@vampire0

The problem comes down to modern versions of SystemD have changed the
locking mechanism they use for updated /etc/passwd and likely other
files. They are hard-coded now to use the Linux-specific
`fcntl(F_OFD_SETLKW)` instead of the older, POSIX-compliant
`fcntl(F_SETLKW)`. While the latter is implemented under WSL1, albeit as
a no-op it seems, they don't implement the former and instead return the
EINVAL errno. This causes all uses of `systemd-sysusers` in various
post-install scripts in Debian packages to throw an error and fail to
finish their upgrade.

I have been able to workaround it by modifying each postinst script that
calls `systemd-sysusers` in /var/lib/dpkg/info/*.postinst to ignore
errors on the call to systemd-sysusers. I added `|| true` to the end of
each line running that command. This allowed all the post-install
scripts to print out the error, but otherwise proceed and complete
successfully as far as `dpkg` is concerned. The users, however, were not
created and it's possible some services are broken, but I have not seen
any issues yet. They can be manually created latter if needed.

The only real fix for this issue is a modified systemd package which
changes the locking mechanism to one that is supported (or claims to be
supported) by WSL1. A change of the ofd argument from `true` to `false`
of the calls to `fcntl_lock()` inside `unposix_lock()` and
`unposix_unlockpp()` in the file src/basic/lock-util.c should do it. A
slightly better patch would be to have it detect the lack of support for
F_OFD_SETLKW or WSL1 and fallback to the other locking mechanism.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2069555

Title:
  Failed to take /etc/passwd lock: Invalid argument on upgrade

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2069555/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to