This is the output. Comes with a warning to use caution. Backup your system beforehand just in case.
When Fedora 44 attempts to enter a suspend state while a active TCP-based VPN (such as OpenVPN, WireGuard over TCP, or AnyConnect) is running, the crash is usually caused by a network interface deadlocking the kernel network stack.
As systemd-logind tries to pause network activities for the sleep state, the active TCP socket waits on a handshake or times out aggressively. This causes an unkillable network process or a kernel panic, resulting in a black-screen crash instead of normal sleep.
Step 1: Tell systemd to bring down the VPN before suspending
The cleanest fix is to create a systemd pre-suspend hook that forces the VPN to disconnect before the laptop powers down the network adapters.
Open your terminal and create a new script file
sudo nano /usr/lib/systemd/system-sleep/vpn-disconnect.sh
Paste the following script (this example works if you manage your VPN via NetworkManager)
#!/bin/sh
case "$1" in
pre)
# Find any active VPN connections and disconnect them
ACTIVE_VPN=$(nmcli -t -f NAME,TYPE connection show --active | grep vpn | head -n1 | cut -d: -f1)
if [ -not -z "$ACTIVE_VPN" ]; then
logger "Pre-suspend: Disconnecting active VPN: $ACTIVE_VPN"
nmcli connection down id "$ACTIVE_VPN"
sleep 1 # Give the network socket a second to close gracefully
fi
;;
esac
(Note: If you run OpenVPN directly from the terminal rather than NetworkManager, replace the inner block with pkill openvpn.)
Make the script executable
sudo chmod +x /usr/lib/systemd/system-sleep/vpn-disconnect.sh
Step 2: Ensure systemd doesn’t ignore inhibitors
Sometimes NetworkManager or desktop modules try to block sleep until the connection is safely torn down, but systemd forces the lid-close suspend anyway, triggering the crash.
Edit your login settings
sudo nano /etc/systemd/logind.conf
Find the following line, uncomment it (remove the #), and ensure it is set to yes
LidSwitchIgnoreInhibited=yes
Alternatively, if you prefer your laptop never goes to sleep while the lid is closed (acting like a workstation server), change the behavior to ignore:
HandleLidSwitch=ignore
Save the file and restart the logind service:
sudo systemctl restart systemd-logind
Step 3: Switch from TCP to UDP (If possible)
TCP VPN profiles are notoriously fragile under Linux sleep cycles because TCP demands strict packet acknowledgments and state tracking. If your VPN provider allows it, switch your connection protocol from TCP to UDP. UDP doesn’t maintain an active, stateful virtual circuit, allowing Fedora’s kernel to cleanly suspend the network interface without waiting for a socket response.