Mit Hald USB-Sticks CDs mounten oder neustarten (XFCE)

chaos

*nix'ler
Hallo,

ich hab ein Problem mit hald und komme mir fast so vor wie Dave in 2001: Odyssee im Weltraum:
Code:
ich: Mounte den USB-Stick/die CD/fahr den Rechner runter.
hal(d): I'm sorry thomas, I'm afraid I can't do that.
Aber nun zur Problembeschreibung, und wie es soweit kommen konnte:

Ich will mit hald aus xfce aus USB-Sticks, CDs usw mounten und den Rechner ausschalten.

Zum Testen habe ich PolicyKit so offen wie möglich konfiguriert (nach manpage von PolicyKit.conf [ man PolicyKit.conf]).

Meine /usr/local/etc/PolicyKit/PolicyKit.conf hat folgenden Inhalt:
Code:
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
<!DOCTYPE pkconfig PUBLIC "-//freedesktop//DTD PolicyKit Configuration 1.0//EN"
"http://hal.freedesktop.org/releases/PolicyKit/1.0/config.dtd">
<!-- See the manual page PolicyKit.conf(5) for file format -->

<config version="0.1">
    <match user="root|thomas">
        <return result="yes"/>
    </match>
    <define_admin_auth group="wheel"/>
</config>
Nach der Manpage sollten so alle Anfragen von den usern root und thomas mit yes beantwortet werden. Soweit die Theorie.

Da das ganze (vermutlich) auch etwas mit dem Device-Dateisystem zu tun hat, meine Änderungen an der /etc/devfs.conf (das meiste aus resultiert aus der Meldung die nach der Installation des k3b-Ports angezeigt wird):
Code:
# Drucker
own     unlpt0   cups:cups
perm    unlpt0   0660
own     ulpt0   cups:cups
perm    ulpt0   0660
# CD Zeugs:
own     acd0    root:wheel
perm    acd0    0660
own     acd1    root:wheel
perm    acd1    0660
own     cd0     root:wheel
perm    cd0     0660
own     cd1     root:wheel
perm    cd1     0660
link    cd0     dvd
link    cd1     dvdram
own     xpt0    root:wheel
perm    xpt0    0660
own     pass0   root:wheel
perm    pass0   0660
own     pass1   root:wheel
perm    pass1   0660

In meiner /etc.rc.conf steht für hald, dbus und Konsorten folgendes
Code:
# HAL
dbus_enable="YES"
polkitd_enable="YES"
hald_enable="YES"
# DM
slim_enable="YES"
Inzwischen hab ich hier gelesen, dass mit slim wohl auch andere User Probleme mit dem Runterfahren haben, aber zunächst will ich auch nur Laufwerke mounten. Und das sollte ja trotz hald, dbus PolicyKit-Teufelszeug unabhängig vom Loginverfahren sein.

Klicke ich also auf das Desktop-Icon meines USB-Sticks um selbigen zu mounten, so bekomme ich eine Fenster mit folgender Fehlermeldung
Code:
Konnte »Cruzer« nicht einhängen:
org.freedesktop.hal.storage.mount-removable no <-- (action, result)
(Toll, jetzt wißt Ihr, was für einen USB-Stick ich besitze ;) ).
Eine inhaltlich ähnliche Fehlermeldung (nur mit der entsprechenden Aktion, also org......), bekomme ich auch, wenn ich den Rechner neustarten oder runterfahren will.
(Zwischenzeitlich hatte ich in /usr/local/etc/PolicyKit/PolicyKit.conf auch mal was stehen, was die einzelnen Handlungen beschreibt, das hat nichts am Ergebnis geändert und die Fehlersuche sollte mit der einfachen PolicyKit-Konfigurationsdatei einfacher sein).

Es scheint mir so, als ob /usr/local/etc/PolicyKit/PolicyKit.conf nicht ausgewertet wird oder durch eine wichtigere Regel überschrieben wird.

Um genaueres rauszufinden habe ich mal ein
Code:
/usr/local/etc/rc.d/hald stop
hald --daemon=no --verbose=yes
gemacht und anschließend wieder auf das Icon geklickt. Als neue Ausgabe kam auf dem Terminal folgendes dazu (bei nur einem Klick ;) )
Code:
18:48:54.006 [W] ci-tracker.c:366: Error doing GetSessionForUnixProcess on ConsoleKit: org.freedesktop.ConsoleKit.Manager.GeneralError: Unable to lookup session information for process '3056'
18:48:54.006 [I] hald_dbus.c:5176: OK for method 'Mount' with signature 'ssas' on interface 'org.freedesktop.Hal.Device.Volume' for UDI '/org/freedesktop/Hal/devices/volume_uuid_0893_67DA' and execpath 'hal-storage-mount'
18:48:54.006 [I] hald_dbus.c:4062: no need to enqueue
Run started hal-storage-mount (0) (1) 
!  full path is '/usr/local/libexec/hal-storage-mount', program_dir is '/usr/local/libexec'
3057: XYA attempting to get lock on /media/.hal-mtab-lock
3057: XYA got lock on /media/.hal-mtab-lock
device                           = /dev/msdosfs/Cruzer
invoked by uid                   = 1001
invoked by system bus connection = :1.54
 label 'Cruzer'  uuid '0893-67DA'
Looking at /etc/fstab entry '/dev/ad0s2b'
/etc/fstab: device /dev/ad0s2b -> /dev/ad0s2b 
Looking at /etc/fstab entry 'linprocfs'
/etc/fstab: device linprocfs -> linprocfs 
Looking at /etc/fstab entry 'procfs'
/etc/fstab: device procfs -> procfs 
Looking at /etc/fstab entry '/dev/ad4s1b'
/etc/fstab: device /dev/ad4s1b -> /dev/ad4s1b 
Looking at /etc/fstab entry '/dev/ad4s1a'
/etc/fstab: device /dev/ad4s1a -> /dev/ad4s1a 
Looking at /etc/fstab entry '/dev/ad4s1e'
/etc/fstab: device /dev/ad4s1e -> /dev/ad4s1e 
Looking at /etc/fstab entry '/dev/ad4s1f'
/etc/fstab: device /dev/ad4s1f -> /dev/ad4s1f 
Looking at /etc/fstab entry '/dev/ad4s1g'
/etc/fstab: device /dev/ad4s1g -> /dev/ad4s1g 
Looking at /etc/fstab entry '/dev/ad4s1d'
/etc/fstab: device /dev/ad4s1d -> /dev/ad4s1d 
Looking at /etc/fstab entry '/dev/da0s2d'
/etc/fstab: device /dev/da0s2d -> /dev/da0s2d 
Looking at /etc/fstab entry '/dev/da0s2'
/etc/fstab: device /dev/da0s2 -> /dev/da0s2 
mount_point    = 'Cruzer'
mount_fstype   = ''
mount_options  = 'longnames     '
trying dir /media/Cruzer
given_options[0] = 'longnames'
allowed_options[0] = 'ro'
allowed_options[1] = 'noexec'
allowed_options[2] = 'noatime'
allowed_options[3] = 'longnames'
allowed_options[4] = 'shortnames'
allowed_options[5] = 'nowin95'
allowed_options[6] = '-u='
allowed_options[7] = '-g='
allowed_options[8] = '-m='
allowed_options[9] = '-M='
allowed_options[10] = '-L='
allowed_options[11] = '-D='
allowed_options[12] = 'large'
using action org.freedesktop.hal.storage.mount-removable for uid 1001, system_bus_connection :1.54
[WARN  2998] Error loading policy files from /usr/local/share/PolicyKit/policy: Out of memory parsing /usr/local/share/PolicyKit/policy/org.freedesktop.policykit.policy
pid 3057: rc=1 signaled=0: /usr/local/libexec/hal-storage-mount
18:48:54.046 [I] device.c:1894: Removing locks from ':1.55'
18:48:54.046 [I] hald_dbus.c:4086: No more methods in queue
18:48:54.046 [I] hald_dbus.c:4149: failed with 'org.freedesktop.Hal.Device.PermissionDeniedByPolicy' 'org.freedesktop.hal.storage.mount-removable no <-- (action, result)'
18:48:54.047 [I] hald_dbus.c:5176: OK for method 'Mount' with signature 'ssas' on interface 'org.freedesktop.Hal.Device.Volume' for UDI '/org/freedesktop/Hal/devices/volume_uuid_0893_67DA' and execpath 'hal-storage-mount'
18:48:54.047 [I] hald_dbus.c:4062: no need to enqueue
Run started hal-storage-mount (0) (1) 
!  full path is '/usr/local/libexec/hal-storage-mount', program_dir is '/usr/local/libexec'
3058: XYA attempting to get lock on /media/.hal-mtab-lock
3058: XYA got lock on /media/.hal-mtab-lock
device                           = /dev/msdosfs/Cruzer
invoked by uid                   = 1001
invoked by system bus connection = :1.54
 label 'Cruzer'  uuid '0893-67DA'
Looking at /etc/fstab entry '/dev/ad0s2b'
/etc/fstab: device /dev/ad0s2b -> /dev/ad0s2b 
Looking at /etc/fstab entry 'linprocfs'
/etc/fstab: device linprocfs -> linprocfs 
Looking at /etc/fstab entry 'procfs'
/etc/fstab: device procfs -> procfs 
Looking at /etc/fstab entry '/dev/ad4s1b'
/etc/fstab: device /dev/ad4s1b -> /dev/ad4s1b 
Looking at /etc/fstab entry '/dev/ad4s1a'
/etc/fstab: device /dev/ad4s1a -> /dev/ad4s1a 
Looking at /etc/fstab entry '/dev/ad4s1e'
/etc/fstab: device /dev/ad4s1e -> /dev/ad4s1e 
Looking at /etc/fstab entry '/dev/ad4s1f'
/etc/fstab: device /dev/ad4s1f -> /dev/ad4s1f 
Looking at /etc/fstab entry '/dev/ad4s1g'
/etc/fstab: device /dev/ad4s1g -> /dev/ad4s1g 
Looking at /etc/fstab entry '/dev/ad4s1d'
/etc/fstab: device /dev/ad4s1d -> /dev/ad4s1d 
Looking at /etc/fstab entry '/dev/da0s2d'
/etc/fstab: device /dev/da0s2d -> /dev/da0s2d 
Looking at /etc/fstab entry '/dev/da0s2'
/etc/fstab: device /dev/da0s2 -> /dev/da0s2 
mount_point    = 'Cruzer'
mount_fstype   = ''
mount_options  = 'longnames     ro      '
trying dir /media/Cruzer
given_options[0] = 'longnames'
given_options[1] = 'ro'
allowed_options[0] = 'ro'
allowed_options[1] = 'noexec'
allowed_options[2] = 'noatime'
allowed_options[3] = 'longnames'
allowed_options[4] = 'shortnames'
allowed_options[5] = 'nowin95'
allowed_options[6] = '-u='
allowed_options[7] = '-g='
allowed_options[8] = '-m='
allowed_options[9] = '-M='
allowed_options[10] = '-L='
allowed_options[11] = '-D='
allowed_options[12] = 'large'
using action org.freedesktop.hal.storage.mount-removable for uid 1001, system_bus_connection :1.54
[WARN  2998] Error loading policy files from /usr/local/share/PolicyKit/policy: Out of memory parsing /usr/local/share/PolicyKit/policy/org.freedesktop.policykit.policy
18:48:54.088 [I] device.c:1894: Removing locks from ':1.56'
pid 3058: rc=1 signaled=0: /usr/local/libexec/hal-storage-mount
18:48:54.089 [I] hald_dbus.c:4086: No more methods in queue
18:48:54.089 [I] hald_dbus.c:4149: failed with 'org.freedesktop.Hal.Device.PermissionDeniedByPolicy' 'org.freedesktop.hal.storage.mount-removable no <-- (action, result)'
18:48:54.091 [I] ci-tracker.c:212: Removing CICallerInfo object for :1.54
18:48:54.091 [I] device.c:1894: Removing locks from ':1.54'

Habt Ihr irgendeine Idee, was ich zur Problemlösung anstellen könnte?

vielen Dank schonmal.
chaos

PS: Denselben Fehler hab ich auch bei KDE.
 
Hy,
also ich geh ma davon aus, daß es um FreeBSD geht (laut Deinem Profil 5.0).
Da gibt's zwei PolicyKit Ordner. Den einen, den Du schon bearbeitet hast und dann noch
/usr/local/share/PolicyKit. Da drin ist der Ordner policy und da drin ist unter anderem die
org.freedesktop.hal.storage.policy.
In diesem gibt's z.B. den Eintrag:
<action id="org.freedesktop.hal.storage.mount-removable">
<description>Mount file systems from removable drives.</description>
<message>System policy prevents mounting removable media</message>
<defaults>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep_always</allow_active>
</defaults>
</action>
Ersetz mal >auth_admin_keep_always< durch >yes< .
Und guck Dir auch den Rest ma an und alles muß in UTF-8 abgespeichert werden.
In der /usr/local/etc/PolicyKit/PolicyKit.conf hab ich bei mir unter anderem folgendes eingefügt:
<match action="org.freedesktop.hal.power-management.shutdown">
<match user="username">
<return result="yes"/>
</match>
</match>
<match action="org.freedesktop.hal.storage.mount">
<match user="username">
<return result="yes"/>
</match>
</match>
<match action="org.freedesktop.hal.storage.unmount">
<match user="username">
<return result="yes"/>
</match>
</match>
<match action="org.freedesktop.hal.storage.eject">
<match user="username">
<return result="yes"/>
</match>
</match>
username ist Dein username ;-)
Aber mal nebenbei gefragt, wieso willst Du noch was mounten, wenn Du
den Rechner dann sowieso runterfährst ?...
Gruß

Hups, jetzt hab ich ja alles als Zitat hier reingewurschtelt
 
Zuletzt bearbeitet:
Ich schwöre immer noch auf mein Automounter Skript (sysutils/automounter) für das Zeug. Hald ist und bleibt inaktiv. Zugegeben, man muss da ein paar devd.conf Einträge machen aber dafür muss man sich nicht mit Policykit (das, wie schon so mancher hier festgestellt hat, nicht wie dokumentiert funktioniert) herumärgern und kann Zugriffsrechte über die devfs.rules setzen. Bis hin zu datenträgerspezifischen Ausnahmen. Ohne dabei eine verschachtelte XML-Datei zu verwenden. XML ist kein sinnvolles Format für Konfigurationsdateien, wenn dann muss es dafür ein Frontend geben.
 
Hallo,

Hy,
also ich geh ma davon aus, daß es um FreeBSD geht (laut Deinem Profil 5.0).
Ist ja auch in einem FreeBSD-unterforum. ;)
Aber hatte ich vergessen dazuzuschreiben, außerdem ist mein Profil wohl etwas veraltet, aktuell habe ich FreeBSD 8.0.

Da gibt's zwei PolicyKit Ordner. Den einen, den Du schon bearbeitet hast und dann noch
/usr/local/share/PolicyKit. Da drin ist der Ordner policy und da drin ist unter anderem die
org.freedesktop.hal.storage.policy.
Ich liebe doch die Trennung zwischen Konfigurationsfiles in .../etc und Nichtkonfigurationsfiles in ../{s|}bin, .../lib{|exec} und .../share.
Vorallem, wenn das strikt eingehalten wird.

In diesem gibt's z.B. den Eintrag:

Ersetz mal >auth_admin_keep_always< durch >yes< .
Stand irgendwie schon so da.

Und guck Dir auch den Rest ma an und alles muß in UTF-8 abgespeichert werden.
In der /usr/local/etc/PolicyKit/PolicyKit.conf hab ich bei mir unter anderem folgendes eingefügt:

username ist Dein username ;-)
Das hat auch noch nichts gebracht.

Aber aufgrund der Fehlermeldung
Code:
[WARN  4748] Error loading policy files from /usr/local/share/PolicyKit/policy: Out of memory parsing /usr/local/share/PolicyKit/policy/org....
Hab ich mal alle Dateien in diesem Verzeichnis vor hald versteckt, indem ich ein .old drangehängt hab.

Und siehe da: Jetzt funktioniert das mounten (reboot hab ich noch nicht versucht).

Aber mal nebenbei gefragt, wieso willst Du noch was mounten, wenn Du
den Rechner dann sowieso runterfährst ?...
Zwischen Mounten und Runterfahren können ja auch noch andere Useraktionen stattfinden.

ciao
chaos
 
Ich schwöre immer noch auf mein Automounter Skript (sysutils/automounter) für das Zeug.
Da hatte ich kurz in das Portverzeichnis geschaut.
Da hat mich folgender Eintrag in pkg-descr ein wenig abgeschreckt:
Code:
 It relies on geom labels, hence it only works for properly labeled devices.
Ist das bei "dahergelaufenen" USB-Sticks und CDs denn der Fall, das das problemlos funktionoert?

Hald ist und bleibt inaktiv.
Wie schaut es dann mit rebooten aus dem WM aus?


Ohne dabei eine verschachtelte XML-Datei zu verwenden. XML ist kein sinnvolles Format für Konfigurationsdateien, wenn dann muss es dafür ein Frontend geben.
XML ist imho in 99.9999% seiner Einsatzfälle Overengineering.

ciao
chaos
 
Zurück
Oben