Permission denied when trying to execute an application on a SD card
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Permission denied when trying to execute an application on a SD card
Hi,
I made some little applications with qt creator and i wanted to run them on an embedded linux board (linux 2.6.24). To transfer the files i use a SD card. If i move the applications to "/bin" after having mounted the SD card and then "chmod a+x" them then i have no problem running them.
But if i mount the SD card and try to run the applications directly in the folder where i mount it i have an error : "Permission denied". Also when using the command "ls" i notice that if i keep the files in the mounting folder and try to "chmod a+x" them, the modification don't happen. They stay "greyed" and don't go "green". (I don't know if this color code is a standart for linux terminal but maybe this could help you understand the problem).
When mounting the SD card i use the command :
Code:
mount -t vfat /dev/mmcblk0p1 /mnt/SD
So the files are located in /mnt/SD.
Am i missing something or is it not possible to run something like that ?
EDIT :
I tried "mount -t vfat -o umask=0000 /dev/mmcblk0p1 /mnt/SD" to chnage how i am mounting the SD card.
Still "Permission Denied".
With "ls -l" i can see that the permissions are staying :
-rw-rw-rw-
Even if i try something like "chmod 777".
It seems to be a problem related to the fact that the sd card is formated as fat32 but it must stay like that.
Last edited by wowy; 05-05-2015 at 03:52 AM.
Reason: Update on the problem
After the card is mounted, re-issue just the mount command to get a report and see if the drive is mounted as read-only. Is there any RW protect tab on the SD card? If so, check where it is set, and it's highly likely that the tab could've been moved by insertion actions, after all those tabs are on the card sides.
After the card is mounted, re-issue just the mount command to get a report and see if the drive is mounted as read-only. Is there any RW protect tab on the SD card? If so, check where it is set, and it's highly likely that the tab could've been moved by insertion actions, after all those tabs are on the card sides.
The tab is not in the "lock" position, i can read and write on it from another pc.
Using the mount command a second time after already mounting it gives me :
Code:
mount: mounting /dev/mmcblk0p1 on /mnt/SD failed: Device or resource busy
Using the mount command a second time after already mounting it gives me :
Code:
mount: mounting /dev/mmcblk0p1 on /mnt/SD failed: Device or resource busy
Don't try to mount it again, just issue "mount<ENTER>" to get a report on what things are mounted.
Example, and notice that these are mounted as read/write:
Code:
$ mount
/dev/sda7 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
...
rootfs on / type rootfs (rw)
/dev/root on / type yaffs2 (rw)
proc on /proc type proc (rw)
/sys on /sys type sysfs (rw)
/tmpfs on /dev type tmpfs (rw)
none on /var type ramfs (rw)
/dev/mmcblk0p1 on /media/mmcblk0p1 type vfat (rw,nosuid,nodev,noexec,noatime,fmask=0111,dmask=0000,codepage=cp437,iocharset=iso8859-1,quiet,utf8)
devpts on /dev/pts type devpts (rw)
/dev/mmcblk0p1 on /mnt/SD type vfat (rw,fmask=0111,dmask=0000,codepage=cp437,iocharset=iso8859-1,quiet,utf8)
It seems to be rw. i used umask=0000 but fmask don't seems to have registered it.
The fmask and dmask options control the files and directory. The umask option only controls permissions for new files and directories. You can use fmask and dmask in your mount command.
I tried with a fmask=0000 because the files are directly in the root of the SD card. (i tried to understand with this : http://askubuntu.com/questions/42984...-mount-options ) Even tried again after this to chmod 777 the files, in case the fmask would only allow a permission and not enforce it.
Still "permission denied".
Sorry, an omission on my part. You're doing the mount using sudo, or as root, by the way?
And when files are mounted, who owns them and/or the directory? A'la "ls -l", is that root?
You may have to run using sudo if things are owned by root. Or you can use sudo to chmod the file so that the world permissions allow for r-x and the directory containing them is also r-x for the world.
Yes all is already done by root and owned by root.
For now it is not really a big problems because i can bypass executing them directly on the mount folder by copying them in another place and it is not a problem for the project. It was simply for us to be a little faster. But still curious on why this don't works.
please provide us with the ls -al for the files in question.
maybe using vfat filesystem (which i think doesnt recognize linux permissions) is problematic ?
I don't have the system in my hand right now so i can't try a ls -al right now. I will update surely tomorrow.
I think so too about vfat, but this is one part i can't change because the sd card is tranfered on different system on this is the only format supported by all.
/dev/mmcblk0p1 on /media/mmcblk0p1 type vfat (rw,nosuid,nodev,noexec,noatime,fmask=0111,dmask=0000,codepage=cp437,iocharset=iso8859-1,quiet,utf8)
devpts on /dev/pts type devpts (rw)
/dev/mmcblk0p1 on /mnt/SD type vfat (rw,fmask=0111,dmask=0000,codepage=cp437,iocharset=iso8859-1,quiet,utf8)
The card was already auto-mounted on /media/mmcblk0p1 with the "noexec" option. I'm surprised the system let you mount it again on /mnt/SD, but apparently the "noexec" option is still applied. Try
The card was already auto-mounted on /media/mmcblk0p1 with the "noexec" option. I'm surprised the system let you mount it again on /mnt/SD, but apparently the "noexec" option is still applied. Try
Code:
mount -o remount,exec /media/mmcblk0p1
I tried not mounting it again on /mnt/SD and using your command and then "mount" :
Code:
/media/mmcblk0p1 # mount
rootfs on / type rootfs (rw)
/dev/root on / type yaffs2 (rw)
proc on /proc type proc (rw)
/sys on /sys type sysfs (rw)
/tmpfs on /dev type tmpfs (rw)
none on /var type ramfs (rw)
/dev/mmcblk0p1 on /media/mmcblk0p1 type vfat (rw,nosuid,nodev,noatime,fmask=0111,dmask=0000,codepage=cp437,iocharset=iso8859-1,quiet,utf8)
devpts on /dev/pts type devpts (rw)
"noexec" is not here anymore but still "permission denied" when trying to run an executable.
EDIT2 : Nope still don't work, when i thought it worked it was because the system still had the file in bin...
Last edited by wowy; 05-06-2015 at 07:21 AM.
Reason: error
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.