fix: give a Wi-Fi the installer set up to NetworkManager, by hand
The Bible study laptop had working internet and a panel that said there
was no connection. Both were true, and one thing caused both.
Measured on the machine:
nmcli device status wlp2s0 wifi unmanaged
nmcli networking connectivity none while curl fetched fine
nmcli device wifi list nothing, with the radio enabled
/run/network/ifstate wlp2s0=wlp2s0
a second wpa_supplicant, -i wlp2s0, with no -c config file
dhcpcd holding the lease
/etc/network/interfaces 0600 root:root
Debian's installer had been given the Wi-Fi, so it wrote it into
/etc/network/interfaces and ifupdown brings it up. NetworkManager ships
with plugins=ifupdown and [ifupdown] managed=false, so an interface named
in that file is UNMANAGED — which is why the applet had nothing to report
and why scanning found nothing. An unmanaged device is not a radio
NetworkManager will scan with. rfkill was ruled out separately: the radio
is enabled.
managed=false stays; it is what keeps a tower's static Ethernet where an
administrator put it. Only a wireless interface is moved.
classroom-wifi grows --check, --adopt (with --dry-run) and --rollback.
--adopt builds a NetworkManager SYSTEM connection from the SSID and key
already in that root-only file, so the password never leaves the machine
and never reaches a human or a log; it lands in a 0600 root file with
psk-flags=0, the same shape 0.2.4 established, and the polkit rules
protecting it are untouched.
Deliberately NOT run by the upgrade. It moves a machine's only link
between managers and the machine it could strand is a laptop in a locked
room, so classroom-migrate only looks and prints what it found. An
administrator runs it over SSH while watching.
Two things this learned from testing the rollback rather than from
reading the code, and both are why the rollback is worth testing:
* ifdown was missing in the lab, subprocess raised FileNotFoundError,
and the exception escaped AFTER the stanza was commented out. No
rollback ran. Every hand-over command now goes through a runner that
tolerates a missing binary, and the whole hand-over is inside a guard
that restores the file on any failure at all.
* it now refuses to start when ifdown or ifup are absent, because
without them the hand-over would be a one-way door.
Success also requires the interface itself to be carrying the connection,
not merely that the machine is online — a machine with a second link
would otherwise report a failed migration as a success.
Verified in the lab against real NetworkManager with a real ifupdown
file: --check and --dry-run leave it byte-identical, a failed --adopt
rolls back byte-identically, and --rollback restores a half-migrated
machine byte-identically and exits 0. The one thing no lab can do is the
hand-over succeeding, which needs the laptop's radio.
Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
a31fa75d55
commit
35e3bdcbbd
@@ -96,6 +96,68 @@ An administrator's own account and root are untouched. To lift any of it
|
||||
for maintenance, drop a file of the same name into
|
||||
`/etc/polkit-1/rules.d/`, which polkit reads first.
|
||||
|
||||
## A Wi-Fi the Debian installer set up
|
||||
|
||||
Symptom: the internet works, Chrome loads pages, and the panel insists
|
||||
there is no connection. Scanning finds nothing either.
|
||||
|
||||
Both are true at once, and they have one cause. If the installer was
|
||||
given the Wi-Fi, it wrote the network into `/etc/network/interfaces`.
|
||||
ifupdown brings that up with its own `wpa_supplicant` and `dhcpcd`, which
|
||||
is the working internet. NetworkManager ships here with
|
||||
`plugins=ifupdown` and `[ifupdown] managed=false`, so an interface named
|
||||
in that file is marked **unmanaged** — and an unmanaged device is not a
|
||||
radio NetworkManager will report on or scan with.
|
||||
|
||||
Measured on the Bible study laptop:
|
||||
|
||||
```
|
||||
$ nmcli device status
|
||||
wlp2s0 wifi unmanaged --
|
||||
$ nmcli networking connectivity
|
||||
none # while curl fetched fine
|
||||
$ nmcli device wifi list
|
||||
SSID SIGNAL # nothing, and the radio is enabled
|
||||
```
|
||||
|
||||
`managed=false` stays. It is what keeps a tower's static Ethernet under
|
||||
ifupdown's control where an administrator put it. Only a **wireless**
|
||||
interface is moved.
|
||||
|
||||
### Moving it, while watching
|
||||
|
||||
This is never done by an upgrade. It moves a machine's only link between
|
||||
two managers, and the machine it could strand is a laptop in a locked
|
||||
room. `classroom-migrate` only looks and says what it found. An
|
||||
administrator does the rest, over SSH, watching:
|
||||
|
||||
```
|
||||
classroom-wifi --check # who owns it; changes nothing
|
||||
classroom-wifi --adopt --dry-run # what would change; changes nothing
|
||||
classroom-wifi --adopt # do it
|
||||
classroom-wifi --rollback # undo it, at any time afterwards
|
||||
```
|
||||
|
||||
`--adopt` creates a NetworkManager **system** connection from the SSID
|
||||
and key already in that file — so the password never leaves the machine,
|
||||
is never printed, and lands in a 0600 root-only file with `psk-flags=0`,
|
||||
exactly as `classroom-wifi` provisions any other network. The stanza is
|
||||
then commented out, the interface handed over, and the result checked:
|
||||
the connection must be active **on that interface** and the machine must
|
||||
really fetch something. Checking only "is the machine online" would pass
|
||||
on a machine with a second link while the Wi-Fi sat dead.
|
||||
|
||||
If any of that fails — including a command that is not installed, or an
|
||||
interrupt — the original file is put back and ifupdown gets the interface
|
||||
again. It refuses to start at all if `ifdown`/`ifup` are missing, because
|
||||
that would be a one-way door.
|
||||
|
||||
The original is kept at `/etc/network/interfaces.before-ekklesia-classroom`.
|
||||
|
||||
After the migration the panel shows the connection at the next login, the
|
||||
room can scan, and the credential protection below applies to it like any
|
||||
other system connection.
|
||||
|
||||
### Recovery when there is no network at all
|
||||
|
||||
There is deliberately no teacher-facing "join a network" dialog in this
|
||||
|
||||
Reference in New Issue
Block a user