/bootの容量不足でyum updateに失敗する場合はyum-utilsを使って古いKernelを削除する
yum update
を実行すると/bootの容量が足りず更新できないことがあるyum-utilsを利用して
package-cleanup --oldkernels
するとgrubも含めて古いカーネルをよろしく削除してくれる
作業ログ
以下は4世代のカーネルが残っていた/bootのUse%が96%だったところを、2世代削除して62%まで減らした際のログ
[mk55@localhost ~]$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 49999000 15912824 34086176 32% / devtmpfs 1909700 0 1909700 0% /dev tmpfs 1924572 0 1924572 0% /dev/shm tmpfs 1924572 9136 1915436 1% /run tmpfs 1924572 0 1924572 0% /sys/fs/cgroup /dev/sda1 303788 289764 14024 96% /boot tmpfs 384916 0 384916 0% /run/user/1000 [mk55@localhost ~]$ ls /boot config-3.10.0-229.11.1.el7.x86_64 initrd-plymouth.img config-3.10.0-229.14.1.el7.x86_64 symvers-3.10.0-229.11.1.el7.x86_64.gz config-3.10.0-229.el7.x86_64 symvers-3.10.0-229.14.1.el7.x86_64.gz config-3.10.0-514.16.1.el7.x86_64 symvers-3.10.0-229.el7.x86_64.gz grub symvers-3.10.0-514.16.1.el7.x86_64.gz grub2 System.map-3.10.0-229.11.1.el7.x86_64 initramfs-0-rescue-405a5d4712b5448a9105ecaec9c7e9a5.img System.map-3.10.0-229.14.1.el7.x86_64 initramfs-3.10.0-229.11.1.el7.x86_64.img System.map-3.10.0-229.el7.x86_64 initramfs-3.10.0-229.11.1.el7.x86_64kdump.img System.map-3.10.0-514.16.1.el7.x86_64 initramfs-3.10.0-229.14.1.el7.x86_64.img vmlinuz-0-rescue-405a5d4712b5448a9105ecaec9c7e9a5 initramfs-3.10.0-229.14.1.el7.x86_64kdump.img vmlinuz-3.10.0-229.11.1.el7.x86_64 initramfs-3.10.0-229.el7.x86_64.img vmlinuz-3.10.0-229.14.1.el7.x86_64 initramfs-3.10.0-229.el7.x86_64kdump.img vmlinuz-3.10.0-229.el7.x86_64 initramfs-3.10.0-514.16.1.el7.x86_64.img vmlinuz-3.10.0-514.16.1.el7.x86_64 initramfs-3.10.0-514.16.1.el7.x86_64kdump.img [mk55@localhost ~]$ rpm -q kernel kernel-3.10.0-229.el7.x86_64 kernel-3.10.0-229.11.1.el7.x86_64 kernel-3.10.0-229.14.1.el7.x86_64 kernel-3.10.0-514.16.1.el7.x86_64 [mk55@localhost ~]$ su - Password: Last login: Wed Jun 21 21:42:07 JST 2017 on tty1 [root@localhost ~]# [root@localhost ~]# [root@localhost ~]# package-cleanup --oldkernels --count=2 Loaded plugins: fastestmirror, langpacks --> Running transaction check ---> Package kernel.x86_64 0:3.10.0-229.el7 will be erased ---> Package kernel.x86_64 0:3.10.0-229.11.1.el7 will be erased ---> Package kernel-devel.x86_64 0:3.10.0-229.el7 will be erased ---> Package kernel-devel.x86_64 0:3.10.0-229.11.1.el7 will be erased --> Finished Dependency Resolution base/7/x86_64 | 3.6 kB 00:00:00 extras/7/x86_64 | 3.4 kB 00:00:00 updates/7/x86_64 | 3.4 kB 00:00:00 updates/7/x86_64/primary_db | 6.4 MB 00:00:55 Dependencies Resolved ======================================================================================================================== Package Arch Version Repository Size ========================================================================================================================Removing: kernel x86_64 3.10.0-229.el7 @anaconda 131 M kernel x86_64 3.10.0-229.11.1.el7 @updates 131 M kernel-devel x86_64 3.10.0-229.el7 @anaconda 32 M kernel-devel x86_64 3.10.0-229.11.1.el7 @updates 32 M Transaction Summary ========================================================================================================================Remove 4 Packages Installed size: 326 M Is this ok [y/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Erasing : kernel-devel.x86_64 1/4 Erasing : kernel.x86_64 2/4 warning: file /lib/modules/3.10.0-229.el7.x86_64/modules.softdep: remove failed: No such file or directory warning: file /lib/modules/3.10.0-229.el7.x86_64/modules.devname: remove failed: No such file or directory Erasing : kernel-devel.x86_64 3/4 Erasing : kernel.x86_64 4/4 warning: file /lib/modules/3.10.0-229.11.1.el7.x86_64/modules.softdep: remove failed: No such file or directory warning: file /lib/modules/3.10.0-229.11.1.el7.x86_64/modules.devname: remove failed: No such file or directory Verifying : kernel-3.10.0-229.11.1.el7.x86_64 1/4 Verifying : kernel-devel-3.10.0-229.el7.x86_64 2/4 Verifying : kernel-3.10.0-229.el7.x86_64 3/4 Verifying : kernel-devel-3.10.0-229.11.1.el7.x86_64 4/4 Removed: kernel.x86_64 0:3.10.0-229.el7 kernel.x86_64 0:3.10.0-229.11.1.el7 kernel-devel.x86_64 0:3.10.0-229.el7 kernel-devel.x86_64 0:3.10.0-229.11.1.el7 Complete! [root@localhost ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 49999000 15570900 34428100 32% / devtmpfs 1909700 0 1909700 0% /dev tmpfs 1924572 0 1924572 0% /dev/shm tmpfs 1924572 9136 1915436 1% /run tmpfs 1924572 0 1924572 0% /sys/fs/cgroup /dev/sda1 303788 185696 118092 62% /boot tmpfs 384916 0 384916 0% /run/user/1000 [root@localhost ~]# ls /boot config-3.10.0-229.14.1.el7.x86_64 initrd-plymouth.img config-3.10.0-514.16.1.el7.x86_64 symvers-3.10.0-229.14.1.el7.x86_64.gz grub symvers-3.10.0-514.16.1.el7.x86_64.gz grub2 System.map-3.10.0-229.14.1.el7.x86_64 initramfs-0-rescue-405a5d4712b5448a9105ecaec9c7e9a5.img System.map-3.10.0-514.16.1.el7.x86_64 initramfs-3.10.0-229.14.1.el7.x86_64.img vmlinuz-0-rescue-405a5d4712b5448a9105ecaec9c7e9a5 initramfs-3.10.0-229.14.1.el7.x86_64kdump.img vmlinuz-3.10.0-229.14.1.el7.x86_64 initramfs-3.10.0-514.16.1.el7.x86_64.img vmlinuz-3.10.0-514.16.1.el7.x86_64 initramfs-3.10.0-514.16.1.el7.x86_64kdump.img [root@localhost ~]# tail /var/log/yum.log -n 4 Jun 22 23:37:02 Erased: kernel-devel Jun 22 23:37:08 Erased: kernel Jun 22 23:37:17 Erased: kernel-devel Jun 22 23:37:21 Erased: kernel
あとはyum update
したあとリブートすればOK。カーネルのバージョンはuname -r
で確認する