mapping values are not allowed in this context

8,012

The issue is the indentation used within the .yaml file

In your example there is a two whitespace inndentation after 'network:' before 'version: 2' but after 'wifis:' and subsequently only one additional space is used as an indent. you can use either/or but not both, so the following will work:

# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
  wifis:
    wlan0:
      dhcp4:no
      dhcp6:no
      addresses: [10.10.10.1/24]
      gateway4: 10.10.10.254

You MUST keep the indentations uniform

Share:
8,012

Related videos on Youtube

Sock Monkey
Author by

Sock Monkey

I like to code Personal Site: www.about7sharks.com

Updated on September 18, 2022

Comments

  • Sock Monkey
    Sock Monkey almost 2 years
    # Let NetworkManager manage all devices on this system
    network:
      version: 2
      renderer: NetworkManager
      wifis:
       wlan0:
        dhcp4:no
        dhcp6:no
        addresses: [10.10.10.1/24]
        gateway4: 10.10.10.254
    

    Error message:
    line 8 column 13: mapping values are not allowed in this context

    What are mapping values?

    • steeldriver
      steeldriver almost 6 years
      I don't know all the terminology, but I believe you need at least one space after the colon in each key: value pair i.e. dhcp4: no and dhcp6: no
    • Sock Monkey
      Sock Monkey almost 6 years
      I won't have access to that computer till tomorrow but the error is appearing on the addresses line, not the dhcp lines.
    • slangasek
      slangasek almost 6 years
      line 8 of the file you've pasted is certainly the dhcp6: line, not the addresses: line; the comment line counts as a line.
  • Sock Monkey
    Sock Monkey almost 6 years
    www.yamllint.com corrected all the issues I was having.