-
Notifications
You must be signed in to change notification settings - Fork 5
Description
While installing cifstab on a new machine, and ran into a problem when I tried to mount the filesystems using cifstab mount -a:
root:~# cifstab mount -a
{
"Documents": {
"name": "Documents",
"host": "nas",
"share": "Documents",
"mountpoint": "/nas/Documents",
"options": "uid=1000,gid=1000"
}
}
Traceback (most recent call last):
File "/usr/local/bin/cifstab", line 8, in <module>
sys.exit(main())
~~~~^^
File "/usr/local/venv/lib/python3.13/site-packages/cifstab/cifstab.py", line 272, in main
getattr(cifstab, args.subcommand)(args)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/usr/local/venv/lib/python3.13/site-packages/cifstab/cifstab.py", line 140, in mount
self.execute(cifscmd,name,cifsmount['password'],operation,retryon,accepterr)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/venv/lib/python3.13/site-packages/cifstab/cifstab.py", line 177, in execute
if child.expect([pexpect.TIMEOUT, "Password.*"]) != 1:
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/venv/lib/python3.13/site-packages/pexpect/spawnbase.py", line 354, in expect
return self.expect_list(compiled_pattern_list,
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
timeout, searchwindowsize, async_)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/venv/lib/python3.13/site-packages/pexpect/spawnbase.py", line 383, in expect_list
return exp.expect_loop(timeout)
~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/local/venv/lib/python3.13/site-packages/pexpect/expect.py", line 179, in expect_loop
return self.eof(e)
~~~~~~~~^^^
File "/usr/local/venv/lib/python3.13/site-packages/pexpect/expect.py", line 122, in eof
raise exc
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0x7f23a5cb8c20>
command: /usr/bin/mount
args: ['/usr/bin/mount', '-t', 'cifs', '-o', 'username=zamora,uid=1000,gid=1000', '//nas/Documents', '/nas/Documents']
buffer (last 100 chars): b''
before (last 100 chars): b'iled: No route to host.\r\n dmesg(1) may have more information after failed mount system call.\r\n'
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: 32
flag_eof: True
pid: 372048
child_fd: 7
closed: False
timeout: 3
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
0: TIMEOUT
1: re.compile(b'Password.*')
The real cause is buried in the traceback: "No route to host." This caused an exception because cifstab was expecting a password prompt and didn't get it.
I checked in dmesg, and found the line: [66376.110143] CIFS: Unable to determine destination address
I was confused because I was able to ping and resolve the name of my NAS using both the short hostname and the fully-qualified name.
After some digging online, I found a blog post that had a solution: https://www.itechlounge.net/2024/05/linux-mount-cifs-unable-to-determine-destination-address
The solution was to install the keyutils and cifs-utils packages. Once I did this, everything worked as expected.
I recommend adding these packages as prerequisites in the documentation. Also, handling the exception to display the actual error would be helpful.