I’m in a situation where I need to upgrade ~20 LXD containers from 16.04 to 18.04 to 20.04. I’ve created a test container to see how well this will work. Due to the large number of containers, I’d prefer not to sit around answering questions - . Google hunting revealed
Hi,
Firstly, you have to install apt install ubuntu-release-upgrader-core package to execute the related command do-release-upgrade -f DistUpgradeViewNonInteractive.
for k in $(lxc ls --format csv -c n); do lxc exec $k -- more do-release-upgrade -f DistUpgradeViewNonInteractive; done
Thanks @cemzafer - that was not mentioned in the several places I saw it provided as an answer.
I’ll go back and add notes where I can - like on this askubuntu answer.
EDIT: Before performing the upgrade on the test container, I had created a snapshot. So I decided to restore the snapshot, install ubuntu-release-upgrader-core then redo the do-release-upgrade. Oddly, I got this when I went to install it:
Details
# apt install ubuntu-release-upgrader-core
Reading package lists... Done
Building dependency tree
Reading state information... Done
ubuntu-release-upgrader-core is already the newest version (1:16.04.32).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
# cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.7 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.7 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
From this:
Does it mean that the prompts that came up cannot be silenced?
If I ought not to be getting prompted, should I raise a bug to have this corrected?
–Cheers.
EDIT2:
I noticed you used a different command to mine when doing the upgrade - specifically:
lxc exec testupgrade -- more do-release-upgrade -f DistUpgradeViewNonInteractive
However, for me, that resulted in:
$ lxc exec testupgrade -- more do-release-upgrade -f DistUpgradeViewNonInteractive
more: stat of do-release-upgrade failed: No such file or directory
more: stat of -f failed: No such file or directory
more: stat of DistUpgradeViewNonInteractive failed: No such file or directory
Takes about 28 minutes to upgrade from 16.04 to 18.04
EDIT - Strike that:
However, attempting to run the command again, to go from 18.04 to 20.04, I got the following output:
$ ssh root@10.12.12.73 bash -s <<<"do-release-upgrade -f DistUpgradeViewNonInteractive"
Checking for a new Ubuntu release
Please install all available updates for your release before upgrading.
On an EC2 instance on AWS it successfully upgraded without these prompts. I suspect that wherever LXC is getting upgrade packages from, they are not the latest hence this error.
In addition, at the end of the upgrade from 16.04 to 18.04, removal of friendly-recovery fails as it is trying to do some grub stuff which of course fails in the container. I have to edit both friendly-recovery.postinst and friendly-recovery.postrm to remove reference to grub for the removal to complete successfully.
After manually installing all pending updates, the container was now at 20.04.3.
I’ll revert the snapshot and run through the process one more time then I’ll be ready to do it on production containers.