3

My old box running ubuntu 9.04 passed away, so I plugged a flash drive into a newer box running ubuntu 16.04.

But, I can't run scripts from there, because all files lost the x-permission. I can copy those files, but I can't chmod them, not even chmod a+w, not even using sudo.

chmod returns with no errors, echo $? shows 0.

It all worked perfectly on 9.04.

Here is what mount says:

/dev/sdd1 on /media/user/LABC type vfat   
 (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

I am aware of https://askubuntu.com/a/17550/778232 and I don't think it's a duplicate.

Firstly, with my problem here, not only +x is ignored. Secondly, the file where the answer proposes a change does not exist on my box.

Edit: What I don't understand, if FAT does not support linux-like flags, why did it work with ubuntu 9.04?

Edit2:

Nope, this didn't work. I unmounted the device, created a new directory, mounted it with

mount /dev/sdd1 /media/LABC -o dmask=000,fmask=111

I can see the files, but still cannot chmod or chown (as root user). chown gives "Operation not permitted".

Thomas Ward
  • 74,764

2 Answers2

2

When working with external drives that are NOT formatted for Linux (FAT32, NTFS, etc.), you cannot use chmod to affect permissions on those drives.

chmod only supports UNIX-permissions-supported disk formats. If your disk is FAT32 or NTFS, these don't speak UNIX permissions and therefore do not work with chmod.

You need to change the mount options on your disk to mount it so everything has the execute bit.

Execute this as your user: sudo mount -t vfat -o remount,umask=0002,defaults,auto,uid=$(id -u),gid=$(id -g) /dev/sdd1 /media/LABC

This will give +x to all files.

Thomas Ward
  • 74,764
  • You missed the point: "It all worked perfectly on 9.04." – Gyro Gearloose Oct 31 '23 at 14:50
  • @GyroGearloose 9.04 vs. 16.04. Lots of internal changes between those versions, including a LOT of compliance changes necessary for filesystem compliance. However, 16.04 is also End of Standard Support so keep in mind you should be upgrading. So, no, I didn't miss your point. Unfortunately you don't have a fix for this except to change your mount options to set the proper UID/GID and file masks. – Thomas Ward Oct 31 '23 at 14:54
  • Since last time I upgraded Ubuntu, it does not recognize my graphics card and I have to boot in emergency mode before I can use the graphics. Each time I boot. Hope you understand I'm not really keen on encountering other improvements. – Gyro Gearloose Oct 31 '23 at 15:00
  • Then why post your question? Unfortunately, you have multiple issues going on now. One is your GPU, one is the drive mounts, and you probably have others. If you are unwilling to accept alternative ways to fix your issues, then I think you're on the wrong site, because alternative solutions are more likely than "Here's exactly how to fix your system so it does what it used to do" because of software changes, etc. changing things. – Thomas Ward Oct 31 '23 at 15:07
  • Yes, I have multiple issues, but they are accumulating. At time of the question, the GPU-support was not yet broken. – Gyro Gearloose Oct 31 '23 at 15:10
  • In your comment, you said "Then why post your question?". Maybe, your reasoning to ask this is just why I wanted it deleted. Now I don't want it deleted any more. – Gyro Gearloose Oct 31 '23 at 16:47
1

In my honest experience, If you have a dual boot computer then you're lucky and you can try "Repair this drive" in Windows. This usually fixes my problems.

  • Thank you, but I'm not using "enemy software" ;-) . Further, I don't think the file system is broken. It worked a week ago under 9.04, and two other flash drives behave exactly the same. Very unlikely that all 3 of them should be damaged in exactly the same way. If everything else fails, I will copy the data,format them with a better file system (ext3, for example) and store the data back. – Gyro Gearloose Apr 03 '19 at 13:27
  • @Melebius "Unfortunately, this does not answer the chmod question at all.", yes, but very unfortunately, no one else did or could or did care for an answer. – Gyro Gearloose Jan 06 '21 at 16:00