Start x11 in linux

X without Display Manager

Traditionally, the X11 session is started by a display manager. However, when running a single-user system, display managers are not strictly necessary. This article describes how to start an X11 session without a display manager.

Starting X11 from console

Using startx

See the Using startx section of the Xorg/Guide article.

Using a dedicated session runner

Some of the desktop environments provide their own replacements for startx . For example, Xfce4 provides startxfce4 :

Starting X11 automatically

Starting X11 on console login

To avoid having to run startx after login, logging in to a specific vt may be configured to start X11 automatically. One of the ways to achieve this is to put code into the shell’s login script (e.g. ~/.bash_profile ):

Important
The GPU could have not been yet initialized when startx is executed. An easy solution would be to add sleep 5; before startx.

OpenRC

 
if shopt -q login_shell; then [[ -f ~/.bashrc ]] && source ~/.bashrc [[ -t 0 && $(tty) == /dev/tty1 && ! $DISPLAY ]] && exec startx else exit 1 # Somehow this is a non-bash or non-login shell. fi 

systemd

 
if [[ ! $DISPLAY> && $XDG_VTNR> == 8 ]]; then exec startx fi 

The XDG_VTNR variable specifies the VT number. To use another VT adjust the number accordingly.

The additional DISPLAY check is necessary because the snippet will be executed on both graphical and non-graphical logins. Since XDG_VTNR will be set to the same value in the shells started within the X11 session (e.g. terminals), it is necessary to prevent them from trying to start X11.

The exec command causes the login shell to be replaced by the X11 session. This means that the user won't be able to use the shell used to start X11 anymore, and whenever the X11 session terminates, user will be logged back out. To remain logged in into vt, remove the exec word.

Important
The DISPLAY check is fairly fragile. Make sure it isn't influenced by side-effects from earlier in the login process.

Ensure the user has permission to execute the ~/.bash_profile script:

Multiple X sessions/Virtual consoles

An alternate method is to auto-login to a Window Manager (WM) or a Desktop Environment (DE) depending on the Virtual Console (VT) used to login. A fallback session can be easily achieved in this manner. Just grab the following file excerpts to get going:

First, set up the sessions or WM or DE to use depending on the VT:

 
# $Header: ~/.xinitrc, 2014/11/22 Exp $ . case $(tty | cut -b9-) in (1) exec enlightenment_start;; (2) exec lxsession ;; (3) exec openbox-session ;; esac 

And then set up the login shell accordingly:

 
# $Header: ~/.bash_login, 2014/11/30 Exp $ . # Auto startx depending on the VT if [[ -z "$DISPLAY" && $(id -u) -ge 1000 ]] ; then TTY=$(tty) [[ "$TTY/tty>" != "$TTY" && "$TTY:8:1>" = "3" ]] && startx 1>~/.log/xsession-errors 2>&1 & unset TTY fi .

Or else, a zsh variant could be used instead.

 
# $Header: ~/.zlogin, 2014/11/30 Exp $ . # Auto startx depending on the tty if [[ -z $DISPLAY ]] && (( $EUID != 0 ))  [[ $TTY/tty> != $TTY ]] && (( $TTY:8:1> = 3 )) && startx 1>~/.log/xsession-errors 2>&1 & > .

The previous files can be used to login into an Enlightenment or LXDE session without needing any middle man or rather Display Manager (DM)! and Openbox session as a fallback session using VT 1, 2, and 3.

Adapt to preferred DE or WM.

X11 autologin with systemd

Method 1

In order to obtain complete X11 autologin, it is possible to use the getty/login autologin feature along with the aforementioned trick.

First, create a new service file like the following:

FILE /etc/systemd/system/x11.service An example service file for X11 autologin

 
[Unit] After=systemd-user-sessions.service [Service] ExecStart=/sbin/mingetty --autologin username --noclear tty8 38400 [Install] WantedBy=multi-user.target 

username replaced by the user's username, and tty8 being the tty the X11-starting login to be performed on. It should be noted that this tty will be used for login and console output, and X11 can be started on any other tty.

Note
This way can only be used for vt7+. Earlier vts are used by default getty generator and require a different kind of hackery.

Afterwards, add the previous snippet to bashrc (with the same vt specified), enable the service:

In order to avoid relying on the DISPLAY+XDG_VTNR trick to determine whether to start X11, the two above approaches may be extended by using a dedicated environment variable to distinguish the specific shell where X11 is to be started.

First, create a dedicated login wrapper:

 
#!/bin/sh exec /bin/login "$@>" START_X11=1 

This causes the user to be logged in with START_X11=1 environment variable set. Then, tell getty to use that file instead of the default /bin/login :

FILE /etc/systemd/system/x11.service X11 autologin service using login wrapper

 
[Unit] After=systemd-user-sessions.service [Service] ExecStart=/sbin/mingetty --autologin username --loginprog=/usr/local/sbin/x11login --noclear tty8 38400 [Install] WantedBy=multi-user.target 

Finally, modify ~/.bashrc (or equivalent) to use the variable rather than guessing:

 
if [[ $START_X11> == 1 ]]; then unset START_X11 exec startx fi 

Remember to unset the variable before starting X11 -- otherwise all the X11 terminals would have it set and try to spawn another X11 session.

Method 2

An alternative method is to use su and xinit for direct login in X.

FILE /etc/systemd/system/xinit-login.service An example service file for X11 autologin using su and xinit

 
[Unit] After=systemd-user-sessions.service [Service] ExecStart=/bin/su username -l -c /usr/bin/xinit -- VT08 [Install] WantedBy=multi-user.target 

startx can be used rather than xinit .

In case X startup fails with the error Xorg.wrap: Only console users are allowed to run the X server then read man Xorg.wrap how to allow any user to do so.

Automatic user selection

On a 1-user system it's possible to avoid typing the username, so the login prompt will ask only for the password. E.g. adjust /etc/inittab so that the third terminal asks about the password only:

 
c3:2345:respawn:/sbin/agetty --noclear --skip-login --login-options=my_user 38400 tty3 linux

Of course, one can have various preselected users on different terminals, e.g. user_a on tty1 and user_b on tty2.

Custom text in console logon

It is possible to create a simple wrapper for /bin/login to show supplementary information on the console logon screen. E.g. on a 1-user system one may wish to see if there are any new emails without logging in. First, create a simple bash wrapper for /bin/login :

 
#!/bin/bash # Show sender and subject of all new emails: egrep -r --max-count=2 '^(From|Subject|$):' ~email_user/.maildir/new # Show user count, terminal, time, kernel version: echo $(who -q) $(tty) $(date '+[%b-%-d %-H:%M]') $(uname -r) # Continue with normal login: exec /bin/login preselected_login_user

The last line calls the actual /bin/login which will do all the heavy lifting. Omit the user name in that line to be prompted for it. Passing a username results in being prompted about the password only.

Finally edit /etc/inittab to use login.sh wrapper, here on tty2:

 
c2:2345:respawn:/sbin/agetty --noclear --skip-login --login-program=/root/login.sh 38400 tty2 linux

Источник

restart xorg

You can try pressing Ctrl + Alt + Backspace to restart X.

How do I start Xorg in Ubuntu?

Make sure you are logged out first. Hit Ctrl + Alt + F1 and login using your credentials. You might be required to reboot when the installation finishes. If not, run sudo service lightdm start or sudo start lightdm to start your X server again.

Can I kill Xorg?

Click the Options button and enable the Control + Alt + Backspace check box under Key sequence to kill the X server. After it's enabled, you can press Ctrl+Alt+Backspace to immediately restart your X server.

How do I start x11 on Linux?

  1. Log in to your Linux system as the administrative (root) user.
  2. Open a Terminal window (if you are logged in to a system with a graphical user interface) and type "update-rc. d '/etc/init. .
  3. Pres "Enter." The command is added to the startup routine on the computer.

How do I restart pop OS?

  1. Boot up computer.
  2. Decrypt disk by inputting password.
  3. Click on top-right drop-down menu.
  4. Choose Power-off or Restart.

How do I restart Display Manager?

How do I switch from XORG to Wayland?

At the login screen, under the password field, you'll see a gear icon. Just click on it and you'll see two options here. The default Ubuntu means it will be using Wayland while Ubuntu on Xorg obviously means it will use Xorg. You can select Ubuntu on Xorg to use Xorg here.

How do I disable Xorg?

In order to disable X from starting when booting the system, you can simply remove gdm from the init scripts: sudo update-rc. d -f gdm remove.

How do I know if I have Wayland or Xorg?

For a fun way to check whether a specific app is using Wayland or XWayland, run xeyes . The eyes will move if the cursor is over an X or XWayland window. If there is no output, you are not running Wayland.

Do I need XORG?

X.Org Server is the free and open source implementation of the display server for the X Window System stewarded by the X.Org Foundation. Yes, you need xorg as without it you would have no display.

What does XORG do in Linux?

It is an open source X11-based desktop infrastructure. Xorg provides an interface between your hardware and the graphical software you want to run. Besides that, Xorg is also fully network-aware, meaning you are able to run an application on one system while viewing it on a different one.

How do I stop gdm3?

  1. ctrl + alt + F3 ( F1 and F2 don't work in ubuntu 18.04)
  2. killall gdm.
  3. Find the id of Xorg process and kill -9
  4. run sudo ./NVIDIA*.run.
  5. sudo systemctl start gdm3.

How to install flameshot screenshot software on Ubuntu / Arch / Fedora

Flameshot

How do I download Flameshot on Ubuntu?How do I use Flameshot in Fedora?How do I download Flameshot on Linux?How install Flameshot Arch Linux?What is F.

How to check the installed RAM on Debian 10

Check

Check memory Debian LinuxOpen the terminal app or login to the remote Debian server using ssh command: ssh [email protected] the free command.

Fix laptop doesn't suspend after the lid is closed in Ubuntu 16.04

Power

Go to System Settings and then click on Power. In the power setting, make sure that option for 'When the lid is closed' is set to Suspend. If you had .

Latest news, practical advice, detailed reviews and guides. We have everything about the Linux operating system

Источник

X Window System Ubuntu

Изображение баннера

Работает, если у Вас X-server gdm, gdm3 или kdm если у Вас что-то другое, просто замените.

Как перезапустить X-server

Перезапустить X-server (предварительно уйдя в консоль Ctrl + Atl + F1)можно командой

Как остановить X сервер

Остановить/Запустить X-server (предварительно уйдя в консоль Ctrl + Atl + F1) можно командой

Если не знаете какой у Вас X сервер, прочитайте статью XSession либо можете попробовать:

/etc/init.d/gdm stop || /etc/init.d/gdm3 stop || /etc/init.d/kdm stop || /etc/init.d/xdm stop || /etc/init.d/lightdm stop

Если и это не помогло попробуйте варианты отсюда

История

X Window System — оконная система, обеспечивающая стандартные инструменты и протоколы для построения графического интерфейса пользователя. Используется в UNIX-подобных ОС.

X Window System обеспечивает базовые функции графической среды: отрисовку и перемещение окон на экране, взаимодействие с устройствами ввода, такими как, например, мышь и клавиатура.

X Window System не определяет деталей интерфейса пользователя — этим занимаются менеджеры окон, которых разработано множество. По этой причине внешний вид программ в среде X Window System может очень сильно различаться в зависимости от возможностей и настроек конкретного оконного менеджера.

В X Window System предусмотрена сетевая прозрачность: графические приложения могут выполняться на другой машине в сети, а их интерфейс при этом будет передаваться по сети и отображаться на локальной машине пользователя.

В контексте X Window System термины «клиент» и «сервер» имеют непривычное для многих пользователей значение: «сервер» означает локальный дисплей пользователя (дисплейный сервер), а «клиент» — программу, которая этот дисплей использует (она может выполняться на удалённом компьютере).

Система X Window System была разработана в Массачусетском технологическом институте (MIT) в 1984 году.

По состоянию на февраль 2016 года версия протокола — X11R7.7 — появилась в июне 2012 года.

Проект X возглавляет фонд X.Org Foundation. Референсная (или образцовая) реализация (reference implementation) системы свободно доступна на условиях лицензии MIT и подобных ей лицензий.

X Window System часто называют X11 или просто X (в разговорной речи — «иксы»)

Источник

Читайте также:  Xbox 360 linux steam
Оцените статью
Adblock
detector