Netplan throws an error when attempting to load a config file, provides no details about what the error is

20,136

netplan is VERY fussy about .yaml file formatting. No tabs, specific indentation, and no extra spaces. Your .yaml looks ok syntactically, but try this variation...

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: true

sudo netplan generate # generate config files

sudo netplan apply # apply config

reboot # reboot the computer

Share:
20,136

Related videos on Youtube

user1819128
Author by

user1819128

Updated on September 18, 2022

Comments

  • user1819128
    user1819128 over 1 year

    Doing a clean install of Ubuntu Server 18.04 on a new machine. Currently attempting to configure my Ethernet network interface to use DHCP using netplan.

    My config file, dynamic.yaml, reads as follows:

    network:
        version: 2
        renderer: networkd
        ethernets:
            eno1:
                dhcp4: true
    

    When I attempt to load this configuration with

    sudo netplan try
    

    I get an error which reads:

    Error while loading /etc/netplan/dynamic.yaml, aborting.
    
    sudo netplan --debug try
    

    merely prints out "ERROR:Error while loading /etc/netplan/dynamic.yaml, aborting."

    Any ideas what the error is? Or does anyone have any suggestions for how to get netplan to actually specify what the error is?

    • steeldriver
      steeldriver over 4 years
      The netplan-try manual page suggests there's a --debug switch: have you tried sudo netplan --debug try?
    • user1819128
      user1819128 over 4 years
      Merely says the same thing unfortunately
    • Boris Hamanov
      Boris Hamanov over 4 years
      Does sudo netplan --debug generate give any more clues?
  • user1819128
    user1819128 over 4 years
    Turns out I was using tabs instead of spaces - switching to spaces fixed the issue, Thanks!
  • Todd Curry
    Todd Curry about 2 years
    @heynnema, this answer made me get out my glasses and find the issue in my netplan -- tedious. Is there a YAML parsing utility (any language) that you know of to find issues programmatically?
  • Boris Hamanov
    Boris Hamanov about 2 years
    @ToddCurry Check out yamllint. It's in the Ubuntu repos.
  • Todd Curry
    Todd Curry about 2 years
    Brilliant, @heynnema -- thank you! When I googled, I also found yamllint.com, (which may/may not be secure, but) checks your yaml in a web form. You have set me on a path to yaml sanity!