-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
createHome attempts to create home directories before local filesystems are mounted #21928
Comments
Mounting zfs datasets via zfs native mounting infrastructure is broken in many places on Linux. Having that said: I suspect that zfs is a special case, because otherwise every service would require Update this is the corresponding upstream bug report: openzfs/zfs#4898 Update here is even a pull request. I will try to review this shortly: openzfs/zfs#4943 |
Thanks for the pointers -- that sheds a lot more light on it for me! It looks like the correct behaviour here is that individual units list the specific mount points that they depend on, and systemd makes sure they don't start until those filesystems are mounted; they don't need to be ordered after local-fs.target, which isn't reached until all local filesystems are mounted. So, e.g., something that depends on /srv but not /home can start up as soon as /srv is mounted even if /home isn't available yet. ZFS breaks that assumption because systemd doesn't know where the zfs mount points are unless you set mountpoint=legacy and manage the mounts by hand (which I haven't been doing for most mounts because I have 30+ datasets). This explains why I'm seeing these problems but things work in general even without an after=local-fs.target ordering, and it also explains why making sure that zfs#4943 looks promising as a "proper" fix for this. In the meantime, making sure that zfs datasets get mounted before sysinit.target seems to be a functioning workaround:
|
Duplicates #6481 |
If a user has
createHome = true
set -- which is the default for normal users and some services, like gitolite -- whatever process tries to create missing home directories runs after/
is mounted but beforelocal-fs.target
is reached. This seems to work ok if all mounts are explicit inhardware-configuration.nix
(although I haven't tested this thoroughly), but breaks if, e.g., you have ZFS datasets that are mounted by thezfs-mount
unit as part of reachinglocal-fs.target
; either services likegitolite-init.service
fail because the home directory they expected to exist hasn't been properly created, orzfs-mount.service
fails because a bunch of home directories have been created in what it expected to be empty mountpoints.On my system
local-fs.target
is reached relatively late (it has a bunch of disks to spin up and zpools to import), so anything that needs local filesystems mounted but doesn't explicitly place itself afterlocal-fs.target
tends to go wrong.This seems like it should be an easy fix (make whatever service creates the home directories
after = ["local-fs.target"]
), but I can't figure out which service does the deed.Technical details
The text was updated successfully, but these errors were encountered: