vaeth / zram-init

A wrapper script for the zram linux kernel module with zsh and openrc support
http://www.mathematik.uni-wuerzburg.de/~vaeth/download/index.html#zram-init
79 stars 26 forks source link

Stopping the service removes zram device #9

Closed morfikov closed 7 years ago

morfikov commented 7 years ago

There's no way to restart the service on kernel 4.8.

# ls -al /dev/zram*
brw-rw---- 1 root disk 253, 0 2016-11-21 17:57:49 /dev/zram0
brw-rw---- 1 root disk 253, 1 2016-11-21 17:57:49 /dev/zram1
brw-rw---- 1 root disk 253, 2 2016-11-21 17:57:49 /dev/zram2

# swapon -s
Filename                                Type            Size    Used    Priority
/dev/zram0                              partition       524284  0       16383
/dev/dm-4                               partition       2093052 41964   -1

When I stop the zram_swap service, I get this in the log:

Nov 21 17:59:56 morfikownia systemd[1]: Stopping swap with zram...
Nov 21 17:59:56 morfikownia kernel: zram0: detected capacity change from 536870912 to 0
Nov 21 17:59:56 morfikownia kernel: zram: Removed device: zram0
Nov 21 17:59:56 morfikownia systemd[1]: Stopped swap with zram.

And as you can see the zram0 device was removed:

 # ls -al /dev/zram*
brw-rw---- 1 root disk 253, 1 2016-11-21 17:57:49 /dev/zram1
brw-rw---- 1 root disk 253, 2 2016-11-21 17:57:49 /dev/zram2

So when I start the service again, I get this:

Nov 21 18:01:04 morfikownia zram-init[91348]: zram-init: cannot find /dev/zram0
Nov 21 18:01:04 morfikownia systemd[1]: zram_swap.service: Main process exited, code=exited, status=1/FAILURE
Nov 21 18:01:04 morfikownia systemd[1]: Failed to start swap with zram.
-- Subject: Unit zram_swap.service has failed

How to restart the service now?

vaeth commented 7 years ago

This is not directly related to kernel 4.8 but more to util-linux-2.29 which added support for hot_add/hot_remove to zramctl.

The new release zram-init-6.0.0 now also adds (limited) support for this.

morfikov commented 7 years ago

Now it works just fine, thanks!