[megoldva] Shevaplug usb mount induláskor nem megy

Fórumok

Adott egy Shevaplug, rajta Debian Squeeze (arm). Korábban az Ubuntu 9.0(arm) volt fenn rajta és az alábbi kis script működött is:

#!/bin/sh
#
case "$1" in
start|"")
grep -q ^/dev/sda /etc/fstab &&
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
[ -b /dev/sda ] && exit 0
sleep 1
done
exit 1
;;
stop)
;;
esac

Erre azért van szükség, mert a gép gyorsabban elindul, mint ahogy az USB init kész lenne.
Nem titok, http://plugcomputer.org/plugforum/index.php?topic=485.msg2858#msg2858 ez a forrás. Gondoltam Debian alatt is megy, de nem nyert. Kiegészítettem, ahogyan a linkelt fórumban megtalálható ezzel:

### BEGIN INIT INFO
# Provides: wait4usbdisks
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-stop:
# Default-Start: S
# Default-Stop:
# X-Interactive: true
# Short-Description: Delays boot to ensure USB disks are connected.
### END INIT INFO

de nem megy. Úgy tűnik, mintha el sem indulna. a checkfs.sh elé raktam be. A script kézzel futtatva természetesen lefut.

Hozzászólások

módosítottam a fejlécet

### BEGIN INIT INFO
# Provides: wait4usbdisks
# Required-Start: module-init-tools
# Required-Stop: module-init-tools
# Should-Start:
# Should-stop:
# Default-Start: S
# Default-Stop:
# X-Start-Before: checkfs mountall
# X-Interactive: true
# Short-Description: Delays boot to ensure USB disks are connected.
### END INIT INFO

és a mountall-nál is módosítottam, hogy csak akkor fusson, ha a wait4usbdisks már véget ért..
szintén semmi..:(

Udv,

nezz utana a "rootdelay" es a "rootwait" kernel parametereknek.

Valamint ha mar itt tartunk a "seq" parancsnak, vagy a "for i in {1..100}" kifejezesnek.

Szerk:
lemaradt a lenyeg: valoszinuleg a scripteddel, az a gond, hogy bar ott van az /etc/init.d-ben, nem hivodik meg soha. Kellene egy symlinket krealni hozza a /etc/rcS.d/-ben, bovebben lasd itt:
http://wiki.debian.org/BootProcess
Ubuntu alatt vagy azert mukodott, mert ott van ra symlink, vagy mert ott upstart van, lasd itt: http://upstart.ubuntu.com/getting-started.html es a linkelt script tkp. egy upstart script.

Sok sikert!

ugyan nem volt tree, de az ugye nem gond, felraktam.
a kimenet:

/etc/init.d
|-- README
|-- apache2
|-- bootlogd
|-- bootlogs
|-- bootmisc.sh
|-- checkfs.sh
|-- checkroot.sh
|-- cron
|-- cryptdisks
|-- cryptdisks-early
|-- halt
|-- hostname.sh
|-- hwclock.sh
|-- hwclockfirst.sh
|-- ifupdown
|-- ifupdown-clean
|-- killprocs
|-- lighttpd
|-- module-init-tools
|-- mountall-bootclean.sh
|-- mountall.sh
|-- mountdevsubfs.sh
|-- mountkernfs.sh
|-- mountnfs-bootclean.sh
|-- mountnfs.sh
|-- mountoverflowtmp
|-- mtab.sh
|-- networking
|-- procps
|-- rc
|-- rc.local
|-- rcS
|-- reboot
|-- rmnologin
|-- rsyslog
|-- sendsigs
|-- single
|-- skeleton
|-- ssh
|-- stop-bootlogd
|-- stop-bootlogd-single
|-- udev
|-- udev-mtab
|-- umountfs
|-- umountnfs.sh
|-- umountroot
|-- urandom
|-- wait4usbdisks
`-- x11-common
/etc/rc.local [error opening dir]
/etc/rc0.d
|-- K01apache2 -> ../init.d/apache2
|-- K01lighttpd -> ../init.d/lighttpd
|-- K01urandom -> ../init.d/urandom
|-- K02sendsigs -> ../init.d/sendsigs
|-- K03rsyslog -> ../init.d/rsyslog
|-- K04hwclock.sh -> ../init.d/hwclock.sh
|-- K04umountnfs.sh -> ../init.d/umountnfs.sh
|-- K05networking -> ../init.d/networking
|-- K06ifupdown -> ../init.d/ifupdown
|-- K07umountfs -> ../init.d/umountfs
|-- K08cryptdisks -> ../init.d/cryptdisks
|-- K09cryptdisks-early -> ../init.d/cryptdisks-early
|-- K10umountroot -> ../init.d/umountroot
|-- K11halt -> ../init.d/halt
`-- README
/etc/rc1.d
|-- K01apache2 -> ../init.d/apache2
|-- K01cron -> ../init.d/cron
|-- K01lighttpd -> ../init.d/lighttpd
|-- K03rsyslog -> ../init.d/rsyslog
|-- README
|-- S01bootlogs -> ../init.d/bootlogs
|-- S01killprocs -> ../init.d/killprocs
`-- S02single -> ../init.d/single
/etc/rc2.d
|-- README
|-- S01bootlogs -> ../init.d/bootlogs
|-- S01rsyslog -> ../init.d/rsyslog
|-- S02apache2 -> ../init.d/apache2
|-- S03cron -> ../init.d/cron
|-- S03lighttpd -> ../init.d/lighttpd
|-- S03ssh -> ../init.d/ssh
|-- S04rc.local -> ../init.d/rc.local
|-- S04rmnologin -> ../init.d/rmnologin
`-- S04stop-bootlogd -> ../init.d/stop-bootlogd
/etc/rc3.d
|-- README
|-- S01bootlogs -> ../init.d/bootlogs
|-- S01rsyslog -> ../init.d/rsyslog
|-- S02apache2 -> ../init.d/apache2
|-- S03cron -> ../init.d/cron
|-- S03lighttpd -> ../init.d/lighttpd
|-- S03ssh -> ../init.d/ssh
|-- S04rc.local -> ../init.d/rc.local
|-- S04rmnologin -> ../init.d/rmnologin
`-- S04stop-bootlogd -> ../init.d/stop-bootlogd
/etc/rc4.d
|-- README
|-- S01bootlogs -> ../init.d/bootlogs
|-- S01rsyslog -> ../init.d/rsyslog
|-- S02apache2 -> ../init.d/apache2
|-- S03cron -> ../init.d/cron
|-- S03lighttpd -> ../init.d/lighttpd
|-- S03ssh -> ../init.d/ssh
|-- S04rc.local -> ../init.d/rc.local
|-- S04rmnologin -> ../init.d/rmnologin
`-- S04stop-bootlogd -> ../init.d/stop-bootlogd
/etc/rc5.d
|-- README
|-- S01bootlogs -> ../init.d/bootlogs
|-- S01rsyslog -> ../init.d/rsyslog
|-- S02apache2 -> ../init.d/apache2
|-- S03cron -> ../init.d/cron
|-- S03lighttpd -> ../init.d/lighttpd
|-- S03ssh -> ../init.d/ssh
|-- S04rc.local -> ../init.d/rc.local
|-- S04rmnologin -> ../init.d/rmnologin
`-- S04stop-bootlogd -> ../init.d/stop-bootlogd
/etc/rc6.d
|-- K01apache2 -> ../init.d/apache2
|-- K01lighttpd -> ../init.d/lighttpd
|-- K01urandom -> ../init.d/urandom
|-- K02sendsigs -> ../init.d/sendsigs
|-- K03rsyslog -> ../init.d/rsyslog
|-- K04hwclock.sh -> ../init.d/hwclock.sh
|-- K04umountnfs.sh -> ../init.d/umountnfs.sh
|-- K05networking -> ../init.d/networking
|-- K06ifupdown -> ../init.d/ifupdown
|-- K07umountfs -> ../init.d/umountfs
|-- K08cryptdisks -> ../init.d/cryptdisks
|-- K09cryptdisks-early -> ../init.d/cryptdisks-early
|-- K10umountroot -> ../init.d/umountroot
|-- K11reboot -> ../init.d/reboot
`-- README
/etc/rcS.d
|-- README
|-- S01mountkernfs.sh -> ../init.d/mountkernfs.sh
|-- S02udev -> ../init.d/udev
|-- S03mountdevsubfs.sh -> ../init.d/mountdevsubfs.sh
|-- S04bootlogd -> ../init.d/bootlogd
|-- S05hostname.sh -> ../init.d/hostname.sh
|-- S05hwclockfirst.sh -> ../init.d/hwclockfirst.sh
|-- S06checkroot.sh -> ../init.d/checkroot.sh
|-- S07cryptdisks-early -> ../init.d/cryptdisks-early
|-- S08cryptdisks -> ../init.d/cryptdisks
|-- S09hwclock.sh -> ../init.d/hwclock.sh
|-- S09ifupdown-clean -> ../init.d/ifupdown-clean
|-- S09module-init-tools -> ../init.d/module-init-tools
|-- S09mtab.sh -> ../init.d/mtab.sh
|-- S09wait4usbdisks -> /etc/init.d/wait4usbdisks
|-- S10checkfs.sh -> ../init.d/checkfs.sh
|-- S11ifupdown -> ../init.d/ifupdown
|-- S11mountall.sh -> ../init.d/mountall.sh
|-- S12mountall-bootclean.sh -> ../init.d/mountall-bootclean.sh
|-- S13mountoverflowtmp -> ../init.d/mountoverflowtmp
|-- S14networking -> ../init.d/networking
|-- S14procps -> ../init.d/procps
|-- S14udev-mtab -> ../init.d/udev-mtab
|-- S14urandom -> ../init.d/urandom
|-- S14x11-common -> ../init.d/x11-common
|-- S15mountnfs.sh -> ../init.d/mountnfs.sh
|-- S16mountnfs-bootclean.sh -> ../init.d/mountnfs-bootclean.sh
|-- S17bootmisc.sh -> ../init.d/bootmisc.sh
`-- S18stop-bootlogd-single -> ../init.d/stop-bootlogd-single

0 directories, 156 files

A módosított fejléc


### BEGIN INIT INFO
# Provides: wait4usbdisks
# Required-Start: module-init-tools $syslog
# Required-Stop: module-init-tools
# Should-Start:
# Should-stop:
# Default-Start: S
# Default-Stop:
# X-Start-Before: $local_fs
# X-Interactive: true
# Short-Description: Delays boot to ensure USB disks are connected.
### END INIT INFO

Ugye felmerült a kernel paraméter is, igen ám, de ez nem root filesystem (de lehet nem jól értettem). Ja és az fstab-ba benne van persze.

Így már úgy tűnik lemegy, a logger-el a /var/log/messages-be írva megtalálom a nyomát, de nem vár - talán a sleep nem működik a boot alatt..

Na ezt csináltam végül. És megy. Többször kipróbáltam. Fogalmam sincsen miért nem ment eddig. Azt viszont nem szeretem. Még tesztelek kicsit. Tulajdonképpen megoldva, de a hiba oka ismeretlen. Eddig.

#!/bin/sh
### BEGIN INIT INFO
# Provides: wait4usbdisks
# Required-Start: module-init-tools $syslog
# Required-Stop: module-init-tools
# Should-Start:
# Should-stop:
# Default-Start: S
# Default-Stop:
# X-Start-Before: $local_fs
# X-Interactive: true
# Short-Description: Delays boot to ensure USB disks are connected.
### END INIT INFO

# If /etc/fstab has been configured to mount a USB drive, pause to give
# the USB drive devices time to show up in /dev. If this is not done,
# checkfs.sh will fail, requiring manual intervention...
#

do_exit() {
logger -s "done: $1"
exit "$1"
}

logger -s "Waiting for usb..."

case "$1" in
start|"")
grep -q ^/dev/sda /etc/fstab &&
for i in `seq 1 20`;
do
[ -b /dev/sda ] && do_exit 0
sleep 1
done
do_exit 1
;;
stop)
;;
esac