The officially official Devuan Forum!

You are not logged in.

#1 2022-02-06 20:19:17

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Missing init scripts and how to provide them

With the advancing encroachment of systemd across the Linux ecosystem it is now not unusual for applications to only supply systemd unit files and omit traditional init scripts. This prevents users of alternative init systems from automatically starting system daemons and other services at boot.

For the bullseye release Debian has provided a small selection of "orphaned" init scripts that can be installed in Devuan chimaera (or later) with

# apt install orphan-sysvinit-scripts

A list of the scripts and their locations can be found here:

https://packages.debian.org/bullseye/al … s/filelist

To use the scripts copy them from /usr/share/orphan-sysvinit-scripts/ to /etc/init.d/ and run this command to make them start automatically from the next boot:

# update-rc.d script defaults

To start the script immediately use

# service script start

In both cases replace script with the actual name of the file that was copied to /etc/init.d/.

For the applications not covered by the above package there is a sysv2d.sh script that can be downloaded from here by using this command:

$ wget https://git.savannah.nongnu.org/cgit/sysvinit.git/plain/contrib/sysd2v.sh

To use it make the script executable and move it to a directory in your user's PATH:

$ chmod +x sysd2v.sh
# mv sysd2v.sh /usr/local/bin/sysd2v

Once that is done the command can be used on any systemd unit files[1] like this:

$ sysv2d example.service > example
# mv example /etc/init.d/

In both commands replace example with the actual name of the unit file.

Once the script is moved to /etc/init.d/ it can be enabled with update-rc.d and started with service as outlined earlier.

(In this thread commands prefixed with $ should be run as the normal user and commands prefixed with # should be run as root; in both cases the prefix should be omitted when running the actual command.)

[1] The systemd .service unit files for installed packages can be found under /lib/systemd/system/.

Last edited by Head_on_a_Stick (2022-02-07 18:04:12)


Brianna Ghey — Rest In Power

Offline

#2 2022-02-13 18:09:44

MLEvD
Member
Registered: 2021-02-14
Posts: 141  

Re: Missing init scripts and how to provide them

Is there some way to reinstate the missing alsa restore and save sound card state in devuan?

Offline

#3 2022-02-13 20:43:03

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: Missing init scripts and how to provide them

This is generated from /lib/systemd/system/alsa-restore.service in my Arch box:

#!/bin/sh
# Generated by sysd2v v0.3  --  http://www.trek.eu.org/devel/sysd2v
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
    set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides:       alsa-restore
# Required-Start: $remote_fs
# Required-Stop:  $remote_fs
# Default-Start:  2 3 4 5
# Default-Stop:   0 1 6
# Description:    Save/Restore Sound Card State
### END INIT INFO
DESC="alsa-restore"
DAEMON=none
PIDFILE=none

do_start_cmd_override ()
{
  /usr/sbin/alsactl restore
  true
}

do_stop_cmd_override ()
{
  /usr/sbin/alsactl store
  true
}

do_status_override () :

^ Save that to /etc/init.d/alsa-restore and run

# update-rc.d alsa-restore defaults

Disclaimer: untested.


Brianna Ghey — Rest In Power

Offline

#4 2024-06-14 16:46:02

bai4Iej2need
Member
From: Ortenau
Registered: 2021-04-25
Posts: 101  

Re: Missing init scripts and how to provide them

Hi
I tested this script sysd2v.sh and it failed.
The start stop functions were not created.

YMMV.


The devil, you know, is better than the angel, you don't know. by a British Citizen, I don't know too good.
One generation abandons the enterprises of another like stranded vessels. By Henry David Thoreau, WALDEN, Economy. Line 236 (Gutenberg text Version)
broken by design :
https://bugs.debian.org/cgi-bin/bugrepo … bug=958390

Offline

#5 2024-06-14 17:05:54

igorzwx
Member
Registered: 2024-05-06
Posts: 21  

Re: Missing init scripts and how to provide them

$ /etc/init.d/alsa-utils
Usage: /etc/init.d/alsa-utils {start [CARD]|stop [CARD]|restart [CARD]|reset [CARD]}

Offline

Board footer