ubuntu升級18.04進不了桌面
https://chengfeng.site/2018/05/02/ubuntu%E5%8D%87%E7%BA%A718-04%E8%B8%A9%E7%9A%84%E5%9D%91/
4月26日,ubuntu如期發布了其長期穩定版18.04,我的虛擬機內ubuntu是16.04,第一時間就升級了,除了遇到一個顯卡驅動兼容問題外,一切都很順利。解決這個問題也很簡單,在virtualbox設置界面中[顯示]選項去掉啟用3D加速即可。
看起來升級挺容易,沒什么問題,於是決定升級下公司工作用的那台ubuntu了。版本是17.04的,之前升級過一次,后邊沒有再次升級到最新的17.10。網上找了一圈,好像沒辦法直接從17.04升級到18.04,也就沒管了,直接用官方的方式先升級到17.10。
電腦比較渣,升級了半天才搞完,重啟后發現進不了桌面了,這就有點尷尬了。沒別的辦法google走起,方法也就是重裝桌面什么的。
“ctrl alt + f2”進入命令行界面后,鼓搗了下似乎沒啥作用,問題是apt update就執行不了。有點不想弄了,准備直接重裝,反正u盤都刻好了。但看了ubuntu提示當前版本17.10有新版本18.04可以升級,抱着試一試的態度直接又執行升級了,萬一升級后就好了呢!就像windows的重啟大法一樣。
等折騰了半天新版本升級安裝完成后,發現問題還是存在,繼續進不了桌面。這下沒法子了,只能硬着頭皮網上找方法。
找到的方法就是重裝桌面
sudo apt-get update sudo apt-get install --reinstall ubuntu-desktop sudo apt-get install unity
第一條執行就報錯了
➜ ~ sudo apt-get update Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease Could not resolve 'archive.ubuntu.com' Err:2 http://archive.ubuntu.com/ubuntu bionic-updates InRelease Could not resolve 'archive.ubuntu.com' Err:3 http://archive.ubuntu.com/ubuntu bionic-backports InRelease Could not resolve 'archive.ubuntu.com' Err:4 http://archive.ubuntu.com/ubuntu bionic-security InRelease Could not resolve 'archive.ubuntu.com' Reading package lists... Done W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Could not resolve 'archive.ubuntu.com' W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Could not resolve 'archive.ubuntu.com' W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Could not resolve 'archive.ubuntu.com' W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-security/InRelease Could not resolve 'archive.ubuntu.com' W: Some index files failed to download. They have been ignored, or old ones used instead.
排查了下是dns的問題,於是
sudo vim /etc/resolv.conf nameserver 8.8.8.8
然后還是不行
➜ ~ sudo apt-get update Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
這個是之前編輯過源的問題,只能是重新搞回來了。正好虛擬機的sources.list可以參考
vim /etc/apt/sources.list
寫入如下內容
deb http://archive.ubuntu.com/ubuntu bionic main restricted deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted deb http://archive.ubuntu.com/ubuntu bionic universe deb http://archive.ubuntu.com/ubuntu bionic-updates universe deb http://archive.ubuntu.com/ubuntu bionic multiverse deb http://archive.ubuntu.com/ubuntu bionic-updates multiverse deb http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu bionic-security main restricted deb http://archive.ubuntu.com/ubuntu bionic-security universe deb http://archive.ubuntu.com/ubuntu bionic-security multiverse
然后執行安裝,重啟搞定
18.04桌面有一個回收站和掛載的盤,因為我個人喜歡干干凈凈的桌面,所以想關掉這些圖標,而且窗口的控制最大化、最小化和關閉頁挪到了右邊有點不喜歡,這些都可以通過安裝gnome-tweak-tool來解決
sudo apt-get install gnome-shell gnome-tweak-tool
打開tewak就可以設置這些內容了
去掉桌面圖標
窗口控制按鈕挪到左邊
到這里基本就可以愉快的使用新版ubuntu 18.04了。