Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
init script to mount /usr and friends before udev
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
gseba
n00b
n00b


Joined: 02 Aug 2003
Posts: 59
Location: Romania

PostPosted: Wed Apr 11, 2012 8:47 am    Post subject: Reply with quote

Hi,

genkernel has another solution in `/etc/initramfs.mounts': list there "/usr" and "/usr/lib64", "/var" etc. and the initramfs created by genkernel will mount these on boot, before 'init'.

For me, it works only with patches from bug #411559, since in the case these are encrypted logical volumes, their volume group(s) must be priorly openLUKS'ed, using kernel cmdline parameter "crypt_maps".

s.


Last edited by gseba on Sat Apr 21, 2012 6:44 pm; edited 2 times in total
Back to top
View user's profile Send private message
sphakka
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jun 2003
Posts: 77

PostPosted: Wed Apr 11, 2012 9:11 am    Post subject: Reply with quote

gseba wrote:

genkernel has another solution in `/etc/initramfs.mounts': list there "/usr" and "/usr/lib64", "/var" etc. and the initramfs created by genkernel will mount these on boot, before 'init'.


Thanks for the tip, but... "initramfs" (argh!) is taboo in this thread ;-) ... and, as far as I'm concerned, genkernel too.

^s
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Wed Apr 11, 2012 9:27 am    Post subject: Reply with quote

also genkernel :)
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
gseba
n00b
n00b


Joined: 02 Aug 2003
Posts: 59
Location: Romania

PostPosted: Wed Apr 11, 2012 12:39 pm    Post subject: Reply with quote

sphakka wrote:

"initramfs" (argh!) is taboo in this thread


I agree "initrd=", as a parameter, is optional.

Regarding "lvm.static" in the patch of my first post, this is from "pkg-setup" of =sys-fs/lvm2-2.02.95-r1 (the third "elog" line):

Code:

pkg_setup() {
   # 1. Genkernel no longer copies /sbin/lvm blindly.
   # 2. There are no longer any linking deps in /usr.
   if use static; then
      elog "Warning, we no longer overwrite /sbin/lvm and;/sbin/dmsetup with"
      elog "their static versions. If you need the static binaries,"
      elog "you must append .static to the filename!"
   fi
}


s.
Back to top
View user's profile Send private message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1432
Location: Berlin, Germany

PostPosted: Fri Apr 13, 2012 11:45 pm    Post subject: Reply with quote

I've been away from this thread for a bit, and I'm wondering where the process stands. For example, with no initramfs, and /usr, /var/, and /opt on separate partitions (on a RAID array no less) is it possible to boot with >usev-182 and rc-0.9.9.3? Or is there still some tweaking to be done?

Thanks for the work,

EE
Back to top
View user's profile Send private message
sphakka
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jun 2003
Posts: 77

PostPosted: Sat Apr 14, 2012 8:25 am    Post subject: Reply with quote

ExecutorElassus wrote:
I've been away from this thread for a bit, and I'm wondering where the process stands. For example, with no initramfs, and /usr, /var/, and /opt on separate partitions (on a RAID array no less) is it possible to boot with >usev-182 and rc-0.9.9.3? Or is there still some tweaking to be done?

Thanks for the work,
EE


As far as I understand, gseba is already on udev-182.

I'm still with udev-171-r5 as I see some blocking packages that might mess up my box:
Code:

flexzo ~ # emerge -pv udev

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N    ~] sys-apps/hwids-20120408  270 kB
[ebuild  N    ~] sys-apps/kmod-7  USE="tools zlib -debug -doc -lzma -static-libs" 959 kB
[uninstall     ] sys-apps/module-init-tools-3.16-r1  USE="-static"
[blocks b      ] sys-apps/kmod ("sys-apps/kmod" is blocking sys-apps/module-init-tools-3.16-r1)
[blocks b      ] sys-apps/module-init-tools ("sys-apps/module-init-tools" is blocking sys-apps/kmod-7)
[ebuild  N    ~] sys-fs/udev-init-scripts-10  16 kB
[ebuild     U ~] sys-fs/udev-182-r3 [171-r5] USE="gudev hwdb keymap openrc%* rule_generator -build -debug -doc% -linux) -static-libs% (-acl%) (-action_modeswitch%) (-edd%) (-extras%*) (-test%)" 774 kB
[blocks b      ] <sys-fs/udev-182 ("<sys-fs/udev-182" is blocking sys-fs/udev-init-scripts-10)
[blocks B      ] <sys-apps/pciutils-3.1.9-r2 ("<sys-apps/pciutils-3.1.9-r2" is blocking sys-apps/hwids-20120408)
[blocks B      ] <sys-apps/usbutils-005-r1 ("<sys-apps/usbutils-005-r1" is blocking sys-apps/hwids-20120408)

Total: 4 packages (1 upgrade, 3 new, 1 uninstall), Size of downloads: 2,017 kB
Conflict: 5 blocks (2 unsatisfied)

 * Error: The above package list contains packages which cannot be
 * installed at the same time on the same system.

  (sys-apps/hwids-20120408::gentoo, ebuild scheduled for merge) pulled in by
    sys-apps/hwids required by (sys-fs/udev-182-r3::gentoo, ebuild scheduled for merge)

  (sys-apps/pciutils-3.1.9-r1::gentoo, installed) pulled in by
    sys-apps/pciutils required by (media-sound/alsa-utils-1.0.25-r1::gentoo, installed)
    sys-apps/pciutils required by (kde-base/kinfocenter-4.8.1::gentoo, installed)
    sys-apps/pciutils required by (sys-apps/vbetool-1.1::gentoo, installed)
    sys-apps/pciutils required by @selected

  (sys-apps/usbutils-004::gentoo, installed) pulled in by
    sys-apps/usbutils required by (kde-base/kinfocenter-4.8.1::gentoo, installed)


For more information about Blocked Packages, please refer to the following
section of the Gentoo Linux x86 Handbook (architecture is irrelevant):

http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?full=1#blocked


The following keyword changes are necessary to proceed:
#required by sys-fs/udev-182-r3[hwdb], required by sys-fs/udev-init-scripts-10
=sys-apps/hwids-20120408 ~amd64
#required by sys-fs/udev-182-r3[openrc], required by udev (argument)
=sys-fs/udev-init-scripts-10 ~amd64
#required by sys-fs/udev-182-r3, required by sys-fs/udev-init-scripts-10
=sys-apps/kmod-7 ~amd64


Nothing really critical, though, I'd like to know if anybody got in trouble because of that above -- so can't tinker too much on my "production" laptop...
Back to top
View user's profile Send private message
sphakka
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jun 2003
Posts: 77

PostPosted: Sun Apr 15, 2012 1:14 pm    Post subject: Success with udev-182-r3! Reply with quote

Pheeew! Upgraded today to udev-182-r3, my box boots fine :-)

Summary of my configuration:
- kernel 3.2.12-gentoo
- openrc-0.9.9.3
- udev-182-r3
- lvm 2.02.88: /usr, /var pre-mounted *RO*
- no RAID

Everything seems fully functional.

Someone should try with RAID...

Cheers,

^s
Back to top
View user's profile Send private message
gseba
n00b
n00b


Joined: 02 Aug 2003
Posts: 59
Location: Romania

PostPosted: Mon Apr 16, 2012 8:00 am    Post subject: Re: Success with udev-182-r3! Reply with quote

Congrats!

sphakka wrote:

- no RAID

Someone should try with RAID...


I tested mdadm=true for ( /home raid1) this configuration:

Code:

/dev/md0:
        Version : 0.90
  Creation Time : Sat Oct  2 23:00:58 2010
     Raid Level : raid1
     Array Size : 328922752 (313.69 GiB 336.82 GB)
  Used Dev Size : 328922752 (313.69 GiB 336.82 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Mon Apr 16 10:50:04 2012
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0
           UUID : ...
         Events : 0.364

    Number   Major   Minor   RaidDevice State
       0       8       19        0      active sync   /dev/sdb3
       1       8        6        1      active sync   /dev/sda6


but fsck fails, and before there are about 10 messages:
Quote:

mdam: sending ioctl 1261 to a partition!


afterwards '/dev/mapper/home' is not mounted (does not exist or something.)

I had to come to the console on the remote machine, so perhaps someone can fix it up before I should try again, glad to help, no thanks.

I emptied /etc/initramfs.mounts, added earlymounts to sysinit and appended comment= to /etc/fstab.

s.
Back to top
View user's profile Send private message
sphakka
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jun 2003
Posts: 77

PostPosted: Mon Apr 16, 2012 9:30 am    Post subject: Re: Success with udev-182-r3! Reply with quote

gseba,

I can't help much here. But, could you please post any other relevant mdadm/fsck error messages? In order to get sysinit properly logged, make sure RC logging is set with rc_log_path="/rc.log" AND your kernel configured with
Code:

CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y


BTW, I wonder if earlymounts should use scripts in '/lib64/rcscripts/addons/' to launch RAID and LVM, that would make it more consistent with the openrc framework...
Back to top
View user's profile Send private message
gseba
n00b
n00b


Joined: 02 Aug 2003
Posts: 59
Location: Romania

PostPosted: Mon Apr 16, 2012 3:12 pm    Post subject: Reply with quote

sphakka,

I wished I can tell you it works or not. The two kernel configuration variables are there. Logging is of course enabled.
Here it was:

Code:

rc sysinit logging started at Mon Apr  9 02:45:25 2012


   OpenRC 0.9.9.3 is starting up Gentoo Linux (x86_64) [XEN0]

Press I to enter interactive boot mode

 * /proc is already mounted, skipping
 * Mounting /run ... [ ok ]
 * /run/lock: creating directory
 * /run/lock: correcting owner
 * Mounting security filesystem ... [ ok ]
 * Mounting debug filesystem ... [ ok ]
 * Using /dev mounted from kernel ... [ ok ]
 * starting early mount service ...
  7 logical volume(s) in volume group "linux" now active
 *   checking auto filesystem on /dev/mapper/linux-usr ...
USR has been mounted 1 times without being checked, check forced.
USR: 100.0% USR: 41060/393216 files (2.6% non-contiguous), 389070/1571840 blocks
 *   mounting /dev/mapper/linux-usr on /usr ... [ ok ]
 *   checking auto filesystem on /dev/mapper/linux-lib64 ...
LIB has been mounted 1 times without being checked, check forced.
LIB: 100.0% LIB: 79417/393216 files (0.7% non-contiguous), 1154755/1572864 blocks
 *   mounting /dev/mapper/linux-lib64 on /usr/lib64 ... [ ok ]
 *   checking jfs filesystem on /dev/mapper/home ...
fsck.jfs version 1.1.15, 04-Mar-2011
processing started: 4/16/2012 15:06:39

Error: Cannot open device /dev/mapper/home

Usage:  fsck.jfs [-afnpvV] [-j journal_device] [--omit_journal_replay] [--replay_journal_only] device

Emergency help:
 -a                 Automatic repair.
 -f                 Force check even if file system is marked clean.
 -j journal_device  Specify external journal device.
 -n                 Check read only, make no changes to the file system.
 -p                 Automatic repair.
 -v                 Be verbose.
 -V                 Print version information only.
 --omit_journal_replay    Omit transaction log replay.
 --replay_journal_only    Only replay the transaction log.
 *   fsck couldn't check filesystem on /dev/mapper/home
 *   mounting /dev/mapper/home on /home ...
mount: special device /dev/mapper/home does not exist
 *   couldn't mount filesystem /dev/mapper/home
 [ !! ]
 * some filesystems not mounted or not checked
 [ !! ]

 * About to start the service dmesg
 *   1) Start the service      2) Skip the service
 *   3) Continue boot process      4) Exit to shell
Give root password for maintenance
(or type Control-D to continue):
bash: no job control in this shell
localhost ~ # mdadm
localhost ~ # mdadm --assemble --scan
localhost ~ # cat /etc/mdadm.conf
DEVICE /dev/sdb3 /dev/sda6
ARRAY /dev/md0 devices=/dev/sdb3,/dev/sda6
...


The script `earlymounts' in `/etc/init.d' already has "embedded" `mdraid' script and `lvm' in it. If you go for addons, it's likely you will reach duplication. Could you not resolve this with "depend" functionality?

Code:

depend () {
     before udev
     after mdraid lvm
}


s.
Back to top
View user's profile Send private message
sphakka
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jun 2003
Posts: 77

PostPosted: Mon Apr 16, 2012 4:36 pm    Post subject: Reply with quote

Mmh, I see nothing about mdadm running (!?). Gseba, please, modify the relevant snippet in `earlymounts' with the following one:
Code:

    if yesno $mdadm; then
        if [ -f /etc/mdadm.conf ]; then
            mdadm -vv --assemble --scan 2>&1
        else
            mdadm -vv --assemble 2>&1
        fi
    fi

... and try again. It should be safe also calling the script on the running system with `restart' action.

Quote:

The script `earlymounts' in `/etc/init.d' already has "embedded" `mdraid' script and `lvm' in it. If you go for addons, it's likely you will reach duplication. Could you not resolve this with "depend" functionality?

That would be OK for mdraid; as for LVM, we want to be selective, so for now we keep it as it is.

^s
Back to top
View user's profile Send private message
gseba
n00b
n00b


Joined: 02 Aug 2003
Posts: 59
Location: Romania

PostPosted: Tue Apr 17, 2012 9:30 pm    Post subject: Reply with quote

sphakka,

Quote:

... and try again. It should be safe also calling the script on the running system with `restart' action.


As reaction to what you requested, I stepped a "running system" throughout sysinit and boot and have the following results.



  • This became for me a probem of right steps and system administration. I managed to bootup Gentoo with the following setups.


    1. patch the `/lib/rcscripts/addons/lvm-start.sh'
      Code:

      --- lvm-start.sh   2012-04-17 22:24:32.000000000 +0300
      +++ lvm-start.sh.static   2012-04-17 22:24:11.000000000 +0300
      @@ -18,7 +18,7 @@
       
       # NOTE: Add needed modules for LVM or RAID, etc
       #       to /etc/modules.autoload if needed
      -for lvm_path in /bin/lvm /sbin/lvm ; do
      +for lvm_path in /{s,}bin/lvm{.static,} ; do
          [ -x "$lvm_path" ] && break
       done
       if [ -z "${CDBOOT}" -a -x "$lvm_path" ] ; then


      UPDATE they moved `/lib/rcscripts/addons/lvm-start.sh' to plain `/etc/init.d/lvm' where now i have

      Code:
      for lvm_path in /{s,}bin/lvm{.static,} ; do


      in `start()' and `stop()'

    2. this script is copied frow within portage `sys-fs/lvm2/files' directory
    3. note that `/etc/conf.d/lvm' contains the line: RC_AFTER="mdraid"
    4. make sure to have the kernel configuration variable set: CONFIG_TMPFS=Y
    5. edit the `/etc/lvm/lvm.conf' global settings and set variable: locking_dir = "/run/lock"
    6. do openrc logging there too: rc_log_path="/run/rc.log"


  • For the second part, add all required services by `earlymount' to sysinit level, and delete them from their previous (boot) runlevel:

    Code:

    eselect rc delete device-mapper boot
    eselect rc delete lvm boot
    eselect rc delete dmcrypt boot
    eselect rc delete mdraid boot

    Code:

    eselect rc add device-mapper sysinit
    eselect rc add lvm sysinit
    eselect rc add dmcrypt sysinit
    eselect rc add mdraid sysinit


    mdadm service uses /var/run/mdadm.pid, so leave it there (boot ).

    Quote:

    That would be OK for mdraid; as for LVM, we want to be selective, so for now we keep it as it is.


    But you would accept the simplification where they were both `use' dependencies?

  • For the third part, keep `earlymount' to its specificity: to mount filesystems (/usr in the main) early. So have these filesystems listed in the mounts variable. The comment= is no further required in /etc/fstab.

    Code:

    # earlymounts configuration file for early mounts init script
    # ...
    # comma separated list of filesystems to mount
    mounts=/usr,/usr/lib64,/home


  • Next, step to a lite `earlymounts' script; start becomes:

    Code:

    ...
    mounts=${mounts:=/usr}
    ...
    depend() {
        before udev
        use dmcrypt mdraid lvm
    }

    start () {
        ebegin "starting early mount service"
        # verbose mount fake all prints lines just for devices with the
        # specified option in /etc/fstab, with the devicename as the first word
        # (also don't write in /etc/mtab to avoid hassles)
        local err=0 retval=0 mntlines=$(mount -vfan) mount line
        eindent
        local IFS_="$IFS"
        local IFS="$_IFS"
        for mount in $mounts; do
            export IFS="$IFS_"
            line=$(echo "$mntlines" | egrep "on $mount type")
            ! [ -z "$line" ] || ewarn "$mount: skipping..."
            ! [ -z "$line" ] || continue
            _doline $line
            retval=$?
            err=$(($err + $retval))
        done
        eoutdent
        eend $err "some filesystems not mounted or not checked"
    }


    The egrep code selects the "on /xxx type yyy (zzz)" infixed lines out of "already mounted on xxx" end-suffixed ones. The _doline $line is perfect, replace with _doline "$line" makes "$1" a whole line, not the device path.



    Now the boxes: with LVM (a), with both LVM and RAID (b), without any (c).



    1. LVM only

      Code:

      # earlymounts configuration file for early mounts init script

      # comma separated list of filesystems to mount
      mounts=/usr,/usr/lib64


      Code:

      $ eselect rc show sysinit
      Status of init scripts in runlevel "sysinit"
        devfs                     [started]
        device-mapper             [started]
        dmcrypt                   [started]
        dmesg                     [started]
        earlymounts               [started]
        lvm                       [started]
        udev                      [started]
        udev-mount                [started]


      Quote:

      * Shutting down the Logical Volume Manager
      * Finished Shutting down the Logical Volume Manager
      * Setting hardware clock using the system clock [Local Time] ... [ ok ]

      rc shutdown logging stopped at Tue Apr 17 22:12:27 2012


      rc sysinit logging started at Wed Apr 18 01:13:51 2012


      OpenRC 0.9.9.3 is starting up Gentoo Linux (x86_64)

      Press I to enter interactive boot mode

      * /proc is already mounted, skipping
      * Mounting /run ... [ ok ]
      * /run/lock: creating directory
      * /run/lock: correcting owner
      * Mounting security filesystem ... [ ok ]
      * Mounting debug filesystem ... [ ok ]
      * Using /dev mounted from kernel ... [ ok ]
      * Setting up the Logical Volume Manager ... [ ok ]
      * starting early mount service ...
      * checking auto filesystem on /dev/mapper/linux-usr ...
      ---
      /dev/mapper/linux-usr
      ---
      Filesystem is clean.
      * mounting /dev/mapper/linux-usr on /usr ... [ ok ]
      * checking auto filesystem on /dev/mapper/linux-lib64 ...
      ---
      /dev/mapper/linux-lib64
      ---
      Filesystem is clean.
      * mounting /dev/mapper/linux-lib64 on /usr/lib64 ... [ ok ]
      --- * starting early mount service ... --- [ ok ]
      * Starting udev ... [ ok ]
      * Populating /dev with existing devices through uevents ... [ ok ]
      * Waiting for uevents to be processed ... [ ok ]
      * Device initiated services: net.eth0 net.wlan0
      * Mounting /dev/shm ... [ ok ]

      rc sysinit logging stopped at Wed Apr 18 01:13:51 2012


      rc boot logging started at Wed Apr 18 01:13:51 2012

      * Setting system clock using the hardware clock [Local Time] ... [ ok ]
      * Loading module phc-intel ... [ ok ]
      ---
      * Autoloaded 7 module(s)
      ---


    2. LVM and RAID

      Code:

      # earlymounts configuration file for early mounts init script

      # comma separated list of filesystems to mount
      mounts=/usr,/usr/lib64,/home


      Code:

      $ eselect rc show sysinit
      Status of init scripts in runlevel "sysinit"
        devfs                     [started]
        device-mapper             [started]
        dmcrypt                   [started]
        dmesg                     [started]
        earlymounts               [started]
        lvm                       [started]
        mdraid                    [started]
        udev                      [started]


      Quote:

      * Shutting down the Logical Volume Manager
      * Finished Shutting down the Logical Volume Manager
      * Shutting down RAID devices (mdadm) ...
      * mdadm: Cannot get exclusive access to /dev/md0:Perhaps a running process, mounted filesystem or active volume group?
      mdadm: Cannot get exclusive access to /dev/md0:Perhaps a running process, mounted filesystem or active volume group?
      [ !! ]
      * ERROR: mdraid failed to stop
      * Removing dm-crypt mappings
      * home ... [ ok ]
      * Setting hardware clock using the system clock [Local Time] ... [ ok ]

      rc shutdown logging stopped at Tue Apr 17 21:54:17 2012


      rc sysinit logging started at Wed Apr 18 00:55:17 2012


      OpenRC 0.9.9.3 is starting up Gentoo Linux (x86_64) [XEN0]

      Press I to enter interactive boot mode

      * /proc is already mounted, skipping
      * Mounting /run ... [ ok ]
      * /run/lock: creating directory
      * /run/lock: correcting owner
      * Mounting security filesystem ... [ ok ]
      * Mounting debug filesystem ... [ ok ]
      * Using /dev mounted from kernel ... [ ok ]
      * Setting up dm-crypt mappings ...
      * Please insert removable device for home
      * home using: luksOpen /dev/md0 home ... [ ok ]
      * dm-crypt mapping store is already configured
      * Starting up RAID devices ...
      *
      [ !! ]
      * Setting up the Logical Volume Manager ... [ ok ]
      * starting early mount service ...
      * checking auto filesystem on /dev/mapper/linux-usr ...
      USR has been mounted 1 times without being checked, check forced.
      USR: 100.0%
      USR: 41100/393216 files (2.6% non-contiguous), 389153/1571840 blocks
      * mounting /dev/mapper/linux-usr on /usr ... [ ok ]
      * checking auto filesystem on /dev/mapper/linux-lib64 ...
      LIB has been mounted 1 times without being checked, check forced.
      LIB: 100.0%
      LIB: 79414/393216 files (0.7% non-contiguous), 1154820/1572864 blocks
      * mounting /dev/mapper/linux-lib64 on /usr/lib64 ... [ ok ]
      * checking auto filesystem on /dev/mapper/home ...
      ---
      Filesystem is clean.
      * mounting /dev/mapper/home on /home ... [ ok ]
      --- * starting early mount service ... --- [ ok ]
      * Starting udev ... [ ok ]
      * Populating /dev with existing devices through uevents ... [ ok ]
      * Waiting for uevents to be processed ... [ ok ]
      * Device initiated services: net.eth0 net.eth1 net.wlan0
      * Mounting /dev/shm ... [ ok ]

      rc sysinit logging stopped at Wed Apr 18 00:55:17 2012


      rc boot logging started at Wed Apr 18 00:55:17 2012

      * Setting system clock using the hardware clock [Local Time] ... [ ok ]
      * Loading module phc-intel ... [ ok ]
      ---
      * Autoloaded 3 module(s)
      * Checking local filesystems ...
      ---
      processing started: 4/17/2012 21:55:20
      /dev/mapper/home
      ---
      Filesystem is clean.
      ---
      /dev/mapper/linux-usr is mounted. e2fsck: Cannot continue, aborting.
      ---
      Filesystem is clean.
      * Operational error [ !! ]
      * Remounting root filesystem read/write ... [ ok ]
      * Remounting filesystems ... [ ok ]
      * Updating /etc/mtab ... [ ok ]


      There is also configuration in `/etc/conf.d/dmcrpyt':

      Code:

      target=home
      source='/dev/md0'
      key='/homekey'
      remdev='/dev/sda1'


    3. no LVM no RAID

      Code:

      # earlymounts configuration file for early mounts init script

      # comma separated list of filesystems to mount
      mounts=/usr,/usr/lib


      Code:

      $ eselect rc show sysinit
      Status of init scripts in runlevel "sysinit"
        devfs                     a
        device-mapper             a
        dmesg                     a
        earlymounts               a
        lvm                       a
        udev                      a
        udev-mount                a


      Quote:

      * Shutting down the Logical Volume Manager
      * Finished Shutting down the Logical Volume Manager
      * Setting hardware clock using the system clock [Local Time] ... [ ok ]

      rc shutdown logging stopped at Tue Apr 17 23:41:40 2012


      rc sysinit logging started at Wed Apr 18 02:42:49 2012


      OpenRC 0.9.9.3 is starting up Gentoo Linux (i686)

      Press I to enter interactive boot mode

      * /proc is already mounted, skipping
      * Mounting /run ... [ ok ]
      * /run/lock: creating directory
      * /run/lock: correcting owner
      * Mounting security filesystem ... [ ok ]
      * Mounting debug filesystem ... [ ok ]
      * Using /dev mounted from kernel ... [ ok ]
      * Setting up the Logical Volume Manager ... [ ok ]
      * starting early mount service ...
      * checking auto filesystem on /dev/mapper/selinux-usr ...
      ---
      Filesystem is clean.
      * mounting /dev/mapper/selinux-usr on /usr ... [ ok ]
      * checking auto filesystem on /dev/mapper/selinux-lib32 ...
      ---
      Filesystem is clean.
      * mounting /dev/mapper/selinux-lib32 on /usr/lib ... [ ok ]
      --- * starting early mount service ... --- [ ok ]
      * Starting udev ... [ ok ]
      * Populating /dev with existing devices through uevents ... [ ok ]
      * Waiting for uevents to be processed ... [ ok ]
      * Device initiated services: net.wlan0
      * Mounting /dev/shm ... [ ok ]

      rc sysinit logging stopped at Wed Apr 18 02:42:49 2012


      rc boot logging started at Wed Apr 18 02:42:49 2012

      * Setting system clock using the hardware clock [Local Time] ... [ ok ]
      * Loading module acpi-cpufreq ... [ ok ]
      ---
      * Loading module b43 ... [ ok ]
      * Autoloaded 2 module(s)
      * Checking local filesystems [passno =1 =2] ...
      ---
      /dev/mapper/selinux-root
      ---
      Filesystem is clean.
      ---
      /dev/mapper/selinux-usr
      ---
      Filesystem is clean
      /dev/mapper/selinux-lib32
      ---
      Filesystem is clean
      ---
      --- * Checking local filesystems [passno =1 =2] ... --- [ ok ]
      * Remounting root filesystem read/write ... [ ok ]
      * Remounting filesystems ... [ ok ]
      * Updating /etc/mtab ... [ ok ]
      * Activating swap devices ... [ ok ]




    The modules service must not be moved to sysyinit (left in boot).

    The "sysinit" runlevel is the correct one where to place device-mapper, lvm, mdraid, dmcrypt; lvm needs writable path for locking: `/run/lock' (tmpfs) is suitable. From there, the line in `depend' takes care of the rest needed before early mounts.

    Code:

        use dmcrypt mdraid lvm


    The patch causes lvm.static to be found and used before.

    The variables you had in `earlymounts` are all in order, but no LVM and no RAID workarounds are needed once the sysinit is populated with the correspondent services. The _doline is untouched, and `mount -vafn' is still what `earlymount' script is based on; the `comment=' is dropped for the `mounts' list configuration variable. But this can be reverted back: perhaps you had in mind to make the fsck service ignore "commented" lines in `/etc/fstab'.

    s.


    Last edited by gseba on Sat Jun 16, 2012 12:02 pm; edited 1 time in total
  • Back to top
    View user's profile Send private message
    greyspoke
    Apprentice
    Apprentice


    Joined: 08 Jan 2010
    Posts: 171

    PostPosted: Sun Apr 29, 2012 3:36 pm    Post subject: Reply with quote

    blimey, it will take a while to work out what has been going on here, but to catch up on a few points, sphakka and gseba you appear to know more about this than I do. I did look at including the raid and lvm scripts in sysinit runlevel, but it looked too complex for me.

    I did find a way round the rather alarming lvm messages on closing down, by introducing another init script
    Code:

    #!/sbin/runscript
    # dm-trigger-udev - Gentoo Linux runscript to trigger a udev event for
    # any devices with system names beginning with dm- eg logical volumes
    # should run after udev but before lvm

    # set defaults

    depend() {
      after udev
    }

    start () {
        ebegin "triggering logical volumes with udev"
        udevadm trigger --action=change --sysname-match=dm-*
    }

    # no exit at the end of a runscript


    This partly fools lvm into thinking that the dm devices are pukka made-by-udev ones so there are no complaints on shutting down, though I still get the more innocuous message(s) on startup about names not having been created by udev when they should have been.

    Anyhow, you guys seem to have taken this a way further.
    Back to top
    View user's profile Send private message
    steveL
    Watchman
    Watchman


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

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

    This:
    Code:
    udevadm trigger --action=change --sysname-match=dm-*

    needs quotes:
    Code:
    udevadm trigger --action=change --sysname-match='dm-*'

    to be safe. As * is a globbing character, if the script were to run in a directory with a filename starting dm- then that name (or names) would be passed. I realise it's unlikely, but it's better to be safe once in scripts.

    Also, if you're averse to moving everything to sysinit as described, you could try our patched scripts which just make udev start after localmount: it's slightly trickier to setup in that you have to patch two udev initscripts, but there's no configuration beyond setting initramfs=no in /etc/conf.d/udev (and switching udev to boot at the same time). It allows the standard sequence to run, so takes care of fsck and localmount as usual, and works if you don't need udev-created nodes to localmount (ie you have drivers for your hard-disk and motherboard, root filesystem and eg device-mapper for lvm, built-in to the kernel, not as modules, which you do when you manually configure a kernel on install.) AFAIK the same is needed for earlymounts.

    I run it with lvm, but don't have mdadm so someone trying that would be good feedback for others who use it.

    Not sure if the new sep-usr flag for busybox can deal with lvm or mdadm. I doubt it since it runs before init:
    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)
    Back to top
    View user's profile Send private message
    steveL
    Watchman
    Watchman


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

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

    [edit: delete duplicate post, sorry about that]

    Last edited by steveL on Mon Jun 11, 2012 9:15 pm; edited 1 time in total
    Back to top
    View user's profile Send private message
    greyspoke
    Apprentice
    Apprentice


    Joined: 08 Jan 2010
    Posts: 171

    PostPosted: Sat Aug 18, 2012 9:02 pm    Post subject: Reply with quote

    Well, that was all going OK until I updated my ~amd64 system (I really should update more frequently). Now with udev-187-r3.

    But that's not the problem, the problem is that the creep of basic system stuff to /usr has started. My LVM2, built with the udev use flag, needs libudev.so.1, which lives on... /usr/lib64. So I went back to activating and mounting my logical volumes in an initramfs for a bit, then tried putting libudev.so.1.0.3 and the symlinks to it in /usr/lib64 on my root partition and going back to earlyonunts. It worked, except...

    The only modules I have set to load via the modules init script are the ones for VirtualBox, my kernel is mainly monolithic except for the wifi ones, and they are loaded automatically by udev. There is an error message with the vboxdrv etc modules saying modprobe command not found. As part of the upgrade modprobe is now a symlink to /usr/sbin/kmod. I guess the modules script (in boot runlevel) starts sufficiently soon after earlymounts (in sysinit) for the mounts not actually to be available. Surprising, since the udev script (in sysinit) doesn't complain. If I had a very modular kernel this would be a considerable PITA.

    When the world and its dog have moved to /usr, this could get messy...
    Back to top
    View user's profile Send private message
    Display posts from previous:   
    Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
    Goto page Previous  1, 2
    Page 2 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