Ubuntu版本:12.04LTS  图形界面:unity2D

解决这个问题也有两星期了,写篇日志记录下,也算提供个方法。

博主完全linux新手,偶尔用ubuntu编程,并没有多少折腾系统的经验。某次开机时发现进入ubuntu图形桌面后,只有张壁纸,没有任何图标或任务栏,重启后才能正常。持续多次开机都有这样情况后,博主无法忍受,百度“Ubuntu桌面不正常”之类的,得到了此后让我折腾几天的“解决”指令:



$sudo apt-get remove gdm
$sudo apt-get install ubuntu-desktop
$sudo apt-get install gnome-core



sudo reboot后,直接连桌面都无法进入了,瞬间崩溃,由于是双系统,感觉重装ubuntu比较麻烦,而且之前配置了好多编程环境,只能尽力挽救。用Ctrl+Alt+F1/F2等发现可以进入命令行,在命令行下操作依然正常,于是我知道只是图形界面问题。

由于各种论坛提到的Ubuntu使用GNOME图形界面,于是博主3天都在看GNOME的使用,尝试了多种重装GNOME和gdm的指令,多次重启无果。直到发现原来之前用的图形界面是叫unity(晕,博主折腾系统零经验啊)于是卸载掉安装并不成功的GNOME,重转unity就行。大部分博文都是吐槽unity不好用,卸载unity装GNOME方法:  于是本人自作聪明,把相关指令的操作对象都换过来,以为就能卸载GNOME安装unity。(由于linux插件依赖关系较多,所以简单的互换对象并不能奏效)结果开机一直卡在Ubuntu的Logo,切换命令行后,用指令startx手动启动图形界面,得到警告如下:

                                                       

unity hololens 去掉logo unity 去除启动logo_操作系统

于是我决定顺藤摸瓜,搜索这类问题的解决方案,最后在天涯论坛找到和我一样的情况和解决办法,http://bbs.tianya.cn/post-itinfo-229777-1.shtml   一个ubuntu的英文网站(类似stackoverflow)给出了How can I remove and re-install Unity?的解答:

提炼出来就是:

Use this to Remove/Uninstall Compiz Unity:



sudo apt-get remove compizconfig-settings-manager
sudo apt-get remove compiz-fusion-plugins-extra
sudo apt-get remove compiz-plugins-extra
sudo apt-get purge compiz*



Then to Re-install Compiz Unity use:



sudo apt-get install unity-2d
sudo apt-get install ubuntu-desktop
sudo apt-get install ubuntu-desktop-2d
sudo apt-get install compizconfig-settings-manager
sudo apt-get install xserver-xgl
sudo apt-get install emerald
sudo apt-get install compiz-fusion-plugins-extra
sudo apt-get install git compiz-plugins-extra
sudo apt-get install compiz-plugins-extra
sudo apt-get install unity



 

这样就能顺利重装unity2d桌面,再安装桌面启动管理器dsktop manager如gdm/lightdm,才能免去开机手动启动图形界面的繁琐,日后也可以轻松切换各种桌面GNOME或者KDE。但后来发现安装gdm并不有效,于是



sudo dpkg-reconfigure gdm



移动光标选择lightdm为默认桌面管理器。最后,reboot再次见到熟悉的ubuntu用户登陆界面。