subiquity should verify netplan config better

Bug #1931624 reported by sascha arthur
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
subiquity
New
Undecided
Unassigned

Bug Description

Hello,

The new autoinstaller is bugged when using mac addresses only having digits..

user-data:

#user-data
autoinstall:
  version: 1
  ...
  network:
    network:
     version: 2
     renderer: networkd
     ethernets:
       ens3:
         match:
           macaddress: 52:54:00:53:05:09
         dhcp4: yes
         dhcp6: no
         mtu: 1300
         nameservers:
             addresses: [8.8.8.8,1.1.1.1]

fails with:

2021-06-10 18:48:13,503 ERROR root:39 finish: subiquity/Network/apply_autoinstall_config/wait_for_apply: FAIL: apply_error() missing 1 required positional argument: 'stage'
2021-06-10 18:48:13,503 ERROR root:39 finish: subiquity/Network/apply_autoinstall_config: FAIL: apply_error() missing 1 required positional argument: 'stage'
2021-06-10 18:48:13,503 ERROR root:39 finish: subiquity/apply_autoinstall_config: FAIL: apply_error() missing 1 required positional argument: 'stage'
2021-06-10 18:48:13,503 ERROR subiquity.server.server:319 top level error
Traceback (most recent call last):
  File "/snap/subiquity/2393/lib/python3.6/site-packages/subiquitycore/controllers/network.py", line 328, in _apply_config
    await arun_command(['netplan', 'apply'], check=True)
  File "/snap/subiquity/2393/lib/python3.6/site-packages/subiquitycore/utils.py", line 85, in arun_command
    raise subprocess.CalledProcessError(proc.returncode, cmd)
subprocess.CalledProcessError: Command '['netplan', 'apply']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/snap/subiquity/2393/lib/python3.6/site-packages/subiquity/server/server.py", line 521, in start
    await self.apply_autoinstall_config()
  File "/snap/subiquity/2393/lib/python3.6/site-packages/subiquitycore/context.py", line 148, in decorated_async
    return await meth(self, **kw)
  File "/snap/subiquity/2393/lib/python3.6/site-packages/subiquity/server/server.py", line 368, in apply_autoinstall_config
    await controller.apply_autoinstall_config()
  File "/snap/subiquity/2393/lib/python3.6/site-packages/subiquitycore/context.py", line 148, in decorated_async
    return await meth(self, **kw)
  File "/snap/subiquity/2393/lib/python3.6/site-packages/subiquity/server/controllers/network.py", line 172, in apply_autoinstall_config
    await self.apply_config_task.wait()
  File "/snap/subiquity/2393/lib/python3.6/site-packages/subiquitycore/async_helpers.py", line 83, in wait
    return await self.task
  File "/snap/subiquity/2393/usr/lib/python3.6/asyncio/events.py", line 145, in _run
    self._callback(*self._args)
  File "/snap/subiquity/2393/lib/python3.6/site-packages/subiquitycore/async_helpers.py", line 26, in _done
    fut.result()
  File "/snap/subiquity/2393/lib/python3.6/site-packages/subiquity/server/controllers/network.py", line 178, in _apply_config
    await super()._apply_config(context=context, silent=silent)
  File "/snap/subiquity/2393/lib/python3.6/site-packages/subiquitycore/context.py", line 148, in decorated_async
    return await meth(self, **kw)
  File "/snap/subiquity/2393/lib/python3.6/site-packages/subiquitycore/controllers/network.py", line 330, in _apply_config
    error("apply")
  File "/snap/subiquity/2393/lib/python3.6/site-packages/subiquitycore/controllers/network.py", line 289, in error
    self.apply_error(stage)
  File "/snap/subiquity/2393/lib/python3.6/site-packages/subiquity/server/controllers/network.py", line 259, in apply_error
    super().apply_error()
TypeError: apply_error() missing 1 required positional argument: 'stage'
2021-06-10 18:48:13,503 INFO root:39 finish: subiquity/Meta/status_GET: SUCCESS: 200 {"state": "ERROR", "confirming_tty": "", "error": {"state": "ERROR_GENERATING...
2021-06-10 18:48:13,504 INFO aiohttp.access:206 [10/Jun/2021:18:48:13 +0000] "GET /meta/status?cur=%22ERROR%22 HTTP/1.1" 200 542 "-" "Python/3.6 aiohttp/3.7.4.post0"

here some infos from the resulting subquity system:

root@ubuntu-server:/etc/netplan# cat 00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
  ethernets:
    ens3:
      dhcp4: true
      dhcp6: false
      match:
        macaddress: 41135231109
      mtu: 1300
      nameservers:
        addresses:
        - 8.8.8.8
        - 1.1.1.1
  renderer: networkd
  version: 2

matching this mac here: "match macaddress: 41135231109" is wrong and results in failing "netplan apply" within the installer.

Tested and verified in a daily ubuntu live focal image (https://cdimage.ubuntu.com/ubuntu-server/focal/daily-live/current/focal-live-server-amd64.iso)

Also it seems apply_error is called wrong?!

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote : Re: [Bug 1931624] [NEW] autoinstall mac match fail

I'm 90% sure this is yaml being insane. Try quoting the mac address? (We
should probably beef up the validation if network config). The failure to
report the error correctly is fixed in git and will be in the next release.

Revision history for this message
sascha arthur (sarthur) wrote : Re: autoinstall mac match fail

yes using

       ens3:
         match:
           macaddress: '52:54:00:53:05:09'

seems to fix the issue. Anyways this is somehow super confusing, where to report this issue against?

When does your fix reach daily-live/current/focal-live-server-amd64.iso ?

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote : Re: [Bug 1931624] Re: autoinstall mac match fail

On Sat, 12 Jun 2021 at 00:50, sascha arthur <email address hidden>
wrote:

> yes using
>
> ens3:
> match:
> macaddress: '52:54:00:53:05:09'
>
> seems to fix the issue.

Glad to hear it!

> Anyways this is somehow super confusing, where
> to report this issue against?
>

Well we can repurpose this bug to say something like "validate netplan
config better" which would make the failure mode less confusing. Fixing
YAML to have less footguns like this is a wider topic of course.

When does your fix reach daily-live/current/focal-live-server-amd64.iso ?
>

Hopefully this week.

summary: - autoinstall mac match fail
+ subiquity should verify netplan config better
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.