USB Festplatte wird beim Start (10.1) nicht gemounted -udev-hal - Vorschlag - mountpoint prüfen ?
Hugo Mahr <[email protected]>
| Newsgroups | gmane.linux.suse.programming |
|---|---|
| Message-ID | <[email protected]> |
Hallo im thread USB Festplatte wird beim Start (10.1) nicht gemounted Von: David Geiger <[email protected]> An: [email protected], Fri May 26 12:21:11 2006 wurde schon gesagt, dass es ein Problem ist, wenn eine USB-Platte vor dem booten an war. Denn dann sieht man es später nicht - ohne manuelles mounten. Nun habe ich mir das näher angesehen. Ich hoffe der Anhang erklärt, was ich gemacht habe Für mich ist jetzt nur noch eine Frage: In ./usr/lib64/hal/scripts/hal-system-storage-mount wird der Mountpoint auf erlaubte Zeichen geprüft: GIVEN_MOUNTPOINT=${GIVEN_MOUNTPOINT//[^a-zA-Z0-9_+-]/_} Damit ist es nicht möglich ein Verzeichnis anzugeben. Was wohl gewünscht ist. Was ich aber nicht mag. Wie muesste man diese zeile ändern, sodass '/' erlaubt ist, aber nicht als erstes Zeichen? Ist ein Mount-point, der ein Verzeichniss ist wirklich schlecht oder gefährlich? Zum Beispiel wird aus dem gewünschten MP. wd1200/daten wd1200_daten Mit meiner Aenderung wird aus /wd1200/daten /wd1200/daten Doch da hätte ich gerne _wd1200/daten d.h. einen absoluten Pfad würde ich schon vermeiden wollen. Ansonsten verstehe ich die hal-specifikation so, das man den Knoten zum einbinden der Laufwerke anpassen kann. Doch ./usr/lib64/hal/scripts/hal-system-storage-mount überschreibt das mit /media. Ich hoffe ich konnte euch ein bisschen helfen und Ihr habt Ideen wie man den MP prüft. Gruss Hugo ------------------------------------anhang ---------------------- Hier ist eine Liste der 'scripts' bzw ein 'diff' um usb Geräte beim booten mit udev/hal einzubinden. Mein System: Linux 2.6.16.13-4-default #1 Wed May 3 04:53:23 UTC 2006 x86_64 x86_64 x86_64 GNU/Linux Dateien: . ./etc ./etc/udev ./etc/udev/rules.d ./etc/init.d ./etc/init.d/mountPostKdmStart ./usr ./usr/lib64 ./usr/lib64/hal ./usr/lib64/hal/scripts ./usr/lib64/hal/scripts/hal-system-storage-mount-diff-treestructure <---diff zu 10.1 script ./usr/local ./usr/local/bin ./usr/local/bin/mountsd-from-file ./usr/local/bin/mountsd ./usr/share ./usr/share/hal ./usr/share/hal/fdi ./usr/share/hal/fdi/policy ./usr/share/hal/fdi/policy/95pmahr-policy ./usr/share/hal/fdi/policy/95pmahr-policy/05-wda-western-digital-1200-mountpoints.fdi ./.viminf ---new file -------------------------------------------------- ./etc/init.d/mountPostKdmStart # # This scipt mount all devices in file /tmp/system-mountsd and # remove this file afterwards. # This is a work-around for suse 10.1 # # 28.6.2006 # # ### BEGIN INIT INFO # Provides: mountPostKdmStart # Required-Start: haldaemon $ALL # Should-Start: # Required-Stop: # Should-Stop: $time # Default-Start: 3 5 # Default-Stop: # Short-Description: mountPostKdmStart starts not hal-mounted disks. # Description: mountPostKdmStart starts not hal-mounted disks. # The system udev writes the devices in question to # /tmp/system-mountsd. # Because is not enouch to wait for haldaemon I define to start as the # latest service in this runlevel. # At stop of this service the file /tmp/system-mountsd is moved to # /tmp/system-mountsd-stop. This takes care that another disk is mounted # and written to the file /tmp/system-mountsd before the stop of this service. # ### END INIT INFO # # Check for missing binaries (stale symlinks should not happen) # Note: Special treatment of stop for LSB conformance MYMOUNT=/usr/local/bin/mountsd-from-file test -x $MYMOUNT || { echo "$MYMOUNT not installed"; if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; } . /etc/rc.status # Reset status of this service rc_reset case "$1" in start) dfile=/tmp/system-mountsd if [ -e $dfile ] then #loop over all devices in file, avoid double items for device in `sort $dfile | uniq ` do echo "$device mounted" /usr/local/bin/mountsd-from-file $device done mv $dfile ${dfile}.old fi # Remember status and be verbose rc_status -v ;; stop) echo ' stop ---------------------------------' dfile=/tmp/system-mountsd if [ -e $dfile ] then mv $dfile ${dfile}-stop fi rc_status -v ;; *) echo "Usage: $0 {start}" exit 1 ;; esac rc_exit ---new file --- diff ----------------------------------------- ./usr/lib64/hal/scripts/hal-system-storage-mount-diff-treestructure 7a8,9 > # > # allow / to build a tree structure, 20060628 73a76 > # I want / !!!!!!!!!!!!!!!! 92c95,98 < GIVEN_MOUNTPOINT=${GIVEN_MOUNTPOINT//[^a-zA-Z0-9_+-]/_} --- > # original > #GIVEN_MOUNTPOINT=${GIVEN_MOUNTPOINT//[^a-zA-Z0-9_+-]/_} > GIVEN_MOUNTPOINT=${GIVEN_MOUNTPOINT//[^a-zA-Z0-9_+-/]_} > ---new file -------------------------------------------------- ./usr/local/bin/mountsd-from-file #!/bin/sh #i mount all devices in temporary file /tmp/system-mountsd # with hal to get the mount-point defined by hal # consider key volume.policy.should_mount # # Problem is hal daemon is not active. Then the rest of the script will fail. # therefore all devices are written to /tmp/system-mountsd so that they # can be mounted later in run-level-5. # # # 20060627 a=`hal-find-by-property --key "block.device" --string /dev/$1` m=`hal-get-property --key volume.policy.desired_mount_point --udi $a` doMount=`hal-get-property --key volume.policy.should_mount --udi $a` if [ "${doMount}xx" = "truexx" ] then halmount "/dev/$1" "$m" fi ---new file -------------------------------------------------- ./usr/local/bin/mountsd #!/bin/sh #i mount a device with hal to get the mount-point defined by hal # consider key volume.policy.should_mount # # Problem is hal daemon is not active. Then the rest of the script will fail. # therefore all devices are written to /tmp/system-mountsd so that they # can be mounted later in run-level-5. # # # 20060627 touch /tmp/system-mountsd echo $1 >> /tmp/system-mountsd a=`hal-find-by-property --key "block.device" --string /dev/$1` m=`hal-get-property --key volume.policy.desired_mount_point --udi $a` doMount=`hal-get-property --key volume.policy.should_mount --udi $a` #here hal is working, remove the temporary file ##if [ -e /var/run/hal/haldaemon.pid ]; then rm /tmp/system-mountsd; fi if [ "${doMount}xx" = "truexx" ] then halmount "/dev/$1" "$m" fi ---new file -------------------------------------------------- ./usr/share/hal/fdi/policy/95pmahr-policy/05-wda-western-digital-1200-mountpoints.fdi <?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- --> <!-- -*- mount points wd1200, fixed device /dev/sdm, 20060328 -*- --> <deviceinfo version="0.2"> <!-- -*- sdm1 -*- --> <device> <match key="block.device" string="/dev/sdm1"> <merge key="volume.policy.should_mount" type="bool">true</merge> <merge key="volume.policy.desired_mount_point" type="string">wd1200/wd1200-p1</merge> <merge key="volume.policy.mount_option.sync" type="bool">false</merge> </match> </device> <!-- -*- sdm2 -*- --> <device> <match key="block.device" string="/dev/sdm2"> <merge key="volume.policy.should_mount" type="bool">true</merge> <merge key="volume.policy.desired_mount_point" type="string">wd1200/wd1200-p2</merge> <merge key="volume.policy.mount_option.sync" type="bool">false</merge> </match> </device> <!-- -*- sdmx -- and more .......................... -*- --> </deviceinfo> # This scipt mount all devices in file /tmp/system-mountsd and # remove this file afterwards. # This is a work-around for suse 10.1 # # 28.6.2006 # # ### BEGIN INIT INFO # Provides: mountPostKdmStart # Required-Start: haldaemon $ALL # Should-Start: # Required-Stop: # Should-Stop: $time # Default-Start: 3 5 # Default-Stop: # Short-Description: mountPostKdmStart starts not hal-mounted disks. # Description: mountPostKdmStart starts not hal-mounted disks. # The system udev writes the devices in question to # /tmp/system-mountsd. # Because is not enouch to wait for haldaemon I define to start as the # latest service in this runlevel. # At stop of this service the file /tmp/system-mountsd is moved to # /tmp/system-mountsd-stop. This takes care that another disk is mounted # and written to the file /tmp/system-mountsd before the stop of this service. # ### END INIT INFO # # Check for missing binaries (stale symlinks should not happen) # Note: Special treatment of stop for LSB conformance MYMOUNT=/usr/local/bin/mountsd-from-file test -x $MYMOUNT || { echo "$MYMOUNT not installed"; if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; } . /etc/rc.status # Reset status of this service rc_reset case "$1" in start) dfile=/tmp/system-mountsd if [ -e $dfile ] then #loop over all devices in file, avoid double items for device in `sort $dfile | uniq ` do echo "$device mounted" /usr/local/bin/mountsd-from-file $device done mv $dfile ${dfile}.old fi # Remember status and be verbose rc_status -v ;; stop) echo ' stop ---------------------------------' dfile=/tmp/system-mountsd if [ -e $dfile ] then mv $dfile ${dfile}-stop fi rc_status -v ;; *) echo "Usage: $0 {start}" exit 1 ;; esac rc_exit ---new file -------------------------------------------------- ./usr/lib64/hal/scripts/hal-system-storage-mount-diff-treestructure 7a8,9 > # > # allow / to build a tree structure, 20060628 73a76 > # I want / !!!!!!!!!!!!!!!! 92c95,98 < GIVEN_MOUNTPOINT=${GIVEN_MOUNTPOINT//[^a-zA-Z0-9_+-]/_} --- > # original > #GIVEN_MOUNTPOINT=${GIVEN_MOUNTPOINT//[^a-zA-Z0-9_+-]/_} > GIVEN_MOUNTPOINT=${GIVEN_MOUNTPOINT//[^a-zA-Z0-9_+-/]_} > ---new file -------------------------------------------------- ./usr/local/bin/mountsd-from-file #!/bin/sh #i mount all devices in temporary file /tmp/system-mountsd # with hal to get the mount-point defined by hal # consider key volume.policy.should_mount # # Problem is hal daemon is not active. Then the rest of the script will fail. # therefore all devices are written to /tmp/system-mountsd so that they # can be mounted later in run-level-5. # # # 20060627 a=`hal-find-by-property --key "block.device" --string /dev/$1` m=`hal-get-property --key volume.policy.desired_mount_point --udi $a` doMount=`hal-get-property --key volume.policy.should_mount --udi $a` if [ "${doMount}xx" = "truexx" ] then halmount "/dev/$1" "$m" fi ---new file -------------------------------------------------- ./usr/local/bin/mountsd #!/bin/sh #i mount a device with hal to get the mount-point defined by hal # consider key volume.policy.should_mount # # Problem is hal daemon is not active. Then the rest of the script will fail. # therefore all devices are written to /tmp/system-mountsd so that they # can be mounted later in run-level-5. # # # 20060627 touch /tmp/system-mountsd echo $1 >> /tmp/system-mountsd a=`hal-find-by-property --key "block.device" --string /dev/$1` m=`hal-get-property --key volume.policy.desired_mount_point --udi $a` doMount=`hal-get-property --key volume.policy.should_mount --udi $a` #here hal is working, remove the temporary file ##if [ -e /var/run/hal/haldaemon.pid ]; then rm /tmp/system-mountsd; fi if [ "${doMount}xx" = "truexx" ] then halmount "/dev/$1" "$m" fi ---new file -------------------------------------------------- ./usr/share/hal/fdi/policy/95pmahr-policy/05-wda-western-digital-1200-mountpoints.fdi <?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- --> <!-- -*- mount points wd1200, fixed device /dev/sdm, 20060328 -*- --> <deviceinfo version="0.2"> <!-- -*- sdm1 -*- --> <device> <match key="block.device" string="/dev/sdm1"> <merge key="volume.policy.should_mount" type="bool">true</merge> <merge key="volume.policy.desired_mount_point" type="string">wd1200/wd1200-p1</merge> <merge key="volume.policy.mount_option.sync" type="bool">false</merge> </match> </device> <!-- -*- sdm2 -*- --> <device> <match key="block.device" string="/dev/sdm2"> <merge key="volume.policy.should_mount" type="bool">true</merge> <merge key="volume.policy.desired_mount_point" type="string">wd1200/wd1200-p2</merge> <merge key="volume.policy.mount_option.sync" type="bool">false</merge> </match> </device> <!-- -*- sdmx -- and more .......................... -*- --> </deviceinfo> -- Um die Liste abzubestellen, schicken Sie eine Mail an: [email protected] Um eine Liste aller verfügbaren Kommandos zu bekommen, schicken Sie eine Mail an: [email protected]