GNU/Linux >> Tutoriales Linux >  >> Linux

Linux:¿cómo iniciar Systemd sin Default.target?

La documentación de systemd y varias fuentes en línea declaran que systemd debería iniciar (de forma predeterminada) el objetivo "especial" llamado "default.target". Es posible cambiar esto mediante systemctl set-default, que básicamente crea un enlace simbólico desde default.target hasta el objetivo deseado.

Sin embargo, en mi sistema no existe tal archivo. No /etc/systemd/system/default.target, no /usr/lib/systemd/system/default.target (en realidad, este archivo no existe en todo el sistema). El sistema aún se está iniciando. Mi pregunta es ¿cómo puede ser?

(Por supuesto que podría hacer un enlace simbólico yo mismo, solo quiero saber cómo es posible definir un valor predeterminado sin destino predeterminado)

Información adicional:

# systemctl get-default
graphical.target

Así que mi objetivo predeterminado es graphical.target. Pero, ¿dónde (y cómo) se define?

# find /usr/lib -iname "default.target" # no results
# find /etc -iname "default.target" # no results
# lsb_release -a
LSB Version:    n/a
Distributor ID: Gentoo
Description:    Gentoo Base System release 2.4.1
Release:    2.4.1
Codename:   n/a

# systemctl list-units --type=target
UNIT                  LOAD   ACTIVE SUB    DESCRIPTION                  
basic.target          loaded active active Basic System                 
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           
machines.target       loaded active active Containers                   
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-lookup.target     loaded active active Host and Network 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        
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.

18 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

Respuesta aceptada:

Gentoo cambió la ubicación de los archivos systemd a /lib/systemd en julio de 2017. En mi sistema, puedo ver el enlace simbólico predeterminado en /lib/systemd/system :

$ ls -l /lib/systemd/system/default.target
lrwxrwxrwx 1 root root 16 Apr  2 15:48 /lib/systemd/system/default.target -> graphical.target

Si agrega un enlace simbólico en /etc/systemd/system (como systemctl set-default lo hace), anulará la configuración predeterminada de la distribución.


Linux
  1. Cómo configuro Vim como mi editor predeterminado en Linux

  2. Cómo cambiar el nivel de ejecución predeterminado en Debian 10 / Debian 9

  3. Cómo enumerar los servicios de Systemd en Linux

  4. Cómo cambiar el shell predeterminado en Linux

  5. ¿Cómo iniciar el servidor Tomcat en Linux?

Cómo deshabilitar la suspensión y la hibernación en Linux

Cómo cambiar el archivo de registro de Sudo predeterminado en Linux

Cómo verificar el nivel de ejecución en Linux

Cómo cambiar el shell predeterminado en el sistema Linux

Cómo ejecutar Shell Script como servicio SystemD en Linux

Obarun:una distribución de Linux basada en Arch sin Systemd