Asus Vivobook 16 running Kubuntu 26.04 LTS Wifi networks don't show up after suspend

I just finished rebooting to report back that this did not work either :sob:
I shall try the github script next :saluting_face:

CAUTION!!! They instruct to put that script in /usr/lib/systemd/system-sleep/, where it doesn’t belong, because that’s package manager (APT) territory. It SHOULD be placed somewhere in /etc; I am currently searching, where exactly.

2 Likes

OK, so I think it should go in /etc/pm/sleep.d, because that’s where I have others, that look to do similar things. Mind you, I am using Ubuntu 24.04, and there is a slight chance that some things have changed. Sadly, I couldn’t find official documentation on this.

1 Like

While you’re at it, make it also less ugly:

#!/bin/sh
case “$1” in
    pre)
      modprobe -rv rtw89_8851be
    ;;
    post)
      modprobe -v rtw89_8851be
    ;;
esac

I’mma be honest… this script thingy is a little beyond my current linux understanding. Should I do every single step on the github page because that seems…extensive? :laughing:

I found the section just for “Problem with recovery after sleep or hibernation”. If I’m understanding correctly I should change sudo cp suspend_rtw89 /usr/lib/systemd/system-sleep/ to sudo cp suspend_rtw89 /etc/pm/sleep.d? Then put the

#!/bin/sh
if [ "${1}" == "pre" ]; then
  modprobe -rv rtw_8852ae
elif [ "${1}" == "post" ]; then
  modprobe -v rtw_8852ae
fi

inside? Sorry if that’s very wrong :sweat_smile: I am still linux bebe.

Use this:

sudo nano /etc/pm/sleep.d/suspend_rtw89

Now copy/paste my script above and hit Ctrl-X (and confirm in nano to write the file)

After this you run:

sudo chmod +x /etc/pm/sleep.d/suspend_rtw89

To make the script executable…

That should be all you need

1 Like

Almost, you still need to replace rtw_8852ae with the proper module name. But you can make it “parametric”; you just need to name it correctly, and the script reacts to that name:

#!/bin/sh

# poor hacker's "multicall"
module=$(basename "$0")

case "$1" in
	pre)
		modprobe -rv "$module"
		;;
	post)
		modprobe -v "$module"
		;;
esac

Then you just need to name that script exactly like the module, i.e. rtw89_pci. And you can reuse it for any module; just change the name of the script file. Usually one puts a template script somewhere and puts a symbolic link in place to get the correct name:

  • put the script under the name /etc/pm/reload_module
  • put a symlink in /etc/pm/sleep.d
cd /etc/pm/sleep.d
sudo ln -s ../reload_module rtw89_pci
sudo chmod +x ../reload_module
1 Like

If you re-write the script you should really not adopt its bashisms or use the correct interpreter in the hashbang line (it might currently work as is but only because our POSIX shell (/bin/sh) is a bit lax when it comes to enforcing proper POSIX)

(There was a reason why I took the effort to re-write it in proper POSIX :wink: )

1 Like

Thanks for pointing that out. I’ve realized my mistake and fixed it. :innocent:

You are absolutely right about bashisms, and usually I try to write POSIX scripts.

1 Like

Double equal sign, weird quoting of variables… both are rather bashisms (you could use /bin/bash instead if you do not mind the extra 5Mb ram that uses and the slowdown it brings along though)

PS: I’m also not a fan of using if/then/fi if a case statement can do it (if/then conditions are significantly slower than case)

1 Like

I think that should do it. Mind taking another look, @ogra?

1 Like

Looks fine :smiley:

1 Like

Okay, I did sudo nano /etc/pm/sleep.d/suspend_rtw89 and put

cd /etc/pm/sleep.d
sudo ln -s ../reload_module rtw89_pci
sudo chmod +x ../reload_module

inside.

Then I did sudo nano /etc/pm/reload_module and put

#!/bin/sh

# poor hacker's "multicall"
module=$(basename "$0")

case "$1" in
	pre)
		modprobe -rv "$module"
		;;
	post)
		modprobe -v "$module"
		;;
esac

inside.

Then I did sudo chmod +x /etc/pm/sleep.d/suspend_rtw89.

I think I’ve followed instructions correctly and can give it a try?

No, sorry, that was meant to convey the procedure. Please remove that file:

sudo rm /etc/pm/sleep.d/suspend_rtw89

That is correct. Then you run the following commands:

cd /etc/pm/sleep.d
sudo ln -s ../reload_module rtw89_pci
sudo chmod +x ../reload_module

You should be able to just copy/paste them in the terminal.

I have removed it! :saluting_face:

I did this. I should be good to try putting it into suspend now?

1 Like

OK, I just did some dummy test, and it looks like /etc/pm is some legacy leftover. It saddens me to say that we may need to do the naughty thing and put that symlink in /usr/lib/systemd/system-sleep:

sudo ln -s /etc/pm/reload_module /usr/lib/systemd/system-sleep/rtw89_pci

That’s the least ugly way I can come up with, right now. Usually one should not mess in that hierarchy, because anything in there is fair game for the package manager to overwrite/remove. So if something breaks after a software upgrade, that’s why, usually. In this case, though, you might be safe.

I will explore some more; there must be some other location, where to put it, that doesn’t violate Debian/Ubuntu policy.

Note that scripts or binaries dropped in /usr/lib/systemd/system-sleep/ are intended for local use only and should be considered hacks. If applications want to react to system suspend/hibernation and resume, they should rather use the Inhibitor Locks.

systemd-sleep(8)

Looks like some exploring of inhibitor locks is in order…

1 Like

I am deeply saddened to say it did not work :sob:

Sorry for this late reply; wasn’t able to post over the weekend due to some Discourse issue.

What exactly have you tried? The script in /etc/pm/sleep.d or in /usr/lib/systemd/system-sleep? If it’s the former, that’s on me, I guess. The latter location seems to be the correct one.

I also was in the process of writing a message when that Discourse issue started, so here is a better solution, using a systemd service:

  1. Undo all prior changes
  2. Create a systemd service template:
sudo nano /etc/systemd/system/reload_module@.service

Put this in it:

# /etc/systemd/system/reload_module@.service
[Unit]
Description=unload/load %I
StopWhenUnneeded=yes

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=modprobe -rv %I
ExecStop=modprobe -v %I

[Install]
WantedBy=sleep.target

Save the file (CtrlO) and exit (CtrlX).

  1. Reload the service manager:
sudo systemctl daemon-reload
  1. Enable the instance for the module:
sudo systemctl enable reload_module@rtw89_8851be

should output this:

Created symlink /etc/systemd/system/sleep.target.wants/reload_module@rtw89_8851be.service → /etc/systemd/system/reload_module@.service.
  1. Test it:
sudo systemctl suspend
systemctl status reload_module@rtw89_8851be

should output something like this:

○ reload_module@snd_seq_dummy.service - unload/load snd_seq_dummy
     Loaded: loaded (/etc/systemd/system/reload_module@.service; enabled; preset: enabled)
     Active: inactive (dead) since Tue 2026-05-12 12:23:55 CEST; 12min ago
   Duration: 10.791s
    Process: 987107 ExecStart=modprobe -rv snd_seq_dummy (code=exited, status=0/SUCCESS)
    Process: 987541 ExecStop=modprobe -v snd_seq_dummy (code=exited, status=0/SUCCESS)
   Main PID: 987107 (code=exited, status=0/SUCCESS)
        CPU: 12ms

May 12 12:23:44 Roadrunner systemd[1]: Starting reload_module@snd_seq_dummy.service - unload/load snd_seq_dummy...
May 12 12:23:44 Roadrunner modprobe[987107]: rmmod snd_seq_dummy
May 12 12:23:44 Roadrunner systemd[1]: Finished reload_module@snd_seq_dummy.service - unload/load snd_seq_dummy.
May 12 12:23:55 Roadrunner systemd[1]: Stopping reload_module@snd_seq_dummy.service - unload/load snd_seq_dummy...
May 12 12:23:55 Roadrunner modprobe[987541]: insmod /lib/modules/6.17.0-23-generic/kernel/sound/core/seq/snd-seq-dummy.ko.zst
May 12 12:23:55 Roadrunner systemd[1]: reload_module@snd_seq_dummy.service: Deactivated successfully.
May 12 12:23:55 Roadrunner systemd[1]: Stopped reload_module@snd_seq_dummy.service - unload/load snd_seq_dummy.

(I used a different module for my testing)

Credit where credit is due: this solution was inspired by this answer on Stack Exchange.

1 Like

I tried it in the first option. I’ll try this new way now! :saluting_face:

It didn’t work :sob: . The output had a lot of “failure” in it:

× reload_module@rtw89_pci.service - unload/load rtw89_pci
Loaded: loaded (/etc/systemd/system/reload_module@.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Thu 2026-05-14 12:19:31 JST; 16s
agoInvocation: e9331325e6d648e39fd419e63f94b804
Process: 6980 ExecStart=modprobe -rv rtw89_pci (code=exited, status=1/FAILURE)
Main PID: 6980 (code=exited, status=1/FAILURE)
Mem peak: 1.7MCPU: 4ms

5月 14 12:19:31 jamie-asusvivobook16 systemd[1]: Starting reload_module@rtw89_pci.service - unload/load rtw8>
5月 14 12:19:31 jamie-asusvivobook16 modprobe[6980]: modprobe: FATAL: Module rtw89_pci is in use.
5月 14 12:19:31 jamie-asusvivobook16 systemd[1]: reload_module@rtw89_pci.service: Main process exited, code=>
5月 14 12:19:31 jamie-asusvivobook16 systemd[1]: reload_module@rtw89_pci.service: Failed with result 'exit-c>
5月 14 12:19:31 jamie-asusvivobook16 systemd[1]: Failed to start reload_module@rtw89_pci.service - unload/lo>