You are not logged in.
I have managed to mount usb memory automatically by adding two files to udev.rules:
[root@archdev rules.d]# pwd
/etc/udev/rules.d
[root@archdev rules.d]# ls
11-media-by-label-auto-mount.rules 11-sd-cards-auto-mount.rules
I got them from my arch linux arm installation, from package udev-automount.
This is what they look like:
[root@archdev rules.d]# cat 11-media-by-label-auto-mount.rules
KERNEL!="sd[a-z][0-9]", GOTO="media_by_label_auto_mount_end"
PROGRAM="/usr/bin/grep -q ' %M:%m /[^ ]* /' /proc/self/mountinfo", PROGRAM!="/usr/bin/grep -q ' %M:%m / /media/' /proc/self/mountinfo", GOTO="media_by_label_auto_mount_end"
# Import FS infos
IMPORT{program}="/sbin/blkid -o udev -p %N"
# Get a label if present, otherwise specify one
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="hd-%k"
# Global mount options
ACTION=="add", ENV{mount_options}="noatime"
# Filesystem-specific mount options
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002"
# Mount the device
ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/%E{dir_name}"
# Clean up after removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"
# Exit
LABEL="media_by_label_auto_mount_end"
root@archdev rules.d]# cat 11-sd-cards-auto-mount.rules
KERNEL!="mmcblk[0-9]p[0-9]", GOTO="sd_cards_auto_mount_end"
PROGRAM="/usr/bin/grep -q ' %M:%m /[^ ]* /' /proc/self/mountinfo", PROGRAM!="/usr/bin/grep -q ' %M:%m / /media/' /proc/self/mountinfo", GOTO="sd_cards_auto_mount_end"
# Global mount options
ACTION=="add", ENV{mount_options}="relatime"
# Filesystem specific options
ACTION=="add", IMPORT{program}="/sbin/blkid -o udev -p %N"
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002"
ACTION=="add", RUN+="/bin/mkdir -p /media/sd-%k", RUN+="/bin/ln -s /media/sd-%k /mnt/sd-%k", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/sd-%k"
ACTION=="remove", RUN+="/bin/umount -l /media/sd-%k", RUN+="/bin/rmdir /media/sd-%k"
LABEL="sd_cards_auto_mount_end"
I believe that the usb device is mounted by 11-media-by-label-auto-mount.rules.
The mounted usb stick:
[root@archdev rules.d]# mount | grep sdb1
/dev/sdb1 on /media/STORE_N_GO type vfat (rw,noatime,gid=100,fmask=0002,dmask=0002,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
Properties of the device:
[root@archdev rules.d]# ls -al /dev/sdb1
brw-rw---- 1 root disk 8, 17 7 sep 12.26 /dev/sdb1
Properties of the mounted device:
[root@archdev rules.d]# ls -al /media/STORE_N_GO/
totalt 20
drwxrwxr-x 3 root users 8192 1 jan 1970 .
drwxr-xr-x 3 root root 4096 7 sep 12.26 ..
drwxrwxr-x 2 root users 8192 6 sep 17.29 katalog
My groups:
[more10@archdev ~]$ groups
root bin daemon adm disk lp wheel games video audio optical storage scanner power users sudo
I cannot unmount the usb stick:
[more10@archdev ~]$ umount /media/STORE_N_GO
umount: /media/STORE_N_GO: umount failed: Operationen inte tillåten
There is nothing regarding mount/umount in /var/log.
What do I need to do in order to get umount to work as user?
Offline
Have you seen this thread? https://bbs.archlinux.org/viewtopic.php?pid=725983
I see from this post that you removed ck-launch-session from your .xinitrc file. Can you put it back and see if it solves your problem? Otherwise I think tweaking your /etc/fstab file might do the trick as far as mounting/unmounting as regular user goes.
More reading:
https://wiki.archlinux.org/index.php/Fstab
https://wiki.archlinux.org/index.php/US … with_fstab
N.b. I'm not an experienced user by any means, you might want to wait for veteran archers to pitch in.
"The problem is, after a week of intense googling, we’ve started to burn out on knowing the answer to everything. God must feel that way all the time. I think people in the year 2020 are going to be nostalgic for the sensation of feeling clueless." Douglas Coupland - jPod
Offline
Thanks for your help ximun.
I believe that ck-launch-session was executed twice, thats why I removed it from .xinitrc.
I did try to unmount through Pcmanfm, it says "Authentication is required to unmount /dev/sdb1 mounted by another user". This seems to be a logical explanation since udev mounts it as root.
Offline
I used to use similar rules, but with pmount instead of mount - that allowed me to use pumount as user for unmounting.
These days, I use udiskie for this, and I would recommend it, unless you have some objection to using udisks.
Offline