LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Samba fails: "Failed to create pipe directory" (https://www.linuxquestions.org/questions/linux-server-73/samba-fails-failed-to-create-pipe-directory-4175664191/)

Lestrad 11-13-2019 11:54 AM

Samba fails: "Failed to create pipe directory"
 
Hello. I have upgraded Samba from version 4.8. to version 4.10.10 to try to solve this problem, but it continues:

I am able to start and enable the smb.service and then connect to the shares on my Wandboard Quad from my Windows and Linux desktop computers. But if I reboot the Wandboard Samba fails with the following output (****..****" added by me for emphasis):


Code:

smb.service - Samba SMB Daemon
  Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; vendor preset: disabled)
  Active: ****failed**** (Result: exit-code) since Sun 2019-11-10 14:05:56 CET; 1min 52s ago
    Docs: man:smbd(8)
          man:samba(7)
          man:smb.conf(5)
  Process: 398 ExecStart=/usr/bin/smbd --foreground --no-process-group $SMBDOPTIONS (code=exited, status=255/EXCEPTION)
 Main PID: 398 (code=exited, status=255/EXCEPTION)
  Status: "Starting process..."

Nov 10 14:05:54 alarm systemd[1]: Starting Samba SMB Daemon...
Nov 10 14:05:56 alarm smbd[398]: [2019/11/10 14:05:56.104125,  0] ../../source3/smbd/server.c:2074(main)
Nov 10 14:05:56 alarm smbd[398]:  ****Failed to create pipe directory /run/samba/ncalrpc - No such file or directory****
Nov 10 14:05:56 alarm systemd[1]: smb.service: Main process exited, code=exited, status=255/EXCEPTION
Nov 10 14:05:56 alarm systemd[1]: smb.service: Failed with result 'exit-code'.
Nov 10 14:05:56 alarm systemd[1]: Failed to start Samba SMB Daemon.

If I create the /run/samba/ncalrpc directory I can successfully start the smb.service and after that again connect to the shares from other computers. But if I reboot Samba again fails to start and I see the same output as above. And the /run/samba/ncalrpc directory I created has disappeared.

This is the same problem I was experiencing with Samba version 4.8. I see that it has been documented here and there for some time, but I have never found a solution. Any suggestions would be appreciated.

TIA
Les

tfrans 11-13-2019 12:22 PM

The directory ought to be created by systemd-tmpfiles.d at boot time based on the content of /usr/lib/tmpfiles.d/samba.conf which is supplied by the samba-common package. Does that file exist? If not then perhaps a yum reinstall samba-common might help.

Lestrad 11-13-2019 02:09 PM

Quote:

Originally Posted by tfrans (Post 6057287)
The directory ought to be created by systemd-tmpfiles.d at boot time based on the content of /usr/lib/tmpfiles.d/samba.conf which is supplied by the samba-common package. Does that file exist? If not then perhaps a yum reinstall samba-common might help.

Thanks! samba.conf exists in /usr/lib/tmpfiles.d/, and it contains these two lines:


Code:

D /run/samba 0755 - - -
d /var/log/samba 0755 - - -

As I mentioned, if I create the directory manually - as root or as the user "alarm" - samba then works but won't start after a reboot. It seems to get wiped out when I reboot. By what, and why, I don't know.

I'll try a reinstall of samba-common. Since I'm on Arch Linux it'll have to be pacman and not yum...

[later] Here's the result:

Code:

[alarm@alarm ~]$ sudo pacman -S samba-common
error: target not found: samba-common
[alarm@alarm ~]$


bgstack15 11-15-2019 09:16 AM

Ugly hack of an idea: Update the smb.service file to run a mkdir -p /run/samba/ncalrpc. Probably a PreExec command.

Wow, I've never known about the /usr/lib/tmpfiles.d/ directory, thanks! I guess you just want to make sure you have an entry for the /run/samba/ncalrpc even if you have to write it yourself, but it does indeed sound like a package manager thing.

Lestrad 11-16-2019 01:16 PM

Thanks! Might be worth trying.

Quote:

Probably a PreExec command.
Could you go into a little detail about PreExec? Below is my service.smb:

Code:

[Unit]
Description=Samba SMB Daemon
Documentation=man:smbd(8) man:samba(7) man:smb.conf(5)
Wants=network-online.target
After=network.target network-online.target nmb.service winbind.service

[Service]
Type=notify
NotifyAccess=all
PIDFile=/run/smbd.pid
LimitNOFILE=16384
EnvironmentFile=-/etc/conf.d/samba
ExecStart=/usr/bin/smbd --foreground --no-process-group $SMBDOPTIONS
ExecReload=/bin/kill -HUP $MAINPID
LimitCORE=infinity


[Install]
WantedBy=multi-user.target


But what I really want to know is what or who is blowing the directory away when I create it and then reboot.

Lestrad 11-20-2019 09:45 AM

Solution
 
I found it here. Very much what bgstack15 suggested.

Thanks to all who showed interest. I'll post the text of the solution I found below.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Samba (smb and nmb services) cannot be started, because /var/run/samba
directory does not exist.

Reproducible: Always

Steps to Reproduce:
1. systemctl start smb.service

Actual Results:
systemd[1]: Starting Samba SMB Daemon...
smbd[2173]: [2014/02/02 19:52:47.463767, 0]
./source3/smbd/server.c:1278(main)
smbd[2173]: standard input is not a socket, assuming -D option
smbd[2204]: [2014/02/02 19:52:47.464517, 0]
-../lib/util/pidfile.c:117(pidfile_create)
smbd[2204]: ERROR: can't open /var/run/samba/smbd.pid: Error was No such file
or directory
systemd[1]: PID file /run/samba/smbd.pid not /readable (yet?) after start.
systemd[1]: Failed to start Samba SMB Daemon.
systemd[1]: Unit smb.service entered failed state.


Expected Results:
It should just start

If I add the following line to /usr/lib/systemd/system/smb.service, smb can be
started:
ExecStartPre=/usr/bin/mkdir -p /var/run/samba

Same for nmb.service


All times are GMT -5. The time now is 08:23 AM.