A start job is running for wait for network to be configured. Ubuntu server 20.04

8,737

In /etc/netplan:

sudo rm -i /etc/netplan/01-netcfg.yaml # remove unnecessary file

sudo -H gedit /etc/netplan/00-installer-config.yaml # edit this file with these contents:

For dhcp:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      dhcp4: true
      optional: true

For static IP: (bridged network)

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      addresses:
        - 192.168.x.xxx/24
      gateway4: 192.168.x.1
      nameservers:
        search: [mydomain, otherdomain]
        addresses: [8.8.8.8, 8.8.4.4]
      optional: true

Create /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg

sudo -H gedit /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg

with the following content:

network: {config: disabled}

Then:

sudo netplan generate

sudo netplan apply

reboot

Share:
8,737
Jastria Rahmat
Author by

Jastria Rahmat

Currently Studying: Computers & Coding Professional at: Ableton, Sound design & Electronic musics

Updated on September 18, 2022

Comments

  • Jastria Rahmat
    Jastria Rahmat over 1 year

    After reading this post, I've followed this answer. But , when I edit the /etc/netplan/01-netcfg.yaml, it was blank. So I create that file and add optional: true. After sudo netplan apply, It turns out to be an error error in network definition unknown key 'optional'.

    Is the previous post answer still relevant for ubuntu 20.04? And he stated that:

    Don't mask or disable the systemd service.

    So, what is the best solution for this in 20.04?

    edit:
    result of ls /etc/netplan

    00-installer-config.yaml  01-netcfg.yaml
    

    result of cat /etc/netplan/01-netcfg.yaml

    optional: true
    

    result of sudo lshw -C network as @heynnema requested as @heynnema requested and result of cat /etc/netplan/*.yaml
    enter image description here

    • chili555
      chili555 over 3 years
      Please edit your question to show the result of the terminal command: ls /etc/netplan and also: cat /etc/netplan/01-netcfg.yaml
    • Jastria Rahmat
      Jastria Rahmat over 3 years
      @chili555 there you go, I've edited it.
    • Boris Hamanov
      Boris Hamanov over 3 years
      I order to help you, please edit your question and show me sudo lshw -C network and cat /etc/netplan/*.yaml. Did your Ubuntu Server install fail during the install?
    • Jastria Rahmat
      Jastria Rahmat over 3 years
      @heynnema I've edited it. No. it didn't fail at all. In VBox, Using NAT is ok, but I want to use bridged adapter now to make it fixed IP.
    • chili555
      chili555 over 3 years
      You have two files: 00-installer-config.yaml and 01-netcfg.yaml. We need to consolidate them into one non-conflicting file. May we see both?
    • Jastria Rahmat
      Jastria Rahmat over 3 years
      @chili555 how??
    • redcalx
      redcalx about 3 years
      I just got this problem too, on a fresh install of Ubuntu Server 20.04. The server has two ethernet ports, and the 'wait' is because only one of them is connected to a network, therefore the second one is waiting for DHCP to occur for up to the two minute time limit. The answer from @heynnema below sorted this for me, i.e. I just added the optional: true setting for the unused ethernet port, ran 'netplan generate' and 'netplan apply', rebooted, and the long wait is now gone.
  • Jastria Rahmat
    Jastria Rahmat over 3 years
    Gedit is supposed to be nano? Or vim?
  • Boris Hamanov
    Boris Hamanov over 3 years
    @JastriaRahmat Yes, you can sudo nano filename if you like. Gedit is just a nice GUI editor that a lot of folks use already.
  • Jastria Rahmat
    Jastria Rahmat over 3 years
    I will follow your answer asap. And see the result later. Thanks
  • Boris Hamanov
    Boris Hamanov over 3 years
    @JastriaRahmat Status please...
  • Jastria Rahmat
    Jastria Rahmat over 3 years
    @haven't tried it. I am outside the town currently.
  • Boris Hamanov
    Boris Hamanov over 3 years
    @JastriaRahmat Status please...
  • Jastria Rahmat
    Jastria Rahmat over 3 years
    it was working. thanks
  • Laryx Decidua
    Laryx Decidua about 3 years
    Well, it didn't work for me... no idea why. Ubuntu 20.04. In the end I went back to the old-fashioned /etc/network/interfaces setup and that worked. Mysterious...
  • Boris Hamanov
    Boris Hamanov about 3 years
    @LaryxDecidua Please start a new question so I can help.