lima-vm / lima

Linux virtual machines, with a focus on running containers
https://lima-vm.io/
Apache License 2.0
15.48k stars 608 forks source link

Expose Linux kernel command line #2011

Open LaszloGombos opened 1 year ago

LaszloGombos commented 1 year ago

Description

Expose the linux kernel command line in limactl start.

qemu

-append cmdline
Use cmdline as kernel command line

VZLinuxBootLoader

AkihiroSuda commented 1 year ago

For QEMU, we already have this: https://github.com/lima-vm/lima/blob/a21b5f3bbcb63a37987a328e63d8a1a9f1c2e098/pkg/limayaml/limayaml.go#L80-L83

ericdbishop commented 11 months ago

First time contributor but I'd like to work on a PR for this issue, could it be assigned to me?

jandubois commented 11 months ago

First time contributor but I'd like to work on a PR for this issue, could it be assigned to me?

Sure, thank you!

ericdbishop commented 11 months ago

For QEMU, we already have this:

https://github.com/lima-vm/lima/blob/a21b5f3bbcb63a37987a328e63d8a1a9f1c2e098/pkg/limayaml/limayaml.go#L80-L83

Shouldn't you be able to specify kernel cmdline options without including the File struct parameters? It seems like this is only used in a very specific instance to run u-boot:

https://github.com/lima-vm/lima/blob/b453dedb757e5fc1e249f352d0812d008e66fa3f/examples/experimental/riscv64.yaml#L14-L19

Could I move cmdline to the top-level of the config? Or is there another way you'd suggest making it possible to add cmdline to the config without the file location?

AkihiroSuda commented 11 months ago

Shouldn't you be able to specify kernel cmdline options without including the File struct parameters?

How to specify vmlinuz then?

ericdbishop commented 11 months ago

So in an instance where you specify kernel cmdline options, you want it to be a requirement to specify a file for the kernel? Just want to make sure that is the intended behavior. It seemed to me like those things shouldn't necessarily be dependent on each other.

AkihiroSuda commented 11 months ago

So in an instance where you specify kernel cmdline options, you want it to be a requirement to specify a file for the kernel? Just want to make sure that is the intended behavior.

Yes

It seemed to me like those things shouldn't necessarily be dependent on each other.

ncopa commented 3 weeks ago

I missed this option today when I had to rescue an Alpine VM. The kernel in the VM was broken, and I needed to boot a different kernel/initrd. I looked for how to pass -kernel <file> -initrd <file> -append <cmdline> to lima, but I didn't find anythign about it. I ended up limactl start .. (which didnt work ofc) , and pasted output of ps xa|grep qemu to a file, and twaek the qemu args manually.