I am having a problem automounting remote samba shares using cifs since updating to kernel 6.6.0. I am on unstable. Here is what happens:
❯ ls /mnt/media
lsd: /mnt/media: No such device (os error 19).
I mount this directory automatically using:
fileSystems."/mnt/media" = {
device = "//nas/media";
fsType = "cifs";
options = let
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
in ["${automount_opts},credentials=/home/user/smb-secrets,uid=1000"];
};
This remote share is on an unraid server.
If I boot back into kernel 6.5.9, everything mounts and works as expected.
I believe this has to do with SMB dialects. I have tried adding vers=1.0
, vers=2.0
and vers=3.0
, but that hasn’t worked, or maybe I am doing it wrong.
Does the cifs mount
section on this page Samba - NixOS Wiki need to be updated now that SMB1 seems to be deprecated in the latest kernel release?
noblman
November 15, 2023, 7:19am
3
Sorry to ping this post, but does anyone have this working with kernel 6.6?
APCodes
November 15, 2023, 9:44am
4
NixOS wiki might need updating in many areas, yes.
But you might not be the only one having issues with cifs
on kernel 6.6.0
opened 08:59PM - 04 Nov 23 UTC
0.kind: bug
6.topic: kernel
0.kind: regression
### Describe the bug
`mount.cifs` starts failing with `ENOKEY` if I use a DNS d… omain for the server address.
### Steps To Reproduce
Command I used is: `mount -t cifs -o vers=3.1.1,cred=/home/u/.secret.txt,uid=1000,gid=100 //smb.server.example.com/scans /home/u/mnt` (mount.cifs version: 7.0 in all cases)
strace from `6.5.9 #1-NixOS SMP PREEMPT_DYNAMIC Wed Oct 25 10:16:30 UTC 2023 x86_64 GNU/Linux`:
```
[pid 3232] mount("//smb.server.example.com/scans", ".", "cifs", 0, "ip=192.168.5.43,unc=\\\\smb.server.example.com\\scans,vers=3.1.1,uid=1000,gid=100,user=u,pass=mypassword") = 0
```
strace from `6.6.0 #1-NixOS SMP PREEMPT_DYNAMIC Mon Oct 30 02:31:08 UTC 2023 x86_64 GNU/Linux`:
```
[pid 4525] mount("//smb.server.example.com/scans", ".", "cifs", 0, "ip=192.168.5.43,unc=\\\\smb.server.example.com\\scans,vers=3.1.1,uid=1000,gid=100,user=u,pass=mypassword") = -1 ENOKEY (Required key not available)
```
Note that when using the IP it still works on 6.6.0:
```
[pid 4537] mount("//192.168.5.43/scans", ".", "cifs", 0, "ip=192.168.5.43,unc=\\\\192.168.5.43\\scans,vers=3.1.1,uid=1000,gid=100,user=u,pass=mypassword") = 0
```
### Expected behavior
The share should be mounted successfully.
### Additional context
* I didn't see anything obvious in the kernel's git log (just skimming the messages) in `fs/smb/client/` in the last 3 months.
* No changes to `configuration.nix` between the offending updates.
* Note that the DNS lookup itself succeeds (i.e. the `ip=` option is populated correctly)
* Nothing suspicious in `resolvectl monitor` or `tcpdump`.
* No changes on the server side (no other system is affected either).
### Notify maintainers
<!--
Please @ people who are in the `meta.maintainers` list of the offending package or module.
If in doubt, check `git blame` for whoever last touched something.
-->
### Metadata
Please run `nix-shell -p nix-info --run "nix-info -m"` and paste the result.
```console
[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-linux"`
- host os: `Linux 6.6.0, NixOS, 23.11 (Tapir), 23.11.20231102.fa804ed`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.17.1`
- channels(root): `""`
- channels(u): `""`
- nixpkgs: `/nix/store/a56i1y5js340dn1w9r767a8jp34k31n4-source`
```
The update in question (via `nix profile diff-closures --profile /nix/var/nix/profiles/system`):
```
Version 438 -> 439:
android-tools: 34.0.1 → 34.0.4, +1713.0 KiB
android-udev-rules: 20230614 → 20231030
docker-compose: 2.21.0 → 2.23.0, +78.2 KiB
enchant: 2.6.1 → 2.6.2
initrd-linux: 6.5.9 → 6.6, +95.8 KiB
jasper: 2.0.32 → 4.0.0, -129.7 KiB
kernel: +67.1 KiB
ldns: ∅ → 1.8.3, +593.0 KiB
libcpuid: 0.6.3 → 0.6.4, +24.5 KiB
linux: 6.5.9, 6.5.9-modules → 6.6, 6.6-modules, +1531.1 KiB
linux-firmware: 20230919 → 20231030, +7527.5 KiB
mdadm.conf: ε → ∅
nixos-system-myhostname: 23.11.20231029.0cbe9f6 → 23.11.20231102.fa804ed
perf-linux: 6.5.9 → 6.6, -644.2 KiB
source: +290.7 KiB
strace: 6.5 → 6.6
unifont: 15.1.02 → 15.1.03
v4l2loopback-unstable: 2023-02-19-6.5.9 → 2023-02-19-6.6
```
noblman
November 29, 2023, 11:27pm
5
I am still no closer to solving this issue. Does anyone have any insight?
APCodes
November 30, 2023, 7:48am
6
did you try mounting it via IP address instead of hostname?
Edit: Also, did you try switching to the LTS kernel?
1 Like
noblman
November 30, 2023, 9:12am
7
Ahh. Brilliant.
I had been using boot.kernelPackages = pkgs.linuxPackages_latest;
from a long time ago because of some hardware compatability issue (long since have forgotten what it was). I am now running the default kernel (which right now is 6.1.63) and my mounting problems have gone away.
Thanks for the tip.
APCodes
November 30, 2023, 9:20am
8
Great! You can mark my post as the solution so that others may see it straight away.
Most likely this issue will be solved very soon though, there appears to be a patch in the kernel by now.