5
3

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 で boot 領域が一杯になって autoremove もできなくなったとき

Last updated at Posted at 2018-11-13

はじめに

サーバを複数台管理していて,タイトルのような現象がよく起こる.

準備

カーネルのバージョンを確認する.

$ uname -r
4.4.0-119-generic

実行

上記以外のバージョンについて,ヘッダやイメージ等を削除する.
ここでは 4.4.0-101 の場合を例に示す.

$ sudo dpkg -r linux-headers-4.4.0-101-generic
$ sudo dpkg -r linux-image-extra-4.4.0-101-generic
$ sudo dpkg -r linux-image-4.4.0-101-generic

こんな感じのスクリプトを書くと便利かも…?

remove.sh
# !/bin/bash

if [ $# -ne 1 ]; then
  echo 'Usage: remove.sh <version>'
  exit 1
fi

dpkg -r linux-headers-$1-generic
dpkg -r linux-image-extra-$1-generic
dpkg -r linux-image-$1-generic

確認

autoremove ができるようになれば OK

$ sudo apt autoremove

まとめ

こまめに apt autoremove しよう!

※上記方法でどうしてもうまくいかない場合, /boot の不要なバージョンを手動削除するとなんとかなります.ただし自己責任でお願いします.

5
3
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
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?