Announcement

Collapse
No announcement yet.

File Systems and executable permissions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    File Systems and executable permissions

    Dear All

    I have a very unusual problem and I am definitely out of my depth.

    I have a Sandisk mp3 player that uses playlists. Writing a playlist is very time-consuming, so I wrote a programme in Lazarus (Windows). When placed on the mp3 player, I can run the programme and select files and change their order to devise a playlist I can set in motion when driving. Lovely. I did all of that in Windows.

    The past month I have been working on amending the code so that I can use the programme in Linux, and use Windows less. Yesterday I finished it. What a lot of work. I made an executable and tested and ran it in Linux (Kubuntu 24.04). I am very pleased.

    I copied the programme to the mp3 player. It does not run. It looses its executable property.

    The use of ls -l SimpleForms of the executable on the Linux computer reveals
    $ ls -l SimpleForms
    -rwxrwxr-x 1 stephanos stephanos 29258072 Jul 29 23:35 SimpleForms


    The same command of the executable after it is copied onto the mp3 player reveals
    $ ls -l SimpleForms
    -rw-r--r-- 1 stephanos stephanos 29258080 Jul 28 21:49 SimpleForms

    Use of chmod does not alter the permissions
    sudo chmod 755 SimpleForms
    makes no changes.

    I did some reading. It has something to do with the file permissions being different on a non-linux file system. I do not know which file system the mp3 play is using, I do not know how to find out. One helpful forum suggested that in order to be able to make the changes I will need to “add parameter exec in the etc/fstab file”. I have no idea what that means, but I decided to have a look inside etc/fstab, as a user, so I did not change anything.

    # /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a device; this may
    # be used with UUID= as a more robust way to name devices that works even if
    # disks are added and removed. See fstab(5).
    #
    # <file system> <mount point> <type> <options> <dump> <pass>
    UUID=0094-7822 /boot/efi vfat defaults 0 2
    UUID=41a5c265-0413-446b-8949-de0a243c5ca0 / ext4 defaults 0 1
    /swapfile swap swap defaults 0 0

    Anyone got any idea if what I want to do is possible, or have I spent 3 weeks rewriting code and will not be able to use the new programme in a Windows free environment?


    Any help appreciated

    #2
    Why are you running the executable on the device, and not from the computer? It's been a dog's decade and then some since I used a Sandisk mp3 player, but I think all I needed to do was to maybe set it to MSC mode (shows up as a USB drive when connected with a cable), then any number of music apps or other apps can create/export playlists (m3u files)

    Comment


      #3
      I agree with claydoh questioning running the executable from the USB; that would be a strange, potentially insecure approach.

      Originally posted by stephanaki View Post
      I copied the programme to the mp3 player. It does not run. It looses its executable property.

      The use of ls -l SimpleForms of the executable on the Linux computer reveals
      $ ls -l SimpleForms
      -rwxrwxr-x 1 stephanos stephanos 29258072 Jul 29 23:35 SimpleForms


      The same command of the executable after it is copied onto the mp3 player reveals
      $ ls -l SimpleForms
      -rw-r--r-- 1 stephanos stephanos 29258080 Jul 28 21:49 SimpleForms
      I think it's likely the USB is formatted FAT32 (or related, such as exFAT or vfat), as most sticks are. FAT32 does not support the traditional Unix-like permissions, and the permissions are faked by "masks" that are applied to all the files at mount time, so changing them has no effect. For example, I've mounted an exFAT USB, and the mount command shows
      Code:
      /dev/sde1 on /media/john/theta type exfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,iocharset=utf8,errors=remount-ro,uhelper=udisks2)
      That "fmask" implies the permissions 755 (being octal 777 minus the fmask, 0022). A file on it shows:
      Code:
      $ cd /media/john/theta
      $ touch some.txt
      $ ls -l some.txt
      -rwxr-xr-x 1 john john 17 Jul 31 15:10 some.txt
      $ chmod 777 some.txt
      $ ls -l some.txt
      -rwxr-xr-x 1 john john 17 Jul 31 15:10 some.txt
      ... I will need to “add parameter exec in the etc/fstab file”.
      1. Making changes to /etc/fstab requires care, as mistakes can make the system unbootable.
      2. Normally, removable devices are mounted using the udisks sub-system, (now part of systemd), controlled by "udev rules", (which seem to me to be a dark art).
      3. One can put removable drives in /etc/fstab, so long as the nofail option is used, and change the fmask there, but it's at least problematic.
      4. I suspect the advice to add the exec option is outdated. Removable devices were once mounted noexec by default and I was surprised to find that's no longer the case. "udisks" changed to "udisks2" at some point and I've found hints that the noexec policy was dropped then.
      I suspect that "executable"ness is not your real problem in getting a Lazarus programme to run. Have you installed the Lazarus stuff in Kubuntu?
      Regards, John Little

      Comment

      Users Viewing This Topic

      Collapse

      There are 0 users viewing this topic.

      Working...
      X