Crash when disconnecting network adapter

Bug #2012659 reported by Adrien Nader
32
This bug affects 4 people
Affects Status Importance Assigned to Milestone
subiquity
Fix Released
Undecided
Olivier Gayot

Bug Description

If you unplug your network adapter during installation, the installer crashes. There's nothing more needed to reproduce the issue. Before you ask, my ethernet card comes from an USB4 hub which is in my screen and got turned off when the screen went to sleep. :)

I was waiting for the bug to be automatically created from my report from the installer but that never happened and I lost some context. I remember there was a problem with "is_connected" though. Basically the installer was attempting to retrieve some information but the card had disappeared and an exception is raised.

Revision history for this message
Olivier Gayot (ogayot) wrote :

This feels like a tricky situation.

I have no doubt we can do something to make sure we don't crash when accessing a network adapter that has disappeared (provided we have the hardware to reproduce it, which I currently don't). A tarball of the logs (e.g., /var/log/installer + /var/crash + journal) would help BTW.

OTOH, if the network adapter gets disconnected and does not come back up before we start downloading packages from the archive, there's little we can do to prevent the install from failing. A manual retry option would be ideal, I guess, but it feels like substantial effort.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Yea, either the install has access to a mirror or it doesn't. If access disappears half way through, well, what can we do? If the user knows in advance this is a possibility, they can disable networking by hand.

Revision history for this message
Adrien Nader (adrien) wrote :

This was still early on: installation hadn't actually begun. IIRC that could happen while the installer was checking the network status.

What I wanted to try but hadn't the time to do yet is whether that happens with several adapters and only one of them being disconnected. As a user I would expect that adapter and the related network configuration to disappear rather than a crash.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Ah yes before installation it should be tolerated. If it happens again can you capture the logs?

Revision history for this message
Olivier Gayot (ogayot) wrote :

I reproduced with a brand new USB to ethernet adapter:

2023-03-28 07:42:12,315 DEBUG root:37 start: subiquity/Network/_send_update: DEL enx00e04c680717
2023-03-28 07:42:12,315 DEBUG subiquity.server.controllers.network:355 dev_info enx00e04c680717 {'dhcp4': True}
2023-03-28 07:42:12,315 ERROR root:37 finish: subiquity/Network/_send_update: FAIL: 'NoneType' object has no attribute 'is_connected'
2023-03-28 07:42:12,315 ERROR subiquity.server.server:422 top level error
Traceback (most recent call last):
  File "/snap/subiquity/4542/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/snap/subiquity/4542/lib/python3.10/site-packages/subiquitycore/controllers/network.py", line 215, in _data_ready
    self.observer.data_ready(fd)
  File "/snap/subiquity/4542/lib/python3.10/site-packages/probert/network.py", line 667, in data_ready
    with CoalescedCalls(self):
  File "/snap/subiquity/4542/usr/lib/python3.10/contextlib.py", line 142, in __exit__
    next(self.gen)
  File "/snap/subiquity/4542/lib/python3.10/site-packages/probert/network.py", line 630, in CoalescedCalls
    meth(obj, action, data)
  File "/snap/subiquity/4542/lib/python3.10/site-packages/probert/network.py", line 680, in link_change
    self.receiver.del_link(ifindex)
  File "/snap/subiquity/4542/lib/python3.10/site-packages/subiquitycore/controllers/network.py", line 72, in del_link
    self.controller.del_link(netdev)
  File "/snap/subiquity/4542/lib/python3.10/site-packages/subiquity/server/controllers/network.py", line 379, in del_link
    self._send_update(LinkAction.DEL, dev)
  File "/snap/subiquity/4542/lib/python3.10/site-packages/subiquity/server/controllers/network.py", line 356, in _send_update
    dev_info = dev.netdev_info()
  File "/snap/subiquity/4542/lib/python3.10/site-packages/subiquitycore/models/network.py", line 201, in netdev_info
    is_connected = bool(self.info.is_connected)
AttributeError: 'NoneType' object has no attribute 'is_connected'
2023-03-28 07:42:12,320 DEBUG subiquity.common.errorreport:384 generating crash report
2023-03-28 07:42:12,320 INFO subiquity.common.errorreport:406 saving crash report 'unknown error crashed with AttributeError' to /var/crash/1679989332.320252895.unknown.crash

When a link disappears, SubiquityNetworkEventReceiver.del_link() calls model.del_link() which sets dev.info to None. Then, the code flows to NetworkController.del_link() which expects dev.info not to be None.

This feels wrong and I suspect the bug could occur without the adapter being disconnected.

Olivier Gayot (ogayot)
Changed in subiquity:
assignee: nobody → Olivier Gayot (ogayot)
status: New → In Progress
Revision history for this message
Olivier Gayot (ogayot) wrote :
Olivier Gayot (ogayot)
Changed in subiquity:
status: In Progress → Fix Committed
Olivier Gayot (ogayot)
Changed in subiquity:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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