Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: [EN] init 3 not working  (Read 17882 times)

Offline Pergola

  • User
  • Posts: 23
[EN] init 3 not working
« on: 2025/09/14, 19:27:11 »
When I type init 3, nothing happens. systemctl isolate multi-user.target brings me to console mode. Do you know this behavior?

« Last Edit: 2025/09/14, 22:03:23 by Pergola »

Offline scholle1

  • Global Moderator
  • User
  • *****
  • Posts: 190
Re: init 3 not working
« Reply #1 on: 2025/09/14, 20:20:05 »
Yes, here’s the reason.

With systemd 258~rc1-1, support for user command for runlevel and runlevel targets (init 0 to init 6) has been removed.

The change is not user-friendly from systemd and is also irrelevant in terms of the code saved.
I now use a script called “onoff” in the /usr/sbin directory to replace the long systemd command.

Code: [Select]
#!/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
Code: [Select]
onoff 6 to reboot, or
Code: [Select]
onoff [2-5] to switch to another target, or
Code: [Select]
onoff 0 to shutdown.
« Last Edit: 2025/09/14, 20:29:42 by scholle1 »
"pax in terra" - Das ist mein großer, mein einzigster, von Herzen kommender Wunsch.
"Frieden auf der Erde" und alles Weitere erscheint einfach.

Offline scholle1

  • Global Moderator
  • User
  • *****
  • Posts: 190
Re: init 3 not working
« Reply #2 on: 2025/09/14, 20:25:59 »
We will discuss within the team whether to include this script in our siduction-scripts package.
"pax in terra" - Das ist mein großer, mein einzigster, von Herzen kommender Wunsch.
"Frieden auf der Erde" und alles Weitere erscheint einfach.

Offline Pergola

  • User
  • Posts: 23
Re: init 3 not working
« Reply #3 on: 2025/09/14, 22:03:04 »
Ahh... thank you for the explanation @scholle1!

Offline ro_sid

  • User
  • Posts: 443
Re: init 3 not working
« Reply #4 on: 2025/09/15, 09:46:12 »
We will discuss within the team whether to include this script in our siduction-scripts package.
Great idea  8)!
[Thanks to @scholle1: Simple, but very effective and nice to have!]

Offline dibl

  • siduction community member
  • Global Moderator
  • User
  • *****
  • Posts: 2.475
    • Land of the Buckeye
Re: init 3 not working
« Reply #5 on: 2025/09/15, 19:26:21 »
+1   :)
System76 Oryx Pro, Intel Core i7-11800H, ASRock B860 Pro-A, Intel Core Ultra 7 265KF, Nvidia GTX-1060, SSD 990 EVO Plus.

Offline reddark

  • User
  • Posts: 1.075
    • http://www.klangruinen.de/
Re: init 3 not working
« Reply #6 on: 2025/09/16, 00:54:52 »
+ 1  ;)

Offline helux

  • User
  • Posts: 21
Re: init 3 not working
« Reply #7 on: 2025/09/16, 11:34:52 »
Kann man das script nicht "init" taufen? Dann ändert sich nichts.  8)

Offline deathwalker

  • Newbie
  • Posts: 4
Re: init 3 not working
« Reply #8 on: 2025/09/19, 08:10:15 »
And what is the way of working for a Siduction update ?
In the manual is init 3 mentioned.

Offline scholle1

  • Global Moderator
  • User
  • *****
  • Posts: 190
Re: init 3 not working
« Reply #9 on: 2025/09/19, 12:31:59 »
Kann man das script nicht "init" taufen? Dann ändert sich nichts.  8)
Nein, leider nicht.
Das ist ja die verrückte Situation mit systemd. systemd benötigt selbst den Befehl init.
init ist ein Link auf ../lib/systemd/systemd.
Code: [Select]
$ readlink /usr/sbin/init                                                                                                             
../lib/systemd/systemd
Während des Bootvorgangs wird init mit PID 1 aufgerufen und an systemd weitergeleitet.
Im Code von systemd ist die Übersetzung der Initbefehle weiterhin vorhanden.
Das kannst du testen indem du an die Kernelbefehlszeile " 3" anhängst. Du landest dann auf TTY
und nicht in der graphischen Oberfläche.
Lediglich die Unterstützung des Aufrufs von init mit einer Benutzer PID wurde entfernt und
zusätzlich auch das Paket telinit.
"pax in terra" - Das ist mein großer, mein einzigster, von Herzen kommender Wunsch.
"Frieden auf der Erde" und alles Weitere erscheint einfach.

Offline ro_sid

  • User
  • Posts: 443
Re: init 3 not working
« Reply #10 on: 2025/09/19, 14:08:02 »
Quote
Lediglich die Unterstützung des Aufrufs von init mit einer Benutzer PID wurde entfernt und
zusätzlich auch das Paket telinit.
Ist das dann nicht auch die (Teil-)Lösung? telinit -> "neues" Skript mit wiedereingeführtem "telinit"; Handbuch ändern auf "telinit 3".

Offline scholle1

  • Global Moderator
  • User
  • *****
  • Posts: 190
Re: init 3 not working
« Reply #11 on: 2025/09/19, 14:16:56 »
And what is the way of working for a Siduction update ?
In the manual is init 3 mentioned.
The online manual has just been updated.
https://manual.siduction.org/index_en.html
"pax in terra" - Das ist mein großer, mein einzigster, von Herzen kommender Wunsch.
"Frieden auf der Erde" und alles Weitere erscheint einfach.

Offline scholle1

  • Global Moderator
  • User
  • *****
  • Posts: 190
Re: init 3 not working
« Reply #12 on: 2025/09/19, 14:23:45 »
Quote
Lediglich die Unterstützung des Aufrufs von init mit einer Benutzer PID wurde entfernt und
zusätzlich auch das Paket telinit.
Ist das dann nicht auch die (Teil-)Lösung? telinit -> "neues" Skript mit wiedereingeführtem "telinit"; Handbuch ändern auf "telinit 3".
telinit ist Teil von sysvinit-core und wegen Konflikten nicht mehr installierbar.
Code: [Select]
apt why-not sysvinit-core
sysvinit-core:amd64 is not selected for install because:
1. systemd-sysv:amd64 is selected for install
2. systemd-sysv:amd64 is available in version 258~rc4-1
3. sysvinit-core:amd64 Kollidiert mit systemd-sysv

-----------
edit 2025-09-22:
Befehl apt why-not sysvinit-core
statt apt-get -s install sysvinit-core
« Last Edit: 2025/09/22, 15:56:54 by scholle1 »
"pax in terra" - Das ist mein großer, mein einzigster, von Herzen kommender Wunsch.
"Frieden auf der Erde" und alles Weitere erscheint einfach.

Offline DeepDayze

  • User
  • Posts: 499
Re: init 3 not working
« Reply #13 on: 2025/09/23, 22:43:12 »
@scholle1 thanks for your script as it's useful for translating the oldstyle SysV runlevels to the targets in systemd and making it easy as it was before to switch "runlevels" as now known as systemd targets (even though now the concept of runlevels are now all but deprecated).