projectacrn / acrn-kernel

Kernel tree for ACRN
Other
88 stars 150 forks source link

Logical Volume Manager ( LVM Linux ) in SOS Linux is supported? #323

Open ionutnechita opened 3 years ago

ionutnechita commented 3 years ago

Hi ACRN team,

I try to boot with LVM disk partition, but SOS enter in kernel panic. LVM is supported in Kernel and SOS kernel config file?

Thanks.

gvancuts commented 3 years ago

It looks like most LVM stuff (device mapper) is in. Can you share your boot configuration, i.e. Grub config file, kernel command-line and if you can where the kernel panicks?

ionutnechita commented 3 years ago

Partial Grub config:

BEGIN /etc/grub.d/40_custom

menuentry 'ACRN multiboot2 ' --id ACRN_deb_multiboot2 {
        load_video
        insmod gzio
        insmod part_gpt
        insmod ext2
    search --no-floppy --fs-uuid  --set "f67bcfe3-406b-4436-bc73-48beb07777b8"
    multiboot2 /boot/acrn.bin root=PARTUUID=/dev/mapper/vg1--n2-root: UUID="f67bcfe3-406b-4436-bc73-48beb07777b8" TYPE="ext4" loglevel=7
    module2 /boot/vmlinuz-5.4.51-PKT-200203T060100Z Linux_bzImage

    }

blkid /dev/sda1: UUID="2FD5-FD5D" TYPE="vfat" PARTUUID="baafe496-c2bf-425d-9793-a4a0d12487fd" /dev/sda2: UUID="POPDvB-XcGo-APf3-muUy-rAfr-n2EU-vdRYSB" TYPE="LVM2_member" PARTUUID="e411dc8a-e077-4cc5-8459-13e8d777e0f9" /dev/mapper/vg1--n2-root: UUID="f67bcfe3-406b-4436-bc73-48beb07777b8" TYPE="ext4" /dev/mapper/vg1--n2-swap_1: UUID="22fcc571-60d4-49f5-ac7f-9546e323e5d8" TYPE="swap"

Config Kernel SOS: config-5.4.51-PKT-200203T060100Z.txt

lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 489.1G 0 disk ├─sda1 8:1 0 512M 0 part /boot/efi └─sda2 8:2 0 488.6G 0 part ├─vg1--n2-root 253:0 0 487.6G 0 lvm / └─vg1--n2-swap_1 253:1 0 980M 0 lvm [SWAP]

Kernel panics for detect init and root partition.

gvancuts commented 3 years ago

Hi @ionutnechita , I do not have (yet) any hands-on experience with booting a system off LVM. But my understanding is that it requires some initramfs because some user-space utilities are needed to mount those partitions. Enabling the right kernel options may not be sufficient.

If true, I don't know how to create and use such initramfs off the top of my head, especially with this multiboot2 protocol. Perhaps @ZideChen0 or @jsun26intel know more about this?

ZideChen0 commented 3 years ago

To load ramdisk, you may try:

1) add the ramdisk_mod_tag to vm_configurations.c. You may use acrn config tool or modify ACRN source code directly. For example:

@@ -30,6 +30,7 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
                        .name = "ACRN Service OS",
                        .kernel_type = KERNEL_BZIMAGE,
                        .kernel_mod_tag = "Linux_bzImage",
+                       .ramdisk_mod_tag = "xxxxx",
                        .bootargs = SOS_VM_BOOTARGS,
                },

2) add one line to the grub config file: module2 /boot/your_initrd xxxxx

Before doing this, probably you may play on native Linux to load kernel from non-LVM and mount root from LVM first to make sure every component is properly configured. BTW, SOS kernel is supposed to be boot on native without ACRN.

gvancuts commented 3 years ago

Thanks @ZideChen0 !

@ionutnechita , is this something you can try?

  1. Boot the ACRN Service VM kernel natively and see that it can find and mount the rootfs? As mentionned, I suspect you'll need to construct an initramfs for this.
  2. Once step 1 works correctly, try to do the same via ACRN and multiboot2 as described above, using the same kernel and initramfs
ionutnechita commented 3 years ago

Ok, understood this two steps.

Thanks @gvancuts and @ZideChen0.

Will be try in feature this configuration.