agama/live/live-root/etc/systemd/system/initrd-nmtui.service
Ladislav Slezák d382e4d6d5
Break a systemd service dependency cycle (#3665)
## Problem

- https://bugzilla.suse.com/show_bug.cgi?id=1268901
- When systemd detects a cycle in the service dependencies then it
deletes some services to break the cycle. But that services are missing
in the boot sequence and that can have nasty side effects.

```
Jun 24 15:03:54 localhost systemd[1]: NetworkManager-initrd.service: Found ordering cycle: ignition-enable-network.service/start after ignition-fetch-offline.service/start after basic.target/start after sysinit.target/start after cryptsetup.target/start after systemd-ask-password-console.path/start after plymouth-start.service/start after initrd-nmtui.service/start after network-online.target/start after network.target/start after NetworkManager-initrd.service/start - after ignition-enable-network.service
Jun 24 15:03:54 localhost systemd[1]: NetworkManager-initrd.service: Job cryptsetup.target/start deleted to break ordering cycle starting with NetworkManager-initrd.service/start
```

## Solution

- Remove the `Before=plymouth-start.service` dependency which was used
to start the interactive TUI tool before the splashscreen (otherwise it
would not be visible).
- Instead ordering the services quit plymouth before starting the TUI
tool.

## Notes

- As written in the comment, it should be enough to use the `plymouth
hide-splash` and `plymouth show-splash` pair in the pre/post scripts but
unfortunately then the `nmtui` ignores pressing the `Enter` key and
cannot be used. It is strange as the `dialog` tool used before running
`nmtui` works fine.
- As a workaround quit the splash screen completely. As this boot option
will be used rarely it is an acceptable solution.

## Testing

- Tested manually, no dependency cycle is reported and the `nmtui` tool
works fine.

---------

Co-authored-by: Martin Vidner <mvidner@suse.com>
2026-06-24 17:55:03 +02:00

47 lines
1.4 KiB
Desktop File

[Unit]
Description=Interactive network configuration in initrd
DefaultDependencies=no
# see https://man7.org/linux/man-pages/man7/dracut.bootup.7.html
# for the dependency order of the dracut services
# after NetworkManager is started and network configured
After=network-online.target
# after the console is initialized
After=systemd-vconsole-setup.service
# before running the pre-pivot dracut hooks (before the driver update),
# before the self-update
Before=dracut-pre-pivot.service live-self-update.service
ConditionKernelCommandLine=live.net_config_tui=1
[Service]
Type=oneshot
# disable the kernel output on the console
ExecStartPre=dmesg --console-off
# disable the systemd status messages on the console
ExecStartPre=kill -SIGRTMIN+21 1
# hide the plymouth splash screen
# NOTE: It should be enough to hide the splash with "plymouth hide-splash" and
# then show it back with "plymouth show-splash". But unfortunately the nmtui
# tool then for some reason does not work properly and does not react on
# pressing the [Enter] key. As a workaround stop the plymouth splash completely.
ExecStartPre=-plymouth quit
ExecStart=initrd-network-setup.sh
# enable back the kernel output on the console
ExecStartPost=dmesg --console-on
# enable back the systemd status messages on the console
ExecStartPost=kill -SIGRTMIN+20 1
Environment=TERM=linux
StandardInput=tty
StandardOutput=tty
TimeoutStartSec=infinity
RemainAfterExit=true
[Install]
WantedBy=initrd.target