[SOLVED] samba nmbd does not start at boot

This forum is dedicated to advanced help and support :

Ask here your questions about advanced usage of Mageia. For example you may post here all your questions about network and automated installs, complex server configurations, kernel tuning, creating your own Mageia mirrors, and all tasks likely to be touchy even for skilled users.

[SOLVED] samba nmbd does not start at boot

Postby pernel » Jul 30th, '15, 19:58

New Mageia 5 64 bit on a Dell precision T5500 with two processors, in total 8 cores.
The host name is not visible in network after boot.
Found out that if samba is restarted with webmin, the hostname becomes visible and samba sharing works.

After boot:
Code: Select all
 
# ps -A | grep mbd
 3155 ?        00:00:00 smbd
 3174 ?        00:00:00 smbd

shows that nmbd is not running after boot.

Restarting:
Code: Select all
]
# /etc/init.d/smb restart
Restarting smb (via systemctl):                                 [  OK  ]
[root@lindell ~]# ps -A | grep mbd
16156 ?        00:00:00 smbd
16166 ?        00:00:00 nmbd
16171 ?        00:00:00 smbd

After this the host name appears visible in the network.

I tried uninstall and re-install samba but the result is the same.
I have another Mageia 5 64 bit in virtualbox with samba working normally but that is an upgrade from Mageia 4.

I would appreciate help to pinpoint and fix the problem.
Of course a possible workaround would be to use a script to restart samba some period after the machine has booted but that's not so elegant.
Last edited by pernel on Aug 4th, '15, 19:12, edited 2 times in total.
pernel
 
Posts: 66
Joined: Mar 21st, '12, 20:13

Re: samba nmbd does not start at boot

Postby doktor5000 » Jul 31st, '15, 17:14

Can you please show the output as root of
Code: Select all
systemctl status smb.service -a -n50


edit: Hmmm, will probably not help that much as samba has not been converted yet to systemd unit files.

But the output of
Code: Select all
journalctl -ab | grep -iE "smbd|nmbd|samba"

might be useful.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18018
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: samba nmbd does not start at boot

Postby pernel » Jul 31st, '15, 18:01

Code: Select all
[root@lindell ~]# journalctl -ab | grep -iE "smbd|nmbd|samba"
[root@lindell ~]#

Obviously gives no output when the machine was booted recently.

Code: Select all
[root@lindell ~]# ps -A | grep mbd                                               
 3085 ?        00:00:00 smbd
 3103 ?        00:00:00 smbd
[root@lindell ~]# systemctl status smb.service -a -n50                          ● smb.service - LSB: Samba servers (nmbd and smbd)
   Loaded: loaded (/etc/rc.d/init.d/smb)
   Active: active (running) since fre 2015-07-31 19:37:15 CEST; 2min 49s ago
  Process: 3076 ExecStart=/etc/rc.d/init.d/smb start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/smb.service
           ├─3085 smbd -D
           └─3103 smbd -D

jul 31 19:37:15 lindell smb[3076]: Startar SMB-tjänster: [  OK  ]
jul 31 19:37:15 lindell smb[3076]: Startar NMB-tjänster: [  OK  ]
[root@lindell ~]# ps -A | grep mbd
 3085 ?        00:00:00 smbd
 3103 ?        00:00:00 smbd


This behaviour is not completely consistent. Sometimes also nmbd is started at boot.
Last edited by pernel on Jul 31st, '15, 20:00, edited 1 time in total.
pernel
 
Posts: 66
Joined: Mar 21st, '12, 20:13

Re: samba nmbd does not start at boot

Postby doktor5000 » Jul 31st, '15, 18:22

pernel wrote:Obviously gives no output when the machine has booted recently.

Well, I'd say it should at least log when it starts, no?

Apart from that, as the other ouput doesn't provide much insight as it's still a legacy sysV service, can't help that much.
Either it's some kind of race condition and it starts too early, before network stack is already available.
You could try to rule that out by disabling it for system start, and start it manually later on - if it starts OK,
then you might need to enable the network-auth service so that the system waits for the network to be up during boot.

Otherwise you probably need to enable debug logging to see why nmbd does not start normally, only on restart.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18018
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: samba nmbd does not start at boot

Postby pernel » Jul 31st, '15, 20:04

I edited last post while you were commenting it. Maybe some useful information now?
pernel
 
Posts: 66
Joined: Mar 21st, '12, 20:13

Re: samba nmbd does not start at boot

Postby pernel » Jul 31st, '15, 21:53

Output from this command attached
[root@lindell ~]# journalctl -ab | grep -iE "smb|nmb|eth0|em1" > /home/per/journal.log
Attachments
journal.log
(41.26 KiB) Downloaded 433 times
pernel
 
Posts: 66
Joined: Mar 21st, '12, 20:13

Re: samba nmbd does not start at boot

Postby doktor5000 » Aug 1st, '15, 19:42

pernel wrote:I edited last post while you were commenting it. Maybe some useful information now?

None that I can see. I understood why the previous journalctl query gave no output, as it does not write the log as smbd but only as smb.
Nonetheless, only the two lines of it starting.

You can try to increase the loglevel of samba log itself, but I'm not sure that will help with your issue.
With default settings you would need to at least uncomment "log level" setting and increase it slightly.
Code: Select all
┌─[doktor5000@Mageia5]─[19:40:15]─[~]
└──╼ grep "log [file,level]" /etc/samba/smb.conf                                                                                                                                                                   
# this tells Samba to use a separate log file for each machine
   log file = /var/log/samba/%m.log
# Put a capping on the size of the log files (in Kb).
# Set the log (verbosity) level (0 <= log level <= 10)
# log level = 3
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18018
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: samba nmbd does not start at boot

Postby pernel » Aug 3rd, '15, 11:55

Have not yet found any solution, only a "dirty" workaround.
I'm more or less sure this is a race condition. Posts in other forums indicate that possibility.
Anyhow I made a script run by cron each minut that checks if nmbd is up, and if not, restarts samba. Not very elegant, but at least it gives a stable network connection.
Would prefer to run this script only once but at a point after startup when the network is guaranteed to be up vith a consistent interface name.
Even better would be to find a way to wait with the first attempt to start samba until network is up and the interface name is stable.
This mix between system V and systemd makes me very confused. I dont understand how to modify start scripts to ensure samba is initiated very late in the startup sequence.
In post 4 you suggest:
if it starts OK,
then you might need to enable the network-auth service so that the system waits for the network to be up during boot.
.
How do I enable that?
pernel
 
Posts: 66
Joined: Mar 21st, '12, 20:13

Re: samba nmbd does not start at boot

Postby doktor5000 » Aug 3rd, '15, 17:48

As root do
Code: Select all
systemctl enable network-auth

If you use networkmanager it would be
Code: Select all
systemctl enable NetworkManager-wait-online.service
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18018
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: samba nmbd does not start at boot

Postby pernel » Aug 4th, '15, 08:28

Thanks a lot!
systemctl enable network-auth
fixed the problem. Samba (including nmbd) now consistently starts each time. It's obvious that there was a race condition.
In which configuration file is this parameter stored or where is the startup code changed by this command? I ask because I wonder if future updates or upgrades will break this fix.
Is this considered to be a bug that should be reported or is my case too rare?
pernel
 
Posts: 66
Joined: Mar 21st, '12, 20:13

Re: samba nmbd does not start at boot

Postby doktor5000 » Aug 4th, '15, 18:36

It is too rare, I'd say, never heard before about this issue with nmbd.

As network-auth is one of the legacy sysV services which was not yet converted to a systemd unit,
it's only stored as empty files to signal start/stop in the respective runlevels:

Code: Select all
/etc/rc.d/rc0.d/K50network-auth
/etc/rc.d/rc1.d/K50network-auth
/etc/rc.d/rc2.d/S50network-auth
/etc/rc.d/rc3.d/S50network-auth
/etc/rc.d/rc4.d/S50network-auth
/etc/rc.d/rc5.d/S50network-auth
/etc/rc.d/rc6.d/K50network-auth
/etc/rc.d/rc7.d/S50network-auth


The only thing this does is that the system will wait during boot until the network interface is fully initialised.
Normally this is done in the background and in a parallel way, as it's not that critical during boot for majority of users,
and leads to the graphical desktop that can start much earlier.

The other thing you could do, is to mark any network filesystem you might have in /etc/fstab with the _netdev option,
that might have a similar affected if you mount any network filesystem during boot, but might not be sufficient for your nmbd issue.

Anyways, with mga6 we will finally switch to samba 4 :)

Please mark the thread accordingly by editing the topic of the first post and prefix it by [SOLVED], thanks
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18018
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany


Return to Advanced support

Who is online

Users browsing this forum: No registered users and 1 guest