Kernel compilation with lvm
Hello, I'm new to crux and I would like to test it. Unfortunately, after the installation the system doesn't boot. I use lilo as bootloader and I have installed lvm. There is a partition for /boot (without lvm) and another one with lvm for the other directories. I have compiled my kernel without initrd. After searching, I think an initrd is necessary with lvm. In "core" or "opt" the utility "mkinitrd" is not available. Is there an alternative to "mkinitrd" to create the initrd ? Thanks! Regards, Cédric
I haven't done that with Crux, but your thoughts are correct - if you have the root filesystem on LVM you need an initrd to expose it so it can be mounted. Would be curious about the process myself as I have only done it on Arch and Gentoo where it is rather black boxish. On Mar 30, 2015 4:49 PM, "Cédric" <grandspas@opmbx.org> wrote:
Hello,
I'm new to crux and I would like to test it. Unfortunately, after the installation the system doesn't boot. I use lilo as bootloader and I have installed lvm. There is a partition for /boot (without lvm) and another one with lvm for the other directories.
I have compiled my kernel without initrd. After searching, I think an initrd is necessary with lvm. In "core" or "opt" the utility "mkinitrd" is not available. Is there an alternative to "mkinitrd" to create the initrd ?
Thanks!
Regards,
Cédric _______________________________________________ CRUX mailing list CRUX@lists.crux.nu https://lists.crux.nu/mailman/listinfo/crux
On 03/30/15 20:43, Cédric wrote:
Hello,
I'm new to crux and I would like to test it. Unfortunately, after the installation the system doesn't boot. I use lilo as bootloader and I have installed lvm. There is a partition for /boot (without lvm) and another one with lvm for the other directories.
I have compiled my kernel without initrd. After searching, I think an initrd is necessary with lvm. In "core" or "opt" the utility "mkinitrd" is not available. Is there an alternative to "mkinitrd" to create the initrd ?
Maybe cd /usr/ports find -name .footprint | xargs grep mkinitrd will tell you which (contrib?) package provides it. Ah! Maybe not ... The Crux wiki entry https://crux.nu/Wiki/BuildingISO may be a starting point. The Makefile there seems to refer (at the initramfs Makefile target) to kernel/linux-3.xx.y/usr/gen_init_cpio which may be a substitute for what you are looking for. This Makefile taught me much more.
Thanks!
Regards,
- Thierry
Might be worth taking a look at Dracut, too. It isn't in ports but I think is still simpler than rolling your own initramfs the old way. On 30 March 2015 at 19:52, Thierry Moreau <thierry.moreau@connotech.com> wrote:
On 03/30/15 20:43, Cédric wrote:
Hello,
I'm new to crux and I would like to test it. Unfortunately, after the installation the system doesn't boot. I use lilo as bootloader and I have installed lvm. There is a partition for /boot (without lvm) and another one with lvm for the other directories.
I have compiled my kernel without initrd. After searching, I think an initrd is necessary with lvm. In "core" or "opt" the utility "mkinitrd" is not available. Is there an alternative to "mkinitrd" to create the initrd ?
Maybe
cd /usr/ports find -name .footprint | xargs grep mkinitrd
will tell you which (contrib?) package provides it.
Ah! Maybe not ...
The Crux wiki entry https://crux.nu/Wiki/BuildingISO may be a starting point. The Makefile there seems to refer (at the initramfs Makefile target) to
kernel/linux-3.xx.y/usr/gen_init_cpio
which may be a substitute for what you are looking for. This Makefile taught me much more.
Thanks!
Regards,
- Thierry
_______________________________________________ CRUX mailing list CRUX@lists.crux.nu https://lists.crux.nu/mailman/listinfo/crux
-- Photography at PBase.. www.pbase.com/sulman
Hi Cedric, I don't know what you need lvm for explicitly, but if it's possible with mdadm, you can work without an initramfs. I do so: <cite /boot/grub/grub.cfg> ... menuentry "CRUX 3.0 v4.0-rc5-131-g7fc377e" { linux /vmlinuz-v4.0-rc5-131-g7fc377e root=/dev/md0 } ... </cite> /boot, on the other hand is still a normal partition. Remember to compile all needed kernel components into the kernel and not as a module! Actually I can't think of a reason why lvm wouldn't work the same way, when all components are compiled into the kernel ... greetings, Erich Am 31.03.2015 um 13:55 schrieb James Trimbee:
Might be worth taking a look at Dracut, too. It isn't in ports but I think is still simpler than rolling your own initramfs the old way.
On 30 March 2015 at 19:52, Thierry Moreau <thierry.moreau@connotech.com <mailto:thierry.moreau@connotech.com>> wrote:
On 03/30/15 20:43, Cédric wrote:
Hello,
I'm new to crux and I would like to test it. Unfortunately, after the installation the system doesn't boot. I use lilo as bootloader and I have installed lvm. There is a partition for /boot (without lvm) and another one with lvm for the other directories.
I have compiled my kernel without initrd. After searching, I think an initrd is necessary with lvm. In "core" or "opt" the utility "mkinitrd" is not available. Is there an alternative to "mkinitrd" to create the initrd ?
Maybe
cd /usr/ports find -name .footprint | xargs grep mkinitrd
will tell you which (contrib?) package provides it.
Ah! Maybe not ...
The Crux wiki entry https://crux.nu/Wiki/__BuildingISO <https://crux.nu/Wiki/BuildingISO> may be a starting point. The Makefile there seems to refer (at the initramfs Makefile target) to
kernel/linux-3.xx.y/usr/gen___init_cpio
which may be a substitute for what you are looking for. This Makefile taught me much more.
Thanks!
Regards,
- Thierry
_________________________________________________ CRUX mailing list CRUX@lists.crux.nu <mailto:CRUX@lists.crux.nu> https://lists.crux.nu/mailman/__listinfo/crux <https://lists.crux.nu/mailman/listinfo/crux>
-- Photography at PBase.. www.pbase.com/sulman <http://www.pbase.com/sulman>
_______________________________________________ CRUX mailing list CRUX@lists.crux.nu https://lists.crux.nu/mailman/listinfo/crux
I wondered about kernel support for LVM, but I've never got it to work without an initramfs; or software RAID for that matter. Without /etc/mdadm.conf (usually handled within the initramfs) I don't know how the Kernel knows to assemble the array - does it just use drive metadata? Some interesting things to think about.
Hi, Am 31.03.2015 um 16:06 schrieb James Trimbee:
I wondered about kernel support for LVM, but I've never got it to work without an initramfs; or software RAID for that matter. Without /etc/mdadm.conf (usually handled within the initramfs) I don't know how the Kernel knows to assemble the array - does it just use drive metadata? Yes, it's in some kind of id in the partition table:
Device Boot Start End Sectors Size Id Type /dev/sdd1 2048 10487807 10485760 5G 83 Linux /dev/sdd2 10487808 976773167 966285360 460.8G fd Linux raid autodetect and then the md-superblock knows the rest (i.e., which name the raid has, which type, etc.). ... there's also "8e Linux LVM", so maybe this works, too. Personally I never felt the need for lvm, and probably won't test it in the near future greetings, Erich
Here's a quick and dirty Pkgfile for dracut if anyone wants to try it: ############ # Description: Dracut, a tool for creating an initramfs. # URL: https://dracut.wiki.kernel.org/index.php/Main_Page # Maintainer: Not applicable, one-off build. name=dracut version=041 release=1 source=( https://www.kernel.org/pub/linux/utils/boot/$name/$name-$version.tar.gz) build() { cd $name-$version ./configure --prefix=/usr --disable-nls --mandir=/usr/man --disabledocumentation make make DESTDIR=$PKG install } ########## It builds okay, but I haven't tested the application yet.
Thank you everybody for all your answers!
Might be worth taking a look at Dracut, too. It isn't in ports but I think is still simpler than rolling your own initramfs the old way.
I could probably use kernel/linux-3.xx.y/user/gen_init_cpio, but I think I'll have a look at the Dracut tool. I think it will be easier. Thank your for providing the Pkgfile! I will boot with the iso, set a network connection and build the tool with your Pkgfile. I hope it will works.
Device Boot Start End Sectors Size Id Type /dev/sdd1 2048 10487807 10485760 5G 83 Linux /dev/sdd2 10487808 976773167 966285360 460.8G fd Linux raid autodetect
and then the md-superblock knows the rest (i.e., which name the raid has, which type, etc.).
... there's also "8e Linux LVM", so maybe this works, too.
I have used "Linux LVM" and it's not enough. Thank you for your link Cezar. I don't remember if I saw that link. As it is said it's not possible without an initrd, but it could work with grub2. As I want to use syslinux, I didn't keep that option. But I will read it carefully one more time to understand the problem better. To answer Erich in the past I didn't used lvm. It happened that I had to reinstall everything, because I had some problem with my partitions size. At the end I decided I don't want anymore to reinstall everything because a partition is too small. So lvm was the solution. Best Regards, Cédric
Dracut should work out of box but very important you append kernel command line to lilo.conf. Dracut will show you what it finds using dracut --print-cmdline (I think)
I should clarify I use lilo but whatever boot manager you use will have some method of appending it, e.g. grub.conf etc. Default dracut is huge, by the way (the package includes all modules it uses), so it should have what ever you need.
Finally I did it! Yes! I had other problems but I was able to solve all of them. I will just describe what I did. First I used the Pkgfile for building dracut. Then I used it to generate the mkiniramfs. Because I don't use so often a chroot environment, I didn't understand at first why dracut was not able to build the lvm module in the initramfs. It was because lvm was provided by the iso, but I had not installed it in the mount partition. So after the setup-chroot the lvm command was not found. I solved it by also installing it. I edited the file dracut.conf with the following line: # Bring up <device> in initramfs, <device> should be the device name add_device+=" /dev/mapper/lvolroot /dev/mapper/lvolswap /dev/mapper/hdvg-lvolhome " Those directories are my root partition, swap and home. To build the initramfs: # dracut --add-fstab /etc/fstab I'm not sure if that option is necessary. I have then installed the lilo bootloader. At the beginning because I had a lot of problems I installed several times lilo. I happened that lilo could not install because the kernel was too big (I don't remember exactly the exact error message). No idea why, after a reboot, it worked without a problem. After the reboot I got an error like: "VFS: cannot open root device "fe00" or unknown. Please append a correct "root = " boot option. Kernel Panic - not syncing: VFS unable to mount root fs." My first kernel panic after many years without, a pleasure! Perhaps James gave me the answer:
Dracut should work out of box but very important you append kernel command line to lilo.conf. Dracut will show you what it finds using dracut --print-cmdline (I think)
It was indeed the solution. I had the option for lilo: root=/dev/mvg/lvolroot but it didn't work. It's necessary to give it with the "append" parameter: append="ro root=/dev/mvg/lvolroot" I use syslinux as bootloader, so for me I didn't think to use the "append" parameter. After that I was able to boot. Thank you for your help! Now I can discover crux! Regards, Cédric
Hi Cédric, I hope the information below will help in some way. I apologize in case you already know it. Best regards and good luck Cezar http://unix.stackexchange.com/questions/2466/is-it-possible-to-put-root-in-l... 2015-03-30 17:43 GMT-03:00 Cédric <grandspas@opmbx.org>:
Hello,
I'm new to crux and I would like to test it. Unfortunately, after the installation the system doesn't boot. I use lilo as bootloader and I have installed lvm. There is a partition for /boot (without lvm) and another one with lvm for the other directories.
I have compiled my kernel without initrd. After searching, I think an initrd is necessary with lvm. In "core" or "opt" the utility "mkinitrd" is not available. Is there an alternative to "mkinitrd" to create the initrd ?
Thanks!
Regards,
Cédric _______________________________________________ CRUX mailing list CRUX@lists.crux.nu https://lists.crux.nu/mailman/listinfo/crux
-- * Cezar Rangel* *cezar.rangel@gmail.com <cezar.rangel@gmail.com>*
participants (5)
-
Cezar Rangel
-
Cédric
-
Erich Eckner
-
James Trimbee
-
Thierry Moreau