Hyprland session wifi doesn't autostart

Note: this isn’t anything officially supported.
Basically I’m running the KDE-Dr460nized edition, but I also have hyprland installed, and switch between sessions.

I tried looking it up wifi autostart, but couldn’t find anything applicable. Whenever I use hyprland, wifi doesn’t auto-connect on session start. If I set it to sleep, when I wake the computer back up, wifi also remains disconnected. On plasma I don’t have this issue.

I don’t know if it’s something wrong with my config or if it’s being on hyprland, but any help is appreciated!

System:
  Kernel: 6.9.7-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 14.1.1 clocksource: tsc
    avail: acpi_pm parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
    root=UUID=e49c1f07-1f07-4998-aa9c-4e366d5462d5 rw rootflags=subvol=@ resume_offset=2810612
    resume=UUID=e49c1f07-1f07-4998-aa9c-4e366d5462d5 rd.udev.log_priority=3
    vt.global_cursor_default=0 loglevel=3 ibt=off
  Desktop: Hyprland v: 0.41.2-19-ge894d5e9 with: waybar vt: 1 dm: SDDM Distro: Garuda
    base: Arch Linux
Machine:
  Type: Convertible System: LENOVO product: 20R5A000US v: ThinkPad L13 Yoga
    serial: <superuser required> Chassis: type: 31 serial: <superuser required>
  Mobo: LENOVO model: 20R5A000US v: SDK0J40700 WIN serial: <superuser required>
    part-nu: LENOVO_MT_20R5_BU_Think_FM_ThinkPad L13 Yoga uuid: <superuser required> UEFI: LENOVO
    v: R15ET47W (1.28 ) date: 01/12/2021
Battery:
  ID-1: BAT0 charge: 32.6 Wh (74.6%) condition: 43.7/46.0 Wh (95.0%) volts: 16.3 min: 15.4
    model: SMP 5B10W13933 type: Li-poly serial: <filter> status: not charging cycles: 402
CPU:
  Info: model: Intel Core i5-10210U bits: 64 type: MT MCP arch: Comet/Whiskey Lake note: check
    gen: core 10 level: v3 note: check built: 2018 process: Intel 14nm family: 6 model-id: 0x8E (142)
    stepping: 0xC (12) microcode: 0xFA
  Topology: cpus: 1x cores: 4 tpc: 2 threads: 8 smt: enabled cache: L1: 256 KiB
    desc: d-4x32 KiB; i-4x32 KiB L2: 1024 KiB desc: 4x256 KiB L3: 6 MiB desc: 1x6 MiB
  Speed (MHz): avg: 1004 high: 1301 min/max: 400/4200 scaling: driver: intel_pstate
    governor: powersave cores: 1: 1300 2: 1300 3: 400 4: 736 5: 400 6: 1301 7: 1300 8: 1300
    bogomips: 33599
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities: <filter>
Graphics:
  Device-1: Intel CometLake-U GT2 [UHD Graphics] vendor: Lenovo driver: i915 v: kernel
    arch: Gen-9.5 process: Intel 14nm built: 2016-20 ports: active: eDP-1 empty: DP-1, DP-2,
    HDMI-A-1, HDMI-A-2 bus-ID: 00:02.0 chip-ID: 8086:9b41 class-ID: 0300
  Device-2: IMC Networks Integrated Camera driver: uvcvideo type: USB rev: 2.0 speed: 480 Mb/s
    lanes: 1 mode: 2.0 bus-ID: 1-5:2 chip-ID: 13d3:56a6 class-ID: 0e02 serial: <filter>
  Display: wayland server: X.org v: 1.21.1.13 with: Xwayland v: 24.1.0 compositor: Hyprland
    v: 0.41.2-19-ge894d5e9 driver: X: loaded: modesetting alternate: fbdev,intel,vesa dri: iris
    gpu: i915 display-ID: 1
  Monitor-1: eDP-1 res: 1920x1080 size: N/A modes: N/A
  API: EGL v: 1.5 hw: drv: intel iris platforms: device: 0 drv: iris device: 1 drv: swrast
    surfaceless: drv: iris wayland: drv: iris x11: drv: iris inactive: gbm
  API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel mesa v: 24.1.2-arch1.1 glx-v: 1.4
    direct-render: yes renderer: Mesa Intel UHD Graphics (CML GT2) device-ID: 8086:9b41
    memory: 3.59 GiB unified: yes
  API: Vulkan v: 1.3.279 layers: 7 device: 0 type: integrated-gpu name: Intel UHD Graphics (CML
    GT2) driver: mesa intel v: 24.1.2-arch1.1 device-ID: 8086:9b41 surfaces: xcb,xlib,wayland
    device: 1 type: cpu name: llvmpipe (LLVM 17.0.6 256 bits) driver: mesa llvmpipe
    v: 24.1.2-arch1.1 (LLVM 17.0.6) device-ID: 10005:0000 surfaces: xcb,xlib,wayland
Audio:
  Device-1: Intel Comet Lake PCH-LP cAVS vendor: Lenovo driver: snd_hda_intel v: kernel
    alternate: snd_soc_skl, snd_soc_avs, snd_sof_pci_intel_cnl bus-ID: 00:1f.3 chip-ID: 8086:02c8
    class-ID: 0403
  API: ALSA v: k6.9.7-zen1-1-zen status: kernel-api tools: N/A
  Server-1: sndiod v: N/A status: off tools: aucat,midicat,sndioctl
  Server-2: PipeWire v: 1.2.0 status: active with: 1: pipewire-pulse status: active
    2: wireplumber status: active 3: pipewire-alsa type: plugin 4: pw-jack type: plugin
    tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Intel Comet Lake PCH-LP CNVi WiFi driver: iwlwifi v: kernel bus-ID: 00:14.3
    chip-ID: 8086:02f0 class-ID: 0280
  IF: wlp0s20f3 state: up mac: <filter>
  Device-2: Intel Ethernet I219-V vendor: Lenovo driver: e1000e v: kernel port: N/A
    bus-ID: 00:1f.6 chip-ID: 8086:0d4f class-ID: 0200
  IF: enp0s31f6 state: down mac: <filter>
  IF-ID-1: MABGaruda state: unknown speed: N/A duplex: N/A mac: N/A
  Info: services: NetworkManager, smbd, systemd-timesyncd, wpa_supplicant
Bluetooth:
  Device-1: Intel Bluetooth 9460/9560 Jefferson Peak (JfP) driver: btusb v: 0.8 type: USB rev: 2.0
    speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-10:5 chip-ID: 8087:0aaa class-ID: e001
  Report: btmgmt ID: hci0 rfk-id: 0 state: up address: <filter> bt-v: 5.1 lmp-v: 10 status:
    discoverable: no pairing: no class-ID: 6c0000
Drives:
  Local Storage: total: 931.51 GiB used: 398.61 GiB (42.8%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung model: SSD 970 EVO Plus 1TB size: 931.51 GiB
    block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 tech: SSD serial: <filter>
    fw-rev: 2B2QEXM7 temp: 40.9 C scheme: GPT
Partition:
  ID-1: / raw-size: 931.22 GiB size: 931.22 GiB (100.00%) used: 398.61 GiB (42.8%) fs: btrfs
    dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%) used: 584 KiB (0.2%) fs: vfat
    dev: /dev/nvme0n1p1 maj-min: 259:1
  ID-3: /home raw-size: 931.22 GiB size: 931.22 GiB (100.00%) used: 398.61 GiB (42.8%) fs: btrfs
    dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-4: /var/log raw-size: 931.22 GiB size: 931.22 GiB (100.00%) used: 398.61 GiB (42.8%)
    fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-5: /var/tmp raw-size: 931.22 GiB size: 931.22 GiB (100.00%) used: 398.61 GiB (42.8%)
    fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
  ID-1: swap-1 type: file size: 8 GiB used: 0 KiB (0.0%) priority: -2 file: /swap/file
  ID-2: swap-2 type: zram size: 7.34 GiB used: 1.06 GiB (14.4%) priority: 100 comp: zstd
    avail: lzo,lzo-rle,lz4,lz4hc,842 max-streams: 8 dev: /dev/zram0
Sensors:
  System Temperatures: cpu: 50.0 C mobo: 41.0 C
  Fan Speeds (rpm): cpu: 4062
Info:
  Memory: total: 8 GiB note: est. available: 7.34 GiB used: 3.5 GiB (47.7%)
  Processes: 276 Power: uptime: 4h 7m states: freeze,mem,disk suspend: deep avail: s2idle
    wakeups: 2 hibernate: platform avail: shutdown, reboot, suspend, test_resume image: 2.92 GiB
    services: power-profiles-daemon, thermald, upowerd Init: systemd v: 256 default: graphical
    tool: systemctl
  Packages: 1982 pm: pacman pkgs: 1969 libs: 536 tools: octopi,pacseek,paru,yay pm: flatpak
    pkgs: 13 Compilers: clang: 17.0.6 gcc: 14.1.1 Client: shell wrapper v: 5.2.26-release
    inxi: 3.3.35
Garuda (2.6.26-1):
  System install date:     2023-09-22
  Last full system update: 2024-07-05 ↻
  Is partially upgraded:   No
  Relevant software:       snapper NetworkManager dracut
  Windows dual boot:       No
  Failed units:            

Generally we don’t offer support for multi desktop setups as only advanced users should deviate from the standard Garuda install.

I would think writing a systemd startup, and a systemd suspend service to reinitiate your network connection would be what you’re looking for. There are many examples of services to initiate WiFi connections after suspending already on our forum and the web. Simply modify the relevant sections of the service to reflect your network configuration.

You will need to create one service for when you start Hyprland and another one for after you resume from sleep.

2 Likes

From your response (thanks!), looking into what is running helped me narrow it down to two things:

Sometimes systemd-networkd.service doesn’t always start from sleep, not sure entirely why, but that’s pretty easy to start again.

The main issue is me (i’m stupid as always), and I wasn’t calling kde-polkit to start with hyprland session. With that turned on though, running nmcli a I get
Error: polkit agent failed: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Passed session and the session the caller is in differs. They must be equal for now.`

So I know it’s definitely something to do with polkit and something being unhappy with that, because when I tried changing WiFi password to unencrypted available to all users, autoconnect works.

I’ll keep looking into it and see if I can figure out what’s causing this!

Be sure to disable MAC address randomization.

My best guess would be that you have conflicting network services running at the same time.

Don’t know if we are facing the same problem, but whenever my WIFI doesn’t auto start when logging in i just
systemctl restart NetworkManager,
If you find this annoying you could probably add it to a script and add it to autostart on your hyprland config. ''Not a fancy solution but just a small life hack

1 Like

hmm, well i’m quite confident it’s a polkit issue.

I’ve now narrowed it down to be something about polkit wayland and hyprland. Running pkexec thunar using either kde or xfce’s polkit gets me a Authorization required, but no authorization protocol specified

I came across this response on stackoverflow, and ran xhost + local: Now if I run something like pkexec thunar to launch thunar in root mode, it’ll work, but stuff like vivaldi browser (error: vivaldi could not unlock your key store) or reconnecting to wifi after sleep still doesn’t work.