systemd / systemd

The systemd System and Service Manager
https://systemd.io
GNU General Public License v2.0
13.32k stars 3.81k forks source link

WireGuard connection does not resume after sleep #26665

Closed andruska closed 1 year ago

andruska commented 1 year ago

systemd version the issue has been seen with

253

Used distribution

Archlinux

Linux kernel version used

6.0.8, 6.1.12, 6.2.1

CPU architectures issue was seen on

x86_64

Component

other

Expected behaviour you didn't see

No response

Unexpected behaviour you saw

After upgrading systemd from 252 to 253 Wireguard stopped resuming from sleep (suspend, hibernation) cycle. journalctl -u wg-quick@profile.service shows exactly same state as it was before sleep. I get Wireguard back restarting wg-quick service by systemctl restart wg-quick@profile.service.

For networking i use systemd-networkd, systemd-resolved, iwd, wg-quick. Tested with kernels 6.0.8, 6.1.12, 6.2.1.

Downgrading to 252 Wireguard works again as expected.

Steps to reproduce the problem

Configurations:

# cat /etc/systemd/network/25-wireless.network 
[Match]
Name=wlan0

[Network]
DHCP=true
IgnoreCarrierLoss=3s

[DHCPv4]
UseDNS=false

[DHCPv6]
UseDNS=false

[IPv6AcceptRA]
UseDNS=false
# cat /lib/systemd/system/wg-quick@.service 
[Unit]
Description=WireGuard via wg-quick(8) for %I
After=network-online.target nss-lookup.target
Wants=network-online.target nss-lookup.target
PartOf=wg-quick.target
Documentation=man:wg-quick(8)
Documentation=man:wg(8)
Documentation=https://www.wireguard.com/
Documentation=https://www.wireguard.com/quickstart/
Documentation=https://git.zx2c4.com/wireguard-tools/about/src/man/wg-quick.8
Documentation=https://git.zx2c4.com/wireguard-tools/about/src/man/wg.8

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/wg-quick up %i
ExecStop=/usr/bin/wg-quick down %i
ExecReload=/bin/bash -c 'exec /usr/bin/wg syncconf %i <(exec /usr/bin/wg-quick strip %i)'
Environment=WG_ENDPOINT_RESOLUTION_RETRIES=infinity

[Install]
WantedBy=multi-user.target
# cat /lib/systemd/system/iwd.service 
[Unit]
Description=Wireless service
Documentation=man:iwd(8) man:iwd.config(5) man:iwd.network(5) man:iwd.ap(5)
After=network-pre.target
Before=network.target
Wants=network.target

[Service]
Type=dbus
BusName=net.connman.iwd
ExecStart=/usr/lib/iwd/iwd
NotifyAccess=main
LimitNPROC=1
Restart=on-failure
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW CAP_NET_BIND_SERVICE
PrivateTmp=true
NoNewPrivileges=true
DevicePolicy=closed
DeviceAllow=/dev/rfkill rw
ProtectHome=yes
ProtectSystem=strict
ProtectControlGroups=yes
ProtectKernelModules=yes
ConfigurationDirectory=iwd
StateDirectory=iwd
StateDirectoryMode=0700

[Install]
WantedBy=multi-user.target
# cat /etc/systemd/resolved.conf 

[Resolve]

DNSSEC=no
DNS=xxx.xxx.xxx.xxx
DNS=xxx.xxx.xxx.xxx
DNS=xxx.xxx.xxx.xxx
DNS=xxx.xxx.xxx.xxx
DNSOverTLS=yes
Domains=~.

Additional program output to the terminal or log subsystem illustrating the issue

Mar 03 23:55:11 book kernel: atkbd serio0: Unknown key pressed (translated set 2, code 0x85 on isa0060/serio0).
Mar 03 23:55:11 book kernel: atkbd serio0: Use 'setkeycodes e005 <keycode>' to make it known.
Mar 03 23:55:11 book systemd-logind[392]: Lid closed.
Mar 03 23:55:11 book systemd-logind[392]: Suspending...
Mar 03 23:55:12 book systemd[1]: Reached target Sleep.
Mar 03 23:55:12 book systemd[1]: Starting System Suspend...
Mar 03 23:55:12 book systemd-sleep[47492]: Entering sleep state 'suspend'...
Mar 03 23:55:12 book kernel: PM: suspend entry (deep)
Mar 03 23:55:12 book kernel: Filesystems sync: 0.075 seconds
Mar 04 00:01:11 book kernel: Freezing user space processes ... (elapsed 0.004 seconds) done.
Mar 04 00:01:11 book kernel: OOM killer disabled.
Mar 04 00:01:11 book kernel: Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Mar 04 00:01:11 book kernel: printk: Suspending console(s) (use no_console_suspend to debug)
Mar 04 00:01:11 book kernel: wlan0: deauthenticating from XX:XX:XX:XX:XX:XX by local choice (Reason: 3=DEAUTH_LEAVING)
Mar 04 00:01:11 book kernel: sd 0:0:0:0: [sda] Synchronizing SCSI cache
Mar 04 00:01:11 book kernel: sd 0:0:0:0: [sda] Stopping disk
Mar 04 00:01:11 book kernel: e1000e: EEE TX LPI TIMER: 00000011
Mar 04 00:01:11 book kernel: ACPI: EC: interrupt blocked
Mar 04 00:01:11 book kernel: ACPI: PM: Preparing to enter system sleep state S3
Mar 04 00:01:11 book kernel: ACPI: EC: event blocked
Mar 04 00:01:11 book kernel: ACPI: EC: EC stopped
Mar 04 00:01:11 book kernel: ACPI: PM: Saving platform NVS memory
Mar 04 00:01:11 book kernel: Disabling non-boot CPUs ...
Mar 04 00:01:11 book kernel: smpboot: CPU 1 is now offline
Mar 04 00:01:11 book kernel: smpboot: CPU 2 is now offline
Mar 04 00:01:11 book kernel: smpboot: CPU 3 is now offline
Mar 04 00:01:11 book kernel: ACPI: PM: Low-level resume complete
Mar 04 00:01:11 book kernel: ACPI: EC: EC started
Mar 04 00:01:11 book kernel: ACPI: PM: Restoring platform NVS memory
Mar 04 00:01:11 book kernel: Enabling non-boot CPUs ...
Mar 04 00:01:11 book kernel: x86: Booting SMP configuration:
Mar 04 00:01:11 book kernel: smpboot: Booting Node 0 Processor 1 APIC 0x2
Mar 04 00:01:11 book kernel: CPU1 is up
Mar 04 00:01:11 book kernel: Freezing user space processes ... (elapsed 0.004 seconds) done.
Mar 04 00:01:11 book kernel: OOM killer disabled.
Mar 04 00:01:11 book kernel: Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Mar 04 00:01:11 book kernel: printk: Suspending console(s) (use no_console_suspend to debug)
Mar 04 00:01:11 book kernel: wlan0: deauthenticating from XX:XX:XX:XX:XX:XX by local choice (Reason: 3=DEAUTH_LEAVING)
Mar 04 00:01:11 book kernel: sd 0:0:0:0: [sda] Synchronizing SCSI cache
Mar 04 00:01:11 book kernel: sd 0:0:0:0: [sda] Stopping disk
Mar 04 00:01:11 book kernel: e1000e: EEE TX LPI TIMER: 00000011
Mar 04 00:01:11 book kernel: ACPI: EC: interrupt blocked
Mar 04 00:01:11 book kernel: ACPI: PM: Preparing to enter system sleep state S3
Mar 04 00:01:11 book kernel: ACPI: EC: event blocked
Mar 04 00:01:11 book kernel: ACPI: EC: EC stopped
Mar 04 00:01:11 book kernel: ACPI: PM: Saving platform NVS memory
Mar 04 00:01:11 book kernel: Disabling non-boot CPUs ...
Mar 04 00:01:11 book kernel: smpboot: CPU 1 is now offline
Mar 04 00:01:11 book kernel: smpboot: CPU 2 is now offline
Mar 04 00:01:11 book kernel: smpboot: CPU 3 is now offline
Mar 04 00:01:11 book kernel: ACPI: PM: Low-level resume complete
Mar 04 00:01:11 book kernel: ACPI: EC: EC started
Mar 04 00:01:11 book kernel: ACPI: PM: Restoring platform NVS memory
Mar 04 00:01:11 book kernel: Enabling non-boot CPUs ...
Mar 04 00:01:11 book kernel: x86: Booting SMP configuration:
Mar 04 00:01:11 book kernel: smpboot: Booting Node 0 Processor 1 APIC 0x2
Mar 04 00:01:11 book kernel: CPU1 is up
Mar 04 00:01:11 book kernel: smpboot: Booting Node 0 Processor 2 APIC 0x1
Mar 04 00:01:11 book kernel: CPU2 is up
Mar 04 00:01:11 book kernel: smpboot: Booting Node 0 Processor 3 APIC 0x3
Mar 04 00:01:11 book kernel: CPU3 is up
Mar 04 00:01:11 book kernel: ACPI: PM: Waking up from system sleep state S3
Mar 04 00:01:11 book kernel: ACPI: EC: interrupt unblocked
Mar 04 00:01:11 book kernel: ACPI: EC: event unblocked
Mar 04 00:01:11 book kernel: sd 0:0:0:0: [sda] Starting disk
Mar 04 00:01:11 book kernel: i915 0000:00:02.0: [drm] [ENCODER:94:DDI A/PHY A] is disabled/in DSI mode with an ungated DDI clock, gate it
Mar 04 00:01:11 book kernel: i915 0000:00:02.0: [drm] [ENCODER:102:DDI B/PHY B] is disabled/in DSI mode with an ungated DDI clock, gate it
Mar 04 00:01:11 book kernel: i915 0000:00:02.0: [drm] [ENCODER:118:DDI C/PHY C] is disabled/in DSI mode with an ungated DDI clock, gate it
Mar 04 00:01:11 book kernel: nvme nvme0: 4/0/0 default/read/poll queues
Mar 04 00:01:11 book kernel: usb 1-9: reset high-speed USB device number 4 using xhci_hcd
Mar 04 00:01:11 book kernel: ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
Mar 04 00:01:11 book kernel: ata1.00: ACPI cmd f5/00:00:00:00:00:e0(SECURITY FREEZE LOCK) filtered out
Mar 04 00:01:11 book kernel: ata1.00: ACPI cmd f5/00:00:00:00:00:e0(SECURITY FREEZE LOCK) filtered out
Mar 04 00:01:11 book kernel: ata1.00: configured for UDMA/133
Mar 04 00:01:11 book kernel: usb 1-7: reset full-speed USB device number 2 using xhci_hcd
Mar 04 00:01:11 book kernel: OOM killer enabled.
Mar 04 00:01:11 book kernel: Restarting tasks ... 
Mar 04 00:01:11 book kernel: usb 1-8: USB disconnect, device number 20
Mar 04 00:01:11 book kernel: mei_hdcp 0000:00:16.0-b638ab7e-94e2-4ea2-a552-d1c54b627f04: bound 0000:00:02.0 (ops i915_hdcp_component_ops [i915])
Mar 04 00:01:11 book kernel: done.
Mar 04 00:01:11 book kernel: random: crng reseeded on system resumption
Mar 04 00:01:11 book bluetoothd[481]: Endpoint unregistered: sender=:1.33 path=/MediaEndpoint/A2DPSink/sbc
Mar 04 00:01:11 book systemd-logind[392]: Lid opened.
Mar 04 00:01:11 book iwd[389]: Received Deauthentication event, reason: 3, from_ap: false
Mar 04 00:01:11 book bluetoothd[481]: Endpoint unregistered: sender=:1.33 path=/MediaEndpoint/A2DPSource/sbc
Mar 04 00:01:11 book systemd-networkd[320]: wlan0: Lost carrier
Mar 04 00:01:11 book bluetoothd[481]: Endpoint unregistered: sender=:1.33 path=/MediaEndpoint/A2DPSink/sbc_xq_453
Mar 04 00:01:11 book systemd-timesyncd[384]: No network connectivity, watching for changes.
Mar 04 00:01:11 book bluetoothd[481]: Endpoint unregistered: sender=:1.33 path=/MediaEndpoint/A2DPSource/sbc_xq_453
Mar 04 00:01:11 book systemd-resolved[383]: Clock change detected. Flushing caches.
Mar 04 00:01:11 book bluetoothd[481]: Endpoint unregistered: sender=:1.33 path=/MediaEndpoint/A2DPSink/sbc_xq_512
Mar 04 00:01:11 book systemd[1]: Starting Load/Save RF Kill Switch Status...
Mar 04 00:01:11 book bluetoothd[481]: Endpoint unregistered: sender=:1.33 path=/MediaEndpoint/A2DPSource/sbc_xq_512
Mar 04 00:01:11 book systemd[1]: Started Verify integrity of password and group files.
Mar 04 00:01:11 book bluetoothd[481]: Endpoint unregistered: sender=:1.33 path=/MediaEndpoint/A2DPSink/sbc_xq_552
Mar 04 00:01:11 book bluetoothd[481]: Endpoint unregistered: sender=:1.33 path=/MediaEndpoint/A2DPSource/sbc_xq_552
Mar 04 00:01:11 book kernel: usb 1-8: new full-speed USB device number 21 using xhci_hcd
Mar 04 00:01:11 book kernel: PM: suspend exit
Mar 04 00:01:11 book systemd-sleep[47492]: System returned from sleep state.
Mar 04 00:01:11 book kernel: Bluetooth: hci0: Bootloader revision 0.0 build 26 week 38 2015
Mar 04 00:01:11 book kernel: Bluetooth: hci0: Device revision is 16
Mar 04 00:01:11 book kernel: Bluetooth: hci0: Secure boot is enabled
Mar 04 00:01:11 book kernel: Bluetooth: hci0: OTP lock is enabled
Mar 04 00:01:11 book kernel: Bluetooth: hci0: API lock is enabled
Mar 04 00:01:11 book kernel: Bluetooth: hci0: Debug lock is disabled
Mar 04 00:01:11 book kernel: Bluetooth: hci0: Minimum firmware build 1 week 10 2014
Mar 04 00:01:11 book systemd[1]: systemd-suspend.service: Deactivated successfully.
Mar 04 00:01:11 book kernel: Bluetooth: hci0: Found device firmware: intel/ibt-12-16.sfi
Mar 04 00:01:11 book systemd[1]: Finished System Suspend.
Mar 04 00:01:11 book systemd[1]: Stopped target Sleep.
Mar 04 00:01:11 book systemd[1]: Reached target Suspend.
Mar 04 00:01:11 book systemd[1]: Stopped target Suspend.
Mar 04 00:01:11 book systemd-logind[392]: Operation 'sleep' finished.
Mar 04 00:01:11 book systemd-networkd[320]: profile: Unmanaging interface.
Mar 04 00:01:11 book systemd-networkd[320]: wlan0: Reconfiguring with /etc/systemd/network/25-wireless.network.
Mar 04 00:01:11 book systemd-networkd[320]: wlan0: DHCP lease lost
Mar 04 00:01:11 book dbus-daemon[388]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.1>
Mar 04 00:01:11 book systemd-networkd[320]: wlan0: DHCPv6 lease lost
Mar 04 00:01:11 book systemd[1]: Starting Hostname Service...
Mar 04 00:01:11 book systemd-networkd[320]: enp0s31f6: Unmanaging interface.
Mar 04 00:01:11 book systemd-networkd[320]: lo: Unmanaging interface.
Mar 04 00:01:11 book kernel: usb 1-8: New USB device found, idVendor=138a, idProduct=003f, bcdDevice= 1.04
Mar 04 00:01:11 book kernel: usb 1-8: New USB device strings: Mfr=0, Product=0, SerialNumber=1
Mar 04 00:01:11 book kernel: usb 1-8: SerialNumber: 0030f20292a1
Mar 04 00:01:11 book systemd[1]: shadow.service: Deactivated successfully.
Mar 04 00:01:11 book dbus-daemon[388]: [system] Successfully activated service 'org.freedesktop.hostname1'
Mar 04 00:01:11 book systemd[1]: Started Hostname Service.
Mar 04 00:01:11 book systemd-hostnamed[47568]: Hostname set to <book> (static)
Mar 04 00:01:11 book kernel: wlan0: authenticate with XX:XX:XX:XX:XX:XX
Mar 04 00:01:11 book kernel: wlan0: 80 MHz not supported, disabling VHT
Mar 04 00:01:11 book kernel: wlan0: send auth to XX:XX:XX:XX:XX:XX (try 1/3)
Mar 04 00:01:11 book kernel: wlan0: authenticated
Mar 04 00:01:11 book kernel: wlan0: associate with XX:XX:XX:XX:XX:XX (try 1/3)
Mar 04 00:01:11 book kernel: wlan0: RX AssocResp from XX:XX:XX:XX:XX:XX (capab=0x431 status=0 aid=8)
Mar 04 00:01:11 book systemd-networkd[320]: wlan0: Connected WiFi access point: AP (XX:XX:XX:XX:XX:XX)
Mar 04 00:01:11 book kernel: wlan0: associated
Mar 04 00:01:11 book systemd-networkd[320]: wlan0: Gained carrier
Mar 04 00:01:11 book systemd-timesyncd[384]: Network configuration changed, trying to establish connection.
Mar 04 00:01:11 book systemd-networkd[320]: wlan0: DHCPv4 address 192.168.43.244/24, gateway 192.168.43.1 acquired from 192.168.43.1
Mar 04 00:01:11 book systemd-timesyncd[384]: Network configuration changed, trying to establish connection.
Mar 04 00:01:11 book systemd-timesyncd[384]: Network configuration changed, trying to establish connection.
Mar 04 00:01:11 book systemd-homed[397]: user: changing state active → authenticating-for-acquire
Mar 04 00:01:11 book systemd-homework[47608]: None of the supplied plaintext passwords unlock the user record's hashed passwords or recovery keys.
Mar 04 00:01:11 book systemd-homed[397]: Authentication failed: Required key not available
Mar 04 00:01:11 book systemd-homed[397]: user: changing state authenticating-for-acquire → active
Mar 04 00:01:11 book kernel: psmouse serio3: synaptics: queried max coordinates: x [..5720], y [..4836]
Mar 04 00:01:12 book systemd-resolved[383]: Clock change detected. Flushing caches.
Mar 04 00:01:12 book systemd-timesyncd[384]: Contacted time server 193.40.134.137:123 (3.arch.pool.ntp.org).
Mar 04 00:01:12 book kernel: psmouse serio3: synaptics: queried min coordinates: x [1332..], y [1146..]
Mar 04 00:01:13 book systemd[811]: Stopped target Bluetooth.
Mar 04 00:01:13 book systemd[1]: Stopped target Bluetooth Support.
Mar 04 00:01:13 book systemd[1]: Started Load/Save RF Kill Switch Status.
Mar 04 00:01:13 book systemd[811]: Reached target Bluetooth.
Mar 04 00:01:13 book systemd[1]: Reached target Bluetooth Support.
Mar 04 00:01:13 book kernel: Bluetooth: hci0: Waiting for firmware download to complete
Mar 04 00:01:13 book kernel: Bluetooth: hci0: Firmware loaded in 1439472 usecs
Mar 04 00:01:13 book kernel: Bluetooth: hci0: Waiting for device to boot
Mar 04 00:01:13 book kernel: Bluetooth: hci0: Device booted in 12743 usecs
Mar 04 00:01:13 book kernel: Bluetooth: hci0: Malformed MSFT vendor event: 0x02
Mar 04 00:01:13 book kernel: Bluetooth: hci0: Found Intel DDC parameters: intel/ibt-12-16.ddc
Mar 04 00:01:13 book kernel: Bluetooth: hci0: Applying Intel DDC parameters completed
Mar 04 00:01:13 book kernel: Bluetooth: hci0: Firmware revision 0.1 build 19 week 44 2021
Mar 04 00:01:13 book kernel: Bluetooth: MGMT ver 1.22
Mar 04 00:01:13 book bluetoothd[481]: src/device.c:device_set_wake_support() Unable to set wake_support without RPA resolution
Mar 04 00:01:13 book bluetoothd[481]: src/adv_monitor.c:btd_adv_monitor_power_down() Unexpected NULL btd_adv_monitor_manager object upon power down
Mar 04 00:01:13 book pulseaudio[889]: Could not find org.bluez.BatteryProviderManager1.RegisterBatteryProvider(), is bluetoothd started with experimental features enabled (-E fl>
Mar 04 00:01:13 book bluetoothd[481]: Endpoint registered: sender=:1.33 path=/MediaEndpoint/A2DPSink/sbc
Mar 04 00:01:13 book bluetoothd[481]: Endpoint registered: sender=:1.33 path=/MediaEndpoint/A2DPSource/sbc
Mar 04 00:01:13 book bluetoothd[481]: Endpoint registered: sender=:1.33 path=/MediaEndpoint/A2DPSink/sbc_xq_453
Mar 04 00:01:13 book bluetoothd[481]: Endpoint registered: sender=:1.33 path=/MediaEndpoint/A2DPSource/sbc_xq_453
Mar 04 00:01:13 book bluetoothd[481]: Endpoint registered: sender=:1.33 path=/MediaEndpoint/A2DPSink/sbc_xq_512
Mar 04 00:01:13 book bluetoothd[481]: Endpoint registered: sender=:1.33 path=/MediaEndpoint/A2DPSource/sbc_xq_512
Mar 04 00:01:13 book bluetoothd[481]: Endpoint registered: sender=:1.33 path=/MediaEndpoint/A2DPSink/sbc_xq_552
Mar 04 00:01:13 book bluetoothd[481]: Endpoint registered: sender=:1.33 path=/MediaEndpoint/A2DPSource/sbc_xq_552
Mar 04 00:01:13 book dbus-daemon[388]: [system] Activating via systemd: service name='org.blueman.Mechanism' unit='blueman-mechanism.service' requested by ':1.53' (uid=60139 pid>
Mar 04 00:01:13 book systemd[1]: Starting Bluetooth management mechanism...
Mar 04 00:01:14 book dbus-daemon[388]: [system] Successfully activated service 'org.blueman.Mechanism'
Mar 04 00:01:14 book systemd[1]: Started Bluetooth management mechanism.
Mar 04 00:01:18 book systemd-homed[397]: user: changing state active → authenticating-for-acquire
Mar 04 00:01:18 book systemd-homework[47627]: Provided password unlocks user record.
Mar 04 00:01:18 book systemd[1]: systemd-rfkill.service: Deactivated successfully.
Mar 04 00:01:19 book systemd-homework[47627]: Discovered used LUKS device /dev/mapper/home-user, and validated password.
Mar 04 00:01:19 book systemd-homework[47627]: Successfully re-activated LUKS device.
Mar 04 00:01:19 book systemd-homework[47627]: Provided password unlocks user record.
Mar 04 00:01:19 book systemd-homework[47627]: Discovered used loopback device /dev/loop0.
Mar 04 00:01:19 book systemd-homework[47627]: Read embedded .identity file.
Mar 04 00:01:19 book systemd-homework[47627]: Provided password unlocks user record.
Mar 04 00:01:19 book systemd-homework[47627]: Reconciling user identities completed (host and header version were identical).
Mar 04 00:01:19 book systemd-homework[47627]: Reconciling embedded user identity completed (host and embedded version were identical).
Mar 04 00:01:19 book systemd-homework[47627]: Everything completed.
Mar 04 00:01:19 book systemd-homed[397]: user: changing state authenticating-for-acquire → active
Mar 04 00:01:19 book xfce4-screensaver-dialog[47572]: pam_systemd_home(xfce4-screensaver:auth): Home for user user successfully acquired.
Mar 04 00:01:19 book xfce4-screensaver-dialog[47572]: gkr-pam: unlocked login keyring
Mar 04 00:01:19 book xfce4-screensaver-dialog[47572]: pam_warn(xfce4-screensaver:account): function=[pam_sm_acct_mgmt] flags=0 service=[xfce4-screensaver] terminal=[:0.0] user=[>
andruska commented 1 year ago

At first glance, the difference between 252 and 253 system logs is that 253 shows:

  Mar 04 00:01:11 book systemd-networkd[320]: profile: Unmanaging interface.  ← wireguard profile
  Mar 04 00:01:11 book systemd-networkd[320]: enp0s31f6: Unmanaging interface.
  Mar 04 00:01:11 book systemd-networkd[320]: lo: Unmanaging interface.
yuwata commented 1 year ago

The log and your comment in the above suggest that you do not use networkd to manage the WireGuard interface, that is, you have no .network or .netdev file for the WireGuard interface. Right? (If so, I guess this is not a bug in networkd, but you also said downgrading systemd to v252 fixes the issue. hmm...)

Could you enable to generate debugging logs of networkd by creating the following drop-in:

# /etc/systemd/system/systemd-networkd.service.d/override.conf
[Service]
Environment=SYSTEMD_LOG_LEVEL=debug

then, please provide the generated logs.

andruska commented 1 year ago

you also said downgrading systemd to v252 fixes the issue. hmm...

Thats was the reason, I reported this to systemd. At first I also thought that the problem was something else. But systemd downgrade solved this problem.

you do not use networkd to manage the WireGuard interface, that is, you have no .network or .netdev file for the WireGuard interface. Right?

Yes, this is intentional to separate handling of wireguard from systemd-networkd. This allows me to easily toggle the wireguard on and off.

andruska commented 1 year ago

Systemd-networkd 252 and 253 debug logs from boot and sleep

yuwata commented 1 year ago

Still not sure why it does not work, but should be caused by a39a9ac8065c29330207838b70fe388bde2bc254...

yuwata commented 1 year ago

Ah, maybe this one.

Mar 04 04:08:57 Elitebook systemd-networkd[328]: Removing foreign routing policy rule (configured,marked): priority: 32764, 0.0.0.0/0 -> 0.0.0.0/0, iif: n/a, oif: n/a, table: main(25>
Mar 04 04:08:57 Elitebook systemd-networkd[328]: Removing foreign routing policy rule (configured,marked): priority: 32765, 0.0.0.0/0 -> 0.0.0.0/0, iif: n/a, oif: n/a, table: 51820
Mar 04 04:08:57 Elitebook systemd-networkd[328]: Removing foreign routing policy rule (configured,marked): priority: 32765, ::/0 -> ::/0, iif: n/a, oif: n/a, table: 51820
Mar 04 04:08:57 Elitebook systemd-networkd[328]: Removing foreign routing policy rule (configured,marked): priority: 32764, ::/0 -> ::/0, iif: n/a, oif: n/a, table: main(254)

I guess, wg service creates routing policy rules, and networkd removes them on after sleep. That should also happen when simply calling networkctl reconfigure UNMANAGED_INTERFACE. Unfortunately, this cannot be fixed (but see the last sentence), as routing policy rules are kind of global setting, and we cannot support multiple services manage it simultaneously.

So, please use ManageForeignRoutingPolicyRules=no in /etc/systemd/networkd.conf.

yuwata commented 1 year ago

Let's close this, at least tentatively, as there is nothing we can do.

@andruska Feel free to request to reopen this if ManageForeignRoutingPolicyRules=no does not work for you.

andruska commented 1 year ago

Works, thanks !

xkhroshkax commented 2 months ago

Let's close this, at least tentatively, as there is nothing we can do.

@andruska Feel free to request to reopen this if ManageForeignRoutingPolicyRules=no does not work for you.

Hello. I have a similar problem and I edited the networkd.conf file, but it didn't help. After waking up from sleep mode, I still have to reconnect the VPN. Are there any other tips for fixing this?