# change waiting time in systemd-network-wait-online ###### tags: `linux` `network` ### ubuntu 18.04 ``` Edit /etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service Add --timeout option with seconds value to wait. Example: ycheng@ycheng:/etc/systemd/system/network-online.target.wants$ cat ./systemd-networkd-wait-online.service # SPDX-License-Identifier: LGPL-2.1+ # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. [Unit] Description=Wait for Network to be Configured Documentation=man:systemd-networkd-wait-online.service(8) DefaultDependencies=no Conflicts=shutdown.target Requires=systemd-networkd.service After=systemd-networkd.service Before=network-online.target shutdown.target [Service] Type=oneshot ExecStart=/lib/systemd/systemd-networkd-wait-online --timeout=10 RemainAfterExit=yes [Install] WantedBy=network-online.target root@nuc:~# cat /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service [Unit] Description=Network Manager Wait Online Documentation=man:nm-online(1) Requires=NetworkManager.service After=NetworkManager.service Before=network-online.target [Service] Type=oneshot ExecStart=/usr/bin/nm-online -s -q --timeout=30 RemainAfterExit=yes [Install] WantedBy=network-online.target ``` ### another example ``` root@develop:~# vim /lib/systemd/system/systemd-networkd-wait-online.service # SPDX-License-Identifier: LGPL-2.1+ # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. [Unit] Description=Wait for Network to be Configured Documentation=man:systemd-networkd-wait-online.service(8) DefaultDependencies=no Conflicts=shutdown.target Requires=systemd-networkd.service After=systemd-networkd.service Before=network-online.target shutdown.target [Service] Type=oneshot #ExecStart=/lib/systemd/systemd-networkd-wait-online --timeout=30 #ExecStart=/lib/systemd/systemd-networkd-wait-online --timeout=10 ExecStart=/lib/systemd/systemd-networkd-wait-online --interface=ens3 --ignore=ens9 --timeout=10 RemainAfterExit=yes [Install] WantedBy=network-online.target !!! After edited configure file. run "systemctl daemon-reload" to reload units. ================================================================= root@develop:/etc/systemd/system# /lib/systemd/systemd-networkd-wait-online --help systemd-networkd-wait-online [OPTIONS...] Block until network is configured. -h --help Show this help --version Print version string -q --quiet Do not show status information -i --interface=INTERFACE Block until at least these interfaces have appeared --ignore=INTERFACE Don't take these interfaces into account --timeout=SECS Maximum time to wait for network connectivity Ref: https://github.com/systemd/systemd/blob/master/src/network/wait-online/wait-online.c ```