Hello CentOS users,
in the recent time I keep getting the logwatch warnings from my 2 dedicated servers running CentOS 7.4.1708.
I guess because of the numerous kernel updates (because of Spectre+Meltdown) in the near past?
Could someone please suggest me, which files in my /boot partition would be safe to delete?
I would like to avoid the situation of having to boot the rescue partiton etc. remotely... and at the same time I am not proficient with grub or whatever my provider has configured my dedicated hosts to use...
# ls -al /boot total 427877 dr-xr-xr-x. 6 root root 6144 28. Jan 10:33 . dr-xr-xr-x 18 root root 4096 7. Feb 03:34 .. -rw-r--r-- 1 root root 140899 5. Dez 01:04 config-3.10.0-693.11.1.el7.x86_64 -rw-r--r-- 1 root root 140915 4. Jan 02:19 config-3.10.0-693.11.6.el7.x86_64 -rw-r--r-- 1 root root 140915 25. Jan 21:26 config-3.10.0-693.17.1.el7.x86_64 -rw-r--r-- 1 root root 140898 13. Sep 00:38 config-3.10.0-693.2.2.el7.x86_64 -rw-r--r-- 1 root root 140898 20. Okt 22:56 config-3.10.0-693.5.2.el7.x86_64 drwxr-xr-x 3 root root 1024 15. Sep 09:43 efi drwxr-xr-x. 2 root root 1024 11. Apr 2016 grub drwx------. 5 root root 1024 28. Jan 10:31 grub2 -rw-r--r--. 1 root root 40142116 15. Dez 2015 initramfs-0-rescue-34946d7b5edb0946bfb52c0f6cae67af.img -rw------- 1 root root 50402914 6. Dez 09:23 initramfs-3.10.0-693.11.1.el7.x86_64.img -rw------- 1 root root 18149718 6. Dez 09:24 initramfs-3.10.0-693.11.1.el7.x86_64kdump.img -rw------- 1 root root 50405879 5. Jan 09:02 initramfs-3.10.0-693.11.6.el7.x86_64.img -rw------- 1 root root 18150336 5. Jan 09:04 initramfs-3.10.0-693.11.6.el7.x86_64kdump.img -rw------- 1 root root 50402830 28. Jan 10:31 initramfs-3.10.0-693.17.1.el7.x86_64.img -rw------- 1 root root 18147918 28. Jan 10:33 initramfs-3.10.0-693.17.1.el7.x86_64kdump.img -rw------- 1 root root 50341850 15. Sep 09:45 initramfs-3.10.0-693.2.2.el7.x86_64.img -rw------- 1 root root 18147818 22. Okt 10:07 initramfs-3.10.0-693.2.2.el7.x86_64kdump.img -rw------- 1 root root 50393743 24. Okt 09:39 initramfs-3.10.0-693.5.2.el7.x86_64.img -rw------- 1 root root 18146720 24. Okt 09:40 initramfs-3.10.0-693.5.2.el7.x86_64kdump.img -rw-r--r--. 1 root root 611928 15. Sep 09:45 initrd-plymouth.img drwx------ 2 root root 12288 25. Mai 2016 lost+found -rw-r--r-- 1 root root 293093 5. Dez 01:07 symvers-3.10.0-693.11.1.el7.x86_64.gz -rw-r--r-- 1 root root 293110 4. Jan 02:21 symvers-3.10.0-693.11.6.el7.x86_64.gz -rw-r--r-- 1 root root 293109 25. Jan 21:28 symvers-3.10.0-693.17.1.el7.x86_64.gz -rw-r--r-- 1 root root 293064 13. Sep 00:40 symvers-3.10.0-693.2.2.el7.x86_64.gz -rw-r--r-- 1 root root 293084 20. Okt 22:59 symvers-3.10.0-693.5.2.el7.x86_64.gz -rw------- 1 root root 3228852 5. Dez 01:04 System.map-3.10.0-693.11.1.el7.x86_64 -rw------- 1 root root 3232490 4. Jan 02:19 System.map-3.10.0-693.11.6.el7.x86_64 -rw------- 1 root root 3232454 25. Jan 21:26 System.map-3.10.0-693.17.1.el7.x86_64 -rw------- 1 root root 3228852 13. Sep 00:38 System.map-3.10.0-693.2.2.el7.x86_64 -rw------- 1 root root 3228852 20. Okt 22:56 System.map-3.10.0-693.5.2.el7.x86_64 -rwxr-xr-x. 1 root root 5156528 15. Dez 2015 vmlinuz-0-rescue-34946d7b5edb0946bfb52c0f6cae67af -rwxr-xr-x 1 root root 5877504 5. Dez 01:05 vmlinuz-3.10.0-693.11.1.el7.x86_64 -rw-r--r-- 1 root root 171 5. Dez 01:05 .vmlinuz-3.10.0-693.11.1.el7.x86_64.hmac -rwxr-xr-x 1 root root 5889728 4. Jan 02:19 vmlinuz-3.10.0-693.11.6.el7.x86_64 -rw-r--r-- 1 root root 171 4. Jan 02:19 .vmlinuz-3.10.0-693.11.6.el7.x86_64.hmac -rwxr-xr-x 1 root root 5890720 25. Jan 21:26 vmlinuz-3.10.0-693.17.1.el7.x86_64 -rw-r--r-- 1 root root 171 25. Jan 21:26 .vmlinuz-3.10.0-693.17.1.el7.x86_64.hmac -rwxr-xr-x 1 root root 5878848 13. Sep 00:38 vmlinuz-3.10.0-693.2.2.el7.x86_64 -rw-r--r-- 1 root root 170 13. Sep 00:38 .vmlinuz-3.10.0-693.2.2.el7.x86_64.hmac -rwxr-xr-x 1 root root 5878368 20. Okt 22:56 vmlinuz-3.10.0-693.5.2.el7.x86_64 -rw-r--r-- 1 root root 170 20. Okt 22:56 .vmlinuz-3.10.0-693.5.2.el7.x86_64.hmac
# cat /etc/grub2.cfg # # DO NOT EDIT THIS FILE # # It is automatically generated by grub2-mkconfig using templates # from /etc/grub.d and settings from /etc/default/grub #
### BEGIN /etc/grub.d/00_header ### set pager=1
if [ -s $prefix/grubenv ]; then load_env fi if [ "${next_entry}" ] ; then set default="${next_entry}" set next_entry= save_env next_entry set boot_once=true else set default="${saved_entry}" fi
if [ x"${feature_menuentry_id}" = xy ]; then menuentry_id_option="--id" else menuentry_id_option="" fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then set saved_entry="${prev_saved_entry}" save_env saved_entry set prev_saved_entry= save_env prev_saved_entry set boot_once=true fi
function savedefault { if [ -z "${boot_once}" ]; then saved_entry="${chosen}" save_env saved_entry fi }
function load_video { if [ x$feature_all_video_module = xy ]; then insmod all_video else insmod efi_gop insmod efi_uga insmod ieee1275_fb insmod vbe insmod vga insmod video_bochs insmod video_cirrus fi }
terminal_output console if [ x$feature_timeout_style = xy ] ; then set timeout_style=menu set timeout=5 # Fallback normal timeout code in case the timeout_style feature is # unavailable. else set timeout=5 fi ### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/00_tuned ### set tuned_params="" ### END /etc/grub.d/00_tuned ###
### BEGIN /etc/grub.d/01_users ### if [ -f ${prefix}/user.cfg ]; then source ${prefix}/user.cfg if [ -n "${GRUB2_PASSWORD}" ]; then set superusers="root" export superusers password_pbkdf2 root ${GRUB2_PASSWORD} fi fi ### END /etc/grub.d/01_users ###
### BEGIN /etc/grub.d/10_linux ### menuentry 'CentOS Linux (3.10.0-693.17.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.13.1.el7.x86_64-advanced-2a4bc862-eb7a-46b1-8979-d19c873dca3b' { load_video set gfxpayload=keep insmod gzio insmod part_msdos insmod part_msdos insmod diskfilter insmod mdraid1x insmod ext2 set root='mduuid/84bbf877f8bd0f7aa0c64064178966b4' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint='mduuid/84bbf877f8bd0f7aa0c64064178966b4' 2206a439-5490-46d0-8d5e-9da8962924df else search --no-floppy --fs-uuid --set=root 2206a439-5490-46d0-8d5e-9da8962924df fi linux16 /vmlinuz-3.10.0-693.17.1.el7.x86_64 root=/dev/md/2 ro nomodeset rd.auto=1 crashkernel=auto LANG=en_US.UTF-8 initrd16 /initramfs-3.10.0-693.17.1.el7.x86_64.img } menuentry 'CentOS Linux (3.10.0-693.11.6.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.13.1.el7.x86_64-advanced-2a4bc862-eb7a-46b1-8979-d19c873dca3b' { load_video set gfxpayload=keep insmod gzio insmod part_msdos insmod part_msdos insmod diskfilter insmod mdraid1x insmod ext2 set root='mduuid/84bbf877f8bd0f7aa0c64064178966b4' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint='mduuid/84bbf877f8bd0f7aa0c64064178966b4' 2206a439-5490-46d0-8d5e-9da8962924df else search --no-floppy --fs-uuid --set=root 2206a439-5490-46d0-8d5e-9da8962924df fi linux16 /vmlinuz-3.10.0-693.11.6.el7.x86_64 root=/dev/md/2 ro nomodeset rd.auto=1 crashkernel=auto LANG=en_US.UTF-8 initrd16 /initramfs-3.10.0-693.11.6.el7.x86_64.img } menuentry 'CentOS Linux (3.10.0-693.11.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.13.1.el7.x86_64-advanced-2a4bc862-eb7a-46b1-8979-d19c873dca3b' { load_video set gfxpayload=keep insmod gzio insmod part_msdos insmod part_msdos insmod diskfilter insmod mdraid1x insmod ext2 set root='mduuid/84bbf877f8bd0f7aa0c64064178966b4' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint='mduuid/84bbf877f8bd0f7aa0c64064178966b4' 2206a439-5490-46d0-8d5e-9da8962924df else search --no-floppy --fs-uuid --set=root 2206a439-5490-46d0-8d5e-9da8962924df fi linux16 /vmlinuz-3.10.0-693.11.1.el7.x86_64 root=/dev/md/2 ro nomodeset rd.auto=1 crashkernel=auto LANG=en_US.UTF-8 initrd16 /initramfs-3.10.0-693.11.1.el7.x86_64.img } menuentry 'CentOS Linux (3.10.0-693.5.2.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.13.1.el7.x86_64-advanced-2a4bc862-eb7a-46b1-8979-d19c873dca3b' { load_video set gfxpayload=keep insmod gzio insmod part_msdos insmod part_msdos insmod diskfilter insmod mdraid1x insmod ext2 set root='mduuid/84bbf877f8bd0f7aa0c64064178966b4' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint='mduuid/84bbf877f8bd0f7aa0c64064178966b4' 2206a439-5490-46d0-8d5e-9da8962924df else search --no-floppy --fs-uuid --set=root 2206a439-5490-46d0-8d5e-9da8962924df fi linux16 /vmlinuz-3.10.0-693.5.2.el7.x86_64 root=/dev/md/2 ro nomodeset rd.auto=1 crashkernel=auto LANG=en_US.UTF-8 initrd16 /initramfs-3.10.0-693.5.2.el7.x86_64.img } menuentry 'CentOS Linux (3.10.0-693.2.2.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.13.1.el7.x86_64-advanced-2a4bc862-eb7a-46b1-8979-d19c873dca3b' { load_video set gfxpayload=keep insmod gzio insmod part_msdos insmod part_msdos insmod diskfilter insmod mdraid1x insmod ext2 set root='mduuid/84bbf877f8bd0f7aa0c64064178966b4' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint='mduuid/84bbf877f8bd0f7aa0c64064178966b4' 2206a439-5490-46d0-8d5e-9da8962924df else search --no-floppy --fs-uuid --set=root 2206a439-5490-46d0-8d5e-9da8962924df fi linux16 /vmlinuz-3.10.0-693.2.2.el7.x86_64 root=/dev/md/2 ro nomodeset rd.auto=1 crashkernel=auto LANG=en_US.UTF-8 initrd16 /initramfs-3.10.0-693.2.2.el7.x86_64.img } menuentry 'CentOS Linux (0-rescue-34946d7b5edb0946bfb52c0f6cae67af) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-34946d7b5edb0946bfb52c0f6cae67af-advanced-2a4bc862-eb7a-46b1-8979-d19c873dca3b' { load_video insmod gzio insmod part_msdos insmod part_msdos insmod diskfilter insmod mdraid1x insmod ext2 set root='mduuid/84bbf877f8bd0f7aa0c64064178966b4' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint='mduuid/84bbf877f8bd0f7aa0c64064178966b4' 2206a439-5490-46d0-8d5e-9da8962924df else search --no-floppy --fs-uuid --set=root 2206a439-5490-46d0-8d5e-9da8962924df fi linux16 /vmlinuz-0-rescue-34946d7b5edb0946bfb52c0f6cae67af root=UUID=2a4bc862-eb7a-46b1-8979-d19c873dca3b ro nomodeset rd.auto=1 crashkernel=auto initrd16 /initramfs-0-rescue-34946d7b5edb0946bfb52c0f6cae67af.img } if [ "x$default" = 'CentOS Linux (3.10.0-327.13.1.el7.x86_64) 7 (Core)' ]; then default='Advanced options for CentOS Linux>CentOS Linux (3.10.0-327.13.1.el7.x86_64) 7 (Core)'; fi; ### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ### ### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/20_ppc_terminfo ### ### END /etc/grub.d/20_ppc_terminfo ###
### BEGIN /etc/grub.d/30_os-prober ### ### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/40_custom ### # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. ### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ### if [ -f ${config_directory}/custom.cfg ]; then source ${config_directory}/custom.cfg elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then source $prefix/custom.cfg; fi ### END /etc/grub.d/41_custom ###
Thank you for any hints Alex
Could someone please suggest me, which files in my /boot partition would be safe to delete?
Don't "delete" anything. It's to do with old kernels - kernels aren't updated as such, new ones are just installed. So long as you don't need the old kernels, just remove the old kernel RPMs.
In fact there are a number of tools to help you. By default yum keeps 5 versions of old kernels (which is usually too many for the default /boot size - good joined-up thinking there!), that number is specified in /etc/yum.conf as "installonly_limit=5" - change that to a suitable number for you, personally I use '3', some people have '2' - don't put it at '1' because then you'll not be able to use an old version to boot in to in emergency.
The package yum-utils has the package-cleanup command to deal with various yum issues, including sorting out old kernels. Do
package-cleanup --oldkernels --count=3
to clean everything to do with old kernels leaving 3 versions on your system.
P.
Thank you Pete for the very insightful answer!
This has worked like a charm -
On Wed, Feb 7, 2018 at 10:16 AM, Pete Biggs pete@biggs.org.uk wrote:
In fact there are a number of tools to help you. By default yum keeps 5 versions of old kernels (which is usually too many for the default /boot size - good joined-up thinking there!), that number is specified in /etc/yum.conf as "installonly_limit=5" - change that to a suitable number for you, personally I use '3', some people have '2' - don't put it at '1' because then you'll not be able to use an old version to boot in to in emergency.
The package yum-utils has the package-cleanup command to deal with various yum issues, including sorting out old kernels. Do
package-cleanup --oldkernels --count=3
to clean everything to do with old kernels leaving 3 versions on your system.
I had:
/dev/md1 488M 428M 34M 93% /boot
Then I after running
# package-cleanup --oldkernels --count=3 Loaded plugins: fastestmirror --> Running transaction check ---> Package kernel.x86_64 0:3.10.0-693.2.2.el7 will be erased ---> Package kernel.x86_64 0:3.10.0-693.5.2.el7 will be erased --> Finished Dependency Resolution
Dependencies Resolved
================================================================================ Package Arch Version Repository Size ================================================================================ Removing: kernel x86_64 3.10.0-693.2.2.el7 @updates 59 M kernel x86_64 3.10.0-693.5.2.el7 @updates 59 M
Transaction Summary ================================================================================ Remove 2 Packages
Installed size: 119 M Is this ok [y/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Erasing : kernel.x86_64 1/2 Erasing : kernel.x86_64 2/2 Verifying : kernel-3.10.0-693.5.2.el7.x86_64 1/2 Verifying : kernel-3.10.0-693.2.2.el7.x86_64 2/2
Removed: kernel.x86_64 0:3.10.0-693.2.2.el7 kernel.x86_64 0:3.10.0-693.5.2.el7
Complete!
I've ended up with comforting
/dev/md1 488M 279M 184M 61% /boot
Have a nice day! Alex