Announcement

Collapse
No announcement yet.

USB fat32 mounted as user on work kubuntu, but mounted as root on home kubuntu

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] USB fat32 mounted as user on work kubuntu, but mounted as root on home kubuntu

    hi all.

    i have a curious behaviour with my fat32 usb sticks.

    i have two laptops: work and home.
    both are on kubuntu 18.04.2 LTS.
    both installed by me.
    i kinda know what i do...most of the time.

    if i plug the usb stick in my work kubuntu laptop all is well.
    i mount the filesystem, a user directory is created under /media for that device and me as a plain user have rw permissions.

    if i do the same with the same stick on my home kubuntu...
    i mount the filesystem, a user directory is created under /media for that device but it belongs to root and i can't write in it.

    now, i know fat32 doesn't have permissions, that i can sudo write into it, that i can fiddle with /etc/fstab and everything.
    i know all that.

    but i'd really like to understand where that small difference in system configuration is that makes the two otherwise supposedly identical installations behave in two different ways.

    any ideas as to where i need to start looking into?

    cheers.
    gnu/linux is not windoze

    #2
    Show us the /etc/fstab file on both PCs.
    Using Kubuntu Linux since March 23, 2007
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    Comment


      #3
      hi snowhog.

      here...
      nothing special in my fstabs.

      home. old toshiba portege r700. bios. great laptop:
      Code:
      # /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=465c6223-5177-4572-9dbd-db7705eceaf5   none         swap    sw                  0   0                                                                                                
      UUID=b01a3a86-f01d-44bf-ba7c-68f06fdb6e61   /            ext4    errors=remount-ro   0   1                                                                                                
      UUID=e1764389-ccb4-446a-b825-ae39e5cbd6e4   /misc        ext4    defaults            0   2
      work. hp spectre x360 pro whatever. uefi. kinda crap piece of hw:
      Code:
      # /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=7f282745-aa4c-4dbf-9a67-83bd0d5612d6  none           swap    sw                 0       0
      UUID=3a363e2d-1b75-47e6-8700-fe142eccb4c4  /              ext4    errors=remount-ro  0       1
      UUID=114A-DA8B                             /boot/efi      vfat    umask=0077         0       1
      UUID=65bb619f-77c8-4d12-81ee-a1ebefc5a235  /misc          ext4    defaults           0       2                                                                                 
      #UUID=6d8e357b-84a3-4e21-ad6d-63c6401d8687 /ubuntu        ext4    defaults           0       2
      let me know.
      if you see something.

      btw, what piece of sw is responsible for removable media management in kubuntu now?

      cheers.
      gnu/linux is not windoze

      Comment


        #4
        None of my USB, pluggable, temporary mounted devices are in fstab. That is generally controlled by whatever succeeded "udev", and I believe it's "udisks" or "usbdisks" - something like that. Every once in a while a USB device will mount with screwed up permissions, but they all get mounted to /media/<my user name>/<device label name or UUID> and take the permissions from <my user name>. For the most part, when a USB device shows up in dmesg (i.e., /dev/sdc1), it will show up in Dolphin under the Places column, and then when I click on it there, it will then show up as mounted under /media/<my user name>/<device label name or UUID> in konsole. That's most of the time. And from time to time, it doesn't work and I just have to play with it. You will have to check the permissions on your mount point and perhaps change ownership with the "sudo chown" CLI input.
        The next brick house on the left
        Intel i7 11th Gen | 16GB | 1TB | KDE Plasma 5.24.7 | Kubuntu 22.04.4 | 6.5.0-18-generic

        Comment


          #5
          thanks jglen490.

          i bought a new 32gb verbatim usb stick today to rule out that variable, i.e. that the problem lie in the old usb stick.
          but i see the same behaviour with the new stick as well.
          it came preformatted as a fat32 filesystem, so i didn't have to do anything.
          i plugged it in one pc - work - and all was ok.
          i plugged it in the other - home - and it got mounted as root.
          so it looks like it's systematic.
          i must have unconsciously changed some setting somewhere some time.

          btw, fat32 doesn't support permissions.
          so you can't just change them with chown once it's mounted...i think.

          i'll take a look at udisk and try to understand what's going on.

          it's not a problem copying stuff as root.
          i can do that.
          i'd just like to understand what the problem is.

          cheers.
          gnu/linux is not windoze

          Comment


            #6
            Have you checked out System Settings, Hardware, Removable Storage? Perhaps the settings there are different between the two systems you use.
            Regards, John Little

            Comment


              #7
              thanks jlittle.
              checked right now.
              nothing to report.
              everything's disabled on both systems.

              in the meanwhile i did a quick test with the new verbatim stick i bought yesterday from command line...

              home pc:
              Code:
              g@bitter:/media/g$ lsblk 
              NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
              ...
              sdb      8:16   1    30G  0 disk 
              └─sdb1   8:17   1    30G  0 part 
              
              g@bitter:/media/g$ udisksctl mount --block-device /dev/sdb1 
              Mounted /dev/sdb1 at /media/g/R2-D2.
              
              g@bitter:/media/g$ ll
              total 24
              drwxr-x---+  3 root root   4096 Apr  6 10:46 ./
              drwxr-xr-x  11 root root   4096 Mar 27 18:00 ../
              drwxr-xr-x   5 root root  16384 Jan  1  1970 R2-D2/
              
              g@bitter:/media/g$ mount
              /dev/sdb1 on /media/g/R2-D2 type vfat (rw,nosuid,nodev,relatime,sync,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro,uhelper=udisks2)
              work pc:
              Code:
              g@peanuts:/media/g$ lsblk
              NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
              ...
              sdb      8:16   1    30G  0 disk 
              └─sdb1   8:17   1    30G  0 part 
              
              g@peanuts:/media/g$ udisksctl mount --block-device /dev/sdb1
              Mounted /dev/sdb1 at /media/g/R2-D2.
              
              g@peanuts:/media/g$ ll
              total 24
              drwxr-x---+ 3 root root   4096 apr  6 11:15 ./
              drwxr-xr-x  3 root root   4096 apr 16  2018 ../
              drwxr-xr-x  5 g    users 16384 gen  1  1970 R2-D2/
              
              g@peanuts:/media/g$ mount
              ...
              /dev/sdb1 on /media/g/R2-D2 type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=100,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
              mount options are not the same so i guess i will have to look into udisk settings?

              cheers.

              ps:
              i also checked that my user belong to the same groups on both systems.
              no issues there.
              both exactly the same:
              Code:
              adm:x:4:syslog,g
              cdrom:x:24:g
              sudo:x:27:g
              dip:x:30:g
              plugdev:x:46:g
              users:x:100:g
              lpadmin:x:118:g
              sambashare:x:128:g
              docker:x:999:g
              Last edited by jankushka; Apr 06, 2019, 06:35 AM.
              gnu/linux is not windoze

              Comment


                #8
                Notice that the ll output on your home and work PC for the stick is different. On the home PC the mounted stick is owned by 'root root'. On the work PC it's owned by 'g users'.

                This tells me that on your home PC your user isn't part of Group that your user on the work PC is. On both PCs, from the command line, what is the output of the command: groups
                Using Kubuntu Linux since March 23, 2007
                "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                Comment


                  #9
                  Originally posted by Snowhog View Post
                  Notice that the ll output on your home and work PC for the stick is different. On the home PC the mounted stick is owned by 'root root'. On the work PC it's owned by 'g users'.
                  snowhog, this is exactly the problem i'm reporting.

                  Originally posted by Snowhog View Post
                  This tells me that on your home PC your user isn't part of Group that your user on the work PC is. On both PCs, from the command line, what is the output of the command: groups
                  see my earlier post.
                  i checked that already.
                  on both systems the user belongs to the same groups.

                  here again...

                  home pc
                  Code:
                  g@bitter:~$ groups
                  users adm cdrom sudo dip plugdev lpadmin sambashare docker
                  work pc
                  Code:
                  g@peanuts:~$ groups
                  users adm cdrom sudo dip plugdev lpadmin sambashare docker
                  same.
                  gnu/linux is not windoze

                  Comment


                    #10
                    Hmm. May I assume correctly, that you are/have been initially mounting/accessing the USB drive from work first, and then attempting to do so from home? Have you tried it from home first (freshly formatted USB drive) to see if it behaves as expected, and then trying it work?
                    Using Kubuntu Linux since March 23, 2007
                    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                    Comment


                      #11
                      This part
                      Originally posted by jankushka View Post

                      Code:
                      g@bitter:/media/g$ mount
                      /dev/sdb1 on /media/g/R2-D2 type vfat (rw,nosuid,nodev,relatime,sync,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro,uhelper=udisks2)
                      Code:
                      g@peanuts:/media/g$ mount
                      /dev/sdb1 on /media/g/R2-D2 type vfat (rw,nosuid,nodev,relatime,[B]uid=1000,gid=100[/B],fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
                      Is the obvious source of the issue. The first computer has no UID or GID in it while the second one does. Also, neither is what I see here. When I plug in a USB stick, my mount line looks like:

                      Code:
                      /dev/sdi1 on /media/stuart/BFDD-C59C type vfat (rw,nosuid,nodev,relatime[B],uid=1000,gid=1000,[/B]fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
                      which I believe to be normal or standard (if there is such a thing). So it seems BOTH systems have been altered. "bitter" is not applying any UID or GID and "peanuts" is applying the UID but a generic GID (all users).

                      I doubt hits happened all by itself, however I would suggest you start looking at your UDEV rules. Look in /etc/udev/rules.d on both machines first. If there's nothing notable there, then start reviewing /lib/udev/rules.d. You would be looking for rules relating to USB that are different dates (as though they've been edited) or finding one or more on one system that are not on the other.

                      Please Read Me

                      Comment


                        #12
                        Originally posted by Snowhog View Post
                        Hmm. May I assume correctly, that you are/have been initially mounting/accessing the USB drive from work first, and then attempting to do so from home? Have you tried it from home first (freshly formatted USB drive) to see if it behaves as expected, and then trying it work?
                        thanks snowhog.
                        i will make sure to try this.
                        right now i'm running out of usb pens... :-D

                        in any case this issue happens with VFAT filesystems only.
                        i have other external usb devices, one with an NTFS filesystem (yeah...i know...but i must use a windoze vm at work from time to time), another one (bootable ubuntu) with an iso9660...
                        no issues with those.
                        only vfat.


                        EDIT
                        and only usb.
                        just tried with my nikon's sd card in the sd card reader.
                        it's a fat filesystem and uid/gid are applied correctly.
                        here:

                        Code:
                        /dev/mmcblk0p1 on /media/g/NIKON D750 type vfat (rw,nosuid,nodev,relatime,uid=1001,gid=100,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
                        cheers
                        Last edited by jankushka; Apr 08, 2019, 12:45 PM.
                        gnu/linux is not windoze

                        Comment


                          #13
                          thanks oshunluvr.

                          my "peanuts" and your system look the same.
                          only difference is my user primarily belongs to group "users" instead of having its own private group.
                          other than that we're aligned.
                          and, in fact, my "peanuts" works as expected.

                          the other one doesn't apply uid and gid as one would expect.
                          yeah, something must have changed some time some how.
                          likely it's me who changed some settings.
                          but i can't think of when nor how nor why.
                          possibly is because i'm getting old and ... :-D

                          i will start looking into udev's rules, then.
                          thanks a lot for the pointer.

                          will come back with findings asap.

                          cheers.
                          gnu/linux is not windoze

                          Comment


                            #14
                            nothing to report after the udev rules investigation.
                            /etc/udev/rules.d is empty.
                            /etc/udev/rules.d looks normal.

                            here's the content of usbmount.rules...
                            Code:
                            g@bitter:/lib/udev/rules.d$ cat  usbmount.rules
                            # Rules for USBmount -*- conf -*-
                            
                            KERNEL=="sd*", DRIVERS=="sbp2",         ACTION=="add",  RUN+="/usr/share/usbmount/usbmount add"
                            KERNEL=="sd*", SUBSYSTEMS=="usb",       ACTION=="add",  RUN+="/usr/share/usbmount/usbmount add"
                            KERNEL=="ub*", SUBSYSTEMS=="usb",       ACTION=="add",  RUN+="/usr/share/usbmount/usbmount add"
                            KERNEL=="sd*",                          ACTION=="remove",       RUN+="/usr/share/usbmount/usbmount remove"
                            KERNEL=="ub*",                          ACTION=="remove",       RUN+="/usr/share/usbmount/usbmount remove"
                            running out of ideas...
                            i will verify this hasn't to do with the usb hardware interfaces being "old" usb2.0 while these pens i'm using are all now usb3.0...
                            gnu/linux is not windoze

                            Comment


                              #15
                              Originally posted by jankushka View Post
                              thanks oshunluvr.

                              my "peanuts" and your system look the same.
                              only difference is my user primarily belongs to group "users" instead of having its own private group.
                              other than that we're aligned.
                              No offence, but "the same" means just that and our systems are not the same. The fact that yours is using a different group to mount removable devices is significant. Group 100 is accessible by any user logged into the system and mine is not. This is a rather large difference in terms of file security. The fact that you're OK with that doesn't change anything.

                              Mostly the point was: this difference didn't happen by accident so either you changed something or something else changed something.

                              Curious if these were clean installs or upgrades from previous versions? Could be something left over from a previous install. Another test; create a new user and log in as that user, then re-run the mount list after mounting the USB drive. This will show us if it's a user setting or system setting causing this.

                              Please Read Me

                              Comment

                              Working...
                              X