Connecting with Samba sharing on VM with WIN10


#1

I’m having trouble connecting with Samba through Windows 10. My HA installation is running on a Virtualbox VM (windows 10 pro machine). I can’t connect to Samba with the host machine, nor the other windows machines inside the network. I tried the usual things:

  • Setting the encryption level to 40- or 56-bits on the advanced sharing options
  • Enabling the SMB1.0/CIFS setting

I know there are many Samba connection topics on this forum, but I believe this has something to do with the subnet, which might differ between the pc’s on the network and the Home Assistant installation on the VM. This is my SAMBA log:

[INFO] Read hostname: hassio Registered MSG_REQ_POOL_USAGE Registered MSG_REQ_DMALLOC_MARK and LOG_CHANGED No builtin backend found, trying to load plugin tdbsam_open: Converting version 0.0 database to version 4.0. tdbsam_convert_backup: updated /var/lib/samba/private/passdb.tdb file. tdb(/var/lib/samba/winbindd_idmap.tdb): tdb_open_ex: could not open file /var/lib/samba/winbindd_idmap.tdb: No such file or directory tdb(/var/lib/samba/account_policy.tdb): tdb_open_ex: could not open file /var/lib/samba/account_policy.tdb: No such file or directory account_policy_get: tdb_fetch_uint32_t failed for type 1 (min password length), returning 0 account_policy_get: tdb_fetch_uint32_t failed for type 2 (password history), returning 0 account_policy_get: tdb_fetch_uint32_t failed for type 3 (user must logon to change password), returning 0 account_policy_get: tdb_fetch_uint32_t failed for type 4 (maximum password age), returning 0 account_policy_get: tdb_fetch_uint32_t failed for type 5 (minimum password age), returning 0 account_policy_get: tdb_fetch_uint32_t failed for type 6 (lockout duration), returning 0 account_policy_get: tdb_fetch_uint32_t failed for type 7 (reset count minutes), returning 0 account_policy_get: tdb_fetch_uint32_t failed for type 8 (bad lockout attempt), returning 0 account_policy_get: tdb_fetch_uint32_t failed for type 9 (disconnect time), returning 0 account_policy_get: tdb_fetch_uint32_t failed for type 10 (refuse machine password change), returning 0 Added user hassio. nmbd version 4.8.4 started. Copyright Andrew Tridgell and the Samba Team 1992-2018 Registered MSG_REQ_POOL_USAGE Registered MSG_REQ_DMALLOC_MARK and LOG_CHANGED added interface enp0s3 ip=10.0.2.15 bcast=10.0.2.255 netmask=255.255.255.0 making subnet name:10.0.2.15 Broadcast address:10.0.2.255 Subnet mask:255.255.255.0 making subnet name:UNICAST_SUBNET Broadcast address:0.0.0.0 Subnet mask:0.0.0.0 making subnet name:REMOTE_BROADCAST_SUBNET Broadcast address:0.0.0.0 Subnet mask:0.0.0.0 load_lmhosts_file: Can’t open lmhosts file /etc/samba/lmhosts. Error was No such file or directory daemon_ready: STATUS=daemon ‘nmbd’ finished starting up and ready to serve connections smbd version 4.8.4 started. Copyright Andrew Tridgell and the Samba Team 1992-2018 Registered MSG_REQ_POOL_USAGE Registered MSG_REQ_DMALLOC_MARK and LOG_CHANGED Processing section “[config]” Processing section “[addons]” Processing section “[ssl]” Processing section “[share]” Processing section “[backup]” added interface enp0s3 ip=10.0.2.15 bcast=10.0.2.255 netmask=255.255.255.0 INFO: Profiling support unavailable in this build. No builtin backend found, trying to load plugin tdb(/var/lib/samba/registry.tdb): tdb_open_ex: could not open file /var/lib/samba/registry.tdb: No such file or directory daemon_ready: STATUS=daemon ‘smbd’ finished starting up and ready to serve connections waiting for connections check_for_master_browser_fail: Forcing election on workgroup WORKGROUP subnet 10.0.2.15 send_election_dgram: Sending election packet for workgroup WORKGROUP on subnet 10.0.2.15 send_election_dgram: Sending election packet for workgroup WORKGROUP on subnet 10.0.2.15 send_election_dgram: Sending election packet for workgroup WORKGROUP on subnet 10.0.2.15 send_election_dgram: Sending election packet for workgroup WORKGROUP on subnet 10.0.2.15 send_election_dgram: Sending election packet for workgroup WORKGROUP on subnet 10.0.2.15 run_elections: >>> Won election for workgroup WORKGROUP on subnet 10.0.2.15 <<< become_local_master_browser: Starting to become a master browser for workgroup WORKGROUP on subnet 10.0.2.15 ***** Samba name server HASSIO is now a local master browser for workgroup WORKGROUP on subnet 10.0.2.15 *****

And the config (I messed a bit with the allowed hosts, but frankly I have no clue what I was doing):

{
“workgroup”: “WORKGROUP”,
“username”: “user”,
“password”: “pass”,
“interface”: “enp0s3”,
“allow_hosts”: [
“10.0.0.0/8”,
“172.16.0.0/12”,
“192.168.0.0/16”,
“10.0.2.0/16”,
“10.0.2.15”,
“0.0.0.0”
]
}

The 10.0.2.15 subnet of Samba doesn’t seem familiar with other devices on my network. Does anyone have a clue how to check this?

Looking forward to your response!


#2

How is the virtual box network configured?

Host only? Bridge?

This is what’s key to the host pc seeing the VM


#3

Hi @Robbrad , thanks for your reply!

I configured the VM with NAT. I tried Bridge first, but it didn’t show my VM as a seperate machine inside the router. With NAT I’m using the IP of the host, which is fine. I also configured the ports that I also configured in my router. The following addons are working fine: LetsEncrypt, Configurator, Node-RED, TasmoAdmin.

Except for Samba…


#4

Where are you running Samba from ?


#5

@Robbrad From within the Hassio installation on the VM using the Samba addon.

I tried connecting to Samba using the host PC running the VM, and another PC that’s connected to the same router (and within the same IP range as the host PC).


#6

does a simple windows share work? Windows share is practically the same as SMB


#7

Does Hassio have an addon for that?


#8

Just trying to understand what your trying to achieve - is to have a share to the config so you can edit from any machine?


#9

That’s right. The only way to access my Hassio configuration files in case my front-end won’t load (had that before) is through samba.

My main goal is to be able to backup my configuration files and being able to restore it. I’m backing up my VM periodically, but it’s not easy to retreive the configuration files out of VDI files. Being able to download snapshots (which I make 2 times a week) through Samba gives me the opportunity to retrieve the latest configuration in case of a crash like I had before.

Also editting the YAML files within other software is a plus for me.


#10

ok cool - So why not just create a standard windows share on the VM - to hass folder?

No need to use the Hass addon


#11

Ah, I didn’t know this was an option. Can you tell me how to achieve this?


#12

Try following https://lifehacker.com/how-to-share-a-folder-over-your-network-5808814

If you get stuck ping me


#13

Thank you for taking the time to help me! :blush:

The problem here is that I don’t seem to have a folder that I can share. Inside the VM folder there’s only this:

image

The cloned VM’s only have the .VDI file inside the folder.

A few weeks back when my Raspberry crashed, I discovered that my config files were also hidden on the SD card. I was unable to retrieve them because of the strange partition structure and format. That’s how I got to Samba.


#14

You have to run the VM, log into that box and share the folder Inside the VM

Your looking at the VM image there. Does that make sense?


#15

If that’s possible, it sounds like a solution! :blush:

I can’t find any folders inside the VM though. The VM only has the webinterface and the console. Is it possible to share a folder from within the console?


#16

Hmm when you boot the VM up, is it Windows or Linux? Not the host operating system, the VM operating system its self.

Which guide did you follow to get this VM setup?


#17

At https://www.home-assistant.io/hassio/installation/ I downloaded the VDI image. Virtualbox is running that VDI image. So, the OS should be Hass.io. Linux-based right?


#18

Ok it’s making more sense now.

You need to use putty to SSH into the VM when it’s running. The guide mentioned a how to do this.

Then follow this guide https://www.hiroom2.com/2017/08/02/fedora-26-samba-en/

This will give you native SMB (samba) on the VM

Make sure the folder you share in the smb config is your Hass config folder.


#19

I’ll look into it, thank you!

Two concerns:

  1. Isn’t this exactly what the Samba addon does?
  2. Doesn’t therefore give this the exact same problems as the Samba addon?

I haven’t tried to get the SSH working yet, so I’ll look into that first.


#20
  1. Not sure it’s the same. It might be but your abstracted from the ‘how does it really work’ - thus when you hit an issue you don’t really know how it works.

  2. Even if it does you will have more control to investigate the issues you are seeing.

Sorry if this feels a little pointless.