Tiny Core Linux
Tiny Core Base => TCB Q&A Forum => Topic started by: herrMnnn on May 18, 2012, 10:54:25 PM
-
Sorry for all the questions, folks, but TC/Linux has a very steep learning curve and I am worn out from searching...
I am booting version 4.5.2 of Core to a command line. It was installed onto sda1 (internal flash) using the installer program in CorePlus, selecting text only install, no extensions.
I need to write data to sdb1 (a removable flash drive) from a python script. I previously had this running under TinyCore but want to run it with just the Core base.
When I try to write to the USB drive I get a permission denied error (either from the script or just with an echo command from the command line). If I sudo the same command it works fine.
Mount returns:
/dev/sdb1 on /mnt/sdb1 type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/etc/fstab contains the line:
/dev/sdb1 /mnt/sdb1 vfat noauto,users,exec,umask=000 0 0 # Added by TC
ls -l in the /mnt directory gives me:
drwxr-xr-x 4 root root 1024 May 19 10:51 sda1/
drwxr-xr-x 4 root root 16384 May 19 12:17 sdb1/
sudo chmod 777 /mnt/sdb1 has no effect on the permissions of the directory.
What do I need to do to get universal access to the usb drive? I guess I could run the script as root, but that doesn't seem right...
NB The system will be running unattended, so all settings need to survive a reboot after a power failure.
-
Hi herrMnnn
Did you mount it using sudo mount /dev/sdb1 /mnt/sdb1 ?
Try using mount /dev/sdb1 instead.
-
Thanks Rich.
It's mounted when I boot, TC appears to be doing it for me at boot time. The entries in fstab were put there by TC or the installer or something, I haven't edited that file.
here's an example of what I get from the mount command:
tc@box:/mnt$ sudo umount /mnt/sdb1
umount: can't umount /mnt/sdb1: Device or resource busy
tc@box:/mnt$ mount /dev/sdb1 /mnt/sdb1
mount: you must be root
tc@box:/mnt$ sudo mount /dev/sdb1 /mnt/sdb1
mount: mounting /dev/sdb1 on /mnt/sdb1 failed: Device or resource busy
tc@box:/mnt$
I'm also a bit confused as to why chmod doesn't affect the permissions for the directory:
tc@box:/mnt$ ls -l
total 17
drwxr-xr-x 4 root root 1024 May 19 10:51 sda1/
drwxr-xr-x 2 root root 16384 Jan 1 1970 sdb1/
tc@box:/mnt$ sudo chmod 777 /mnt/sdb1
tc@box:/mnt$ ls -l
total 17
drwxr-xr-x 4 root root 1024 May 19 10:51 sda1/
drwxr-xr-x 2 root root 16384 Jan 1 1970 sdb1/
tc@box:/mnt$
-
You can't set the permissions because it's fat32, no support for permissions in that FS.
Try "sudo remount /mnt/sdb1 -o uid=1001,gid=50". It may need a full umount/mount instead of remount, but try anyway.
-
Hi herrMnnn
It's mounted when I boot, TC appears to be doing it for me at boot time.
TC won't mount a drive just because it finds it. There's probably a tce or cde directory on it that's
causing that to happen. What does ls /mnt/sdb1 give you?
-
You can't set the permissions because it's fat32, no support for permissions in that FS.
Try "sudo remount /mnt/sdb1 -o uid=1001,gid=50". It may need a full umount/mount instead of remount, but try anyway.
Hi herrMnnn
It's mounted when I boot, TC appears to be doing it for me at boot time.
TC won't mount a drive just because it finds it. There's probably a tce or cde directory on it that's
causing that to happen. What does ls /mnt/sdb1 give you?
Is there a forehead slapping emoticon I can use? :-[
I must have put a mount command in /opt/bootlocal.sh at some time along the way. I was sure I hadn't but no-one else could have done it so I obviously did.
Adding the uid and gid options as per curaga's post has it all working.
Thanks for being so patient and helpful. I am learning a lot from this forum and just from researching solutions to the problems I seem to create for myself. I have toyed with Linux several times over the past 10-15 years or so but never stuck with it. Tiny Core however is such an elegant solution that it has encouraged me to persist.
-
Haha, "remount" ;) I'm getting old, obviously. Should have been mount -o remount.