私のUbuntu 16.04システムのブートパーティションは完全に一杯で、それを修正しようとして問題がありました。
$ df -h
udev 2,9G 0 2,9G 0% /dev
tmpfs 597M 63M 535M 11% /run
/dev/mapper/user--vg-root 109G 67G 37G 65% /
tmpfs 3,0G 13M 3,0G 1% /dev/shm
tmpfs 5,0M 0 5,0M 0% /run/lock
tmpfs 3,0G 0 3,0G 0% /sys/fs/cgroup
/dev/sda1 472M 471M 0 100% /boot
tmpfs 597M 0 597M 0% /run/user/999
tmpfs 597M 0 597M 0% /run/user/1000
Sudo apt-get autoremove
を実行しようとしましたが、失敗します:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
linux-image-extra-4.4.0-96-generic : Depends: linux-image-4.4.0-96-generic but it is not installed
linux-image-generic : Depends: linux-image-4.4.0-96-generic but it is not installed
Recommends: thermald but it is not installed
E: Unmet dependencies. Try using -f.
-f
を使用すると、スペースが残っていないというエラーが発生します...
たぶん、この情報が必要です:
$ dpkg -l | grep linux
ii console-setup-linux 1.108ubuntu15.3 all Linux specific part of console-setup
ii libselinux1:AMD64 2.4-3build2 AMD64 SELinux runtime shared libraries
ii linux-base 4.0ubuntu1 all Linux image base package
iF linux-firmware 1.157.11 all Firmware for Linux kernel drivers
iU linux-generic 4.4.0.96.101 AMD64 Complete Generic Linux kernel and headers
ii linux-headers-4.4.0-64 4.4.0-64.85 all Header files related to Linux kernel version 4.4.0
ii linux-headers-4.4.0-64-generic 4.4.0-64.85 AMD64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii linux-headers-4.4.0-66 4.4.0-66.87 all Header files related to Linux kernel version 4.4.0
ii linux-headers-4.4.0-66-generic 4.4.0-66.87 AMD64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii linux-headers-4.4.0-70 4.4.0-70.91 all Header files related to Linux kernel version 4.4.0
ii linux-headers-4.4.0-70-generic 4.4.0-70.91 AMD64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii linux-headers-4.4.0-71 4.4.0-71.92 all Header files related to Linux kernel version 4.4.0
ii linux-headers-4.4.0-71-generic 4.4.0-71.92 AMD64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii linux-headers-4.4.0-72 4.4.0-72.93 all Header files related to Linux kernel version 4.4.0
ii linux-headers-4.4.0-72-generic 4.4.0-72.93 AMD64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii linux-headers-4.4.0-75 4.4.0-75.96 all Header files related to Linux kernel version 4.4.0
ii linux-headers-4.4.0-75-generic 4.4.0-75.96 AMD64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii linux-headers-4.4.0-78 4.4.0-78.99 all Header files related to Linux kernel version 4.4.0
ii linux-headers-4.4.0-78-generic 4.4.0-78.99 AMD64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii linux-headers-4.4.0-79 4.4.0-79.100 all Header files related to Linux kernel version 4.4.0
ii linux-headers-4.4.0-79-generic 4.4.0-79.100 AMD64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii linux-headers-4.4.0-81 4.4.0-81.104 all Header files related to Linux kernel version 4.4.0
ii linux-headers-4.4.0-81-generic 4.4.0-81.104 AMD64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii linux-headers-4.4.0-83 4.4.0-83.106 all Header files related to Linux kernel version 4.4.0
ii linux-headers-4.4.0-83-generic 4.4.0-83.106 AMD64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
ii linux-headers-4.4.0-87 4.4.0-87.110 all Header files related to Linux kernel version 4.4.0
ii linux-headers-4.4.0-87-generic 4.4.0-87.110 AMD64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
iU linux-headers-4.4.0-96 4.4.0-96.119 all Header files related to Linux kernel version 4.4.0
iU linux-headers-4.4.0-96-generic 4.4.0-96.119 AMD64 Linux kernel headers for version 4.4.0 on 64 bit x86 SMP
iU linux-headers-generic 4.4.0.96.101 AMD64 Generic Linux kernel headers
rc linux-image-4.4.0-21-generic 4.4.0-21.37 AMD64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-64-generic 4.4.0-64.85 AMD64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-66-generic 4.4.0-66.87 AMD64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-70-generic 4.4.0-70.91 AMD64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-71-generic 4.4.0-71.92 AMD64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-72-generic 4.4.0-72.93 AMD64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-75-generic 4.4.0-75.96 AMD64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-78-generic 4.4.0-78.99 AMD64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-79-generic 4.4.0-79.100 AMD64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-81-generic 4.4.0-81.104 AMD64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF linux-image-4.4.0-83-generic 4.4.0-83.106 AMD64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF linux-image-4.4.0-87-generic 4.4.0-87.110 AMD64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-21-generic 4.4.0-21.37 AMD64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-64-generic 4.4.0-64.85 AMD64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-66-generic 4.4.0-66.87 AMD64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-70-generic 4.4.0-70.91 AMD64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-71-generic 4.4.0-71.92 AMD64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-72-generic 4.4.0-72.93 AMD64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-75-generic 4.4.0-75.96 AMD64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-78-generic 4.4.0-78.99 AMD64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-79-generic 4.4.0-79.100 AMD64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iF linux-image-extra-4.4.0-81-generic 4.4.0-81.104 AMD64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU linux-image-extra-4.4.0-83-generic 4.4.0-83.106 AMD64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU linux-image-extra-4.4.0-87-generic 4.4.0-87.110 AMD64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc linux-image-extra-4.4.0-89-generic 4.4.0-89.112 AMD64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU linux-image-extra-4.4.0-96-generic 4.4.0-96.119 AMD64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU linux-image-generic 4.4.0.96.101 AMD64 Generic Linux kernel image
iU linux-libc-dev:AMD64 4.4.0-89.112 AMD64 Linux Kernel Headers for development
ii linuxbrew-wrapper 20150804-3 all Missing Package Manager For Linux
ii util-linux 2.27.1-6ubuntu3.3 AMD64 miscellaneous system utilities
purge-old-kernels
からのbyobu 5.106-0ubuntu1
があります。
#!/bin/sh
#
# purge-old-kernels - remove old kernel packages
# Copyright (C) 2012 Dustin Kirkland <[email protected]>
#
# Authors: Dustin Kirkland <[email protected]>
# Kees Cook <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Ensure we're running as root
if [ "$(id -u)" != 0 ]; then
echo "ERROR: This script must run as root. Hint..." 1>&2
echo " Sudo $0 $@" 1>&2
exit 1
fi
# NOTE: This script will ALWAYS keep the currently running kernel
# NOTE: Default is to keep 2 more, user overrides with --keep N
KEEP=2
# NOTE: Any unrecognized option will be passed straight through to apt
APT_OPTS=
while [ ! -z "$1" ]; do
case "$1" in
--keep)
# User specified the number of kernels to keep
KEEP="$2"
shift 2
;;
*)
APT_OPTS="$APT_OPTS $1"
shift 1
;;
esac
done
# Build our list of kernel packages to purge
CANDIDATES=$(ls -tr /boot/vmlinuz-* | head -n -${KEEP} | grep -v "$(uname -r)$" | cut -d- -f2- | awk '{print "linux-image-" $0 " linux-headers-" $0}' )
for c in $CANDIDATES; do
dpkg-query -s "$c" >/dev/null 2>&1 && PURGE="$PURGE $c"
done
if [ -z "$PURGE" ]; then
echo "No kernels are eligible for removal"
exit 0
fi
apt $APT_OPTS remove --purge $PURGE