PDA

View Full Version : F17 samba won't start after boot.


serendip82
8th April 2013, 01:08 PM
Hi,

I need some help with samba. I really don't know why it don't want to work. I tried so many things, goggled so much... no chance.

Maybe you can help me to work out a checklist for troubleshooting samba.


The steps that I have tried:

1) Install samba
yum install samba samba-client samba-swat system-config-samba

2)Acitivate some services
chkconfig smb on
chkconfig swat on
service smb start
service xinetd start
systemctl start smb.service
systemctl start nmb.service

Some may be arbitrary. I don't know why there a so many arbitrary options. I prefere the "service smb on" syntax scince I can remember it, it is easy and intuitive. Systemctl doesn't tell me anything. However, nothing really lead to success.

3) Allow samba services in the firewall.
Just checked samba and samba-client.

4) Configure SELinux
setsebool -P samba_export_all_rw 1



NOW: smb starts after bootup, nmb don't. There is no error message

cat /var/log/samba/log.nmbd gives:
[PASTE_doesn' work]

*****
[2013/04/08 12:36:39, 0] nmbd/nmbd.c:66(terminate)
Got SIGTERM: going down...
[2013/04/08 12:36:39, 0] nmbd/nmbd.c:861(main)
nmbd version 3.6.12-1.fc17 started.
Copyright Andrew Tridgell and the Samba Team 1992-2011
[2013/04/08 12:36:39, 0] nmbd/nmbd.c:889(main)
standard input is not a socket, assuming -D option
[2013/04/08 12:37:02, 0] nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)
*****

Samba name server ** is now a local master browser for workgroup SAMBA on subnet 192.168****
[/PASTE....]

starting nmb by
service nmb start

don't give me access to my network shares.


I always have to upen the samba-server-configuration-gui apply some changes.
Then surprise the network share is available.

What else can I do to activate samba automatically after reboot?????

best S.

---------- Post added at 12:08 PM ---------- Previous post was at 11:14 AM ----------

It seems that, the configuration tool restarts the nmb service.

Doing this manually allows access to the network shares.

Now, why doesn't it do its job in the first place?

And, is it possible to fix it?

jpollard
8th April 2013, 02:00 PM
Are you using NetworkManager? if yes, then do you have NetworkManager-wait-online enabled?

The problem by default is that systemd assumes everything is ready for use even if it isn't. When NetworkManager starts, systemd assumes the network is ready (it isn't) so systemd ALSO starts smd/nmb. Now if other processes delay the actual starting long enough, then SOMETIMES it will work. NetworkManager-wait-online is supposed to delay systemd until NetworkManager actually configures the network... but this is only reliable in a single network interface (the usual case).

DBelton
8th April 2013, 03:30 PM
try using systemd to enable the smb service on startup. You enabled samba on startup using the old service, which doesn't start the necessary other services. You either need to tell it to start the other services on boot, or just use systemctl enable smb.service which will insure the other services are started as well.


systemctl enable smb.service

serendip82
8th April 2013, 06:48 PM
I checked:
systemctl status NetworkManager-wait-online

NetworkManager-wait-online.service - Network Manager Wait Online
Loaded: loaded (/usr/lib/systemd/system/NetworkManager-wait-online.service; disabled)
Active: inactive (dead)
CGroup: name=systemd:/system/NetworkManager-wait-online.service

and tried
systemctl enable NetworkManager-wait-online

....will it work? the answer in a few minutes...

---------- Post added at 05:41 PM ---------- Previous post was at 05:33 PM ----------

reboot: no, it did not help. Now, the status looks a bit different:

systemctl status NetworkManager-wait-online
NetworkManager-wait-online.service - Network Manager Wait Online
Loaded: loaded (/usr/lib/systemd/system/NetworkManager-wait-online.service; enabled)
Active: inactive (dead) since Mon, 08 Apr 2013 20:35:41 +0200
Process: 752 ExecStart=/usr/bin/nm-online -q --timeout=30 (code=exited, status=0/SUCCESS)
CGroup: name=systemd:/system/NetworkManager-wait-online.service

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.


now, trying:
systemctl enable smb.service
....to be continued...

---------- Post added at 05:48 PM ---------- Previous post was at 05:41 PM ----------

....nope...

no change.

Which other services do you mean, by the way? I wrote that it works, when I restart the nmb service, which is already active. It is maybe the problem with the network manager, but I cannot find any error message. Or don't understand them.

Is this the important message?
(from /var/log/samba/log.nmb)

[2013/04/08 12:36:39, 0] nmbd/nmbd.c:66(terminate)
Got SIGTERM: going down...

?????

beaker_
8th April 2013, 06:50 PM
Don't ignore DBelton's post above: smb service will not start nmb automatically and that behavior changed way back in Fedora 9!.

---------- Post added at 02:50 PM ---------- Previous post was at 02:48 PM ----------

Crap. I miss read it. He wrote smb.service.

systemctl enable smb.service
systemctl enable nmb.service

serendip82
8th April 2013, 07:00 PM
chkconfig gives

Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.

livesys 0:off 1:off 2:off 3:on 4:on 5:on 6:off
livesys-late 0:off 1:off 2:off 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
spice-vdagentd 0:off 1:off 2:off 3:off 4:off 5:on 6:off
tcsd 0:off 1:off 2:off 3:off 4:off 5:off 6:off

does this look good?

---------- Post added at 05:56 PM ---------- Previous post was at 05:50 PM ----------

OK, I tried


systemctl enable smb.service
systemctl enable nmb.service


and it is not working. :-(

---------- Post added at 05:57 PM ---------- Previous post was at 05:56 PM ----------

Do I have to undo something, maybe??

---------- Post added at 06:00 PM ---------- Previous post was at 05:57 PM ----------

I just had a look into
/lib/systemd/system/smb.service

I seems that smb waits for the nmb service, befor it starts. Probably correct...

------------------------
[Unit]
Description=Samba SMB Daemon
After=syslog.target network.target nmb.service winbind.service

[Service]
Type=forking
PIDFile=/run/smbd.pid
LimitNOFILE=16384
EnvironmentFile=-/etc/sysconfig/samba
ExecStart=/usr/sbin/smbd $SMBDOPTIONS
-------------------

beaker_
8th April 2013, 07:02 PM
Probably not. This behavior is typical when samba starts before your nic is ready. You could try dumping restarts in rc.local. But even then you're hoping systemd hits rc.local both last and after your nic is up. Basically you have both systemd and networkmanager to thank.

serendip82
8th April 2013, 07:22 PM
But, this is in the configuration file!
After=syslog.target network.target nmb.service winbind.service
Why should this be wrong? I did not place it there...

OK, you mean samba starts before the nic=network(?) is ready?

...I tried inserting the NetworkManager-wait-online.service in both the
/lib/systemd/system/smb.service
/lib/systemd/system/nmb.service

and increased the waiting time to 60 sec, still doesn't work.... too, bad...

---------- Post added at 06:19 PM ---------- Previous post was at 06:17 PM ----------


The problem by default is that systemd assumes everything is ready for use even if it isn't. When NetworkManager starts, systemd assumes the network is ready (it isn't) so systemd ALSO starts smd/nmb. Now if other processes delay the actual starting long enough, then SOMETIMES it will work. NetworkManager-wait-online is supposed to delay systemd until NetworkManager actually configures the network... but this is only reliable in a single network interface (the usual case).
Reply With Quote


I my case it doesn't....WHY :-( ??

---------- Post added at 06:22 PM ---------- Previous post was at 06:19 PM ----------

Do you know the difference between:

chkconfig smb on
service smb start
systemctl start smb.service
systemctl enable smb.service

?? What is the state of the art to do it?

beaker_
8th April 2013, 07:39 PM
systemd replaced sysv around fedora 15. chkconfig and service were the old commands and systemctl is the new command/method.

See http://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet

If samba plays nicely after you login and restart smb and nmb services manually. Then I say you have a choice; try dumping restarts in rc.local; or toss fedora in the trash and grab rhel/centos/sl. Of course your choice will always depend on both your level of sanity, how critical samba is, and how much work you're willing to do.

---------- Post added at 03:39 PM ---------- Previous post was at 03:31 PM ----------

Just adding: in general, it has gotten better and
systemctl enable NetworkManager-wait-online.service
systemctl enable smb.service
systemctl enable nmb.service
should be the most work you need to do. Assuming you've already configured the nic to be a "system connection" and "connect automatically" (NetworkManager's language, found in KDE's or gnome's applet).

serendip82
8th April 2013, 07:44 PM
Thanks!

I tried to start nmb and smb services after the sendmail.service, which is the last I can see. However, it did not change anything....

Then, I think, I will have to find out, what dumping restarts in rc.local means, and give it a try....
or wait for the next generation of init-methods, and fix other bugs in the meantime...

Thanks to all of you!!

jpollard
8th April 2013, 07:50 PM
Fedora 14 and earlier:

chkconfig smb on
service smb start


Fedora 15 and later:

systemctl start smb.service
systemctl enable smb.service


Fedora 17 and later:

systemctl start smb
systemctl enable smb


You also have to do:

systemctl enable nmb
systemctl start nmb



OK, you mean samba starts before the nic=network(?) is ready?


Sometimes....


?? What is the state of the art to do it?


I gave up on NetworkManager. It just seems so flaky as to be unusable (for me). I completely disabled it, and enabled networks.
It just seems more reliable.

It appears to work if you have only one network interface. Two or more though, and it gets easily confused as to what it is doing, and the state of the network becomes indeterminate.

I have two wired networks, one is supported via DHCP, the other is not. I kept having NetworkManager set the wrong default route on the wrong interface, and it seemed to set it on the interface that came up first (the static internal one), thus routing to the internet always failed. This also meant that the state of the network was indeterminate - using NTP would also fail due to the inaccessibility to the time servers. If the networks came up in the reverse order... things worked. Next boot - not work.

Services would also not start properly. In my case it was Apache, sometimes it would work.... sometimes not. It also seemed to depend on which order the devices came up.

I tried using NetworkManager-wait-online, but that didn't always work either. The DHCP interface would not yet be ready... but the internal net would be ready... so NetworkManager assumed the network was ready... wrong. It still depended on which network was ready first...

Routing to/from VMs would also fail.

As soon as I disabled NetworkManager and enabled networks everything worked.

The difference: the /etc/network script doesn't mark the network as ready until ALL configured interfaces are ready, and that included waiting until the DHCP negotiation completed.

I blame most of the problems on NetworkManager, the rest on systemd being overly aggressive about running everything simultaneously. Systemd cannot know enough about what is going on, and gets it wrong. Sometimes.

beaker_
8th April 2013, 07:53 PM
Dumping restarts into rc.local means, restart smb and nmb service in rc.local because rc.local is suppose to be the last thing executed.

Of course, now you need to create the file and:

/etc/rc.d/rc.local
#!/bin/bash
systemctl restart smb.service
systemctl restart nmb.service


systemctl enable rc-local.service

Yeah it needs to be executable but I don't recall if chmod +x or chmod 760 is all you need.

---------- Post added at 03:53 PM ---------- Previous post was at 03:51 PM ----------

You got it then. Good luck.

jpollard
8th April 2013, 08:11 PM
Last is relative.

It is "last" if you mean after multi-user.target is reached... but you CAN get there without the network being fully functional.

beaker_
8th April 2013, 08:18 PM
You know it.:cool:

jpollard
8th April 2013, 08:36 PM
Besides, throwing things into rc.local to try and get them to work properly is just so.... SunOS 2.x way to do it :)

DBelton
9th April 2013, 05:19 AM
Yep.. You shouldn't need to have anything in rc.local to get samba server working.


livesys 0:off 1:off 2:off 3:on 4:on 5:on 6:off
livesys-late 0:off 1:off 2:off 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
spice-vdagentd 0:off 1:off 2:off 3:off 4:off 5:on 6:off
tcsd 0:off 1:off 2:off 3:off 4:off 5:off 6:off


Ummm.. Are you using network or NetworkManager? This shows network being enabled so it comes up and running on boot.

If you are trying to start both network and NetworkManager, that could be the issue.

serendip82
9th April 2013, 07:32 PM
ok, the "last thing" I just try...

I generated the file with the described content, then typed (as root):

systemctl enable rc-local.service

however, system answers: The unit files have no [Install] section. They are not meant to be enabled using systemctl.

but, anyway, I will make a reboot...

---------- Post added at 06:08 PM ---------- Previous post was at 06:00 PM ----------

....wah, where is my post...


ok, I tried the rc.local way. ...didn't work.
By the way, when typing

systemctl enable rc-local.service

the system answers:

The unit files have no [Install] section. They are not meant to be enabled using systemctl.

So, as I get it, this file is automatically started.

---------- Post added at 06:09 PM ---------- Previous post was at 06:08 PM ----------

@ DBelton

Ok, I think I use the network manager. At least I have installed a VPN that I can activate...

---------- Post added at 06:30 PM ---------- Previous post was at 06:09 PM ----------

Hey,

first signs of success!!!

I used the rc.local script and inserted

sleep 60
systemctl restart smb.service
systemctl restart nmb.service



and.... it works!!! However, extending the boot process artificially by 60 seconds is.....come on! Not good...

---------- Post added at 06:31 PM ---------- Previous post was at 06:30 PM ----------

PS: Thanks!!


If you are trying to start both network and NetworkManager, that could be the issue.
Reply With Quote

How can I check whether the network and NetworkManager both start??

---------- Post added at 06:32 PM ---------- Previous post was at 06:31 PM ----------

And if this double start causes some conflicts why aren't there some Warnings???

jpollard
9th April 2013, 09:46 PM
"systemctl status NetworkManager" will show its state.

If you can check for both by using "systemctl status NetworkManager networks", one should show as active (if you are using NetworkManager, that one should show "active". Networks, exits when it is finished setting up the net, so it will show "inactive (dead)"). You can check for networks by "chkconfig --list | grep network" (or "chkconfig --list network"), normally it would show "off", when NetworkManager is active, but it is possible to have both turned on.


That is what NetworkManager-wait-online is for.

Unfortunately, the design is unreliable.

There are no warnings because doing it a second time would only generate a message if it were already active...

beaker_
9th April 2013, 10:07 PM
I seem to recall durring the transition from F8 to F9 that many people were writing cron tasks to check nmb pid (whether it's running or not). I don't know if any survived and I'm too lazy to try.

You know... let machine boot, cron runs a task to restart nmb service every 10min or so... but checks if nmb is ok first ie.,

serendip82
13th April 2013, 08:53 PM
check:

chkconfig --list | grep network

Hinweis: Diese Ausgabe zeigt lediglich SysV-Dienste und beinhaltet keine
nativen systemd-Dienste. Die SysV-Konfigurationsdaten könnten durch
die Konfiguration des systemd überschrieben werden.

network 0:Aus 1:Aus 2:Ein 3:Ein 4:Ein 5:Ein 6:Aus

---------- Post added at 07:53 PM ---------- Previous post was at 07:52 PM ----------

will try the cron job option next week,
thanks for the tip
best S

marko
13th April 2013, 10:46 PM
Try using "systemd-analyze blame" to see if any systemd start ups are taking a huge amount of time.
If any of those are network related and you don't need them, then get rid of them via systemctl disable

I was recently finding that my sendmail service was re-added to one of my systems (I always disable it) and it was taking a huge amount of time out of my boot up (like nearly a minute). I noticed because my boot slowed down. I'm not sure if a super slow sendmail failure would cause the problems you have but it doesn't help.

jpollard
14th April 2013, 11:58 AM
That doesn't fix the problem of the network not coming up.

All it does is make some things run sooner... and that means attempting to start samba also happens sooner.

The only reason sendmail takes so long is that it attempts to identify itself (requiring the FQDN)... and when that fails it tries again.

And since sendmail doesn't depend on samba (nor vice versa), it does nothing.

serendip82
24th May 2013, 08:28 PM
Hey,

I lost the track of this problem, and hope that it works in the next generation.

thanks for the tips!