Michael Mair-Keimberger <m.mairkeimber...@gmail.com> wrote:

> On Tue, Nov 11, 2014 at 05:13:16PM -0500, cov...@ccs.covici.com wrote:
> > Michael Mair-Keimberger <m.mairkeimber...@gmail.com> wrote:
> > 
> > > Hi List,
> > > 
> > > Today I've started to play around with systemd but so far I couldn't get
> > > it to boot. I've followed the how to from the gentoo wiki [1], but I
> > > stuck somehow.
> > > 
> > > My configuration:
> > > rootfs is on lvm2 (no encryption or raid). I just use it for being able
> > > creating snapshot/backups of the running system.
> > > Grub is on /dev/sda2 which is a simple ext2 partition with a custom
> > > grub.cfg. A Grub entry looks like that:
> > > 
> > > ###
> > > menuentry 'gentoo amd64 gnome' {
> > >         linux /gentoo-3.16.5-n lvm=gentoo_amd64_gnome
> > >         initrd /initrd.cpio.gz
> > > }
> > > ###
> > > 
> > > Don't get confused about the "lvm" flag. This just get passed to my very
> > > simple custom initramfs which looks like this:
> > > 
> > > ###
> > > #!/bin/busybox sh
> > > 
> > > cmdline() {
> > >         local value
> > >         value=" $(cat /proc/cmdline) "
> > >         value="${value##* $1=}"
> > >         value="${value%% *}"
> > >         [ "$value" != "" ] && echo "$value"
> > > }
> > > # Mount the /proc and /sys filesystems.
> > > mount -t proc none /proc
> > > mount -t sysfs none /sys
> > > mount -t devtmpfs none /dev
> > > 
> > > lvm vgscan
> > > lvm vgchange -ay vg0
> > > lvm vgscan --mknodes
> > > 
> > > # Mount the root filesystem.
> > > mount -o ro /dev/mapper/vg0-$(cmdline lvm) /mnt/root
> > > 
> > > # Clean up.
> > > umount /proc
> > > umount /sys
> > > umount /dev
> > > 
> > > # Boot the real thing.
> > > exec switch_root /mnt/root /sbin/init
> > > ###
> > > 
> > > So far this works great for me. However, with systemd I had some
> > > difficulties how to correctly configure the system and grub2 in order to
> > > boot with systemd.
> > > 
> > > This is what i did so far:
> > > 
> > > For systemd i've created a new initramfs with genkernel and changed the
> > > grub config like the following entry:
> > > 
> > > ###
> > > menuentry 'gentoo amd64 gnome systemd' {
> > >         linux /gentoo-3.16.5-n 
> > > root=UUID=1eb94a2b-40d7-4556-9102-0320efd04adc 
> > > init=/usr/lib/systemd/systemd
> > >         initrd /initramfs-genkernel-x86_64-3.16.5-gentoo
> > > }
> > > ###
> > > 
> > > Systemd installation went without problems (it's a base system without
> > > any wm's installed atm), but even though the grub2 changes were quite
> > > easy and I've used the genkernel initramfs instead of mine I still get a
> > > kernel panic on boot (have a look at the attached picture).
> > > I've also checked the kernel config for having the required systemd
> > > configurations enabled.
> > > 
> > > Anyone has some ideas what might be wrong?
> > > 
> > > Furthermore I've also have some questions about lvm2+systemd. Hope
> > > someone can give me some answers :)
> > > 
> > > First of all, with systemd installed I can't install lvm2 with the
> > > static use flag anymore, which is mandatory for being able using it for
> > > a initramfs. Why isn't that possible? How can I use the lvm binaries for
> > > my initramfs?
> > > 
> > > This lead me to my second question. At the wiki, the only way to create
> > > an initramfs for systemd was with genkernel (genkernel --udev --lvm).
> > > While the command itself is pretty useless (it's `genkernel --udev --lvm
> > > initramfs` if you want to create the initramfs -> is this a bug??) i
> > > also would like to use my own initramfs.
> > > What changes do i have to make in my own initramfs for being able
> > > booting systemd from it?
> > 
> > I would use dracut to generate the initramfs and use  rd.lvm.vg= to
> > activate your volume group and specify the init as  the exact location
> > of the systemd binary  -- then you don't need static or anything, dracut
> > will automatically put in the appropriate libraries, and also check the
> > file systems upon boot.  Much better if you need to use systemd.
> > 
> > Hope this helps.
> 
> Dracut was already mentioned. I'll give it a try later that day. Regarding 
> your
> "rd.lvm.vg=" flag. I guess should be put into the grub2 entry, shouldn't
> it?
> 
> Anyway, thanks for sharing :)

Yep, that is where it should go and it seems to work nicely.  I had a
lot of work to find that I needed that, otherwise the lvm volumes were
not there and my root would not mount at all.

-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

         John Covici
         cov...@ccs.covici.com

Reply via email to