WSL: Updating `systemd` in WSL1 Kali Linux fails with `Failed to take /etc/passwd lock: Invalid argument`
Windows Version
Microsoft Windows [Version 10.0.19045.3324]
WSL Version
1.2.5.0
Are you using WSL 1 or WSL 2?
- WSL 2
- WSL 1
Kernel Version
4.4.0-19041-Microsoft
Distro Version
Kali Linux
Other Software
No response
Repro Steps
Try to update your system with sudo apt-get update && sudo apt-get dist-upgrade
Expected Behavior
The Update succeeds.
Actual Behavior
Updating the systemd package fails:
Preconfiguring packages ...
Setting up systemd (254-1) ...
Failed to take /etc/passwd lock: Invalid argument
dpkg: error processing package systemd (--configure):
installed systemd package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
systemd
E: Sub-process /usr/bin/dpkg returned an error code (1)
Diagnostic Logs
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 15
FWIW, here is my workaround:
Only thing that worked for me from everything I tried.
+1
sudo sh -c 'cd /bin && mv -f systemd-sysusers systemd-sysusers.org && ln -s echo systemd-sysusers'in case you get a
mv: cannot move 'systemd-sysusers' to 'systemd-sysusers.org': Permission deniederrorThis affects also debian.
While the superuser.com post could give hints, I found it really too much aggressive on the deletion of the /var/lib/dpkg/info folder.
I had to do such instead:
This will actually allow dpkg to “configure” the package, albeit, doing nothing because the postinst script is not here anymore.
I found that both script are using systemd-sysusers command to update passwd / group files according to a conf file. I ensured that my local files are correct comparing to the appropriate conf file.
I have then put them back in place, just for being clean.
Ran into this with Kali-xRDP
Install
opensysusersActually this issue is quite annoying as it happens in all postinst script which calls “systemd-sysusers” to setup users and groups.
My workaround for the moment is to modify /var/lib/dpkg/info/[package-name].postinst and comment the call to systemd-sysusers.
In my environment, disabling postinst script of
polkitdwas needed.Did your windows break because of wsl? now my wsl doesn’t open either. It’s like he just disappeared 😄 o heil windows