FS#79001 - [filesystem] Consider adding tmpfiles.d entries for the /var directories

Attached to Project: Arch Linux
Opened by Emil (xexaxo) - Thursday, 06 July 2023, 10:49 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:23 GMT
Task Type Feature Request
Category Packages: Core
Status Closed
Assigned To Sébastien Luttringer (seblu)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

One of my machines has a ro rootfs and designated var/home partitions. Every now and then I would wipe the latter two and effectively "reset" the system.

On a follow-up boot after the wiping, I would notice that only some /var directories are restored/recreated. It appears that not all Arch packages have tmpfiles.d snippets for their /var directories. The filesystem being one of them.

Can we have the entries added? The attached patch has the complete list - it also includes entries that are a) created/owned by the filesystem package itself but are handled by other pre-existing tmpfiles.d snippets.

The latter will result in a couple of warnings such as `/usr/lib/tmpfiles.d/arch.conf:XX: Duplicate line for path "YY", ignoring.` - those are absolutely harmless, although if preferred the entries can dropped.

Thanks in advance


Additional info:
* package version(s)
2023.01.31
This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:23 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/filesystem/issues/5
Comment by Doug Newgard (Scimmia) - Thursday, 06 July 2023, 10:56 GMT
Wiping /var on Arch is a terrible idea, you'll destroy all package management.
Comment by Emil (xexaxo) - Thursday, 06 July 2023, 13:52 GMT
I may have considered this point already - the pacman DBPath does not point to /var ;-)
Comment by Toolybird (Toolybird) - Thursday, 06 July 2023, 22:21 GMT
A read-only rootfs in Arch is not supported out of the box. Niche cases like this are fine for documenting in the Wiki but don't belong in the distro IMHO. If there is no reaction from the maintainers this will be closed as "Won't implement".
Comment by Emil (xexaxo) - Sunday, 09 July 2023, 14:17 GMT
Whether the rootfs is RO or not is an orthogonal implementation detail. I should have known that it might confuse people - sorry about that.

The key premise is that if a package owns some tmpfiles (or having the tool that using them) should also own a tmpfiles.d snippet. Obviously some programs/libraries can recreate their tmpfiles on as-needed basis at runtime, which is perfectly understandable.
That would result in robust systems that just work - systemd itself has been capable of doing that for years [1].

If we look at Arch as a whole - `pacman -F /usr/lib/tmpfiles.d | wc -l` - there are over 200 packages doing so already.

[1] https://systemd.io/BUILDING_IMAGES/
Comment by Doug Newgard (Scimmia) - Sunday, 09 July 2023, 14:29 GMT
Packages tend to do that to set permissions, not to recreate dirs.
Comment by loqs (loqs) - Sunday, 09 July 2023, 14:30 GMT
Do any of the 214 ( pacman -F /var/ | wc -l ) packages that package /var/ provide a tmpfiles snippet covering /var? Should it be handled as a todolist?
Edit:
Answering my own question I think it is 29 of the 214:
dhcpcd
openssh
systemd
amavisd-new
freeipmi
freeradius
gerbera
kafka
libvirt
lighttpd
mailman3
mattermost
moosefs
munge
munin
munin-node
nethack
opensearch
opensearch-dashboards
plocate
prosody
slurm-llnl
swtpm
tang
tomcat10
tomcat8
tomcat9
unrealircd
ziproxy
Comment by Emil (xexaxo) - Sunday, 09 July 2023, 15:25 GMT
(removing duplicate)
Comment by loqs (loqs) - Sunday, 09 July 2023, 15:29 GMT
Why not create a todolist for the 185 packages that currently provide /var/ without a matching tmpfiles.d snippet? Why is this more suitable for a series of bug reports?
Comment by Emil (xexaxo) - Sunday, 09 July 2023, 16:04 GMT
> Packages tend to do that to set permissions, not to recreate dirs.

Not sure I follow - tmpfiles.d supports user/group handling, (re)creating as well as copying from factory.
Comment by Emil (xexaxo) - Sunday, 09 July 2023, 16:06 GMT
How can I create a todo list? I thought only Arch developers can do that.

Looking at this there are few things to consider:
- Which packages do not own a tmpfiles.d snippet? Seemingly 63 packages fall short here.
`comm -12 <(pacman -Fq /var/ | cut -f2 -d'/' | pacman -Fl - | grep tmpfiles.d | cut -f1 -d' ' | sort -u) <(pacman -Fq /var/ | cut -f2 -d'/' | sort -u)` will help here

- Of the ones that do, is it complete?
For that package would need to be fetched and checked via `grep -wr $(pacman -Qql foo | grep ^/var/.) /usr/lib/tmpfiles.d`

- Of the ones that don't, is one provided by another (base/depends) package?
Like "is complete" step, modulo s/fetched/installed/

One could even go further and make this a namcap/lint check ... assuming the idea does not get short down ;-)
Comment by loqs (loqs) - Sunday, 09 July 2023, 16:17 GMT
I would try posting on arch-general or seblu could create it. This does assume there is no need for an RFC for supporting BUILDING_IMAGES [1] or that could be part of larger RFC covering stateless [2], currently only 4 packages use usr/share/factory/.

[1] https://systemd.io/BUILDING_IMAGES/
[2] https://0pointer.net/blog/projects/stateless.html
Comment by Emil (xexaxo) - Sunday, 09 July 2023, 16:32 GMT
Thanks for the stateless link - was looking for it earlier but could not find it.

Do we have a wiki page which outlines how TODO lists are proposed/executed? Should there be a link to https://archlinux.org/todo/?