Sample Header Ad - 728x90

How to debug why uid,gid,umask,fmask and dmask mount options are ignored?

1 vote
0 answers
644 views
I am running a Live ISO of Kubuntu 22.04 LTS (AKA Jammy Jellyfish). What I am trying to do has most likely nothing to do with KDE, so one may assume I am running Ubuntu. I am trying to mount a FAT32 partition in read-write mode for current user. On this Live ISO the user is called kubuntu (it is ubuntu in case of Ubuntu). There is also a root which always has all permissions, obviously. But I want to make it work for a regular user. Lets assume I have the partition device path in shell variable P and mount point path in MP. I tried to execute such command sudo mount $P $MP Then when I call mount | grep $MP I can see such mount type and options applied (please note fmask and dmask options values): type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro) When I call stat $MP | grep Uid: I get this: Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) It completely matches to what one would expect when doing mount as root when options with values like fmask=0022,dmask=0022 have been applied. I tried to find an information about how to make mounted FS work for a regular user. All the recommendations are about uid,gid,umask,fmask, dmask and how to use those. While I am pretty happy with fmask=0022,dmask=0022 I also decided to try to reset those as well. So I ended up trying this (added redundancy, just in case): sudo mount -o uid=$(id -u),gid=$(id -g),umask=0000,fmask=0000,dmask=0000 $P $MP And guess what? The result is exactly the same as I mentioned above. It is type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro) Same thing with stat $MP | grep Uid:. It returns Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) There are no write permissions for my kubuntu user. I checked sudo dmesg | tail -n 2 and cat /var/log/syslog | tail -n 2. I usually triggering "sysrq: Emergency Sync" by pressing Alt+(SysRq/PrtScr, S) right before I do something like above (sudo mount ...). This way I have a "checkpoint" in logs which consist of 2 lines with text fragments sysrq: Emergency Sync and Emergency Sync complete. So as usual I triggered "sysrq: Emergency Sync" and then called sudo mount .... After checking both logs all I saw was just those 2 lines related to "sysrq: Emergency Sync". There is nothing related to mount command which would shed some light on why it ignored mount options. So here are the questions: - Why the mount options I provided were ignored? - How to troubleshoot this kind of mount behavior?
Asked by Victor Yarema (148 rep)
Jul 20, 2022, 12:27 PM
Last activity: Jul 20, 2022, 12:33 PM