这次使用VNC Viewer远程连接Ubuntu 14.04 系统之路并不顺畅。根据之前的博客,能够顺利连接上,但是连上之后发现没有菜单栏(menu)(有没有桌面我也忘了)。花了很久时间才解决,在此记录之。
在此过程中,针对该类问题总结出了几条原则:
.vnc/
下面的log要多看,里面都记录了诸如报错之类的问题;我的VNC Viewer连接服务器上的Ubuntu 14.04 的过程是按照我之前的博客来的:
但是这次却和本地Windows远程连接阿里云服务器图形界面(使用vnc viewer) 里面显示的桌面不一样。没有菜单栏,中间甚至还有灰屏的情况。
由于我尝试了很多方法,安装了包括vncserver, vnc4server, tightvncserver, vino, gdm, LXDE, gnome, xfce4 等等等等package。。。
所以整个就乱套了。所以不得不清空一波。
具体的相关指令如下(仅供参考):
# find all vnc-related folder
sudo find / -iname "*vnc*" # No.1
# rm files
rm .xsession-errors
rm .Xauthority
rm .Xresources
rm /etc/alternatives/vncconfig
# rm xrdp
sudo dpkg -P xrdp
# purge packages about xfce4
sudo apt-get purge xfconf xfce4-utils xfwm4 xfce4-session xfdesktop4 exo-utils xfce4-panel xfce4-terminal thunar
sudo apt-get remove xfce4-*
sudo apt-get autoremove
# find vnc-related packages already installed
dpkg -l | grep vnc # No.2
dpkg -P remmina-plugin-vnc
dpkg -P libvncserver0
# find and rm server-related packages already installed
dpkg -l | grep server # No.3
dpkg -l | grep x-
sudo apt-get purge xserver-*
sudo dpkg -P x11-xfs-utils
sudo dpkg -P vino
sudo dpkg -P xinit
# reboot for refreshing (seems not necessary)
sudo reboot
# auto-remove vnc4server
sudo apt-get remove vnc4server # No.4
sudo apt-get remove --auto-remove vnc4server
sudo apt-get purge vnc4server
sudo apt-get purge --auto-remove vnc4server
# auto-remove other packages
sudo apt-get remove --auto-remove xvnc4viewer
sudo apt-get remove --auto-remove tightvncviewer
sudo apt-get remove --auto-remove vncviewer
sudo apt-get remove --auto-remove xinit
# find and rm server-related packages already installed
dpkg -l |grep desktop # No.5
grep installed /var/log/dpkg.log | grep xdg-utils # show installed time # No.6
sudo apt-get remove unity-*
sudo apt-get remove --auto-remove LXDE
sudo apt-get remove --auto-remove desktop-*
sudo apt-get remove --auto-remove gnome-panel
sudo apt-get remove --auto-remove gnome-settings-daemon
sudo apt-get remove --auto-remove metacity
sudo apt-get remove --auto-remove nautilus
sudo apt-get remove --auto-remove gnome-terminal
sudo apt-get remove --auto-remove ubuntu-desktop
sudo apt-get remove --auto-remove remmina-plugin-rdp
sudo apt-get remove --auto-remove lxmenu-data
# also rm
sudo dpkg -P desktop-base
P.S. 从 # No.1
到 # No.6
是几个关键的查找指令(已标注在上面代码中)。
运行完这些指令之后,我感觉基本就算清理的差不多了。
在此过程中参考了一些文献:
主要参考:
(补充:How to install VNC server on ubuntu 14.04似乎更加详细,但是暂时没用上。)
期间稍作修改,具体如下:
1)安装Ubuntu-desktop
sudo apt-get install --no-install-recommends ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal gnome-core
2)安装vnc4server:
sudo apt-get install vnc4server
3)修改配置:
我没有修改:/usr/bin/vncserver
文件,而是直接vncserver,然后需要输入密码,然后会自动创建~/.vnc/
文件夹,包含xstartup
可执行文件,因此,我直接修改这个xstartup文件,删除其中原有内容,添加新内容如下:
#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
3.1)我还做了如下修改,运行:
sudo cp -rf .local .local-bk # original owner: root, and seems save some files for python3.6, and also some other files.
sudo chown -R apr:apr .local
不然的话,.vnc/下的log会提示permission的错误。
4)添加alias,nano ~/.bashrc
,在末尾添加如下行:
alias vkill='vncserver -kill :1'
alias vnc2='vncserver :1'
alias vnc='vncserver :1 -geometry 1920x1080'
然后 . ~/.bashrc
使其生效。(往后可以直接运行vkill
停止vnc进程,以及直接运行vnc
或者vnc2
来开启vnc,很方便)
至此,菜单栏已经出现。
查看log显示:
(gnome-control-center.real:27532): Gdk-ERROR **: The program 'gnome-control-center.real' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadRequest (invalid request code or no such operation)'.
(Details: serial 136 error_code 1 request_code 149 (RANDR) minor_code 8)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the GDK_SYNCHRONIZE environment
variable to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":1"
after 156 requests (154 known processed) with 0 events remaining.
大概知道解决方案在这个网页中:
I did a little test:
- upgraded to xorg 1.14
- switched from catalyst to xf86-video-ati drive
Most of the errors dissappeared (GOA still crashes).
But now i can only see message tray using keyboard shortcut (super + m). I read that I need to move my mouse fast to the botton edge of my screen - does not work - instead it show up randomly when i moved mouse near the bottom edge.
I don't want to use the open source drivers (slow and laggy with multi monitor setup I'm using). I hope gnome devs will fix this bugs soon.
SOLUTION (to still use catalyst):
I found out that this is an Xorg 1.12 bug.
Bug: http://lists.debian.org/debian-x/2012/12/msg00133.html
To solve this use patch from this bugreport to compile xorg 1.12
I used this aur packages:
1. https://aur.archlinux.org/packages/xf86-input-evdev1.12/
2. https://aur.archlinux.org/packages/xorg-server1.12/ - I have edited PKGBUILD to include patch from bug report above
PKGBUILD and patch:
https://gist.github.com/winglot/5450630
另外还有次要参考:Gdk-ERROR **: The program ‘_______’ received an X Window System error
但是我嫌麻烦,算了。以后有需要再说吧。
最坑我的要数这个文献:Vnc Ubuntu 14.04 destop don’t show menus icon 这是造成我后续数个小时挣扎的起源。这里面是这样配置的~/.vnc/xstartup
的:
#!/bin/sh
unset SESSION_MANAGER
/etc/X11/xinint/
xrdb $HOME/.Xresources
xsetroot -solid grey
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &
# Fix to make GNOME work
export XKL_XMODMAP_DISABLE=1
#/etc/X11/Xsession
gnome-session --session=gnome-fallback &
里面的:/etc/X11/xinint/
是个错别字,xinint
应该改为xinit
。而且就算改了,从.vnc/ 下的log以及连接的界面来看发现也还是有问题,总之问题多多,后面就陆续参考了其他文献,都失败了。这里简要列举一部分文献: