Can't run startx on tty

22,919

Remove nvidia drivers first:

sudo apt purge nvidia-*

Next allow Ubuntu to install recommended 396 driver:

sudo ubuntu-drivers autoinstall

Reboot your laptop:

sudo reboot

Since the Ubuntu 18.04 has been used, enable graphical environment by default:

sudo systemctl set-default graphical.target

If you want to start Gnome Desktop from a current session without GUI (multi-user environment), just execute:

sudo systemctl start gdm3.service

Update

Since hybrid graphics is in use, install nvidia-prime to switch between intel and nvidia graphics (it can be installed already):

sudo apt install nvidia-prime

Check which graphics card is being used:

prime-select query

You can see intel or nvidia as output of the command. If you see intel, switch to nvidia:

sudo prime-select nvidia

Reboot and check if the graphics works normally. If prime-select query returns nvidia, try to switch to intel:

sudo prime-select intel

reboot and see if everything is OK. If nothing helps, please, post in the text of question output of the command:

sudo lshw -c display
Share:
22,919

Related videos on Youtube

Lydia Cieszynska
Author by

Lydia Cieszynska

Updated on September 18, 2022

Comments

  • Lydia Cieszynska
    Lydia Cieszynska over 1 year

    I recently switched from win10 to Ubuntu because I don't use it for gaming anymore. When I installed it, I only had access to my desktop(gdm3) but a resolution of 800x600 which looked awful.

    Now that I installed all neccessary drivers, I get my full 1920x1080 resolution but I'm unable to access the GUI. (I can't get out of tty1.)

    SOLVED: Use Integrated Graphics (intel) as primary graphics: sudo prime-select intel

    This is what it says:

    >sudo startx
    
    X.Org X Server 1.19.6
    Release Date: 2017-12-20
    X Protocol Version 11, Revision 0
    Build Operating System: Linux 4.4.0-119-generic x86_64 Ubuntu
    Current Operating System: Linux <machine name> 4.15.0-30-generic #32-Ubuntu SMP Thu Jul 26 17:42:43 UTC 2018 x86_64
    Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-30-generic root=UUID=<uuid> ro  quiet splash pci=noaer 3
    Build Date: 13 April 2018 08:07:36PM
    xorg-server 2:1.19.6-1ubuntu4 (For technical support please see http://www.ubuntu.com/support)
    Current version of pixman: 0.34.0
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
    Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (II) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
    (==) Log file: /var/log/Xorg.2.log", Time: Sat Aug 11 20:56:06 2018
    (==) Using config file: "/etc/X11/xorg.conf"
    (==) Using config directory: /etc/X11/xorg.conf.d"
    (==) Using system config directory "/usr/share/X11/xorg.conf.d"
    

    And that is where it freezes and doesn't generate any output anymore. I let it like that for 2 hours with no change whatsoever.

    I'm using a MSI notebook with a gtx960M and Ubuntu 18.04. Further information on request.

    Can someone tell me how to fix this please? Because I really need this notebook for my work...

    Driver output:

    >ubuntu-drivers devices
    
    == sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
    modalias : pci:v000010DEd0000139Bsv00001462sd00001150BbcO3sc02i00
    vendor   : NVIDIA Corporation
    model    : GM107M [GeForce GTX 960M]
    driver   : nvidia-driver-390 - third-party free
    driver   : nvidia-driver-396 - third-party free recommended
    driver   : xserver-xorg-video-nouveau - distro free builtin 
    

    Freeze#2

    [ OK ] Started Daily apt download activities.
    [ OK ] Listening on UUID daemon activation socket.
    [ OK ] Started Discard unused blocks once a week.
           Starting Socket activation for snappy daemon.
    [ OK ] Started CUPS Scheduler.
    [ OK ] Listening on ACPID Listen Socket.
    [ OK ] Started Message of the Day.
    [ OK ] Started Daily apt upgrade and clean activities
    [ OK ] Started ACPI Events Check.
    [ OK ] Reached target Paths.
    [ OK ] Started Trigger anacron every hour.
    [ OK ] Listening on CUPS Scheduler.
    [ OK ] Reached target Timers.
    [ OK ] Listening on D-Bus System Message Bus Socket.
    [ OK ] Listening on Socket activation for snappy daemon.
    [ OK ] Reached target Sockets.
    [ OK ] Reached target Basic System.
           Starting System Logging Service...
           Starting LSB: Record successful boot for GRUB...
           Starting Thermal Daemon Service...
           Starting LSB: Speech Dispatcher...
    [ OK ] Started D-Bus System Message Bus.
    [ OK ] Reached target Login Prompts.
           Starting Accounts Service...
           Starting Login Service...
           Starting Avahi mDNS/DNS-SD Stack...
    [ OK ] Started Run anacron Jobs.
    [ OK ] Started CUPS Scheduler.
           Starting rng-tools.service...
           Starting WPA supplicant...
           Starting LSB: automatic crash report generation...
           Starting Network Manager...
           Starting Restore /etc/resolv.conf if the system crashed before the ppp link was shut down...
    [ OK ] Started irqbalance daemon.
           Starting Dispatcher daemon for systemd-networkd...
           Starting Detect the available GPUs and deal with any system changes...
    [ OK ] Started Set the CPU Frequency Scaling governor.
           Starting Bluetooth service...
    [ OK ] Started Regular background program processing daemon.
           Starting Disk Manager...
    [ OK ] Started ACPI event daemon.
           Starting Save/Restore Sound Card State...
           Starting Modem Manager...
           Starting Snappy daemon...
    [ OK ] Started System Logging Service.
    [ OK ] Started Restore /etc/resolv.conf if the system crashed before the ppp link was shut down.
    [ OK ] Started Save/Restore Sound Card State.
    [ OK ] Started Thermal Daemon Service.
    [ OK ] Started Login Service.
    [ OK ] Started LSB: Speech Dispatcher.
    [ OK ] Started LSB: automatic crash report generation.
    [ OK ] Started rng-tools.service.
           Starting Authorization Manager...
    [ OK ] Started Detect the available GPUs and deal with any system changes.
    [ OK ] Started Bluetooth service.
    [ OK ] Reached target Bluetooth.
    [ OK ] Started Avahi mDNS/DNS-SD Stack.
    [ OK ] Started Make remote CUPS printers available locally.
           Starting Hostname service...
    [ OK ] Started LSB: Record successful boot for GRUB.
    [ OK ] Started Authorization Manager.
    [ OK ] Started Raise network interfaces.
    [ OK ] Started Accounts service.
    [ OK ] Started Modem Manager.
    [ OK ] Started Hostname Service.
    [ OK ] Started Disk Manager. 
    

    nvidia-smi / uname -r

    >nvidia-smi
    
    Sat Aug 11 23:01:59 2018
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 396.51                 Driver Version: 396.51                    |
    |-----------------------------------------------------------------------------+
    | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
    |===============================+======================+======================|
    |   0  GeForce GTX 960M    Off  | 00000000:01:00.0 Off |                  N/A |
    | N/A   49C    P8    N/A /  N/A |     13MiB /  2004MiB |      0%      Default |
    +-----------------------------------------------------------------------------+
    
    
    +-----------------------------------------------------------------------------+
    | Processes:                                                       GPU Memory |
    |  GPU       PID   Type   Process name                             Usage      |
    |=============================================================================|
    |    0      1164      G   /usr/lib/xorg/Xorg                             7MiB |
    |    0      2023      G   /usr/bin/gnome-shell                           5MiB |
    +-----------------------------------------------------------------------------+
    
    >uname -r
    
    4.15.0-30-generic
    

    lspci

    >lspci -knn | grep VGA -A3
    
    00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 530 [8086:191b] (rev 06)
        Subsystem: Micro-Star International Co., Ltd. [MSI] HD Graphics 530 [1462:115b]
        Kernel modules: i915
    00:14.0 USB controller [0c03]: Intel Corporation Sunrise Point-H USB 3.0 xHCI Controller [8086:a12f] (rev 31)
    

    Thanks in advance,

    Lydia

    • RalfFriedl
      RalfFriedl almost 6 years
      Log file: /var/log/Xorg.2.log" indicates that there are already two sessions running. Try Alt+Ctrl+F7.
    • Lydia Cieszynska
      Lydia Cieszynska almost 6 years
      Did so. It gives me a blackscreen with the shell cursor blinking in the top left.
    • Bob
      Bob almost 6 years
      @LydiaCieszynska Could you please post output of the command ubuntu-drivers devices
    • Lydia Cieszynska
      Lydia Cieszynska almost 6 years
      @Bob added it..
  • Lydia Cieszynska
    Lydia Cieszynska almost 6 years
    Did as you told me but the result is the same. Xorg.2.log has changed to Xorg.log but I think that I previously just tried to run startx in two ttys...
  • Bob
    Bob almost 6 years
    @LydiaCieszynska I can't understand, do you use multi-user or graphical target by default? Your Ubuntu is 18.04 version. Just start gdm3.service instead of startx, just execute: sudo systemctl start gdm3.service
  • Bob
    Bob almost 6 years
    @LydiaCieszynska See updated answer.
  • Lydia Cieszynska
    Lydia Cieszynska almost 6 years
    Executed the commands in your update but all I get now is the cursor in the top left. It's not even blinking now. Could my GRUB arguments ro quiet splash pci=noaer 3 might interfere with that?
  • Bob
    Bob almost 6 years
    @LydiaCieszynska Try to remove pci=noaer and add nomodeset, thus the full line will look: ro quiet splash nomodeset
  • Bob
    Bob almost 6 years
    @LydiaCieszynska Another possibility is to try 390 driver instead of 396. Purge all of nvidia: sudo apt purge nvidia-*, install nvidia 390 driver: sudo apt install nvidia-driver-390 and reboot: sudo reboot
  • Lydia Cieszynska
    Lydia Cieszynska almost 6 years
    See my updated answer. It freezes again. I will try the 390-Driver now..
  • Bob
    Bob almost 6 years
    @LydiaCieszynska Post output of nvidia-smi and uname -r commands. There is known bug for some Nvidia cards and some older kernels. Read this: bugs.launchpad.net/ubuntu/+source/nvidia-prime/+bug/1764005
  • Bob
    Bob almost 6 years
    @LydiaCieszynska One more suggestion. Reboot and execute journalctl -k -b > /home/user/journal.log - replace user with your real username and post the file journal.log somewhere on pastebin.ubuntu.com
  • Lydia Cieszynska
    Lydia Cieszynska almost 6 years
    Nvidia Driver 390 also freezes... Journal.log: termbin.com/zt3u I also posted the nvidia-smi and uname-r Sigh...
  • Bob
    Bob almost 6 years
    @LydiaCieszynska Do you have hybrid graphics (Intel+Nvidia)? Is it enabled in BIOS? Could you please post output of lspci -knn | grep VGA -A3
  • Lydia Cieszynska
    Lydia Cieszynska almost 6 years
    Good morning! :3 I added the command output. And yes I do use hybrid graphics. I'll do some googling on how to determine if its enabled. But it should, as it worked on win10.
  • Bob
    Bob almost 6 years
    @LydiaCieszynska Hi! Please, see new update under bold word Update. Use nvidia-prime to switch between intel and nvidia.
  • Lydia Cieszynska
    Lydia Cieszynska almost 6 years
    OMG! You're my hero! It works now after I switched to intel! And in full 1920x1080! Feel yourself kissed! <3
  • Bob
    Bob almost 6 years
    @LydiaCieszynska You are welcome! But the problem still exists - Nvidia doesn't work... If Intel is OK for you, you can mark the question answered. For Nvidia the problem looks a bug.
  • Lydia Cieszynska
    Lydia Cieszynska almost 6 years
    I will open a new question when Nvidia is required. Thank you so much!