home-assistant / supervisor

:house_with_garden: Home Assistant Supervisor
https://home-assistant.io/hassio/
Apache License 2.0
1.77k stars 648 forks source link

Mounting to Network Share Failed using guest #4356

Closed mrslvd closed 1 year ago

mrslvd commented 1 year ago

The problem

I can't connect Home Assistant to samba share. I got USB drive connected to Asus router. Guest login is allowed and no user and pass is needed. When I type \192.168.0.1\ext1 to windows explorer I can access this share. I can use this share from all other devices in my network. For example media players, android mobiles, TV set top boxes.

What version of Home Assistant Core has the issue?

2023.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Jun 08 17:13:08 homeassistant systemd[1]: Mounting Supervisor cifs mount: wrt...
Jun 08 17:13:08 homeassistant kernel: CIFS: Attempting to mount \\192.168.0.1\ext1
Jun 08 17:13:08 homeassistant mount[7193]: Password for root@//192.168.0.1/ext1:
Jun 08 17:13:08 homeassistant mount[7192]: mount error(22): Invalid argument
Jun 08 17:13:08 homeassistant mount[7192]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
Jun 08 17:13:08 homeassistant systemd[1]: mnt-data-supervisor-mounts-wrt.mount: Mount process exited, code=exited, status=32/n/a
Jun 08 17:13:08 homeassistant systemd[1]: mnt-data-supervisor-mounts-wrt.mount: Failed with result 'exit-code'.
Jun 08 17:13:08 homeassistant systemd[1]: Failed to mount Supervisor cifs mount: wrt.
Jun 08 17:13:08 homeassistant kernel: CIFS: VFS: cifs_mount failed w/return code = -22

Additional information

image image

frenck commented 1 year ago

Try using guest as a username?

mrslvd commented 1 year ago

image This happens if any user name is used. For example: anonymous, guest, the login name for my router, the name of my PC

Anto79-ops commented 1 year ago

Hi. I have the same issue with same error message (mount error).

I can connect to my USB drive connected to my router in Windows but cannot connect via HA.

markli96 commented 1 year ago

Hi, I have to same problem and I think the problem is in smb version - https://askubuntu.com/a/962862. But I don't know what to do about it 😄

ludeeus commented 1 year ago

No, that is not the same. For CIFS we currently do not support guest access (what this issue is about).

For version, you need to be running 2.1+ on your NAS/router/server. "-22" error, means something was wrong, it's a catch-all error.

Anto79-ops commented 1 year ago

hmm... I'm trying to figure out to determine the version on my router, I think its at least 2.0. Its Linksys WRT3200ACM running stock firmware. Guess I might have to upgrade to DD-WRT....now?

ludeeus commented 1 year ago

Still unrelated here, this is about guest access..

Anto79-ops commented 1 year ago

ahh, ok, when you say guest access do you mean guest username? It does not work for anything in the username or password, even blank fields.

ludeeus commented 1 year ago

I got USB drive connected to Asus router. Guest login is allowed and no user and pass is needed.

Anto79-ops commented 1 year ago

thanks for clarifying.

I'd be curious to know if the op also has the same issue with non-guest access...i,e. create username and password and try again.

markli96 commented 1 year ago

Hi, I don't know if I should create a new issue, but I am having the same problem when using guest access and also when using username and password.

I have just purchased TP-Link AX55 and I tried to find, what SMB it supports and it should be version 2. But I don't know if it is 2.0 or 2.1+.

When I use guest mode, the log looks like this:

Jun 10 06:52:00 homeassistant systemd[1]: Mounting Supervisor cifs mount: TPLinkShare... Jun 10 06:52:00 homeassistant kernel: CIFS: Attempting to mount \192.168.2.1\G Jun 10 06:52:00 homeassistant mount[234819]: Password for root@//192.168.2.1/G: Jun 10 06:52:00 homeassistant mount[234818]: mount error(22): Invalid argument Jun 10 06:52:00 homeassistant mount[234818]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg) Jun 10 06:52:00 homeassistant kernel: CIFS: VFS: cifs_mount failed w/return code = -22 Jun 10 06:52:00 homeassistant systemd[1]: mnt-data-supervisor-mounts-TPLinkShare.mount: Mount process exited, code=exited, status=32/n/a Jun 10 06:52:00 homeassistant systemd[1]: mnt-data-supervisor-mounts-TPLinkShare.mount: Failed with result 'exit-code'. Jun 10 06:52:00 homeassistant systemd[1]: Failed to mount Supervisor cifs mount: TPLinkShare.

And when I use username and password it looks like this:

Jun 10 06:56:35 homeassistant systemd[1]: Mounting Supervisor cifs mount: TPLinkShare... Jun 10 06:56:35 homeassistant kernel: CIFS: Attempting to mount \192.168.2.1\G Jun 10 06:56:35 homeassistant mount[236248]: mount error(22): Invalid argument Jun 10 06:56:35 homeassistant mount[236248]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg) Jun 10 06:56:35 homeassistant kernel: CIFS: VFS: cifs_mount failed w/return code = -22 Jun 10 06:56:35 homeassistant systemd[1]: mnt-data-supervisor-mounts-TPLinkShare.mount: Mount process exited, code=exited, status=32/n/a Jun 10 06:56:35 homeassistant systemd[1]: mnt-data-supervisor-mounts-TPLinkShare.mount: Failed with result 'exit-code'. Jun 10 06:56:35 homeassistant systemd[1]: Failed to mount Supervisor cifs mount: TPLinkShare.

The network folder \\192.168.2.1\g is accessible via windows file manager. image

image image

And here is my router settings: image image

I have tried to use //TPShare instead of router IP address (192.168.2.1), but the home assistant cannot resolve the domain address.

Jun 10 07:06:54 homeassistant systemd[1]: Mounting Supervisor cifs mount: TPLinkShare... Jun 10 07:06:55 homeassistant systemd[1]: run-docker-runtime\x2drunc-moby-c29cbc5cac75c6e24aff381328f982a1d31790f4f1c788c1976286a659b5e26f-runc.dKe0GS.mount: Deactivated successfully. Jun 10 07:06:58 homeassistant mount[238429]: mount error: could not resolve address for TPShare: Unknown error Jun 10 07:06:58 homeassistant systemd[1]: mnt-data-supervisor-mounts-TPLinkShare.mount: Mount process exited, code=exited, status=1/FAILURE Jun 10 07:06:58 homeassistant systemd[1]: mnt-data-supervisor-mounts-TPLinkShare.mount: Failed with result 'exit-code'. Jun 10 07:06:58 homeassistant systemd[1]: Failed to mount Supervisor cifs mount: TPLinkShare.

I hope this will help someone to fix this. Thank you in advance.

markli96 commented 1 year ago

And just to let you know. I have tried it today again and there was additional message in the host log.

Jun 12 06:58:01 homeassistant systemd[1]: Mounting Supervisor cifs mount: TPLinkShare... Jun 12 06:58:01 homeassistant kernel: Key type cifs.spnego registered Jun 12 06:58:01 homeassistant kernel: Key type cifs.idmap registered Jun 12 06:58:01 homeassistant kernel: CIFS: No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3.1.1), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3.1.1 (or even SMB3 or SMB2.1) specify vers=1.0 on mount. Jun 12 06:58:01 homeassistant kernel: CIFS: Attempting to mount \192.168.2.1\g Jun 12 06:58:01 homeassistant mount[64087]: mount error(22): Invalid argument Jun 12 06:58:01 homeassistant mount[64087]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg) Jun 12 06:58:01 homeassistant kernel: CIFS: VFS: cifs_mount failed w/return code = -22 Jun 12 06:58:01 homeassistant systemd[1]: mnt-data-supervisor-mounts-TPLinkShare.mount: Mount process exited, code=exited, status=32/n/a Jun 12 06:58:01 homeassistant systemd[1]: mnt-data-supervisor-mounts-TPLinkShare.mount: Failed with result 'exit-code'. Jun 12 06:58:01 homeassistant systemd[1]: Failed to mount Supervisor cifs mount: TPLinkShare.

But when I try it again, the messages are the same as in my previous comment.

ludeeus commented 1 year ago

You are still off-topic here @markli96, you are using username/password, this issue is about guest access. Your problem is that your router is using too old SMB, you need 2.1 or higher.

nstrelow commented 1 year ago

I have the same 2 problems. Guest access, but also I only have smb v2.0.2

mrslvd commented 1 year ago

Hello, After updating the core to 2023.7 I still can't mount my network storage. After entering the data according to my first post, here is the log message data: Jul 05 19:30:08 homeassistant kernel: CIFS: Attempting to mount \192.168.0.1\ext1 Jul 05 19:30:08 homeassistant mount[6130]: mount error(22): Invalid argument Jul 05 19:30:08 homeassistant kernel: CIFS: VFS: cifs_mount failed w/return code = -22 Jul 05 19:30:08 homeassistant mount[6130]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg) Jul 05 19:30:08 homeassistant systemd[1]: mnt-data-supervisor-mounts-wrt.mount: Mount process exited, code=exited, status=32/n/a Jul 05 19:30:08 homeassistant systemd[1]: mnt-data-supervisor-mounts-wrt.mount: Failed with result 'exit-code'. Jul 05 19:30:08 homeassistant systemd[1]: Failed to mount Supervisor cifs mount: wrt. Jul 05 19:30:23 homeassistant systemd[1]: run-docker-runtime\x2drunc-moby-c4fbbcbdd631e2920af2118df2f08ce53079fcf58948065cf7d111e61b04954f-runc.hMQJJw.mount: Deactivated successfully.