Results 1 to 9 of 9

Thread: umount Confussion

  1. #1
    Join Date
    Oct 2008
    Location
    UK
    Beans
    1,669
    Distro
    Ubuntu Mate 20.04 Focal Fossa

    umount Confussion

    I have a 20.04 mate system where with dad ALL=(ALL) NOPASSWD: /usr/bin/mount, /usr/bin/umount in /etc/sudoers.d/config I can successfully unmount a partition/device with the command sudo /usr/bin/umount /media/dad/backup. On a different 20.04 system everything is set up the same, apart from the username, I consistently get:

    Code:
    sudo /usr/bin/umount /media/username/backup
    sudo: /usr/bin/umount: command not found
    But if I type: sudo /bin/umount /media/username/back it works OK. Problem is when change the sudoers.d/config file everything gets messed/doesn't work. Should the mount/umount executable be in /usr/bin/?

  2. #2
    Join Date
    Oct 2008
    Location
    UK
    Beans
    1,669
    Distro
    Ubuntu Mate 20.04 Focal Fossa

    Re: umount Confussion

    Same if I type sudo /usr/bin/mount I get sudo: /usr/bin/mount: command not found

  3. #3
    Join Date
    Oct 2008
    Location
    UK
    Beans
    1,669
    Distro
    Ubuntu Mate 20.04 Focal Fossa

    Re: umount Confussion

    Hmm on my system there is a mount and umount file in /usr/bin/ which makes sense. On this new system (upgraded from 18.04 to 20.04 today) these two files are not in /usr/bin - they are in /bin/ again this makes sense in terms of what is happening. Should they be in /usr/bin/ and how do I move them?

  4. #4
    Join Date
    Oct 2008
    Location
    UK
    Beans
    1,669
    Distro
    Ubuntu Mate 20.04 Focal Fossa

    Re: umount Confussion

    Made soft links of the files between /bin/ and /usr/bin/ - appears to work. Is this OK?

  5. #5
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    15,654
    Distro
    Kubuntu Development Release

    Re: umount Confussion

    Usually mount/umount are found in /bin since they are both used while the machine is still running in single-user mode. Traditionally the /usr file system was only mounted after the machine went multi-user so many standard utilities needed to be available to the root user in /bin. I don't know whether that's still the case in modern implementations.

    On my 21.04 machine the file /bin/umount and /usr/bin/umount are hard linked to the same inode.
    Code:
    $ ls -i /bin/umount /usr/bin/umount
    264732 /bin/umount  264732 /usr/bin/umount
    where 264732 is the number of the inode where the data are stored. In this case the entries are identical.

    So if you want to replicate the configuration of a stock Ubuntu machine, then you should probably use a hard link instead. In practice I doubt using symlinks matters an iota. https://www.redhat.com/sysadmin/linking-linux-explained is pretty good.
    Last edited by SeijiSensei; November 27th, 2021 at 07:24 PM.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  6. #6
    Join Date
    Aug 2011
    Location
    51.8° N 5.8° E
    Beans
    6,125
    Distro
    Xubuntu

    Re: umount Confussion

    /usr is traditionally allowed to be on a separate partition. To mount that partition, you need the mount command, which is unavailable if it's on the still unmounted /usr partition. Therefore, mount was put in /bin, not /usr/bin. Nowadays, I think starting from Ubuntu 21.04, /bin is normally a symlink to /usr/bin (and similar for /sbin and /lib*), so it's all conveniently in one directory (I'm not sure what's so inconvenient about the old way), but this no longer allows a separate /usr partition (nobody used those anymore). It's triggered by the usrmerge package, so you can prevent this merge by preventing installation of the usrmerge package. There's no automatic undo; removing usrmerge doesn't cleanly undo the merge.

  7. #7
    Join Date
    May 2010
    Beans
    1,949

    Re: umount Confussion

    If you run:
    Code:
    which mount
    which umount
    You will see where the files are. I suspect that you guessed the location and weren't accurate

  8. #8
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: umount Confussion

    Always make a script. You can make it a toggle.

    Code:
    MOUNT="$(which mount || echo '/usr/bin/mount')"
    That way, if the PATH isn't reasonable, we get the specific location. Wouldn't hurt to test that $MOUNT exists and try a different location or error out too.

    Do the same for umount.

    Of course, you could just setup autofs and this stuff is solved already.

  9. #9
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    15,654
    Distro
    Kubuntu Development Release

    Re: umount Confussion

    Quote Originally Posted by Impavidus View Post
    /Nowadays, I think starting from Ubuntu 21.04, /bin is normally a symlink to /usr/bin (and similar for /sbin and /lib*), so it's all conveniently in one directory (I'm not sure what's so inconvenient about the old way), but this no longer allows a separate /usr partition (nobody used those anymore).
    Actually, as I said, on my 21.04 machine the entries in /bin and /usr/bin are both hard links, not symbolic links.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •