The officially official Devuan Forum!

You are not logged in.

#1 2025-05-18 15:57:46

Altoid
Member
Registered: 2017-05-07
Posts: 1,748  

[SOLVED] zramswap script won't start

Hello:

Still working on my Asus 1000HE. 8^°

I have set up zram / zramswap with this script which I found referenced here.

Just in case, I added both the shebang (#!/bin/sh) and the usual PATH= variable as I saw it was missing.
I then named it zramswap, copied it to /etc/init.d, made it executable and did update-rc.d zramswap defaults.

The problem I have is that it does not start at boot and I can't figure out why.

But I can start it from a terminal:

$ sudo zramswap start
Setting up swapspace version 1, size = 1002.6 MiB (1051303936 bytes)
no label, UUID=05decff9-d90e-4db3-ae9d-a65484a3462c
$ 
$ sudo swapon -s
Filename				Type		Size	Used	Priority
/dev/sda5                              	partition	12595196	0	1
/dev/zram0                             	partition	1026664	0	20
~$ 
$ cat /proc/swaps
Filename				Type		Size		Used		Priority
/dev/sda5                               partition	12595196	0		1
/dev/zram0                              partition	1026664		0		20
$  
$ sudo zramctl
NAME       ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lzo-rle    1002.6M   4K   74B    4K       2 [SWAP]
$ 

I can't get anything from running the script in a terminal either:

# /etc/init.d/zramswap start > /tmp/zramswap.log 2>&1
#
# cat /tmp/zramswap.log
#                           <- nothing to see here ...

Just in case ...

#!/bin/sh
#!/usr/bin/env /lib/init/init-d-script

### BEGIN INIT INFO
# Provides:          zramswap
# Required-Start:    $syslog $time $remote_fs
# Required-Stop:     $syslog $time $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Linux zramswap setup
# Description:       Debian init script for zramswap
### END INIT INFO

PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/zramswap
PIDFILE=none

_is_active() {
	$DAEMON status >/dev/null 2>&1
	return $?
}

do_start_prepare() {
	if _is_active; then
		log_warning_msg "$NAME is already active"
		exit 3
	fi
}

do_start_cmd_override() {
	$DAEMON start
}

do_stop_prepare() {
	if ! _is_active; then
		log_warning_msg "$NAME is not active"
		exit 3
	fi
}

do_stop_cmd_override() {
	$DAEMON stop
}

do_status_override() {
	$DAEMON status
}

do_restart_override() {
	if _is_active; then
		$DAEMON restart
	else
		$DAEMON start
	fi
}

How to troubleshoot this further?

Thanks in advance.

Best,

A.

Last edited by Altoid (2025-05-18 15:58:12)

Offline

#2 2025-05-18 23:20:23

Altoid
Member
Registered: 2017-05-07
Posts: 1,748  

Re: [SOLVED] zramswap script won't start

Hello.

I wrote:

... troubleshoot this further?

No need.

In true (and time proven) Linux fashion I found a way out.
ie: by doing it in a different manner.

For those interested, the whole explanation is here.

TL;DR
For whatever reason, it seems the problem of getting the/a zram script to start in /etc/init.d has been doing the rounds for a while.
I could not find out why.

The solution is to start zram, setting the parameters and the zramswap file directly from rc.local.
And Bob's your uncle.

To test, I just dropped in the lines posted but (just to be neat) I'll write up a short script as a replacement for that.

Best,

A.

Offline

#3 2025-05-19 00:24:33

EDX-0
Member
Registered: 2020-12-12
Posts: 115  

Re: [SOLVED] zramswap script won't start

you could also give my https://github.com/eylles/zram-service script a try, it just works perfectly on my machine, also i'm planning to make it have some feature parity with what the rust-systemd-zram-generator so that it can also do mounts not just a single zram device as zramswap.

Offline

#4 2025-05-19 01:15:51

Altoid
Member
Registered: 2017-05-07
Posts: 1,748  

Re: [SOLVED] zramswap script won't start

Hello:

EDX-0 wrote:

Yes, I saw it.

But this is for an undepowered (Intel Atom N280/2Gb) ca. 2009 netbook for which I need a simple/easy solution.
The zramctl command can set up all the parameters I need in a jiffy in case the default ones are not suitable or I want to experiment.

Thanks for your input.

Best,

A.

Offline

#5 2025-05-19 18:26:24

hunter0one
Member
Registered: 2021-12-31
Posts: 77  

Re: [SOLVED] zramswap script won't start

As another option I've ported the zramen script from Void Linux to Devuan. It comes with a working init script for Daedulus.

https://git.disroot.org/hunter0one/devu … ter/zramen

Offline

#6 2025-05-19 19:39:04

Altoid
Member
Registered: 2017-05-07
Posts: 1,748  

Re: [SOLVED] zramswap script won't start

Hello:

hunter0one wrote:

... ported the zramen script from Void Linux ...
... comes with a working init script for Daedulus.

Thanks for doing that for the team Dev1.

Best,

A.

Offline

#7 2025-05-20 20:54:47

hunter0one
Member
Registered: 2021-12-31
Posts: 77  

Re: [SOLVED] zramswap script won't start

No problem. Its not actually in Devuan repos as I'm not sure how to propose it. It may have to first be enabled by you if I remember correctly. I am currently on PCLOS, not Devuan.

Offline

#8 2025-05-20 21:21:34

Altoid
Member
Registered: 2017-05-07
Posts: 1,748  

Re: [SOLVED] zramswap script won't start

Hello:

hunter0one wrote:

... not actually in Devuan repos ...
... not sure how to propose it.
... be enabled by you ...

No, not me. 8^D!
I'm just an interested observer.

That would be one of the admins (@golinux / @fsmithred / @Ralph.Ronnquist).
But I don't know what the process is / entails.

Best,

A.

Last edited by Altoid (2025-05-20 21:22:27)

Offline

#9 2025-05-20 21:28:01

hunter0one
Member
Registered: 2021-12-31
Posts: 77  

Re: [SOLVED] zramswap script won't start

By enabled I meant that the init script does not start automatically if I remember correctly. You have to enable it with update-rc.d.

Offline

#10 2025-05-20 22:16:09

Altoid
Member
Registered: 2017-05-07
Posts: 1,748  

Re: [SOLVED] zramswap script won't start

Hello:

hunter0ne wrote:

... meant that the init script does not start ...
... enable it with update-rc.d.

Right ...  8^°
Sorry, my bad.

Yes, update-rc.d uses the INIT INFO fields and is mandatory when adding a script to /etc/init.d.

Best,

A.

Offline

Board footer