Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!

Ogłoszenie

Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundację Dzieciom „Zdążyć z Pomocą”.
Więcej informacji na dug.net.pl/pomagamy/.

#1 2018-02-24 23:54:36

rah606
Użytkownik
Zarejestrowany: 2018-02-24

Automount pamięci USB - Buster

Witam,

aktualnie użytkuje Debiana Buster z Fluxboxem, MC, Xtermem - bez zbędnych wodotrysków.
Nie mogę sobie sobie poradzić z automontowaniem pamięci USB.
Czy ktoś może mi pomóc? Próbowałem tego:

https://www.digitalfoundations.com.au/blog/automoun … vices-udisks2

jednak nic.
Usbmount nie jest też przewidziany dla Bustera (mam na myśli repo).

Pozdrawiam,

Offline

 

#2 2018-02-25 00:24:43

Jacekalex
Podobno człowiek...;)
Skąd: /dev/urandom
Zarejestrowany: 2008-01-07

Re: Automount pamięci USB - Buster

To zatrudnij do tego Udeva:

Kod:

root ~> cat /etc/udev/rules.d/99-pendrak.rules

Kod:

KERNEL=="sd[a-b][0-9]", ENV{UDISKS_IGNORE}="1"


ENV{ID_SERIAL_SHORT}=="000FEAFB7AFEF921958F00ED", ENV{UDISKS_IGNORE}:="1"

KERNEL=="sd?1", ACTION=="add", ENV{ID_SERIAL_SHORT}=="000FEAFB7AFEF921958F00ED", \
    SYMLINK+="pendrak%n", \
    RUN+="/bin/mount -t vfat /dev/pendrak%n /media/Pendrak1 -o rw,sync,noexec,nosuid,nodev,shortname=mixed,uid=1001,gid=1001,umask=0077,utf8=1,showexec,flush"


KERNEL=="sd?2", ACTION=="add", ENV{ID_SERIAL_SHORT}=="000FEAFB7AFEF921958F00ED", \
    SYMLINK+="pendrak%n", \
    RUN+="/bin/mount -t ext4 /dev/pendrak%n /media/Pendrak2 -o rw,sync,noexec,nosuid,nodev,user", \
    RUN+="/usr/local/bin/udevmess 'Pendrak zamontowany ;)'"

KERNEL=="sd?3", ACTION=="add", ENV{ID_SERIAL_SHORT}=="000FEAFB7AFEF921958F00ED", \
    SYMLINK+="pendrak%n", \
    RUN+="/bin/mount -t ext4 /dev/pendrak%n /media/Pendrak3 -o rw,sync,noexec,nosuid,nodev,user"

KERNEL=="sd?1", ACTION=="remove", ENV{ID_SERIAL_SHORT}=="000FEAFB7AFEF921958F00ED", \
    RUN+="/bin/umount -f /media/Pendrak1"


KERNEL=="sd?2", ACTION=="remove", ENV{ID_SERIAL_SHORT}=="000FEAFB7AFEF921958F00ED", \
    RUN+="/bin/umount -f /media/Pendrak2"


KERNEL=="sd?3", ACTION=="remove", ENV{ID_SERIAL_SHORT}=="000FEAFB7AFEF921958F00ED", \
    RUN+="/bin/umount -f /media/Pendrak3", \
    RUN+="/usr/local/bin/udevmess 'Pendrak odmontowany  :)'"

Pendrak zawsze ląduje gdzie trzeba, a ja dostaję śliczny komunikat, o akcji montowania czy odmontowania.

Udevmess?

Kod:

#!/bin/bash

MESSAGE="$*"

 for NUMBER in `ls /tmp/.X11-unix | awk -F"X" '{print $2}'`; do env DISPLAY=":$NUMBER"  notify-send -t 50000  ":${MESSAGE}:";  done;

Taka gimnastyka z udevem jest pozornie trudna, ale jak kiedyś zaszyfrujesz pendraka Truecryptem czy Veracryptem, to szybko docenisz możliwości udeva w tym zakresie. xD

Pozdro

Ostatnio edytowany przez Jacekalex (2018-02-25 00:30:37)


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#3 2018-02-25 10:22:32

morfik
Cenzor wirtualnego świata
Skąd: ze WSI
Zarejestrowany: 2011-09-15
Serwis

Re: Automount pamięci USB - Buster

E tam bawić się udev'em. Wystarczy zaprzęgnąć do pracy udevil'a. On zezwoli użytkownikowi na dostęp do określonych urządzeń i punktów montowania, np.

Kod:

$ cat /etc/udevil/udevil-user-morfik.conf
log_keep_days = 10
allowed_types = $KNOWN_FILESYSTEMS, file, nfs, curlftpfs, sshfs
allowed_users = *
allowed_groups = *
allowed_media_dirs = /media/$USER, /media, /run/media/$USER, /mnt
allowed_devices = /dev/*, /dev/mapper/pen*
allowed_internal_devices = /dev/mapper/pen*
forbidden_devices =
allowed_networks = 127.0.0.1, 192.168.1.*, 192.168.2.*
forbidden_networks =
allowed_files = *
forbidden_files =
default_options           = nosuid, noexec, nodev, noatime
default_options_file      = nosuid, noexec, nodev, noatime, uid=$UID, gid=$GID, ro
default_options_iso9660   = nosuid, noexec, nodev, noatime, uid=$UID, gid=$GID, ro, utf8
default_options_udf       = nosuid, noexec, nodev, noatime, uid=$UID, gid=$GID
default_options_vfat      = nosuid, noexec, nodev, noatime, fmask=0133, dmask=0022, uid=$UID, gid=$GID, utf8
default_options_msdos     = nosuid, noexec, nodev, noatime, fmask=0133, dmask=0022, uid=$UID, gid=$GID
default_options_umsdos    = nosuid, noexec, nodev, noatime, fmask=0133, dmask=0022, uid=$UID, gid=$GID
default_options_ntfs      = nosuid, noexec, nodev, noatime, fmask=0133, uid=$UID, gid=$GID, utf8
default_options_cifs      = nosuid, noexec, nodev, uid=$UID, gid=$GID
default_options_smbfs     = nosuid, noexec, nodev, uid=$UID, gid=$GID
default_options_sshfs     = nosuid, noexec, nodev, noatime, uid=$UID, gid=$GID, nonempty, allow_other
default_options_curlftpfs = nosuid, noexec, nodev, noatime, uid=$UID, gid=$GID, nonempty, allow_other
default_options_ftpfs     = nosuid, noexec, nodev, noatime, uid=$UID, gid=$GID
default_options_davfs     = nosuid, noexec, nodev, uid=$UID, gid=$GID
default_options_tmpfs     = nosuid, noexec, nodev, noatime, uid=$UID, gid=$GID
default_options_ramfs     = nosuid, noexec, nodev, noatime, uid=$UID, gid=$GID
allowed_options           = nosuid, noexec, nodev, noatime, fmask=0133, dmask=0022, uid=$UID, gid=$GID, ro, rw, sync, flush, iocharset=*, utf8, remount
allowed_options_nfs       = nosuid, noexec, nodev, noatime, ro, rw, sync, remount, port=*, rsize=*, wsize=*, hard, proto=*, timeo=*, retrans=*
allowed_options_cifs      = nosuid, noexec, nodev, ro, rw, remount, port=*, user=*, username=*, pass=*, password=*, guest, domain=*, uid=$UID, gid=$GID, credentials=*
allowed_options_smbfs     = nosuid, noexec, nodev, ro, rw, remount, port=*, user=*, username=*, pass=*, password=*, guest, domain=*, uid=$UID, gid=$GID, credentials=*
allowed_options_sshfs     = nosuid, noexec, nodev, noatime, ro, rw, uid=$UID, gid=$GID, nonempty, allow_other, idmap=user, BatchMode=yes, port=*
allowed_options_curlftpfs = nosuid, noexec, nodev, noatime, ro, rw, uid=$UID, gid=$GID, nonempty, allow_other, user=*
allowed_options_ftpfs     = nosuid, noexec, nodev, noatime, ro, rw, port=*, user=*, pass=*, ip=*, root=*, uid=$UID, gid=$GID
mount_point_mode = 0755
mount_point_mode_sshfs =
mount_point_mode_curlftpfs =
mount_point_mode_ftpfs =

No i potem już tylko wystarczy dobrać jakiś kompatybilny menadżer plików, który umożliwia automontowanie zasobów, np. spacefm. I bez problemu działa. xD

Offline

 

#4 2018-02-25 12:22:07

rah606
Użytkownik
Zarejestrowany: 2018-02-24

Re: Automount pamięci USB - Buster

Panowie,
na wstępie dziękuje za ultra szybkie odpowiedzi.

@Jacekalex:

Ok, ale tutaj patrząc po ID_SERIAL_SHORT i po ilości/rodzaju partycji, dotyczy to jednego konkretnego pena.
Chciałbym aby to działało dla dowolnego pendrive.
Rozumiem, że odpowiednie foldery w /media muszą być wcześniej utworzone?

@morfik:

Czy można te metodę połączyć z MC?

Offline

 

#5 2018-02-25 15:18:31

morfik
Cenzor wirtualnego świata
Skąd: ze WSI
Zarejestrowany: 2011-09-15
Serwis

Re: Automount pamięci USB - Buster

Możesz sobie zrobić dopasowanie po:

Kod:

KERNEL=="sd[a-z][0-9]", SUBSYSTEMS=="usb", DRIVERS=="usb-storage"

Offline

 

#6 2018-02-25 17:09:45

rah606
Użytkownik
Zarejestrowany: 2018-02-24

Re: Automount pamięci USB - Buster

Co robię źle, że nie mam nic w folderze pendrive1?
Montaż "z ręki" lata aż miło.

Kod:

KERNEL=="sd[a-z][0-9]", SUBSYSTEMS=="usb", DRIVERS=="usb-storage"

KERNEL=="sd?1", ACTION=="add", \
    SYMLINK+="pendrive%n", \
    RUN+="/bin/mkdir /media/pendrive%n", \
    RUN+="/bin/mount /dev/pendrive%n /media/pendrive%n -o user,rw,sync,noexec,nosuid,nodev,shortname=mixed,umask=0000,utf8=1,showexec,flush", \
    RUN+="/usr/local/bin/udevmess 'Pendrive connected'"
    
KERNEL=="sd?1", ACTION=="remove", \
    RUN+="/bin/rm -r /media/pendrive%n", \
    RUN+="/bin/umount -f /media/pendrive%n", \
    RUN+="/usr/local/bin/udevmess 'Pendrive disconnected"

Offline

 

#7 2018-02-25 17:44:00

morfik
Cenzor wirtualnego świata
Skąd: ze WSI
Zarejestrowany: 2011-09-15
Serwis

Re: Automount pamięci USB - Buster

Ta pierwsza linijka ma być w regule. Poza tym, ta druga reguła i tak ci nic nie da jak wyciągniesz pendrive. I tu jest taki bajer, że bawiąc się w taki sposób bardzo łatwo można uszkodzić system plików jak się zapomni odmontować pendrive przed wyciągnięciem go z systemu.

A poza tym to używasz nie takich poleceń jakich trzeba.
Zamiast rm -r używaj rmdir -- to usuwa pusty katalog. Po co co ci rm -r? Jeszcze się rypniesz i sobie system skasujesz. xD
Zamiast umount -f używaj umount -l, ale to i tak tylko w przypadku wyciągnięcia podmontowanego pendrive.

Ostatnio edytowany przez morfik (2018-02-25 17:48:10)

Offline

 

#8 2018-02-25 18:39:09

rah606
Użytkownik
Zarejestrowany: 2018-02-24

Re: Automount pamięci USB - Buster

Racja. Druga reguła jest bez sensu; utworze sobię dwa skrypyt w bashu - do montowania i do odmontowywania - będzie bezpieczniej.
Nie zmienia to faktu, że pomimo twoich sugestii, katalog /media/pendrive1 jest pusty. Jeżeli tworzy się katalog pendrive1, wiem, że reguła działa, ale czemu nie montuje?
Chciałbym tylko te kwestię rozwiązać, bo mnie to gryzie.

Offline

 

#9 2018-02-25 18:52:28

morfik
Cenzor wirtualnego świata
Skąd: ze WSI
Zarejestrowany: 2011-09-15
Serwis

Re: Automount pamięci USB - Buster

Zajrzyj w log i zobacz co tam pisze.

Offline

 

#10 2018-02-25 23:31:35

rah606
Użytkownik
Zarejestrowany: 2018-02-24

Re: Automount pamięci USB - Buster

Ok, loguje sobie udeva w ten sposób: https://wiki.ubuntu.com/DebuggingUdev (4ta metoda z /dev/.udev.debug).

Po podpięciu penka dostaje:

Kod:

seq 3053 queued, 'add' 'usb'
seq 3053 forked new worker [7999]
seq 3054 queued, 'add' 'usb'
seq 3055 queued, 'add' 'scsi'
seq 3053 running
seq 3056 queued, 'add' 'scsi_host'
seq 3053 processed
seq 3057 queued, 'bind' 'usb'
seq 3054 running
seq 3058 queued, 'bind' 'usb'
seq 3054 processed
seq 3055 running
seq 3055 processed
seq 3056 running
seq 3056 processed
seq 3057 running
seq 3057 processed
seq 3058 running
seq 3058 processed
cleanup idle workers
worker [7999] exited
seq 3059 queued, 'add' 'scsi'
seq 3059 forked new worker [8011]
seq 3060 queued, 'add' 'scsi'
seq 3061 queued, 'add' 'scsi_disk'
seq 3062 queued, 'bind' 'scsi'
seq 3063 queued, 'add' 'scsi_device'
seq 3064 queued, 'add' 'scsi_generic'
seq 3059 running
seq 3065 queued, 'add' 'bsg'
seq 3066 queued, 'add' 'bdi'
seq 3059 processed
seq 3066 forked new worker [8013]
seq 3060 running
seq 3060 processed
seq 3061 running
seq 3061 processed
seq 3066 running
seq 3062 running
seq 3062 processed
seq 3066 processed
seq 3065 forked new worker [8015]
seq 3064 running
seq 3063 running
seq 3063 processed
seq 3064 processed
seq 3065 running
seq 3065 processed
seq 3067 queued, 'add' 'block'
seq 3067 running
seq 3068 queued, 'add' 'block'
seq 3067 processed
seq 3068 running
seq 3068 processed
cleanup idle workers
worker [8011] exited
cleanup idle workers
worker [8015] exited
cleanup idle workers
worker [8013] exited

po wypięciu:

Kod:

seq 3069 queued, 'remove' 'bsg'
seq 3069 forked new worker [8410]
seq 3070 queued, 'remove' 'scsi_generic'
seq 3070 forked new worker [8412]
seq 3071 queued, 'remove' 'scsi_device'
seq 3069 running
seq 3071 forked new worker [8414]
seq 3069 processed
seq 3072 queued, 'remove' 'scsi_disk'
seq 3072 forked new worker [8416]
seq 3073 queued, 'remove' 'block'
seq 3073 running
seq 3073 processed
seq 3071 running
seq 3071 processed
seq 3070 running
seq 3070 processed
seq 3072 running
seq 3072 processed
cleanup idle workers
worker [8414] exited
worker [8416] exited
cleanup idle workers
worker [8410] exited
cleanup idle workers
worker [8412] exited
seq 3074 queued, 'remove' 'bdi'
seq 3074 forked new worker [8419]
seq 3074 running
seq 3074 processed
seq 3075 queued, 'remove' 'block'
seq 3075 forked new worker [8421]
seq 3076 queued, 'unbind' 'scsi'
seq 3077 queued, 'remove' 'scsi'
seq 3075 running
seq 3075 processed
seq 3076 running
seq 3076 processed
seq 3077 running
seq 3077 processed
cleanup idle workers
worker [8419] exited
cleanup idle workers
worker [8421] exited
seq 3078 queued, 'remove' 'scsi'
seq 3078 forked new worker [8423]
seq 3079 queued, 'remove' 'scsi_host'
seq 3078 running
seq 3078 processed
seq 3079 forked new worker [8425]
seq 3080 queued, 'remove' 'scsi'
seq 3079 running
seq 3079 processed
seq 3081 queued, 'unbind' 'usb'
seq 3080 running
seq 3082 queued, 'remove' 'usb'
seq 3080 processed
seq 3083 queued, 'unbind' 'usb'
seq 3081 running
seq 3084 queued, 'remove' 'usb'
seq 3081 processed
seq 3082 running
seq 3082 processed
seq 3083 running
seq 3083 processed
seq 3084 running
seq 3084 processed
cleanup idle workers
worker [8423] exited
worker [8425] exited

nie widzę nic niepokojącego.

Offline

 

#11 2018-02-26 10:12:05

morfik
Cenzor wirtualnego świata
Skąd: ze WSI
Zarejestrowany: 2011-09-15
Serwis

Re: Automount pamięci USB - Buster

Zajrzyj w log systemowy. xD

Offline

 

#12 2018-02-26 22:08:16

rah606
Użytkownik
Zarejestrowany: 2018-02-24

Re: Automount pamięci USB - Buster

Hehe, widziałem od razu w tym coś bardziej skomplikowanego. W /var/log/messages nic specjalnego:

Kod:

Feb 26 22:04:53 hackbox kernel: [  587.709312] usb 3-4: new SuperSpeed USB device number 10 using xhci_hcd
Feb 26 22:04:53 hackbox kernel: [  587.734655] usb 3-4: New USB device found, idVendor=090c, idProduct=1000
Feb 26 22:04:53 hackbox kernel: [  587.734660] usb 3-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Feb 26 22:04:53 hackbox kernel: [  587.734662] usb 3-4: Product: USB DISK
Feb 26 22:04:53 hackbox kernel: [  587.734664] usb 3-4: Manufacturer: SMI Corporation
Feb 26 22:04:53 hackbox kernel: [  587.734666] usb 3-4: SerialNumber: AAW6DHCMYHYMBSNQ
Feb 26 22:04:53 hackbox kernel: [  587.737969] usb-storage 3-4:1.0: USB Mass Storage device detected
Feb 26 22:04:53 hackbox kernel: [  587.739726] scsi host4: usb-storage 3-4:1.0
Feb 26 22:04:55 hackbox kernel: [  588.968095] scsi 4:0:0:0: Direct-Access     SMI      USB DISK         1100 PQ: 0 ANSI: 6
Feb 26 22:04:55 hackbox kernel: [  588.968809] sd 4:0:0:0: Attached scsi generic sg2 type 0
Feb 26 22:04:55 hackbox kernel: [  588.969559] sd 4:0:0:0: [sdd] 15601664 512-byte logical blocks: (7.99 GB/7.44 GiB)
Feb 26 22:04:55 hackbox kernel: [  588.970155] sd 4:0:0:0: [sdd] Write Protect is off
Feb 26 22:04:55 hackbox kernel: [  588.970751] sd 4:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Feb 26 22:04:55 hackbox kernel: [  588.975607]  sdd: sdd1
Feb 26 22:04:55 hackbox kernel: [  588.977814] sd 4:0:0:0: [sdd] Attached SCSI removable disk

Offline

 

#13 2018-02-26 22:47:28

morfik
Cenzor wirtualnego świata
Skąd: ze WSI
Zarejestrowany: 2011-09-15
Serwis

Re: Automount pamięci USB - Buster

No to jak widzisz, nie ma próby montowania po wykryciu, czyli pewnie reguła nie została dopasowana.

Pobaw się tym i popatrz co tam wypisuje i czy w ogóle bierze pod uwagę twoje reguły:

Kod:

# udevadm control --reload
# udevadm test -a -p $(udevadm info -q path -n /dev/sdd1)

Offline

 

#14 2018-02-27 19:58:07

rah606
Użytkownik
Zarejestrowany: 2018-02-24

Re: Automount pamięci USB - Buster

Ok, wracam z logiem (pendrive1 to symlink utworzony na podstawie reguły, którą wrzuciłem wcześniej):

Kod:

root@hackbox:/etc/udev/rules.d# udevadm test $(udevadm info -q path -n /dev/pendrive1)
calling: test
version 236
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

=== trie on-disk ===
tool version:          236
file size:         9135137 bytes
header size             80 bytes
strings            1940673 bytes
nodes              7194384 bytes
Load module index
Found container virtualization none.
timestamp of '/etc/systemd/network' changed
timestamp of '/lib/systemd/network' changed
Ignoring /lib/systemd/network/80-container-host0.network, because it's not a regular file with suffix .link.
Ignoring /lib/systemd/network/80-container-ve.network, because it's not a regular file with suffix .link.
Ignoring /lib/systemd/network/80-container-vz.network, because it's not a regular file with suffix .link.
Parsed configuration file /lib/systemd/network/99-default.link
Created link configuration context.
timestamp of '/etc/udev/rules.d' changed
Ignoring /etc/udev/rules.d/99-pendrive.rulesmy, because it's not a regular file with suffix .rules.
Ignoring /etc/udev/rules.d/99-pendrive.rulesforum, because it's not a regular file with suffix .rules.
Reading rules file: /lib/udev/rules.d/40-usb_modeswitch.rules
Reading rules file: /lib/udev/rules.d/50-firmware.rules
Reading rules file: /lib/udev/rules.d/50-udev-default.rules
Reading rules file: /lib/udev/rules.d/55-dm.rules
Reading rules file: /lib/udev/rules.d/56-hpmud.rules
Reading rules file: /lib/udev/rules.d/60-block.rules
Reading rules file: /lib/udev/rules.d/60-cdrom_id.rules
Reading rules file: /lib/udev/rules.d/60-drm.rules
Reading rules file: /lib/udev/rules.d/60-evdev.rules
Reading rules file: /lib/udev/rules.d/60-fuse.rules
Reading rules file: /lib/udev/rules.d/60-input-id.rules
Reading rules file: /lib/udev/rules.d/60-libgphoto2-6.rules
Reading rules file: /lib/udev/rules.d/60-libsane.rules
Reading rules file: /lib/udev/rules.d/60-persistent-alsa.rules
Reading rules file: /lib/udev/rules.d/60-persistent-input.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage-dm.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage-tape.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage.rules
Reading rules file: /lib/udev/rules.d/60-persistent-v4l.rules
Reading rules file: /lib/udev/rules.d/60-sensor.rules
Reading rules file: /lib/udev/rules.d/60-serial.rules
Reading rules file: /lib/udev/rules.d/64-btrfs.rules
Reading rules file: /lib/udev/rules.d/64-xorg-xkb.rules
Reading rules file: /lib/udev/rules.d/65-libwacom.rules
Reading rules file: /lib/udev/rules.d/69-cd-sensors.rules
Reading rules file: /lib/udev/rules.d/69-wacom.rules
Reading rules file: /lib/udev/rules.d/70-debian-uaccess.rules
Reading rules file: /lib/udev/rules.d/70-joystick.rules
Reading rules file: /lib/udev/rules.d/70-mouse.rules
Reading rules file: /lib/udev/rules.d/70-power-switch.rules
Reading rules file: /lib/udev/rules.d/70-touchpad.rules
Reading rules file: /lib/udev/rules.d/70-uaccess.rules
Reading rules file: /lib/udev/rules.d/71-seat.rules
Reading rules file: /lib/udev/rules.d/73-seat-late.rules
Reading rules file: /lib/udev/rules.d/73-special-net-names.rules
Reading rules file: /lib/udev/rules.d/73-usb-net-by-mac.rules
Reading rules file: /lib/udev/rules.d/75-net-description.rules
Reading rules file: /lib/udev/rules.d/75-probe_mtd.rules
Reading rules file: /lib/udev/rules.d/78-sound-card.rules
Reading rules file: /lib/udev/rules.d/80-debian-compat.rules
Reading rules file: /lib/udev/rules.d/80-drivers.rules
Reading rules file: /lib/udev/rules.d/80-ifupdown.rules
Reading rules file: /lib/udev/rules.d/80-libinput-device-groups.rules
Reading rules file: /lib/udev/rules.d/80-net-setup-link.rules
Reading rules file: /lib/udev/rules.d/85-hdparm.rules
Reading rules file: /lib/udev/rules.d/85-hplj10xx.rules
Reading rules file: /lib/udev/rules.d/85-hwclock.rules
Reading rules file: /lib/udev/rules.d/90-alsa-restore.rules
Reading rules file: /lib/udev/rules.d/90-console-setup.rules
Reading rules file: /lib/udev/rules.d/90-libinput-model-quirks.rules
Reading rules file: /lib/udev/rules.d/95-cd-devices.rules
Reading rules file: /lib/udev/rules.d/95-dm-notify.rules
Reading rules file: /etc/udev/rules.d/99-pendrive.rules
Reading rules file: /lib/udev/rules.d/99-systemd.rules
rules contain 196608 bytes tokens (16384 * 12 bytes), 23045 bytes strings
12718 strings (108030 bytes), 10564 de-duplicated (87140 bytes), 2155 trie nodes used
GROUP 6 /lib/udev/rules.d/50-udev-default.rules:56
LINK 'disk/by-id/usb-Chipsbnk_UDisk_1209180932340324068700-0:0-part1' /lib/udev/rules.d/60-persistent-storage.rules:53
LINK 'disk/by-path/pci-0000:00:14.0-usb-0:3:1.0-scsi-0:0:0:0-part1' /lib/udev/rules.d/60-persistent-storage.rules:76
IMPORT builtin 'blkid' /lib/udev/rules.d/60-persistent-storage.rules:90
probe /dev/sdh1 raid offset=0
LINK 'disk/by-uuid/0031-BFB7' /lib/udev/rules.d/60-persistent-storage.rules:93
LINK 'disk/by-label/PEN\x20JAGODA' /lib/udev/rules.d/60-persistent-storage.rules:94
LINK 'disk/by-partuuid/0031bfb7-01' /lib/udev/rules.d/60-persistent-storage.rules:101
LINK 'pendrive1' /etc/udev/rules.d/99-pendrive.rules:4
RUN '/bin/mkdir /media/pendrive%n' /etc/udev/rules.d/99-pendrive.rules:4
RUN '/bin/mount /dev/pendrive%n /media/pendrive%n -o user,rw,sync,noexec,nosuid,nodev,shortname=mixed,umask=0000,utf8=1,showexec,flush' /etc/udev/rules.d/99-pendrive.rules:4
handling device node '/dev/sdh1', devnum=b8:113, mode=0660, uid=0, gid=6
preserve permissions /dev/sdh1, 060660, uid=0, gid=6
preserve already existing symlink '/dev/block/8:113' to '../sdh1'
found 'b8:113' claiming '/run/udev/links/\x2fdisk\x2fby-id\x2fusb-Chipsbnk_UDisk_1209180932340324068700-0:0-part1'
creating link '/dev/disk/by-id/usb-Chipsbnk_UDisk_1209180932340324068700-0:0-part1' to '/dev/sdh1'
preserve already existing symlink '/dev/disk/by-id/usb-Chipsbnk_UDisk_1209180932340324068700-0:0-part1' to '../../sdh1'
found 'b8:113' claiming '/run/udev/links/\x2fdisk\x2fby-label\x2fPEN\x5cx20JAGODA'
creating link '/dev/disk/by-label/PEN\x20JAGODA' to '/dev/sdh1'
preserve already existing symlink '/dev/disk/by-label/PEN\x20JAGODA' to '../../sdh1'
found 'b8:113' claiming '/run/udev/links/\x2fdisk\x2fby-partuuid\x2f0031bfb7-01'
creating link '/dev/disk/by-partuuid/0031bfb7-01' to '/dev/sdh1'
preserve already existing symlink '/dev/disk/by-partuuid/0031bfb7-01' to '../../sdh1'
found 'b8:113' claiming '/run/udev/links/\x2fdisk\x2fby-path\x2fpci-0000:00:14.0-usb-0:3:1.0-scsi-0:0:0:0-part1'
creating link '/dev/disk/by-path/pci-0000:00:14.0-usb-0:3:1.0-scsi-0:0:0:0-part1' to '/dev/sdh1'
preserve already existing symlink '/dev/disk/by-path/pci-0000:00:14.0-usb-0:3:1.0-scsi-0:0:0:0-part1' to '../../sdh1'
found 'b8:113' claiming '/run/udev/links/\x2fdisk\x2fby-uuid\x2f0031-BFB7'
creating link '/dev/disk/by-uuid/0031-BFB7' to '/dev/sdh1'
preserve already existing symlink '/dev/disk/by-uuid/0031-BFB7' to '../../sdh1'
found 'b8:113' claiming '/run/udev/links/\x2fpendrive1'
creating link '/dev/pendrive1' to '/dev/sdh1'
preserve already existing symlink '/dev/pendrive1' to 'sdh1'
created db file '/run/udev/data/b8:113' for '/devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3:1.0/host12/target12:0:0/12:0:0:0/block/sdh/sdh1'
ACTION=add
DEVLINKS=/dev/disk/by-label/PEN\x20JAGODA /dev/disk/by-uuid/0031-BFB7 /dev/disk/by-partuuid/0031bfb7-01 /dev/disk/by-path/pci-0000:00:14.0-usb-0:3:1.0-scsi-0:0:0:0-part1 /dev/disk/by-id/usb-Chipsbnk_UDisk_1209180932340324068700-0:0-part1 /dev/pendrive1
DEVNAME=/dev/sdh1
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3:1.0/host12/target12:0:0/12:0:0:0/block/sdh/sdh1
DEVTYPE=partition
ID_BUS=usb
ID_FS_LABEL=PEN_JAGODA
ID_FS_LABEL_ENC=PEN\x20JAGODA
ID_FS_TYPE=vfat
ID_FS_USAGE=filesystem
ID_FS_UUID=0031-BFB7
ID_FS_UUID_ENC=0031-BFB7
ID_FS_VERSION=FAT32
ID_INSTANCE=0:0
ID_MODEL=UDisk
ID_MODEL_ENC=UDisk\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_MODEL_ID=1234
ID_PART_ENTRY_DISK=8:112
ID_PART_ENTRY_FLAGS=0x80
ID_PART_ENTRY_NUMBER=1
ID_PART_ENTRY_OFFSET=64
ID_PART_ENTRY_SCHEME=dos
ID_PART_ENTRY_SIZE=15974336
ID_PART_ENTRY_TYPE=0xb
ID_PART_ENTRY_UUID=0031bfb7-01
ID_PART_TABLE_TYPE=dos
ID_PART_TABLE_UUID=0031bfb7
ID_PATH=pci-0000:00:14.0-usb-0:3:1.0-scsi-0:0:0:0
ID_PATH_TAG=pci-0000_00_14_0-usb-0_3_1_0-scsi-0_0_0_0
ID_REVISION=5.00
ID_SERIAL=Chipsbnk_UDisk_1209180932340324068700-0:0
ID_SERIAL_SHORT=1209180932340324068700
ID_TYPE=disk
ID_USB_DRIVER=usb-storage
ID_USB_INTERFACES=:080650:
ID_USB_INTERFACE_NUM=00
ID_VENDOR=Chipsbnk
ID_VENDOR_ENC=Chipsbnk
ID_VENDOR_ID=abcd
MAJOR=8
MINOR=113
PARTN=1
SUBSYSTEM=block
TAGS=:systemd:
USEC_INITIALIZED=1953784824
run: '/bin/mkdir /media/pendrive1'
run: '/bin/mount /dev/pendrive1 /media/pendrive1 -o user,rw,sync,noexec,nosuid,nodev,shortname=mixed,umask=0000,utf8=1,showexec,flush'
Unload module index
Unloaded link configuration context.

Co ciekawe, "run" pojawiło mi się tylko raz, przy kolejnej próbie nie ma już tego wywołania:

Kod:

root@hackbox:/etc/udev/rules.d# udevadm test -a -p $(udevadm info -q path -n /dev/pendrive1)
calling: test
version 236
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

=== trie on-disk ===
tool version:          236
file size:         9135137 bytes
header size             80 bytes
strings            1940673 bytes
nodes              7194384 bytes
Load module index
Found container virtualization none.
timestamp of '/etc/systemd/network' changed
timestamp of '/lib/systemd/network' changed
Ignoring /lib/systemd/network/80-container-host0.network, because it's not a regular file with suffix .link.
Ignoring /lib/systemd/network/80-container-ve.network, because it's not a regular file with suffix .link.
Ignoring /lib/systemd/network/80-container-vz.network, because it's not a regular file with suffix .link.
Parsed configuration file /lib/systemd/network/99-default.link
Created link configuration context.
timestamp of '/etc/udev/rules.d' changed
Ignoring /etc/udev/rules.d/99-pendrive.rulesmy, because it's not a regular file with suffix .rules.
Ignoring /etc/udev/rules.d/99-pendrive.rulesforum, because it's not a regular file with suffix .rules.
Reading rules file: /lib/udev/rules.d/40-usb_modeswitch.rules
Reading rules file: /lib/udev/rules.d/50-firmware.rules
Reading rules file: /lib/udev/rules.d/50-udev-default.rules
Reading rules file: /lib/udev/rules.d/55-dm.rules
Reading rules file: /lib/udev/rules.d/56-hpmud.rules
Reading rules file: /lib/udev/rules.d/60-block.rules
Reading rules file: /lib/udev/rules.d/60-cdrom_id.rules
Reading rules file: /lib/udev/rules.d/60-drm.rules
Reading rules file: /lib/udev/rules.d/60-evdev.rules
Reading rules file: /lib/udev/rules.d/60-fuse.rules
Reading rules file: /lib/udev/rules.d/60-input-id.rules
Reading rules file: /lib/udev/rules.d/60-libgphoto2-6.rules
Reading rules file: /lib/udev/rules.d/60-libsane.rules
Reading rules file: /lib/udev/rules.d/60-persistent-alsa.rules
Reading rules file: /lib/udev/rules.d/60-persistent-input.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage-dm.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage-tape.rules
Reading rules file: /lib/udev/rules.d/60-persistent-storage.rules
Reading rules file: /lib/udev/rules.d/60-persistent-v4l.rules
Reading rules file: /lib/udev/rules.d/60-sensor.rules
Reading rules file: /lib/udev/rules.d/60-serial.rules
Reading rules file: /lib/udev/rules.d/64-btrfs.rules
Reading rules file: /lib/udev/rules.d/64-xorg-xkb.rules
Reading rules file: /lib/udev/rules.d/65-libwacom.rules
Reading rules file: /lib/udev/rules.d/69-cd-sensors.rules
Reading rules file: /lib/udev/rules.d/69-wacom.rules
Reading rules file: /lib/udev/rules.d/70-debian-uaccess.rules
Reading rules file: /lib/udev/rules.d/70-joystick.rules
Reading rules file: /lib/udev/rules.d/70-mouse.rules
Reading rules file: /lib/udev/rules.d/70-power-switch.rules
Reading rules file: /lib/udev/rules.d/70-touchpad.rules
Reading rules file: /lib/udev/rules.d/70-uaccess.rules
Reading rules file: /lib/udev/rules.d/71-seat.rules
Reading rules file: /lib/udev/rules.d/73-seat-late.rules
Reading rules file: /lib/udev/rules.d/73-special-net-names.rules
Reading rules file: /lib/udev/rules.d/73-usb-net-by-mac.rules
Reading rules file: /lib/udev/rules.d/75-net-description.rules
Reading rules file: /lib/udev/rules.d/75-probe_mtd.rules
Reading rules file: /lib/udev/rules.d/78-sound-card.rules
Reading rules file: /lib/udev/rules.d/80-debian-compat.rules
Reading rules file: /lib/udev/rules.d/80-drivers.rules
Reading rules file: /lib/udev/rules.d/80-ifupdown.rules
Reading rules file: /lib/udev/rules.d/80-libinput-device-groups.rules
Reading rules file: /lib/udev/rules.d/80-net-setup-link.rules
Reading rules file: /lib/udev/rules.d/85-hdparm.rules
Reading rules file: /lib/udev/rules.d/85-hplj10xx.rules
Reading rules file: /lib/udev/rules.d/85-hwclock.rules
Reading rules file: /lib/udev/rules.d/90-alsa-restore.rules
Reading rules file: /lib/udev/rules.d/90-console-setup.rules
Reading rules file: /lib/udev/rules.d/90-libinput-model-quirks.rules
Reading rules file: /lib/udev/rules.d/95-cd-devices.rules
Reading rules file: /lib/udev/rules.d/95-dm-notify.rules
Reading rules file: /etc/udev/rules.d/99-pendrive.rules
Reading rules file: /lib/udev/rules.d/99-systemd.rules
rules contain 196608 bytes tokens (16384 * 12 bytes), 23045 bytes strings
12718 strings (108030 bytes), 10564 de-duplicated (87140 bytes), 2155 trie nodes used
LINK 'disk/by-id/usb-Chipsbnk_UDisk_1209180932340324068700-0:0-part1' /lib/udev/rules.d/60-persistent-storage.rules:53
LINK 'disk/by-path/pci-0000:00:14.0-usb-0:3:1.0-scsi-0:0:0:0-part1' /lib/udev/rules.d/60-persistent-storage.rules:76
IMPORT builtin 'blkid' /lib/udev/rules.d/60-persistent-storage.rules:90
probe /dev/sdm1 raid offset=0
LINK 'disk/by-uuid/0031-BFB7' /lib/udev/rules.d/60-persistent-storage.rules:93
LINK 'disk/by-label/PEN\x20JAGODA' /lib/udev/rules.d/60-persistent-storage.rules:94
LINK 'disk/by-partuuid/0031bfb7-01' /lib/udev/rules.d/60-persistent-storage.rules:101
update old name, '/dev/pendrive1' no longer belonging to '/devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3:1.0/host17/target17:0:0/17:0:0:0/block/sdm/sdm1'
no reference left, remove '/dev/pendrive1'
handling device node '/dev/sdm1', devnum=b8:193, mode=0600, uid=0, gid=0
preserve already existing symlink '/dev/block/8:193' to '../sdm1'
found 'b8:193' claiming '/run/udev/links/\x2fdisk\x2fby-id\x2fusb-Chipsbnk_UDisk_1209180932340324068700-0:0-part1'
creating link '/dev/disk/by-id/usb-Chipsbnk_UDisk_1209180932340324068700-0:0-part1' to '/dev/sdm1'
preserve already existing symlink '/dev/disk/by-id/usb-Chipsbnk_UDisk_1209180932340324068700-0:0-part1' to '../../sdm1'
found 'b8:193' claiming '/run/udev/links/\x2fdisk\x2fby-label\x2fPEN\x5cx20JAGODA'
creating link '/dev/disk/by-label/PEN\x20JAGODA' to '/dev/sdm1'
preserve already existing symlink '/dev/disk/by-label/PEN\x20JAGODA' to '../../sdm1'
found 'b8:193' claiming '/run/udev/links/\x2fdisk\x2fby-partuuid\x2f0031bfb7-01'
creating link '/dev/disk/by-partuuid/0031bfb7-01' to '/dev/sdm1'
preserve already existing symlink '/dev/disk/by-partuuid/0031bfb7-01' to '../../sdm1'
found 'b8:193' claiming '/run/udev/links/\x2fdisk\x2fby-path\x2fpci-0000:00:14.0-usb-0:3:1.0-scsi-0:0:0:0-part1'
creating link '/dev/disk/by-path/pci-0000:00:14.0-usb-0:3:1.0-scsi-0:0:0:0-part1' to '/dev/sdm1'
preserve already existing symlink '/dev/disk/by-path/pci-0000:00:14.0-usb-0:3:1.0-scsi-0:0:0:0-part1' to '../../sdm1'
found 'b8:193' claiming '/run/udev/links/\x2fdisk\x2fby-uuid\x2f0031-BFB7'
creating link '/dev/disk/by-uuid/0031-BFB7' to '/dev/sdm1'
preserve already existing symlink '/dev/disk/by-uuid/0031-BFB7' to '../../sdm1'
created db file '/run/udev/data/b8:193' for '/devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3:1.0/host17/target17:0:0/17:0:0:0/block/sdm/sdm1'
ACTION=-p
DEVLINKS=/dev/disk/by-uuid/0031-BFB7 /dev/disk/by-label/PEN\x20JAGODA /dev/disk/by-id/usb-Chipsbnk_UDisk_1209180932340324068700-0:0-part1 /dev/disk/by-path/pci-0000:00:14.0-usb-0:3:1.0-scsi-0:0:0:0-part1 /dev/disk/by-partuuid/0031bfb7-01
DEVNAME=/dev/sdm1
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3:1.0/host17/target17:0:0/17:0:0:0/block/sdm/sdm1
DEVTYPE=partition
ID_BUS=usb
ID_FS_LABEL=PEN_JAGODA
ID_FS_LABEL_ENC=PEN\x20JAGODA
ID_FS_TYPE=vfat
ID_FS_USAGE=filesystem
ID_FS_UUID=0031-BFB7
ID_FS_UUID_ENC=0031-BFB7
ID_FS_VERSION=FAT32
ID_INSTANCE=0:0
ID_MODEL=UDisk
ID_MODEL_ENC=UDisk\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_MODEL_ID=1234
ID_PART_ENTRY_DISK=8:192
ID_PART_ENTRY_FLAGS=0x80
ID_PART_ENTRY_NUMBER=1
ID_PART_ENTRY_OFFSET=64
ID_PART_ENTRY_SCHEME=dos
ID_PART_ENTRY_SIZE=15974336
ID_PART_ENTRY_TYPE=0xb
ID_PART_ENTRY_UUID=0031bfb7-01
ID_PART_TABLE_TYPE=dos
ID_PART_TABLE_UUID=0031bfb7
ID_PATH=pci-0000:00:14.0-usb-0:3:1.0-scsi-0:0:0:0
ID_PATH_TAG=pci-0000_00_14_0-usb-0_3_1_0-scsi-0_0_0_0
ID_REVISION=5.00
ID_SERIAL=Chipsbnk_UDisk_1209180932340324068700-0:0
ID_SERIAL_SHORT=1209180932340324068700
ID_TYPE=disk
ID_USB_DRIVER=usb-storage
ID_USB_INTERFACES=:080650:
ID_USB_INTERFACE_NUM=00
ID_VENDOR=Chipsbnk
ID_VENDOR_ENC=Chipsbnk
ID_VENDOR_ID=abcd
MAJOR=8
MINOR=193
PARTN=1
SUBSYSTEM=block
TAGS=:systemd:
USEC_INITIALIZED=2925158684
Unload module index
Unloaded link configuration context

Offline

 

#15 2018-02-27 21:18:53

morfik
Cenzor wirtualnego świata
Skąd: ze WSI
Zarejestrowany: 2011-09-15
Serwis

Re: Automount pamięci USB - Buster

Bo ty źle nazywasz pliki:

Kod:

Ignoring /etc/udev/rules.d/99-pendrive.rulesmy, because it's not a regular file with suffix .rules.
Ignoring /etc/udev/rules.d/99-pendrive.rulesforum, because it's not a regular file with suffix .rules.

One mają się kończyć na rules, a nie na rulesmy albo rulesforum. xD

Offline

 

#16 2018-02-28 22:17:37

rah606
Użytkownik
Zarejestrowany: 2018-02-24

Re: Automount pamięci USB - Buster

Absolutnie na to nie zwracaj uwagi, to celowo potworzone pliki jako bekapy. W logu widać że właściwy plik nie jest ignorowany.

Offline

 

#17 2018-03-01 13:53:44

morfik
Cenzor wirtualnego świata
Skąd: ze WSI
Zarejestrowany: 2011-09-15
Serwis

Re: Automount pamięci USB - Buster

Technicznie niby powinno działać:

Kod:

LINK 'pendrive1' /etc/udev/rules.d/99-pendrive.rules:4
RUN '/bin/mkdir /media/pendrive%n' /etc/udev/rules.d/99-pendrive.rules:4
RUN '/bin/mount /dev/pendrive%n /media/pendrive%n -o user,rw,sync,noexec,nosuid,nodev,shortname=mixed,umask=0000,utf8=1,showexec,flush' /etc/udev/rules.d/99-pendrive.rules:4

Offline

 

#18 2018-03-05 20:36:13

rah606
Użytkownik
Zarejestrowany: 2018-02-24

Re: Automount pamięci USB - Buster

No i niestety nie działa. Podrzucę tutaj swoje rozwiązanie jak zakończę - z bashem.

2018-03-15: no i zakończyłem.

Wykorzystuje dwa rules'y udeva: *-libmtp.rules (jest out of the box) oraz utworzony przeze mnie 99-masstorage.rules.

99-masstorage.rules:

Kod:

KERNEL=="sd[c-z][0-9]", SUBSYSTEMS=="usb", DRIVERS=="usb-storage", ACTION=="add", \
    SYMLINK+="extdisk%n", \
    RUN+="/bin/mkdir /media/extdisk%n"

KERNEL=="sd[c-z]", SUBSYSTEMS=="usb", DRIVERS=="usb-storage", ACTION=="add", ENV{ID_FS_USAGE} == "filesystem", \
    SYMLINK+="extdisk%n", \
    RUN+="/bin/mkdir /media/extdisk%n"

Oraz skrypty do montowania / odmontowania urządzeń - napisane w bashu.

Działa wyśmienicie.

Ostatnio edytowany przez rah606 (2018-03-15 19:58:44)

Offline

 

Stopka forum

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson
Nas ludzie lubią po prostu, a nie klikając w przyciski ;-)