An image of Hugh Rawlinson's face

Solved again! Ubuntu Updater fails with Snap in WSL

I noticed today that my shell is running an old version, fish@3.3, and I wanted fish 3.5. Strangely, despite using the dedicated PPA, I wasn't eligible for the latest package. Turns out I was on an EoL ubuntu distro! Time to do-release-upgrade. I hope it's not as painful as the last time.

Dear reader.

It was.

I also wrote a blog post the last time I tried to do this, which was evidently too long ago. You can read that to catch up, but the gist of it is that in WSL, Ubuntu doesn't support the Snap store, but the Ubuntu dist upgrade script expects Snap to be there, and when it doesn't find it, it quietly (almost silently in fact) exits and leaves you high and dry.

In actual fact, there's a log file at /var/log/dist-upgrade/main.log that will output precisely one line and error message indicating that the part of the updater that checks connectivity with the snap store experienced a timeout, and that the upgrade abort sequence was initiated. Having remembered that this file exists, I checked my old blog post for the path name, looked at the file, and sure enough found the line.

At this point I thought "this is a problem I have already solved, I will follow my instructions from last time and get on my merry way (I was meant to be making a website this evening)". As per my instructions I removed snap and tried the command again, expecting the script to not check connectivity to the snap store because snap isn't installed.

No dice.

After some spelunking through the upgrade package I found the part that checks snap store connectivity. There were no obvious ways to simply trigger an alternative branch by messing with my computer state - no config env vars, no packages to install/uninstall etc. Maybe the maintainers have considered this bug.

It looks like they have, and they even have a patch! Hooray! Thanks, maintainers! But it looks like the patch isn't in our upgrade bundle.

My detail-free impression slash guess as to the way the Ubuntu dist upgrader works is:

  1. Ubuntu ships a script in its distribution that will check a repository for an applicable dist upgrade bundle
  2. The script downloads the upgrade bundle from the repository to tmp and executes it.

This presents a problem - manually patching the bundle between the time that the upgrade script downloads the bundle and executes the code in the bundle would be ...difficult.

So, I get that monkey patching your OS's dist upgrade code is bad. You could introduce a bug that breaks the upgrade somehow, and suddenly all your data's gone. In WSL this is presumably particularly bad, considering you don't have nice easy access to the filesystem when your WSL installation doesn't boot. I want to be clear: I'm not suggesting that you monkey patch your OS's dist upgrade code.

But that's exactly what I did. I was mediumly confident in doing so having seen a patch in the official repository that skipped the branch in question. Should I have backed up my files first? You bet. But it's been a day, I've had fights with file encoding, and it's dinner time, so I am fresh out of the will necessary to make stuff happen on

So I'm not saying "do this"; I'm saying "here's what I did, I'm tired, it's time for a break".