How to Update kernel in Amazon EC2 Instances

Submitted by lwinmaungmaung on
Update Kernel Amazon EC2

Update kernel Amazon EC2 is not the easy way and sometimes leads to worse your instance by not connecting to your system. I have faced and as fast as I can, I have shared the problem with you. I work with gentoo.


Update Kernel Amazon EC2

This process has been described in EC2 Official Page:

Gentoo Update Kernel

It is also in:

The main problem is the New Kernel is not boot even grub is updated.


Go to boot dir by /boot

$ cd /boot

This boot will display the following

Update Kernel Amazon EC2- Change Kernel in symlink






And you will see the softlinks to kernel and initramfs and even

You have to replace these softlinks by

rm /boot/ /boot/initramfs /boot/kernel

ln -s /boot/initramfs-5.4.38-gentoo-x86_64.img /boot/initramfs

ln -s /boot/vmlinux-5.4.38-gentoo-x86_64 /boot/kernel

ln -s /boot/ /boot

After that reboot your machine.

How to Rescue when kernel not work

You can find detail in this YouTube Link:

When you boot your machine and take system screenshot and the following error may occurs:

* Bringing up interface eth0 
*     Caching network module dependencies 
*     ERROR: interface eth0 does not exist 
*     Ensure that you have loaded the correct kernel module for your hardware 
* ERROR: net.eth0 failed to start 
* ERROR: cannot start netmount as net.eth0 would not start

You can stop machine forcefully and detach and attach on another EC2 Instances

For example, if you mount with xvdf, you should mount like this

mount /xvdf1 /mnt

mount -o bind /dev /mnt/dev

mount -o bind /dev/shm /mnt/dev/shm

mount -o bind /proc /mnt/proc

mount -o bind /sys /mnt/sys

chroot /mnt

Your old Gentoo installation will occur in these area. You can type with the following exact command.

touch /etc/udev/rules.d/80-net-name-slot.rules 

According to this.