# Exit X to Commandline



## yth (Sep 18, 2018)

According to the Handbook description, it seemed like we can exit out of X and back to command line by using vt. We just need to add a line to loader.conf:


```
kern.vty=vt
```

I tried that, but it does not appear to work as described.

Based on my research, if I just start plain X, it will display a blank screen. So, I created the keyboard exit to X based on the Handbook, and it seems to work. I used the following command to create something that's not a blank screen.

`X -retro :1`

With the keyboard exit command, I seem to be able to exit out it and back to a blank screen.

I am not sure where I should look to find a way to be able to exit X back to command line. Any help/tip will be most welcome!

Please let me know what information you need from me.


----------



## rigoletto@ (Sep 18, 2018)

You don't need to add `kern.vty=vt` because it is already the default, and I didn't well understood what exactly you trying to accomplish.

However the behavior you describe seems the typical of nvidia drivers. If you actually is using a nvidia card you have two options ( otherwise explain with more details ):

add `hw.vga.textmode="1"` /boot/loader.conf; or
switch to the old _sc_ console kern.vty="sc".
Cheers!


----------



## yth (Sep 18, 2018)

I do not have a nvidia graphics card. It's using intel graphics.

The effect that I want to create is that I want to be able to start X, and then exit X and return to a command line interface without having to restart. Does this help?


----------



## rigoletto@ (Sep 18, 2018)

Ah, `Ctrl + Alt + F[1,2,3,4,5,6,7,8]`. `Ctrl + Alt + F9` bring back to X.


----------



## yth (Sep 18, 2018)

X does not respond to any of those key combinations after it has started.


----------



## rigoletto@ (Sep 18, 2018)

Those keys should work by default. Start X without any kind xorg.conf ( it should not be necessary in most cases anyway ) and try again. Otherwise wait someone who use Intel ( I don't ).


----------



## ShelLuser (Sep 18, 2018)

What FreeBSD version are you using?


----------



## Datapanic (Sep 18, 2018)

You might try creating the following files in /usr/local/etc/X11/xorg.conf.d:

This one makes CTRL-ALT-BackSpace bring back the prompt:

```
section "InputClass"
        Identifier      "KeyboardDefaults"
        Driver          "keyboard"
        MatchIsKeyboard "on"
        Option          "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection
```

Enable Zap:


```
Section "ServerLayout"
        Identifier "EnableZap"
        Option     "DontZap" "Off"
EndSection
```

You might also need to put them in /usr/local/etc/X11/xorg.conf:

```
Section "ServerLayout"
        Identifier "EnableZap"
        Option     "DontZap" "Off"
        Screen      0  "Screen0" 0 0
EndSection

Section "InputClass"
        Identifier      "KeyboardDefaults"
        Driver          "keyboard"
        MatchIsKeyboard "on"
        Option          "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection
```

At most, the above are just clues for you to find your own solution


----------



## yth (Sep 19, 2018)

I am using version 11.2-RELEASE-p2.

EDIT:
I found out that the version of Xorg that I am using was built on FreeBSD 11.1-RELEASE-p13 amd64.

Does this mean I need to build Xorg on my machine?


----------



## SirDice (Sep 19, 2018)

yth said:


> Does this mean I need to build Xorg on my machine?


No, that won't be necessary.


----------

