Ubuntu只能在终端上启动,我该如何恢复图形界面桌面?

我的Ubuntu桌面在哪里?它一直启动并默认进入终端屏幕,如果我按下Ctrl+Alt+F7仍然在终端,按下Ctrl+Alt+F1仍然在终端。

enter image description here

没有图形用户界面,怎么恢复它?

编辑:

sun@e700gent:/etc/X11$ sudo apt-get install --reinstall ubuntu-desktop
[sudo] password for sun: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libcdio-paranoia1 packagekit-backend-aptcc gdebi-core libxrandr-ltsq2 linux-headers-3.5.0-23-generic linux-headers-3.5.0-23 libcdio-cdda1 libllvm3.1
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 209 not upgraded.
Need to get 0 B/4,016 B of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 230006 files and directories currently installed.)
Preparing to replace ubuntu-desktop 1.267.1 (using .../ubuntu-desktop_1.267.1_amd64.deb) ...
Unpacking replacement ubuntu-desktop ...
Setting up ubuntu-desktop (1.267.1) ...

sun@e700gent:~$ unity --reset
WARNING: no DISPLAY variable set, setting it to :0

(process:2541): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
//bin/dbus-launch terminated abnormally with the following error: Autolaunch error: X11 initialization failed.

WARNING: environment is incorrect: No D-BUS daemon running

Did you just try to reset in a tty?
unity-panel-service: no process found
compiz (core) - Fatal: Couldn't open display :0




sun@e700gent:~$ sudo startx
[sudo] password for sun: 


X.Org X Server 1.11.3
Release Date: 2011-12-16
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.42-37-generic x86_64 Ubuntu
Current Operating System: Linux e700gent 3.5.0-36-generic #57~precise1-Ubuntu SMP Thu Jun 20 18:21:09 UTC 2013 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.5.0-36-generic.efi.signed root=UUID=68af0547-17ed-4a85-8369-244d57223f91 ro quiet splash vt.handoff=7
Build Date: 11 April 2013  01:05:39PM
xorg-server 2:1.11.4-0ubuntu10.13 (For technical support please see http://www.ubuntu.com/support) 
Current version of pixman: 0.24.4
    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, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Tue Jul 16 17:37:57 2013
(==) Using system config directory "/usr/share/X11/xorg.conf.d"

Fatal server error:
no screens found

Please consult the The X.Org Foundation support 
     at http://wiki.x.org
 for help. 
Please also check the log file at "/var/log/Xorg.0.log" for additional information.

 ddxSigGiveUp: Closing log
Server terminated with error (1). Closing log file.

编辑:

解决这个问题就像是火箭科学一样复杂,它无法修复。我不想再浪费时间来调试它,最终我重新安装了Ubuntu。


2试试输入sudo startx,看会发生什么? - Mitch
1@Mitch: 失败了(没运气) - user25165
1请将 /var/log/Xorg.0.log 的内容发布到 pastebin,并提供链接。如果不知道出了什么问题,您可以尝试将 /etc/X11/xorg.conf 和 /etc/X11/xorg.conf.d 目录中的所有文件移动到备份目录中。 - soulsource
1@soulsource: 请在这里找到:http://paste.ubuntu.com/5881280/ - user25165
1这很奇怪。看起来Intel显卡驱动程序找不到,或者更有可能的是无法使用您的显卡芯片。在您的系统停止工作之前发生了什么?硬件检测至少正确吗,也就是说,它是一块Intel显卡芯片吗? - soulsource
@soulsource:当我第一次安装并使用LiveCD时,它工作得非常完美,但突然间从磁盘运行时就完全不起作用了。但是当我使用LiveCD时它很好用。 - user25165
由於這似乎是一個Intel驅動程序的問題,你可以嘗試清除並重新安裝它:sudo apt-get purge xserver-xorg-video-intelsudo apt-get install xserver-xorg-video-intel,但我不太樂觀這會有所幫助。清除時要小心 - 我不知道還有哪些其他套件可能依賴它... 另一個可能的原因是你可能已經更新了這個套件到xserver-xorg-video-intel-lts-quantal - 在這種情況下,你可以嘗試刪除xserver-xorg-video-intel-lts-quantal並再次安裝xserver-xorg-video-intel。 - soulsource
@soulsource:刚刚尝试了,但仍然没有运气,它启动到纯命令行界面,没有任何图形用户界面。 - user25165
好的,我必须承认,我完全不知道还可能是什么原因。 - soulsource
sudo apt-get install --reinstall ubuntu-desktop 这个操作非常顺利地完成了。 - undefined
9个回答

试试这个。只需在键盘上按下Ctrl+Alt+T即可打开终端。当终端打开后,运行以下命令:
sudo apt-get install --reinstall ubuntu-desktop

1我只有SSH访问和CTRL+ALT+F1终端访问权限。在那里,我还重新安装了ubuntu-desktop。重启后仍然没有改变。 - user25165
1@YumYumYum - 你之前用的是哪个显示管理器?!以root身份进入保护模式,然后尝试重新安装不同的软件包: - dschinn1001
1@YumYumYum,我按下CTRL+ALT+F1后如何返回UI界面? - bits
2我在启动过程中按下Alt+F2打开了终端。希望这对某人有所帮助。 - hal
1也可以使用lubuntu-desktop :) - oscar1919
1也适用于gdm3(gnome)。 - rogerdpack
1我在启动过程中按下esc键进入恢复模式,并通过终端登录。这里有一些有用的信息:https://www.wikihow.tech/Recover-Ubuntu - vissu pepala
这救了我!!!xD - LeandroLuk
它就像魔法一样有效。你救了我一天的忙。我因为某种原因卸载了Python。重新安装后,一切都恢复正常了。 - Prashant Zombade

请按照以下说明进行操作:
  1. sudo dpkg --configure -a
  2. sudo apt-get install --reinstall ubuntu-desktop
  3. 重新启动计算机并进入桌面

当我在我的机器上遇到这个问题时,我只需删除 /etc/X11/xorg.conf 并重新启动系统。但是,我总是备份! :)

2没有任何xorg.conf文件。 - user25165
嗯..你可以试试这个:: sudo dpkg-reconfigure xserver-xorg但请小心操作,或者尝试看看YouTube上关于这个主题的视频。 - Rodislav Moldovan
尝试了但没有解决,很奇怪。 - user25165
2我刚组装了一台新电脑,把笔记本电脑的硬盘插入到了新的台式机中,但是却无法使得 X 能够在新的硬件上正常工作。删除了 xorg.conf 文件后,一切顿时完美地运行起来了!谢谢! - Brian

你之前用的是什么显示管理器?以root身份使用Ctrl + Alt + F1 进入保护模式,然后尝试重新安装以下软件包:
apt-get install --reinstall xorg-xserver*
apt-get install --reinstall gdm
apt-get install --reinstall unity

如果您使用的显示管理器不是gdm,请输入kdm或lightdm。
我以前也遇到过这个问题 - 关于nvidia驱动程序...

失败 - 无法正常工作,仍停留在终端屏幕,没有桌面界面。 - user25165
@YumYumYum - 你还没有告诉我你用的是哪个窗口管理器?是Unity吗?如果安装了Gnome或者KDE会发生什么? - dschinn1001
Unity,Ubuntu 默认桌面。 - user25165
@YumYumYum 你有看到我的第二个答案吗?离解决方法越来越近了吗? - dschinn1001
这对我来说很有效,在运行命令时在xorggdm3之间切换(Ubuntu 18)。 - mredig
我退出了i3窗口管理器,然后我的图形界面崩溃了。我遇到了与这个问题描述相同的问题。重新安装i3解决了这些问题。 - clickMe
这个解决方案对我起了作用! - Robert Long

以下是对我有效的两个命令,然后重新启动
sudo apt install xorg
sudo apt-get install --reinstall ubuntu-desktop

在Ubuntu论坛上发布了这个解决方案,以解决以下问题:
当你的启动日志中出现"Stopping userspace bootsplash"时:
安装专有驱动后,他们执行了以下操作:
按下Ctrl + Alt + F1(打开终端) 然后登录:
sudo apt-get clean

sudo apt-get autoclean

sudo apt-get autoremove

sudo dpkg-reconfigure -phigh -a

reboot

进入Grub恢复模式并选择“修复损坏的软件包”

reboot

按住Shift键进入grub菜单 按下E键将临时更改输入到grub中 在quiet splash旁边加上'vmalloc=192MB' F10 问题现在解决了吗?!
然后他们通过编辑/etc/default/grub文件来使更改变为永久性的。
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash vmalloc=192MB"

也许这个能解决你的问题?告诉我一声!

@YumYumYum - 你重启后解决了剩下的问题吗? - dschinn1001
不,这是 grub 修复模式,按下 shift 键时无法进入 "恢复模式"?好吧,但这已经很多了!现在 supergrub-CD 会有帮助吗?! - dschinn1001
步骤1:清理/自动清理/全部完成 步骤2:更改grub设置 步骤3:应用update-grub/update-grub2。但是我仍然遇到启动进入终端而没有图形界面的问题。 - user25165
你读过第二次重启后的那部分了吗?慢慢地读这些行。按下“Shift”键进入GRUB菜单,然后按下“e”键(用于编辑)-请参考上面的说明。 - dschinn1001
是的-那些都完成了,基本上如果你在登录后永久地做同样的事情。/etc/default/grub通过按下shift/e也是一样的。 - user25165
不知道该怎么办 - 可能是一些完全不同和平凡的事情:a) 你问这个人 - 他解决了:http://ubuntuforums.org/showthread.php?t=2147113 b) 这可能只是关于目录的错误拼写检查问题?就像这里:http://askubuntu.com/questions/65852/cannot-login-to-my-user-account/67723#67723 - 我没有找到更多的信息...很快就要睡觉了。 - dschinn1001
我删除了~/.Xauthority文件,但问题仍未解决(来自您提供的第二个链接)。 - user25165
让我们在聊天中继续这个讨论。 - dschinn1001
我只是通过执行清理、自动清理、自动删除和重新启动这些操作,就解决了我的问题。谢谢! - Tom

我遇到了同样的问题,这里发布的解决方案都没有起作用。 对我有效的是以下方法:
     sudo apt-get upgrade
     sudo reboot

在重新启动之前,apt-get update等命令无法正常工作。重新启动后,我打开了一个终端(Ctrl + Alt + T)并更新了所有内容。

    sudo apt-get update
    sudo apt-get dist-upgrade

一切似乎都运行正常。


如果您安装了图形用户界面并且它启动到命令行界面,那么您可以使用以下命令:
sudo service lightdm start

最近我遇到了这个问题。问题是更改默认显示管理器或删除与其相关的守护程序。我的默认显示管理器是gdm3,但我错误地安装了xdm,并因此在安装时选择了xdm。但当我意识到问题时,我删除了xdm,希望默认会回到gdm3,但并没有回到。相反,每次登录时都会弹出终端屏幕,这让人沮丧。起初很困惑,但只需要一行命令就可以解决问题... sudo apt install xdm 当弹出窗口以选择默认显示管理器时,请选择gdm3(是的,它仍然存在)并按ok。现在重新启动系统以让你微笑。