Bug #3311
closedansible: osmo-gsm-tester main unit udhcpd server not started correctly during boot
100%
Description
For last days nanobts tests in osmo-gsm-tester have been failing.
After having a look for a while and testing booring a nanobts manually and checking with abisip-find, I noticed there was no output and finally realized the udhcpd server was not up. This is what I saw:
root@osmo-gsm-tester-prod:~# systemctl status udhcpd ● udhcpd.service - LSB: Start busybox udhcpd at boot time Loaded: loaded (/etc/init.d/udhcpd; generated; vendor preset: enabled) Active: active (exited) since Thu 2018-05-31 15:00:45 CEST; 2min 2s ago Docs: man:systemd-sysv-generator(8) Process: 299 ExecStart=/etc/init.d/udhcpd start (code=exited, status=0/SUCCESS)
Restarting it with systemctl restart udhcpd
worked fine and since then an IP addr was assigned to the BTS and I could see it with abisip-find.
Since I had restarted the main unit for other reasons a few hours ago, I thought that perhaps udhcpd was not being startup correctly during boot. I re-booted the main unit and checked at the status of the server: udhcpd again stated it 3was started but exited:
May 31 15:00:45 osmo-gsm-tester-prod systemd[1]: Starting LSB: Start busybox udhcpd at boot time... May 31 15:00:45 osmo-gsm-tester-prod udhcpd[299]: Starting very small Busybox based DHCP server: udhcpd. May 31 15:00:45 osmo-gsm-tester-prod systemd[1]: Started LSB: Start busybox udhcpd at boot time. May 31 15:00:45 osmo-gsm-tester-prod udhcpd[315]: udhcpd (v1.22.1) started May 31 15:00:45 osmo-gsm-tester-prod udhcpd[315]: max_leases=235 is too big, setting to 6 May 31 15:00:45 osmo-gsm-tester-prod udhcpd[315]: is interface enp2s0 up and configured?: Cannot assign requested address
So it seems udhcpd is started before the network is up, then exits. udhcpd in our current version actually seems to be using /etc/init.d/ still, for which systemc creates a temporal .service file in /run. So in order to wait for network to be up, I had to create a service file with required bits:
# cat /lib/systemd/system/udhcpd.service [Unit] Description=udhcpcd DHCP server After=network-online.target Wants=network-online.target [Service] ExecStart=/usr/sbin/udhcpd -f RestartSec=5 Restart=always [Install] WantedBy=multi-user.target
Then enabled it systemctl enable udhcpd.server
, then restarted the main unit and udhcpd started fine during boot process.
So, we need to add that file to ansible and install it into /lib/systemd/system/udhcpd.service. We also need to enable the service.
Updated by lynxis almost 6 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 80
The commits has been tested on rnd and waiting for review.
https://gerrit.osmocom.org/#/c/osmo-ci/+/9447 ansible: udhcpd: add systemd service file
Updated by lynxis almost 6 years ago
- Status changed from In Progress to Closed
- % Done changed from 80 to 100
the commit has been merged.