Mark_F
Posts: 14
Joined: Mon Jul 22, 2019 7:42 am
Location: Moe, Victoria, Australia
Contact: Website Facebook

Need help with permissions after automount of usb storage?

Sat Aug 31, 2019 12:48 am

Hi folks,

First post here and first Pi which is only a week out of the box.

Got my NEW Pi 4 4GB all happening. Buster, Apache, MySQL, php, wordpress, samba and stuff all working very nicely indeed. Then I threw a spanner into the works...
I thought it'd be a great idea to press a Sandisk SSD (500GB) into service so I followed the VERY nice and easy to follow HOWTO I found on this very site. That went well and I now have plenty of space and a bit of a perceived performance improvement. All good, BUT....
Before the SSD I could plug a USB stick in and it'd be presented on the (username) pi desktop and be accessible by all and sundry - just what I wanted. Now, however, the plugged in USB stick is ONLY accessible to "root" and for the user "pi" to be able to get at it it needs to be unmounted and remounted with -o uid=pi, gid=pi.
With Slackware, which I'm familiar with, I'd just edit the udev rules and reload them and we'd be all OK. Since implementing the SSD /dev/sda is taken and the USB stick is now /dev/sdb or /dev/sdc. I can find no udev rules that are relevant. So....
Does Buster use udev or some other mechanism and if so, what? What do I need to "fix" to get it working as it did when the USB stick was coming up on /dev/sda ? I know this is just something that I don't understand just yet..:-)
If someone could please tell me where I can find the /dev/sda stuff I can then seek to understand it and fix it for /dev/sdb and /dev/sdc.
Mark F
http://jandmf.com
Vk3KW / VK3ZMF

LTolledo
Posts: 2158
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Stooopid newbie non understanding

Sat Aug 31, 2019 3:30 am

try changing ownership of the SSD mount
usually its seen in /media/pi/xxxxx-xxxx-xxx (if auto-mounted)

Code: Select all

sudo chown -R pi:pi /media/pi/xxxx-xxxx-xxx 
in addition you may

Code: Select all

sudo chmod -R 775 /media/pi/xxxx-xxxx-xxx
use

Code: Select all

lsblk
to check where the SSD is mounted

better to have it mounted properly using /etc/fstab
there are quite a number in the forum....
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

Mark_F
Posts: 14
Joined: Mon Jul 22, 2019 7:42 am
Location: Moe, Victoria, Australia
Contact: Website Facebook

Re: Stooopid newbie non understanding

Sat Aug 31, 2019 10:44 am

LTolledo wrote:
Sat Aug 31, 2019 3:30 am
try changing ownership of the SSD mount
usually its seen in /media/pi/xxxxx-xxxx-xxx (if auto-mounted)

Code: Select all

sudo chown -R pi:pi /media/pi/xxxx-xxxx-xxx 
in addition you may

Code: Select all

sudo chmod -R 775 /media/pi/xxxx-xxxx-xxx
Good solution but it requires privilege which I'd rather not give my 12 year old grandson.

use

Code: Select all

lsblk
to check where the SSD is mounted

better to have it mounted properly using /etc/fstab
there are quite a number in the forum....
The SSD is mounted by proper use of fstab :-

Code: Select all

proc            /proc           proc    defaults          0       0
PARTUUID=a207fce3-01  /boot           vfat    defaults          0       2
PARTUUID=a207fce3-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
The SSD is the ext4 partition mounted at /.

What I'm after is the automount mechanism. If it's udev I can't find the rule to tweak and if it isn't I don't know how the automount is done.

Cheers,
Mark F...
Mark F
http://jandmf.com
Vk3KW / VK3ZMF

User avatar
DougieLawson
Posts: 36578
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Stooopid newbie non understanding

Sat Aug 31, 2019 10:55 am

What's the filesystem format on your SSD?
If it's NTFS then sudo apt install ntfs-3g is needed to allow read/write access. Then ownership is done on the mount (or automount) for the drive (can be overridden with umask=000 to give every file 777 permission bits).
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5201
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Stooopid newbie non understanding

Sat Aug 31, 2019 4:49 pm

Mark_F wrote:
Sat Aug 31, 2019 10:44 am
...

What I'm after is the automount mechanism. If it's udev I can't find the rule to tweak and if it isn't I don't know how the automount is done.

Cheers,
Mark F...
It's usually (often) performed by the (desktop) file manager and, unless things have changed, there should be an option to "turn it off":
http://www.cpmspectrepi.uk/raspberry_pi ... Auto-mount
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, A+ and a B2) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

bjtheone
Posts: 396
Joined: Mon May 20, 2019 11:28 pm
Location: The Frozen North (AKA Canada)

Re: Stooopid newbie non understanding

Sat Aug 31, 2019 5:33 pm

Mark_F wrote:
Sat Aug 31, 2019 10:44 am
The SSD is mounted by proper use of fstab :-

Code: Select all

proc            /proc           proc    defaults          0       0
PARTUUID=a207fce3-01  /boot           vfat    defaults          0       2
PARTUUID=a207fce3-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
The SSD is the ext4 partition mounted at /.

What I'm after is the automount mechanism. If it's udev I can't find the rule to tweak and if it isn't I don't know how the automount is done.
Humm... You have gacked something up in your installing/configuring. I have an almost identical setup (4B, with boot on the SD, rootfs on an SSD), with a very similar fstab. Automounting USB sticks works just fine.

I did manage to break fuser in my mucking about such that it broke automounting USB sticks (gave an error) but I brute forced that via a forced reinstall of fuser rather than sorting exactly what I broke. Just tweaking fstab to mount rootfs from an SSD will not break automounting. Be default it will happily mount sticks on sdb, sdc, etc if sda is used by the SSD. Sorry that it is not a solution, but at least its confirmation that it should just work.

As noted, permissions to the automounted file system is another thing and is totally dependent on what file system type you are mounting. But given the questions you are asking I suspect you already know that.

Mark_F
Posts: 14
Joined: Mon Jul 22, 2019 7:42 am
Location: Moe, Victoria, Australia
Contact: Website Facebook

Re: Stooopid newbie non understanding

Sun Sep 01, 2019 1:05 am

bjtheone wrote:
Sat Aug 31, 2019 5:33 pm
Humm... You have gacked something up in your installing/configuring.
Yep I somehow managed to mess up udev. Last night I put the backup SD card from BEFORE I added the SSD and tried things out and as expected it worked properly. Added a USB memory stick for the root partition using the same process as I did before and again, it all worked properly. Went back to the current SD and SSD and it's still not working properly. Took a punt and uninstalled UDEV and reinstalled it. Viola and it all worked properly again.
The clue pointing to UDEV was in /var/log/messages where it says "mounted on behalf of uid 1000" While it was "gacked" it was saying mounted on behalf of uid ????????.
It's now all fixed but I don't know why or how it got messed up. Maybe the rsync from the SD to the SSD ? Dunno...:-)

Cheers and thanks for all the help.
Mark F...
Mark F
http://jandmf.com
Vk3KW / VK3ZMF

bjtheone
Posts: 396
Joined: Mon May 20, 2019 11:28 pm
Location: The Frozen North (AKA Canada)

Re: Need help with permissions after automount of usb storage?

Sun Sep 01, 2019 4:09 pm

Did you switch from default user "pi" to something else during the config process? 1000 is the uid of the default user.

Return to “Advanced users”