lima-vm / alpine-lima

Create an alpine based image for lima
Apache License 2.0
40 stars 26 forks source link

Include kernel config file #113

Open yzhao1012 opened 2 years ago

yzhao1012 commented 2 years ago

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.

afbjorklund commented 2 years ago

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.

yzhao1012 commented 2 years ago

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.

afbjorklund commented 2 years ago

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 ?

jandubois commented 2 years ago

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

afbjorklund commented 2 years ago

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.

jandubois commented 2 years ago

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
afbjorklund commented 2 years ago

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 ?

jandubois commented 2 years ago

I think it is just

mkmntdirs
mount -a
yzhao1012 commented 2 years ago

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?

jandubois commented 2 years ago

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

dimaqq commented 1 year ago

It's not on cdrom:

$ sudo find /media/cdrom/
/media/cdrom/
/media/cdrom/boot
/media/cdrom/boot/00-modprobe.sh
/media/cdrom/boot/01-alpine-ash-as-bash.sh
/media/cdrom/boot/04-persistent-data-volume.sh
/media/cdrom/boot/05-lima-disks.sh
/media/cdrom/boot/05-rosetta-volume.sh
/media/cdrom/boot/06-etc-hosts.sh
/media/cdrom/boot/07-etc-environment.sh
/media/cdrom/boot/08-shell-prompt.sh
/media/cdrom/boot/09-host-dns-setup.sh
/media/cdrom/boot/10-alpine-prep.sh
/media/cdrom/boot/11-colorterm-environment.sh
/media/cdrom/boot/20-rootless-base.sh
/media/cdrom/boot/25-guestagent-base.sh
/media/cdrom/boot/30-install-packages.sh
/media/cdrom/boot/35-setup-packages.sh
/media/cdrom/boot/40-install-containerd.sh
/media/cdrom/boot.sh
/media/cdrom/etc_environment
/media/cdrom/lima-guestagent
/media/cdrom/lima.env
/media/cdrom/meta-data
/media/cdrom/network-config
/media/cdrom/user-data
/media/cdrom/util
/media/cdrom/util/compare_version.sh

It is however, on a different mount (tried as root)

mkmntdirs
mount -a 
less /media/vda/boot/config-virt