导致无法进入Ubuntu图形界面的原因很多,关键是要找到问题原因所在。
最佳的方法是查看.xsession-errors这个日志文件,依据问题解决~
这里先汇总一下问题:
1 环境变量导致的,进入tty1使用sudo vim profile or environment,将其还原,修正错误;
2 初始化文件出错,直接删除home/xxx下的.Xauthority,Xinit等,重启;
3 /home或/tmp等权限问题,使用chmod 777给文件夹加权限;
这些是常见问题,方法来自网络,但与本机情况不符合。
修复之前的问题是这样的:
LibGL error: Failed to load driver: swrast Script for ibus started at run_im. init: unity-settings-daemon main process ended,respawning init: hud main process (1537) terminated with status 1 init: unity-panel-service main process (1547) terminated with status 1 init: indicator-printers main process (1639) terminated with status 1 init: unity-settings-daemon main process (3284) terminated with status 1 init: gnome-session (Unity) main process (1540) terminated with status 1 init: indicator-bluetooth main process (1616) killed by TERM signal init: indicator-power main process (1620) killed by TERM signal init: indicator-datetime main process (1629) killed by TERM signal init: indicator-session main process (1643) killed by TERM signal init: indicator-application main process (1648) killed by TERM signal init: Disconnected from notified D-Bus bus
简单说,libGL和nvidia驱动出现了一些问题。
解决方法是重新安装驱动,电脑比较老旧,去官网下载.run驱动,将原有的驱动卸载掉。
默认软件源中340.96支持330m,可以更新nvidia软件源更新,在官网下载也可以,选用:
NVIDIA-Linux-x86_64-340.101.run
先要卸载原有驱动包括nvidia-340和nouveau,在tty1中命令行操作即可。
$ sudo apt-get remove nvida-340
$ sudo apt-get remove xserver-xorg-video-nouveau
安装驱动:
$ sudo apt-get install dkms
$ sudo service lightdm stop
sudo ./NVIDIA-Linux-x86_64-340.101.run
在出现界面中选择合适操作进行安装,装完后,重启,熟悉的桌面又回来了。心累;-)