Select Page

Introduction

Oftentimes in a Linux machine, you’re required to handle filesystems as well as their partitions using different commands. This is essential in various ways. Starting from the installation of a Linux Environment inside a disk, all the way to transferring files from one disk to another by first mounting them on assigned folders, you name it. It is probably a very common command, not only in Linux, but other UNIX systems as well.

Following those roots, there’s a common misconception among many users who’ve just started their journey with Linux. Also, there are times when the required packages and commands to mount and unmount filesystems are not installed, in case the environment is being built from scratch, or if it is that you’re installing the “Arch Linux”. Whatever’s your case, you may possibly see this error message when trying to unmount a filesystem or partition: “unmount: command not found”. In this article, we’ll go through the fix of this commonly encountered error message, and keep you from switching out of Linux before it’s too late!

I use Arch, by the way 😉


You’re spelling the wrong command

Well well well. You don’t need to feel noobish for this, because every now and then at least 4 out of 5 users are definitely doing the same – spelling the wrong command for unmounting filesystems. If you’ve used the mount command, then the probable thing to come in mind for unmounting would be unmount command, and that’s exactly where you may start to see the frustration occurring. To unmount a filesystem, you need to type “umount”, without the “n”.

So why on Earth did it have to be umount? Why couldn’t they just add another letter to simply make life easier? It’s not until you really see the reasons behind all of this mess. There are a lot of commands you’ll find in Linux that are quite old (at least a decade) that come from its ancestor UNIX. Some of them are cd, ls mv, cp, passwd, and not to mention, mount and umount. One thing you’d notice among all these commands is that none of these exceed any more than 6 letters. getting the idea yet? 

The earliest of UNIX systems only incapable of running commands that exceeded 6 letters. Hence, all the commands back then were made keeping that limit in mind, which is the sole reason why you need to type out umount instead of unmount. This command has stayed the same since then, and so did the other commands, and were passed down on newer generation operating systems like Linux.

It doesn’t necessarily mean you cannot execute commands that are more than 6 letters, probably. Commands that have come long after do not have that limit, due to such rapid enhancements in hardware, as well as in software. 


Install the package to unmount filesystems

In Linux distributions, you can also get the umount command by installing a package, if you don’t have it in your system. Though this is extremely unlikely, it is still possible that somehow the commands got erased due to whatever reason. If you’re sure that you typed the right command, which is umount, and still are unable to run it, then you may find luck by installing the package that contains this command. 

The name of the package differs from distribution to distribution. Some systems have the umount command under the util-linux package, while others have a packeg called mount, which contains both the mount and the umount commands. Some of the distributions are mentioned here:

Arch Linux

$ sudo pacman -Syu 
$ sudo pacman -S util-linux

Ubuntu

$ sudo apt-get update 
$ sudo apt-get install mount

Debian

$ sudo apt-get update 
$ sudo apt-get install mount

Fedora

$ sudo yum makecache
$ sudo yum install util-linux

CentOS/RedHat

$ sudo dnf makecache
$ sudo dnf install util-linux

The first line of the command will update your system’s repositories, and the second line will install the package. If you’ve properly been able to install it, then you should no longer see the error message while trying to execute the umount command.


Install the package from source code

There’s one other method of getting the umount command, which is to install the package from the source code which contains it. This is the util-linux package which is available in GitHub. It is actually just a collection of many Linux commands that you can use, one of which is umount.

To install it from source code, you need to first make sure that you have the following programs installed in your system:

  • git
  • make

Git is required to download the source code which is hosted in GitHub. Make is used to build the package from the source code. Once you’re done making sure that you have these, proceed to the installation.

Download the source code using the below command:

$ git clone https://github.com/util-linux/util-linux.git

After that, enter the downloaded directory using the cd command:

$ cd util-linux

Inside this directory, run the autogen.sh shell script to create the configuration files for the package:

$ ./autogen.sh

Once done, you now need to run the configure script, using:

$ ./configure

Now, run the make command to build the package:

$ make

Lastly, install the package to make it available system wide: 

$ sudo make install

You should now be able to execute the umount command, if you’ve properly followed the whole procedure properly.

There is one thing you should note, as well. Sometimes, it is possible that the directory where command like umount is installed, may not be included in the PATH variable of your machine. What this means, bourne again shell will not be able to scan for that folder then the terminal start, and you’d be unable to run the command.

To fix this, you need to add one line of code to the .bashrc file, which should be located in your home directory, hidden. First, open the .bashrc file using a text editor, such as nano, by executing:

$ nano ~/.bashrc

Inside this file, append the following line:

export PATH=/usr/bin:$PATH

Save and exit the file. This will make sure that you can execute the command without any further issues.


An easier way for newbies

Learning the use of terminals is extremely crucial if you wish to adapt to the Linux environment. However, when you’re just starting out, it is not so necessary that you need to force yourself to do just about everything with the terminal. So is the case right here. Using the unmount command can help you learn things, but at times when you need to get the job done quickly, I’d definitely say using a graphical application to help you with that is good without an argument. 

Some of the graphical applications that you could use to achieve these tasks are:

  • KDE partition manager
  • Gnome Disks
  • Qtparted

These applications will help you a lot when you just don’t know how to use the mount, umount and other such commands. The UI is easy to use and if you’re coming from Windows, it should be too hard anyway.

Yes, you definitely should learn terminal commands whenever you get the chance. But how would you even achieve that, if you are unable to fix your pc in the first place, right?


Conclusion

This concludes our fix to the “umount: command not found” error message. For more than 90% of users out there, the main issue is spelling the wrong command. In a very few cases, it might be that the commands got removed from your system, which is very possible in Linux. Given that you can take full control of your machine when you login as the root user, cleaning up your whole disk just by a wrong click or a command is not unheard of, here in Linux.