Linux kernel

From Lolly's Wiki
Revision as of 11:34, 6 October 2022 by Lollypop (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


Break boot process before everything really starts

Sometimes, maybe after cloning a VM, you want to edit network settings and so on before your VM comes up with an IP address of the machine it is cloned from. In this moments a stop right after filesystems are mounted is a nice option. To do this you can put an additional option to the kernel options in grub during boot.

When grub shows up, navigate to your disired kernel and press e like edit. Find the line where the kernel is loaded (I always use ZFS so it looks like this at my installations):

linux   "/BOOT/ubuntu_ocpr44@/vmlinuz-5.15.0-48-generic" root=ZFS="rpool/ROOT/ubuntu_ocpr44" ro init_on_alloc=0

add the option break=bottom to the options:

linux   "/BOOT/ubuntu_ocpr44@/vmlinuz-5.15.0-48-generic" root=ZFS="rpool/ROOT/ubuntu_ocpr44" ro init_on_alloc=0 break=bottom

Press <ctrl>+<X> to boot tis setting.

After the initial boot process you will dropped into the initramfs shell:

(initramfs) _

At this point your root filesystem is mounted to /root so to edit network settings you need to modify the files under /root/etc/netplan.
For example:

(initramfs) vi /root/etc/netplan/ens160.yaml

To have always your favorite editor in your initramfs take a look at initramfs#Adding vi to initramfs