15

I'm attempting to connect to my Pi via VNC for the first time.

I performed the initial set up of the Pi in a headless fashion using a direct connection to my laptop (via an ethernet cable). I didn't use a monitor or keyboard, and had to fiddle around to ensure sshd was up and running. (See this thread: Initial setup without a monitor or keyboard)

The Pi is now connected to my home network, so there's no longer a need for the direct connection. I'm now attempting to access the Pi via VNC from my laptop, over the network.

I can create the session on the Pi (via ssh) using these instructions, but on connecting to the session with the laptop I hit the following error:

Xsession: unable to start X session --- no "/home/pi/.xsession" file, no "/home/pi/.Xsession" file, no session managers, no window managers, and no terminal emulators found; aborting.

I notice a similar question has been asked before, and with the only answer suggesting it should just work.

However, I'm using a Jessie Lite image, and this post would suggest that certain X windows packages are deliberately not included in the image.

So, should this just work, or are any additional X server packages required for the Lite image? (Does VNC actually require additional X server packages, or are all requirements pulled in when VNC is installed?)

Note that I haven't configured anything via raspbi-config.

  • 1
    Connecting to a system without X-server via VNC makes little sense. See unix.stackexchange.com/questions/129432/… – Ghanima Jan 31 '16 at 11:44
  • There definitely is no GUI installed on Raspbian lite, although it is not hard to add one. The default DE on normal Raspbian is LXDE, but I am not sure if apt-get install lxde will really pull in everything required. I believe there are apt "meta packages" for this but I am not familiar with them. You may have to create your own .Xsession but that is not hard, they are shell scripts usually containing only a couple of lines. – goldilocks Jan 31 '16 at 12:02
15

The error message is quite clear. You are missing a X enviroment , so install it :

sudo apt-get install xserver-xorg-core xserver-xorg-input-all \
xserver-xorg-video-fbdev libx11-6 x11-common \
x11-utils x11-xkb-utils x11-xserver-utils xterm lightdm openbox
  • 2
    Thanks very much. How did you determine that this set of packages is the one required? Just from experience? – Richard Horrocks Feb 6 '16 at 20:35
  • 3
    Yes , more or less. – flakeshake Feb 8 '16 at 7:50
4

Yes And No

Installing a vnc server will also get you an x server.
(Both the tightvncserver and vnc4server packages provide xserver).
This is enough for you to see and interact with graphical applications.

But you will really, really, really want an x window manager so that you can move the applications around on your screen, resize them, make them stop covering each other, switch between them, etc.
apt-cache search x-window-manager will return a large list of options.

Without a window manager: Without a Window Manager

With a window manager: With a Window Manager

Steps

You linked a good guide, but just for completeness, I'd like to post what I did here.

  1. Download and install vnc4server:

    pi@raspberrypi:~ $ sudo apt-get install vnc4server
    ...
    The following NEW packages will be installed:
      fontconfig-config fonts-dejavu-core libdrm-amdgpu1 libdrm-freedreno1 libdrm-nouveau2 libdrm-radeon1 libelf1
      libfontconfig1 libfontenc1 libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libice6 libllvm3.7 libsm6
      libtxc-dxtn-s2tc0 libutempter0 libx11-xcb1 libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0
      libxcb-shape0 libxcb-sync1 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxfont1 libxft2 libxi6
      libxinerama1 libxkbfile1 libxmu6 libxpm4 libxrandr2 libxrender1 libxshmfence1 libxt6 libxtst6 libxv1 libxxf86dga1
      libxxf86vm1 vnc4server x11-apps x11-common x11-session-utils x11-utils x11-xkb-utils x11-xserver-utils
      xbase-clients xbitmaps xfonts-base xfonts-encodings xfonts-utils xinit xterm
    0 upgraded, 58 newly installed, 0 to remove and 35 not upgraded.
    Need to get 25.0 MB of archives.
    After this operation, 74.8 MB of additional disk space will be used.
    
  2. Download and install a window manager:
    (I picked openbox since another answer mentioned it. I don't have a favorite since I usually just use ssh with no gui).

    pi@raspberrypi:~ $ sudo apt-get install openbox
    ...
    The following NEW packages will be installed:
      fontconfig giblib1 hicolor-icon-theme libatk1.0-0 libatk1.0-data libavahi-client3 libcairo2 libcroco3 libcups2
      libdatrie1 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgif4 libglade2-0 libgraphite2-3 libgtk2.0-0
      libgtk2.0-bin libgtk2.0-common libharfbuzz0b libid3tag0 libimlib2 libjasper1 libjbig0 libobrender29 libobt2
      libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpangoxft-1.0-0 libpixman-1-0 librsvg2-2 librsvg2-common
      libstartup-notification0 libthai-data libthai0 libtiff5 libxcb-render0 libxcb-shm0 libxcb-util0 obconf openbox
      python-xdg scrot
    0 upgraded, 43 newly installed, 0 to remove and 35 not upgraded.
    Need to get 11.5 MB of archives.
    After this operation, 44.8 MB of additional disk space will be used.
    
  3. Run vncserver:

    pi@raspberrypi:~ $ vncserver
    
    You will require a password to access your desktops.
    
    Password:
    Verify:
    xauth:  file /home/pi/.Xauthority does not exist
    
    New 'raspberrypi:1 (pi)' desktop is raspberrypi:1
    
    Creating default startup script /home/pi/.vnc/xstartup
    Starting applications specified in /home/pi/.vnc/xstartup
    Log file is /home/pi/.vnc/raspberrypi:1.log
    
  4. Connect using a vnc viewer and enjoy!

TightVNC Viewer is one option:
(I picked it because it is FOSS and has an MSI installer).
Remember to do :1!

You'll have to enter the password from earlier:
You will be prompted for the password you set.

  1. When you're done, kill your vnc server with:

     pi@raspberrypi:~ $ vncserver -kill :1
    

Looks like someone else figured out how to make the vncserver run at startup.

Tested on a fresh 2016-03-18-raspbian-jessie-lite install on my old Raspberry Pi B.

0

Sorry, the Raspbian Lite image does not include a graphical environment and as such a VNC connection would be counter productive. The official word from raspberrypi.org;

The lite version of Raspbian Jessie is just like the normal Raspbian Jessie operating system but without any of the graphical desktop environment packages. This means it’s much, much smaller than the normal image–it’s only about 1.3 gigabytes in size vs. over 4 gigabytes for the normal image

I would suggest that you either continue to use ssh for the connection from the laptop (use 'putty' if you're in Windows (configuration details here)) or re-install the full version of Jessie which includes the graphical components.

  • 8
    It took me all of 5 minutes to install a GUI to my taste with lite -- it would have taken me longer starting with Raspbian hefty. That extra 2.5 GB is way, way more stuff than just the GUI. You can do a full linux desktop install with pretty much any DE in 2 GB. Xorg itself is only something like 150 MB. As per usual, the Foundation are dumbing things down a bit much with that statement -- the real beast is Mathematica, not the desktop. – goldilocks Jan 31 '16 at 17:15
0

As per the other comments you need an X environment (however you achieve this). Attempting to start vnc via a SysV init seems to be problematical (although theoretically systemd should generate a .service). If you looked through some of the other links you would find a systemd script.

NOTE However you decide to run vnc you should initially run manually (via ssh if headless) to create the initial environment and set passwords.

0

Based on the other comments, it sounds like you need to install and configure the GUI.

Once you do, you might consider x11vnc; it's probably more like the VNC that you're expecting if you are used to Windows VNC. I came across this software setting up VNC on my own Pis and a few tutorials should help get you started (and one more).

When you ask "should it just work?" you reminded me of my frustrations dealing with the sometimes vastly different idiosyncrasies of FOSS software compared to Windows, so this might help you get back to a "just make it work" point so you can move on to what you were probably actually trying to do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.