Add user warning if no LAN is configured
Migrated from: https://tracker.clearos.com/view.php?id=10441, https://tracker.clearos.com/view.php?id=15841
Reported by: Ben Chambers
It's possible to get into a situation where the enduser thinks Samba is initialising even though nothing is happening.
This occurs when no LAN network has been configured.
Comment 1:
Confirmed. The nmb daemon complains with:
"nmbd: No local IPv4 non-loopback interfaces available, waiting for interface"
I guess loopback is not good enough for this service (even though the "bind interfaces" parameter is set to "No"?). Other services that have bind or LAN-only specific API calls behave when a LAN interface is not yet configured:
- PPTP Server
- OpenVPN Server
- IDS
- IPS
- Web Proxy
- OpenLDAP
- Network Map
Steps to reproduce
from duplicate issue https://tracker.clearos.com/view.php?id=15841
On a new system, configure the networking for gateway mode and configure from the External interface.
For the LAN interface, configure on DHCP and NEVER have it connected to a DHCP server source (ie. unconfigured)
Install and configure the accounts manager, OpenLDAP. Attempt to initialize the system. The /var/log/system log will have a similar log:
Jul 20 11:33:27 localhost samba: initializing Samba system
Jul 20 11:33:27 localhost samba: setting winadmin password
Jul 20 11:33:27 localhost samba: setting netbios name and workgroup: MyServer - TESTDOM
Jul 20 11:33:28 localhost samba: setting mode to PDC
Jul 20 11:33:28 localhost samba: storing LDAP credentials
Jul 20 11:33:28 localhost samba: starting Samba services for net calls
Jul 20 11:33:38 localhost events: accounts - event occurred
Jul 20 11:33:38 localhost events: accounts - triggered hook: accounts
Jul 20 11:34:59 localhost engine: exception: error: /usr/clearos/apps/base/libraries/Shell.php (227): Command execution failed.
Jul 20 11:34:59 localhost engine: exception: debug backtrace: /usr/clearos/apps/base/libraries/Daemon.php (598): execute
Jul 20 11:34:59 localhost engine: exception: debug backtrace: /usr/clearos/apps/samba/libraries/OpenLDAP_Driver.php (623): set_running_state
Jul 20 11:34:59 localhost engine: exception: debug backtrace: /usr/sbin/app-samba-initialize (161): initialize_samba_as_master_or_standalone
If running the init from command line you will get:
[root@gateway mode]# /usr/sbin/app-samba-initialize
Server name (e.g. SERVER1): MyServer
Password: The following settings will be used to set up the Samba Directory
Mode: master
Domain:
Server name: MyServer
Password: *********
Setting stored password for "cn=manager,ou=Internal,dc=testdom,dc=lan" in secrets.tdb
Secret stored
Redirecting to /bin/systemctl start nmb.service
Job for nmb.service failed because a timeout was exceeded. See "systemctl status nmb.service" and "journalctl -xe" for details.
PHP notice: Undefined index: line - /usr/clearos/apps/samba_common/libraries/Samba.php (2728)
Setting stored password for "cn=manager,ou=Internal,dc=testdom,dc=lan" in secrets.tdb
Secret stored
Redirecting to /bin/systemctl start nmb.service
Job for nmb.service failed because a timeout was exceeded. See "systemctl status nmb.service" and "journalctl -xe" for details.
Fatal - uncaught exception: exception 'clearos\apps\base\Engine_Exception' with message 'Command execution failed.' in /usr/clearos/apps/base/libraries/Shell.php:227
Stack trace:
#0 /usr/clearos/apps/base/libraries/Daemon.php(598): clearos\apps\base\Shell->execute('/sbin/service', 'nmb start', true, Array)
0000001 /usr/clearos/apps/samba/libraries/OpenLDAP_Driver.php(623): clearos\apps\base\Daemon->set_running_state(true)
0000002 /usr/sbin/app-samba-initialize(171): clearos\apps\samba\OpenLDAP_Driver->initialize_samba_as_master_or_standalone('MyServer', '', 'xxxxxxxx', false)
0000003 {main}
This is due to the fact that nmb cannot start without an interface:
[root@gateway ~]# systemctl status nmb
? nmb.service - Samba NMB Daemon
Loaded: loaded (/usr/lib/systemd/system/nmb.service; disabled; vendor preset: disabled)
Active: activating (start) since Thu 2017-07-20 11:51:29 EDT; 55s ago
Main PID: 19297 (nmbd)
Status: "nmbd: No local IPv4 non-loopback interfaces available, waiting for interface ..."
CGroup: /system.slice/nmb.service
??19297 /usr/sbin/nmbd
??19298 /usr/sbin/nmbd
Jul 20 11:51:29 gateway.example.com systemd[1]: Starting Samba NMB Daemon...
Jul 20 11:51:29 gateway.example.com systemd[1]: nmb.service: Supervising process 19297 which is not our child. We'll most likely not notice when it exits.