Can’t upgrade Ubuntu 18.10 to 19.10
(Major update: see this blog post for a workaround to upgrade from 18.10.)
I’ve got an Ubuntu 18.10 (cosmic) system. I want to upgrade it to the latest (19.10, eoan). I understand I probably have to upgrade it to 19.04 (disco) first, that’s fine.
Except I can’t.
# do-release-upgrade
Checking for a new Ubuntu release
Your Ubuntu release is not supported anymore.
...
An upgrade from 'cosmic' to 'eoan' is not supported with this tool.
That’s it. No options to help. I get it, 18.10 isn’t supported anymore. But it’s only 15 months old. Surely the old upgrader files are lying around somewhere?
So off to the cargo cult Internet I go.
First thing that looks promising is “How to install software or upgrade from an old unsupported release?” They advise using the old-releases sources as a way to get, well, old releases. That seems promising except following the advice about updating sources.list and running apt update doesn’t work
# apt update
Err:9 http://old-releases.ubuntu.com/ubuntu cosmic Release
404 Not Found [IP: 91.189.88.153 80]
E: The repository 'http://old-releases.ubuntu.com/ubuntu cosmic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
So something about the source repo directory structure doesn’t match what apt wants? Or did Ubuntu somehow screw up the release signatures? Beats me.
So I went in to sources.list and tried hacking them all to include [trusted=yes], to ignore this error. Yeah, that’s a scary idea. Doesn’t work though. Or rather “apt update” seems to run an O(n^2) update on 124 different URLs, for ~15,000 separate updates. Or something, I dunno, it’s clearly wrong.
I’m stuck. I understand Ubuntu’s support window, or I thought I did. I didn’t realize that being just a few months out of date left you out in the cold forever. I think a full reinstall is my only option.
Update
I tried asking on FreeNode #ubuntu. No one there knew an answer. Got some suggestions on things to try though. By far the best solution is a full reinstall, but I really hope not to do that. The other suggestion is sort of documented here: basically you just hack your sources list and rely on apt-get dist-upgrade to correctly upgrade the system, bypassing the do-release-upgrade script entirely.
My concern is that do-release-upgrade does some extra thing, like modifying config files, that the dist-upgrade won’t do. But after talking about it I think that’s not true, apt really should be able to do the job. I also remember now I had trouble with do-release-upgrade once before and relied on apt to finish an upgrade for me and it worked fine. It may be it’s OK not to run that script.
Update 2
I updated a different system from 19.04 to 19.10 using do-release-upgrade. It sure didn’t look like that script was doing much other than setting up sources and running apt. I think doing this by hand for my 18.10 system (to 19.04 first, then 19.10) is OK.
Update 3
I went a little further down the rabbit hole of “what does do-release-upgrade” actually do. Useful resources: this old Stack question, this gist essay.
A key thing it does is download an updater from a metadata file and presumably run it. (There’s a shell script named “disco”). It might work to do that by hand, or else you can inspect it to try to figure it out. It’s a lot of code though.
I downloaded the disco updater (which is for 18.10 -> 19.04) and took a quick look. A specific thing to inspect is DistUpgradeQuirks.py. The disco updater has a couple of quirks. IT checks if you’re on an i386 and refuses to run. And it runs a function called _replaceDebsWithSnaps(), which is sort of self explanatory. I didn’t bother trying to figure out which debs were involved. There’s also a list of demoted packages which I imagine is a way to remove obsolete stuff. The powerpc build chain features prominently in the disco version.
So anyway, I now know that do-release-upgrade is doing more than just setting up sources and running apt. But it’s not doing a lot more, at least than I can see, and ignoring that stuff may be safe.