-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
On Windows 18362.207, running Debian.
Upgrading to Debian 10 Buster is successful. However, a subsequent sudo apt-get install usrmerge fails, resulting in an installation that's difficult to get to a recoverable state. It partially succeeds, but is unable to complete. It additionally complains that it must succeed before further updates and installations.
This basically requires a user to do a Debian reinstallation to recover from. Oops.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
cerebrate commentedon Jul 11, 2019
Do you happen to recall at what point it failed?
I did the update to buster myself a while back, followed by a usrmerge, and it completed successfully. That said, my update was on 18922, so this may be a fixed-in-later-version issue.
bazald commentedon Jul 11, 2019
I recall vividly. The first point of failure is the attempt to move pam modules directory. On the first of the two failed systems, I made the brilliant move of rsyncing them into place and breaking sudo in the process, because it obviously didn't know where to look for them without the not-yet-present symlink.
skywind3000 commentedon Jul 14, 2019
Has anybody successfully upgraded to buster on windows 18362 (or before) ??
bazald commentedon Jul 19, 2019
The upgrade completes fine. It's the
usrmergecommand that resulted in problems for me. I haven't tried again since applying the July update.nsgautumn commentedon Aug 15, 2021
I was able to reproduce this. By accident, unfortunately. Running usrmerge left me with a broken Debian install in WSL that required a reinstall to recover from.
I tried it again on a fresh install from the Microsoft Store, which gave me Debian 10.9, and it failed the same way. I'm using WSL 1. Not sure if the permission issue is any different under WSL 2.
I'm hoping this is resolved by default when the Debian distro in the store is updated to Debian 11 and I can do a fresh install with merged-usr already applied by default.
nsgautumn commentedon Aug 15, 2021
Followup: usrmerge does work without error when running Debian as WSL 2.
And migrating back to WSL 1 after running usrmerge while in WSL 2 does work as well.
So anyone needing to use WSL 1 and wanting to do a usrmerge, your workaround is to just switch your Debian to WSL 2 first, run usrmerge, and then switch back to WSL 1.
westfly commentedon Oct 19, 2021
Does Anyone try this way?
janpfeifer commentedon Nov 7, 2021
Same problem here, when upgrading my WSL 1.0 from Ubuntu 20.04 to 21.10 the usrmerge+WSL1 broke my installation :( ...
Any guidelines on how to upgrade to WSL2 to run
/usr/lib/usrmerge/convert-usrmergeand then convert back to WSL 1 ?janpfeifer commentedon Nov 7, 2021
Apparently as simple as:
I'm not sure it actually changed, since
wsl -l -vstill listed my "Ubuntu" installation as version 1 ... but after I did this running/usr/lib/usrmerge/convert-usrmergeworked (I wonder if all it needed was a reboot).In any case I moved it back (??) by doing:
And then I bumped into issue #4640, which is then solved by removing a
sudo rm -f /etc/apt/apt.conf.d/20snapd.conf. Notice snapd package had already been removed because it also breaks the upgrade from 20.04 to 21.10 for some obscure reason.maxprehl commentedon Sep 27, 2022
For those who may come later:
Got the same error trying to update my Debian WSL1 install
Converting the WSL1 install to WSL2 made it so that convert-usrmerge could succeed.
Tried running convert-usrmerge (needs sudo) but it works!
Converted back to WSL1 and the rest of my updates are running fine!
boxfire commentedon Sep 28, 2022
Here is a fun hack that worked for WSL1:
The key is 9P FS works even when WSL is shut down.
Lets suppose you already started. If not, the first step is to fail:
I ran into the above issue. However I did the following:
from a root terminal
wsl.exe -u rootin a cmdsudo suwith your PWsu -with root PWnow in a cmd do
wsl --shutdown.In your favorite way from windows:
\\wsl$\Debian\lib\\wsl$\Debian\libtmpto\\wsl$\Debian\lib(I used explorer... I use WSL for a reason, could care less about windows file manipulation command line)
then read and weep:
edit: Fix delete instruction I mistyped, and add instruction from the top in case anybody tries from the top, and its
\\wsl$, not\\$wsltjkirch commentedon Sep 30, 2022
Thanks for these tips @boxfire! This saved my install. I use WSL2, so the other tips about switching to WSL2 didn't apply to me, but yours worked fine. Just one tweak:
This should say to delete
lib, nottmp.boxfire commentedon Oct 1, 2022
Thanks, and fixed. Yeah this saved me big time too, and I refused "convert to WSL2" as any reasonable solution, period.
You can pry my wicked win32 hacks inside WSL1 programs from my cold dead hands...
WSL1 forever!! or rather at least until back to native linux if it sunsets.
4 remaining items
drm commentedon Sep 22, 2023
For anyone googling this, this is the actual solution: https://askubuntu.com/a/1486648/1733922
Scrxtchy commentedon Oct 21, 2023
this didn't work for me, but I moved
C:\Debian\rootfs\usr\lib\x86_64-linux-gnu\securitytoC:\Debian\rootfs\usr\lib\x86_64-linux-gnu\security_1and ranapt upgardewhich generated the same result. It ended up just creating a new security folder in the end, so it looks good to meWe don't have WSL2 on WinServ 2019, so everyone's pointers here has been greatly appreciated
mikegerber commentedon Oct 26, 2023
I also ran into this issue while updating my Debian WSL1 from 11 to 12 (on Windows 10). After migrating to WSL2 temporarily,
usrmergewould succeed and I changed to WSL1 again.zhangboyang commentedon Dec 8, 2023
The root cause is: WSL1 currently doesn't support moving (renameing) directory while some file in that directory is being used. For example, if
/somedir/somefileis being used, thenmv /somedir /somedir2will result inPermission denied.The
sudoprogram uses dynamic libraries in/lib/x86_64-linux-gnu/security/. So if you are usingsudoto execute commands, you will never be able to move that directory. Thus the workaround is: do not usesudoin linux shell, usewsl -u rootin windows command prompt instead.Here are the steps to workaround this specific problem under WSL1:
wsl --shutdownto fully close all linux processes.wsl -u rootto get root access and do fixes in linux shell, you might need to run/usr/lib/usrmerge/convert-usrmergemultiple times.tezhm commentedon Jan 26, 2024
I was getting the following error when upgrading to bookworm while currently on WSL 2:
The problem here is WSL mounts the
modulesdirectory into/libwhen starting up debian.The way I fixed it was downgrading to WSL 1, following @boxfire workaround above (#4279 (comment)), then upgrading back to WSL 2.
There's probably a more sane way to do this where the
modulesdirectory can be configured to mount somewhere else.Fabrice-Hoffmann commentedon Feb 9, 2024
I ran into the same problem as @tezhm. The problem I have is that I can't switch to WSL1. The following error occurs:
wsl --set-version Debian_WSL2 1
Conversion is in progress. This process can take several minutes.
Error: 0xd000000d
Error code: Wsl/Service/0xd000000d
Any ideas?
tezhm commentedon Feb 9, 2024
@pickard1 sorry I am unsure, luckily downgrading to WSL 1 worked for me. The problem is that
/libhas a mounted directorymoduleswhich I'm pretty sure WSL 2 is creating since it doesn't create in WSL 1. If somehow you could configure WSL 2 to not do that then I'm guessing the usrmerge conversion should work without needing to downgrade to WSL 1.Fabrice-Hoffmann commentedon Feb 9, 2024
@tezhm. The question is whether this can be solved configurationally. Of course, this doesn't work on the live system because the resource is always busy. So a umount, for example, won't work like that.
You can't find much information online about what Microsoft is doing... i will try ....
Fabrice-Hoffmann commentedon Feb 9, 2024
I did it. :-)
After I set the mountFsTab=false option in [automount] in wsl.conf, I was able to remove the mountpoints for /lib/modules. Then the upgrade went through!!
JtMotoX commentedon Mar 16, 2024
Thank you @pickard1 ! This worked for me.
Here are the exact steps I performed.
I edited my .wslconfig and added:
Then I performed a
wsl.exe --shutdownandwsl.exe -u root. Then I ranmount | grep '\/usr\/lib\/'to get a list of the mounts in use (there were 4). I then began runningumount /usr/lib/...for each of these. Some of them are dependent on each other so it might fail to unmount until you unmount one of the others. Once you get them all unmounted, then run/usr/lib/usrmerge/convert-usrmerge.If that completed successfully, then remove the entry you added in the .wslconfig and do another wsl.exe --shutdown.
eddyp commentedon Mar 26, 2024
Had the same issue with Debian, while upgrading from buster to bookworm.
One thing to mention is the wsl command effectively terminated the running session (I didn't knew if it needed to be closed during the
wsl --set-version Debian 2I didn't try switching back to WSL 1 as I find no reason at this point.I switched back to WSL1 because the DNS integration didn't work anymore for me (my employer uses zscaler and had to import the CA root certificate as suggested in this post: https://stackoverflow.com/questions/72167566/wsl-docker-curl-60-ssl-certificate-problem-unable-to-get-local-issuer-certi/73497278#73497278).Yes, just disable the sanpd integration:
sudo mv /etc/apt/apt.conf.d/20snapd.conf{,.disabled}#4640 (comment)
Opposite34 commentedon May 4, 2024
Seconding #4279 (comment), I had to
sudo apt installsomething on my wsl (Debian Bookworm) and it got the same error. So I downgraded to WSL1, do what #4279 (comment) suggested, and upgraded back to WSL2. Once that's done, everything worked and the issue is solved.I would still recommend you have a backup before doing this because it is still sketchy.
kristjanvalur commentedon Jun 27, 2024
I came here because of problems upgrading WSL2 version of Ubuntu 20 to 22.
What happened was that
usrmergewas unable to mv/lib/modulesto/usr/lib/modulesbecause of the presence of the WSL2 kernel in/lib/modules.The solution was to temporarily switch back to WSL version 1. Then, run
dpkg --configure -ato finish the failed install. Finally switch back.WSL will place the kernel in the old place,
/lib/modulesand not/usr/lib/modulesbut at least usrmerge has finished and won't complain.bmaehr commentedon Apr 14, 2025
For Ubuntu do-release-upgrade it must be
ln -s usr/lib /libtmp.Renaming/Deleting the directory is possible in Windows even if the wsl machine is dead in the Explorer finding the folder
rootfs. It is in