1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

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

Last updated at Posted at 2017-01-11

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

参考

1
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?