You are not logged in.

#1 2014-12-18 11:32:15

KablamoBoom
Member
Registered: 2014-12-16
Posts: 6

[SOLVED] LVM and Syslinux, Kernel Panic

Finally reached the bootloader menu after many failures. The countdown/enter button both simply refresh the menu, however, and it appears to be a kernel panic rather than syslinux.cfg error, as per https://wiki.archlinux.org/index.php/Sy … do_nothing. I've tested all possible drive names, as well as with UUIDs, so I'm feeling pretty confident the cfg is fine, but here it is:

DEFAULT arch
PROMPT 0
TIMEOUT 50

UI menu.c32

...
LABEL arch
     MENU LABEL Arch Linux
     LINUX ../vmlinuz-linux
     APPEND root=/dev/mapper/Crucial-root rw
     INITRD ../initramfs-linux.img

LABEL archfallback
     MENU LABEL Arch Linux
     LINUX ../vmlinuz-linux
     APPEND root=/dev/mapper/Crucial-root rw
     INITRD ../initramfs-linux-fallback.img

Pretty normal, right? Well, I think I may have misinterpreted the partitioning section of the beginners' guide. As you can see, I'm running LVM for root, as well as a home and a backup partition. I have a dedicated 2m BIOS boot partition for syslinux to boot into, legacy boot flags are set, etc. etc. But I've been mounting the partition in /mnt/boot...which is where vmlinuz-linux, the linux kernel is installed. I get the feeling I'm doing something wrong but I can find nothing on the wiki or elsewhere that distinguishes separate /boot partitions or BIOS boot partitions, and how they should be mounted (or even which of those are needed for LVM on syslinux). And...I could be wrong about my hunch. It's a small miracle I've made it this far with LVM. I am at wit's end. Thanks in advance.

Last edited by KablamoBoom (2014-12-19 08:38:40)

Offline

#2 2014-12-18 11:43:27

smirky
Member
From: Bulgaria
Registered: 2013-02-23
Posts: 277
Website

Re: [SOLVED] LVM and Syslinux, Kernel Panic

Can you provide more information? As I see your syslinux.cfg, there's no obvious problem. There's a few other things that might be thought...

$ grep ^HOOKS /etc/mkinitcpio.conf 
HOOKS="base udev autodetect modconf block lvm2 filesystems keyboard fsck"

Pay attention to where 'lvm2' is. It's important that it's between 'block' and 'filesystems'. Afterwards, a:

$ mkinitcpio -p linux

will be required.

If you did that correct, maybe:

$ vgdisplay
$ lvdisplay

might help getting more information to track down your problem. And of course, provide some logs if you can.


Personal spot  ::  https://www.smirky.net/  ::  Try not to get lost!

Offline

#3 2014-12-18 13:21:06

KairiTech
Member
From: Toronto, Canada
Registered: 2011-06-04
Posts: 275

Re: [SOLVED] LVM and Syslinux, Kernel Panic

You are not alone. Up to version 112 of device-mapper booting to root on LVM2 (RAID0 encrypted and with a detached LUKS header) worked flawlessly for me with both UEFI and syslinux.

Version 113 came and went and that seems to be when it broke. I still can't get the current 114 version of device-mapper to activate my LVM2 logical volumes during boot. I do see the volume group in /dev/mapper though.

I can get LVM2 to work perfectly (once I go back to a non-LVM2 root and again RAID0 encrypted and with a detached LUKS header for my data) but just not during boot to an LVM2 root.

See here.

Last edited by KairiTech (2014-12-18 13:35:48)

Offline

#4 2014-12-18 20:40:37

KablamoBoom
Member
Registered: 2014-12-16
Posts: 6

Re: [SOLVED] LVM and Syslinux, Kernel Panic

smirky wrote:
$ grep ^HOOKS /etc/mkinitcpio.conf 
HOOKS="base udev autodetect modconf block lvm2 filesystems keyboard fsck"

Pay attention to where 'lvm2' is. It's important that it's between 'block' and 'filesystems'. Afterwards, a:

$ mkinitcpio -p linux

will be required.

Yes, I've edited mkinitpio.conf, and run mkinitcpio -p linux after adding the lvm2 hook. I also edited lvm2.conf and disabled lvmetad.

smirky wrote:
$ vgdisplay
$ lvdisplay

might help getting more information to track down your problem. And of course, provide some logs if you can.

Right-o. Shoulda thought of that.

root@archiso ~ # modprobe dm-mod
root@archiso ~ # vgchange -ay
root@archiso ~ # vgdisplay
  --- Volume group ---
  VG Nam                       Crucial
  System ID
  Format		lvm2
  Metadata Areas	1
  Metadata Sequence No	4
  VG Access		read/write
  VG Status		resizeable
  MAX LV		0
  Cur LV		3
  Open LV		0
  Max PV		0
  Cur PV		1
  Act PV		1
  VG Size		238.47 GiB
  PE Size		4.00 MiB
  Total PE		61048
  Alloc PE / Size	61048 / 238.47
  Free PE / Size	0 / 0
  VG UUID		AmlqFo-xj6v-fKwm-Oqxm-tI2o-KIeu-4nHL4k

root@archiso ~ # lvdisplay		#ugh typing this up manually...
  --- Logical Volume ---
  LV Path		/dev/Crucial/root
  LV Name		root
  VG Name		Crucial
  LV UUID		udb3tn-70Bw-EFm4-4o3t-kiay-1fOv-HHwCXP
  LV Write Access	read/write
  LV Creation host, time	archiso, 2014-12-16 10:39:53 +0000
  LV Status		available
  # open		0
  LV Size		15.00 GiB
  Current LE		3840
  Segments		1
  Allocation		inherit
  Read ahead sectors	auto
  - currently set to	256
  Block device		254:1

  --- Logical Volume ---
  LV Path		/dev/Crucial/backup
  LV Name		backup
  VG Name		Crucial
  LV UUID		vEm3Sw-HE2RUSj1-fueC-koe6-VkvS-16bG5c
  LV Write Access	read/write
  LV Creation host, time	archiso, 2014-12-16 10:40:09 +0000
  LV Status		available
  # open		0
  LV Size		10.00 GiB
  Current LE		2560
  Segments		1
  Allocation		inherit
  Read ahead sectors	auto
  - currently set to	256
  Block device	254:2

  --- Logical Volume ---
  LV Path		/dev/Crucial/home
  LV Name		home
  VG Name		Crucial
  LV UUID		29cw1U-9I1n-uh5N-p97d-mDve-qAjs-vt7h3a
  LV Write Access	read/write
  LV Creation host, time	archiso, 2014-12-16 10:40:43 +0000
  LV Status		available
  # open		0
  LV Size		213.47 GiB
  Current LE		54648
  Segments		1
  Allocation		inherit
  Read ahead sectors	auto
  - currently set to	256
  Block device		254:3

It wasn't until quite recently that I understood the BIOS Boot partition required when using LVM is not the same as deciding to make your /boot directory a separate partition. I've been mounting my 2m BIOS Boot partition on /mnt/boot, where the linux kernel is stored, and I realized when I mount it all the other files in that pre-existing directory disappear. I'm assuming this is a bad thing, and the reason why the bootloader kernel panics when I try to boot. If this is the problem though, I'm lost as to the solution - the wiki doesn't go into great detail with LVM partitions running a syslinux bootloader. Thanks so much for your help.

EDIT: I have GParted live on another USB, I am prepared to deal with the consequences of my mistakes or what have you. Just please...please don't make me type up lvdisplay output again. It took ages...

Last edited by KablamoBoom (2014-12-18 20:44:35)

Offline

#5 2014-12-18 20:59:41

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,138
Website

Re: [SOLVED] LVM and Syslinux, Kernel Panic

It wasn't until quite recently that I understood the BIOS Boot partition required when using LVM...

A BIOS Boot partition is not required when using LVM. It is not required when using syslinux. It is only used by GRUB not by syslinux.

...is not the same as deciding to make your /boot directory a separate partition.

Yes that part is correct.
Remember that syslinux doesn't allow booting from LVM "/boot" subvolume. You need to have a separated normal partition for it and mount it under "/boot".

I realized when I mount it all the other files in that pre-existing directory disappear. I'm assuming this is a bad thing, and the reason why the bootloader kernel panics when I try to boot. If this is the problem though, I'm lost as to the solution

The solution is to mount the /boot partition to a different directory like /mnt ONCE, then move the files from /boot to /mnt. Then make sure that the partition for /boot is specified in /etc/fstab so that it is mounted when you start the computer.

Last edited by teateawhy (2014-12-18 21:00:57)

Offline

#6 2014-12-18 21:31:22

KablamoBoom
Member
Registered: 2014-12-16
Posts: 6

Re: [SOLVED] LVM and Syslinux, Kernel Panic

teateawhy wrote:

A BIOS Boot partition is not required when using LVM. It is not required when using syslinux. It is only used by GRUB not by syslinux.

Remember that syslinux doesn't allow booting from LVM "/boot" subvolume. You need to have a separated normal partition for it and mount it under "/boot".

Oh boy. So the 2MiB BIOS boot partition I've got is pointless. This is good. But I'll need to create another boot partition in its place...maybe ~100MiB of type 8300 (Linux filesystem) with ext2fs, and enabled legacy boot flag, then reinstall Arch and syslinux taking into account the new /boot part. Does that sound about right? Then the kernel and syslinux directory will both be on one partition, mounted to /mnt/boot. I'm just not sure how much space exactly is required by syslinux and all the kernel files stored in the /boot dir.

teateawhy wrote:

The solution is to mount the /boot partition to a different directory like /mnt ONCE, then move the files from /boot to /mnt. Then make sure that the partition for /boot is specified in /etc/fstab so that it is mounted when you start the computer.

Sounds reasonable, but if my /boot partition is only two megs, I don't think it can hold all the files in /boot. Just want to make sure I'm getting this right before frolicking about with GParted.

Offline

#7 2014-12-19 08:26:42

KablamoBoom
Member
Registered: 2014-12-16
Posts: 6

Re: [SOLVED] LVM and Syslinux, Kernel Panic

So I took the initiative and shrank the LVM part with GParted, then remade the boot part a little bigger. Tadaa! It works!

...partially. When I try to boot into Arch at the syslinux load page I get an error because syslinux isn't finding /dev/mapper/Crucial-root. After some googling and forum searching I found this: https://bbs.archlinux.org/viewtopic.php?id=167000. I'd already remade mkinitcpio.conf and I know syslinux.cfg is pointing to the right root partition. Additionally, systemd is just fine. One person (post #4) recommended manually scanning and activating the volume group, then exiting to re-try. This works completely, but I'm wondering why the VG isn't getting automatically activated.

I also found a similar-looking problem on the Ubuntu forums, though there's no way to say if it's really similar, as I don't know enough of the architecture of that distro. http://ubuntuforums.org/showthread.php?t=1564411

The main question I have is why the VG gets activated when booting from live media but not when booting from the main drive. For now manually running vgscan and vgchange -ay is fine, but I'm going to keep looking for a solution. Advice appreciated.

---------------------

EDIT: Forgot to add dm-mod to the modules in mkinitcpio.conf. I think. Wasn't mentioned in the main wiki, but found it on the LVM page. Seems to be working 100% now. Marking topic as solved. Here were the steps leading up to now.

1. Remove existing /boot part (if one exists) and clean up the /boot directory.
2. Boot into live media and shrink your filesystem and logical volume:

# resize2fs /dev/VolGroup00/lvolhome xxG
# lvresize -L -xxG VolGroup00/lvolhome
# resize2fs /dev/VolGroup00/lvolhome

3. Use GParted or similar partitioning tool to move the LVM partition to the end of your drive.
4. Create a new /boot partition using gptfdisk defaults on /dev/sda1.
5. Create the filesystem and mount it on /mnt/boot
6. Reinstall Arch with pacstrap /mnt base.
7. Chroot into the drive and remake mkinitcpio with lvm2 hook and dm-mod module.
8. Reinstall syslinux with syslinux-install_update -iam.
9. Edit /boot/syslinux/syslinux,cfg so that the APPEND root= lines point to your root like so:

# nano /boot/syslinux/syslinux.cfg
...
LABEL arch
        ...
        APPEND root=/dev/mapper/vgname-lvname rw
        ...
LABEL archfallback
        ...
        APPEND root=/dev/mapper/vgname-lvname rw
        ...

10. Exit and reboot.

Offline

#8 2014-12-19 08:29:56

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] LVM and Syslinux, Kernel Panic

Please remember to mark your thread as [Solved] by editing your first post and prepending it to the title.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB