{"id":657,"date":"2016-01-25T10:38:14","date_gmt":"2016-01-25T17:38:14","guid":{"rendered":"http:\/\/wmbuck.net\/blog\/?p=657"},"modified":"2016-02-03T10:55:47","modified_gmt":"2016-02-03T17:55:47","slug":"getting-a-gnome-desktop-in-vnc-under-ubuntu","status":"publish","type":"post","link":"https:\/\/wmbuck.net\/blog\/?p=657","title":{"rendered":"Getting a Gnome desktop in VNC under Ubuntu"},"content":{"rendered":"<p>There is a lot of old and wrong data out on the net about this. I think it is because of the continuing evolution of the desktop environment\/gnome\/unity etc., most of which I don&#8217;t understand.<\/p>\n<p>Below is the overall approach I use, and some things I had to do to make it work. I will use as an example getting up a vnc viewer screen on oregano showing a gnome desktop on cinnamon. Interestingly, it proved much harder on cinnamon (running Wily Werewolf) than on pepper or the Butcher box named kodi, both of which are running Trusty Tahr.<\/p>\n<p>On oregano the file \/usr\/local\/bin\/&lt;remote hostname&gt; contains a script to make an ssh connection to &lt;remote hostname&gt; and also to establish various ssh tunnels to that hostname (for example, to look at databases). In the case of hosts where I want to be able to open a graphical environment using vnc, the script will contain the following, among other things (here the remote host is cinnamon, and the port numbers in the command aren&#8217;t important, except that the &#8220;:3&#8221; has to match the &#8220;5903&#8221;. Selecting the port numbers carefully beccomes important if one has multiple such connections in play at once):<br \/>\n<code><br \/>\nssh uname@cinnamon vncserver -geometry 2400x1200 :3<br \/>\nssh -L *:5901:localhost:5903 -g uname@cinnamon<br \/>\n<\/code><br \/>\nwhich runs the vncserver command on cinnamon as user uname. The vncserver command looks for an xstartup file under ~\/.vnc\/xstartup. That file is the key. The (important) contents of the file are (line folding is not in the file):<br \/>\n<code><br \/>\n#!\/bin\/sh<br \/>\nunset SESSION_MANAGER<br \/>\n[ -r $HOME\/.Xresources ] &amp;&amp; xrdb $HOME\/.Xresources<br \/>\ngnome-session --disable-acceleration-check \u2013session=gnome-flashback &amp;<br \/>\n<\/code><br \/>\nI think that the parameter \u2013disable-acceleration-check is still required, as of this writing, but it is one thing I put in to try to solve the problem, and then had to do other things, and I haven&#8217;t yet gone back to test without it. In any case I&#8217;m pretty sure it can&#8217;t hurt, because acceleration is what we don&#8217;t have. (Update: I later found pepper didn&#8217;t work correctly till I put it in).<br \/>\n<!--more--><br \/>\nIncidentally, in debugging all this, I found it very useful to add \u2013debug to the parameter line for gnome-session. The log created by gnome-session goes into the .vnc directory and has a lot of poodah.<\/p>\n<p>Over the years the contents of the \u201c&#8211;session=\u201d parameter have changed. The main difficulty (as I understand it) is that since this will be run through the ssh pipe to a vnc screen, we cannot use a desktop manager which requires 3d acceleration hardware. However the \u201csession=\u201d parameter must correspond to a \u201csession\u201d file which has to exist in one of a set of possible places successively searched:<br \/>\n<code><br \/>\n~\/.config,<br \/>\n\/etc\/xdg,<br \/>\n\/usr\/local\/share<br \/>\n\/usr\/share (the final, and default).<br \/>\n<\/code><br \/>\nIn each directory what is sought is .\/gnome-session\/sessions\/&lt;session file&gt;. Most of the old stuff on the web refers to session files (like ubuntu-2d) that don&#8217;t exist anymore.<\/p>\n<p>As of now the session file that works is called gnome-flashback (it was formerly called gnome-fallback). It does not come standard with ubuntu anymore (at least on Wily). I found that it was present on Trusty on both pepper and kodi). Install it with:<br \/>\n<code><br \/>\napt-get install gnome-session-flashback<br \/>\n<\/code><br \/>\nThis installs \/usr\/share\/gnome-session\/sessions\/gnome-flashback-compiz.session and \/usr\/share\/gnome-session\/sessions\/gnome-flashback-metacity.session. On Trusty, I found that gnome-session\/sessions contained gnome-flashback-compiz.session and also gnome-flashback.session. Eventually I decided that I could just copy the one from Trusty, and use it on Wily. One can create their own version of this file pretty easily, and store it in ~\/.config\/gnome-session\/sessions.<\/p>\n<p>In ~\/.config\/gnome-session\/sessions\/gnome-flashback.session (line folding not in the file):<br \/>\n<code><br \/>\n[GNOME Session]<br \/>\nName=GNOME Flashback (Metacity)<br \/>\nRequiredComponenents=gnome-panel;unity-settings-daemon;metacity;nautilus-classic;gnome-flashback-services;<br \/>\nDesktopName=GNOME-Flashback<br \/>\n<\/code><br \/>\nThe components named (like gnome-panel) are each the name of an \u201capplication\u201d that exist as a \u201c.desktop\u201d file (e.g. gnome-panel.desktop), also in one of a sequence of possible locations:<br \/>\n<code><br \/>\n~\/.config\/autostart,<br \/>\n\/usr\/local\/share\/gnome\/autostart,<br \/>\n\/usr\/share\/gnome\/autostart,<br \/>\n\/etc\/xdg\/autostart,<br \/>\n~\/.local\/share\/applications,<br \/>\n\/usr\/local\/share\/applications,<br \/>\n\/usr\/share\/applications\/<br \/>\n<\/code><\/p>\n<p>So the first hurdle is to have the xstartup file specify a session file that actually exists in gnome-session\/sessions\/*, and it has to be one that does not require 3d acceleration.<\/p>\n<p>The next hurdle, for me (in Wily), was in the gnome-panel.desktop file, started by the session file. The gnome-panel \u201capplication\u201d is (I think) not used by the more modern gnome sessions \u2013 it was loaded (into \/usr\/share\/applications) by the install of gnome-session-flashback. But the gnome-panel.desktop file loaded by the install contains a line:<br \/>\n<code><br \/>\nOnlyShowIn=GNOME-Flashback;<br \/>\n<\/code><br \/>\nThe trick here is that the name specified in OnlyShowIn has to match the \u201cDesktopName\u201d in the session file. There is not a \u201cDesktopName\u201d in either the gnome-flashback-compiz.session or the gnome-flashback-metacity.session files that got loaded on Wily, and so the gnome panel kept getting loaded on Wily even when I was logging into the ordinary Unity desktop. I needed to ensure that the OnlyShowIn= line in the desktop file matched the DesktopName= name in the session file. When I started using my own session file (as typed above), it worked.<\/p>\n<p>On cinnamon I have installed the session file and the desktop file in ~\/.config which will be preserved across reinstalls since my home directory persists.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There is a lot of old and wrong data out on the net about this. I think it is because of the continuing evolution of the desktop environment\/gnome\/unity etc., most of which I don&#8217;t understand. Below is the overall approach I use, and some things I had to do to make it work. I will &hellip; <a href=\"https:\/\/wmbuck.net\/blog\/?p=657\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Getting a Gnome desktop in VNC under Ubuntu<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,9],"tags":[],"class_list":["post-657","post","type-post","status-publish","format-standard","hentry","category-linux","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/657"}],"collection":[{"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=657"}],"version-history":[{"count":10,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/657\/revisions"}],"predecessor-version":[{"id":695,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/657\/revisions\/695"}],"wp:attachment":[{"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=657"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=657"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=657"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}