Boot without X?

General support questions
altiris
Posts: 334
Joined: 2013/05/31 01:27:50

Boot without X?

Postby altiris » 2014/08/03 18:26:41

Upgrading my existing Centos 6 box with centos 7 (testing in virtual machine of course). I want to know if it's possible to (after installing centos 7 with gui) make it boot without X or essentially turn it off but still have the ability to turn it back on whenever (reboot being required is fine). Is this possible?

I've bee reading online and many are saying that having a GUI on a server is pretty much unneeded and just uses more system resources. I am beginning to like this idea but I would prefer to have a GUI initially to set up the system, then once it's set up and configured I would like to disable X so that it will just run without a GUI.

bertan
Posts: 55
Joined: 2014/01/12 23:43:19
Location: Canada

Re: Boot without X?

Postby bertan » 2014/08/03 19:54:32

Probably you want runlevel 3, except it's not called runlevel 3 any more.

Code: Select all

$ cat /etc/inittab
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /etc/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To set a default target, run:
#
# ln -sf /lib/systemd/system/<target name>.target /etc/systemd/system/default.target
#

altiris
Posts: 334
Joined: 2013/05/31 01:27:50

Re: Boot without X?

Postby altiris » 2014/08/03 23:17:20

Soo, this isnt possible anymore or I need to do something different?

bertan
Posts: 55
Joined: 2014/01/12 23:43:19
Location: Canada

Re: Boot without X?

Postby bertan » 2014/08/03 23:25:01

Oh, it is possible, in fact there's a command to do that for you:

Code: Select all

systemctl set-default multi-user.target


See upstream vendor's documentation

MIDNITER32
Posts: 6
Joined: 2013/03/12 08:47:15

Re: Boot without X?

Postby MIDNITER32 » 2014/08/03 23:27:51

From what I understand, CentOS 7 no longer uses /etc/inittab to configure runlevels, use this to change default runlevels:

http://www.server-world.info/en/note?os=CentOS_7&p=runlevel

User avatar
jenaniston
Posts: 6
Joined: 2014/07/15 12:07:22

Re: Boot without X?

Postby jenaniston » 2014/08/03 23:33:49

bertan wrote:... you want runlevel 3, except it's not called runlevel 3 any more.

Code: Select all

$ cat /etc/inittab
...
# To set a default target, run:
#
# ln -sf /lib/systemd/system/<target name>.target /etc/systemd/system/default.target
#


man runlevel . . . "This is a legacy command available for compatibility only.
It should not be used anymore, as the concept of runlevels is obsolete."

but command still gives same output

Code: Select all

# runlevel
N 5
# systemctl get-default
graphical.target

So, to reboot to runlevel 3

Code: Select all

# systemctl set-default multi-user.target
which produces the output:

Code: Select all

rm '/etc/systemd/system/default.target'
ln -s '/usr/lib/systemd/system/multi-user.target' '/etc/systemd/system/default.target'
and exits.

Centos 7 will then boot into runlevel 3 with that new default set.
Use

Code: Select all

 # systemctl set-default graphical.target
to get back to boot into runlevel 5 again.

I also noticed that this link says that systemd distinguishes between halt (as in # shutdown -h now) and poweroff ?
"so halt without parameters now does exactly what it says - it merely stops the system without turning it off."
https://fedoraproject.org/wiki/Systemd

altiris
Posts: 334
Joined: 2013/05/31 01:27:50

Re: Boot without X?

Postby altiris » 2014/08/04 04:03:10

jenaniston wrote:
bertan wrote:... you want runlevel 3, except it's not called runlevel 3 any more.

Code: Select all

$ cat /etc/inittab
...
# To set a default target, run:
#
# ln -sf /lib/systemd/system/<target name>.target /etc/systemd/system/default.target
#


man runlevel . . . "This is a legacy command available for compatibility only.
It should not be used anymore, as the concept of runlevels is obsolete."

but command still gives same output

Code: Select all

# runlevel
N 5
# systemctl get-default
graphical.target

So, to reboot to runlevel 3

Code: Select all

# systemctl set-default multi-user.target
which produces the output:

Code: Select all

rm '/etc/systemd/system/default.target'
ln -s '/usr/lib/systemd/system/multi-user.target' '/etc/systemd/system/default.target'
and exits.

Centos 7 will then boot into runlevel 3 with that new default set.
Use

Code: Select all

 # systemctl set-default graphical.target
to get back to boot into runlevel 5 again.

I also noticed that this link says that systemd distinguishes between halt (as in # shutdown -h now) and poweroff ?
"so halt without parameters now does exactly what it says - it merely stops the system without turning it off."
https://fedoraproject.org/wiki/Systemd

Thanks guys for the extra information, I can't try this yet as I am still configuring the CO7 but hopefully it will work.


Return to “CentOS 7 - General Support”

Who is online

Users browsing this forum: gerald_clark and 3 guests