scaleway/kernel-tools

How to boot a kernel with different cmdline?

Opened this issue · 2 comments

irsl commented

Hi,

I need cgroup_enable=memory swapaccount=1 parameters added to my kernel command line arguments so that I could better limit memory consumption of my Docker containers.
I was googleing around but couldn't find any articles describing the proper way of accomplishing this with a Scaleway baremetal server.

If you could give me a hint, I'd appreciate it.

irsl commented

So, by reading the initrd source code, I guess something like the following server tags should do the work (I didn't have the time to test it yet):

KEXEC_KERNEL=latest
KEXEC_INITRD=http://169.254.42.24/initrd/initrd-Linux-x86_64-v3.12.7.gz KEXEC_APPEND="cgroup_enable=memory swapaccount=1"

The initrd url is coming from scw-metadata.

irsl commented

Had chance to experiment with it today. I learned:

The feature I was looking for is enabled by default on the bootscript/kernel combo (x86_64-mainline-lts-4.9-4.9.93-rev1) the SCW system assigned to me, without the need to specify anything explicitly at command line.

The approach above works, but the latest keyword at the kernel tag boots a vanilla OS kernel which did not recognize the ethernet interface for me. Instead of that I managed to make it work with the kernel url coming from the metadata:

KEXEC_KERNEL=http://169.254.42.24/kernel/x86_64-mainline-lts-4.9-4.9.93-rev1/vmlinuz-4.9.93
KEXEC_INITRD=http://169.254.42.24/initrd/initrd-Linux-x86_64-v3.14.4.gz
KEXEC_APPEND=foobar

root@scw-f12581:~# cat /proc/cmdline
showopts console=ttyS1,9600n8 nousb vga=0 root=/dev/nbd0 scaleway boot=local nbd.max_part=16 is_in_kexec=yes foobar

The official kernels 4.15.11 and 4.14.33 did not even boot (the root file system could not be mounted by initrd under /newroot). The 4.9.* kernels still unable to reboot and even cause file system corruption.
Nice system ;-)