Description
Describe the bug
Currently, it is not possible to pass arguments to init using --
(ref) as extra arguments are appended after the user provided command line here. When a user uses --
, the behaviour causes essential arguments to be ignored as they will be passed to init.
In a bit of a contrived example, but for illustrations sake, let's imagine my init was to /bin/cat
a file.
When specifying kernel boot_args
such as console=ttyS0 nomodules random.trust_cpu=on reboot=k panic=1 pci=off ip=:::::eth0:dhcp init=/bin/cat -- /etc/password
, the aforementioned code block will append extra arguments which technically get discarded because of the the --
. The resultant command line would therefore be:
[ 0.000000] Command line: console=ttyS0 nomodules random.trust_cpu=on reboot=k panic=1 pci=off ip=:::::eth0:dhcp init=/bin/cat -- /etc/password root=/dev/vda rw virtio_mmio.device=4K@0xd0000000:5 virtio_mmio.device=4K@0xd0001000:6 virtio_mmio.device=4K@0xd0002000:7
To Reproduce
- Start firecracker with
firecracker --api-sock /tmp/firecracker.socket
. - Configure the kernel with the following JSON body:
{
"kernel_image_path":"/path/to/kern",
"boot_args":"console=ttyS0 nomodules random.trust_cpu=on reboot=k panic=1 pci=off ip=:::::eth0:dhcp init=/bin/cat -- /etc/password"
}
- Configure other parts to get a VM to boot.
- Start the instance and observe the
Command line:
output.
Expected behaviour
Kernel arguments such as root=
and virtio_mmio.device=
should appear before user supplied arguments.
Environment
- Arch : x86_64
- OS: Ubuntu 21.04
- Firecracker 0.24.6
Checks
- Have you searched the Firecracker Issues database for similar problems?
- Have you read the existing relevant Firecracker documentation?
- Are you certain the bug being reported is a Firecracker issue?