Skip to main content

Netplan FAQs


Looking at search traffic, it seems the following netplan issues get people frequently.

No tabs in YAML

Problem:
netplan prints an error message like this:

Invalid YAML at //etc/netplan/10-bad.yaml line 6 column 0: found character that cannot start any token

Solution:
You have a tab in your YAML file. Remove the tab and try again.

There will eventually be better error messages for this - PR#12 or PR#18, but they haven't landed as of June 2018.

mapping values are not allowed in this context

Problem:
netplan prints an error message like this:

Invalid YAML at //etc/netplan/10-bad.yaml line 3 column 12: mapping values are not allowed in this context

Cause:
Netplan parses YAML with libyaml, which has some rather obtuse error messages.

As far as I can tell, this is caused when you have a YAML file where:
  • you have begun a mapping. As of Bionic, netplan recognises networks, match, nameservers, routes, routing-policy, access-points, parameters and SSIDs as mappings (see the netplan man page)
  • you have an item in the mapping that isn't a key-value pair, it's just a bare value.
This is easy to do if you forget a colon somewhere. For example, here there should be a colon after the ens3:

network:
      version: 2
      ethernets:
        ens3
            dhcp4: true


(If you have another YAML file that demonstrates this, please let me know on Twitter (@daxtens) or by posting a comment!)

Solution:
Check your YAML file carefully for syntax errors. Check all mapping stanzas, checking that each item has a colon in the correct place.

Cannot set an MTU!

Netplan (well really the combination of udev and systemd-networkd) has some weird quirks when setting MTUs. As far as I can tell, if you are trying to set an MTU and it isn't working, make sure the match stanzas are matching on MAC address. This seems to be the most reliable; otherwise networkd throws a fit about devices that are renamed in udev. See LP: #1724895 and my previous post.

Other issues?

We can probably help!

  • Let me know in the comments;
  • Ask me (@daxtens) on on Twitter; 
  • Ask on Ask Ubuntu;
  • Try #netplan on freenode; or,
  • Open an issue on Launchpad.

Comments

Popular posts from this blog

Connecting to a wifi network with netplan

How do you connect to a a wifi network with netplan? I hang out on the #netplan IRC channel on Freenode, and this comes up every so often. netplan - the default network configuration tool in Ubuntu 17.10 onwards - currently supports WPA2 Personal networks, and open (unencrypted) networks only. If you need something else, consider using NetworkManager directly, or falling back to ifupdown and wpa_supplicant for a little longer. Without further ado, here are tested, working YAML files for connection to my local WPA2 and unencrypted network. The only things that have been changed are the SSIDs and password. Both networks have a router providing dhcp4. In both cases I assume there's only one wifi device in the system - if this is not true, replace match: {} with something more specific. You can drop these in  /etc/netplan and run netplan generate; netplan apply  and things should work. The network will also be brought up on subsequent boots. Note that, as always in YAML...

Anonymous bridges in netplan

netplan is the default network configuration system for new installs of Ubuntu 18.04 (Bionic). Introduced as the default in Artful, it replaces /etc/network/interfaces . One question that gets asked repeatedly is: "How do I set up an anonymous bridge in netplan?" (An anonymous bridge, I discovered, is one where the bridge doesn't have an IP address; it's more akin to a switch or hub.) It's been approached on  Launchpad , and comes up on the IRC channel. If you're trying to create a bridge without an IP address, the obvious first thing to try is this: network: version: 2 ethernets: ens8: match: macaddress: 52:54:00:f9:e9:dd ens9: match: macaddress: 52:54:00:56:0d:ce bridges: br0: interfaces: [ens8, ens9] This is neat, plausible, and wrong - the bridge will be created but will stay 'down'. Per ip a : 5: br0: <BROADCAST,MULTICAST> mtu 15...

Painless powerpc cross-compiling

As an ex-IBMer, I'm still quite fond of POWER/ppc64 processors, and occasionally cross-compile kernels for 64-bit little-endian PowerPC (ppc64el/ppc64le) from my amd64 system. It's not immediately obvious what the simplest way to do this is. On Ubuntu (and I'm told, Debian) it is really very simple. Installation sudo apt install gcc-powerpc64le-linux-gnu Congrats, you now have a ppc64le cross-compiling toolchain installed! If you need other languages, g++/gccgo/gfortran/gnat/gobjc-powerpc64le-linux-gnu are also available. Kernel cd your/linux/source make ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- <your usual kernel build commands here> That's it. Userspace It depends a bit on the build system. Here's how to build, for example, sed , which uses autotools ( ./configure and friends). ./configure --host powerpc64le-linux-gnu make That's it.  For a dynamically linked binary, you only need the headers for any library depende...