No new ideas after seeing your settings…
I’ll shoot some ideas and questions:
Is unraid and hassos on the same machine?
Can you ping nas from hassos? Ping from other machines in local network?
Does nas has some firewall in it?
Try adding -v option to mount command, it should add verbose output.
Hey,
I was getting the same thing when trying to connect my Synology NAS. What ended up working for me was actually running the command through an automation. I had the commands setup as a shell_command
and ran that shell_command
from the automation.
I could not see the mount point from the CLI after running from the automation. I’m not too experienced with docker yet so my assumption is that the mount point is in a different location than what is accessible from the CLI.
Either way, I would love a better solution because if you need to change the command in any way or unmount it, you have to create new shell_command
to unmount and then change settings, each requiring a HA restart between each.
@insajd cheers for the brainstorming!
-v didnt output anything new, does that work with the mount command?
As to the setup details. Networking wise:
- HASSOS is a separate machine (Intel NUC)
- UnRaid (NAS) is a different server all together, basically custom built
- Both devices connect to the same switch and also same subnet (its a flat network)
- HASSOSS and NAS connect to eachother and i have my HA smb shares mounted on the NAS for back up purposes so no restirctions there, ping runs fine network is fine
- NAS has a simple firewall, but that isnt the issue as it allows smb connections to the server from other machines
Overall the NAS works fine, its only when I try to connect to the SMB share from HA that I get this issue, never had any propblems with this share on anyother device.
As a test I booted up my Ubuntu VM on my laptop and was able to mount the SMB share to Ubuntu. So everything works, apart from HA refusing to play! Command used for test:
mount -t cifs -o username=USER,password=PASSWORD,domain=WORKGROUP //192.168.1.20/nvr-cctv /mnt/media2
@Cyberfighter - How do you know that the shell_command mounted the share? how do you confirm this in the HA GUI?
I’ve created the shell_command and when i run the service there is nothing that lets me to believe that its mounted?
This is why i tried to see if it even mounts from the CLI running as root?
Cheers guys!!
MAN! you were right! it doesnt work in CLI for soem daft reason been needlessly chasing my own tail…
@insajd original method works i was just being an idiot!
For anyone else who may be in the same boat as me this is where i went wrong, didnt understant how the media browser works!
So missing the following in my configuration.yaml
homeassistant:
media_dirs:
recordings: /mnt/media2
Once I added the above and ran my shell:
shell_command:
mount_cctv_media_folder: mount -t cifs -o username=USER,password=PASSWORD,domain=WORKGROUP //192.168.1.20/nvr-cctv /mnt/media2
It all appeared in the media browser!!
Sorry for waisting your time guys, and appreciate the support
Glad you fixed it. One note though, after HA upgrade you’ll probably need to connect to the ha and recreate the /mnt/media2 folder. Not to do it, add “mkdir -p /mnt/media2;” before mount command in shell_command.
Yep good point, i just got too excited that i managed to mount it
, now to make this thing automated and last a reboot!
Guys, i need also add my NAS folder to my Mediabrowser folder in Hassios, but no success, I get permission denied when i do that via de Terminal addon.
mount -t cifs -o username=xxxxxx,password=xxxxx,domain=WORKGROUP //192.xxx.yy.z/music /media
What is wrong here?
Do i need to create/mount a local folder on the Hassos?
In order to mount a folder, it must exist, yes. But you’re mounting to /media, which exists in docker image.
Have a look at comment of @nickcj Mount remote smb share on hassio where he says that the command didn’t work from terminal, but actually worked when he used it as shell_command.
Detailed steps that I did to get shares working, is described in comment 28 Mount remote smb share on hassio
Very very veryyy thanks, it works now like a charm!!! All of my music collection i can now browse via mediabrowser…
Another question is how i can play songs after and after. It stops now by me at the end of every track and then i must to browse the next track and hit to play.
i get error on
homeassistant:
media_dirs:
recordings: /mnt/media2
when making the Check
not a directory for dictionary value @ data[‘media_dirs’][‘recordings’]
what can be wrong?
I had this error issue when I tried to put that yaml in the wrong place of the config file.
I will take a look tomorrow morning and send you a sample of where I’ve managed to enter that config and get it to pass the config checker.
@denveronly
I ended up having to put my media_dirs config right at the top of my configuration.yaml file for to configuration to be validated. Not sure if its the right place or not, but it’s working for me with no negatives.
If you configure using the Visual Studio Code plugin within HA, then it will still throw up an error with “Property media_dirs is not allowed” however ignore that, i am assuming its a plugin issue. Just hit save and go to your server controls and check config then reboot, everything should work.
Sample of mine below:
# Configure a default setup of Home Assistant (frontend, api, etc)
homeassistant:
media_dirs:
cctv: /mnt/cctv
default_config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
# base_url: example.duckdns.org:8123
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
python_script:
system_health:
climate:
well my string is from config.yaml from the very top (second line if to be correct)
it gives an error, and the cause of that is any other folder, or a string mnt
if i restart it, HA goest to safemode with that error
The only version that passes the check is
homeassistant:
media_dirs:
local: /media
I had the same problem, but when I upgraded to version 0.116 I get only the warning from VS plugin
what version is your HA?
It is Hassio supervised 0.116.4
You should check comment 29: Mount remote smb share on hassio - #29 by JZhass
The reason seem to be missing folder. This command was working for @JZhass to create folder in docker.
sudo docker exec -i homeassistant mkdir /mnt/_NASVIDEO && sudo docker container restart homeassistant
Another approach - install portainer, open shell, create folder.
Yet another approach - do not list anything in media_dirs, but do create shell_command: “mkdir /mnt/media2” - execute it, and then create media_dirs config. But you probably will need to do this after every upgrade.
Hey man, it worked, you are a genius. The error is gone. well i tried before to make a folder using portainer console. but ssh comands worked better
but the thing is that the drive is still not mounting
i wrote this command in configuration.yaml
shell_command:
mount_smbmedia_folder: mount -t cifs -o username=idenya,password=Password,domain=WORKGROUP //192.168.1.210/Public /mnt/media2
It goes to my WD my cloud drive. IP, Login, Password are correct im pretty sure. Folder exists (if it would not exist - the error did not go away)
but it doesnt mount.
If i try to execute Shell command manualy in configurator i get
Command executed: mount -t cifs -o username=idenya,password=Password,domain=WORKGROUP //192.168.1.210/Public /mnt/media2 : 255
mount: mounting //192.168.1.210/Public on /mnt/media2 failed: No such file or directory
Ugh
Update:
i did it using command in ssh
sudo docker exec -i homeassistant mount -t cifs -o username=idenya,password=Password,domain=WORKGROUP //192.168.1.210/Public /mnt/media2
all cool! the last question - how to make the shell script work? i guess it is some rights problem?
Does the shell not execute at all when you run it? it looks identical to mine (i just create the directory first then mount) but that shouldnt make any difference unless your directory gets destroyed and not re-created.
Have you tried addint the mkdir -p /mnt/cctv;
to run before your mount command as listed in earlier posts?
it doesnt execute at all.
directory exists, it doesnt get deleted. but drive doesnt mount
if i send ssh command to docker to mount it gets mounted
so the problem is maybe permissions or level of access?