I just now had this same issue moving from Debian Stretch
to Sid
in WSL, which is why I landed on this question searching for a fix.
Luckily, I was able to mitigate it fairly easily.
I apologize for responding with a WSL-specific answer to your question, but anything I mention here not specific to WSL should work on a regular Debian distro, too. The packages are the same on either platform.
For an example of a WSL-specific command translation, if you're not using WSL you could replace wsl --terminate Debian
with systemctl reboot
, or wsl -u root
with logging on as root to a freshly rebooted system.
Here's how I solved the libc
mismatch problem I was having:
I downloaded libc6
and libcrypt
.deb
files from a local Debian mirror and installed them manually.
If having trouble executing privileged commands, as I was due to the libc
mismatch, you can run wsl -u root
to enter the WSL container (in regular Debian, simply login as root user directly).
Inside WSL, create a folder for your .deb
s and use wget
to get these two files (links are amd64 versions):
libc6 2.34
: http://ftp.us.debian.org/debian/pool/main/g/glibc/libc6_2.34-4_amd64.deb
libcrypt1_4.4.28-2
: http://ftp.us.debian.org/debian/pool/main/libx/libxcrypt/libcrypt1_4.4.28-2_amd64.deb
If you don't have wget
, and obviously can't run apt
in order to install it, you'll have to try curl -O $LINK
, or download a binary distribution of either (Google for it).
Install libc
first using dpkg
:
# dpkg -i libc6_2.34-4_amd64.deb
Then install libcrypt
:
# dpkg -i libcrypt1_4.4.18-4_amd64.deb
After a big OS infrastructure update like libc
, exit
WSL prompt and run wsl --terminate Debian
from CMD prompt (or reboot machine if not WSL), then enter again with wsl -u root
(or login as root if not WSL). This is basically as close as you can get to a reboot in WSL.
Then try running apt dist-upgrade -y
(make sure you're refreshed your apt cache recently using apt update
prior), and it should pull the rest of your system up to the new dependency plateau created by installing libc6 2.34
for Bookworm.
Basically, the idea here is to add as many packages as necessary before you can run an upgrade automatically. For me it took these two packages.
If you get a message to run apt --fix-broken install
, try it, then try apt dist-upgrade
again.
Contrary to other instructions that say run apt upgrade
before apt dist-upgrade
, that shouldn't be necessary now since you've already installed the big pieces. You can do it first if you want to, or run into problems, though.
I also ran into this little snafu:
Preparing to unpack .../util-linux_2.38.1-1_amd64.deb ...
Unpacking util-linux (2.38.1-1) over (2.29.2-1+deb9u1) ...
dpkg: error processing archive /var/cache/apt/archives/util-linux_2.38.1-1_amd64.deb (--unpack):
trying to overwrite '/bin/findmnt', which is also in package mount 2.29.2-1+deb9u1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/util-linux_2.38.1-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
TL;DR if you just want the command, I put it under spoiler towards the end. If you'd rather follow the process of how I got there, read on ...
This could basically happen with any number of packages, in this case it's trying to install util-linux
with an incompatible version of mount
installed. To verify this was the case, I ran this little for
loop, which checks upgradable packages for the two conflicting packages, respectively (the 2>/dev/null
filters out that annoying WARNING: Cli interface blah blah
message):
# for i in util-linux mount; do apt list --upgradable 2>/dev/null | grep $i; done
util-linux/unstable 2.38.1-1 amd64 [upgradable from: 2.29.2-1+deb9u1]
mount/unstable 2.38.1-1 amd64 [upgradable from: 2.29.2-1+deb9u1]
If your conflicting packages are different, just make $i
reflect whichever packages you're checking your apt list --upgradable
list for, such as for systemd systemd-resolved; do ...
or whatever the package names may be.
If they both show up in the list, bingo, they need to be installed using different timing, or in my case needed to overwrite one or the other while a conflicting version was installed.
dpkg
has a flag called --force-overwrite
, but how to run in apt
? The -o
flag!
# apt -o Dpkg::Options::="--force-overwrite" --fix-broken install
spoiler You should probably add it to your dist-upgrade
way back towards the beginning
# apt -o Dpkg::Options::="--force-overwrite" dist-upgrade
After all that, reboot your system (exit
, C:\> wsl --terminate Debian
) and enter it again, this time as your normal user, and see if stuff like sudo
and passwd
work now.
Can also check to see if the upgrade is reflected:
$ clear && uname -a; cat /etc/debian_version; cat -n /etc/os-release
Linux marmot 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 GNU/Linux
bookworm/sid
1 PRETTY_NAME="Debian GNU/Linux bookworm/sid"
2 NAME="Debian GNU/Linux"
3 ID=debian
4 HOME_URL="https://www.debian.org/"
5 SUPPORT_URL="https://www.debian.org/support"
6 BUG_REPORT_URL="https://bugs.debian.org/"
Install neofetch
for more fun identification:
$ neofetch
_,met$$$$$gg. avery@marmot
,g$$$$$$$$$$$$$$$P. ------------
,g$$P" """Y$$.". OS: Debian GNU/Linux bookworm/sid on Windows 10 x ,$$P' `$$$. Kernel: 5.10.102.1-microsoft-standard-WSL2
',$$P ,ggs. `$$b: Uptime: 22 hours, 27 mins
`d$$' ,$P"' . $$$ Packages: 399 (dpkg)
$$P d$' , $$P Shell: bash 5.2.0
$$: $$. - ,d$$' Terminal: Windows Terminal
$$; Y$b._ _,d$P' CPU: Intel i5-6300U (4) @ 2.495GHz
Y$$. `.`"Y$$$$P"' Memory: 71MiB / 6219MiB
`Y$$
`Y$$.
`$$b.
`Y$$b.
`"Y$b._
Hope this helps someone.