Issues with hard drive mounting & deluged permissions to write

Hi all,

I’m trying to get a USB hard drive mounted and writeable by deluged (installed through apt-get).

The Hard Drive is ext4 (although for some reason fdisk thinks it’s exfat - it isn’t!), and was previously mounted on my router. The router has been playing up so I’ve moved it to the Raspberry Pi.

When the drive auto-mounts, it mounts with a ridiculously long name in the /media folder (5df93hnfs0-f98nf489-sf98bn4sf or similar) and I can’t work out how rename it.

I can manually mount the drive to /mnt/usb using fstab, where it is accessible through OSMC and ssh, but can’t work out how to give deluged write permissions, in either scenario (in /media or /mnt) I have tried changing the deluge-daemon username to osmc with no success.

All help appreciated!

To rename an ext4 drive you want to use e2label.

sudo umount /media/57awefawef868awef68w
sudo e2label /dev/sda1 "Disk Name"

Replace the letters and numbers with what you have and sda1 with the correct partition node.

To be able to write to an ext4 partition as the osmc user you may need to add group and other write permission on the root directory of the drive. So for example if the drive is (after naming it) mounting at /media/MyDrive to set rwx permissions for user/group/other you would do:

sudo chmod a+rwx /media/MyDrive

You should only need to do this once.

That string looks like the drive’s UUID. It can be used to mount the drive but it’s easier to use the device id (/dev/sdb1/ for example).

You may also have to take ownership of the files on the drive. Something like

$ sudo chown -R osmc.osmc /mnt/usb/

Udisks will mount a drive under it’s volume name if it has one, if not, it will use the UUID which is a long string of letters and numbers…

We are working some improvements to the automounter so that it shouldn’t be necessary to manually mount an external drive.

I’ve identified a couple of issues from these threads:

  1. FAT32 and NTFS drives are currently mounted in mode 0700. This means only root and the osmc user can access them - any software (such as some daemons) that use a different unprivileged user would not be able to access FAT32 or NTFS partitions.

  2. EXFAT partitions currently mount as owned by root with 0755 permissions. Despite this normal users can write to the disk but any application that checks permissions explicitly (instead of just trying to write) may be confused and believe it can’t write to it. This affects the ftp server and samba without force user = root, and possibly other programs.

I have a usb drive connected to my pi 2 with osmc. When I try run transmission daemon, I get permission errors. Will setting the user to root or osmc in these two files (/lib/systemd/system/transmission-daemon.service and /etc/init.d/transmission-daemon) give the daemon permission to write to my usb drive? Thanks.

1 Like

What file system is the external drive and what are the specific errors you’re seeing ?

Check this topic
https://discourse.osmc.tv/t/solved-i-cant-get-tranmission-to-work/1309/10

everything gets automounted in /Media

You want I assume a fixed mount
This explains also how How To Mount A USB Flash Disk On The Raspberry Pi - Raspberry Pi Spy
(it only skips one thing in our OSMC case, you need to unmount it from media first)

Shouldn’t be necessary.

I’m pretty sure it’s ntfs format and the error I’m getting now is:

403: Forbidden
Unauthorized IP Address.
Either disable the IP address whitelist or add your address to it.
If you’re editing settings.json, see the ‘rpc-whitelist’ and ‘rpc-whitelist-enabled’ entries.

It was all working fine until I had to reset the pi.
I had stopped the transmission daemon when editing the json file and the other two.

Hi @DBMandrake

has this been solved until now? I have a exFAT or fat32 formatted drive attached and I randomly get permission errors on when writing / deleting stuff via ssh and samba access. Please have a look at my GitHub issue. Permission error for samba share · Issue #225 · osmc/osmc · GitHub

Do you think these errors will be solved by formatting the drive to ext4 or changing the auto mount path to something else than /media/drivename? Thanks!

I can answer the 2nd part of your question, anyway. I have my external hard drive mounted in /mnt/ but I don’t think that makes much difference.

However, I also have it formatted as ext4 and I’ve never had any permission issues. Ext4 is much more compatible with linux (OSMC). I think you should give it a shot if you’re able.

Has what been solved ?

I’m not currently aware of an issue where drive permissions are wrong, the issue we are aware of is drives sometimes not mounting at all. But if they do mount the permissions should be correct.

If the drive is exfat we would need to see more info such as:

ls -al /media
sudo journalctl | paste-log

BTW it’s probably not worth spending too much effort trying to figure this bug out because we are planning to scrap udisks/udisks-glue (the current automounter system) completely due to various issues with it we have encountered, some of which are not fixable, and start fresh using udevil/devmon. Work on this is well advanced and we are hoping to get this into the next monthly update.

It has taken a bit longer than we hoped for as in the process we have had to fix bugs in Kodi’s udev storage provider to get it working properly with udevil. (Previously Kodi was using the udisks storage provider)

1 Like

Thanks a lot bot @Katze and @DBMandrake for your replies.

I just formatted the exFat drive to ext4 so I’m afraid I currently can’t give you the info given by the two commands. But what I can do is reporting back if using ext4 solves my problems.

BTW how can the auto-mounting feature be disabled?

To completely disable it you could do:

sudo systemctl mask udisks udisks-glue

There shouldn’t be any real need to disable it however, because if you mount a drive manually in /etc/fstab udisks will not try to automount it.

Ah I see, thanks a lot!

The error hasn’t occurred again yet but I will update my post if so.

Update: it’s been a couple of days and I can certainly say that the problems have been solved by reformatting the drive. Thanks for the help!