Samba in host and container

Having samba in both lxd-host and container causes smbd to fail in host. You can test if smbd is running by:

root@host:~# netstat -apn | grep 445
tcp        0      0 *               LISTEN      13390/smbd      
tcp        0      0 a.b.c.d:445*               LISTEN      13390/smbd      
tcp        0      0*               LISTEN      13390/smbd      
tcp        0      0 a.b.c.d:445        a.b.c.55:3029       TIME_WAIT   -               
tcp        0      0 a.b.c.d:445        a.b.c.44:35502      FIN_WAIT2   -               
tcp        0      0 a.b.c.d:445        a.b.c.55:3031       ESTABLISHED 13395/smbd      
tcp6       0      0 ::1:445                 :::*                    LISTEN      13390/smbd      
unix  2      [ ACC ]     STREAM     LISTENING     22445    1/init              /run/snapd.socket

Soln: Changed this line in the file /etc/init.d/smbd

if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/smbd -- -D ; then
if ! start-stop-daemon --start --quiet --oknodo --pidfile /var/run/samba/ --exec /usr/sbin/smbd -- -D ; then

This way it starts smbd if it’s pid file does not exist.

Is there any place to raise this bug? I am posting this here as anyone doing the same can be warned.

It seems an improvement in the startup scripts of samba, to better support containers. So probably should be directed to the package maintainers of samba

I’m guessing the OS is ubuntu, in which case suppose the distro-maintainers of the package samba for ubuntu 18.04 could be a starting point:


What is the actual significance of specifying the PID file?

Between the host and the container, the host’s SAMBA can only affect the container’s SAMBA when it binds first the network ports.

If anyone visits this you need know that it has been fixed in Ubuntu