View previous topic :: View next topic |
Author |
Message |
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1435 Location: Berlin, Germany
|
Posted: Mon Feb 25, 2013 1:06 pm Post subject: new install, grub2/grub.cfg manual, / on lvm |
|
|
so, like it says: I'm installing gentoo new onto a laptop, and the root partition is on lvm (as in, on /dev/{vg}/{vg}-root), and I'm using grub2 with a manually written cfg file (because NeddySeagoon has a guide for an init script to run an initramfs, because /usr is also on lvm, but also because grub2-mkconfig persistently sets /usr as the root partition in its auto-generated cfg file). /boot is on /dev/md1 (raid1).
Thus:
How do I configure grub2 to load up the lvm partitions, so it can find the kernel?
How do I write up the grub2 config file?
Thanks,
EE |
|
Back to top |
|
|
tuner23 Tux's lil' helper
Joined: 18 May 2006 Posts: 82
|
Posted: Wed Feb 27, 2013 9:26 am Post subject: |
|
|
Hy,
you can try doing this by creating an initramfs including a statically compiled lvm-version, like described here..
http://wiki.gentoo.org/wiki/DM-Crypt_LUKS
With busybox you can execute then lvm.
Best to configure is, when you make another grub-entry with an initram wich beams you to the shell after loading the kernel and before booting:
Code: | #!/bin/busybox sh
export PATH=/bin
umask 0077
mount -t proc none /proc
mount -t sysfs none /sys
echo "Mounting Rootfs"
#while [ ! -b /dev/mapper/rootfs ]
#do
# cryptsetup luksOpen /dev/sda5 rootfs
# sleep1
#done
#mount -r /dev/mapper/rootfs /rootfs
sh
umount /proc
umount /sys
exec switch_root /rootfs /sbin/init
|
But ist's hard stuff and if you are new, i would more prefer to ask: why?
My /root-partition is after several years already 314M
You can let the system boot and create a secondary partition for LVM including a usr, var and data partition, maybe also home if you put any stuff inside..
Greets,
Antonios. |
|
Back to top |
|
|
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1435 Location: Berlin, Germany
|
Posted: Sat Mar 02, 2013 5:32 pm Post subject: |
|
|
okay fine then I'll do it the normal way. hmph.
Okay, now root's on /dev/md3, with the lvm on /dev/md4 like in the guide.
I have a manually-written grub.cfg file, and it now fails with the following:
Code: | error: /boot/kernel-3.8.1-gentoo not found
You need to load the kernel first |
But that file exists, on /boot/ right where I specified in the file /boot/grub2/grub.cfg.
I used grub2-install to install grub to the mbr of both sda and sdb, but wrote grub.cfg manually rather than using grub2-mkconfig (since that method seems to be full of suffering and confusion).
Anyway, what's going wrong here?
Cheers,
EE |
|
Back to top |
|
|
popsUlfr Tux's lil' helper
Joined: 27 Feb 2011 Posts: 80
|
Posted: Sun Mar 03, 2013 1:57 pm Post subject: |
|
|
ExecutorElassus wrote: | okay fine then I'll do it the normal way. hmph.
Okay, now root's on /dev/md3, with the lvm on /dev/md4 like in the guide.
I have a manually-written grub.cfg file, and it now fails with the following:
Code: | error: /boot/kernel-3.8.1-gentoo not found
You need to load the kernel first |
But that file exists, on /boot/ right where I specified in the file /boot/grub2/grub.cfg.
I used grub2-install to install grub to the mbr of both sda and sdb, but wrote grub.cfg manually rather than using grub2-mkconfig (since that method seems to be full of suffering and confusion).
Anyway, what's going wrong here?
Cheers,
EE |
Why did you install grub 2 to two hard drives? You just place the one where grub 2 is installed into mbr as first boot device in your BIOS.
I just finished creating a Gentoo system on lvm with systemd,grub 2,uefi but for generating the initramfs I rather use mkinitcpio from Arch (it's in the portage) than genkernel for easy lvm2 support.
So I imagine you're working in chroot of your target system, for succesfull grub 2 installation you should have /dev, /sys and /proc mounted in it.
Code: |
mount -t proc none /path/to/proc/in/your/chroot
mount -o bind /sys /path/to/sys/in/your/chroot
mount -o bind /dev /path/to/dev/in/your/chroot
|
For grub 2 make sure you have the device-mapper useflag enabled and os-prober is installed.
Since your lvm logical volumes are already created do a
Code: |
vgscan
vgchange -a y
|
To have them appear correctly in lsblk.
Now either use the lvm nodes in /dev/mapper or the UUID (you can get a ready for fstab string with 'lsblk -f -P -o UUID /dev/mapper/[yourlvmnode]') to add in your fstab.
Install grub 2 to the mbr of the disk of your choice
Code: | grub2-install /dev/sda |
Then you generate the grub.cfg, you really don't want to do it by hand. Grub 2 will pick up everything automatically and load the needed modules if it resides on an lvm volume.
Code: |
grub2-mkconfig -o /boot/grub2/grub.cfg |
You need to make sure your initramfs has the adequate hooks for lvm2, but after that you should be good to go. Unmount all the stuff you mounted earlier and reboot.
The ArchWiki is great for more info on the LVM stuff. |
|
Back to top |
|
|
tuner23 Tux's lil' helper
Joined: 18 May 2006 Posts: 82
|
Posted: Sun Mar 03, 2013 2:42 pm Post subject: |
|
|
Hy,
Is boot on an own partition?
Can you post the grub-configuration?
1. possibly the kernel can't read your filesystem (you have to compile your fs statically and not as module)
2. if boot is on an own partition, your kernel is Quote: | kernel kernel-3.3.8-gentoo | , else it is Quote: | kernel /boot/kernel-3.3.8-gentoo | .
Greets. |
|
Back to top |
|
|
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1435 Location: Berlin, Germany
|
Posted: Mon Mar 04, 2013 5:03 pm Post subject: |
|
|
okay, to answer a few questions:
Quote: | Why did you install grub 2 to two hard drives? |
For a number of reasons: the guide (though for grub[1]) says to, because I have /boot on a mirrored RAID array. I didn't want to muck around figuring out which of my drives is actually first in the BIOS boot list.
My initramfs is made from NeddySeagoon's handy guide. He also used a manual grub file. I've read some scarly-looking complaints about grub2 børking UUIDs and having messy config files, so I went with what I knew.
When I chroot into my (properly-mounted) environment, none of the mounts carry over. Is there a way to update mtab to match the actual mount situation?
EDITnvm that last bit. 'ln -sf /proc/mounts /etc/mtab' fixed it. Hope that wasn't a stupid thing to do
anyway, so now I told grub2-mkconfig to do it automatically. I'll report back in a sec to say if it worked.
Cheers,
EE |
|
Back to top |
|
|
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1435 Location: Berlin, Germany
|
Posted: Mon Mar 04, 2013 5:13 pm Post subject: |
|
|
UPDATE: yeah, grub2-mkconfig totally didn't make a working config. It misidentified the root and /boot mduuids. How do I fix that? Do I have to go rewriting the files in /etc/grub.d/?
Cheers,
EE
PS- every stupid time I write out file names and commands, I keep hitting TAB for auto-completion. My browser hates me
Also, here is my grub.cfg written manually:
Code: | #
# This is a MANUALLY WRITTEN (holy shit!) grub-config, following NeddySeagoon's guide here:
# http://forums.gentoo.org/viewtopic-t-920644-highlight-.html
#
#
default 0
timeout 7
#splashimage=(hd0,0)/boot/grub/splash.xpm.gz
menuentry 'Gentoo' {
root=hd0,1
linux /boot/kernel-3.8.1-gentoo root=UUID=bb492953-3a45-47ed-9ef5-615147e13e78
initrd /boot/initrd.cpio.gz
}
menuentry 'Gentoo-prevkernel' {
root=hd0,1
linux /boot/kernel-3.8.1-gentoo root=UUID=bb492953-3a45-47ed-9ef5-615147e13e78
initrd /boot/initrd.cpio.gz
}
|
incidentally, the instruction to write simply "linux kernel-3.8.1-gentoo…" for the kernel line contradicts the grub2 guide and the gentoo documentation. Is that truly correct? /boot is, as I said, on a RAID1 array, as is /
cheers,
EE |
|
Back to top |
|
|
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1435 Location: Berlin, Germany
|
Posted: Sun Mar 17, 2013 10:18 pm Post subject: |
|
|
okay, I've gotten a bit further with the config file. For this box, unlike my main, the kernel string has to be in the format 'kernel /kernel-3.8.x-gentoo' (or however I named it, but *with* a preceding slash) for the loader to find it. However, two things then happen:
the initrd does not get loaded, even when formatted the same, and the start process then hangs on a kernel panic. Or, more to the point, it hangs when it is unable to find the /init process.
So, this leads me to suspect that something is wrong with how I'm identifying the / partition (though the uuid is correct for /dev/md3), but also that something is wrong with how grub is loading partitions.
Any advice?
Cheers,
EE |
|
Back to top |
|
|
ExecutorElassus Veteran
Joined: 11 Mar 2004 Posts: 1435 Location: Berlin, Germany
|
Posted: Wed Mar 27, 2013 1:31 am Post subject: |
|
|
Sigh. I'm still having problems with this. I'm sure it's just something misconfigured: when I boot from the LiveCD, I can set up the md and lvm devices fine, and run from the root OS. But I can't boot the box on its own. Here's the present /boot/grub2/grub.cfg:
Code: | #
# This is a MANUALLY WRITTEN (holy shit!) grub-config, following NeddySeagoon's guide here:
# http://forums.gentoo.org/viewtopic-t-920644-highlight-.html
#
#
default 0
timeout 7
#splashimage=(hd0,0)/boot/grub/splash.xpm.gz
menuentry 'Gentoo' {
root=hd0,1
linux /kernel-3.8.1-gentoo root=UUID=bb492953-3a45-47ed-9ef5-615147e13e78
initrd /boot/initrd.cpio.gz
}
menuentry 'Gentoo-prevkernel' {
root=hd0,1
linux /kernel-3.8.1-gentoo root=UUID=bb492953-3a45-47ed-9ef5-615147e13e78
initrd /boot/initrd.cpio.gz
}
|
Here is the output of blkid:
Code: | # blkid
/dev/loop0: TYPE="squashfs"
/dev/sr0: LABEL="Gentoo Linux amd64 20130110" TYPE="iso9660"
/dev/sda1: UUID="5b60525c-e83a-7e01-cb20-1669f728008a" TYPE="linux_raid_member"
/dev/sda2: UUID="94e65518-6c42-46a8-99e7-c68aa531d574" TYPE="swap"
/dev/sda3: UUID="ed5d1009-5b52-bc94-cb20-1669f728008a" TYPE="linux_raid_member"
/dev/sda4: UUID="494b1b91-4220-4725-bb84-1e9ab089ffde" UUID_SUB="9822330e-20a0-d3c8-a328-e449a3f0a1ec" LABEL="livecd:4" TYPE="linux_raid_member"
/dev/sdb1: UUID="5b60525c-e83a-7e01-cb20-1669f728008a" TYPE="linux_raid_member"
/dev/sdb2: UUID="e5c374df-c0a7-4e79-9eea-80541ad71f9c" TYPE="swap"
/dev/sdb3: UUID="ed5d1009-5b52-bc94-cb20-1669f728008a" TYPE="linux_raid_member"
/dev/sdb4: UUID="494b1b91-4220-4725-bb84-1e9ab089ffde" UUID_SUB="60342ef3-ffbf-83ee-1b01-7c3ec3fdda25" LABEL="livecd:4" TYPE="linux_raid_member"
/dev/md1: UUID="f3751a22-b683-43b7-a74d-5d39ff7b117b" TYPE="ext2"
/dev/md3: UUID="bb492953-3a45-47ed-9ef5-615147e13e78" TYPE="ext3"
/dev/md4: UUID="vBcv7D-jQwi-14ft-cHah-pzol-c71h-m6eNaq" TYPE="LVM2_member"
/dev/mapper/choria-tmp: UUID="79d1bc8b-e7d3-41bb-b7e8-c4df1c574320" TYPE="ext2"
/dev/mapper/choria-var: UUID="6f70de91-3fa0-4989-a9cc-832568d38499" TYPE="ext3"
/dev/mapper/choria-usr: UUID="4079e7b4-9e84-4c92-863e-ebe4b152e38f" TYPE="ext3"
/dev/mapper/choria-usr--port--dist: UUID="168ad4fa-8c4c-415b-94be-8caf0ae41638" TYPE="ext2"
/dev/mapper/choria-usr--port: UUID="a4288177-9c30-4fec-a2b3-c4ee80b7812d" TYPE="ext2"
/dev/mapper/choria-home: UUID="8d842dea-8eda-45aa-af03-091f59345ebd" TYPE="ext3"
| and here is the output of 'mdadm -E /dev/sda3' (one of the two partitions involved in the Raid1 array of / ):
Code: | # mdadm -E /dev/sda3
/dev/sda3:
Magic : a92b4efc
Version : 0.90.00
UUID : ed5d1009:5b52bc94:cb201669:f728008a (local to host livecd)
Creation Time : Mon Mar 18 12:14:32 2013
Raid Level : raid1
Used Dev Size : 6291392 (6.00 GiB 6.44 GB)
Array Size : 6291392 (6.00 GiB 6.44 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 3
Update Time : Wed Mar 27 02:22:35 2013
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Checksum : 571c7417 - correct
Events : 20
Number Major Minor RaidDevice State
this 0 8 3 0 active sync /dev/sda3
0 0 8 3 0 active sync /dev/sda3
1 1 8 19 1 active sync /dev/sdb3
|
grub is built with device-mapper, and the config should be correct. But what am I missing here?
Cheers,
EE |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|