It appears to be a known issue that WSL1 does not support F_OFD_SETLKW, which is what systemd is using here. I could add a fallback to use F_SETLKW instead, but according to [1], it sounds like the locking is just broken on WSL1? So the "fallback" would probably lead to even more issues.
Do you get the same error in the "WSL2 and systemd disabled" case? I don't understand why disabling systemd would change anything related to the kernel. [1] https://github.com/Microsoft/WSL/issues/1927 ** Bug watch added: github.com/Microsoft/WSL/issues #1927 https://github.com/Microsoft/WSL/issues/1927 -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to systemd in Ubuntu. https://bugs.launchpad.net/bugs/2080257 Title: [WSL] systemd fails to upgrade on WSL1 Status in systemd package in Ubuntu: Confirmed Bug description: Original report: https://github.com/ubuntu/WSL/issues/493 On WSL with systemd disabled (wsl1 or wsl2 without systemd enabled), systemd fails to upgrade. # Test Case WSL1 1. Install Ubuntu 24.04 with WSL from a Windows shell wsl --install --enable-wsl1 ubuntu-24.04 or wsl --install ubuntu-24.04 wsl --set-version ubuntu-24.04 1 => Verify that 24.04 is using version 1 NAME STATE VERSION Ubuntu-22.04 Stopped 2 Ubuntu-24.04 Running 1 2. Start the distro if it is not already running ubuntu2404.exe 3. In the distro run the following command: sudo apt install --reinstall systemd # Expected result systemd is reinstalled without any issue # Actual result systemd postinst script fails and the following error is displayed to the user: ``` root@drenec:~# apt install --reinstall systemd Reading package lists... Done Building dependency tree... Done Reading state information... Done 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 2 not upgraded. Need to get 3470 kB of archives. After this operation, 0 B of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 systemd amd64 255.4-1ubuntu8.4 [3470 kB] Fetched 3470 kB in 1s (2816 kB/s) (Reading database ... 40771 files and directories currently installed.) Preparing to unpack .../systemd_255.4-1ubuntu8.4_amd64.deb ... Unpacking systemd (255.4-1ubuntu8.4) over (255.4-1ubuntu8.4) ... Setting up systemd (255.4-1ubuntu8.4) ... 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 Processing triggers for dbus (1.14.10-4ubuntu4.1) ... Processing triggers for man-db (2.12.0-4build2) ... Errors were encountered while processing: systemd E: Sub-process /usr/bin/dpkg returned an error code (1) ``` There is no easy way to recover from the error. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2080257/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp