View previous topic :: View next topic |
Author |
Message |
greyspoke Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 08 Jan 2010 Posts: 171
|
Posted: Fri Mar 30, 2012 5:20 pm Post subject: init script to mount /usr and friends before udev |
|
|
OK peeps, as mentioned on the What do you think about Fedora/FreeDesktop.org UsrMove Plan? gentoo chat thread, here is my initscript which may provide an alternative way to be friendly with udev (alternative to mounting /usr in an initramfs). This is improved thanks to comments from sphakka and steveL on that thread. I have since then:
- tried to make it POSIX compliant
- found a way of using a fake mount command to identify the devices from fstab that need checking and mounting, thus avoiding fancy stuff with sed or awk
- not found a way to avoid checking the devices at this stage and relying on the fsck init script to do it later. fsck will not check mounted devices even if mounted ro and I am getting conflicting messages from the internets about whether checking ro devices is safe.
You may say why not run mount all and fsck all commands with appropriate option restrictions. That would work for mounting but not for fsck - ing as the devices will be set with the sixth bit on the line to 0 (don't check).
I can't fathom what is going on in the fsck init script, so I haven't tried to copy what it tries to do, though it appears to do some clever stuff that might be useful here.
Comments etc welcome.
modify /etc/fstab thus - add the comment=early option and put 0 in "pass" so it doesn't try to checkt an already mounted filesystem. I have a separate /usr and /var, so probably will need to early mount them both.
Code: | [device] /usr ext3 noatime,comment=early 1 0
[device] /var ext3 noatime,comment=early 1 0
|
some configuration in /etc/conf.d/earlymounts - not needed if you don't use raids or lvms and want to check, this has my settings:
Code: | # earlymounts configuration file for early mounts init script
# set to true if raids need assembling, default is false
#mdadm=true
# set to true if logical volumes need activating, default is false, no
# lvm will be done if false
lvm2=true
# comma separated list of names of volume groups to activate, if not set
# then all volume groups will be activated if lvm2 is set to true
#vgs=vg
# comma separated list of lvm2 paths of volumes to activate
# if set and lvm2 is set to true the specified volumes will be activated
# as well as all volumes in any groups specified by vgs
lvs=vg/usr,vg/var
# whether to fsck the mounts or not, default is true
#check=false
|
And the script /etc/init/d/earlymounts
Code: | #!/sbin/runscript
# earlymounts - Gentoo Linux runscript to mount partitions early on in
# the init process. Relies on the mounts being in /etc/fstab and will
# try to run fsck and then mount only those fstab entries that have the
# mount option comment=early set (no quotes around early)
# set defaults
depend() {
before udev
}
doline () {
if $check; then
ebegin "checking $5 filesystem on $1"
fsck -C "$1"
local err=$?
if [ $err = 4 ]; then
eerror "errors on filesystem on $1 couldn't be corrected, will not mount"
return 1
elif [ $err -gt 4 ]; then
ewarn "fsck couldn't check filesystem on $1"
elif [ $err -gt 0 ]; then
ewarn "errors found on filelsystem on $1 and corrected"
fi
fi
ebegin "mounting $1 on $3"
mount "$1"
err=$?
eend $err "couldn't mount filesystem $1"
return $err
}
start () {
ebegin "starting early mount service"
# build the raid arrays
if ${mdadm:=false}; then
if [ -f /etc/mdadm.conf ]; then
mdadm --assemble --scan
else
mdadm --assemble
fi
fi
# now need to assemble the logical volumes
if ${lvm2:=false}; then
if ! [ -z $vgs ]; then
IFS=","
for vg in $vgs; do
unset IFS
vgchange -aly --sysinit $vg
IFS=","
done
unset IFS
fi
if ! [ -z $lvs ]; then
IFS=","
for lv in $lvs; do
unset IFS
lvchange -aly --sysinit $lv
IFS=","
done
unset IFS
fi
if [ -z $vgs ] && [ -z $lvs ]; then
vgchange -aly --sysinit
fi
fi
#default check is true
case $check in
"true" | "false") ;;
*) check=true;;
esac
# verbose mount fake all prints lines just for devices with the
# specified option in /etc/fstab, with the devicename as the first word
mntlines=$(mount -v -f -a -O comment=early)
local err=0, retval=0
IFS=$'\n'
eindent
for line in $mntlines; do
unset IFS
doline $line
retval=$?
err=$(($err + $retval))
IFS=$'\n'
done
eoutdent
eend $err "some filesystems not mounted or not checked"
# check it worked before it scrolls by
#read -p "press any key to continue"
unset IFS
}
# no exit at the end of a runscript
|
Then you need to put this in the sysinit runlevel
Code: | rc-update add earlymounts sysinit |
This works for me, can't promise it will work for you and I wouldn't suggest using it unless you can check it for yourself. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
ExecutorElassus Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/15750694344835dc870e988.jpg)
Joined: 11 Mar 2004 Posts: 1435 Location: Berlin, Germany
|
Posted: Sat Mar 31, 2012 10:56 pm Post subject: |
|
|
ohgod, am I going to be a beta tester for this? What's the best route to test this? Right now, I have >=udev-181 hardmasked; should I install these scripts, update rc, and reboot (to see if it works) and then unmask udev? Do I need to do both at the same time? If this script does not work, is there a way to recover?
Thanks for your work on this. I'll, uh, report my findings? (Assuming my computer doesn't puke)
Cheers,
EE
UPDATE: okay, so it boots? Yay? I got a bunch of errors about fsck being unable to read/check the partitions; I'm assuming that's normal, yes? Should I unmask udev?
(I'm a bit of a wuss) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
greyspoke Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 08 Jan 2010 Posts: 171
|
Posted: Sun Apr 01, 2012 8:06 am Post subject: |
|
|
Well I didn't say you had to do it EE...
I am running udev-164-r2 (I think it is time to update my system) so I can't comment. (I did this to avoid some error messages from stuff that udev tried to start which needed /usr.) I get the idea that this new udev refuses to play at all unless /usr is present. So this ought to keep it happy.
If you are getting fsck complaining about checking partitions, did you set the last thing on the lines in fstab to "0" - which tells fsck not to try to check them? This script checks the partitions you want mounted early (unless you have set check to false in the config file). |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
ExecutorElassus Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/15750694344835dc870e988.jpg)
Joined: 11 Mar 2004 Posts: 1435 Location: Berlin, Germany
|
Posted: Sun Apr 01, 2012 6:24 pm Post subject: |
|
|
Well, lemme try another tack (and this is a dumb question. Sorry!).
Is there a way to read a log of all the startup messages? The ones that come after rc is loaded, that are in the format "Checking [X]...................................[OK]" Because that's where I got all the errors: after rc had loaded, when fsck is usually run on all the lvm partitions.
Not checking the filesystems isn't such a terrible thing to me, but I would like to have it (if that's even what went wrong; it scrolled by too fast to read).
Thanks,
EE |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
gorkypl Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 04 Oct 2010 Posts: 444 Location: Kraków, PL
|
Posted: Sun Apr 01, 2012 6:41 pm Post subject: |
|
|
ExecutorElassus wrote: | Well, lemme try another tack (and this is a dumb question. Sorry!).
Is there a way to read a log of all the startup messages? The ones that come after rc is loaded, that are in the format "Checking [X]...................................[OK]" Because that's where I got all the errors: after rc had loaded, when fsck is usually run on all the lvm partitions.
Not checking the filesystems isn't such a terrible thing to me, but I would like to have it (if that's even what went wrong; it scrolled by too fast to read).
|
Enable rc_logger in /etc/rc.conf and check /var/log/rc.log _________________ BTW, TWM FTW! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
greyspoke Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 08 Jan 2010 Posts: 171
|
Posted: Sun Apr 01, 2012 6:52 pm Post subject: |
|
|
Or hit "L" key when rc starts and you will be able to walk through the boot process - here's the bit from etc/rc.conf:
Code: |
# Set rc_interactive to "YES" and you'll be able to press the I key during
# boot so you can choose to start specific services. Set to "NO" to disable
# this feature.
rc_interactive="YES"
|
you checked your fstab and it is still happening I assume. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Hu Moderator
![Moderator Moderator](/images/ranks/rank-mod.gif)
Joined: 06 Mar 2007 Posts: 21619
|
Posted: Sun Apr 01, 2012 8:44 pm Post subject: |
|
|
greyspoke wrote: | Or hit "L" key when rc starts and you will be able to walk through the boot process - here's the bit from etc/rc.conf:
Code: | # Set rc_interactive to "YES" and you'll be able to press the I key during
|
| Your post says L (as in Lima), but the text you quoted shows I (as in India). |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
greyspoke Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 08 Jan 2010 Posts: 171
|
Posted: Mon Apr 02, 2012 7:13 am Post subject: |
|
|
Doh my brane... yes of course it is the "I" key, thanks. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
derk Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 10 Mar 2003 Posts: 347 Location: St Thomas Ontario
|
Posted: Tue Apr 03, 2012 3:09 pm Post subject: |
|
|
could this approach be added to the gentoo wiki i.e. http://wiki.gentoo.org ? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
ExecutorElassus Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/15750694344835dc870e988.jpg)
Joined: 11 Mar 2004 Posts: 1435 Location: Berlin, Germany
|
Posted: Tue Apr 03, 2012 3:29 pm Post subject: |
|
|
thanks for the logging tip. But now I've checked rc.log, and it shows nothing. But watching, it looks like fsck is trying to run on the earlymounted drives, and failing (maybe because they're already mounted?). The drives all mount okay, it's just the timing of fsck seems to be wrong (and yes, the check flag is set to 0 in fstab). Unfortunately, rc.log doesn't start logging until later on in the startup process, so I can't see what's really going on. I'll try again in interactive mode, and see what the exact errors are.
Cheers,
EE
UPDATE: hrm. It went by too fast for me to hit the I key. But the errors I'm getting are what I thought: rc is failing to mount and check the earlymounted drives. Should I care about this? They're obviously mounted, so maybe this is just a needless second mount attempt that I can safely ignore? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
greyspoke Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 08 Jan 2010 Posts: 171
|
Posted: Tue Apr 03, 2012 6:49 pm Post subject: |
|
|
Well I can't see why your system should behave differently EE, I am assuming your fsck script does the same thing as mine does - which should mean it won't try to check filesystems with the last word in fstab set to 0. But also, it seems averse to checking mounted filesystems even if it thinks it should (which is a clearly a good thing), which would explain the errors.
Not sure how reliable things have to be to wiki them. How many folk does this actually work for? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
ExecutorElassus Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/15750694344835dc870e988.jpg)
Joined: 11 Mar 2004 Posts: 1435 Location: Berlin, Germany
|
Posted: Tue Apr 03, 2012 8:55 pm Post subject: |
|
|
Does "work" imply that I can boot newer udev without the system puking? I'll give it a shot and let you know, once I no longer have stuff to do that can't be put on hold for a few days while I rescue a broken system if it doesn't work. After Easter?
Cheers,
EE |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
sphakka Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/gallery/Futurama/cartoon_futurama_bender.gif)
Joined: 24 Jun 2003 Posts: 79
|
Posted: Thu Apr 05, 2012 9:07 am Post subject: |
|
|
Hi there,
As promised, my contribution -- patches and comments.
- /etc/init.d/earlymounts (patch: '# cd /etc/init.d/ && patch < /path/to/patch-file')
Code: |
--- earlymounts 2012-04-04 20:01:18.000000000 +0200
+++ earlymounts.new 2012-04-04 19:53:57.000000000 +0200
@@ -1,19 +1,40 @@
#!/sbin/runscript
# earlymounts - Gentoo Linux runscript to mount partitions early on in
# the init process. Relies on the mounts being in /etc/fstab and will
-# try to run fsck and then mount only those fstab entries that have the
-# mount option comment=early set (no quotes around early)
+# try to run fsck and then mount only those fstab entries that have
+# the mount option comment=early set (no quotes around early)
# set defaults
+description="Early mount [and check] some filesystems to make udev happy ;-)"
+
+check=${check:=true}
+fsck_opts=${fsck_opts:='-C0 -T -a'}
+lvm2=${lvm2:=false}
+mdadm=${mdadm:=false}
+mount_opts=${mount_opts:=}
+pretend=${pretend:=false}
+
+# aux variables
+_IFS=','
+
+if yesno $pretend; then
+ alias runcmd='echo [fake]'
+else
+ # just a no-op
+ alias runcmd=':;'
+fi
+
+
depend() {
- before udev
+ before udev
}
-doline () {
- if $check; then
+_doline () {
+ # default check value taken into account here
+ if yesno $check; then
ebegin "checking $5 filesystem on $1"
- fsck -C "$1"
+ runcmd fsck $fsck_opts "$1"
local err=$?
if [ $err = 4 ]; then
eerror "errors on filesystem on $1 couldn't be corrected, will not mount"
@@ -25,7 +46,7 @@
fi
fi
ebegin "mounting $1 on $3"
- mount "$1"
+ runcmd mount $mount_opts "$1"
err=$?
eend $err "couldn't mount filesystem $1"
return $err
@@ -34,7 +55,7 @@
start () {
ebegin "starting early mount service"
# build the raid arrays
- if ${mdadm:=false}; then
+ if yesno $mdadm; then
if [ -f /etc/mdadm.conf ]; then
mdadm --assemble --scan
else
@@ -43,22 +64,22 @@
fi
# now need to assemble the logical volumes
- if ${lvm2:=false}; then
+ if yesno $lvm2; then
if ! [ -z $vgs ]; then
- IFS=","
+ local IFS="$_IFS"
for vg in $vgs; do
unset IFS
vgchange -aly --sysinit $vg
- IFS=","
+ IFS="$_IFS"
done
unset IFS
fi
if ! [ -z $lvs ]; then
- IFS=","
+ IFS="$_IFS"
for lv in $lvs; do
unset IFS
lvchange -aly --sysinit $lv
- IFS=","
+ IFS="$_IFS"
done
unset IFS
fi
@@ -67,29 +88,28 @@
fi
fi
- #default check is true
- case $check in
- "true" | "false") ;;
- *) check=true;;
- esac
-
# verbose mount fake all prints lines just for devices with the
# specified option in /etc/fstab, with the devicename as the first word
- mntlines=$(mount -v -f -a -O comment=early)
- local err=0, retval=0
+ # (also don't write in /etc/mtab to avoid hassles)
+ mntlines=$(mount -vfan -O comment=early)
+ local err=0 retval=0
IFS=$'\n'
eindent
for line in $mntlines; do
+ # need to filter out unexepcted output
+ echo $line| egrep -i 'already[[:blank:]]+mounted' >/dev/null && {
+ ewarn "$line: skipping..."
+ continue;
+ }
+ # only well-formatted lines should go through
unset IFS
- doline $line
+ _doline $line
retval=$?
err=$(($err + $retval))
- IFS=$'\n'
+ local IFS=$'\n'
done
eoutdent
eend $err "some filesystems not mounted or not checked"
- # check it worked before it scrolls by
- #read -p "press any key to continue"
unset IFS
}
|
Comments:
- added description and option declarations with default values at beginning. New options are:
- fsck_opts: mainly because I want minimal checks via the switch '-a'
- mount_opts: as I need '-r' (read-only) to avoid hassles with following fsck in boot runlevel
- pretend: to show fsck and mount commands without executing them. This is done by creating an alias which is prefixed to the relevant commands
- renamed 'doline()' to '_doline()' as it is an internal function, not a script command
- in '_doline()', branching on option 'check' moved here (default treated outside)
- in 'start()':
- branching on options unfied via 'yesno()'
- relevant variable localized to avoid ENV hassles
- default for 'check' removed
- fake mount with '-n' to not writing mtab (avoid hassles with double entries)
- added a filter for already mounted partition -- just cosmetic: it warns beforehand instead of letting _doline() scream; useful when debugging at system already up (I used dummy mount lines in my fstab...).
- watch out for commas in statements like
Code: | local err=0, retval=0 | as you end up having 'err := 0,' which breaks 'eend'!
/etc/conf.d/earlymounts (new options only)
Code: |
# pretend executing mounts and checks; for debugging only. Default is false.
# pretend=true
# mount options. Default is empty. Use '-r' for read-only mounts (avoid hassles
# with fsck service running afterwards).
mount_opts='-r'
# fsck options. Default is '-C0 -T -a', i.e. output on STDOUT, be quiet and do
# automatic/lightweight checks
#fsck_opts='-C0 -T -a'
|
Comments: quite obvious.
It works for me with
- udev-171-r5, openrc-0.9.9.3 (though I'm downgrading it now for stability)
- /usr and /var on LVM, no raid
- read-only mounts and light fsck
The only harmless glitch, as seen already with the previous version, is LVM complaining later on about missing udev symlinks.
Other tips:
- OpenRC logging: set 'rc_log_path="/rc.log"' to also have sysinit logging (else won't work on /var as it is not mounted yet)
- I don't know why but '# rc-update add earlymounts sysinit' silently fails somewhere (with openrc-0.9.9.3): the dependency tree was not updated and earlymounts would run in default runlevel. However, forcing deps update with '# rc-update -u' fixed the problem
- possibly another udev side effect: my keyboard doesn't get up fast enough at sysinit (it lags behind for 10-20 seconds), so I can't enter interactive boot
An ugly workaround is temporarily adding a 'sleep 20' statements at end in '/etc/init.d/earlymounts' -- a better explanation/solution would be much appreciated!
Last but not least, I'd be keen on writing an ebuild for this... if I find some more spare time
Enjoy!
^s |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
DaggyStyle Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/182793287489b53393316c.gif)
Joined: 22 Mar 2006 Posts: 5909
|
Posted: Thu Apr 05, 2012 12:00 pm Post subject: |
|
|
sphakka, the issue is with udev-182 and above, I fail to see how this is relevant if you didn't tested it on at least that version. _________________ Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
sphakka Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/gallery/Futurama/cartoon_futurama_bender.gif)
Joined: 24 Jun 2003 Posts: 79
|
Posted: Thu Apr 05, 2012 2:04 pm Post subject: |
|
|
Hi,
DaggyStyle wrote: | sphakka, the issue is with udev-182 and above, I fail to see how this is relevant if you didn't tested it on at least that version. |
One thing at a time, please.
1) fist step, verified that the script solves current issues with <udev-182 (alsactl and bluetooth);
2) next step, try with >=udev-182. But I'm waiting to see how this bug evolves, as I'm affected.
Cheers,
--^s |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
DaggyStyle Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/182793287489b53393316c.gif)
Joined: 22 Mar 2006 Posts: 5909
|
Posted: Thu Apr 05, 2012 2:24 pm Post subject: |
|
|
sphakka wrote: | Hi,
DaggyStyle wrote: | sphakka, the issue is with udev-182 and above, I fail to see how this is relevant if you didn't tested it on at least that version. |
One thing at a time, please.
1) fist step, verified that the script solves current issues with <udev-182 (alsactl and bluetooth);
2) next step, try with >=udev-182. But I'm waiting to see how this bug evolves, as I'm affected.
Cheers,
--^s |
thats make sense, I was under the impression that you've concluded the testing. _________________ Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
sphakka Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/gallery/Futurama/cartoon_futurama_bender.gif)
Joined: 24 Jun 2003 Posts: 79
|
Posted: Fri Apr 06, 2012 8:00 pm Post subject: Warning! earlymounts breaks openrc-0.9.8.4 |
|
|
Update.
Further testing with openrc-0.9.8.4 (as of today, stable in portage), earlymounts with read-only mounts breaks default runlevel, notably dbus and dependent services:
Code: |
* Starting D-BUS system messagebus ...
Failed to start message bus: Failed to bind socket "/var/run/dbus/system_bus_socket": Read-only file system
|
Since consolekit is also affected, my box *won't* boot correctly. I didn't try to early mount RW as I already know that it'll break openrc-0.9.9.3. So for the time being, I re-emerged the latest openrc (which so far behaved pretty well) and re-set earlymounts RO.
p.s. bug 408919 was fixed today, so I'll be soon testing udev-182! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
The Sk n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/gallery/Zelda/Zelda_-_Darunia.jpg)
Joined: 02 Feb 2008 Posts: 35 Location: Brownsville
|
Posted: Sat Apr 07, 2012 7:14 am Post subject: |
|
|
Thanks for the script. I will be trying it tomorrow.
I'm affected by the same problem, having /usr on a seperate partition and had to create an initramfs =s with dracut.
I currently have udev 171, and heard that with 181 booting without an initramfs is deprecated. Is this true? If so I guess I'll stick with an initramfs and +5 seconds on my boot time =( |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Hu Moderator
![Moderator Moderator](/images/ranks/rank-mod.gif)
Joined: 06 Mar 2007 Posts: 21619
|
Posted: Sat Apr 07, 2012 4:58 pm Post subject: |
|
|
The Sk wrote: | I currently have udev 171, and heard that with 181 booting without an initramfs is deprecated. Is this true? If so I guess I'll stick with an initramfs and +5 seconds on my boot time =( | As I understand it, using >=sys-fs/udev-181 with separate /usr and no initramfs is unsupported and highly likely to fail in very frustrating ways. Older versions have already not handled separate /usr particularly well, and support has degraded over time. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
sphakka Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/gallery/Futurama/cartoon_futurama_bender.gif)
Joined: 24 Jun 2003 Posts: 79
|
Posted: Sat Apr 07, 2012 5:05 pm Post subject: |
|
|
The Sk wrote: | Thanks for the script. I will be trying it tomorrow.
I'm affected by the same problem, having /usr on a seperate partition and had to create an initramfs =s with dracut.
I currently have udev 171, and heard that with 181 booting without an initramfs is deprecated. Is this true? If so I guess I'll stick with an initramfs and +5 seconds on my boot time =( |
IMHO, having an initramfs is just an (overkill) option. Earlymounts will hopefully spare you the extra overhead of maintaining an initramfs, though, as for boot time overhead, you might have the same penalty depending on how many partitions you'll mount and check.
I'd appreciate if you could test the script posted by greyspoke plus my patch -- please, mind the warnings above about different openrc versions and RW vs RO mounts.
Cheers,
--^s |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
The Sk n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/gallery/Zelda/Zelda_-_Darunia.jpg)
Joined: 02 Feb 2008 Posts: 35 Location: Brownsville
|
Posted: Sun Apr 08, 2012 6:33 am Post subject: |
|
|
I just found out that ctrl+s stops the boot up and enter starts it up.
The original script works. I noticed it hangs a bit after "loading uevents" but is still faster than initramfs. Thanks =)
The patch doesn't run and outputs: Code: | ./earlymounts: line 21: yesno: command not found
./earlymounts: line 55: syntax error near unexpected token `fi'
./earlymounts: line 55: ` fi' |
It seems it might be a problem on my end. I checked the code and can't tell why it's saying there's an error near "fi". I tried tabbing it and spacing it but it still fails. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
sphakka Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/gallery/Futurama/cartoon_futurama_bender.gif)
Joined: 24 Jun 2003 Posts: 79
|
Posted: Sun Apr 08, 2012 8:58 am Post subject: |
|
|
Thanks, The Sk!
The Sk wrote: |
I just found out that ctrl+s stops the boot up and enter starts it up.
|
Interesting, I didn' know...
Quote: |
The patch doesn't run and outputs: Code: | ./earlymounts: line 21: yesno: command not found
./earlymounts: line 55: syntax error near unexpected token `fi'
./earlymounts: line 55: ` fi' |
|
Possibly it wasn't clear from my previous posts, but you need at least openrc-0.9.8.4 (recommended version is 0.9.9.3, in order to use RO mounts) -- 'yesno' is a runscript's facility, you can check with $ man runscript if it's available in your setup. Those other syntax errors are possibly a consequence of the script breaking beforehand at yesno -- the shell is tricky, you know BTW, you can debug it by running
Code: | # /etc/init.d/earlymounts -d <action> |
Let me know! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
gseba n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 02 Aug 2003 Posts: 59 Location: Romania
|
Posted: Sun Apr 08, 2012 6:48 pm Post subject: |
|
|
Thanks for this quick post. But here is my `/etc/fstab':
Code: |
/dev/mapper/linux-usr /usr auto noatime,comment=udev 0 1
/dev/mapper/linux-lib64 /usr/lib64 auto noatime,comment=udev 0 2
|
and `/etc/conf.d/earlymounts':
Code: |
vgs=linux
lvs=linux/usr,linux/lib64
|
It looks a step further, so I patched it below (I rather use `udev' as "comment"; well, not important...)
Code: |
--- earlymounts 2012-04-08 21:28:50.254407881 +0300
+++ earlymounts.static 2012-04-08 21:28:50.254407881 +0300
@@ -69,7 +69,7 @@
local IFS="$_IFS"
for vg in $vgs; do
unset IFS
- vgchange -aly --sysinit $vg
+ lvm.static vgchange -aly --sysinit $vg
IFS="$_IFS"
done
unset IFS
@@ -78,13 +78,13 @@
IFS="$_IFS"
for lv in $lvs; do
unset IFS
- lvchange -aly --sysinit $lv
+ lvm.static lvchange -aly --sysinit $lv
IFS="$_IFS"
done
unset IFS
fi
if [ -z $vgs ] && [ -z $lvs ]; then
- vgchange -aly --sysinit
+ lvm.static vgchange -aly --sysinit
fi
fi
|
I wont go to far to suggest a USE flag "early" perhaps for `sys-fs/udev' to install your script? Except for this problem from `/var/log/rc.log':
Quote: |
/dev/mapper/linux-usr is mounted. e2fsck: Cannot continue, aborting.
|
s. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
sphakka Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/gallery/Futurama/cartoon_futurama_bender.gif)
Joined: 24 Jun 2003 Posts: 79
|
Posted: Mon Apr 09, 2012 9:44 am Post subject: |
|
|
Hi gseba,
Thanks for testing.
I'm not an LVM expert, but as far as I can see your patch prepends all lvm calls with lvm.static: I guess that's needed because your '/lib64' is on LVM, right?
As for USE flags, ebuilds & Co., I wouldn't start working on that until we can confirm that earlymounts works with udev-182. BTW, which version of udev are you using?
Also, is that error you see about e2fsck really blocking the boot process? I don't use ext* file systems, but on top of my head it looks like a RW mount problem: if so, please try RO mounts, by setting in '/etc/conf.d/earlymounts'.
Lastly, on my box, I still see at shutdown weird warnings concerning my '/tmp' partition:
Code: |
* Unmounting filesystems
* Unmounting /tmp ...
* in use but fuser finds nothing [ !! ]
* Shutting down the Logical Volume Manager
* Shutting Down logical volumes ...
LV flexzoHD2/tmp in use: not deactivating [ !! ]
* Shutting Down volume groups ...
Can't deactivate volume group "flexzoHD2" with 1 open logical volume(s) [ !! ]
|
Is anybody seeing the same message? Someone elsewhere suggests adding the failing mounts to 'RC_NO_UMOUNTS' ENV var, though I'd like to have an explanation for that...
Cheers,
^s |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
gseba n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 02 Aug 2003 Posts: 59 Location: Romania
|
Posted: Mon Apr 09, 2012 11:43 am Post subject: |
|
|
None other than those concerned: sys-fs/udev-182-r3, sys-apps/openrc-0.9.9.3.
It's the `/usr/lib64' mount, it's "libudev.so.0" that is not found because:
Quote: |
gseba@localhost ~ $ ldd /sbin/vgchange
linux-vdso.so.1 => (0x00007fff97572000)
libudev.so.0 => /usr/lib64/libudev.so.0 (0x00007f57ae475000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f57ae271000)
libdevmapper-event.so.1.02 => /lib64/libdevmapper-event.so.1.02 (0x00007f57ae06b000)
libdevmapper.so.1.02 => /lib64/libdevmapper.so.1.02 (0x00007f57ade32000)
libreadline.so.6 => /lib64/libreadline.so.6 (0x00007f57adbeb000)
libc.so.6 => /lib64/libc.so.6 (0x00007f57ad85d000)
librt.so.1 => /lib64/librt.so.1 (0x00007f57ad654000)
/lib64/ld-linux-x86-64.so.2 (0x00007f57ae683000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f57ad433000)
libncurses.so.5 => /lib64/libncurses.so.5 (0x00007f57ad1de000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f57acfc1000)
gseba@localhost ~ $ ls -l /sbin/vg*
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgcfgbackup -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgcfgrestore -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgchange -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgck -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgconvert -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgcreate -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgdisplay -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgexport -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgextend -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgimport -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgmerge -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgmknodes -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgreduce -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgremove -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgrename -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgs -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgscan -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/vgsplit -> lvm
gseba@localhost ~ $ ls -l /sbin/lv*
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/lvchange -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/lvconvert -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/lvcreate -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/lvdisplay -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/lvextend -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/lvmchange -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/lvmdiskscan -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/lvmsadc -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/lvmsar -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/lvreduce -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/lvremove -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/lvrename -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/lvresize -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/lvs -> lvm
lrwxrwxrwx 1 root root 3 7 apr 21:41 /sbin/lvscan -> lvm
|
all symlink'd against `/sbin/lvm' binary which is dynamic; try `lvm.static help' for the commands accepted.
The "mount_opts='-r'" is there; but, as you said, for now the log is harmless.
thank s. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
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
|
|