public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: covici@ccs.covici.com
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] difficulties with lvm2+systemd+grub2
Date: Wed, 12 Nov 2014 06:44:27 -0500	[thread overview]
Message-ID: <18642.1415792667@ccs.covici.com> (raw)
In-Reply-To: <20141112094758.GE25089@getafix>

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

> On Tue, Nov 11, 2014 at 05:13:16PM -0500, covici@ccs.covici.com wrote:
> > Michael Mair-Keimberger <m.mairkeimberger@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
         covici@ccs.covici.com


  parent reply	other threads:[~2014-11-12 11:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-11 20:56 [gentoo-user] difficulties with lvm2+systemd+grub2 Michael Mair-Keimberger
2014-11-11 21:44 ` Stefan G. Weichinger
2014-11-12  8:22   ` Michael Mair-Keimberger
2014-11-11 21:47 ` Jc García
2014-11-12  8:25   ` Michael Mair-Keimberger
2014-11-11 22:13 ` covici
2014-11-12  9:47   ` Michael Mair-Keimberger
2014-11-12 10:19     ` Stefan G. Weichinger
2014-11-12 11:44     ` covici [this message]
2014-11-12  1:03 ` wraeth
2014-11-12  9:42   ` Michael Mair-Keimberger
2014-11-12 10:07     ` Sam Jorna
2014-11-12 10:20       ` Stefan G. Weichinger
2014-11-14 18:43         ` Michael Mair-Keimberger
2014-11-16  1:21           ` wraeth
2014-11-17 20:39             ` Michael Mair-Keimberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18642.1415792667@ccs.covici.com \
    --to=covici@ccs.covici.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox