Gradual Migration to a more self contained /usr (Moving parts of /etc, /boot and /var to /usr)
💡
Idea proposal Checks
NOTE: The below check boxes must be checked before the accompanying idea will be considered.
-
I have checked that the idea is not directly tied to a specific project For example: "Show label icons in the package overview web page" must be a feature request in the ArchWeb repository -
I have carefully checked this idea is not already covered by any open or closed ideas. -
I understand that I hold no copyright claims and that this idea can be adapted and used by Arch Linux in any arbitrary shape or form.
Summary
The concept is that to slowly moved installed packages from outside /usr and /opt to inside. Directories like /var will still have configs but not be managed as pacman.
Motivation
This setup is usually found on immutable oses like microos and silverblue. Arch although mutable will still benefit from this idea. For example it will allow / to mounted ro without effecting /var which is useful when one want to use dm-verity or recover from btrfs snapshots. Another advantage is that config and state can be reseted easily without downloading and reinstalling packages.
Specification
We need to slowly reduce files and folders installed outside a set of blessed folders which my opinion should be /usr and /opt.
The first step will be moving the few files in /boot that are handled by pacman. I am not sure what is the best solution to handle the microcode stuff which is the biggest offender here.
For empty folders that are created in PKGBUILDs could be created by systemd-tmpfiles. In most cases here, we will be replacing 'install at build time' with systemd-tmpfiles. Systemd tmpfile can be overriden allowing those file and folder to be blocked from being created.
If upstream of a library also supports distro config to be installed in /usr and overrideable in /etc, the packages should move the distro config to the respected folders example pam config should be installed in /usr/lib/pam.d. I would also prefer if we could do the same with /etc/profile.d.
This should not be a hard ban, and the migration can take years. There is no need to start patching applications.
On a similar vein, can folders in filesystem like /dev or /mnt be auto generated by systemd(via tmpfiles aor similar actions) if it does not exist? That will be useful way to deal with this proposal.