Forum
usb0 Fat32 drive owned by root - read only - Printable Version

+- Forum (http://forum.xbian.org)
+-- Forum: Software (/forum-6.html)
+--- Forum: Configuration (/forum-17.html)
+--- Thread: usb0 Fat32 drive owned by root - read only (/thread-42.html)



usb0 Fat32 drive owned by root - read only - rhwaugh - 14th Dec, 2012 12:39 PM

Hello, I am new to LINUX so please excuse my ignorance - I'm only being so forward as to post because I am trying to configure a PI as a Christmas Present and am running out of time! (And if you are wondering, I'm going with the Alpha/Frodo version because it has better Karaoke support.)

I am using Alpha 3 and the attached fat32 usb drive is owned by root:root which, as I understand it, means that the xbian user cannot write to it. I noticed this when trying to run the XBMC backup settings addon targeted at the usb drive. The xbmc log file returns an error when trying to make directories. It is the same for the xbian user on ssh.

I am guessing that this is an oversight and not the desired default behavior?

Apologies if this is already a known issue - I did spend an age trying to find an xbian reference to the problem, but couldn't see anything. There's obviously advice out there in the ether about how to mount drives, but if I attempt my own fix it won't last past the next install.

Rachel


RE: usb0 Fat32 drive owned by root - read only - DraZtiK - 14th Dec, 2012 12:55 PM

login via ssh
# sudo chmod 0777 -R /media/usb*
should do it. there are other ways depending on what you are trying to accomplish.


RE: usb0 Fat32 drive owned by root - read only - rhwaugh - 14th Dec, 2012 06:53 PM

(14th Dec, 2012 12:55 PM)DraZtiK Wrote:  login via ssh
# sudo chmod 0777 -R /media/usb*
should do it. there are other ways depending on what you are trying to accomplish.

Thanks for the quick reply.

I thought that your fix was working this morning, but it turns out that after only three hours sleep I had forgotten that I had removed the usb flash drive, and so media/usb wasn't mapped to the relevant Fat32 usb drive! [I need to find out where it was mapping to on the SD card so I can remove those test directories!]

So the sudo chmod doesn't work.

I was sudo chmoding and chowning my little heart out yesterday before posting, but to no avail: couldn't change usb0 from drwxr-xr-x root:root. Chown comes back with "Operation not permitted". I get the idea from other posts that the permissions are being ignored because Fat32 isn't set up for linux permissions, and the question of who can read or write to the drive comes down to a question of ownership at the time when the drive is mounted.

Any other thoughts?

Thanks again,

Rachel


RE: usb0 Fat32 drive owned by root - read only - CurlyMo - 14th Dec, 2012 09:42 PM

Can you try:

*This is a single (one line) command*
Code:
sudo sed -i 's/FS_MOUNTOPTIONS="dmask=0777,fmask=0777"/FS_MOUNTOPTIONS="uid=xbian,gid=xbian,dmask=0777,fmask=0777"/g' /etc/usbmount/usbmount.conf

This should make all usb drives not only read/writable/executable but also owned by xbian:xbian.

PS. i did some cleaning up...


RE: usb0 Fat32 drive owned by root - read only - rhwaugh - 14th Dec, 2012 09:49 PM

(14th Dec, 2012 09:42 PM)CurlyMo Wrote:  Can you try:

*This is a single (one line) command*
Code:
sudo sed -i 's/FS_MOUNTOPTIONS="dmask=0777,fmask=0777"/FS_MOUNTOPTIONS="uid=xbian,gid=xbian,dmask=0777,fmask=0777"/g' /etc/usbmount/usbmount.conf

This should make all usb drives not only read/writable/executable but also owned by xbian:xbian.

PS. i did some cleaning up...

Thanks, but after running the command all the usb drives are still showing root:root.


RE: usb0 Fat32 drive owned by root - read only - CurlyMo - 14th Dec, 2012 09:58 PM

To summaries things, you say none of these properties work on your usb drive? The user:group isn't automatically set to xbian:xbian, and the permissions aren't automatically set to 0777?


RE: usb0 Fat32 drive owned by root - read only - rhwaugh - 14th Dec, 2012 10:16 PM

(14th Dec, 2012 09:58 PM)CurlyMo Wrote:  To summaries things, you say none of these properties work on your usb drive? The user:group isn't automatically set to xbian:xbian, and the permissions aren't automatically set to 0777?

Yes (though the logical directory usb is 0777). Here's the listing for /media after updating the usbmount.conf to

FS_MOUNTOPTIONS="uid=xbian,gid=xbian,dmask=0777,fmask=0777"

as suggested above (and rebooting).

lrwxrwxrwx 1 root root     4 Nov 11 17:18 usb -> usb0
drwxr-xr-x 8 root root 16384 Jan  1  1970 usb0
drwxrwxrwx 2 root root  4096 Nov 11 17:18 usb1
drwxrwxrwx 2 root root  4096 Nov 11 17:18 usb2
drwxrwxrwx 2 root root  4096 Nov 11 17:18 usb3
drwxrwxrwx 2 root root  4096 Nov 11 17:18 usb4
drwxrwxrwx 2 root root  4096 Nov 11 17:18 usb5
drwxrwxrwx 2 root root  4096 Nov 11 17:18 usb6
drwxrwxrwx 2 root root  4096 Nov 11 17:18 usb7


RE: usb0 Fat32 drive owned by root - read only - CurlyMo - 14th Dec, 2012 11:43 PM

Can you replace the FS_MOUNTOPTIONS line with:
Code:
FS_MOUNTOPTIONS="-fstype=ntfs,gid=xbian,uid=xbian,umask=0 \
                 -fstype=vfat,gid=xbian,uid=xbian,umask=0 \
                 -fstype=ext2,gid=xbian,uid=xbian,umask=0 \
                 -fstype=ext3,gid=xbian,uid=xbian,umask=0 \
                 -fstype=ext4,gid=xbian,uid=xbian,umask=0 \
                 -fstype=hfsplus,gid=xbian,uid=xbian,umask=0 \
                 -fstype=exfat,gid=xbian,uid=xbian,umask=0"

Should work now.


RE: usb0 Fat32 drive owned by root - read only - rhwaugh - 15th Dec, 2012 12:00 AM

(14th Dec, 2012 11:43 PM)CurlyMo Wrote:  Can you replace the FS_MOUNTOPTIONS line with:
Code:
FS_MOUNTOPTIONS="-fstype=ntfs,gid=xbian,uid=xbian,umask=0 \
                 -fstype=vfat,gid=xbian,uid=xbian,umask=0 \
                 -fstype=ext2,gid=xbian,uid=xbian,umask=0 \
                 -fstype=ext3,gid=xbian,uid=xbian,umask=0 \
                 -fstype=ext4,gid=xbian,uid=xbian,umask=0 \
                 -fstype=hfsplus,gid=xbian,uid=xbian,umask=0 \
                 -fstype=exfat,gid=xbian,uid=xbian,umask=0"

Should work now.

That does indeed work - my hero!

Is it expected that a listing of /media should still show root ownership of the logical directory etc (usb0 is the only drive plugged in, and is now owned by xbian)?

lrwxrwxrwx 1 root root 4 Nov 11 17:18 usb -> usb0
drwxrwxrwx 8 xbian xbian 16384 Dec 14 13:52 usb0
drwxrwxrwx 2 root root 4096 Nov 11 17:18 usb1
drwxrwxrwx 2 root root 4096 Nov 11 17:18 usb2
drwxrwxrwx 2 root root 4096 Nov 11 17:18 usb3
drwxrwxrwx 2 root root 4096 Nov 11 17:18 usb4
drwxrwxrwx 2 root root 4096 Nov 11 17:18 usb5
drwxrwxrwx 2 root root 4096 Nov 11 17:18 usb6
drwxrwxrwx 2 root root 4096 Nov 11 17:18 usb7

And will this change of the config file be standard in the future?

Thanks so much for your patient and speedy help,

Rachel


RE: usb0 Fat32 drive owned by root - read only - CurlyMo - 15th Dec, 2012 12:04 AM

No need to 'say' thanks, we have a button for that now Wink, but your welcome. I'm committing this fix now.


RE: usb0 Fat32 drive owned by root - read only - BBsan - 23rd Jan, 2013 03:46 AM

Sorry for bringing this topic up again, but I've got a similar problem with my HFS+ USB HDD.

My usbmount.conf looks like:

Code:
...
FS_MOUNTOPTIONS="-fstype=ntfs,gid=xbian,uid=xbian,umask=0 \
                 -fstype=vfat,gid=xbian,uid=xbian,umask=0 \
                 -fstype=ext2,gid=xbian,uid=xbian,umask=0 \
                 -fstype=ext3,gid=xbian,uid=xbian,umask=0 \
                 -fstype=ext4,gid=xbian,uid=xbian,umask=0 \
                 -fstype=hfsplus,gid=xbian,uid=xbian,umask=0 \
                 -fstype=exfat,gid=xbian,uid=xbian,umask=0"
...
but the result is:

Code:
xbian@xbian:/media# ls -all
total 36
drwxr-xr-x 10 root root 4096 Nov 11 18:18 .
drwxr-xr-x 22 root root 4096 Jan  1  1970 ..
lrwxrwxrwx  1 root root    4 Nov 11 18:18 usb -> usb0
drwxrwxr-x  1   99   99   18 Jan  3 23:14 usb0
drwxrwxrwx  2 root root 4096 Nov 11 18:18 usb1
drwxrwxrwx  2 root root 4096 Nov 11 18:18 usb2
drwxrwxrwx  2 root root 4096 Nov 11 18:18 usb3
drwxrwxrwx  2 root root 4096 Nov 11 18:18 usb4
drwxrwxrwx  2 root root 4096 Nov 11 18:18 usb5
drwxrwxrwx  2 root root 4096 Nov 11 18:18 usb6
drwxrwxrwx  2 root root 4096 Nov 11 18:18 usb7
Am I missing something, perhaps just one rw flag or something like this?


EDIT:
After re-reading the post, I'm not sure, wether rhwaughs question was Mount related, or just permissions.
Looks to me, like my drive is mounted ro, but I don't know why.
chmod brings:
Code:
chmod: changing permissions of `/media/usb0/xbmcTR.repo_.zip': Read-only file system

EDIT2:
After playing around a bit, I definetely now, the issue is not directly usbmount related.
When I plugin another usb drive (exFat) it is recognized, mounted with xbian:xbian and rw.
If I plug in my HFS+ formatted HDD, it's mounted, but strangely with 99:99 as user and group. Also, it seems to be mounted as ro. Is there any possibility changing this?

EDIT3:
OK, fixed the mounting problems I think. Last Problem is, that there are some permission issues left. I chmodded whole media directory and it now it finally works.

I think hfsplus, hfsprogs and hfsutils should be included in xbian, as this seemed to be the issue which prevented usbmount from mounting the HFSPLUS partition in rw.