Ubuntu: /usr/bin/X not found

Автор: | 10/03/2017
 

В какой-то момент после очередной перезагрузки – упали иксы на Ubuntu 14.04:

setevoy@setevoy-nout:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:        14.04
Codename:       trusty

[simterm]

$ startx

/etc/X11/xinit/xserverrc: 3: exec: /usr/bin/X: not found
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error

[/simterm]

Особо не вникал, просто гуглил – и пробовал решения, т.к. система в любом случае сейчас пойдёт (UPD – и пошла>>>) под “снос” – буду ставить Arch.

Пробуем solution #1:

[simterm]

$ sudo dpkg-reconfigure -phigh xserver-xorg-lts-wily
/usr/sbin/dpkg-reconfigure: xserver-xorg-lts-wily is broken or not fully installed

[/simterm]

Пробуем переустановить его:

[simterm]

$ sudo apt install --reinstall xserver-xorg-lts-wily
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 xserver-xorg-lts-wily : Depends: xserver-xorg-core-lts-wily (>= 2:1.17) but it is not going to be installed
                         Depends: xserver-xorg-input-all-lts-wily but it is not going to be installed or
                                  xorg-driver-input
                         Depends: xserver-xorg-input-evdev-lts-wily but it is not going to be installed
                         Recommends: xserver-xorg-video-all-lts-wily but it is not going to be installed
                         Recommends: xserver-xorg-input-all-lts-wily but it is not going to be installed
                         Recommends: libegl1-mesa-lts-wily but it is not going to be installed
                         Recommends: libegl1-mesa-drivers-lts-wily but it is not installable
E: Unable to correct problems, you have held broken packages.

[/simterm]

Пробуем удалить драйвера для mesa:

[simterm]

$ sudo apt-get purge libegl1-mesa-drivers-lts-wily libegl1-mesa-lts-wily

[/simterm]

Не помогло.

Сносим иксы вообще:

[simterm]

$ sudo apt-get purge xserver-xorg-lts-wily
$ sudo reboot

[/simterm]

Пробуем установить заново (--reinstall по сути):

[simterm]

$ sudo apt-get install xserver-xorg-lts-wily
[sudo] password for setevoy: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 xserver-xorg-lts-wily : Depends: xserver-xorg-core-lts-wily (>= 2:1.17) but it is not going to be installed
                         Depends: xserver-xorg-input-all-lts-wily but it is not going to be installed or
                                  xorg-driver-input
                         Depends: xserver-xorg-input-evdev-lts-wily but it is not going to be installed
                         Recommends: xserver-xorg-video-all-lts-wily but it is not going to be installed
                         Recommends: xserver-xorg-input-all-lts-wily but it is not going to be installed
                         Recommends: libegl1-mesa-lts-wily but it is not going to be installed
                         Recommends: libegl1-mesa-drivers-lts-wily but it is not installable
E: Unable to correct problems, you have held broken packages.

[/simterm]

Не-а…

А что скажет aptitude?

[simterm]

$ sudo aptitude install xserver-xorg
The following NEW packages will be installed:
  libmtdev1{a} xserver-xorg xserver-xorg-input-all{a} xserver-xorg-input-evdev{a} xserver-xorg-input-mouse{a} xserver-xorg-input-synaptics{a} xserver-xorg-input-vmmouse{a} xserver-xorg-input-wacom{a} 
0 packages upgraded, 8 newly installed, 0 to remove and 2 not upgraded.
Need to get 281 kB/310 kB of archives. After unpacking 1 454 kB will be used.
Do you want to continue? [Y/n/?] y
...

[/simterm]

И xinit для startx:

[simterm]

$ sudo aptitude install xinit
The following NEW packages will be installed:
  xinit

[/simterm]

Пробуем запустить:

[simterm]

$ tail -n 30  /var/log/Xorg.0.log
[   187.212] (II) LoadModule: "nouveau"
[   187.213] (WW) Warning, couldn't open module nouveau
[   187.213] (II) UnloadModule: "nouveau"
[   187.213] (II) Unloading nouveau
[   187.213] (EE) Failed to load module "nouveau" (module does not exist, 0)
[   187.213] (II) LoadModule: "modesetting"
[   187.213] (WW) Warning, couldn't open module modesetting
[   187.213] (II) UnloadModule: "modesetting"
[   187.213] (II) Unloading modesetting
[   187.213] (EE) Failed to load module "modesetting" (module does not exist, 0)
[   187.213] (II) LoadModule: "fbdev"
[   187.214] (WW) Warning, couldn't open module fbdev
[   187.214] (II) UnloadModule: "fbdev"
[   187.214] (II) Unloading fbdev
[   187.214] (EE) Failed to load module "fbdev" (module does not exist, 0)
[   187.214] (II) LoadModule: "vesa"
[   187.214] (WW) Warning, couldn't open module vesa
[   187.214] (II) UnloadModule: "vesa"
[   187.214] (II) Unloading vesa
[   187.214] (EE) Failed to load module "vesa" (module does not exist, 0)
[   187.214] (EE) No drivers available.
[   187.214] (EE) 
Fatal server error:
[   187.218] (EE) no screens found(EE) 
[   187.220] (EE) 
Please consult the The X.Org Foundation support 
         at http://wiki.x.org
 for help. 
[   187.226] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[   187.227] (EE)

[/simterm]

Уже намного лучше.

Бутаемся на всякий случай:

[simterm]

$ sudo reboot

[/simterm]

Проверяем наличие драйвера:

[simterm]

$ dpkg -l | grep nvidia
ii  nvidia-340                                                  340.101-0ubuntu0.14.04.1                               amd64        NVIDIA binary driver - version 340.101
rc  nvidia-352                                                  352.63-0ubuntu0.14.04.1                                amd64        NVIDIA binary driver - version 352.63
ii  nvidia-opencl-icd-340                                       340.101-0ubuntu0.14.04.1                               amd64        NVIDIA OpenCL ICD
rc  nvidia-opencl-icd-352                                       352.63-0ubuntu0.14.04.1                                amd64        NVIDIA OpenCL ICD
ii  nvidia-prime                                                0.6.2.1                                                amd64        Tools to enable NVIDIA's Prime
ii  nvidia-settings                                             331.20-0ubuntu8                                        amd64        Tool for configuring the NVIDIA graphics driver

[/simterm]

Выполняем настройку nvidia-340:

[simterm]

$ sudo dpkg-reconfigure nvidia-340

[/simterm]

Не помогло (

Reboot:

[simterm]

$ cat /var/log/Xorg.0.log | grep nvidia
[    17.693] (==) Matched nvidia as autoconfigured driver 1
[    17.693] (II) LoadModule: "nvidia"
[    17.693] (WW) Warning, couldn't open module nvidia
[    17.693] (II) UnloadModule: "nvidia"
[    17.693] (II) Unloading nvidia
[    17.693] (EE) Failed to load module "nvidia" (module does not exist, 0)
[    17.694] (==) Matched nvidia as autoconfigured driver 1
[    17.695] (II) LoadModule: "nvidia"
[    17.695] (WW) Warning, couldn't open module nvidia
[    17.695] (II) UnloadModule: "nvidia"
[    17.695] (II) Unloading nvidia
[    17.695] (EE) Failed to load module "nvidia" (module does not exist, 0)

[/simterm]

Попробовать вообще переустановить их?

[simterm]

$ sudo apt-get install --reinstall nvidia-340
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.2.0-41 linux-headers-4.2.0-41-generic
  linux-image-4.2.0-41-generic linux-image-extra-4.2.0-41-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 2 not upgraded.
Need to get 51,7 MB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://ua.archive.ubuntu.com/ubuntu/ trusty-updates/restricted nvidia-340 amd64 340.101-0ubuntu0.14.04.1 [51,7 MB]
Fetched 51,7 MB in 16s (3 170 kB/s)                                            
(Reading database ... 291180 files and directories currently installed.)
Preparing to unpack .../nvidia-340_340.101-0ubuntu0.14.04.1_amd64.deb ...                                                                                                                                                                     
Stopping nvidia-persistenced                                                                                                                                                                                                                  
nvidia-persistenced: no process found  
...

[/simterm]

Проверяем:

[simterm]

$ lsmod | grep nvidia
nvidia              10563584  0 
drm                   360448  4 i915,drm_kms_helper,nvidia

[/simterm]

Файлы модуля:

[simterm]

$ find /lib/modules/$(uname -r) -type f -name nvidia*.ko
/lib/modules/4.2.0-42-generic/updates/dkms/nvidia_340.ko
/lib/modules/4.2.0-42-generic/updates/dkms/nvidia_340_uvm.ko
/lib/modules/4.2.0-42-generic/kernel/drivers/video/fbdev/nvidia/nvidiafb.ko

[/simterm]

Ну, ОК, ребут.

Проверяем логи:

[simterm]

$ cat /var/log/gpu-manager.log | grep nvidia
Looking for nvidia modules in /lib/modules/4.2.0-42-generic/updates/dkms
Found nvidia module: nvidia_340.ko
Is nvidia loaded? yes
Was nvidia unloaded? no
Is nvidia blacklisted? no
Is nvidia kernel module available? yes
Skipping "/dev/dri/card1", driven by "nvidia-drm"
Skipping "/dev/dri/card1", driven by "nvidia-drm"
Skipping "/dev/dri/card1", driven by "nvidia-drm"
Skipping "/dev/dri/card1", driven by "nvidia-drm"
Has nvidia? yes
Is nvidia enabled? no
Is nvidia egl enabled? no
Is nvidia available? yes
Is nvidia egl available? no

[/simterm]

ОК, а intel драйвер? Это ноутбук, два видео, nvidia – картой, и intel – в CPU:

[simterm]

$ sudo apt-get install xserver-xorg-video-intel
[sudo] password for setevoy: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.2.0-41 linux-headers-4.2.0-41-generic
  linux-image-4.2.0-41-generic linux-image-extra-4.2.0-41-generic
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  xserver-xorg-video-intel
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 1 612 kB of archives.
After this operation, 3 209 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/xorg-edgers/ppa/ubuntu/ trusty/main xserver-xorg-video-intel amd64 2:2.99.917+git20151202.da9ad388-0ubuntu0sarvatt~trusty [1 612 kB]
Fetched 1 612 kB in 1s (1 475 kB/s)                     
Selecting previously unselected package xserver-xorg-video-intel.
(Reading database ... 291180 files and directories currently installed.)
Preparing to unpack .../xserver-xorg-video-intel_2%3a2.99.917+git20151202.da9ad388-0ubuntu0sarvatt~trusty_amd64.deb ...
Unpacking xserver-xorg-video-intel (2:2.99.917+git20151202.da9ad388-0ubuntu0sarvatt~trusty) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up xserver-xorg-video-intel (2:2.99.917+git20151202.da9ad388-0ubuntu0sarvatt~trusty) ...
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...

[/simterm]

И – вуаля!

[simterm]

$ tail /var/log/Xorg.0.log
[   570.392] (II) config/udev: Adding input device Acer BMA150 accelerometer (/dev/input/event10)
[   570.392] (II) No input driver specified, ignoring this device.
[   570.392] (II) This device may have been added with another device file.
[   570.393] (II) config/udev: Adding input device Acer BMA150 accelerometer (/dev/input/js0)
[   570.393] (II) No input driver specified, ignoring this device.
[   570.393] (II) This device may have been added with another device file.
[   571.854] (II) intel(0): EDID vendor "AUO", prod id 12844
[   571.854] (II) intel(0): Printing DDC gathered Modelines:
[   571.854] (II) intel(0): Modeline "1366x768"x0.0   69.50  1366 1414 1446 1466  768 771 777 790 -hsync -vsync (47.4 kHz eP)
[   586.247] (II) XKB: generating xkmfile /tmp/server-4EECF4164384C62D89D7EB2533FDADA9A2DE6DE1.xkm

[/simterm]

Готово.