[Bug 1270913] Re: zram-config doesn't start if zram is built-in, not module

Lenin 1270913 at bugs.launchpad.net
Fri Oct 19 11:15:12 UTC 2018


Maybe one of the zram-config maintainers want to update

end-zram-swapping 
#!/bin/sh

if DEVICES=$(grep zram /proc/swaps | awk '{print $1}'); then
  for i in $DEVICES; do
    swapoff $i
  done
fi
lsmod |grep zram >/dev/null && rmmod zram


init-zram-swapping
#!/bin/sh

# load dependency modules
if grep ZRAM=m /boot/config-$(uname -r)
  NRDEVICES=$(grep -c ^processor /proc/cpuinfo | sed 's/^0$/1/')
  if modinfo zram | grep -q ' zram_num_devices:' 2>/dev/null; then
    MODPROBE_ARGS="zram_num_devices=${NRDEVICES}"
  elif modinfo zram | grep -q ' num_devices:' 2>/dev/null; then
    MODPROBE_ARGS="num_devices=${NRDEVICES}"
  else
    exit 1
  fi
  modprobe zram $MODPROBE_ARGS
fi

# Calculate memory to use for zram (1/2 of ram)
totalmem=`LC_ALL=C free | grep -e "^Mem:" | sed -e 's/^Mem: *//' -e 's/  *.*//'`
mem=$(((totalmem / 2 / ${NRDEVICES}) * 1024))

# initialize the devices
for i in $(seq ${NRDEVICES}); do
  DEVNUMBER=$((i - 1))
  echo $mem > /sys/block/zram${DEVNUMBER}/disksize
  mkswap /dev/zram${DEVNUMBER}
  swapon -p 5 /dev/zram${DEVNUMBER}
done

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to zram-config in Ubuntu.
https://bugs.launchpad.net/bugs/1270913

Title:
  zram-config doesn't start if zram is built-in, not module

Status in zram-config package in Ubuntu:
  Confirmed

Bug description:
  zram-config works only if zram is compiled as module, if built-in then

  modinfo zram | grep -q ' zram_num_devices:' 2>/dev/null;

  and

  modinfo zram | grep -q ' num_devices:' 2>/dev/null;

  from file /etc/init/zram-config.conf returns false.

  Looks like check should be another, proper check for zram
  availability.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/zram-config/+bug/1270913/+subscriptions



More information about the foundations-bugs mailing list