foundObjects / zram-swap

A simple zram swap service for modern systemd Linux
MIT License
309 stars 44 forks source link

Service occasionally fails to start #9

Closed roalyr closed 2 years ago

roalyr commented 2 years ago

Lenovo-V14-ADA 5.11.0-40-generic #44-Ubuntu SMP Wed Oct 20 16:16:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux Xubuntu 21.04

Every now and then service fails to start when computer boots up. I have started noticing it around this month only. Roughly 1 in 5-10 boots, without any apparent pattern.

-- Boot 26befe3957714f72a5dd0e20bca542f8 --
гру 01 14:29:05 roalyr-Lenovo-V14-ADA systemd[1]: Starting zram swap service...
гру 01 14:29:05 roalyr-Lenovo-V14-ADA zram-swap.sh[646]: zramctl: /dev/zram0: failed to reset: Device or resource busy
гру 01 14:29:05 roalyr-Lenovo-V14-ADA zram-swap.sh[703]: zramctl: /dev/zram0: failed to reset: Device or resource busy
гру 01 14:29:05 roalyr-Lenovo-V14-ADA zram-swap.sh[761]: zramctl: /dev/zram0: failed to reset: Device or resource busy
гру 01 14:29:05 roalyr-Lenovo-V14-ADA zram-swap.sh[589]: Err init: Failed to initialize zram device
гру 01 14:29:05 roalyr-Lenovo-V14-ADA systemd[1]: zram-swap.service: Main process exited, code=exited, status=1/FAILURE
гру 01 14:29:05 roalyr-Lenovo-V14-ADA systemd[1]: zram-swap.service: Failed with result 'exit-code'.
гру 01 14:29:05 roalyr-Lenovo-V14-ADA systemd[1]: Failed to start zram swap service.
thanhminhmr commented 2 years ago

Can confirm this bug on Ubuntu 20.04.3 LTS. The log seem to be the same as above.

roalyr commented 2 years ago

Someone on discord commented that this may be related to swap not being properly stopped on shutdow. I am not sure. Maybe it has something to do with poor timing during boot since the issue is appearing at random?

thanhminhmr commented 2 years ago

I just restart a bunch of times to see if it failed, and it failed everytime. So maybe on Ubuntu 20.04.3 LTS it is a different problem? Anyway, I make a wild guess that maybe the zram module somehow not loaded on time (?), so I added the zram module to initramfs module list, and now it seem to successfully create the swap. Note that I have no idea what I'm doing, so please do not consider this as a solution without some (or a lot) more investigation.

britishbadger commented 2 years ago

I've forked this repo and found that https://github.com/britishbadger/zram-swap/commit/3adea21997fc0acc40a807f868576ff6a58665ec the following options seem to result in everything starting correctly from boot.

roalyr commented 2 years ago

Thank you, will test ASAP.

roalyr commented 2 years ago

I've forked this repo and found that britishbadger@3adea21 the following options seem to result in everything starting correctly from boot.

@britishbadger it fails to start still, but the frequency is much lower now, around 1 in 10-15 boots.

-- Boot 730c7bfada7148d69467d7375ca7ec19 --
січ 01 13:19:41 roalyr-Lenovo-V14-ADA systemd[1]: Starting zram swap service...
січ 01 13:19:42 roalyr-Lenovo-V14-ADA zram-swap.sh[672]: zramctl: /dev/zram0: failed to reset: Device or resource busy
січ 01 13:19:42 roalyr-Lenovo-V14-ADA zram-swap.sh[748]: zramctl: /dev/zram0: failed to reset: Device or resource busy
січ 01 13:19:42 roalyr-Lenovo-V14-ADA zram-swap.sh[813]: zramctl: /dev/zram0: failed to reset: Device or resource busy
січ 01 13:19:42 roalyr-Lenovo-V14-ADA zram-swap.sh[615]: Err init: Failed to initialize zram device
січ 01 13:19:42 roalyr-Lenovo-V14-ADA systemd[1]: zram-swap.service: Main process exited, code=exited, status=1/FAILURE
січ 01 13:19:42 roalyr-Lenovo-V14-ADA systemd[1]: zram-swap.service: Failed with result 'exit-code'.
січ 01 13:19:42 roalyr-Lenovo-V14-ADA systemd[1]: Failed to start zram swap service.
roalyr commented 2 years ago

So far no more, it seems.

roalyr commented 2 years ago

No more failures since last report.