우분투 16.04 LTS에서 18.04 LTS로 업그레이드하기

우분투 16.04 Xenial Xerus에서 18.04 Bionic Beaver로 업그레이드하는 방법입니다.
18.04에서 20.04로의 업그레이드는 이 글을 참고해 주세요.

업그레이드 과정에서 부팅 불가 등의 문제가 발생할 수 있으니 위험을 인지하신 후에 진행하셔야 합니다.


패키지 업데이트

패키지를 최신 버전으로 업데이트합니다.

$ sudo apt update && sudo apt upgrade && sudo apt dist-upgrade

업데이트 완료 후 재부팅합니다.

$ sudo reboot now

더 이상 필요하지 않은 패키지를 삭제합니다.

$ sudo apt autoremove && sudo apt clean

업데이트 매니저 설치

update-manager-core가 설치되지 않은 경우 설치합니다.

$ sudo apt install update-manager-core

lts 릴리스로 업데이트 하기 위해 update-manager의 설정을 변경합니다.

$ sudo nano /etc/update-manager/release-upgrades

아래 내용과 같이 Prompt=lts로 변경합니다.

# Default behavior for the release upgrader.

[DEFAULT]
# Default prompting behavior, valid options:
#
#  never  - Never check for 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 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 this option should not be
#           used if the currently-running release is not itself an LTS
#           release, since in that case the upgrader won't be able to
#           determine if a newer release is available.
Prompt=lts

Ctrl+XYEnter 하여 저장합니다.


우분투 릴리스 업그레이드

업그레이드를 진행합니다.

$ sudo do-release-upgrade
$ sudo do-release-upgrade
Checking for a new Ubuntu release
Get:1 Upgrade tool signature [819 B]                                                        
Get:2 Upgrade tool [1,242 kB]                                                               
Fetched 1,243 kB in 0s (0 B/s)                                                              
authenticate 'bionic.tar.gz' against 'bionic.tar.gz.gpg' 
extracting 'bionic.tar.gz'

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] 

SSH를 통한 업그레이드를 권장하지 않는다는 메시지가 표시됩니다.
업그레이드 후 문제가 생길 경우 복구가 어렵기 때문입니다.
그대로 진행할 시 추가 SSH 데몬이 1022번 포트에서 실행될 것이라고 알려줍니다.
y를 입력하여 확인합니다.


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]

방화벽 설정 업데이트 가이드입니다.
업그레이드 이후 문제가 발생할 경우 1022번 포트로 SSH 연결이 가능하다는 메시지입니다.
Enter를 입력하여 확인합니다.


To continue please press [ENTER]

Reading package lists... Done
Building dependency tree        
Reading state information... Done
Hit http://kr.archive.ubuntu.com/ubuntu xenial InRelease                                    
Hit http://security.ubuntu.com/ubuntu xenial-security InRelease                             
Get:1 http://kr.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]                 
Get:2 http://kr.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]               
Fetched 216 kB in 0s (0 B/s)                                                                
Reading package lists... Done    
Building dependency tree          
Reading state information... Done

Updating repository information
Get:1 http://kr.archive.ubuntu.com/ubuntu bionic InRelease [242 kB]  

.......

Checking package manager
Reading package lists... Done    
Building dependency tree          
Reading state information... Done

Calculating the changes

Calculating the changes

Do you want to start the upgrade? 


54 installed packages are no longer supported by Canonical. You can 
still get support from the community. 

40 packages are going to be removed. 402 new packages are going to be 
installed. 1496 packages are going to be upgraded. 

You have to download a total of 1,099 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를 입력하여 진행합니다.


 Continue [yN]  Details [d]y

Lock screen disabled 

Your lock screen has been disabled and will remain disabled until you 
reboot. 

To continue please press [ENTER]
Inhibiting until Ctrl+C is pressed...

우분투를 gnome-desktop 환경에서 실행중이기 때문에 재부팅 전까지 락스크린이 비활성화될 것이라고 알려줍니다.
Enter를 입력하여 확인합니다.


Configuration file '/etc/update-manager/release-upgrades'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** release-upgrades (Y/I/N/O/D/Z) [default=N] ? 

/etc/update-manager/release-upgrades가 업데이트되어 나오는 메시지입니다.
D를 입력하여 변경사항을 확인할 수 있습니다.

--- /etc/update-manager/release-upgrades        2020-02-11 16:55:07.071327392 +0900
+++ /etc/update-manager/release-upgrades.dpkg-new       2019-06-20 01:49:56.000000000 +0900
@@ -3,16 +3,14 @@
 [DEFAULT]
 # Default prompting behavior, valid options:
 #
-#  never  - Never check for a new release.
+#  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 release that immediately succeeds the currently-running
-#           release.
+#           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 this option should not be
-#           used if the currently-running release is not itself an LTS
-#           release, since in that case the upgrader won't be able to
-#           determine if a newer release is available.
+#           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=lts
-
(END)

주석 내용만 업데이트 되었으므로 q를 입력하여 비교 창을 닫습니다.

*** release-upgrades (Y/I/N/O/D/Z) [default=N] ? y

y를 입력하여 업데이트된 버전으로 대체하겠습니다.


Searching for obsolete software
Reading state information... Done

Remove obsolete packages? 


116 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 18.04.4 LTS
Release:        18.04
Codename:       bionic

업그레이드가 완료된 것을 확인할 수 있습니다.