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

zram_init: warning: failed to set zram0 backing_dev #18

Closed Yamakuzure closed 5 years ago

Yamakuzure commented 5 years ago

Hi,

I'd like to set one of my two regular swap partitions as backing_dev for my zram swap.

The error in the script is: /sbin/zram-init: Line 13: printf: Write error: The device or resource is busy

I thought this would mean that the disksize is already set, but if I raise the size so it doesn't fit, the error about that comes after the "busy" warning, so the order is definitely correct.

I tried with turned on and off swap partition. Then I found out, by doing things manually, that the error comes from writing into /sys/block/zram0/backing_dev -- No matter what I try to write in there, it doesn't work.

Currently I am pretty sure that I am doing something wrong. What could that be?

Kernel is gentoo-5.0.5, zstd is enabled and built in.

Yamakuzure commented 5 years ago

sigh ...

I solved it. Although I had enabled ZSTD in the kernel, I hadn't rebooted using the new kernel.

So for anybody stumbling over this:

  1. ZSTD must be enabled in the kernel and that kernel must be booted.
  2. The backing_dev must not be used. A swapoff is not enough, you need a fresh boot.