[LINUX] Upgrade from Ubuntu 20.04 LTS (Focal Fossa) to Ubuntu 20.10 (Groovy Gorilla)

Overview

--Upgrade from Ubuntu 20.04 LTS (Focal Fossa) to Ubuntu 20.10 (Groovy Gorilla) --Perform the upgrade while connected by ssh from the outside

Check the version before upgrade

Confirm that it is 20.04 focal.

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.1 LTS
Release:	20.04
Codename:	focal

Check the package repository before upgrade

Make sure focal is specified in sources.list.

$ grep ^deb /etc/apt/sources.list
deb http://jp.archive.ubuntu.com/ubuntu focal main restricted
deb http://jp.archive.ubuntu.com/ubuntu focal-updates main restricted
deb http://jp.archive.ubuntu.com/ubuntu focal universe
deb http://jp.archive.ubuntu.com/ubuntu focal-updates universe
deb http://jp.archive.ubuntu.com/ubuntu focal multiverse
deb http://jp.archive.ubuntu.com/ubuntu focal-updates multiverse
deb http://jp.archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu focal-security main restricted
deb http://security.ubuntu.com/ubuntu focal-security universe
deb http://security.ubuntu.com/ubuntu focal-security multiverse

Check the external package repository before upgrade

In this environment, NodeSource is set as the external package repository for Node.js. Check the files under /etc/apt/sources.list.d.

$ cat /etc/apt/sources.list.d/*
deb https://deb.nodesource.com/node_14.x focal main
deb-src https://deb.nodesource.com/node_14.x focal main
$ dpkg -l | grep nodejs
ii  nodejs    14.15.3-deb-1nodesource1    amd64    Node.js event-based server-side javascript engine

Update pre-upgrade package

Keep the package structure clean.

$ sudo apt update
$ sudo apt upgrade
$ sudo apt dist-upgrade
$ sudo apt autoremove
$ sudo reboot

Preparing update-manager

Install the update-manager-core package.

$ sudo apt install update-manager-core

Specify Prompt = normal in the/etc/update-manager/release-upgrades file.

$ cat /etc/update-manager/release-upgrades
# Default behavior for the release upgrader.

[DEFAULT]
# Default prompting and upgrade behavior, valid options:
#
#  never  - Never check for, or allow upgrading to, a new release.
#  normal - Check to see if a new release is available.  If more than one new
#           release is found, the release upgrader will attempt to upgrade to
#           the supported release that immediately succeeds the
#           currently-running release.
#  lts    - Check to see if a new LTS release is available.  The upgrader
#           will attempt to upgrade to the first LTS release available after
#           the currently-running one.  Note that if this option is used and
#           the currently-running release is not itself an LTS release the
#           upgrader will assume prompt was meant to be normal.
Prompt=normal

Check if there is a version that can be upgraded

$ sudo do-release-upgrade -c
Checking for a new Ubuntu release
New release '20.10' available.
Run 'do-release-upgrade' to upgrade to it.

Perform upgrade

This time, the upgrade will be performed while connected by ssh from the outside, so open the 1022 port of the firewall if necessary.

$ sudo iptables -I INPUT -p tcp --dport 1022 -j ACCEPT
$ sudo iptables -L
Chain INPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:1022
(The following is omitted)

Perform an upgrade.

$ sudo do-release-upgrade
Checking for a new Ubuntu release
(Omission)
Checking the package manager

I'm running via SSH, do you want to continue?


This session seems to be running on SSH. It is not recommended to upgrade over SSH. This is because it will be difficult to restore if the upgrade fails.

Port additional SSH daemons if you want to continue'1022'Start with.
Are you sure you want to proceed?

continue[yN] y
Start a spare sshd

Ports to facilitate recovery in the event of a failure'1022'And another sshd
let's start doing .... If something goes wrong with the currently running ssh, you can still connect to the other port.

If you are running a firewall, you need to open this port temporarily. This operation is not automatic because of the potential danger. Open the port as in the example below:
'iptables -I INPUT -p tcp --dport 1022 -j ACCEPT' 

To continue[ENTER]Press the key
Update repository information

I set it not to use the repository provided by the third party

sources.I set it not to use the repository provided by the third party in list. After the upgrade is complete'Software source'
You can make it available again using a tool or package manager.

To continue[ENTER]Press the key
Do you want to start the upgrade?


3 installed packages are Canonical
Is no longer supported by. However, you can get support from the community.

Two packages will be removed. 97 new packages will be installed. 503 packages will be upgraded.

A total of 814 M should be downloaded. This download takes about 1 hour 43 minutes over a 1Mbit DSL connection, 56k
It takes about 7 hours a day on the modem.

Obtaining and installing an upgrade can take several hours. Once the download is complete, the process cannot be canceled.

continue[yN]Details[d]
The system upgrade is complete.

Reboot required

A reboot is required to complete the upgrade.
'Y'Select to restart.

continue[yN] y

Check the upgraded version

Reconnect with ssh and check the version. 20.10 Confirm that it is groovy.

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.10
Release:	20.10
Codename:	groovy

Check the package repository after upgrade

Make sure groovy is specified in sources.list.

$ grep ^deb /etc/apt/sources.list
deb http://jp.archive.ubuntu.com/ubuntu groovy main restricted
deb http://jp.archive.ubuntu.com/ubuntu groovy-updates main restricted
deb http://jp.archive.ubuntu.com/ubuntu groovy universe
deb http://jp.archive.ubuntu.com/ubuntu groovy-updates universe
deb http://jp.archive.ubuntu.com/ubuntu groovy multiverse
deb http://jp.archive.ubuntu.com/ubuntu groovy-updates multiverse
deb http://jp.archive.ubuntu.com/ubuntu groovy-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu groovy-security main restricted
deb http://security.ubuntu.com/ubuntu groovy-security universe
deb http://security.ubuntu.com/ubuntu groovy-security multiverse

Set up external package repository after upgrade

Check the files under /etc/apt/sources.list.d. The number of files is increasing, and the contents are commented out.

$ ls -1 /etc/apt/sources.list.d
nodesource.list
nodesource.list.distUpgrade
$ cat /etc/apt/sources.list.d/nodesource.list
# deb https://deb.nodesource.com/node_14.x groovy main #Disabled during upgrade to groovy
# deb-src https://deb.nodesource.com/node_14.x groovy main #Disabled during upgrade to groovy
$ cat /etc/apt/sources.list.d/nodesource.list.distUpgrade
deb https://deb.nodesource.com/node_14.x focal main
deb-src https://deb.nodesource.com/node_14.x focal main

/etc/apt/sources.list.d Rewrite and organize the following files for Ubuntu 20.10 (Groovy Gorilla).

$ cat /etc/apt/sources.list.d/*
deb https://deb.nodesource.com/node_14.x groovy main
deb-src https://deb.nodesource.com/node_14.x groovy main

Check if you can connect to the external package repository.

$ sudo apt update
hit:1 http://jp.archive.ubuntu.com/ubuntu groovy InRelease
Get:2 http://jp.archive.ubuntu.com/ubuntu groovy-updates InRelease [110 kB]
Get:3 http://jp.archive.ubuntu.com/ubuntu groovy-backports InRelease [101 kB]
Get:4 http://security.ubuntu.com/ubuntu groovy-security InRelease [110 kB]
Get:5 https://deb.nodesource.com/node_14.x groovy InRelease [4,584 B]
Get:6 https://deb.nodesource.com/node_14.x groovy/main amd64 Packages [768 B]
Obtained 327 kB in 2 seconds(164 kB/s)
Loading the package list...Done
Creating a dependency tree
Reading status information...Done
All packages are up to date.

Update the package as needed.

$ sudo apt upgrade

Reference material

Recommended Posts

Upgrade from Ubuntu 20.04 LTS (Focal Fossa) to Ubuntu 20.10 (Groovy Gorilla)
From Ubuntu 20.04 introduction to environment construction
How to use OpenVPN with Ubuntu 18.04.3 LTS
13 Things to Do After Installing Ubuntu 20.04 LTS
10 Things to Do After Installing Ubuntu 18.04 LTS