RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Execute file from ROM folder = Permission denied

    Scheduled Pinned Locked Moved Help and Support
    permission deniexecuterom foldergoogle drive
    13 Posts 4 Posters 4.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      kaichou
      last edited by

      All, first time posting, trying to follow all the rules:

      Raspberry 3b
      Power Supply used: 5v - 2.5Amp
      RetroPie Version: 4.2
      Built From: Pre made SD Image: retropie-4.2-rpi2_rpi3.img, using the method of hosting ROMs on USB stick
      USB Devices connected: Xbox Wireless Receiver, USB 64GB stick
      Controller used: Xbox 360 wireless
      Error messages received: Permission denied
      Guide used: https://github.com/BOBdotEXE/RetroPie-Simple-Backup-Script/blob/master/README.md & https://github.com/BOBdotEXE/RetroPie-Simple-Backup-Script/releases/
      File: /home/pi/RetroPie/roms/drive

      How to replicate the problem:

      I'm trying to perform backups to Google Drive of all my saves using the mentioned guide by BOBdotEXE.
      The guide instructs me to copy the drive file into /home/pi/RetroPie/roms/ and execute it from there.
      However when I do so, I get this:

      pi@retropie:~/RetroPie/roms $ drive init /home/pi/RetroPie/roms
      -bash: drive: command not found

      Then I tried to just execute the file:

      pi@retropie:~/RetroPie/roms $ ./drive
      -bash: ./drive: Permission denied

      I verified the owner was pi.
      I verified that the file and the folders permitted read, write, execute.
      I tried using sudo, same.
      I tried enabling root and then executing, same problem.
      I tried moving the file to /home/pi/RetroPie, same problem.
      I tried moving the file to /home/pi, IT WORKED!!!!

      pi@retropie:~ $ ./drive
      Usage: ./drive <command>

      where <command> is one of:
      about print out information about your Google drive
      clashes fix clashes by renaming files
      copy copy remote paths to a destination
      ...

      So now I'm trying to understand why I couldn't execute the file from /home/pi sub folders, even using root.

      Thanks!

      meleuM 1 Reply Last reply Reply Quote 0
      • meleuM
        meleu @kaichou
        last edited by meleu

        @kaichou

        Built From: Pre made SD Image: retropie-4.2-rpi2_rpi3.img, using the method of hosting ROMs on USB stick

        You said "using the method of hosting ROMs on USB stick". The scenario you're describing makes me believe that the USB stick is being mounted on /home/pi/RetroPie with the noexec option.

        Could you paste here the output of cat /etc/fstab?

        • Useful topics
        • joystick-selection tool
        • rpie-art tool
        • achievements I made
        1 Reply Last reply Reply Quote 0
        • K
          kaichou
          last edited by

          You are correct. Sorry I wasn't more clear on that. From what you said, the default behavior of mounting via USB will set it up for noexec? I'm a novice at linux, so I'm still learning to understand how things work.

          pi@retropie:~ $ cat /etc/fstab
          proc /proc proc defaults 0 0
          /dev/mmcblk0p1 /boot vfat defaults 0 2
          /dev/mmcblk0p2 / ext4 defaults,noatime 0 1
          # a swapfile is not a swap partition, no line here
          # use dphys-swapfile swap[on|off] for that

          Thanks!

          meleuM 1 Reply Last reply Reply Quote 0
          • meleuM
            meleu @kaichou
            last edited by meleu

            Ooops! Your USB stick isn't on fstab. Could you paste here the output of mount? (yes, just mount)

            • Useful topics
            • joystick-selection tool
            • rpie-art tool
            • achievements I made
            1 Reply Last reply Reply Quote 0
            • K
              kaichou
              last edited by

              Here you go!

              pi@retropie:~/BACKUP_SCRIPT $ mount
              /dev/mmcblk0p2 on / type ext4 (rw,noatime,data=ordered)
              devtmpfs on /dev type devtmpfs (rw,relatime,size=372092k,nr_inodes=93023,mode=755)
              sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
              proc on /proc type proc (rw,relatime)
              tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
              devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
              tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
              tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
              tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
              cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
              cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
              cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
              cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
              cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
              cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
              cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
              systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
              mqueue on /dev/mqueue type mqueue (rw,relatime)
              debugfs on /sys/kernel/debug type debugfs (rw,relatime)
              configfs on /sys/kernel/config type configfs (rw,relatime)
              fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
              /dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
              /dev/sda1 on /media/usb0 type vfat (rw,nodev,noexec,noatime,nodiratime,sync,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
              /dev/sda1 on /home/pi/RetroPie type vfat (rw,nodev,noexec,noatime,nodiratime,sync,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
              tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=75288k,mode=700,uid=1000,gid=1000)
              
              meleuM 1 Reply Last reply Reply Quote 0
              • meleuM
                meleu @kaichou
                last edited by

                @kaichou Bingo! Look the noexec in the /home/pi/RetroPie line:

                /dev/sda1 on /home/pi/RetroPie type vfat (rw,nodev,noexec,noatime,nodiratime,sync,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)

                • Useful topics
                • joystick-selection tool
                • rpie-art tool
                • achievements I made
                1 Reply Last reply Reply Quote 0
                • K
                  kaichou
                  last edited by

                  Wow! I've learned something new! Ok, I see that it says errors=remount-ro, how do I fix that? After some quick Googling, would this be the correct method?

                  sudo umount /home/pie/RetroPie
                  sudo umount /media/usb0
                  sudo mount -o remount, rw /dev/sda1 /media/usb0
                  sudo mount -o remount, rw /dev/sda1 /home/pie/RetroPie
                  

                  Thanks!

                  meleuM 1 Reply Last reply Reply Quote 0
                  • meleuM
                    meleu @kaichou
                    last edited by

                    @kaichou Ouch! Now you screwed me up! :-) I don't know every detail of the mount command, sorry. But why do you think the errors=remount-ro option is a bad thing?

                    You can look at the mount man page (command man mount) the meaning of this option:

                    • errors={continue|remount-ro|panic}
                      Define the behavior when an error is encountered. (Either
                      ignore errors and just mark the filesystem erroneous and
                      continue, or remount the filesystem read-only, or panic and halt
                      the system.) The default is set in the filesystem superblock,
                      and can be changed using tune2fs(8).
                    • Useful topics
                    • joystick-selection tool
                    • rpie-art tool
                    • achievements I made
                    1 Reply Last reply Reply Quote 0
                    • K
                      kaichou
                      last edited by

                      I assumed it was a problem because it was marked under Errors. ;) Figured it needed to be fixed. Plus I'm just using this as a learning opportunity. When I have a moment (when kids aren't playing on it), I'll try remounting to see what happens.

                      Thanks!

                      meleuM 1 Reply Last reply Reply Quote 0
                      • meleuM
                        meleu @kaichou
                        last edited by

                        @kaichou said in Execute file from ROM folder = Permission denied:

                        I assumed it was a problem because it was marked under Errors. ;) Figured it needed to be fixed.

                        It's not an actual error, it's just an option saying what mount should do when an error is encountered.

                        • Useful topics
                        • joystick-selection tool
                        • rpie-art tool
                        • achievements I made
                        1 Reply Last reply Reply Quote 0
                        • K
                          kaichou
                          last edited by

                          DOH! Now I get it. Ok, so the noexec has probably been set by RetroPie; probably something to do with protecting the USB mount process. I don't have to run my scripts from this folder, I can adjust the script to run elsewhere; I was just so confused at being denied. Glad I understand it now, and I'll leave this alone for now.

                          Thanks for your help Meleu!

                          As an aside, I've done some editing to BOBdotEXE's Google Drive Backup Script. Added support for PSP and DreamCast (still to be tested, but it at least backs-up the files). I'm now working on comparing the MD5 hashes of the backups so that I only keep backups that have new data in them. I'm not that great at scripting, but I'll eventually share what I come up with.

                          1 Reply Last reply Reply Quote 1
                          • S
                            sonicsheppard
                            last edited by sonicsheppard

                            Hi @meleu and @kaichou,

                            Sorry to reopen an old thread, but I believe I am experiencing the exact same issue.

                            I recently switched my RetroPie setup to run rom files direct from a USB drive using the automatic mount (easy) method here - https://retropie.org.uk/docs/Running-ROMs-from-a-USB-drive/.

                            Most things seem to be working fine, however when trying to launch the grim-win.sh (Grim Fandango using ResidualVM) script it will give a Permission Denied error in the runcommand.log. I checked everything is set up correctly in terms of user and permissions. I also experiencing the same thing when trying to launch .sh scripts from roms/lr-multi-bomberman (the game made by @alexis-puska (https://github.com/alexis-puska/lr-multi-bomberman). This was all working fine before switching to USB drive mount.

                            Checking cat /etc/fstab I can't see any reference to media or USB drives, and checking "mount" I can see I have noexec in the /home/pi/RetroPie line:
                            /dev/sda1 on /home/pi/RetroPie type vfat (rw,nodev,noexec,noatime,nodiratime,sync,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)

                            Details:
                            Pi Model or other hardware: Pi 3
                            Power Supply used: 5V 2.5A mains adaptor
                            RetroPie Version Used: 4.2 img updated to script to 4.2.5
                            Built From: Build from img on RetroPie website.
                            USB Devices connected: 255GB Hyper X-Savage USB drive, Rapoo T-Series wireless keyboard/mouse
                            Controller used: PS3

                            Is there a way around this? Would going through the Manual method resolve this issue?

                            Any help greatly appreciated!

                            Thanks very much.

                            G 1 Reply Last reply Reply Quote 0
                            • G
                              goyney @sonicsheppard
                              last edited by

                              @sonicsheppard You can remove the noexec flag by editing /etc/usbmount/usbmount.conf and removing the noexec parameter. Save and reboot.

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post

                              Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                              Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.