WhitewaterFoundry / Pengwin

A Linux distro optimized for WSL based on Debian.
Other
1.48k stars 105 forks source link

systemd Update Error Blocking All Updates #789

Closed PeteSL closed 2 months ago

PeteSL commented 2 months ago

Describe the bug Recently, running pengwin-setup update in a WSL1 instance, the update tried to update systemd and associated components. It failed with an error and now fails before trying to update any new packages.

To Reproduce run pengwin-setup update in a WSL1 instance which will fail updating systemd.

Expected behavior apt update should not fail but maybe systemd shouldn't be updated?

Screenshots This is the error information: Setting up systemd (254.15-1~bpo12+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)

Additional context WSL1, not WSL2

Basic Troubleshooting Checklist I have run sudo apt update and apt upgrade and upgrade causes the error as well.

Pengwin Version PENGWIN_VERSION="24.07.0"

WSL general info

Release Install Date: Sun Oct 16 06:52:16 CDT 2022 Branch: ni_release Build: 22631 Full Build: 22621.1.amd64fre.ni_release.220506-1250 Display Scaling: 1 Locale (Windows): en_US Theme (Windows): dark Uptime (Windows): 0d 6h 46m Version (WSL): 1 Uptime (WSL): 0d 0h 9m Release: Pengwin Kernel: Linux 4.4.0-22621-Microsoft Packages: 726 IPv4 Address: 192.168.181.8 System Type (Windows): Desktop SystemD Status: N/A

PeteSL commented 2 months ago

Good or bad, I have been able to resolve issue, although not sure if other damage might have been done. Per an online article regarding this type of error, I did the following which appears to have resolved it (please verify no other damage done):

sudo rm /var/lib/dpkg/info/systemd*
sudo dpkg --configure -D 777 systemd
sudo apt -f install
PeteSL commented 2 months ago

I now get this when apt update/upgrade is run:

dpkg: warning: files list file for package 'systemd-sysv' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'systemd' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'systemd-dev' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'systemd-timesyncd' missing; assuming package has no files currently installed

It make sense since the systemd file lists were deleted in the first step of the recovery. Everything is working. Please advise if I need to do a reinstall of systemd.

crramirez commented 2 months ago

It looks good. But after we test it, we cannot be certain that everything is working .

Since it is WSL1 I don't see any immediate problem with this approach

crramirez commented 2 months ago

ok @PeteSL

to put your system in good shape do the following:

sudo apt install opensysusers -y
sudo apt install --reinstall systemd systemd-dev systemd-timesyncd

For more information check this: https://github.com/microsoft/WSL/issues/10397 and https://superuser.com/questions/1803992/getting-this-error-failed-to-take-etc-passwd-lock-invalid-argument

For others facing this issue it is better to go this way:

sudo mv /var/lib/dpkg/info/systemd-timesyncd.postinst /tmp/
sudo mv /var/lib/dpkg/info/systemd.postinst /tmp/
sudo dpkg --configure -a

sudo apt install -y opensysusers 

sudo mv /tmp/systemd-timesyncd.postinst /var/lib/dpkg/info/
sudo mv /tmp/systemd.postinst /var/lib/dpkg/info/
sudo apt upgrade -y

We will issue a fix in pengwin-setup to alleviate this problem

PeteSL commented 2 months ago

Thank you. Done and appears apt update/upgrade is happy again. You can close this with the pengwin-setup fix.

crramirez commented 2 months ago

Now pengwin-setup will install opensysusers if it detects WSL1. On a clean installation it will work, but if the error with systemd is already there, the solution above must be applied.