Can't give executable permission to binary

I’ve installed an sd card drive to Jetson AGX Xavier in order to increase the capacitance of the kit (30G are not enough for my project). I noticed that when I was creating a simple binary executable (from a .c file) the binary didn’t have executable permissions. The same happened when I was trying to create a simple cross compile application. I also used "sudo chmod +x " to make the binary executable but still no executable permissions was added to the file. How can I give executable permissions when I am in the sd card?

At the location where your executable is on the SD card (use cd to go there), what do you see from this (the “.” is important):
df -H -T .

Also, if the SD card is “/dev/mmcblk1” (I’m guessing, so it might be something else, adjust if so), what do you see from:
lsblk -f /dev/mmcblk1
(you can see all block devices with “lsblk -f”, I’m just interested in the one device though)

Thank you for your response. For the fist one I see this:

xavier@xavier-desktop:/media/xavier/0123-4567$ df -H -T .
Filesystem     Type   Size  Used Avail Use% Mounted on
/dev/mmcblk1p1 exfat  501G   59G  443G  12% /media/xavier/0123-4567

Yes the SD card as you can see in the image above is /dev/mmcblk1p1. Bellow is the result of the command you suggested :

I’ve also faced a problem when I was trying to create a create a symbolic link. cmake error :
“llvm-project/llvm/./bin/lld-link’: Operation not permitted”

The exFAT filesystem type does not support the full set of Linux file permissions. This particular filesystem type also does not support symbolic links (it’s basically a Windows type filesystem, and symbolic links are a *NIX/Linux concept…a Windows “shortcut” is different). Note that often, with a Windows style filesystem, that mounting it in Linux implies permissions determined from the mount options. Windows itself has a different filesystem permissions system, and so Linux mount uses rules rather than individual file permissions to some extent (NTFS behaves differently than exFAT, and also differs from ext4).

If this does not need to run on Windows, then you are probably better off formatting it as ext4. This would make permission settings such as what you have attempted possible (you’d back up the content, format ext4, and then restore).

If you need to keep this as exFAT filesystem type, what user ID do you want to have permissions? One method of seeing your numeric UID and GID is with the “id” command. The first admin user is usually UID and GID of 1000. I’m going to assume 1000 for this example, but adjust for your particular UID if it differs.

For manual mount I will assume the mount point is “/mnt”. You’ll need to first manually umount if it auto mounted (and it did since it is in a “/media” directory):
sudo umount /dev/mmcblk1p1

Next, try mounting it on “/mnt” (you could use the previous location if you want):
sudo mount -o rw,exec,uid=1000,umask=007,user /dev/mmcblk1p1 /mnt

The above makes the device and content owned by user ID 1000, and the umask removes “others” from having permission to access.

You will not be able to make symbolic links within this mount point. You could in theory create a symbolic link which points at this content so long as it starts in an ext4 location. Various chmod features will not be supported so long as it is exFAT.

Thank you very match for your answer. I am going to format it as ext4 and I think the problems will be fixed.

Best regards,

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.