Skip to content

systemd removed support for runlevel [init 0-6] #27

@ak-li

Description

@ak-li

With systemd 258~rc1-1, support for runlevel and runlevel targets (init 0 to init 6) has been removed. Do we want to submit to the constraints of systemd, or add our own document?
After the upgrade, the file /usr/sbin/init continues to exist as a link to /usr/lib/systemd/systemd

For example: /usr/sbin/onoff

#!/usr/bin/bash
#
# Name: /usr/sbin/onoff
#
# This script makes the functionality removed by systemd 258~rc1-1,
# init 0 to init 6, available again to the user in a running system.

case  "${1}" in
	0)
		systemctl poweroff
	;;
	1)
		systemctl isolate emergency.target
	;;
	2)
		systemctl isolate rescue.target
	;;
	3|4)
		systemctl isolate multi-user.target
	;;
	5)
		systemctl isolate graphical.target
	;;
	6)
		systemctl reboot 
	;;
	*)
		echo "Error: >${1}< is not a valid option" && exit 1
	;;
esac
exit 0

After that, you can use the command onoff 6 to reboot, or onoff [1-5] to switch to another target, or onoff 0 to shutdown.

Please also take a look at siduction forum


edit 2025-08-29:
That's my solution. Maybe include it in the siduction-scripts.
edit 2025-09-19:
onoff [2-5] to onoff [1-5]
add link to forum

Metadata

Metadata

Assignees

Labels

DiscussionQATesting & Quality AssurancedocumentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions