You are not logged in.

#1 2021-06-09 14:04:21

zilverling
Member
From: Bennekom, Netherlands
Registered: 2009-08-19
Posts: 78

[SOLVED] Want to automount ereader rw as normal user, but it mounts ro

I don't know how/why this happens, but I can only write stuff to my ereader when I connect to it (via USB cable) when logged in as root.

If I check /proc/mounts in that situation it says:

/dev/sdb /run/media/root/READER vfat rw,nosuid,nodev,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro 0 0

If I connect the device when logged in as 'normal user', I only have read permissions to the ereader. Even when I su, I still cannot access it.
In this situation /proc/mounts in that situation /proc/mounts looks like this:

/dev/sdb /run/media/erik/READER vfat ro,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro 0 0

How does this come about and what do I need to do to get write permissions when connecting while being logged in as 'normal user'?

Last edited by zilverling (Yesterday 08:19:04)

Offline

#2 2021-06-09 14:12:00

seth
Member
Registered: 2012-09-03
Posts: 21,074

Re: [SOLVED] Want to automount ereader rw as normal user, but it mounts ro

errors=remount-ro

=> monitor "dmesg -w" while mounting as user, are there any errors?

You could have a convincing fstab entry (eg. matching the label), complete w/ users,x-systemd.automount, that tells udisks where to mount it how.
But that won't help if it's a bail-on-error read only mount.

Offline

#3 2021-06-09 15:34:54

zilverling
Member
From: Bennekom, Netherlands
Registered: 2009-08-19
Posts: 78

Re: [SOLVED] Want to automount ereader rw as normal user, but it mounts ro

dmesg -w output when I connect the device via USB (and choose data exchange mode on the Sony PRS-T1:

[   81.652069] usb 1-5.1: new high-speed USB device number 9 using xhci_hcd
[   81.737532] usb 1-5.1: New USB device found, idVendor=054c, idProduct=05c2, bcdDevice= 2.26
[   81.737567] usb 1-5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   81.737584] usb 1-5.1: Product: Sony Digital Book Reader
[   81.737597] usb 1-5.1: Manufacturer: Sony
[   81.737608] usb 1-5.1: SerialNumber: 148427511937883
[   81.781453] usb-storage 1-5.1:1.0: USB Mass Storage device detected
[   81.782887] scsi host2: usb-storage 1-5.1:1.0
[   81.783111] usbcore: registered new interface driver usb-storage
[   81.791232] usbcore: registered new interface driver uas
[   82.788454] scsi 2:0:0:0: Direct-Access     Sony     PRS-T1           2001 PQ: 0 ANSI: 2
[   82.789945] scsi 2:0:0:1: Direct-Access     Sony     PRS-T1  SD       2001 PQ: 0 ANSI: 2
[   82.791768] scsi 2:0:0:2: Direct-Access     Sony     PRS-T1  Setting  2001 PQ: 0 ANSI: 2
[   82.794747] sd 2:0:0:0: Power-on or device reset occurred
[   82.803094] sd 2:0:0:1: Power-on or device reset occurred
[   82.809083] sd 2:0:0:2: Power-on or device reset occurred
[   82.818231] sd 2:0:0:0: [sdb] Attached SCSI removable disk
[   82.824242] sd 2:0:0:2: [sdd] Attached SCSI removable disk
[   82.830163] sd 2:0:0:1: [sdc] Attached SCSI removable disk
[   87.091265] sd 2:0:0:0: [sdb] 2958976 512-byte logical blocks: (1.51 GB/1.41 GiB)
[   87.095956] sd 2:0:0:2: [sdd] 20528 512-byte logical blocks: (10.5 MB/10.0 MiB)
[   87.098122] sd 2:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   87.098138] sdb: detected capacity change from 0 to 2958976
[   87.100562] sd 2:0:0:2: [sdd] Write Protect is on
[   87.100574] sd 2:0:0:2: [sdd] Mode Sense: 0f 00 80 00
[   87.102824] sdd: detected capacity change from 0 to 20528
[   87.108330]  sdb:
[   87.111966]  sdd:

Two directories show up in Thunar after connecting: READER and SETTING. I assume these are related to /dev/sdb and /dev/sdd respectively.

After I open the READER directory via Thunar, dmesg -w generates:

[  316.730865] FAT-fs (sdb): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[  316.774551] FAT-fs (sdb): error, corrupted directory (invalid entries)
[  316.774562] FAT-fs (sdb): Filesystem has been set read-only
[  316.777565] FAT-fs (sdb): error, corrupted directory (invalid entries)
[  316.801177] FAT-fs (sdb): error, corrupted directory (invalid entries)
[  316.805964] FAT-fs (sdb): error, corrupted directory (invalid entries)

When I run sudo fsck /dev/sdb, I get:

[erik@celaeno ~]$ sudo fsck /dev/sdb
[sudo] password for erik: 
fsck from util-linux 2.37
fsck.fat 4.2 (2021-01-31)
There are differences between boot sector and its backup.
This is mostly harmless. Differences: (offset:original/backup)
  65:01/00
1) Copy original to backup
2) Copy backup to original
3) No action
[123?q]?

For now I chose option 3.

Does this output provide any further clues?

Offline

#4 2021-06-09 15:53:15

seth
Member
Registered: 2012-09-03
Posts: 21,074

Re: [SOLVED] Want to automount ereader rw as normal user, but it mounts ro

Yes, the filesystem is "corrupt" (likely unclean disconnect, ie. you unplugged it w/o unmouting it first)
You'll have to fix that by chosing one of the boot sectors, ie. chose "1" (in theory this can lead to limited data loss on the device, but the unclean disconnect would have caused some data corruption anyway then - and usually it's harmless)

The device should™ mount rw afterwards. Ensure that the device is ***NOT MOUNTED*** while running fsck.

Offline

#5 2021-06-10 09:35:07

zilverling
Member
From: Bennekom, Netherlands
Registered: 2009-08-19
Posts: 78

Re: [SOLVED] Want to automount ereader rw as normal user, but it mounts ro

I did fsck /dev/sdb and chose option 1, but unfortunately the error remains and the reader still mounts ro for normal user.

Also, I find it strange that when logged in as root on my Arch system, the reader mounts rw just like that...

[erik@celaeno media]$ sudo fsck /dev/sdb
fsck from util-linux 2.37
fsck.fat 4.2 (2021-01-31)
There are differences between boot sector and its backup.
This is mostly harmless. Differences: (offset:original/backup)
  65:01/00
1) Copy original to backup
2) Copy backup to original
3) No action
[123?q]? 1
Got 1317888 bytes instead of 1476592 at 1496064

Offline

#6 2021-06-10 13:10:12

seth
Member
Registered: 2012-09-03
Posts: 21,074

Re: [SOLVED] Want to automount ereader rw as normal user, but it mounts ro

that when logged in as root on my Arch system

Do you use thunar there as well? (Implication is: please don't)

And what does "dmesg -w" tell you in this case?

Offline

#7 Yesterday 08:15:59

zilverling
Member
From: Bennekom, Netherlands
Registered: 2009-08-19
Posts: 78

Re: [SOLVED] Want to automount ereader rw as normal user, but it mounts ro

I finally resolved the issue, after investigating dmesg messages displayed when connecting the device when logged in as root and as normal user.

So the solution proved to be to login as root on my arch linux system, make sure that the device was unmounted and fsck the device. For some reason, when logged in as root, fsck does work properly, whereas when I tried sudo fsck as normal user it didn't. When logged in as root, fsck enabled me (after chosing option 1), to remove a dirty bit and resolve some memory issues. After logging out as root and logging in again as normal user, the device mounted rw and Calibre recognised the device automatically.

Issue solved.

Many thanks for the continued attention that you gave to my issue and for your useful suggestions.

Offline

#8 Yesterday 13:20:20

seth
Member
Registered: 2012-09-03
Posts: 21,074

Re: [SOLVED] Want to automount ereader rw as normal user, but it mounts ro

I suspect that something™ in your regular account (tries to) automount or otherwise access the device - otherwise there's no good reason why "sudo fsck" or "su; fsck" should behave differently from a root session shell.

Offline

Board footer

Powered by FluxBB