Ich habe bei Hetzner ein paar Linux-Server im Einsatz.
Diese verwenden eine vollverschlüsselte Festplatte und
führen im Wesentlichen einige LXC-Container aus.
Einige der Server laufen noch unter Ubuntu-18.04. Diese muß
ich hochziehen auf Ubuntu-20.04. Bislang habe ich dafür immer
eine Neuinstallation durchgeführt, jetzt teste ich es auch
mal mit einer Aktualisierung.
Vorarbeiten
Bevor die Aktualisierung begonnen werden kann müssen
wir den bestehenden Server aktualisieren:
Nach der Annmeldung am Server wird angezeigt, wie man eine
Aktualisierung durchführen kann:
123456
uli@ulidesktop:~ $ ssh mein-server
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 5.4.0-60-generic x86_64)
...
New release '20.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
...
Also:
1234567891011121314151617181920
root@hetzner:~ # do-release-upgrade
Checking for a new Ubuntu release
...
If you continue, an additional ssh daemon will be started at port
'1022'.
Do you want to continue?
Continue [yN] y
Starting additional sshd
To make recovery in case of failure easier, an additional sshd will
be started on port '1022'. If anything goes wrong with the running
ssh you can still connect to the additional one.
If you run a firewall, you may need to temporarily open this port. As
this is potentially dangerous it's not done automatically. You can
open the port with e.g.:
'iptables -I INPUT -p tcp --dport 1022 -j ACCEPT'
To continue please press [ENTER]
Zur Sicherheit mache ich ein zweites Fenster auf und verbinde mich
über den neuen Port mit dem Server:
123456
uli@ulidesktop:~ $ ssh -p 1022 mein-server
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 5.4.0-60-generic x86_64)
...
Your Hardware Enablement Stack (HWE) is supported until April 2023.
Last login: Thu Jan 14 10:25:26 2021 from 91.89.124.131
root@hetzner:~ #
...
To continue please press [ENTER] ENTER
Reading package lists... Done
Building dependency tree
Reading state information... Done
Hit http://mirror.hetzner.de/ubuntu/packages bionic InRelease
Hit http://mirror.hetzner.de/ubuntu/packages bionic-backports InRelease
...
Third party sources disabled
Some third party entries in your sources.list were disabled. You can
re-enable them after the upgrade with the 'software-properties' tool
or your package manager.
To continue please press [ENTER] ENTER
...
Do you want to start the upgrade?
7 installed packages are no longer supported by Canonical. You can
still get support from the community.
5 packages are going to be removed. 65 new packages are going to be
installed. 349 packages are going to be upgraded.
You have to download a total of 322 M. This download will take about
40 minutes with a 1Mbit DSL connection and about 12 hours with a 56k
modem.
Fetching and installing the upgrade can take several hours. Once the
download has finished, the process cannot be canceled.
Continue [yN] Details [d] y
Also diese Aktionen:
– ENTER
– ENTER
– y ENTER
Danach erscheinen diverse Hiweise:
* Service-Restarts: OK.
* HTTP-Tunnels in Apt-Cacher NG erlauben: Nein!
* /etc/crontab – keep current version
* /etc/initramfs-tools/initramfs.conf – keep current version
* /etc/ssh/ssh_config – keep current version
* /etc/ssh/sshd_config – keep current version
* Remove obsolete packages? Ja!
* Restart required – continue? Ja!
Der Server wird nun durchgestartet, das zweite Fenster
wird abgeklemmt! Der Server kann wie üblich gestartet werden.
Nach dem Neustart sieht der Server weitgehend unverändert aus,
er läuft aber mit Ubuntu-20.04:
12
Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-60-generic x86_64)
...
Nacharbeiten
Es gibt unnötige Pakete, beispielsweise den alten Kernel:
123456789
oot@sb35 ~ # apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
linux-headers-generic-hwe-18.04 linux-image-generic-hwe-18.04
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Wir lassen einfach alle unnötigen Pakete deinstallieren:
123456789101112
root@sb35 ~ # apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-headers-generic-hwe-18.04 linux-image-generic-hwe-18.04
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 36.9 kB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 64495 files and directories currently installed.)
Removing linux-headers-generic-hwe-18.04 (5.4.0.62.65) ...
Removing linux-image-generic-hwe-18.04 (5.4.0.62.65) ...
Nachkontrolle:
123456
root@sb35 ~ # apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Zusatzbereinigung:
1234567891011121314151617181920212223
root@sb35 ~ # dpkg --get-selections linux*
linux-base install
linux-firmware install
linux-generic install
linux-generic-hwe-18.04 install
linux-headers-5.4.0-62 install
linux-headers-5.4.0-62-generic install
linux-headers-generic install
linux-image-5.4.0-62-generic install
linux-image-generic install
linux-modules-5.4.0-62-generic install
linux-modules-extra-5.4.0-62-generic install
root@sb35 ~ # apt purge `dpkg --get-selections linux*18.04*|cut -f1`
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-generic-hwe-18.04*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 18.4 kB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 65984 files and directories currently installed.)
Removing linux-generic-hwe-18.04 (5.4.0.62.65) ...