0

I'm running 18.04.4 LTS with HWE.

After a reboot, I must manually run "sudo netplan apply" to set the static IP described in 50-cloud-init.yaml:

network:
ethernets:
    renderer: networkd
    enp0s25:
        dhcp4: no
        optional: false
        addresses: [172.28.1.99/24]
        gateway4: 172.28.1.1
        nameservers:
                   addresses: [172.28.1.99, 172.28.1.1]
version: 2

I see a lot of posts talking about skipping the wait for the network to become available, but nothing about how to enforce waiting for the network.

So, immediately after I login, I can netplan apply and a couple of seconds later, the static IP is applied and the card is up.

Looking at journalctl --no-pager -lu systemd-networkd, there are only "Permission denied" errors during the boot...

-- Reboot --
Feb 04 20:10:52 lei systemd[1]: Starting Network Service...
Feb 04 20:10:52 lei systemd-networkd[935]: Failed to connect to bus: Permission denied
Feb 04 20:10:52 lei systemd-networkd[935]: Could not connect to bus: Permission denied
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Main process exited, code=exited, status=1/FAILURE
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Failed with result 'exit-code'.
Feb 04 20:10:52 lei systemd[1]: Failed to start Network Service.
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Service has no hold-off time, scheduling restart.
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Scheduled restart job, restart counter is at 1.
Feb 04 20:10:52 lei systemd[1]: Stopped Network Service.
Feb 04 20:10:52 lei systemd[1]: Starting Network Service...
Feb 04 20:10:52 lei systemd-networkd[936]: Failed to connect to bus: Permission denied
Feb 04 20:10:52 lei systemd-networkd[936]: Could not connect to bus: Permission denied
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Main process exited, code=exited, status=1/FAILURE
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Failed with result 'exit-code'.
Feb 04 20:10:52 lei systemd[1]: Failed to start Network Service.
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Service has no hold-off time, scheduling restart.
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Scheduled restart job, restart counter is at 2.
Feb 04 20:10:52 lei systemd[1]: Stopped Network Service.
Feb 04 20:10:52 lei systemd[1]: Starting Network Service...
Feb 04 20:10:52 lei systemd-networkd[938]: Failed to connect to bus: Permission denied
Feb 04 20:10:52 lei systemd-networkd[938]: Could not connect to bus: Permission denied
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Main process exited, code=exited, status=1/FAILURE
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Failed with result 'exit-code'.
Feb 04 20:10:52 lei systemd[1]: Failed to start Network Service.
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Service has no hold-off time, scheduling restart.
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Scheduled restart job, restart counter is at 3.
Feb 04 20:10:52 lei systemd[1]: Stopped Network Service.
Feb 04 20:10:52 lei systemd[1]: Starting Network Service...
Feb 04 20:10:52 lei systemd-networkd[939]: Failed to connect to bus: Permission denied
Feb 04 20:10:52 lei systemd-networkd[939]: Could not connect to bus: Permission denied
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Main process exited, code=exited, status=1/FAILURE
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Failed with result 'exit-code'.
Feb 04 20:10:52 lei systemd[1]: Failed to start Network Service.
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Service has no hold-off time, scheduling restart.
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Scheduled restart job, restart counter is at 4.
Feb 04 20:10:52 lei systemd[1]: Stopped Network Service.
Feb 04 20:10:52 lei systemd[1]: Starting Network Service...
Feb 04 20:10:52 lei systemd-networkd[940]: Failed to connect to bus: Permission denied
Feb 04 20:10:52 lei systemd-networkd[940]: Could not connect to bus: Permission denied
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Main process exited, code=exited, status=1/FAILURE
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Failed with result 'exit-code'.
Feb 04 20:10:52 lei systemd[1]: Failed to start Network Service.
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Service has no hold-off time, scheduling restart.
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Scheduled restart job, restart counter is at 5.
Feb 04 20:10:52 lei systemd[1]: Stopped Network Service.
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Start request repeated too quickly.
Feb 04 20:10:52 lei systemd[1]: systemd-networkd.service: Failed with result 'exit-code'.
Feb 04 20:10:52 lei systemd[1]: Failed to start Network Service.

Then, the entries from when I did netplan apply...

Feb 04 20:11:49 lei systemd[1]: Starting Network Service...
Feb 04 20:11:49 lei systemd-networkd[2856]: Enumeration completed
Feb 04 20:11:49 lei systemd[1]: Started Network Service.
Feb 04 20:11:49 lei systemd-networkd[2856]: lo: Link is not managed by us
Feb 04 20:11:53 lei systemd-networkd[2856]: enp0s25: Gained carrier
Feb 04 20:11:54 lei systemd-networkd[2856]: enp0s25: Gained IPv6LL
Feb 04 20:11:54 lei systemd-networkd[2856]: enp0s25: Configured

I implemented the tighter .yaml config as recommended by heynnema and still have the same results. The netplan --debug generate returned:

root@l:/etc/netplan# netplan --debug generate                                                       
DEBUG:command generate: running ['/lib/netplan/generate']                                             
** (generate:22264): DEBUG: 21:54:44.867: Processing input file /etc/netplan/50-cloud-init.yaml..     
** (generate:22264): DEBUG: 21:54:44.867: starting new processing pass                                
** (generate:22264): DEBUG: 21:54:44.868: enp0s25: setting default backend to 1                       
** (generate:22264): DEBUG: 21:54:44.868: Configuration is valid                                      
** (generate:22264): DEBUG: 21:54:44.868: Generating output files..                                   
** (generate:22264): DEBUG: 21:54:44.868: NetworkManager: definition enp0s25 is not for us (backend 1)

On reboot, I still have no static IP until I manually execute a netplan apply...

dparks@l:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s25: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether d0:50:99:67:5e:2b brd ff:ff:ff:ff:ff:ff
dparks@l:~$
dparks@l:~$ sudo netplan apply
[sudo] password for dparks:
dparks@l:~$
dparks@l:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether d0:50:99:67:5e:2b brd ff:ff:ff:ff:ff:ff
    inet 172.28.1.99/24 brd 172.28.1.255 scope global enp0s25
       valid_lft forever preferred_lft forever
    inet6 fe80::d250:99ff:fe67:5e2b/64 scope link
       valid_lft forever preferred_lft forever

/etc/systemd/network is empty:

dparks@l:~$ ls -al /etc/systemd/network
total 8
drwxr-xr-x 2 root root 4096 Apr 20  2018 .
drwxr-xr-x 5 root root 4096 Feb  6 06:18 ..

This issue was determined to be a permissions issue on the root folder:

dr-xr-x--x 26 root root 4096 Feb 4 20:09 /

Correcting to 0755 resolved the issue and netplan applies properly at boot.

drwxr-xr-x 26 root root 4096 Feb  4 20:09 /
  • Please file a bug report in Launchpad using the command 'ubuntu-bug systemd' from the affected system. The errors about failing to connect to the bus are not expected and indicate some sort of ordering problem at boot, which will need to be investigated – slangasek Feb 5 at 17:57
1

.yaml files are very fussy about indentation, spacing, and no tabs.

Assuming that you're using Ubuntu Server...

Use this .yaml file...

network:
  renderer: networkd
  version: 2
  ethernets:
    enp0s25:
      addresses: [172.28.1.99/24]
      gateway4: 172.28.1.1
      nameservers:
        addresses: [172.28.1.99, 172.28.1.1]

Then:

sudo netplan --debug generate # generate config files

sudo netplan apply # apply new config

reboot # because of static address

  • Yes on Ubuntu server. I did the netplan generate and didn't have any errors, but I recreated the file with tighter indentation control and did another generate. No errors. After reboot, I still have to manually run netplan apply and manually start services that should have been dependent on "network-online". I'll add a follow-up post with some more info. – David Parks Feb 6 at 3:04
  • @DavidParks Edit your question and show me ls -al /etc/systemd/network. – heynnema Feb 6 at 3:44
  • I believe that sudo netplan generate places the config files in that directory. For some reason yours is empty. That might explain your problem. I'd recommend reinstalling Ubuntu. Uncheck the format box in the installer, so it'll keep your existing files (still doesn't mean that you shouldn't have a good backup before reinstalling... ) – heynnema Feb 6 at 20:17
  • @DavidParks Please show me cat /etc/network/interfaces. Please tell me how you're doing with this problem. – heynnema Feb 10 at 17:07
  • /etc/network/interfaces is empty - except for the comment lines that ifupdown has been replaced by netplan. I've opened a bug report at launchpad. I'm also going to add a new Ethernet card to see if that has any impact. – David Parks Feb 10 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.