F5F Stay Refreshed Software Operating Systems target for systemd wake-up process

target for systemd wake-up process

target for systemd wake-up process

K
kcristan
Senior Member
514
02-25-2026, 04:12 PM
#1
Systemd currently lacks a wakeup.target feature. To automate tasks when the system wakes up from hibernation or suspend, you’d need to configure it manually. Regarding your second point, if /sys/power/image_size retains your settings through unit files, you wouldn’t have to worry about making those files dependent on wakeup mechanisms.
K
kcristan
02-25-2026, 04:12 PM #1

Systemd currently lacks a wakeup.target feature. To automate tasks when the system wakes up from hibernation or suspend, you’d need to configure it manually. Regarding your second point, if /sys/power/image_size retains your settings through unit files, you wouldn’t have to worry about making those files dependent on wakeup mechanisms.

P
Pieftw247
Member
201
02-25-2026, 06:06 PM
#2
I discovered a sample unit file that matches your requirements...
P
Pieftw247
02-25-2026, 06:06 PM #2

I discovered a sample unit file that matches your requirements...

D
Devies
Member
185
02-25-2026, 07:13 PM
#3
I tested the file and manually launched the service: [Unit] Description=set /sys/power/image_size to zero [Service] User=root Type=oneshot RemainAfterExit=no ExecStart=echo 0 > /sys/power/image_size [Install] WantedBy=multi-user.target The change wasn't applied. It seems systemd might not support this action after shutdown. Maybe a sleep.target is needed, though I couldn't locate details about it. Refer to the link provided: https://github.com/systemd/systemd/issues/6364
D
Devies
02-25-2026, 07:13 PM #3

I tested the file and manually launched the service: [Unit] Description=set /sys/power/image_size to zero [Service] User=root Type=oneshot RemainAfterExit=no ExecStart=echo 0 > /sys/power/image_size [Install] WantedBy=multi-user.target The change wasn't applied. It seems systemd might not support this action after shutdown. Maybe a sleep.target is needed, though I couldn't locate details about it. Refer to the link provided: https://github.com/systemd/systemd/issues/6364

B
bannana45
Junior Member
16
02-25-2026, 11:20 PM
#4
I thought it meant the computer restarts right after the hibernate command runs. While it does save RAM data to the hard drive during hibernation, I’m not confident that’s exactly how it works.
B
bannana45
02-25-2026, 11:20 PM #4

I thought it meant the computer restarts right after the hibernate command runs. While it does save RAM data to the hard drive during hibernation, I’m not confident that’s exactly how it works.

M
mrdikkieman
Junior Member
26
02-26-2026, 03:32 AM
#5
Hmm, the situation varies. I'm attempting to restart today because the hibernation feature stopped functioning after I deleted a disk used for storing RAM data. It's now working again, allowing me to conserve energy. While troubleshooting, I discovered that hibernated RAM needs more than just basic setup—it also requires Dracut to load the resume module. Without it, the RAM won't be loaded properly. Setting image_size to 0 helps reduce the size of the RAM image written to disk, speeding up wake-up and ensuring the swap partition fits within RAM. I'm unsure what these targets actually do, but a wakeup.target might be more appropriate. Since my unit file can't adjust image_size, it won't help much. I think I found a solution here: https://bbs.archlinux.org/viewtopic.php?id=195364. I'll check if it works on the next reboot.
M
mrdikkieman
02-26-2026, 03:32 AM #5

Hmm, the situation varies. I'm attempting to restart today because the hibernation feature stopped functioning after I deleted a disk used for storing RAM data. It's now working again, allowing me to conserve energy. While troubleshooting, I discovered that hibernated RAM needs more than just basic setup—it also requires Dracut to load the resume module. Without it, the RAM won't be loaded properly. Setting image_size to 0 helps reduce the size of the RAM image written to disk, speeding up wake-up and ensuring the swap partition fits within RAM. I'm unsure what these targets actually do, but a wakeup.target might be more appropriate. Since my unit file can't adjust image_size, it won't help much. I think I found a solution here: https://bbs.archlinux.org/viewtopic.php?id=195364. I'll check if it works on the next reboot.

X
xAdriLCT
Senior Member
702
02-26-2026, 07:44 AM
#6
Adjust system settings to manage power management. Set the image size target to zero using the appropriate command. Ensure hibernate.target is configured accordingly.
X
xAdriLCT
02-26-2026, 07:44 AM #6

Adjust system settings to manage power management. Set the image size target to zero using the appropriate command. Ensure hibernate.target is configured accordingly.

A
addecr7
Junior Member
12
02-26-2026, 11:49 AM
#7
The unit file functions correctly when started manually, confirming its intended behavior. The script sets the image size to zero by redirecting output from a shell command. Using sh or bash is necessary because it executes the command properly, ensuring the file is created as expected. After hibernation, the image_size returned zero, which may be due to the sleep duration or system state. I’ll address the hibernation fix in a separate update.
A
addecr7
02-26-2026, 11:49 AM #7

The unit file functions correctly when started manually, confirming its intended behavior. The script sets the image size to zero by redirecting output from a shell command. Using sh or bash is necessary because it executes the command properly, ensuring the file is created as expected. After hibernation, the image_size returned zero, which may be due to the sleep duration or system state. I’ll address the hibernation fix in a separate update.

U
Udlu
Member
193
02-26-2026, 03:56 PM
#8
The keyword specifies dependencies for service startup. After installing, configure the file to launch with Hibernate's target. Running without the After clause causes it to start immediately with the resume target. Setting WantedBy=multi-user.target ensures it activates at the shell level, typically during startup. Ignoring the After directive means it won't wait for the resume process.
U
Udlu
02-26-2026, 03:56 PM #8

The keyword specifies dependencies for service startup. After installing, configure the file to launch with Hibernate's target. Running without the After clause causes it to start immediately with the resume target. Setting WantedBy=multi-user.target ensures it activates at the shell level, typically during startup. Ignoring the After directive means it won't wait for the resume process.

Z
zLeoZiin
Senior Member
503
02-26-2026, 08:03 PM
#9
I’d prefer it to execute before hibernation so the disk-written image stays as compact as possible. Once it’s done afterward, it’ll maintain that size, though it won’t be essential if it runs each time before hibernating. Using a shell was a surprise—I hadn’t considered that. If I have to run this, I’ll likely write a C program for the writing process. It could be more efficient and less resource-heavy.
Z
zLeoZiin
02-26-2026, 08:03 PM #9

I’d prefer it to execute before hibernation so the disk-written image stays as compact as possible. Once it’s done afterward, it’ll maintain that size, though it won’t be essential if it runs each time before hibernating. Using a shell was a surprise—I hadn’t considered that. If I have to run this, I’ll likely write a C program for the writing process. It could be more efficient and less resource-heavy.