Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: Inconsistent "swap exited 128" error (Read 757 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

Inconsistent "swap exited 128" error

I sometimes (but not always) get:

Code: [Select]
swapon: cannot open /dev/zram0: No such file or directory
[don't remember]: swap exited 128

whenever I boot my system. swapon doesn't report /dev/zram0 being enabled. After boot is finished, running swapon -a enables /dev/zram0 without complaints.

I suspect this might be related to the fact that I enable ZRAM using a modules-load + udev rule, but I don't know how to confirm this (e. g. checking if running the modules service after swap causes the problem).

EDIT: using zramen could be an option, but the package doesn't seem to come with a /etc/s6/config/zram.conf.

Re: Inconsistent "swap exited 128" error

Reply #1
Perhaps the swap oneshot needs an explicit dependency on udevadm?

Re: Inconsistent "swap exited 128" error

Reply #2
Tried adding udevadm to /etc/s6/sv/swap/dependencies and running /usr/share/libalpm/scripts/s6-rc-db-update-hook, but error still appears.

I'll try doing the same for modules and report.

Re: Inconsistent "swap exited 128" error

Reply #3
Making swap depend on either modules by itself or modules and udevadm fixes "cannot open /dev/zram0", but swap still exits 128 due to "/dev/zram0: read swap header failed" sometimes. swapon -a still works after boot is finished, so I'm guessing swap runs before udev applies my "run mkswap" rule.

I've seen reports from other s6 users that adding an udevadm dependency is unreliable (probably due to lack of readiness notification), so I guess I'll have to live with that. Or write my own zramen with blackjack and execline.

I don't remember this happening back when I used 66, though I can't tell whether this is luck, or if 66 is actually doing something different.

Re: Inconsistent "swap exited 128" error

Reply #4
Actually, try resetting everything to the default (AKA reinstall s6-scripts) and then try this:

/etc/s6/sv/mount-filesystems/dependencies:
Code: [Select]
modules
mount-tmpfs
udevadm

/etc/s6/sv/modules/dependencies:
Code: [Select]
mount-procfs
udevadm

Compile a new database with the hook and give that whirl.

Re: Inconsistent "swap exited 128" error

Reply #5
That seemed to do the trick. Thank you!

Re: Inconsistent "swap exited 128" error

Reply #6
Cool, now I just need to remember why modules currently has remount-root in the dependencies. I can't remember if modprobe actually requires write permissions or not. Hopefully not otherwise that will throw a wrench in things. I'll test that in a bit.

Re: Inconsistent "swap exited 128" error

Reply #7
sudo bwrap --ro-bind / / modprobe loop (for example) works here, so I'm guessing no. (also the fact that my system boots and can load zram).

However, I don't know if the fact that I'm "simulating" a readonly filesystem using a mount namespace will change something.

Re: Inconsistent "swap exited 128" error

Reply #8
Seems to be fine so I'll go ahead and push the changes.