Skip to content

Instantly share code, notes, and snippets.

@swtornio
Created May 12, 2025 17:52
Show Gist options
  • Save swtornio/902a21379cd39ef6ebcd9071a157e370 to your computer and use it in GitHub Desktop.
Save swtornio/902a21379cd39ef6ebcd9071a157e370 to your computer and use it in GitHub Desktop.
bypass etc/passwd lock error for apt upgrade in wsl1
# 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