Recovering a failed Ubuntu upgrade

Sometimes an Ubuntu in-place upgrade will error, failing to install packages like:


At the end of the install, the Ubuntu upgrade installer said the install had failed, and it was going to revert with dpkg --configure -a. That will typically also fail. As a last resort, consider a recovery procedure as below. This will keep the new Ubuntu version if it works.

Open a second Terminal, WITHOUT clicking close on that dialog:

apt install gvfs init systemd-sysv

In the same new Terminal: