NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
[TOC] ## 问题 启动虚拟机后,是字符界面,Ctrl+Alt+ F7无法进入图形界面。 使用startx命令也无法启动 ``` /etc/X11/xinit/xserverrc: line 3: /usr/bin/X: No such file or directory /etc/X11/xinit/xserverrc: line 3: exec: /usr/bin/X: cannot execute: No such file or directory xinit: giving up xinit: unable to connect to X server: Connection refused xinit: server error ``` 解决办法 ``` sudo apt-get update sudo apt-get install xserver-xorg sudo apt-get install ubuntu-desktop ``` 错误提示如下所示: ``` $ sudo apt update Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease Hit:2 http://ca.archive.ubuntu.com/ubuntu bionic InRelease Hit:3 http://ca.archive.ubuntu.com/ubuntu bionic-updates InRelease Hit:4 http://ca.archive.ubuntu.com/ubuntu bionic-backports InRelease (appstreamcli:15814): GLib-CRITICAL **: g_strchug: assertion 'string != NULL' failed (appstreamcli:15814): GLib-CRITICAL **: g_strchomp: assertion 'string != NULL' failed (appstreamcli:15814): GLib-CRITICAL **: g_strchug: assertion 'string != NULL' failed (appstreamcli:15814): GLib-CRITICAL **: g_strchomp: assertion 'string != NULL' failed AppStream cache update completed, but some metadata was ignored due to errors. Reading package lists... Done Building dependency tree Reading state information... Done 1675 packages can be upgraded. Run 'apt list --upgradable' to see them. ``` 解决方案: ``` sudo sed -i -e 's/bionic/xenial/g' /etc/apt/sources.list ```