Help us understand the problem. What is going on with this article?

Ubuntuでapt-get upgradeしたとき/bootの空き領域がなくてエラーになる場合の対処方法

More than 3 years have passed since last update.

Ubuntu Server 16.04 LTSでapt-get upgradeしたら以下のようなエラーが出ました。

dpkg: アーカイブ /var/cache/apt/archives/linux-image-4.4.0-59-generic_4.4.0-59.80_amd64.deb
の処理中にエラーが発生しました (--unpack):
'./boot/vmlinuz-4.4.0-59-generic' の展開済みデータを '/boot/vmlinuz-4.4.0-59-generic.dpkg-new'
にコピーできません: 書き込みに失敗しました (デバイスに空き領域がありません)

dfコマンドで見てみると確かに/bootディレクトリがいっぱいに。

$ df -m
Filesystem                        1M-blocks  Used Available Use% Mounted on
()
tmpfs                                     5     0         5   0% /run/lock
tmpfs                                  1896     0      1896   0% /sys/fs/cgroup
/dev/sda1                               472   464         0 100% /boot
tmpfs                                   380     0       380   0% /run/user/1000

/bootの中身を見てみる。

$ ls /boot
System.map-4.4.0-21-generic  abi-4.4.0-21-generic  config-4.4.0-21-generic  grub                         vmlinuz-4.4.0-28-generic
System.map-4.4.0-28-generic  abi-4.4.0-28-generic  config-4.4.0-28-generic  initrd.img-4.4.0-21-generic  vmlinuz-4.4.0-31-generic
System.map-4.4.0-31-generic  abi-4.4.0-31-generic  config-4.4.0-31-generic  initrd.img-4.4.0-28-generic  vmlinuz-4.4.0-34-generic
System.map-4.4.0-34-generic  abi-4.4.0-34-generic  config-4.4.0-34-generic  initrd.img-4.4.0-31-generic  vmlinuz-4.4.0-36-generic
System.map-4.4.0-36-generic  abi-4.4.0-36-generic  config-4.4.0-36-generic  initrd.img-4.4.0-34-generic  vmlinuz-4.4.0-38-generic
System.map-4.4.0-38-generic  abi-4.4.0-38-generic  config-4.4.0-38-generic  initrd.img-4.4.0-36-generic  vmlinuz-4.4.0-42-generic
System.map-4.4.0-42-generic  abi-4.4.0-42-generic  config-4.4.0-42-generic  initrd.img-4.4.0-38-generic  vmlinuz-4.4.0-45-generic
System.map-4.4.0-45-generic  abi-4.4.0-45-generic  config-4.4.0-45-generic  initrd.img-4.4.0-42-generic  vmlinuz-4.4.0-47-generic
System.map-4.4.0-47-generic  abi-4.4.0-47-generic  config-4.4.0-47-generic  initrd.img-4.4.0-45-generic  vmlinuz-4.4.0-51-generic
System.map-4.4.0-51-generic  abi-4.4.0-51-generic  config-4.4.0-51-generic  initrd.img-4.4.0-47-generic  vmlinuz-4.4.0-53-generic
System.map-4.4.0-53-generic  abi-4.4.0-53-generic  config-4.4.0-53-generic  lost+found                   vmlinuz-4.4.0-57-generic
System.map-4.4.0-57-generic  abi-4.4.0-57-generic  config-4.4.0-57-generic  vmlinuz-4.4.0-21-generic

古いLinuxカーネルが残っているらしい。

いらないものは消す。最新3個くらいは残しておく。

$ sudo apt-get remove linux-image-4.4.0-2{1,8}-generic -y
$ sudo apt-get remove linux-image-4.4.0-3{1,4,6,8}-generic -y
$ sudo apt-get remove linux-image-4.4.0-4{2,5,7}-generic -y

最後にgrubを更新する。

$ sudo update-grub

参考

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした