You are not logged in.

#1 2014-06-06 04:28:45

mindstalk
Member
Registered: 2014-05-16
Posts: 23

trouble mounting USB as user, or user-writable as root [solved]

Not sure if this is the right forum.

So I've got an SD card reader, and I can mount it as root, read-writable by root.  But as a user I can't write to it.

My fstab line is (and yes, it's ext4, I just formatted it)
/dev/sdb1      /mnt/usb        ext4    user,rw,noauto,noatime,flush 0 0

[solved -- mount didn't like 'flush', and just use 'mount /mnt/usb']

Despite the 'user' there, when I mount it, I get permission denied.  This wasn't true when the SD card was exfat instead of ext4.

The wiki suggests ( https://wiki.archlinux.org/index.php/US … ge_Devices )
sudo mount -o gid=users,fmask=113,dmask=002 /dev/sdb1 /mnt/usb
but that yields
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error

dmesg | tail yields

[1809028.816748]  sdb: sdb1
[1809773.022117] EXT4-fs (sdb1): Unrecognized mount option "gid=100" or missing value
[1809804.085232] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)
[1809825.184347] EXT4-fs (sdb1): Unrecognized mount option "gid=100" or missing value
[1809872.937645] EXT4-fs (sdb1): Unrecognized mount option "gid=100" or missing value
[1809889.322033] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)
[1810043.908498] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)
[1810207.996065] EXT4-fs (sdb1): Unrecognized mount option "gid=100" or missing value

I *can* write the card after chgrping it to group 'wheel' (which I'm in, not actually in 'users', and making it group writeable, but is that actually the best solution?)  And even with that, I can't umount as user:

[Zefiris:0] umount /mnt/usb             
umount: /mnt/usb: umount failed: Operation not permitted

or mount
[Zefiris:0] mount /dev/sdb1 /mnt/usb     
mount: only root can do that

Isn't 'user' in fstab supposed to let users mount things?


My main drive in fstab is
# /dev/sda3
UUID=c89fc4c3-d982-448b-b31c-92b6d1328430       /               ext4            defaults,relatime,data=ordered  0 1

can you not mix and match line formats?  Even when I use a UUID line for /mnt/usb, I still can't mount it.

Last edited by mindstalk (2014-06-11 16:42:26)

Offline

#2 2014-06-06 04:57:30

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,804

Re: trouble mounting USB as user, or user-writable as root [solved]

Did you create a partition table, then create a single partition on /dev/sdb1, then use mkfs to create an ext4 file system?  This is what your fstab tells me.
Or did you create an ext4 file system on /dev/sdb ?  If so, your fstab is wrong.

But, There is also something else going on:
That GID=100 stuff tells me that udev and udisk are trying to auto mount it and are trying to treat it as a fat partition

Last edited by ewaller (2014-06-06 04:57:48)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2014-06-06 06:03:45

mindstalk
Member
Registered: 2014-05-16
Posts: 23

Re: trouble mounting USB as user, or user-writable as root [solved]

I didn't create a partition table, I just formatted /dev/sdb1 with mkfs.ext4

[Zefiris:0] lsblk -f
NAME   FSTYPE LABEL       UUID                                 MOUNTPOINT
sda                                                            
├─sda1 vfat   DellUtility 26A6-34DD                            
├─sda2 vfat   OS          35C4-ADBA                            
├─sda3 ext4               c89fc4c3-d982-448b-b31c-92b6d1328430 /
├─sda4                                                         
└─sda5 swap               8d70ad11-caea-4ccf-8108-1bfa8dbf6ccd [SWAP]
sdb                                                            
└─sdb1 ext4               5c1fd23a-03d9-49ef-8801-24b0715dd1b2 
sr0  

Group users is GID 100.

There is a
root       159     1  0 May16 ?        00:00:01 /usr/lib/systemd/systemd-udevd
No process with udisk in the name.

Nothing of obvious interest in /etc/udev/

Last edited by mindstalk (2014-06-06 06:54:31)

Offline

#4 2014-06-06 06:44:16

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: trouble mounting USB as user, or user-writable as root [solved]

Please use code tags when pasting to the boards https://wiki.archlinux.org/index.php/Fo … s_and_Code


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2014-06-11 03:40:37

fungle
Member
Registered: 2014-05-01
Posts: 81

Re: trouble mounting USB as user, or user-writable as root [solved]

Is there a reason why your SD card is ext4 instead of fat? The user option only allows non-root users to mount the device which is not the same thing as allowing users to have rwx permissions on the mount point. The -o gid, fmask, dmask options are only for fat filesystems which is why it's failing. You need to use sudo chown /mnt/usb/ or mount the device in a directory owned by you like $HOME/usb.

Offline

#6 2014-06-11 03:55:47

mindstalk
Member
Registered: 2014-05-16
Posts: 23

Re: trouble mounting USB as user, or user-writable as root [solved]

I reformatted the card to ext4 so that filenames (mostly CD tracks) with Unix-permitted characters could get copied over properly.

Thanks on the options.  But I still can't mount the card as a user.  "Only root can do that".

[Zefiris:0] mount /dev/sdb1 /mnt/usb
mount: only root can do that


drwxrwxrwx 2 root root 4096 Apr 30 20:09 /mnt/usb/

[/etc/fstab]
/dev/sdb1       /mnt/usb        ext4    user,rw,noauto,noatime,flush 0 0

Offline

#7 2014-06-11 07:15:09

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,763
Website

Re: trouble mounting USB as user, or user-writable as root [solved]

mindstalk wrote:

I didn't create a partition table, I just formatted /dev/sdb1 with mkfs.ext4

Maybe create a partition table, then format it?

Offline

#8 2014-06-11 15:56:12

mindstalk
Member
Registered: 2014-05-16
Posts: 23

Re: trouble mounting USB as user, or user-writable as root [solved]

Head_on_a_Stick wrote:
mindstalk wrote:

I didn't create a partition table, I just formatted /dev/sdb1 with mkfs.ext4

Maybe create a partition table, then format it?

How would that help?  The card is mountable and usable, it's just not mountable *as a user*.

Offline

#9 2014-06-11 16:34:07

ukhippo
Member
From: Non-paged pool
Registered: 2014-02-21
Posts: 366

Re: trouble mounting USB as user, or user-writable as root [solved]

Have you tried just doing “mount /mnt/usb” or “mount /dev/sdb1”? By explicitly specifying both dev and dir on your mount command, mount ignores fstab. To use fstab just give either dev or dir, not both.

Offline

#10 2014-06-11 16:40:38

mindstalk
Member
Registered: 2014-05-16
Posts: 23

Re: trouble mounting USB as user, or user-writable as root [solved]

Hmm.

[Zefiris:0] mount /mnt/usb
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
[Zefiris:32] mount /dev/sdb1
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
[Zefiris:32] sudo mount /mnt/usb
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
[Zefiris:32] sudo mount /dev/sdb1
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
[Zefiris:32] sudo mount /dev/sdb1 /mnt/usb
[Zefiris:0] 

from dmesg: [2286524.389750] EXT4-fs (sdb1): Unrecognized mount option "flush" or missing value

So I edited flush out... and now it mounts:

[Zefiris:0] mount /mnt/usb
[Zefiris:0]

That feels anticlimactic.  Thank you!

(Now to figure out why most of my Cyanogen filesystem is mounted ro, but that's for another forum...)

Last edited by mindstalk (2014-06-11 16:41:28)

Offline

Board footer

Powered by FluxBB