Skip to content

PCI devices are assigned in random order => random issues with Wi-Fi connection #6587

@v6ak

Description

@v6ak

Qubes OS version
R4.0

Affected component(s) or functionality

Assigning PCI devices to qubes.

Brief summary
PCI devices are assigned in random order. This causes the interface names to vary across reboots (e.g., wls6 vs. wls7). Network Manager uses this identifier to identify the network card, so “randomly“ (=depending on the interface name) ignores saved Wi-Fi networks.

How Reproducible

Randomly – something like 50 % chance of different order with two PCI devices.

To Reproduce

Steps to reproduce the behavior:

  1. Assign at least two PCI devices to a qube (e.g. Wi-Fi + Ethernet to sys-net)
  2. Run lspci in the qube and save the content.
  3. Reboot computer. (Maybe restart of qubesd would be enough; Restarting just the single qube is not enough.)
  4. Run lspci in the qube and compare with the previous output.

Expected behavior
The order of those devices is always the same.

Actual behavior
The order varies randomly.

Additional context

IIUC, qubes.devices.PersistentCollection stores the identifiers of PCI devices in a Dict. Dictionaries in Python don't guarrant the order of keys (try running python3 -c 'print({"1":None, "2":None})' several times…), IIUC, it has some per-process random nonce in order to prevent collision-based DoS attack. It seems that the order is propagated to the affected DomU. I can see varying order of pcidevs in /var/log/libvirt/libxl/<qube-name>.log.

In my opinion, keeping a stable order might be also useful for some other kind of persistently attachable devices, so maybe the problem should be solved there.

Solutions you've tried

  • Workaround for NetworkManager: For each Wi-Fi network, add two (or more, depending on the number of PCI devices) connections – one for each possible interface name.
  • Workaround for NetworkManager: When Wi-Fi does not connect, edit the network connection and adjust the Device identifier.
  • [Not yet tried] Workaround for network interface names: Add some kernel parameter that affects the network interface naming to be based on something other than on order of PCI devices.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: otherNo other component ("C:") label applies to this issue, or the appropriate label is not yet known.P: defaultPriority: default. Default priority for new issues, to be replaced given sufficient information.eol-4.0This issue has been closed because Qubes OS 4.0 has reached end of life (EOL).pr submittedA pull request has been submitted for this issue.

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions