Comment 21 for bug 1558196

Revision history for this message
Erik Kruus (ejkruus) wrote :

Jacques,

Ditto for rpcbind patch not being enough. I have traced the issue via syslogs
to nis starting too early, before kernel has brought network interfaces up.
**If** the network interfaces get up "fast", then boot succeeds. Otherwise
nfs fails and nameserver might never be there, and userids are unavailable, etc.
You may boot after the 5 min network timeout, but with drastically reduced
service.

What follows makes things work, but is UGLY and not the "right way".
--------------------------------------------------------------------
At our site IT recommends static ips set up with /etc/network/interfaces,
and the HACK I suggested involves overriding the default 'systemctl cat nis.service'
to put it after <email address hidden> and before NetworkManager.service.
This works, but is not a correct solution, because nis is starting after ifup
starts but before kernel reports the interface as 'ready'.

I also aid the boot by putting into 'interfaces' a
"post-up systemctl restart nis", just in case, and help some of the other
packages a bit by supplying dns-nameserver clause, and finally attempted
to cover my a** with an additional
  system-ctl add-wants NetworkManager.service nis.service

Now system boots with nis maybe 6 times in a row, and without timeouts, and
all nis stuff available -- good enough for me, but not generic since ifup
may not be there at your place.

I have NOT tested whether putting nis after (or maybe "Also") with
NetworkManager.service works, and if that worked, it might be a more general
solution.

-----For example only:
kruus@snake10$ cat nis.service
# /run/systemd/generator.late/nis.service
# Generated by [on a default install]
# systemctl cat nis.service > /etc/systemd/system/nis.service
# and some light editing.
#
# Also see the ifup dependency patched into
# /etc/systemd/system/nis.service.d/ifup.conf
# that reflects the static nec-labs route you set up in
# /etc/network/interfaces

[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/nis
Description=LSB: Start NIS client and server daemons.
Before=multi-user.target
Before=graphical.target
Before=NetworkManager.service
Before=remote-fs.target
After=rpcbind.target
After=network-pre.target
# NO! After=remote-fs.target
# NO! Wants=network-online.target

[Install]
WantedBy=NetworkManager.service
# NO! WantedBy=nss-user-lookup.target

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/init.d/nis start
ExecStop=/etc/init.d/nis stop
ExecReload=/etc/init.d/nis reload

    /etc/systemd/system
kruus@snake10$ cat nis.service.d/ifup.conf
[Unit]
<email address hidden>
<email address hidden>
# ^^^^ your main network interface HERE.

    /etc/systemd/system
kruus@snake10$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto enp14s0
iface enp14s0 inet static
  address 138.15.169.213
  <snip-snip -- boring snake08--snake10 point-to-point on second port>

auto eno1
iface eno1 inet static
  address 138.15.169.213
  netmask 255.255.255.0
  gateway 138.15.169.254
# below is not required for general use:
  metric 50
  #dns-search nec-labs.com
  #dns-nameservers 138.15.108.11 138.15.200.9
  #post-up systemctl restart nis && echo "ifup: NIS restarted" || echo "ifup: FAILED NIS restart"

Note that I have only a systemd patch working, and NONE of my earlier
/etc/network/interfaces helper hacks, such as
dns-search, or
dns-nameservers, or
post-up systemctl restart nis ...

Success measured by:
- no 5 minute timeouts in boot
- boot accepts NIS user login.
- syslog doesn't look too bad any more.
- badness:
  - depends on ifup and interface name
  - nis starts when ifup begins, not when ifup ends with kernel report 'device ready'

Comment: Some difficulty from systemd using old init.d nis and networking scripts.
It would be nice to have an "net-interface-up.target" in systemd, somewhere between
network-pre.target and network-online(?) but this gets a bit more involved.