You are not logged in.

#1 2017-11-24 21:36:45

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 341

What sets the systemd default target to graphical.target?

I noticed on one of my (headless) servers with no graphical software installed at all that the default systemd target is set to graphical:

[root@www system]# systemctl get-default
graphical.target

Checked a different server and got the same result.  Does anyone know what or why the default target is being set to graphical?  multi-user.target would seem to be a more sensible choice under these circumstances.

Offline

#2 2017-11-24 21:57:28

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: What sets the systemd default target to graphical.target?

Why it is set as the default is in all likelihood because that was the default for sysv runlevel, 5.

`systemctl list-dependencies graphical.target ` shows multi-user as a dependency of graphical.

You can change that with:

# systemctl enable multi-user.target
# systemctl set-default multi-user.target

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2017-11-24 21:58:23

loqs
Member
Registered: 2014-03-06
Posts: 17,370

Re: What sets the systemd default target to graphical.target?

pgoetz wrote:

I noticed on one of my (headless) servers with no graphical software installed at all that the default systemd target is set to graphical:

pgoetz wrote:

multi-user.target would seem to be a more sensible choice under these circumstances.

How would you script that using the information available to pacman at the time the systemd package is installed?  Or are you suggesting systemd should automatically change the default target based on some criteria?

$ systemctl cat graphical.target 
# /usr/lib/systemd/system/graphical.target
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit]
Description=Graphical Interface
Documentation=man:systemd.special(7)
Requires=multi-user.target
Wants=display-manager.service
Conflicts=rescue.service rescue.target
After=multi-user.target rescue.service rescue.target display-manager.service
AllowIsolate=yes

Unless something providing display-manager.service or a service depending on graphical.target is enabled graphical.target will be equivalent to multi-user.target.

Offline

#4 2017-11-24 22:16:09

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 341

Re: What sets the systemd default target to graphical.target?

loqs wrote:

How would you script that using the information available to pacman at the time the systemd package is installed?  Or are you suggesting systemd should automatically change the default target based on some criteria?
Unless something providing display-manager.service or a service depending on graphical.target is enabled graphical.target will be equivalent to multi-user.target.

Hmm, yeah; good point.  I guess my thought is that the certain package installations (e.g. installation of a display manager) would trigger a change in the default target from multi-user to graphical.  I can provide at least one real world example where this default target might have burned me had the system I was configuring been Arch.  I recently set up a GPU-laden (4 x GTX1080) rack mount system used for structural biology imaging.  Some of the processing software uses CUDA, so I had to install the nVidia drivers, which automatically triggered an installation of X as a dependency.  Of course I don't want a display manager or anything running on the system, given that it's headless and installed in a server closet.

Last edited by pgoetz (2017-11-24 22:17:16)

Offline

#5 2017-11-25 01:27:05

progandy
Member
Registered: 2012-05-17
Posts: 5,192

Re: What sets the systemd default target to graphical.target?

pgoetz wrote:

I can provide at least one real world example where this default target might have burned me had the system I was configuring been Arch.  I recently set up a GPU-laden (4 x GTX1080) rack mount system used for structural biology imaging.  Some of the processing software uses CUDA, so I had to install the nVidia drivers, which automatically triggered an installation of X as a dependency.  Of course I don't want a display manager or anything running on the system, given that it's headless and installed in a server closet.

That shouldn't be a problem. First you probably did not install a display manager, so there is no display-manager.service. Second, packages in arch should only install disabled service files. If you want to use them you'll have to enable them manually. Even if you install a display manager, it should only start after a "systemctl enable"


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#6 2017-11-25 12:15:20

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,528
Website

Re: What sets the systemd default target to graphical.target?

I think runlevel0.target would be a much better default.  Really, why all the bloat and handholding: if the user doesn't explicitly tell the system to do anything, then nothing should be done for them.  So unless they change the default target to boot into during the installation then the only sane response is to immediately shut down upon the next boot, right?

EDIT: just in case it's not already obvious: </sarcasm>

Last edited by Trilby (2017-11-25 12:16:02)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB