Zum Inhalt springen

Runlevel/Default: Unterschied zwischen den Versionen

Aus Foxwiki
K Dirkwagner verschob die Seite Linux/Runlevel/Default nach Runlevel/Default
Keine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
* In Debian 9/10, systemd uses targets instead of run-levels.
* In Debian 9/10, systemd uses targets instead of run-levels
* The /etc/inittab file is no longer used by systemd to change run levels.
* The /etc/inittab file is no longer used by systemd to change run levels


== Change Default runlevel ==
== Change Default runlevel ==
The Default [[runlevel]] can be set either by using the systemctl command or making a symbolic link of runlevel targets file to the default target file.
The Default [[runlevel]] can be set either by using the systemctl command or making a symbolic link of runlevel targets file to the default target file


=== Method 1 ===
=== Method 1 ===
Let’s check the current run level by using the following command.
Let’s check the current run level by using the following command
  # systemctl get-default
  # systemctl get-default
  graphical.target
  graphical.target


Before changing the default runlevel, check out the available targets.
Before changing the default runlevel, check out the available targets
  # systemctl list-units --type=target
  # systemctl list-units --type=target
  UNIT                   LOAD   ACTIVE SUB   DESCRIPTION
  UNIT LOAD ACTIVE SUB DESCRIPTION
  basic.target           loaded active active Basic System
  basic.target loaded active active Basic System
  cryptsetup.target     loaded active active Encrypted Volumes
  cryptsetup.target loaded active active Encrypted Volumes
  getty.target           loaded active active Login Prompts
  getty.target loaded active active Login Prompts
  graphical.target       loaded active active Graphical Interface
  graphical.target loaded active active Graphical Interface
  local-fs-pre.target   loaded active active Local File Systems (Pre)
  local-fs-pre.target loaded active active Local File Systems (Pre)
  local-fs.target       loaded active active Local File Systems
  local-fs.target loaded active active Local File Systems
  multi-user.target     loaded active active Multi-User System
  multi-user.target loaded active active Multi-User System
  network-online.target loaded active active Network is Online
  network-online.target loaded active active Network is Online
  network.target         loaded active active Network
  network.target loaded active active Network
  nss-user-lookup.target loaded active active User and Group Name Lookups
  nss-user-lookup.target loaded active active User and Group Name Lookups
  paths.target           loaded active active Paths
  paths.target loaded active active Paths
  remote-fs.target       loaded active active Remote File Systems
  remote-fs.target loaded active active Remote File Systems
  slices.target         loaded active active Slices
  slices.target loaded active active Slices
  sockets.target         loaded active active Sockets
  sockets.target loaded active active Sockets
  sound.target           loaded active active Sound Card
  sound.target loaded active active Sound Card
  swap.target           loaded active active Swap
  swap.target loaded active active Swap
  sysinit.target         loaded active active System Initialization
  sysinit.target loaded active active System Initialization
  time-sync.target       loaded active active System Time Synchronized
  time-sync.target loaded active active System Time Synchronized
  timers.target         loaded active active Timers
  timers.target loaded active active Timers
LOAD  = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.


Issue the following command to change the default runlevel to runlevel 3 (nothing but a multi-user.target).
LOAD = Reflects whether the unit definition was properly loaded
ACTIVE = The high-level unit activation state, i.e
* generalization of SUB
SUB = The low-level unit activation state, values depend on unit type
 
Issue the following command to change the default runlevel to runlevel 3 (nothing but a multi-user.target)
  # systemctl set-default multi-user.target
  # systemctl set-default multi-user.target


Confirm the default runlevel.
Confirm the default runlevel
  # systemctl get-default
  # systemctl get-default
  multi-user.target
  multi-user.target


Reboot and check it out.
Reboot and check it out
  # reboot
  # reboot


=== Method 2 ===
=== Method 2 ===
In the previous method, we made the runlevel 3 as the default runlevel. You can also confirm that using the following command.
In the previous method, we made the runlevel 3 as the default runlevel
* You can also confirm that using the following command
  #systemctl get-default
  #systemctl get-default
  multi-user.target
  multi-user.target
For a demo, issue the following command to make runlevel 5 as the default runlevel.
For a demo, issue the following command to make runlevel 5 as the default runlevel
  # ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
  # ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
  OR
  OR
  # ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
  # ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target


Again check the current level. Now the default runlevel is the graphical mode(runlevel 5).
Again check the current level
* Now the default runlevel is the graphical mode(runlevel 5)
  # systemctl get-default
  # systemctl get-default
  graphical.target
  graphical.target


Reboot the machine and check it out.
Reboot the machine and check it out
  # reboot
  # reboot


Zeile 71: Zeile 74:
* https://www.systutorials.com/239880/change-systemd-boot-target-linux/
* https://www.systutorials.com/239880/change-systemd-boot-target-linux/
* https://wiki.debian.org/systemd
* https://wiki.debian.org/systemd


[[Kategorie:Systemd]]
[[Kategorie:Systemd]]
[[Kategorie:Init]]
[[Kategorie:Init]]

Version vom 28. Januar 2025, 12:53 Uhr

  • In Debian 9/10, systemd uses targets instead of run-levels
  • The /etc/inittab file is no longer used by systemd to change run levels

Change Default runlevel

The Default runlevel can be set either by using the systemctl command or making a symbolic link of runlevel targets file to the default target file

Method 1

Let’s check the current run level by using the following command

# systemctl get-default
graphical.target

Before changing the default runlevel, check out the available targets

# systemctl list-units --type=target
UNIT LOAD ACTIVE SUB DESCRIPTION
basic.target loaded active active Basic System
cryptsetup.target loaded active active Encrypted Volumes
getty.target loaded active active Login Prompts
graphical.target loaded active active Graphical Interface
local-fs-pre.target loaded active active Local File Systems (Pre)
local-fs.target loaded active active Local File Systems
multi-user.target loaded active active Multi-User System
network-online.target loaded active active Network is Online
network.target loaded active active Network
nss-user-lookup.target loaded active active User and Group Name Lookups
paths.target loaded active active Paths
remote-fs.target loaded active active Remote File Systems
slices.target loaded active active Slices
sockets.target loaded active active Sockets
sound.target loaded active active Sound Card
swap.target loaded active active Swap
sysinit.target loaded active active System Initialization
time-sync.target loaded active active System Time Synchronized
timers.target loaded active active Timers
LOAD = Reflects whether the unit definition was properly loaded
ACTIVE = The high-level unit activation state, i.e
  • generalization of SUB
SUB = The low-level unit activation state, values depend on unit type

Issue the following command to change the default runlevel to runlevel 3 (nothing but a multi-user.target)

# systemctl set-default multi-user.target

Confirm the default runlevel

# systemctl get-default
multi-user.target

Reboot and check it out

# reboot

Method 2

In the previous method, we made the runlevel 3 as the default runlevel

  • You can also confirm that using the following command
#systemctl get-default
multi-user.target

For a demo, issue the following command to make runlevel 5 as the default runlevel

# ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
OR
# ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target

Again check the current level

  • Now the default runlevel is the graphical mode(runlevel 5)
# systemctl get-default
graphical.target

Reboot the machine and check it out

# reboot

Links

Weblinks