lima icon indicating copy to clipboard operation
lima copied to clipboard

Include kernel config file

Open yzhao1012 opened this issue 3 years ago • 10 comments

Description

IIUC, Lima uses a Ubuntu distro.

Ubuntu has a kernel config file that includes the value of all of the kernel source configuration entries. Ubuntu puts that file at /boot/config-$(uname -r).

Pixie (px.dev) reads this config file at runtime, to determine the right configuration entry for compiling C code to BPF byte code using BCC.

Let me know if I could help with any changes.

yzhao1012 avatar Jun 01 '22 23:06 yzhao1012

It seems to be there, for the "default":

anders@lima-default:/home/anders$ ls /boot/
System.map-5.15.0-25-generic  config-5.15.0-25-generic  efi  grub  initrd.img  initrd.img-5.15.0-25-generic  initrd.img.old  vmlinuz  vmlinuz-5.15.0-25-generic  vmlinuz.old

Maybe you are thinking of alpine-lima ?

It uses a "Live CD" boot mechanism, and the kernel config is elsewhere.

lima-alpine:/home/anders$ ls /boot
ls: /boot: No such file or directory

Currently it is at /media/cdrom/boot/config-virt, for the "virt" kernel.

afbjorklund avatar Jun 02 '22 05:06 afbjorklund

Oh nice, let me verify the /media/cdrom/boot/config-virt.

For background, my use case is with https://github.com/rancher-sandbox/rancher-desktop, which uses lima to create VM. I'll also submit an issue at rancher-sandbox's repo to gather their suggestions.

yzhao1012 avatar Jun 02 '22 16:06 yzhao1012

One approach is to use CONFIG_IKCONFIG_PROC, which makes it available in /proc/config.gz.

But making the config file configurable is probably also a viable approach, and default to /boot files ?

afbjorklund avatar Jun 02 '22 16:06 afbjorklund

It is available at /media/sr0/boot/config-virt

jandubois avatar Jun 02 '22 16:06 jandubois

It is available at /media/sr0/boot/config-virt

Right, seems like the mountpoint changed in 3.15.


lima-alpine:/home/anders/alpine-lima$ more /etc/fstab 
/dev/cdrom      /media/cdrom    iso9660 noauto,ro 0 0
/dev/usbdisk    /media/usb      vfat    noauto,ro 0 0
#LIMA-START
#LIMA-END
lima-alpine:/home/anders/alpine-lima$ ls -l /dev/cdrom
lrwxrwxrwx    1 root     root             3 Jun  2 16:45 /dev/cdrom -> sr0

Should be the same thing.

afbjorklund avatar Jun 02 '22 16:06 afbjorklund

Should be the same thing.

But somehow it isn't:

lima-rancher-desktop:~$ more /etc/fstab
/dev/cdrom      /media/cdrom    iso9660 noauto,ro 0 0
/dev/usbdisk    /media/usb      vfat    noauto,ro 0 0
#LIMA-START
#LIMA-END
lima-rancher-desktop:~$ ls -l /dev/cdrom
lrwxrwxrwx    1 root     root             3 Jun  2 16:38 /dev/cdrom -> sr0
lima-rancher-desktop:~$ ls /media/cdrom
lima-rancher-desktop:~$ ls /media/sr0
alpine.apkovl.tar.gz  apks                  boot                  efi

jandubois avatar Jun 02 '22 16:06 jandubois

Indeed confusing.

/etc/fstab:/dev/cdrom	/media/cdrom	iso9660	noauto,ro 0 0
/etc/mtab:/dev/sr0 /media/sr0 iso9660 ro,relatime,nojoliet,check=s,map=n,blocksize=2048,iocharset=utf8 0 0

Wonder who mounts things ?

afbjorklund avatar Jun 02 '22 16:06 afbjorklund

I think it is just

mkmntdirs
mount -a

jandubois avatar Jun 02 '22 16:06 jandubois

I am not familiar with filesystem setups, but is there a way to ssh to the Lima VM, so that I could manually examine my local VM setup in rancher-desktop?

yzhao1012 avatar Jun 02 '22 17:06 yzhao1012

I've already replied in https://github.com/rancher-sandbox/rancher-desktop/discussions/2324#discussioncomment-2873022

jandubois avatar Jun 02 '22 17:06 jandubois