Broken system : unable to boot - Question 4

I have a lot of questions about how to repair a broken system. I have already read a lot of things on your forum.
As I did not want to mix different questions with different answers I am going to open a thread for each subject.

Before system got broken :

 uname -a
Linux linux-u6go 4.4.104-39-default #1 SMP Thu Jan 4 08:11:03 UTC 2018 (7db1912) x86_64 x86_64 x86_64 GNU/Linux

Hardware info :
— ! —

Question 4 .

To update the nvidia driver ( the hardway ) I use to use the following script after rebooting in text mode ( init 3 ) :

When running the command

CMD="zypper rm drm-kmp-default
echo "$CMD"
eval "$CMD"

I did not pay attention that the zypper command was going to remove the kernel
And I have silly accepted the command.

Then zypper removed the kernel, leaving the system unbootable.

How is it possible ?

I would not have expected that to happen.

Once, a long time ago (maybe 2006), I found myself without a kernel. That was before the multi-version kernel setup. So the updater (I think it was called “zen” back then) deleted the current kernel. Then it failed to install the new kernel because there wasn’t enough space in “/boot”.

I was lucky. I noticed it before rebooting. So I cleared some space in “/boot”, and used Yast to install a kernel.

Back to your problem.

You will need a way of booting. Either boot to the installer in rescue mode. Or maybe used the Tumbleweed Rescue live CD.

If you can boot to that, then:

Mount your root file system at “/mnt”.
Mount all other file systems as appropriate, relative to “/mnt”. For example you would mount the “/home” file system to “/mnt/home” and any “/boot” file system to “/mnt/boot”. And if this is an EFI box, mount the EFI partition to “/mnt/boot/efi”.

When you have that all done:

mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys

At that point, you should be able to chroot into the mounted system

chroot /mnt

You will be in a bash shell. You can run yast (the command line ncurses version) to install a kernel. Or you can use zypper to install a kernel.

Then exit from “chroot” shell, reboot and you should be back in business.