core/pppd-plugin: wait to recover port settings before notifying death

pppd restores the previous settings for the serial port it uses right
before exiting. It is especially important to do so because otherwise
ModemManager is not able to recover the port as it can receive a hangup
event from the port due to CLOCAL not being restored.  However, there is
currently a race condition that produces this issue. This is because
when PHASE_DEAD is notified, pppd still has not restored the port
settings - it does that a bit later, in the die() function.

This patch delays notifying PHASE_DEAD until when the exitnotify() hook
is called by pppd: when this happens the port settings have already been

There were previously efforts to fix this in commit fe090c34, so
PHASE_DEAD was used instead of PHASE_DISCONNECT to notify MM that the
port was disconnected, but that still early to ensure that the port
settings are restored.

The MM traces seen when the bug is triggered are:

ModemManager[2158]: <warn>  (ttyACM1): could not re-acquire serial port lock: (5) Input/output error
ModemManager[2158]: <warn>  Couldn't load Operator Code: 'Cannot run sequence: 'Could not open serial device ttyACM1: it has been forced close'

(cherry picked from commit a251712a)
(cherry picked from commit 3caa0657)
5 jobs for nm-1-16 in 127 minutes and 17 seconds (queued for 15 minutes and 31 seconds)
Status Job ID Name Coverage
passed #360050


failed #360051


passed #360052


failed #360053
allowed to fail


passed #360049
allowed to fail


Name Stage Failure
build_f29 Test There has been a timeout failure or the job got stuck. Check your timeout limits or try again
[296/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-connection.c.o'.
[297/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-ip4-config.c.o'.
[298/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-macvlan.c.o'.
[299/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-olpc-mesh.c.o'.
[300/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/meson-generated_.._nm-core-enum-types.c.o'.
[301/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-ovs-bridge.c.o'.
[302/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-gsm.c.o'.
[303/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-macsec.c.o'.
[304/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-match.c.o'.
[305/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-ovs-patch.c.o'.
build_frawhide Test
warning: Macro expanded in comment on line 144: %{real_version_major}/%{name}-%{real_version}.tar.xz

error: This macro requires some arguments
error: line 858: %systemd_postun

ERROR: rpmbuild FAILED
ERROR: Job failed: exit code 1