Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#77831 - [ntp] dead link to /var/lib/ntp after uninstall

Attached to Project: Arch Linux
Opened by Markus R. (mqus) - Monday, 13 March 2023, 00:06 GMT
Last edited by Toolybird (Toolybird) - Saturday, 16 September 2023, 00:23 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Lukas Fleischer (lfleischer)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

The /var/lib/ntp directory should probably be a [tmpfiles configuration](https://wiki.archlinux.org/title/Systemd#systemd-tmpfiles_-_temporary_files) instead of being part of the package, because it gets
"out of sync" after uninstalling ntp and fails the periodic pwck check (of the shadow package), since users created by sysusers conf files are not removed after removal of the file

I have no clue if this is feasible or if there are other constraints here, though.

Additional info:
* package version:4.2.8.p15-3

Steps to reproduce:
1. Install ntp
2. Uninstall ntp (`pacman -R ntp`)
3. Run `systemctl start shadow.service` (which checks user db integrity)

Step 3 fails because the user ntp is still there (it won't get removed just because the sysusers conf is no longer there) but the referenced directory is not there anymore:

```
× shadow.service - Verify integrity of password and group files
Loaded: loaded (/usr/lib/systemd/system/shadow.service; static)
Active: failed (Result: exit-code) since Mon 2023-03-13 00:47:51 CET; 9min ago
Duration: 45ms
TriggeredBy: ● shadow.timer
Process: 130331 ExecStart=/bin/sh -c /usr/bin/pwck -r || r=1; /usr/bin/grpck -r && exit $r (code=exited, status=1/FAILURE)
Main PID: 130331 (code=exited, status=1/FAILURE)
CPU: 42ms

Mar 13 00:47:51 host systemd[1]: Started Verify integrity of password and group files.
Mar 13 00:47:51 host sh[130334]: user 'ntp': directory '/var/lib/ntp' does not exist
Mar 13 00:47:51 host sh[130334]: pwck: no changes
Mar 13 00:47:51 host systemd[1]: shadow.service: Main process exited, code=exited, status=1/FAILURE
Mar 13 00:47:51 host systemd[1]: shadow.service: Failed with result 'exit-code'.
```

This task depends upon

Closed by  Toolybird (Toolybird)
Saturday, 16 September 2023, 00:23 GMT
Reason for closing:  Fixed
Additional comments about closing:  shadow 4.13-3
Comment by loqs (loqs) - Monday, 13 March 2023, 01:21 GMT
What if ntp's home directory is changed to /nonexistent ? See also NONEXISTENT in [1].

[1] https://man.archlinux.org/man/core/shadow/pwck.8.en
Comment by Toolybird (Toolybird) - Tuesday, 14 March 2023, 03:44 GMT
This sounds like a generic problem that could apply to more pkgs than just ntp? Maybe pkgs that create user accounts via sysusers should clean up after themselves upon uninstallation in a post_remove hook or something?

Anyway, doesn't seem like a big deal. Possibly fits into the "sysadmin" category of clean-up tasks that Arch users are supposed to take care of themselves.
Comment by Markus R. (mqus) - Tuesday, 14 March 2023, 19:56 GMT
> This sounds like a generic problem that could apply to more pkgs than just ntp
It probably isn't that widespread because most packages use both sysusers and tmpfiles or none of them, which leaves either a user as well as their /var/lib folder intact after removal or it doesn't with both. But I haven't checked.

> Anyway, doesn't seem like a big deal. Possibly fits into the "sysadmin" category of clean-up tasks that Arch users are supposed to take care of themselves.

I don't agree fully. Sure, users are responsible for cleaning up app data after removal, but uninstalling a package shouldn't break checks of the base install imho.
Comment by loqs (loqs) - Tuesday, 14 March 2023, 22:59 GMT
> Maybe pkgs that create user accounts via sysusers should clean up after themselves upon uninstallation in a post_remove hook or something?
The user / group can not be removed as it prevents files / directories becoming owned by a ID that could then be reused. The files / directories cleanup assumes the user did not want to preserve those files.

> It probably isn't that widespread because most packages use both sysusers and tmpfiles or none of them, which leaves either a user as well as their /var/lib folder intact after removal or it doesn't with both. But I haven't checked.
$ comm -12 <(pacman -qF /var/lib/ | sort -u) <(pacman -qF /usr/lib/sysusers.d/ | sort -u)
Followed by manual inspection gives
community/backuppc
community/consul
community/ejabberd
community/gerbera
community/gitlab-shell
community/glusterfs
community/keycloak
community/libvirt
community/minio
community/moosefs
community/mopidy
community/munge
community/munin
community/munin-node
community/openntpd
community/opensearch-dashboards
community/pcp
community/prosody
community/puppet
community/swtpm
community/tarantool
community/wallabag
community/zeroc-ice
core/nfs-utils
extra/gdm
extra/ntp
extra/postfix
extra/spamassassin
extra/tomcat10
extra/tomcat8
extra/tomcat9
Home directories outside /var/lib that could be removed were only encountered by chance so the above is not a complete list. Many of the packages above use tmpfiles, just not for the creation of the sysuser's home directory.

Loading...