Created
May 12, 2025 17:52
-
-
Save swtornio/902a21379cd39ef6ebcd9071a157e370 to your computer and use it in GitHub Desktop.
bypass etc/passwd lock error for apt upgrade in wsl1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Move the dpkg info directory out of the way | |
sudo mv /var/lib/dpkg/info /var/lib/dpkg/info_silent | |
# 2. Recreate an empty info directory so dpkg won’t error out on missing files | |
sudo mkdir /var/lib/dpkg/info | |
# 3. Refresh and fix any half-installed packages | |
sudo apt-get update | |
sudo apt-get -f install | |
# 4. Move any newly unpacked package info into the backup | |
sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info_silent | |
# 5. Restore the original info directory and clean up | |
sudo rm -rf /var/lib/dpkg/info | |
sudo mv /var/lib/dpkg/info_silent /var/lib/dpkg/info | |
# 6. Finally, update and complete the upgrade | |
sudo apt-get update | |
sudo apt-get upgrade |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment