Doing a Little Samba

I ran into some interesting problems getting Samba to work on my Raspberry Pi and be discoverable under Windows 10. This article summarizes how I got things working. Context: my Pi runs Debian Buster.

The first, and biggest, problem was getting Samba installed. Normally that’s drop-dead simple, by doing this (from https://wiki.debian.org/SambaServerSimple):

> apt-get install samba
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  attr libcephfs2 libgpgme11 python-crypto python-dnspython python-gpg python-ldb python-samba python-tdb samba-common-bin
  samba-dsdb-modules samba-vfs-modules tdb-tools
Suggested packages:
  python-crypto-doc bind9 bind9utils ctdb ldb-tools ntp | chrony smbldap-tools winbind heimdal-clients
The following NEW packages will be installed:
  attr libcephfs2 libgpgme11 python-crypto python-dnspython python-gpg python-ldb python-samba python-tdb samba samba-common-bin
  samba-dsdb-modules samba-vfs-modules tdb-tools
0 upgraded, 14 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,877 kB/5,457 kB of archives.
After this operation, 38.9 MB of additional disk space will be used.
Do you want to continue? [Y/n]
...details omitted
Setting up samba-common-bin (2:4.9.5+dfsg-5+deb10u1+rpi1) ...
Checking smb.conf with testparm
Load smb config files from /etc/samba/smb.conf
Error loading services.
dpkg: error processing package samba-common-bin (--configure):
 installed samba-common-bin package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of samba:
 samba depends on samba-common-bin (= 2:4.9.5+dfsg-5+deb10u1+rpi1); however:
  Package samba-common-bin is not configured yet.

dpkg: error processing package samba (--configure):
 dependency problems - leaving unconfigured
Processing triggers for ufw (0.36-1) ...
Processing triggers for systemd (241-7~deb10u4+rpi1) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10+rpi1) ...
Errors were encountered while processing:
 samba-common-bin
 samba
E: Sub-process /usr/bin/dpkg returned an error code (1)

Unfortunately, once the installation of dependency samba-common-bin starts (line 18, prior details omitted) the install blows up. With a not terribly helpful error message.

After struggling with this for a few hours I tried installing samba-common-bin, explicitly, before attempting to install samba. That failed, too, but it contained a more helpful warning that pointed to the solution:

> sudo cp /usr/share/samba/smb.conf /etc/samba/smb.conf

Apparently the problem was caused by a missing configuration file which, for whatever reason, the install routines weren’t copying over themselves when it was missing. In any event, manually copying the file allowed the installation of samba and smbclient to succeed.

I then set up an SMB user on the Pi corresponding to my Windows identity and thought I was done:

> sudo smbpasswd -a mark

But my home folder on the Pi still wasn’t visible under Windows 10. Interestingly, I could map a network drive to the home folder provided I manually specified the UNC path with \\mycroft\mark (mycroft is my Pi’s name) and telling Windows what credentials to use (basically just entering my normal Windows logon credentials for the newly-created mapping). So access wasn’t the problem; the ability to browse home folders was.

It turns out this is related to Microsoft, and others, deprecating the SMB1 protocol for security reasons. Some sites suggest you can work around this problem by re-enabling the SMB1 protocol under Windows 10. I tried that and it didn’t work for me. It also opens a pretty severe security hole in your environment so it’s not really a good answer.

A better approach is to add a new service/daemon to the Pi which supports Windows’ Web Service Discovery protocol. Fortunately, someone’s already written one and made it available on github (thanx, Steffen!). Even better, someone’s written a simple set of instructions for getting it installed and working on Ubuntu.

After getting the new daemon up and running, voila!, home folders visible under Windows 10!

1 thought on “Doing a Little Samba”

Leave a Comment

Your email address will not be published. Required fields are marked *

Categories
Archives