You are not logged in.

#1 2016-10-31 09:49:51

rafdre
Member
From: Gdansk
Registered: 2013-09-21
Posts: 76

[SOLVED] auto mount does not work

Hello all,

I have issues to make auto-mount working.
When I plug in USB drive I can see the icon in my file maneger Nemo, but when I try to open the drive I see "Unable to mount location"

Here what "dmesg" shows me:

[   76.782615] usb-storage 3-1:1.0: USB Mass Storage device detected
[   76.782912] scsi host4: usb-storage 3-1:1.0
[   77.810189] scsi 4:0:0:0: Direct-Access              TS32MJFLASHA     1.00 PQ: 0 ANSI: 2
[   77.819520] sd 4:0:0:0: [sdc] 63200 512-byte logical blocks: (32.4 MB/30.9 MiB)
[   77.828848] sd 4:0:0:0: [sdc] Write Protect is off
[   77.828853] sd 4:0:0:0: [sdc] Mode Sense: 0b 00 00 08
[   77.838153] sd 4:0:0:0: [sdc] No Caching mode page found
[   77.838159] sd 4:0:0:0: [sdc] Assuming drive cache: write through
[   77.942631]  sdc: sdc1
[   77.970408] sd 4:0:0:0: [sdc] Attached SCSI removable disk

When I mount it as root using this command:
mount /dev/sdc1 /mnt/usb

all works fine. I can mount it without issues.
The same happens if I leave it during system start up. USB is mounted.

My user has not authorization to use "mount" command. I think this might be a reason.
In order to solve it I added to sudoers following lines;

command:

Cmnd_Alias MOUNT = /sbin/mount

privilage:

rafal ALL=(ALL) MOUNT

It does not work. I still can see error that only root can execute 'mount'

To give you a full picture what environment I am using, here details:
latests 64 bit archlinux (updated few days ago) - 4.8.4-1-ARCH
SLIM as display manager
Cinnamon as desktop manager

Here is my fstab:

# 
# /etc/fstab: static file system information
#
# <file system>    <dir>    <type>    <options>    <dump>    <pass>
# UUID=6315e9e8-d98b-4c7e-8ca8-b06026fe93f6
/dev/sdc1              /             ext4          rw,relatime,data=ordered    0 1
UUID=e342dd65-e657-4ccd-9203-1bc209fa9bf2         /dane        ext4         rw,relatime,data=ordered    0 1

How can I make automount working ?

regards
Rafal

Last edited by rafdre (2016-11-01 08:28:01)

Offline

#2 2016-10-31 13:36:24

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: [SOLVED] auto mount does not work

Automount is done by the file manager via udisk. The authorization is given by default for the local users by Polkit (see: https://wiki.archlinux.org/index.php/Polkit). For it to work, you should use a compatible display manager (I do not know for slim, you may try lightdm). You should not have an entry in fstab related to the disk, it won't work if you ave the fstab entry. The mount command is not used directly, so don't try to configure sudo for it. Now you have to configure your file manager accordingly.

It works for me with lightdm and the Thunar file manager. I need several optional dependencies for this (do pacman -Qi <your file manager> to check).

Last edited by olive (2016-10-31 13:38:14)

Offline

#3 2016-10-31 14:12:26

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,412
Website

Re: [SOLVED] auto mount does not work

For it to work, you should use a compatible display manager (I do not know for slim, you may try lightdm)

You're more likely to encounter issues with the logind session when using some display manager. Same for "maintained" ones such as lightdm or SDDM.

To check the session, follow:

https://wiki.archlinux.org/index.php/Ge … ermissions

Cmnd_Alias MOUNT = /sbin/mount

This is a bad idea, since now any user can trivially gain root priviledges by mounting a drive with suid files on them.

P.S. Use code tags, the post is already hard to read as it stands...

Last edited by Alad (2016-10-31 14:12:44)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#4 2016-10-31 16:35:07

rafdre
Member
From: Gdansk
Registered: 2013-09-21
Posts: 76

Re: [SOLVED] auto mount does not work

ok. I removed entries in sudoers

When I try udiskie I get following error

[rafal@localhost ~]$ udiskie
failed to mount /org/freedesktop/UDisks2/block_devices/sdc1: GDBus.Error:org.freedesktop.UDisks2.Error.Failed: Error mounting system-managed device /dev/sdc1: Command-line `mount "/"' exited with non-zero exit status 32: mount: wrong fs type, bad option, bad superblock on /dev/sdc1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

something similar with  devmon:

devmon: /usr/bin/udisksctl mount -b /dev/sdc1 -o "noexec,nosuid,nodev,noatime"    
Error mounting /dev/sdc1: GDBus.Error:org.freedesktop.UDisks2.Error.Failed: Error mounting system-managed device /dev/sdc1: Command-line `mount "/"' exited with non-zero exit status 32: mount: wrong fs type, bad option, bad superblock on /dev/sdc1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
devmon: error mounting /dev/sdc1 (1)

I have tried to do it with PolKit.
I have created the file /etc/polkit-1/rules.d/10-udisks.rules
and added there following lines:

polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.udisks2.filesystem-mount" &&
        subject.user == "rafal") {
        return "yes";
    }
});

I am not expert in it ;-), but my question is: shouldn't I see something here?

[rafal@localhost ~]$ pkaction
org.cinnamon.settings-daemon.plugins.power.backlight-helper
org.cinnamon.settings-daemon.plugins.wacom.wacom-led-helper
org.cinnamon.settings-users
org.cinnamon.settingsdaemon.datetimemechanism.configure
org.freedesktop.NetworkManager.checkpoint-rollback
org.freedesktop.NetworkManager.enable-disable-network
org.freedesktop.NetworkManager.enable-disable-statistics
org.freedesktop.NetworkManager.enable-disable-wifi
org.freedesktop.NetworkManager.enable-disable-wimax
org.freedesktop.NetworkManager.enable-disable-wwan
org.freedesktop.NetworkManager.network-control
org.freedesktop.NetworkManager.reload
org.freedesktop.NetworkManager.settings.modify.global-dns
org.freedesktop.NetworkManager.settings.modify.hostname
org.freedesktop.NetworkManager.settings.modify.own
org.freedesktop.NetworkManager.settings.modify.system
org.freedesktop.NetworkManager.sleep-wake
org.freedesktop.NetworkManager.wifi.share.open
org.freedesktop.NetworkManager.wifi.share.protected
org.freedesktop.RealtimeKit1.acquire-high-priority
org.freedesktop.RealtimeKit1.acquire-real-time
org.freedesktop.accounts.change-own-user-data
org.freedesktop.accounts.set-login-option
org.freedesktop.accounts.user-administration
org.freedesktop.color-manager.create-device
org.freedesktop.color-manager.create-profile
org.freedesktop.color-manager.delete-device
org.freedesktop.color-manager.delete-profile
org.freedesktop.color-manager.device-inhibit
org.freedesktop.color-manager.install-system-wide
org.freedesktop.color-manager.modify-device
org.freedesktop.color-manager.modify-profile
org.freedesktop.color-manager.sensor-lock
org.freedesktop.hostname1.set-hostname
org.freedesktop.hostname1.set-machine-info
org.freedesktop.hostname1.set-static-hostname
org.freedesktop.import1.export
org.freedesktop.import1.import
org.freedesktop.import1.pull
org.freedesktop.locale1.set-keyboard
org.freedesktop.locale1.set-locale
org.freedesktop.login1.attach-device
org.freedesktop.login1.flush-devices
org.freedesktop.login1.hibernate
org.freedesktop.login1.hibernate-ignore-inhibit
org.freedesktop.login1.hibernate-multiple-sessions
org.freedesktop.login1.inhibit-block-idle
org.freedesktop.login1.inhibit-block-shutdown
org.freedesktop.login1.inhibit-block-sleep
org.freedesktop.login1.inhibit-delay-shutdown
org.freedesktop.login1.inhibit-delay-sleep
org.freedesktop.login1.inhibit-handle-hibernate-key
org.freedesktop.login1.inhibit-handle-lid-switch
org.freedesktop.login1.inhibit-handle-power-key
org.freedesktop.login1.inhibit-handle-suspend-key
org.freedesktop.login1.lock-sessions
org.freedesktop.login1.manage
org.freedesktop.login1.power-off
org.freedesktop.login1.power-off-ignore-inhibit
org.freedesktop.login1.power-off-multiple-sessions
org.freedesktop.login1.reboot
org.freedesktop.login1.reboot-ignore-inhibit
org.freedesktop.login1.reboot-multiple-sessions
org.freedesktop.login1.set-reboot-to-firmware-setup
org.freedesktop.login1.set-self-linger
org.freedesktop.login1.set-user-linger
org.freedesktop.login1.set-wall-message
org.freedesktop.login1.suspend
org.freedesktop.login1.suspend-ignore-inhibit
org.freedesktop.login1.suspend-multiple-sessions
org.freedesktop.machine1.host-login
org.freedesktop.machine1.host-open-pty
org.freedesktop.machine1.host-shell
org.freedesktop.machine1.login
org.freedesktop.machine1.manage-images
org.freedesktop.machine1.manage-machines
org.freedesktop.machine1.open-pty
org.freedesktop.machine1.shell
org.freedesktop.policykit.example.pkexec.run-frobnicate
org.freedesktop.policykit.exec
org.freedesktop.systemd1.manage-unit-files
org.freedesktop.systemd1.manage-units
org.freedesktop.systemd1.reload-daemon
org.freedesktop.systemd1.reply-password
org.freedesktop.systemd1.set-environment
org.freedesktop.timedate1.set-local-rtc
org.freedesktop.timedate1.set-ntp
org.freedesktop.timedate1.set-time
org.freedesktop.timedate1.set-timezone
org.freedesktop.udisks2.ata-check-power
org.freedesktop.udisks2.ata-secure-erase
org.freedesktop.udisks2.ata-smart-enable-disable
org.freedesktop.udisks2.ata-smart-selftest
org.freedesktop.udisks2.ata-smart-simulate
org.freedesktop.udisks2.ata-smart-update
org.freedesktop.udisks2.ata-standby
org.freedesktop.udisks2.ata-standby-other-seat
org.freedesktop.udisks2.ata-standby-system
org.freedesktop.udisks2.cancel-job
org.freedesktop.udisks2.cancel-job-other-user
org.freedesktop.udisks2.eject-media
org.freedesktop.udisks2.eject-media-other-seat
org.freedesktop.udisks2.eject-media-system
org.freedesktop.udisks2.encrypted-change-passphrase
org.freedesktop.udisks2.encrypted-change-passphrase-system
org.freedesktop.udisks2.encrypted-lock-others
org.freedesktop.udisks2.encrypted-unlock
org.freedesktop.udisks2.encrypted-unlock-crypttab
org.freedesktop.udisks2.encrypted-unlock-other-seat
org.freedesktop.udisks2.encrypted-unlock-system
org.freedesktop.udisks2.filesystem-fstab
org.freedesktop.udisks2.filesystem-mount
org.freedesktop.udisks2.filesystem-mount-other-seat
org.freedesktop.udisks2.filesystem-mount-system
org.freedesktop.udisks2.filesystem-unmount-others
org.freedesktop.udisks2.loop-delete-others
org.freedesktop.udisks2.loop-modify-others
org.freedesktop.udisks2.loop-setup
org.freedesktop.udisks2.manage-md-raid
org.freedesktop.udisks2.manage-swapspace
org.freedesktop.udisks2.modify-device
org.freedesktop.udisks2.modify-device-other-seat
org.freedesktop.udisks2.modify-device-system
org.freedesktop.udisks2.modify-drive-settings
org.freedesktop.udisks2.modify-system-configuration
org.freedesktop.udisks2.open-device
org.freedesktop.udisks2.open-device-system
org.freedesktop.udisks2.power-off-drive
org.freedesktop.udisks2.power-off-drive-other-seat
org.freedesktop.udisks2.power-off-drive-system
org.freedesktop.udisks2.read-system-configuration-secrets
org.freedesktop.udisks2.rescan
org.gnome.gconf.defaults.set-mandatory
org.gnome.gconf.defaults.set-system
org.gnome.settings-daemon.plugins.power.backlight-helper
org.gnome.settings-daemon.plugins.wacom.wacom-led-helper
org.gnome.settings-daemon.plugins.wacom.wacom-oled-helper
org.nemo.root
org.x.xf86-video-intel.backlight-helper
org.xfce.thunar

I would expect there: org.freedesktop.udisks2.filesystem-mount , but could not see it.

Here next check

[rafal@localhost ~]$ pkaction --verbose --action-id org.freedesktop.udisks2.filesystem-mount
org.freedesktop.udisks2.filesystem-mount:
  description:       Mount a filesystem
  message:           Authentication is required to mount the filesystem
  vendor:            The udisks Project
  vendor_url:        http://udisks.freedesktop.org/
  icon:              drive-removable-media
  implicit any:      auth_admin
  implicit inactive: auth_admin
  implicit active:   yes

Last edited by rafdre (2016-10-31 16:36:47)

Offline

#5 2016-10-31 16:45:53

rafdre
Member
From: Gdansk
Registered: 2013-09-21
Posts: 76

Re: [SOLVED] auto mount does not work

sorry
org.freedesktop.udisks2.filesystem-mount  is listed

the question is why it does not work ?

Offline

#6 2016-10-31 17:17:50

rafdre
Member
From: Gdansk
Registered: 2013-09-21
Posts: 76

Re: [SOLVED] auto mount does not work

I have now switched to GDM but same results, so I think its not related to SLIM

I think I know why there are strange errors about 'wrong fs type'...etc.

I have PC which has two hard disks.
One is SSD (mSATA) and one is simple disk with SATA.

As you can see below the command "lsblk -f"  provides the information about the disk structure.

[root@localhost rafal]# lsblk -f
NAME   FSTYPE LABEL UUID                                 MOUNTPOINT
sdb                                                      
├─sdb2                                                   
├─sdb5 ext4         662b803a-ae89-4bd6-bc15-7f6ed4236a0d 
└─sdb1 ext4         6315e9e8-d98b-4c7e-8ca8-b06026fe93f6 /
sdc                                                      
└─sdc1 vfat         E476-5E4A                            
sda                                                      
├─sda2 ext4   dane  e342dd65-e657-4ccd-9203-1bc209fa9bf2 /dane
├─sda3 vfat         0613-FBAC                            
└─sda1 ext4         8c38f128-5fb0-4824-b366-dc1687bac405 

and here once again my /etc/fstab

[root@localhost rafal]# cat /etc/fstab
# 
# /etc/fstab: static file system information
#
# <file system>	<dir>	<type>	<options>	<dump>	<pass>
# UUID=6315e9e8-d98b-4c7e-8ca8-b06026fe93f6
/dev/sdc1          	/         	ext4      	rw,relatime,data=ordered	0 1
UUID=e342dd65-e657-4ccd-9203-1bc209fa9bf2 		/dane		ext4 		rw,relatime,data=ordered	0 1

as you can see the entry in fstab says that root directory is on sdc1, but here this is not true. It is sdb1.
Nevertheless system boots without issues.

Here one additional information : actually grub is used from another partition - sdb5 - on which Debian is installed.
I wanted not to switch off my debian before I am sure archlinux is customizined accorind to my needs. Thats why I use GRUB from Debian which is installed on same PC.

Maybe I am wrong , but I think strange errors with mount come from the fact that mount migth check entries in fstab, so it expects ext4 partition. it is fat32, so probably that why the whole thing is not working.
USB which I plug in is detected as sdc1.

I tried to use UUID in my fstab, but is somehow didn't worked correctly.

what is you opinion on it?
how can I correct my fstab to make it better.

eventually I can install GRUB on Archlinux, since now it will become my main system on this PC.

Offline

#7 2016-10-31 19:54:56

cirrus
Member
From: Glasgow Scotland
Registered: 2012-08-24
Posts: 340
Website

Re: [SOLVED] auto mount does not work

Make sure mountpoints have relevant permissions, edit fstab accordingly (the wiki: fstab has a template fstab file) also remove that line from /etc/sudoers.
(As the filesystem is ext4 then fstab entry will be simple)
Should look similar to ..

UUID=d17b3219-a43d-4c38-b9cd-0ad892fa9d6e /mnt/foo ext4 defaults 0 0

Find the drives UUID by running

lsblk -f

Meh mybad i see first post mentions USB sticks. Please disregard this post, its mainly for automounting internal HDD & not USB.
Sorry for the  noise
Good Luck.

Last edited by cirrus (2016-10-31 20:09:40)

Offline

#8 2016-11-01 08:25:02

rafdre
Member
From: Gdansk
Registered: 2013-09-21
Posts: 76

Re: [SOLVED] auto mount does not work

@cirrus: I know lsblk ...otherwsie I will not list it in my post before ;-)

The issue with automount is solved now. I was looking for solution at the wrong place.
The issue was not with proper authorization, but it was caused by wrong entry in /etc/fstab
The whole time when after auto mount system tried to mount new drive it failed ( mount: wrong fs type, bad option, bad superblock)
This means wrong entry in fstab was considered (/dev/sdc1 was defined there as ext4 but my USB was using fat32)
Strange is that it was considered by devmon or udidkie, but not when I mounted drive as root (using simple 'mount /dev/sdc1 /mnt/usb')

Offline

#9 2016-11-01 08:30:50

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: [SOLVED] auto mount does not work

@rafdre. The mount command consider the entry in fstab only if you do not specify the device, for example mount /mnt/usb. If you explicitly tell the device, then it is considered a complete mount command. For automount to work properly, you should not have an entry on the fstab.

Offline

Board footer

Powered by FluxBB