2024年1月1日 星期一

使用 do-release-upgrade 把 Oracle Cloud - Ubuntu 18.04 升級至 20.04 再繼續升級到 22.04

在 2019年搶了一台 Ubuntu 18.04 後,一直在那邊做例行公事。應該近一年 apt upgrade 也沒法多升級什麼就涼在那邊,趁 2024-01-01 假期,來整理一下。

升級絕對有風險,請自行評估跟承擔,在此謹流水帳紀錄,適合我的 VM 情況不代表大家都能升。

由於之前有設定防火牆來做一些簡單的防護,這次升級時要打開 1022 port 來小心一下:

$ sudo iptables -I INPUT 1 -p tcp --dport 1022 -j ACCEPT
$ sudo service netfilter-persistent save

開始操作:

$ sudo do-release-upgrade 
...
Calculating the changes

Could not calculate the upgrade

An unresolvable problem occurred while calculating the upgrade.

This was likely caused by:
* Unofficial software packages not provided by Ubuntu
Please use the tool 'ppa-purge' from the ppa-purge
package to remove software from a Launchpad PPA and
try the upgrade again.

If none of this applies, then please report this bug using the
command 'ubuntu-bug ubuntu-release-upgrader-core' in a terminal. If
you want to investigate this yourself the log files in
'/var/log/dist-upgrade' will contain details about the upgrade.
Specifically, look at 'main.log' and 'apt.log'.

接著安裝一下:

$ sudo apt-get install ppa-purge
$ sudo do-release-upgrade 
...

又碰到問題,大概看了一下 bugs.launchpad.net/ubuntu/+source/llvm-toolchain-9/+bug/1886748 ,偷懶衝:

$ sudo apt install clang-9
$ sudo do-release-upgrade 
...
Do you want to start the upgrade? 


17 packages are going to be removed. 209 new packages are going to be 
installed. 759 packages are going to be upgraded. 

You have to download a total of 886 M. This download will take about 
1 hour 52 minutes with a 1Mbit DSL connection and about 1 day 10 
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

...
System upgrade is complete.

Restart required 

To finish the upgrade, a restart is required. 
If you select 'y' the system will be restarted. 

Continue [yN] Y

所幸...連得上 XD 看來完成了 Ubuntu 20.04 了

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

繼續升上去!

$ sudo do-release-upgrade 
...
Reading cache

Checking package manager

Continue running under SSH? 

This session appears to be running under ssh. It is not recommended 
to perform a upgrade over ssh currently because in case of failure it 
is harder to recover. 

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. 


To continue please press [ENTER]

Do you want to start the upgrade? 


12 packages are going to be removed. 128 new packages are going to be 
installed. 826 packages are going to be upgraded. 

You have to download a total of 746 M. This download will take about 
2 minutes with your connection. 

Installing the upgrade can take several hours. Once the download has 
finished, the process cannot be canceled. 

 Continue [yN]  Details [d] Y

done
Processing triggers for dbus (1.12.20-2ubuntu4.1) ...
Processing triggers for libgdk-pixbuf-2.0-0:amd64 (2.42.8+dfsg-1ubuntu0.2) ...
Reading package lists... Done    
Building dependency tree          
Reading state information... Done

Processing snap replacements

refreshing snap lxd

refreshing snap oracle-cloud-agent

Searching for obsolete software
Reading state information... Done

Remove obsolete packages? 


127 packages are going to be removed. 

Removing the packages can take several hours. 

 Continue [yN]  Details [d]Y

...

System upgrade is complete.

Restart required 

To finish the upgrade, a restart is required. 
If you select 'y' the system will be restarted. 

Continue [yN] Y

再次登入:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy

沒有留言:

張貼留言