I am formatting an USB and no matter what I can not change the owner from ROOT to anything else, the permissions for the files are also set in some random way that I can not change.
I have formatted my USB following this tutorial. I can mount it and copy files to it, for example, I mount it this way:
sudo mount /dev/sdm1 /home/me/media/( I do not know why, but it does not automount in Ubuntu/Awesome )
Now the owner is root, and if I try chown me /media or sudo chown me /media it says:
Operation not permitted
How should I format a USB drive so that the user that is formatting it is the owner of the files, and not root?
============
Udisks Output (systemctl status udisks2.service)
● udisks2.service - Disk Manager Loaded: loaded (/lib/systemd/system/udisks2.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2022-05-14 17:33:28 CEST; 20h ago Docs: man:udisks(8) Main PID: 732 (udisksd) Tasks: 5 (limit: 8718) Memory: 8.3M CGroup: / └─732 /usr/lib/udisks2/udisksd
May 14 17:33:28 code systemd[1]: Starting Disk Manager...
May 14 17:33:28 code udisksd[732]: udisks daemon version 2.8.4 starting
May 14 17:33:28 code udisksd[732]: failed to load module mdraid: libbd_mdraid.so.2: cannot open shared object file: No such file or directory
May 14 17:33:28 code udisksd[732]: Failed to load the 'mdraid' libblockdev plugin
May 14 17:33:28 code systemd[1]: Started Disk Manager.
May 14 17:33:28 code udisksd[732]: Acquired the name org.freedesktop.UDisks2 on the system message bus
May 14 19:15:00 code udisksd[732]: Requested start of the logical partition overlaps with extended partition metadata. Start of the partition moved to 1.
May 14 19:15:33 code udisksd[732]: Requested start of the logical partition overlaps with extended partition metadata. Start of the partition moved to 1.
May 15 12:30:38 code udisksd[732]: Unmounted /dev/sdm1 on behalf of uid 0
May 15 12:30:48 code udisksd[732]: Requested start of the logical partition overlaps with extended partition metadata. Start of the partition moved to 1.More details:
I am trying to mount a usb without root privileges. I get the error below when running udisksctl mount -b /dev/sdm1 (which I get using lsblk)
Error mounting /dev/sdm1: GDBus.Error:org.freedesktop.UDisks2.Error.Failed: Error creating mount point `/media/sm/A9D0-0E9B': Input/output errorThe journalctl shows this errors:
May 15 12:58:04 code kernel: fat__get_entry: 6 callbacks suppressed
May 15 12:58:04 code kernel: FAT-fs (sdk1): Directory bread(block 30560) failed
May 15 12:58:04 code kernel: FAT-fs (sdk1): Directory bread(block 30561) failed
May 15 12:58:04 code kernel: FAT-fs (sdk1): Directory bread(block 30562) failed
May 15 12:58:04 code kernel: FAT-fs (sdk1): Directory bread(block 30563) failed
May 15 12:58:04 code kernel: FAT-fs (sdk1): Directory bread(block 30564) failed
May 15 12:58:04 code kernel: FAT-fs (sdk1): Directory bread(block 30565) failed
May 15 12:58:04 code kernel: FAT-fs (sdk1): Directory bread(block 30566) failed
May 15 12:58:04 code kernel: FAT-fs (sdk1): Directory bread(block 30567) failed
May 15 12:58:04 code kernel: FAT-fs (sdk1): Directory bread(block 30568) failed
May 15 12:58:04 code kernel: FAT-fs (sdk1): Directory bread(block 30569) failed
May 15 12:58:04 code kernel: FAT-fs (sdk1): FAT read failed (blocknr 197)What can I do to fix it?
1 Answer
Most likely, your USB is formatted with a filesystem format (typically vfat) that does not support the "owner" permission. In these cases, the owner is set (by the mount command) when it is mounted.
If "automount" (actually udisks) was working, it would automatically set the owner to the user currently logged into the console or the user that ran udisksctl. (Ubuntu 18.04 / udisks2 2.7.6 has an unfixable bug involving udisks and user permissions that is fixed in Ubuntu 20.04 / udisks2 2.8.)
If you are manually mounting with the mount command running as root, you can use the -o uid= option to set the owner.
The vfat and exfat filesystem formats are typically used for USB disks because that format has the greatest compatibility across operating systems. Also, typically ownership is unimportant to save in the filesystem format on portable disks and may actually be harmful, especially if the disk is to be moved between different systems that may not have the same accounts.
Update: The error you are getting (Error creating mount point ... Input/output error) is unrelated to your USB stick and indicates there may be a failure in your root filesystem. Possibly you have a failing system disk?
10