LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 05-05-2015, 02:24 AM   #1
wowy
Member
 
Registered: Mar 2015
Location: France
Distribution: Ubuntu 14.04
Posts: 61

Rep: Reputation: Disabled
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
 
Old 05-05-2015, 05:43 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,876
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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.
 
Old 05-05-2015, 05:57 AM   #3
wowy
Member
 
Registered: Mar 2015
Location: France
Distribution: Ubuntu 14.04
Posts: 61

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rtmistler View Post
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
 
Old 05-05-2015, 06:04 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,876
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by wowy View Post
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)
...
 
Old 05-05-2015, 06:20 AM   #5
wowy
Member
 
Registered: Mar 2015
Location: France
Distribution: Ubuntu 14.04
Posts: 61

Original Poster
Rep: Reputation: Disabled
My bad, sorry.

When using mount it gives me :
Code:
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.
 
Old 05-05-2015, 06:28 AM   #6
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,876
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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.
 
Old 05-05-2015, 06:42 AM   #7
wowy
Member
 
Registered: Mar 2015
Location: France
Distribution: Ubuntu 14.04
Posts: 61

Original Poster
Rep: Reputation: Disabled
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".
 
Old 05-05-2015, 06:46 AM   #8
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,876
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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.
 
Old 05-05-2015, 06:58 AM   #9
wowy
Member
 
Registered: Mar 2015
Location: France
Distribution: Ubuntu 14.04
Posts: 61

Original Poster
Rep: Reputation: Disabled
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.
 
Old 05-05-2015, 08:00 AM   #10
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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 ?
 
Old 05-05-2015, 08:26 AM   #11
wowy
Member
 
Registered: Mar 2015
Location: France
Distribution: Ubuntu 14.04
Posts: 61

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by schneidz View Post
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.
 
Old 05-05-2015, 10:29 AM   #12
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
Quote:
Originally Posted by wowy View Post
Code:
/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
Code:
mount -o remount,exec /media/mmcblk0p1
 
2 members found this post helpful.
Old 05-06-2015, 06:36 AM   #13
wowy
Member
 
Registered: Mar 2015
Location: France
Distribution: Ubuntu 14.04
Posts: 61

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
When execute Gcc , permission denied , why? kenneth2078 Linux - Software 3 03-03-2010 04:41 AM
Cannot execute /bin/sh: Permission denied ItsJustLoco Slackware 8 10-09-2008 04:28 AM
cannot execute bash: permission denied flipwhy Linux - Newbie 11 11-12-2007 10:49 AM
Cannot execute /bin/bash: Permission denied Z038 Slackware 13 06-23-2007 09:34 PM
Permission denied to execute anything under /home ErrorBound Linux - Software 8 07-26-2006 09:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration