Short post about fixing a failed ubuntu upgrade

This commit is contained in:
Marcus 2024-10-07 23:28:49 +00:00
parent b0e3126cbf
commit 859ec57f70

View File

@ -0,0 +1,51 @@
---
title: 'Recovering Failed Ubuntu Upgrade'
date: 2024-10-07T22:59:30Z
draft: false
series: "Fun Center"
summary: "Marcus recovers from an aborted Ubuntu Upgrade on his VPS"
tags:
- ubuntu
- how-i-did-it
- technology
---
Forewarning- I tried to ask ChatGPT to help me with this post but it didnt understand and kept misbehaving so I had to forego that for this post. Also I dont normally write about techy stuff so I hope I got it all in the right order.
I use a VPS I got on a black friday sale from [Rack Nerd](https://www.racknerd.com/) and it has been solid for uptime and everything. I run my a few servers up there including my atuin, ntfy, a budgeting app, and some other random one off stuff. I run the nextcloud and other larger storage things at home thanks to Google Fiber/WebPass.
Most of the time I use it as a jump server to connect over to SDF or to wherever else online I'm going and so I dont see my MOTD. A few weekends back I was setting up an [Actual Server](https://actualbudget.org/) aka the budgeting app and I saw that I was out of date and Ubuntu 24.01 was avaialble. Because I'm so good at planning I started up the upgrade and then saw I needed to get to the movies. I hit control c and closed the window. Don't do that!
So I left everything running for a month or so and decided today I would get it going. First I tried the simple
`sudo apt update && sudo apt upgrade`
Update was happy but upgrade was mad. It suggested maybe I should run `sudo apt --fix-broken install` which then also told me to try `sudo apt-get clean` from there I was off to startpage to see if I could find something. I tried `sudo dpkg --configure -a` and I tried `sudo apt upgrade --fix-missing` and `do apt-get -f install` at this point I was starting to get a little desperate. How desperate? Messing with some system level files desperate!
I found a Stack Overflow question and the answers suggested moving the dat files from /var/cache/debconf to a backup directory and then trying to upgrade again. That failed but told me that everything failed because it depended on systemd-sysv. Oooh progress!
At this point when I ran the apt update and then apt upgrade I got a warning about the shadow group cdrom already existing. so I edited the /etc/gshadow file to remove it. Then it was another group. I noticed that they were all groups that had ubuntuf in the last field. I put the cdrom entry back, duplicated the file, and then deleted all the ubuntufs in there. Then I ran `sudo dpkg --configure -a` Hey it finished!
```
Do you want to continue? [Y/n] y
(Reading database ... 147882 files and directories currently installed.)
Preparing to unpack .../systemd-sysv_255.4-1ubuntu8.4_amd64.deb ...
Unpacking systemd-sysv (255.4-1ubuntu8.4) over (249.11-0ubuntu3.12) ...
Setting up systemd-sysv (255.4-1ubuntu8.4) ...
Processing triggers for man-db (2.10.2-1) ...
needrestart is being skipped since dpkg has failed
```
I switched over to root to run these because I was done typing sudo sudo sudo so much
Let's try the apt update .. so far so good
Lets try upgrade .. no not quite there yet
Ok how about `apt --fix-broken install`
Wooo it was installing like crazy.
It wasn't quite done though. I ran apt update and we still had quite a few packages to work on.
One more apt upgrade and then it was time to restart.
After reboot we were on 24.01. Now I need to upgrade postgresql eventually...