8
14

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で古いバージョンのKernelイメージを削除する方法

Last updated at Posted at 2016-09-27

/bootの容量が100%になってしまうと、apt-get等のコマンドに失敗する、そうなる前の対策。

定期的に古いカーネルがあるか確認

確認方法

現在実行中のカーネルを確認

$ uname -r
3.13.0-76-generic

インストール済みカーネルイメージの確認

$ dpkg --get-selections | grep image
genisoimage                                     install
libcupsimage2:amd64                             install
libxcb-image0:amd64                             install
linux-image-3.13.0-24-generic                   install
linux-image-3.13.0-68-generic                   install
linux-image-3.13.0-70-generic                   install
linux-image-3.13.0-71-generic                   install
linux-image-3.13.0-73-generic                   install
linux-image-3.13.0-74-generic                   install
linux-image-3.13.0-76-generic                   install
linux-image-3.13.0-77-generic                   install
linux-image-3.13.0-79-generic                   install
linux-image-extra-3.13.0-24-generic             install
linux-image-extra-3.13.0-68-generic             install
linux-image-extra-3.13.0-70-generic             install
linux-image-extra-3.13.0-71-generic             install
linux-image-extra-3.13.0-73-generic             install
linux-image-extra-3.13.0-74-generic             install
linux-image-extra-3.13.0-76-generic             install
linux-image-extra-3.13.0-77-generic             install
linux-image-extra-3.13.0-79-generic             install
linux-image-extra-3.13.0-83-generic             install
linux-image-extra-3.13.0-96-generic             install
linux-image-generic                             install

古いカーネルを削除

単品削除

$ sudo apt-get remove linux-image-3.13.0-24-generic

複数同時削除

$ sudo apt-get remove linux-image-3.13.0-{24,68,70}-generic

実際にディスク上から削除

$ sudo apt-get autoremove
$ sudo update-grub

どうしても消えない場合

/bootの容量を強制的にあける(rmで古いkernel関係のファイルを削除)
/bootの容量が空いてきたら、以下を実行して再起動。

$ sudo apt-get -f install
$ sudo apt-get autoremove

※本当はやりたくありませんが。。。
以上

8
14
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
8
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?