kernelcompilationcetnos7

Question

Hi Team

i follow below URl for kernel compilation on centos7
https://linuxhint.com/compile-linux-kernel-centos7/

my current kernel version is 3.10.0-693.11.6.el7.x86_64
os is centos7.4 CentOS Linux release 7.4.1708 (Core)

after i follow the process , i found that , my old kernel got disappear .
is there any way to keep the old kernel also in place , so that if any bug or issue is found , we can revert back to the old version

before kernel compilation

 awk -F’ ‘$1==”menuentry ” {print i++ ” : ” $2}’ /etc/grub2.cfg
0 : CentOS Linux (3.10.0-693.11.6.el7.x86_64) 7 (Core)
1 : CentOS Linux (0-rescue-609bbd29e32a4898e604f49bff82a88c) 7 (Core)

after kernel compilation

 awk -F’ ‘$1==”menuentry ” {print i++ ” : ” $2}’ /etc/grub2.cfg
0 : CentOS Linux (4.18.6) 7 (Core)
1 : CentOS Linux (0-rescue-609bbd29e32a4898e604f49bff82a88c) 7 (Core)

Regards

solved 0
rr.manoj 1 year 3 Answers 15164 views

Answers ( 3 )

  1. Hi rr.manoj,

    By default, both the kernels should be available. I think, the old kernel won’t be deleted automatically.

     

    Can you run the following command and post the result here?

    $ ls /boot

    Thanks.

    • Hi Shahriar 

      Thanks for the reply
      below is the display of /boot after kernel compilation .3.10.0-69(vmlinuz file is missing)
      ls -la /boot/
      total 448336
      dr-xr-xr-x.  5 root root      4096 Sep 12 02:27 .
      dr-xr-xr-x. 19 root root      4096 Sep 12 02:20 ..
      -rw-r–r–   1 root root    175252 Sep 12 01:46 config-4.18.6
      drwxr-xr-x.  3 root root        17 Jan  8  2018 efi
      drwxr-xr-x.  2 root root        39 Sep 12 02:35 grub
      drwx——.  5 root root       109 Sep 12 02:12 grub2
      -rw——-.  1 root root  41356940 Jan  8  2018 initramfs-0-rescue-609bbd29e32a4898e604f49bff82a88c.img
      -rw——-.  1 root root  19597938 Jan  8  2018 initramfs-3.10.0-693.el7.x86_64.img
      -rw——-   1 root root 248291920 Sep 12 02:27 initramfs-4.18.6.img
      lrwxrwxrwx   1 root root        23 Sep 12 02:00 System.map -> /boot/System.map-4.18.6
      -rw-r–r–   1 root root   3529390 Sep 12 02:00 System.map-4.18.6
      -rwxr-xr-x   1 root root 132927949 Sep 12 01:40 vmlinux-4.18.6.bz2
      lrwxrwxrwx   1 root root        20 Sep 12 02:00 vmlinuz -> /boot/vmlinuz-4.18.6
      -rwxr-xr-x.  1 root root   5889728 Jan  8  2018 vmlinuz-0-rescue-609bbd29e32a4898e604f49bff82a88c
      -rw-r–r–   1 root root   7306720 Sep 12 02:00 vmlinuz-4.18.6

  2. I don’t really know why only the vmlinuz file was replaced with the new one, but the initramfs file for the old kernel is still there.

    Please try running the following command and see if you can select the old kernel from the GRUB menu at boot time.

    $ sudo grub2-mkconfig -o /boot/grub2/grub.cfg

     

    If that doesn’t work, then before upgrading the kernel, copy the vmlinuz and initramfs files for your old kernel somewhere safe. Then perform the kernel upgrade and once it’s complete, try copying the old vmlinuz and initramfs files back to the /boot directory. Then run

    $ sudo grub2-mkconfig -o /boot/grub2/grub.cfg

     

    It should work. Let me know how it goes. Thanks.

     

    Best answer

Leave an answer