Ubuntu

[Ubuntu] 12.04 から 14.04 へアップデートした時のメモ

More than 3 years have passed since last update.


Ubuntu のバージョンに関して

https://www.ubuntulinux.jp/ubuntu

バージョン名は YY.MM となっているようです。なので、12.04 であれば12年の4月公開されたもの。

長期保証(LTS)は偶数年の4月に公開され、5年間の保証がつきます。

バージョンの確認方法

$ cat /etc/lsb-release

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.5 LTS"


アップデート方法


5行でまとめると

$ sudo apt-get update

$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
$ sudo apt-get install update-manager-core
$ sudo do-release-upgrade


経過

$ sudo apt-get update

Hit http://security.ubuntu.com precise-security Release.gpg
Hit http://ap-northeast-1.ec2.archive.ubuntu.com precise Release.gpg
Hit http://security.ubuntu.com precise-security Release
Get:1 http://ap-northeast-1.ec2.archive.ubuntu.com precise-updates Release.gpg [198 B]
Hit http://ap-northeast-1.ec2.archive.ubuntu.com precise Release
... (略)...
Fetched 3,065 kB in 10s (284 kB/s)
Reading package lists... Done

$ sudo apt-get upgrade

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
xxx xxx xxx
The following packages will be upgraded:
apport apt apt-transport-https apt-utils bash xxx ...
92 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Need to get 101 MB of archives.
After this operation, 287 kB disk space will be freed.
Do you want to continue [Y/n]? Y
Get:1 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ precise-updates/main bash amd64 4.2-2ubuntu2.6 [641 kB]
Get:2 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ precise-updates/main coreutils amd64 8.13-3ubuntu3.3 [2,234 kB]
... (略)...
Updating /boot/grub/menu.lst ... done

Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-3.2.0-69-virtual

$ sudo apt-get dist-upgrade

Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
linux-headers-3.2.0-75 xxx
The following packages will be upgraded:
linux-headers-virtual xxx
3 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 25.6 MB of archives.
After this operation, 104 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ precise-updates/main linux-image-3.2.0-75-virtual amd64 3.2.0-75.110 [12.9 MB]
Get:2 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ precise-updates/main linux-headers-3.2.0-75 all 3.2.0-75.110 [11.7 MB]
... (略)...
Found memtest86+ image: /boot/memtest86+.bin
done
Setting up linux-headers-3.2.0-75 (3.2.0-75.110) ...
Setting up linux-headers-3.2.0-75-virtual (3.2.0-75.110) ...
Setting up linux-image-virtual (3.2.0.75.89) ...
Setting up linux-headers-virtual (3.2.0.75.89) ...
Setting up linux-virtual (3.2.0.75.89) ...

あれ、終わった?と思いバージョン確認

$ cat /etc/lsb-release

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.5 LTS"

まだ変わってない。dist-upgrade ってdistribution のアップデートしてくれるんじゃなかったっけ・・・。

気を取り直して続き。

$ sudo apt-get install update-manager-core

Reading package lists... Done
Building dependency tree
Reading state information... Done
update-manager-core is already the newest version.
The following packages were automatically installed and are no longer required:
linux-headers-3.2.0-58 linux-headers-3.2.0-58-virtual python-twisted-names
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

いくつかのパッケージが消せと言われてるので消す(やる必要ない)

$ sudo apt-get autoremove

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-headers-3.2.0-58 linux-headers-3.2.0-58-virtual python-twisted-names
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
After this operation, 68.1 MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 116781 files and directories currently installed.)
Removing linux-headers-3.2.0-58-virtual ...
Removing linux-headers-3.2.0-58 ...
Removing python-twisted-names ...

本題に戻る

$ sudo do-release-upgrade

Checking for a new Ubuntu release
Get:1 Upgrade tool signature [198 B]
Get:2 Upgrade tool [1,152 kB]
Fetched 1,152 kB in 0s (0 B/s)
authenticate 'trusty.tar.gz' against 'trusty.tar.gz.gpg'
extracting 'trusty.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 だと事故った時大変だよ、本当にこのまま続行していい?」

「事故った時ように1022ポートで ssh 聞いとくね」

と言われてる。親切。

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]

Reading package lists... Done

Building dependency tree
Reading state information... Done
Building data structures... Done
Hit http://ap-northeast-1.ec2.archive.ubuntu.com precise Release.gpg
Get:1 http://ap-northeast-1.ec2.archive.ubuntu.com precise-updates Release.gpg [198 B]
Hit http://security.ubuntu.com precise-security Release.gpg
...(略)...
Checking package manager
Reading package lists... Done
Building dependency tree
Reading state information... Done
Building data structures... Done

Calculating the changes

Calculating the changes

Do you want to start the upgrade?

2 packages are going to be removed. 167 new packages are going to be
installed. 528 packages are going to be upgraded.

You have to download a total of 239 M. This download will take about
1 minute with your connection.

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

Continue [yN] Details [d]

「本当にやるよ?」「数時間かかる事もあるから」「ダウンロードが終わったらもう引き返せないからね?」

星の◯ービィスーパーDX並に親切。

ちなみにここで d を押すと何故かのフェイタルエラーが出ます。

y で先に進む。

途中でいっぱい質問を受ける。

例)

Configuration file '/etc/munin/munin-node.conf'

==> 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.
*** munin-node.conf (Y/I/N/O/D/Z) [default=N] ?

例その2)


25 packages are going to be removed.

Continue [yN] Details [d]d

Remove: linux-image-3.2.0-58-virtual linux-image-3.2.0-75-virtual

Remove (was auto installed) g++-4.6 libcdt4 libgd2-noxpm libgraph4
libgvc5 libkadm5clnt-mit8 libkadm5srv-mit8 libkdb5-6 liblcms1
libmagickcore4 libmagickcore4-extra libmagickwand4 libmpc2
libpango1.0-0 libpangox-1.0-0 libpangoxft-1.0-0 libpathplan4
libstdc++6-4.6-dev libtasn1-3-dev libtiff4 libxft2
linux-headers-3.2.0-75-virtual ttf-dejavu-core

そしてとうとうこの時が

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

Broadcast message from root@ip-xxx-xx-x-x
(/dev/pts/2) at 17:51 ...

The system is going down for reboot NOW!
=== Command detached from window (Fri Jan 30 17:51:19 2015) ===
=== Command terminated normally (Fri Jan 30 17:51:19 2015) ===Connection to xxx.xx.x.xx closed by remote host.
Connection to xxx.xx.x.xx closed.

再起動後、バージョンを確認してみる

$ cat /etc/lsb-release 

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"

おー!ついにきた。