The "mount" command - Usage, examples, errors

mail

mount error(127): Key has expired or mount(2) system call failed: Key has expired

Situation

When trying to mount a Samba share on a Linux client, I get one of the error messages :

Details

man mount.cifs is of little help on this topic (or I missed it ). Despite the cryptic error message, the solution was straightforward : the password has expired and needs to be changed.

Solution

mail

mount error(111): could not connect to 192.168.1.8Unable to find suitable address.

Situation

I got this error mostly (only?) when trying to mount Samba shares :
mount /path/to/mountPoint/
	mount error(111): could not connect to 192.168.1.8Unable to find suitable address.

Details

Details about this error code can be found in the kernel source code (source) :
find / -iname "*errno.h*"
	
	/usr/src/linux-headers-5.10.0-9-amd64/arch/x86/include/generated/uapi/asm/errno.h
	/usr/src/linux-headers-5.10.0-8-amd64/arch/x86/include/generated/uapi/asm/errno.h
	/usr/src/linux-headers-5.10.0-9-common/include/linux/errno.h
	/usr/src/linux-headers-5.10.0-9-common/include/uapi/asm-generic/errno.h
	/usr/src/linux-headers-5.10.0-9-common/include/uapi/linux/errno.h
	/usr/src/linux-headers-5.10.0-8-common/include/linux/errno.h
	/usr/src/linux-headers-5.10.0-8-common/include/uapi/asm-generic/errno.h
	/usr/src/linux-headers-5.10.0-8-common/include/uapi/linux/errno.h

find /usr/src/linux-headers-$(uname -r | sed -r 's/\-([^-]+)$/-common/')/include -name "*errno.h*"
	/usr/src/linux-headers-5.10.0-9-common/include/linux/errno.h
	/usr/src/linux-headers-5.10.0-9-common/include/uapi/asm-generic/errno.h
	/usr/src/linux-headers-5.10.0-9-common/include/uapi/linux/errno.h

grep 111 /usr/src/linux-headers-5.10.0-9-common/include/uapi/asm-generic/errno.h
	#define ECONNREFUSED    111     /* Connection refused */
I'm both :

Solution

As a quick'n'dirty solution, a Samba restart / server reboot made the error disappear without altering any configuration.
mail

mount

Usage

Mount a filesystem by "attaching" it to a location found on the local host (a.k.a a mount point).

Like many commands, mount works in different "modes" :

Some of the mount options are filesystem-specific.

Flags

Flag Usage
-a --all mount all filesystems mentioned in /etc/fstab except those having the noauto option
--bind oldDir newDir allows to remount part of the file hierarchy somewhere else. After this call the same content is accessible in two places.
-t fsType specify that the filesystem to mount is of type fsType
-o options options :
  • ro, --ro : mount as read only
  • rw, --rw : mount as read/write
  • remount : remount an already-mounted filesystem

Example

Remount a volume as rw :

  • umount /boot && mount /boot --rw
  • mount -o remount --rw /boot

Get a nice display of mounted volumes (source) :

mount | column -t