Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
udev-182 HOWTO
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 32439
Location: 56N 3W

PostPosted: Wed Apr 18, 2012 9:09 pm    Post subject: udev-182 HOWTO Reply with quote

NeddySeagoon's Rough Guide to >=udev-182


WARNING: You might be first to follow this guidecorrections, comments and improvements welcome.


DISCLAIMER: You follow this guide at your own risk. If your system breaks as a result, you get to keep both pieces.
Allow plenty of time - this is a major change. For help, post to this thread. >=udev-182 is only in ~ARCH at the time of writing.
If you run ~ARCH you are supposed to know what you are doing.

Credits The Gentoo Wiki which provided much of the insperation and gentoo-wiki.com which I have used for static root on lvm over raid for many years.

Aim of this guide
To keep you in control of the boot process on your system.

You need this guide if you have a separate /usr or /var partition and want to understand and have control of the boot process on your system after the upgrade to >=udev-182
The use of raid and lvm is covered as I had to make that work but encrypted filesystems are not as I have no way to test.
An initrd is required but you build it with the aid of a kernel provided script. Neither dracut nor genkernel are required, well if they were needed you would not
be in control would you?
The idea is to have a system that when it fails to boot, you can fix it yourself. Its likely that during the executopn of this procedure you will get to practice
that, so have a bootable USB stick, or CDROM handy. You will not be able to boot into an old kernel.

Prerequisties
A Gentoo system with a separate /usr and or /var partition, optionally, with everything except /boot on lvm on raid. >=udev-182 should be in your package.mask, or
you have seen emerge wanting to upgrade to it. If you already have udev-182, you box won't boot again until you make arrangeents to mount /usr and /var before udev
is started.

Overview
Preparation - you can do this now and test it. These steps are required before you reboot useing you new initrd but they can be tested and debugged before you
make the leap to >=udev-182

Initrd preparation
This can be done but not tested until your have >=udev-182 installed.

The leap to >=udev-182
Going back after this stage is pointless, long term the only way is on.

The reboot
If it doesn't work first time, fetch the boot media you hoped you would not need, get into your chroot and fix it.




Preparation
As the initrd will contain /sbin/mount change /etc/fstab to mount everything by UUID. This is a robustness improvement you get for free. You cannot yet use a UUID
in grub.conf to mount root. That's covered later, once the system boots using the initrd.
To disciver your UUIDs run the command blkid
blkid:
$ sudo blkid
Password:
/dev/sda1: UUID="9392926d-6408-6e7a-8663-82834138a597" TYPE="linux_raid_member"
/dev/sda2: UUID="b6633d8e-41ef-4485-9bbe-c4c2d69f4e8c" TYPE="swap"
/dev/sda5: UUID="5e3cadd4-cfd2-665d-9690-1ac76d8f5a5d" TYPE="linux_raid_member"
/dev/sda6: UUID="9657e667-5b60-f6a3-0391-65e6dcf662fa" TYPE="linux_raid_member"
[other drives omitted]
/dev/md125: UUID="741183c2-1392-4022-a1d3-d0af8ba4a2a8" TYPE="ext2"
/dev/md126: UUID="ff5730d5-c28d-4276-b300-5b0b0fc60300" TYPE="ext4"
/dev/md127: UUID="7b2KgY-NHef-kuNk-WBAp-VnLa-h03A-b4ehGy" TYPE="LVM2_member"
/dev/mapper/vg-usr: UUID="fc23601b-e2af-443f-959e-50148154a91b" TYPE="ext4"
/dev/mapper/vg-local: UUID="7e0d0ae4-2c57-44e9-995f-5723ab0670b3" TYPE="ext4"
/dev/mapper/vg-tmp: UUID="1ff5e3b5-c2d8-41a6-b172-e1ede8fe22ff" TYPE="ext2"
/dev/mapper/vg-var: UUID="57b34894-f80d-47ab-a522-46fb6e1a19b8" TYPE="ext4"
/dev/mapper/vg-vmware: UUID="e41a94cc-0817-449f-8ac8-f3055d33879c" TYPE="ext4"
/dev/mapper/vg-opt: UUID="7f0fad34-6130-42d8-8246-033de9717005" TYPE="ext4"
/dev/mapper/vg-distfiles: UUID="54b46458-d411-4ea8-8920-4c5fcdb56a81" TYPE="ext4"
/dev/mapper/vg-packages: UUID="59c06fd1-8471-4efb-b055-8f1cfb39645f" TYPE="ext4"
/dev/mapper/vg-portage: UUID="8675cb9c-4251-489f-8e9b-0244ca80176c" TYPE="ext2"
/dev/mapper/vg-home: UUID="8d5d5691-ceb7-4e58-bed3-28803cb88bfe" TYPE="ext4"
/dev/sde1: SEC_TYPE="msdos" UUID="FC30-3DA9" TYPE="vfat"
Notice that every block device has a UUID. Carefully choose the right ones for use in your
Code:
/etc/fstab
In my case
/etc/fstab:
# <fs>                                    <mountpoint>    <type>          <opts>          <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
#/dev/md125             /boot           ext2            noauto,noatime  1 2
UUID=741183c2-1392-4022-a1d3-d0af8ba4a2a8 /boot           ext2            noauto,noatime  1 2
UUID=8d5d5691-ceb7-4e58-bed3-28803cb88bfe /home           ext4            noatime         1 2
UUID=7f0fad34-6130-42d8-8246-033de9717005 /opt            ext4            noatime         1 2

and so on.

Save the changes and test with
Code:
mount -a
fix any syntax errors.

The initrd requires some packages to be built with the static USE flag. Edit
Code:
/etc/portage/package.use
to include
Code:
# static bits and pieces for an initrd
sys-fs/lvm2 static
sys-fs/mdadm static
sys-apps/busybox static

mdadm and lvm2 are not requried if you do not use kernel raid or Logical Volume Manager. Do not put the static USE flag in /etc/make.conf
busybox will provide the shell in the initrd.
Code:
emerge -uDNav world
to rebuild packages with the changed USE flags.

>=udev-182 depends on a kernel option
Code:
    |    [*] Maintain a devtmpfs filesystem to mount at /dev                    | |
  | |    [*]   Automount devtmpfs at /dev, after the kernel mounted the rootfs

The Automount is not required as our initrd init script will mount it anyway. If you have a kernel with the automount option missing, this guide will still work.

If you are using kernel raid auto assembly, turn it off
Code:
[ ]     Autodetect RAID arrays during kernel boot
This will break rebooting meanwhile.

Rebuild and reinstall your kernel. If you need to reboot, raid autoassembly users cannot reboot into this kernel without following the rest of this guide.

At the outset, I mentioned a kernel provided script. The kernel sources provide the gen_init_cpio and gen_initramfs_list.sh utilities. The gen_init_cpio utility
does not come prepackaged and needs to be built.
Code:
cd /usr/src/linux/usr
make gen_init_cpio

Check these files are execuatable
Code:
chmod +x gen_init_cpio
chmod +x ../scripts/gen_initramfs_list.sh

Initrd Preparation

With the aid of the kernel scripts, there are two files to prepare. The init script itself and a list of files to be included in the initrd.
Old habits die hard an I like to prepare the initrd in /root/initrd
The /root/initrd/initramfs_list contains

initramfs_list:
# directory structure
dir /proc       755 0 0
dir /usr        755 0 0
dir /bin        755 0 0
dir /sys        755 0 0
dir /var        755 0 0
#dir /lib        755 0 0
dir /lib64      755 0 0
dir /sbin       755 0 0
dir /mnt        755 0 0
dir /mnt/root   755 0 0
dir /etc        755 0 0
dir /root       700 0 0
dir /dev        755 0 0

# busybox
file /bin/busybox /bin/busybox  755 0 0

# for raid on lvm
file /sbin/mdadm                /sbin/mdadm              755 0 0
file /sbin/lvm.static           /sbin/lvm.static         755 0 0

# libraries required by /sbin/fsck.ext4 and /sbin/fsck

slink   /lib                            /lib64                          777 0 0
file    /lib64/ld-linux-x86-64.so.2     /lib64/ld-linux-x86-64.so.2     755 0 0
file    /lib64/libext2fs.so.2           /lib64/libext2fs.so.2           755 0 0
file    /lib64/libcom_err.so.2          /lib64/libcom_err.so.2          755 0 0
file    /lib64/libpthread.so.0          /lib64/libpthread.so.0          755 0 0
file    /lib64/libblkid.so.1            /lib64/libblkid.so.1            755 0 0
file    /lib64/libuuid.so.1             /lib64/libuuid.so.1             755 0 0
file    /lib64/libe2p.so.2              /lib64/libe2p.so.2              755 0 0
file    /lib64/libc.so.6                /lib64/libc.so.6                755 0 0

file    /sbin/fsck              /sbin/fsck                      755 0 0
file    /sbin/fsck.ext4         /sbin/fsck.ext4                 755 0 0

# our init script
file    /init                   /root/initrd/init               755 0 0


Omit
Code:
# for raid on lvm
file /sbin/mdadm                /sbin/mdadm              755 0 0
file /sbin/lvm.static           /sbin/lvm.static         755 0 0

if you do not require raid or lvm support.

Use
Code:
ldd <your_fsck_helper>
to discover the libraries you need if you do not use ext4.
32 bit installs do not have /lib64. See the gentoo wiki for a 32 bit initramfs_list.

If you made your initrd elsewhere, update
Code:
file    /init                   /root/initrd/init               755 0 0

The init script itself
init:

#!/bin/busybox sh

rescue_shell() {
    echo "$@"
    echo "Something went wrong. Dropping you to a shell."
    /bin/busybox --install -s
    exec /bin/sh
}

# allow the use of UUIDs or filesystem lables
uuidlabel_root() {
    for cmd in $(cat /proc/cmdline) ; do
        case $cmd in
        root=*)
            type=$(echo $cmd | cut -d= -f2)
            echo "Mounting rootfs"
            if [ $type == "LABEL" ] || [ $type == "UUID" ] ; then
                uuid=$(echo $cmd | cut -d= -f3)
                mount -o ro $(findfs "$type"="$uuid") /mnt/root
            else
                mount -o ro $(echo $cmd | cut -d= -f2) /mnt/root
            fi
            ;;
        esac
    done
}

check_filesystem() {
    # most of code coming from /etc/init.d/fsck

    local fsck_opts= check_extra= RC_UNAME=$(uname -s)

    # FIXME : get_bootparam forcefsck
    if [ -e /forcefsck ]; then
        fsck_opts="$fsck_opts -f"
        check_extra="(check forced)"
    fi

    echo "Checking local filesystem $check_extra : $1"

    if [ "$RC_UNAME" = Linux ]; then
        fsck_opts="$fsck_opts -C0 -T"
    fi

    trap : INT QUIT

    # using our own fsck, not the builtin one from busybox
    /sbin/fsck -p $fsck_opts $1

    ret_val=$?
    case $ret_val in
        0)      return 0;;
        1)      echo "Filesystem repaired"; return 0;;
        2|3)    if [ "$RC_UNAME" = Linux ]; then
                        echo "Filesystem repaired, but reboot needed"
                        reboot -f
                else
                        rescue_shell "Filesystem still have errors; manual fsck required"
                fi;;
        4)      if [ "$RC_UNAME" = Linux ]; then
                        rescue_shell "Fileystem errors left uncorrected, aborting"
                else
                        echo "Filesystem repaired, but reboot needed"
                        reboot
                fi;;
        8)      echo "Operational error"; return 0;;

        16)     echo "Use or Syntax Error"; return 16;;
        32)     echo "fsck interrupted";;
        127)    echo "Shared Library Error"; sleep 20; return 0;;
        *)      echo $ret_val; echo "Some random fsck error - continuing anyway"; sleep 20; return 0;;


    esac

# rescue_shell can't find tty so its broken
    rescue_shell
}

# start for real here

# temporarily mount proc and sys
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devtmpfs none /dev

# disable kernel messages from popping onto the screen
###echo 0 > /proc/sys/kernel/printk
# clear the screen
###clear

# assemble the raid set(s) - they got renumbered from md1, md5 and md6
# /boot
/sbin/mdadm --assemble /dev/md125 --uuid=d678d02e-28ab-84e0-c44c-77eb7ee19756
# don't care if /boot fails to assemble

# /  (root)  I wimped out of root on lvm for this box
/sbin/mdadm --assemble /dev/md126 --uuid=ad5fe0cb-775d-38b4-7169-e221fc96089f || rescue_shell
# if root won't assemble, we are stuck

# LVM for everything else
/sbin/mdadm --assemble /dev/md127 --uuid=52be4797:edab2349:eb21497e:52035eaa || rescue_shell
# and if the LVM space won't assemble there is no /usr or /var so we are really in a mess
# TODO could auto cope with degraded raid operation

# lvm runs as whatever its called as and we need vgchange
ln -s /sbin/lvm.static /sbin/vgchange

# start the vg volume group - we only have one volume group
/sbin/vgchange -ay vg || rescue_shell
# if this failed we have no /usr or /var

# get here with raid sets assembled and logical volumes available

# mounting rootfs on /mnt/root
uuidlabel_root || rescue_shell "Error with uuidlabel_root"

# space separated list of mountpoints that ...
mountpoints="/usr /var"

# ... we want to find in /etc/fstab ...
ln -s /mnt/root/etc/fstab /etc/fstab

# ... to check filesystems and mount our devices.
for m in $mountpoints ; do

#echo $m

    check_filesystem $m

    echo "Mounting $m"
    # mount the device and ...
    mount $m || rescue_shell "Error while mounting $m"

    # ... move the tree to its final location
    mount --move $m "/mnt/root"$m || rescue_shell "Error while moving $m"
done

echo "All done. Switching to real root."

# clean up. The init process will remount proc sys and dev later
umount /proc
umount /sys
umount /dev

# switch to the real root and execute init
exec switch_root /mnt/root /sbin/init


Fill in your own mdadm parameters and volume group names.
Remove the mdadm and lvm items from the init script if you don't use mdadm or lvm
Read the comments in the init file - you may need to make other adjustments.

Notice that if you make a mess of your included libraries, there is a 20 second pause then fsck returns as if it had worked but without doing anything.
This avoids the need to get into your chroot to fix your initrd, provided everything else works. Fix it. Mounting unchecked filesystems is ok for debugging but not
reccomenred.

Mount /boot, so the script gen_initramfs_list.sh can install the initrd there.
Run /usr/src/linux/scripts/gen_initramfs_list.sh -o /boot/initrd.cpio.gz /root/initrd/initramfs_list

Fix grub.conf. Mount root using the UUID of the root filesystem and add in the initrd line.
grub.conf:
#3.3.1-gentoo
title=Kernel 3.3.1-gentoo (hd0)
root (hd0,0)
kernel (hd0,0)/3.3.1-gentoo root=UUID=ff5730d5-c28d-4276-b300-5b0b0fc60300 vga=0x317 video=vesafb:mtrr:3,ywrap
initrd /boot/initrd.cpio.gz

title=Kernel 3.3.1-gentoo (hd1)
root (hd1,0)
kernel (hd1,0)/3.3.1-gentoo root=/dev/md126
initrd /boot/initrd.cpio.gz


The leap to >=udev-182
Update udev and anything else that is manually masked due to udev. Check your /etc/portage/package.mask
be sure you have >=openrc-0.9.9.3
run
Code:
 etc-update


Reboot to test.

TODO: Put all the files needed in the initrd in a filesystem in /root/initrd so they don't get messed up by random system updates.

TODO: Done - Use UUIDs in the mdadm --assemble commands post updated above but initscript examples copy/pasted from a second box.
UUIDs are unique, so readers need to use their own anyay. Not the the UUIDS here are the UUIDS foing using
Code:
mdadm -E <componet device>
not the UUIDs of the filesystem on the /dev/md device.

TODO: Test with a static /dev in the initrd and DEVTMPFS off in the kernel. If that works, this becomes a complex static initrd that can be hand rolled with cpio.

--- edit 1 ---
Well that should have booted but not cleanly. The filesystems that the initrd now checks and mounts the normal init system tryes to check and mount. Edit /etc/fstab to stop that.

/etc/fstab changes:
UUID=57b34894-f80d-47ab-a522-46fb6e1a19b8 /var                    ext4  noatime,noauto    1 0
UUID=fc23601b-e2af-443f-959e-50148154a91b /usr                    ext4  noatime,noauto    1 0

The filesystems that are mounted by the initrd need to be set to noauto, so that the normal init system does not attempt to mount them. Do not remove the entries as the init script in the initrd uses them.
The pass number, thats th final field on the line needs to be set to zero, which means don't check this filesystem.

--- edit 2 ---
Init script updated to use UUIDs in mdadm assemble commands
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
ExecutorElassus
l33t
l33t


Joined: 11 Mar 2004
Posts: 765
Location: Stuttgart, Germany

PostPosted: Mon Apr 30, 2012 9:01 pm    Post subject: Reply with quote

upon emerging mdadm, I get the following advice:
Code:
* If you're not relying on kernel auto-detect of your RAID devices,
 * you need to add 'mdraid' to your 'boot' runlevel:
 * rc-update add mdraid boot
Should I heed it?

Which of those directories in the initramfs directory list (the first list of directories) are necessary, and are there others?

emerging busybox results is:
Code:
* You cannot have USE='static pam'.  Assuming static is more important.
Do I need to rebuild busybox, or does this mean that it has automatically dropped the pam USE-flag, and built static?

What is the difference between an initramfs and an initrd? Also, this relates to the graphics options you have on your first kernel option in your grub.conf. I remember explicitly disabling framebuffer support and directfb a couple years ago (due to some problem with the X server which may not even exist anymore; support for Radeon? Xcomposite? I can't even remember =/ ). Is there instruction somewhere where I can set that up, besides the framebuffer wiki that's here?

Why does the "--uuid=..." line for your large lvm use colons innstead of dashes? And what do you mean you wimped out of root on lvm?

What is /mnt/root? I don't have one on my system. Is that / ?

Thanks for the guide. Adventure!

Cheers,

EE


Last edited by ExecutorElassus on Mon Apr 30, 2012 10:21 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 32439
Location: 56N 3W

PostPosted: Mon Apr 30, 2012 10:18 pm    Post subject: Reply with quote

ExecutorElassus,

You need mdadm in the boot runlevel if your root is not on raid and the initrd does not assemble yur raid sets. (It does.)
If you have mdadm set up to monitor your raid sets and send you emails you should add it to the defualt runlevel unless you need it started earlier.
The initrd only assembles your raid sets - it does not start the mdadm service.

Search in menuconfig is your friend. press / and enter devtmpfs.

Busybox must be built with stactic, as its libraries are not in the initrd. This meanes busybox does not have pam support.

The difference between and initrd and initramfs is one of internal format. An initrd is an old term the really refers to an ext2 filesystem in a gzipped file.
An initramfs is a compressed cpio archive ove other cpio achives. The compression is user defined at kernel build time ... at least, the decompression support is.

I still use a framebuffer console as I use the nvidia binary blob for Xorg. You continue to use hwatever you have been using. This initrd/initramfs does not affect any video options.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
ExecutorElassus
l33t
l33t


Joined: 11 Mar 2004
Posts: 765
Location: Stuttgart, Germany

PostPosted: Mon Apr 30, 2012 10:26 pm    Post subject: Reply with quote

Hi Neddy,

okay, so I can leave mdadm to start at default, as previously.

I found the kernel options. Hurrah!

I haven't been using any console framebuffer at all, so my bootup is an ugly 600x800 startup console. I'd really like it to be … not ugly.

When I run 'make gen_init_cpio' I get this:
Code:
# make gen_init_cpio
make: `gen_init_cpio' is up to date.
Is that normal behavior?

Sorry for all the questions. I'm new at this.

Cheers,

EE
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 32439
Location: 56N 3W

PostPosted: Mon Apr 30, 2012 10:33 pm    Post subject: Reply with quote

ExecutorElassus,

The
Code:
make: `gen_init_cpio' is up to date
means the binary already existed and is newer than the .c and .h files use to build it, so there was nothing to do.

If you are nervous, you can run
Code:
make clean
make gen_init_cpio
That will remove any binaries before the build starts.

Its normal after the first
Code:
make gen_init_cpio
in any kernel tree.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
ExecutorElassus
l33t
l33t


Joined: 11 Mar 2004
Posts: 765
Location: Stuttgart, Germany

PostPosted: Mon Apr 30, 2012 10:45 pm    Post subject: Reply with quote

okay, I'm almost at the end of updating your script to fit my system. What is the /mnt/root option you have? Is that what I would call / on my system?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 32439
Location: 56N 3W

PostPosted: Mon Apr 30, 2012 10:55 pm    Post subject: Reply with quote

ExecutorElassus,

The initrd is a little like a boot CD , when you installed originally.
You attached your root partition at /mnt/gentoo to being the install, untarred the stage3 then chrooted into it.
The initrd is the boot CD, your install is the already untarred stage3 and the init script in the initrd lists the steps requited to mount things, check them and get into the chroot.

The initrd attaches it at /mnt/root because it needs to read /etc/fstab to get the UUIDs of /usr and /var
It also needs to switch_root right at the very end, so your root filesystem has to be mounted somewhere before that.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
ExecutorElassus
l33t
l33t


Joined: 11 Mar 2004
Posts: 765
Location: Stuttgart, Germany

PostPosted: Mon Apr 30, 2012 11:02 pm    Post subject: Reply with quote

Hi Neddy

okay, so in that case, I need to make /mnt/root to serve as the temporary root fs, but that won't affect anything post-mount, correct?

Also noteworthy: the /usr/src/linux/scripts/gen_initramfs_list.sh has to be run from /usr/src/linux/, as its line 298 refers to "usr/gen_init_cpio" as a relative - that is, not absolute - path.

Cheers,

EE
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 32439
Location: 56N 3W

PostPosted: Tue May 01, 2012 6:47 pm    Post subject: Reply with quote

ExecutorElassus,

/mnt/root only exists in the initrd.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
ExecutorElassus
l33t
l33t


Joined: 11 Mar 2004
Posts: 765
Location: Stuttgart, Germany

PostPosted: Tue May 01, 2012 7:05 pm    Post subject: Reply with quote

Hi Neddy,

ah, okay. then I'll delete that directory once I can mount / again. For the moment, the initrd is not mounting any of the / partitions, and is consequently unable to find the kernel's root (that is, the block device specified by "root=…" in grub.conf). Neither "/dev/md126" (which is the raid device built out of the three mirrored partitions from each of the three HDDd), nor the equivalent UUID of that array device, seem to work. Is there some other UUID I should be giving? Just the UUID from one of the partitions?

Cheers,

EE
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Sun May 06, 2012 5:20 pm    Post subject: Reply with quote

Hello neddy,

I hope you can help me with not created symlinks in /dev/disk/by-label(uuid) for other linux LVs.

My setup:

everything on lvm except /boot and swap

custom kernel 3.3.4 and 3.2.12, udev 182-r3, openrc 0.9.9.3, lvm 2.0.2.95-r1, genkernel created ramdisk with lvm support
same result with lower version of udev and lvm

Fix for lvm 2.0.2.95-r1
https://bugs.gentoo.org/show_bug.cgi?id=409921#c52

If I boot the system, only symlinks for the gentoo PV's containing LVs are created in /dev/disk/by-label(uuid), I assume by udev.
Despite eg /dev/arch/ and /dev/ubuntu/ are present, the /dev/mapper/ only contains the gentoo LVs.

If I start after boot the lvm service, still no symlinks.
However, if I restart the lvm service, the symlinks are created.

I have basically the same setup for arch and ubuntu, and it works there.

Also, I don't get the system started without the "dolvm" kernel parameter, but I guess it is genkernel init script related

Any help would be appreciated.

PS: I probably give your cpio "arch" approach to initramfs a try and see if that works better.


Last edited by udeved on Sun May 06, 2012 5:50 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 32439
Location: 56N 3W

PostPosted: Sun May 06, 2012 5:48 pm    Post subject: Reply with quote

udeved,

I don't get any symlinks at all for my logical volumes.
In fact, I get error messages from lvm saying that udev was supposed to make the links but didn't ... falling back in direct linke creation.

genkernel will do something similar to my initrd but it will do a lot more too as genkernel builds you a fully modular kernel, therfore, it needs to load the kernel modules needed to boot your box too. My initrd is not tied to any partitular kernel as it does not contain bits of the kernel. With genkernel, you need a new initrd with every kernel build.

Are your arch and ubuntu logical vlomes started by genkernels initrd?
I would be surprised if they were.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Sun May 06, 2012 6:03 pm    Post subject: Reply with quote

NeddySeagoon wrote:
udeved,

I don't get any symlinks at all for my logical volumes.
In fact, I get error messages from lvm saying that udev was supposed to make the links but didn't ... falling back in direct linke creation.

genkernel will do something similar to my initrd but it will do a lot more too as genkernel builds you a fully modular kernel, therfore, it needs to load the kernel modules needed to boot your box too. My initrd is not tied to any partitular kernel as it does not contain bits of the kernel. With genkernel, you need a new initrd with every kernel build.

Are your arch and ubuntu logical vlomes started by genkernels initrd?
I would be surprised if they were.


Yes, perhaps I didn't get the problem along.

I run a custom kernel, without many modules, almost all is built in, but the initrd is generated with
Code:
genkernel --lvm --install initramfs --kernname=kernel


Only eg ext3 fs module in initrd, its about 5 modules, and very small in size



So, all VGs are activated, so in my case arch, ubuntu, chakra and gentoo(the booted system)
Thus, udev creates and populates eg /dev/arch/lv-name, besides the /dev/gentoo/LV-name

however, the /dev/disk/by-label or /dev/disk/by-uuid don't have any symlinks to the activated LVs, only the gentoo LVs are symlinked.

No lvm service in runlevels.

But, I get the missing LV in the mentioned directories after twice starting lvm service, strange...

Output without lvm service, as after boot:

Code:
# ls -la /dev/disk/by-label
insgesamt 0
drwxr-xr-x 2 root root 200  6. Mai 19:59 .
drwxr-xr-x 5 root root 100  6. Mai 2012  ..
lrwxrwxrwx 1 root root  10  6. Mai 2012  Daten -> ../../sda2
lrwxrwxrwx 1 root root  10  6. Mai 2012  System -> ../../sda1
lrwxrwxrwx 1 root root  11  6. Mai 2012  arch-boot -> ../../sda11
lrwxrwxrwx 1 root root  10  6. Mai 2012  boot -> ../../sda3
lrwxrwxrwx 1 root root  11  6. Mai 2012  chakra-boot -> ../../sda13
lrwxrwxrwx 1 root root  11  6. Mai 18:35 gentoo-boot -> ../../sda10
lrwxrwxrwx 1 root root  11  6. Mai 18:38 ubuntu -> ../../dm-20
lrwxrwxrwx 1 root root  11  6. Mai 18:38 ubuntu-usr -> ../../dm-17

ls -la /dev/disk/by-uuid
insgesamt 0
drwxr-xr-x 2 root root 220  6. Mai 19:59 .
drwxr-xr-x 5 root root 100  6. Mai 2012  ..
lrwxrwxrwx 1 root root  10  6. Mai 2012  1E1816A318167A4B -> ../../sda1
lrwxrwxrwx 1 root root  10  6. Mai 2012  2b2a518d-60be-4c99-bb7b-7b2041251a2b -> ../../sda5
lrwxrwxrwx 1 root root  11  6. Mai 18:38 2c9bf884-120c-4fcb-8901-5d6e711f742b -> ../../dm-20
lrwxrwxrwx 1 root root  11  6. Mai 18:35 42b3d32d-b892-4252-861e-5fd727792ef9 -> ../../sda10
lrwxrwxrwx 1 root root  11  6. Mai 2012  7987c32a-6d8a-4074-97cd-94862b921df3 -> ../../sda11
lrwxrwxrwx 1 root root  10  6. Mai 2012  C4EE10EDEE10D98E -> ../../sda2
lrwxrwxrwx 1 root root  10  6. Mai 2012  ce99c81a-032a-4254-9acb-8c4bddef5982 -> ../../sda3
lrwxrwxrwx 1 root root  11  6. Mai 18:38 e2bfcc75-4650-4c27-9575-78d893b3bf90 -> ../../dm-17
lrwxrwxrwx 1 root root  11  6. Mai 2012  fe3e1a6a-e034-4356-a82d-e5d49f614880 -> ../../sda13


Output with twice started lvm service:

Code:
ls -la /dev/disk/by-label
insgesamt 0
drwxr-xr-x 2 root root 400  6. Mai 20:01 .
drwxr-xr-x 5 root root 100  6. Mai 2012  ..
lrwxrwxrwx 1 root root  10  6. Mai 2012  Daten -> ../../sda2
lrwxrwxrwx 1 root root  10  6. Mai 2012  System -> ../../sda1
lrwxrwxrwx 1 root root  11  6. Mai 20:01 arch -> ../../dm-16
lrwxrwxrwx 1 root root  11  6. Mai 2012  arch-boot -> ../../sda11
lrwxrwxrwx 1 root root  11  6. Mai 20:01 arch-tmp -> ../../dm-15
lrwxrwxrwx 1 root root  11  6. Mai 20:01 arch-usr -> ../../dm-13
lrwxrwxrwx 1 root root  11  6. Mai 20:01 arch-var -> ../../dm-14
lrwxrwxrwx 1 root root  10  6. Mai 2012  boot -> ../../sda3
lrwxrwxrwx 1 root root  10  6. Mai 20:01 chakra -> ../../dm-3
lrwxrwxrwx 1 root root  11  6. Mai 2012  chakra-boot -> ../../sda13
lrwxrwxrwx 1 root root  10  6. Mai 20:01 chakra-tmp -> ../../dm-2
lrwxrwxrwx 1 root root  10  6. Mai 20:01 chakra-usr -> ../../dm-0
lrwxrwxrwx 1 root root  10  6. Mai 20:01 chakra-var -> ../../dm-1
lrwxrwxrwx 1 root root  11  6. Mai 18:35 gentoo-boot -> ../../sda10
lrwxrwxrwx 1 root root  11  6. Mai 18:38 ubuntu -> ../../dm-20
lrwxrwxrwx 1 root root  11  6. Mai 20:01 ubuntu-tmp -> ../../dm-19
lrwxrwxrwx 1 root root  11  6. Mai 18:38 ubuntu-usr -> ../../dm-17
lrwxrwxrwx 1 root root  11  6. Mai 20:01 ubuntu-var -> ../../dm-18

# ls -la /dev/disk/by-uuid
insgesamt 0
drwxr-xr-x 2 root root 420  6. Mai 20:01 .
drwxr-xr-x 5 root root 100  6. Mai 2012  ..
lrwxrwxrwx 1 root root  11  6. Mai 20:01 05a1302b-a68d-4d6d-bd42-5b44d4579f02 -> ../../dm-18
lrwxrwxrwx 1 root root  10  6. Mai 2012  1E1816A318167A4B -> ../../sda1
lrwxrwxrwx 1 root root  10  6. Mai 2012  2b2a518d-60be-4c99-bb7b-7b2041251a2b -> ../../sda5
lrwxrwxrwx 1 root root  11  6. Mai 18:38 2c9bf884-120c-4fcb-8901-5d6e711f742b -> ../../dm-20
lrwxrwxrwx 1 root root  10  6. Mai 20:01 355db144-8d49-4833-a771-f3fdd9ebac1d -> ../../dm-3
lrwxrwxrwx 1 root root  11  6. Mai 20:01 37bb65e7-7c71-46ff-aeef-3d0a7481f23a -> ../../dm-15
lrwxrwxrwx 1 root root  11  6. Mai 18:35 42b3d32d-b892-4252-861e-5fd727792ef9 -> ../../sda10
lrwxrwxrwx 1 root root  11  6. Mai 20:01 584b24ae-67c9-4ccd-8e3f-02d9d2fc1c1a -> ../../dm-14
lrwxrwxrwx 1 root root  11  6. Mai 2012  7987c32a-6d8a-4074-97cd-94862b921df3 -> ../../sda11
lrwxrwxrwx 1 root root  11  6. Mai 20:01 915ff97c-d501-415e-b2e5-47973790ccb1 -> ../../dm-13
lrwxrwxrwx 1 root root  10  6. Mai 2012  C4EE10EDEE10D98E -> ../../sda2
lrwxrwxrwx 1 root root  11  6. Mai 20:01 a1635db3-44eb-491f-91a7-35d31f498d35 -> ../../dm-16
lrwxrwxrwx 1 root root  10  6. Mai 20:01 b6cf29f5-f46c-4014-853a-ee4f6f329c67 -> ../../dm-2
lrwxrwxrwx 1 root root  10  6. Mai 2012  ce99c81a-032a-4254-9acb-8c4bddef5982 -> ../../sda3
lrwxrwxrwx 1 root root  11  6. Mai 20:01 d49e80af-2499-448d-9240-52b3a7fb54e4 -> ../../dm-19
lrwxrwxrwx 1 root root  10  6. Mai 20:01 d7026d92-2b96-4f2c-b2c9-3fbf84a26128 -> ../../dm-1
lrwxrwxrwx 1 root root  11  6. Mai 18:38 e2bfcc75-4650-4c27-9575-78d893b3bf90 -> ../../dm-17
lrwxrwxrwx 1 root root  10  6. Mai 20:01 f188ac91-b7d9-4221-ab5b-d2a46432ade9 -> ../../dm-0
lrwxrwxrwx 1 root root  11  6. Mai 2012  fe3e1a6a-e034-4356-a82d-e5d49f614880 -> ../../sda13


I forgot, the result of getting the LVs symlinked, is that they show up in dolphin sidebar.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 32439
Location: 56N 3W

PostPosted: Sun May 06, 2012 6:15 pm    Post subject: Reply with quote

udeved,

I suspect that your genkernel initrd is only doing
Code:
vgchange -ay gentoo
so only your gentoo logical volume group is started.

/usr/src/linux/Documentation/initrd.txt tells how to examine the content of the initrd.
What does the init script in your initrd show?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Sun May 06, 2012 6:23 pm    Post subject: Reply with quote

NeddySeagoon wrote:
udeved,

I suspect that your genkernel initrd is only doing
Code:
vgchange -ay gentoo
so only your gentoo logical volume group is started.

/usr/src/linux/Documentation/initrd.txt tells how to examine the content of the initrd.
What does the init script in your initrd show?


This is the method from initrd's ./etc/initrd.scripts...

Quote:
startVolumes() {
#good_msg 'Checking if volumes need to be started...'

# Here, we check for /dev/device-mapper, and if it exists, we setup a
# a symlink, which should hopefully fix bug #142775 and bug #147015
if [ -e /dev/device-mapper ] && [ ! -e /dev/mapper/control ]
then
mkdir -p /dev/mapper
ln -sf /dev/device-mapper /dev/mapper/control
fi

if [ "${USE_MDADM}" = '1' ]
then
/sbin/mdadm --assemble --scan
fi

if [ "${USE_DMRAID_NORMAL}" = '1' ]
then
if [ -e '/sbin/dmraid' ]
then
good_msg "Activating Device-Mapper RAID(s)"
if [ '${DMRAID_OPTS}' = '' ]
then
/sbin/dmraid -ay
else
/sbin/dmraid -ay ${DMRAID_OPTS}
fi
fi
fi

if [ "${USE_LVM_NORMAL}" = '1' ]
then
if [ -e '/bin/lvm' ]
then
for dev in ${RAID_DEVICES}
do
setup_md_device "${dev}"
done

# This is needed for /bin/lvm to accept the following logic
lvm_commands="#! /bin/lvm"

# If there is a cahe, update it. Unbreak at least dmcrypt
[ -d /etc/lvm/cache ] && lvm_commands="${lvm_commands} \nvgscan"

# To activate volumegroups on all devices in the cache
lvm_commands="${lvm_commands} \nvgchange -ay --sysinit"

# To create symlinks so users can use real_root=/dev/vg/root
# This needs to run after vgchange, using vgchange --mknodes is too
# early.
lvm_commands="${lvm_commands} \nvgmknodes --ignorelockingfailure"

# And finally execute it all (/proc/... needed if lvm is compiled without readline)
good_msg "Scanning for and activating Volume Groups"
printf "%b\n" "${lvm_commands}" | /bin/lvm /proc/self/fd/0
else
bad_msg "vgscan or vgchange not found: skipping LVM volume group activation!"
fi
fi

if [ "${USE_ZFS}" = '1' ]
then
/sbin/zpool import -N -a ${ZPOOL_FORCE}
fi
}
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Sun May 06, 2012 7:11 pm    Post subject: Reply with quote

I quickly booted ubuntu, to post some output:

Code:
~$ ls -la /dev/disk/by-label
insgesamt 0
drwxr-xr-x 2 root root 580 Mai  6  2012 .
drwxr-xr-x 6 root root 120 Mai  6  2012 ..
lrwxrwxrwx 1 root root  11 Mai  6 21:05 arch -> ../../dm-16
lrwxrwxrwx 1 root root  11 Mai  6 21:05 arch-boot -> ../../sda11
lrwxrwxrwx 1 root root  11 Mai  6 21:05 arch-tmp -> ../../dm-15
lrwxrwxrwx 1 root root  11 Mai  6 21:05 arch-usr -> ../../dm-13
lrwxrwxrwx 1 root root  11 Mai  6 21:05 arch-var -> ../../dm-14
lrwxrwxrwx 1 root root  10 Mai  6 21:05 boot -> ../../sda3
lrwxrwxrwx 1 root root  10 Mai  6 21:05 chakra -> ../../dm-3
lrwxrwxrwx 1 root root  11 Mai  6 21:05 chakra-boot -> ../../sda13
lrwxrwxrwx 1 root root  10 Mai  6 21:05 chakra-tmp -> ../../dm-2
lrwxrwxrwx 1 root root  10 Mai  6 21:05 chakra-usr -> ../../dm-0
lrwxrwxrwx 1 root root  10 Mai  6 21:05 chakra-var -> ../../dm-1
lrwxrwxrwx 1 root root  10 Mai  6 21:05 Daten -> ../../sda2
lrwxrwxrwx 1 root root  10 Mai  6 21:05 gentoo -> ../../dm-5
lrwxrwxrwx 1 root root  11 Mai  6 21:05 gentoo-boot -> ../../sda10
lrwxrwxrwx 1 root root  11 Mai  6 21:05 gentoo-distfiles -> ../../dm-11
lrwxrwxrwx 1 root root  11 Mai  6 21:05 gentoo-opt -> ../../dm-12
lrwxrwxrwx 1 root root  10 Mai  6 21:05 gentoo-portage -> ../../dm-8
lrwxrwxrwx 1 root root  10 Mai  6 21:05 gentoo-src -> ../../dm-7
lrwxrwxrwx 1 root root  11 Mai  6 21:05 gentoo-tmp -> ../../dm-10
lrwxrwxrwx 1 root root  10 Mai  6 21:05 gentoo-usr -> ../../dm-6
lrwxrwxrwx 1 root root  10 Mai  6 21:05 gentoo-var -> ../../dm-9
lrwxrwxrwx 1 root root  10 Mai  6 21:05 home -> ../../dm-4
lrwxrwxrwx 1 root root  10 Mai  6 21:05 System -> ../../sda1
lrwxrwxrwx 1 root root  11 Mai  6 21:05 ubuntu -> ../../dm-20
lrwxrwxrwx 1 root root  11 Mai  6 21:05 ubuntu-tmp -> ../../dm-19
lrwxrwxrwx 1 root root  11 Mai  6 21:05 ubuntu-usr -> ../../dm-17
lrwxrwxrwx 1 root root  11 Mai  6 21:05 ubuntu-var -> ../../dm-18


Note, contrary to gentoo, ubuntu also symlinks the ubuntu LVs.
Gentoo doesn't do that.
Arch also creates all symlinks.

Code:
~$ ls -la /dev/mapper
insgesamt 0
drwxr-xr-x  2 root root     480 Mai  6  2012 .
drwxr-xr-x 20 root root    4820 Mai  6 21:05 ..
lrwxrwxrwx  1 root root       8 Mai  6 21:05 arch-root -> ../dm-16
lrwxrwxrwx  1 root root       8 Mai  6 21:05 arch-tmp -> ../dm-15
lrwxrwxrwx  1 root root       8 Mai  6 21:05 arch-usr -> ../dm-13
lrwxrwxrwx  1 root root       8 Mai  6 21:05 arch-var -> ../dm-14
lrwxrwxrwx  1 root root       7 Mai  6 21:05 chakra-root -> ../dm-3
lrwxrwxrwx  1 root root       7 Mai  6 21:05 chakra-tmp -> ../dm-2
lrwxrwxrwx  1 root root       7 Mai  6 21:05 chakra-usr -> ../dm-0
lrwxrwxrwx  1 root root       7 Mai  6 21:05 chakra-var -> ../dm-1
crw-------  1 root root 10, 236 Mai  6 21:05 control
lrwxrwxrwx  1 root root       8 Mai  6 21:05 gentoo-distfiles -> ../dm-11
lrwxrwxrwx  1 root root       8 Mai  6 21:05 gentoo-opt -> ../dm-12
lrwxrwxrwx  1 root root       7 Mai  6 21:05 gentoo-portage -> ../dm-8
lrwxrwxrwx  1 root root       7 Mai  6 21:05 gentoo-root -> ../dm-5
lrwxrwxrwx  1 root root       7 Mai  6 21:05 gentoo-src -> ../dm-7
lrwxrwxrwx  1 root root       8 Mai  6 21:05 gentoo-tmp -> ../dm-10
lrwxrwxrwx  1 root root       7 Mai  6 21:05 gentoo-usr -> ../dm-6
lrwxrwxrwx  1 root root       7 Mai  6 21:05 gentoo-var -> ../dm-9
lrwxrwxrwx  1 root root       7 Mai  6 21:05 home-home -> ../dm-4
lrwxrwxrwx  1 root root       8 Mai  6 21:05 ubuntu-root -> ../dm-20
lrwxrwxrwx  1 root root       8 Mai  6 21:05 ubuntu-tmp -> ../dm-19
lrwxrwxrwx  1 root root       8 Mai  6 21:05 ubuntu-usr -> ../dm-17
lrwxrwxrwx  1 root root       8 Mai  6 21:05 ubuntu-var -> ../dm-18


Very strange.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 32439
Location: 56N 3W

PostPosted: Sun May 06, 2012 8:18 pm    Post subject: Reply with quote

udeved,

That init script fragment looks OK to me.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Sun May 06, 2012 8:54 pm    Post subject: Reply with quote

NeddySeagoon wrote:
udeved,

That init script fragment looks OK to me.


I just had a look into ubuntu initrd.

Ubuntu seems to do the lvm activation purely with udevadm besides a vgscan

Code:
# It's all over netlink now
echo "" > /proc/sys/kernel/hotplug
   
# Start the udev daemon to process events
/sbin/udevd --daemon --resolve-names=never

# Iterate sysfs and fire off everything; if we include a rule for it then
# it'll get handled; otherwise it'll get handled later when we do this again
# in the main boot sequence.
( /sbin/udevadm trigger --action=add --subsystem-match=block; \
  /sbin/udevadm trigger --action=add --subsystem-nomatch=block; ) &


I can't find any reference to vgchange -a y in lvm init related scripts.

If you follow the bug report I posted, iirc post 54 gives the solution.
It says to comment out some lines in /lib/rcscripts/addons/lvm-start-sh, which I bvelieve is used in initrd.
I will generate a new initrd, after I commented out the vgchange line as well, and test it.
Back to top
View user's profile Send private message
Goverp
Guru
Guru


Joined: 07 Mar 2007
Posts: 353

PostPosted: Tue May 08, 2012 11:50 am    Post subject: Will kernel-built RAID need initramfs ? Reply with quote

I've been following the udev-182 saga, but not dared touch anything so far. My box has a 4-disk RAID 5 array partitioned into /, /var, /home and /var/tmp, so /usr is part of rootfs, but /var isn't. The system is an amd64 Gentoo stable setup, kernel 3.2.12 (no initramfs) sys-fs/udev-171-r5. The mdadm service is in the default runlevel, and doesn't start until quite late (after cups). The kernel assembles the RAID array from command-line parameters (not auto-assemble, but the explicit version of the same). Here are the md-related lines from syslog:
Code:
 May  8 12:01:59 kernel: Command line: root=/dev/md127p3 md=127,/dev/sda3,/dev/sdb3,/dev/sdc3,/dev/sdd3 vga=0x317
 May  8 12:01:59 kernel: Kernel command line: root=/dev/md127p3 md=127,/dev/sda3,/dev/sdb3,/dev/sdc3,/dev/sdd3 vga=0x317
 May  8 12:01:59 kernel: md: Will configure md127 (super-block) from /dev/sda3,/dev/sdb3,/dev/sdc3,/dev/sdd3, below.
 May  8 12:01:59 kernel: ata5: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0xff00 irq 14
 May  8 12:01:59 kernel: ata6: PATA max UDMA/100 cmd 0x170 ctl 0x376 bmdma 0xff08 irq 15
 May  8 12:01:59 kernel: md: raid1 personality registered for level 1
 May  8 12:01:59 kernel: md: raid6 personality registered for level 6
 May  8 12:01:59 kernel: md: raid5 personality registered for level 5
 May  8 12:01:59 kernel: md: raid4 personality registered for level 4
 May  8 12:01:59 kernel: md: Skipping autodetection of RAID arrays. (raid=autodetect will force)
 May  8 12:01:59 kernel: md: Loading md127: /dev/sda3
 May  8 12:01:59 kernel: md: bind<sda3>
 May  8 12:01:59 kernel: md: bind<sdb3>
 May  8 12:01:59 kernel: md: bind<sdc3>
 May  8 12:01:59 kernel: md: bind<sdd3>
 May  8 12:01:59 kernel: md/raid:md127: device sdd3 operational as raid disk 3
 May  8 12:01:59 kernel: md/raid:md127: device sdc3 operational as raid disk 2
 May  8 12:01:59 kernel: md/raid:md127: device sdb3 operational as raid disk 1
 May  8 12:01:59 kernel: md/raid:md127: device sda3 operational as raid disk 0
 May  8 12:01:59 kernel: md/raid:md127: allocated 4270kB
 May  8 12:01:59 kernel: md/raid:md127: raid level 5 active with 4 out of 4 devices, algorithm 2
 May  8 12:01:59 kernel: md127: detected capacity change from 0 to 805295751168
 May  8 12:01:59 kernel: md127: p1 p2 p3 p4
 May  8 12:01:59 kernel: md127: p1 p2 p3 p4
 May  8 12:01:59 kernel: EXT4-fs (md127p3): mounted filesystem with ordered data mode. Opts: (null)
 May  8 12:01:59 kernel: mdadm: sending ioctl 1261 to a partition!
 May  8 12:01:59 kernel: EXT4-fs (md127p3): re-mounted. Opts: (null)
 May  8 12:01:59 kernel: EXT4-fs (md127p4): mounted filesystem with ordered data mode. Opts: (null)
 May  8 12:01:59 kernel: EXT4-fs (md127p1): mounted filesystem with ordered data mode. Opts: (null)
 May  8 12:01:59 kernel: EXT4-fs (md127p2): mounted filesystem with ordered data mode. Opts: (null)
. md127p1 is /var, md127p2 is /var/tmp (and /tmp bind-mounted from within that), md127p3 is rootfs, and md127p4 is /home. /etc/fstab locates the partitions by LABEL=, which may not be as precise as UUID, but it's pretty similar in function.

My question is, will this need an initramfs after udev-182? I'd have thought not, as the kernel is already assembling the RAID array without udev's or mdadm's assistance. It will need something to mount /var and so forth before udev starts, such as greyspoke's script, or maybe just a one-liner to mount /var.

If it's got a reasonable chance, I'll try upgrading udev to test it, but not if I'm almost certain to need to build an initramfs.
_________________
Greybeard
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 32439
Location: 56N 3W

PostPosted: Tue May 08, 2012 5:35 pm    Post subject: Reply with quote

Goverp,

You will need something to mount /var before udev starts, thats normally in the sysinit runlevel and well before local-mount.
An initrd or one possible solution. A mount /var early in the in init script is not a good idea. The filesystem should be checked before its mounted, so now you need the right fsck too.

There are two or three other approaches, greyspokes script. SteveLs changes to the existing init scrips and a latecommer, vapiers busybox with the USE=sep-usr flag set.
I'm not sure how that works but I guess its intended for use in an initrd.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Tue May 08, 2012 6:05 pm    Post subject: Reply with quote

NeddySeagoon wrote:
Goverp,

You will need something to mount /var before udev starts, thats normally in the sysinit runlevel and well before local-mount.
An initrd or one possible solution. A mount /var early in the in init script is not a good idea. The filesystem should be checked before its mounted, so now you need the right fsck too.

There are two or three other approaches, greyspokes script. SteveLs changes to the existing init scrips and a latecommer, vapiers busybox with the USE=sep-usr flag set.
I'm not sure how that works but I guess its intended for use in an initrd.


Thanks a lot for mentioning the buybox approach.
Google found me the thread, and it states it works with busybox 1.20.0 without initrd.
Exactly what I was looking for, besides the earlymount script.

http://www.gossamer-threads.com/lists/gentoo/dev/252734

I will report back how that one worked out, since its in the portage tree it says.

Do you see any other LVs, or any LVs at all in your filemanager?
Back to top
View user's profile Send private message
steveL
Advocate
Advocate


Joined: 13 Sep 2006
Posts: 3036
Location: The Peanut Gallery

PostPosted: Thu May 10, 2012 2:51 pm    Post subject: Reply with quote

I don't think busybox with sep-usr works with /usr on LVM since it runs before init (thus before lvm service):
vapier wrote:
[the] new applet has a hand written set of commands to automatically mount /dev /proc /sys /usr and seed /dev, and then execute
the real init (defaulting to /sbin/init)

I'd like openrc using busybox in any case, so I'll play with that sometime in next couple of weeks.

You could also try earlymounts or the patched scripts, which I prefer as they seem to have less issues with other stuff, although they are a bit trickier to setup due to the patching needed, and switching udev runlevel. (They just make udev run after localmount, so don't require any configuration beyond a single variable in udev.conf, eg for fsck, lvm or mdadm, last of which I don't use, so haven't tested.)
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Thu May 10, 2012 3:42 pm    Post subject: Reply with quote

I can confirm, that busybox sep-usr does not work with root on lvm.
I tried to configure busybox with mdev support, no difference, LVM volumes don't get activated.

I also messed with different initrd structures.
I took arch's initrd created with mkinitcpio, customized it a bit, and the thingy boots. Probably I post the init script here, after I got everything like demons to work properly.

After closer inspection of arch's initrd, I found that arch includes the udevd in lib.
This seems to solve the problem of LVs not getting properly symlinked and thus refuse to show in filemanager.

I also simply copied the whole arch kernel with ramdisk to gentoo boot partition.
If I boot arch's kernel with gentoo, everything LV related works as intended in desktop environment.

Atm, arch's mkinitcpio seems to have the better approach with their "hooks" for ramdisk than genkernel.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 32439
Location: 56N 3W

PostPosted: Thu May 10, 2012 6:29 pm    Post subject: Reply with quote

udeved,

Root on LVM has always required an inird. LVM is a userspace tool and you need it working to mount root.
Root on a real partition or autodetected raid with everything else in LVM did not used to need an initrd but will with >=udev-182 as /usr and /var are in LVM, so LVM must be started to mount /usr and /var before udev starts.

I'm not sure if steveLs patched scripts will start LVM early enough. I think they will as local-mount used to mount /usr and /var anyway, so LVM had to be running before local-mount.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
udeved
n00b
n00b


Joined: 06 May 2012
Posts: 29

PostPosted: Thu May 10, 2012 7:02 pm    Post subject: Reply with quote

NeddySeagoon wrote:
udeved,

Root on LVM has always required an inird. LVM is a userspace tool and you need it working to mount root.
Root on a real partition or autodetected raid with everything else in LVM did not used to need an initrd but will with >=udev-182 as /usr and /var are in LVM, so LVM must be started to mount /usr and /var before udev starts.

I'm not sure if steveLs patched scripts will start LVM early enough. I think they will as local-mount used to mount /usr and /var anyway, so LVM had to be running before local-mount.


Yes, you are totally right. I completely forgot about userspace when made my enthusiast post.
I assumed wrongly that ginit also allows the kernel parameter dolvm, which produces a kernel panic.
I forgot to mention, I moved my root to a non LVM partition as well and tested busybox sep-usr

The result was still unmounted partitions with that ginit kernel paramenter for non root LVM partitions.
I tested a non LV /usr and /var as well.

I got now a very well working initrd which symlinks LVs properly.

If want me to post the scripts, say so. :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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