Score:0

Inconsistent indentation with YAML

br flag

While trying to set up my Ubuntu Server, I've stumbled upon this error when typing Netplan Generate

Invalid YAML: inconsistent indentation:

But it just shows

                  ^             

I have no Idea where the error is.

My Code is:

network:
  ethernets:
    addresses: [192.168.136.1/24]
    gateway4: 192.168.136.1
    nameservers: 
      addresses: [1.1.1.1, 1.0.0.1]
      search: []
  version: 2
  wifis:
    wlp2s2:
      dhcp4: yes
      access-points:
        'SSID'
          password: 'password'

Please Note that: The ethernets part was there when I opened it for the first time, so I only configured the wifis part.

I've left the SSID and the password away for obvious reasons.

Can anyone help?

in flag
I believe you're missing a colon after the wireless interface and again after SSID. I generally use double-quotes rather than single quotes with the SSID ...
cn flag
Me too @matigo I advice to use double quotes. and .... https://codebeautify.org/yaml-validator/cbd763fb ftw ;-) acc. to link: error at wlp2s2 a , made it valid ;)
pasman pasmański avatar
mx flag
Indentation is bad too, look at examples: https://netplan.io/examples/
random person avatar
br flag
@matigo I edited it but now it says --> Error in network definition: expected mapping (check indentation)
random person avatar
br flag
@pasmanpasmański Sorry I kinda messed it up a bit while writing the question. I edited it. now it looks like the code.
random person avatar
br flag
@matigo Nvm, it I changed the code a bit. But now it doesn't really work. It only says configuring when I type **networkctl**
Score:1
in flag
  1. The first comment made two points:

    Missing something ...

  2. The second comment corroborated something in the first, supplied a tool to validate the YAML against, and pointed to a specific line:

    YAML Validation

  3. Using the YAML validator, invalid YAML was confirmed:

    Missing a colon

  4. Adding a colon resolves the issue:

    One-Two Punch

random person avatar
br flag
even after the colon it still didn't work. I simply removed the single quotes from the SSID and the password
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.