Enabling framebufferr without X

October 3, 2016 217 views
Miscellaneous Ubuntu

I'd like to view images and graphics in a shell/terminal/command line without X.

Because I'd like to set up a fully remote development environment, and Emacs' Org-Mode uses PNG files to render LaTeX and of course to plot images, I'd like to be able to view simple PNG files in terminal mode.

Now, I can install a desktop, like Unity or a more lightweight one, and then use that to run GUI Emacs (or surf the internet for that matter). That works for rendering images. But it is more resource-heavy than I'd like.

I know this can be done with ImageMagick, Dvipng, or more probably fbi or fim, if I can get the framebuffer to work. Those tools work from the command line without an X window.

Is this possible? I'm working on an Ubuntu 14.04. Thanks!

  • A framebuffer is a feature of X. Even to run something like xvfb, you'll need to have X installed and running.

  • Hi rcvcaboose, thanks for chiming in. Below I've included a link where people discuss rendering images with a framebuffer but without X. Framebuffers don't appear to be enabled on Digital Ocean machines. More thoughts appreciated!

2 Answers
ryanpq MOD October 3, 2016
Accepted Answer

even xvfb would still require X so I would recommend going with a lightweight based solution. This script can be used from the CLI or as a user-data script on the create page and will set up a super lightweight remotely accessible desktop:

export DEBIAN_FRONTEND=noninteractive;
apt-get update;
apt-get -y install blackbox xterm;
add-apt-repository -y ppa:x2go/stable;
apt-get update;
apt-get -y install x2goserver x2goserver-xsession;

(If you run this as a user-data script it may take 5+ minutes to complete after your droplet comes online, you can view it's progress if you log in before it completes with tail -f /var/log/cloud-init-output.log (use Ctrl+c to stop tailing the file).

Once this script has finished running you can connect to it with the X2Go client. Select a "Custom Desktop" instead of one of the pre-defined options and enter "blackbox" as the command to run.

This will give you a window manager. Right-clicking the desktop will display a menu with one option being to start up xterm.

  • Hi ryanpq,

    Thanks for the really thorough answer! It sounds like X2Go is much like a VNC connection, enabling graphical support via a desktop connection. That's the conclusion I've come to as well - enabling framebuffers at a hardware level may not be possible on a DigitalOcean box.

    For reference, I relied on this post and this other post when attempting to render images without X support.

    Ideally, I'd like to use Prompt2 on the iPad to SSH into the machine. Such an SSH connection probably won't support X on the target machine, so I'll look in X2Go or a VNC connection.

    • Yes. X2Go serves a similar purpose as VNC. It's based on the NX protocol which tends to provide a better quality experience over various internet connection speeds than VNC in my opinion. I don't think there is an iOS client currently available so this guide can walk you through setting up VNC instead. You can swap out the xfce installation with blackbox or another lightweight WM and replace startxfce4 in the xstartup file that guide has you create with blackbox or openbox etc.

      In this guide, we will be setting up VNC on a Ubuntu 16.04 server and connecting to it securely through an SSH tunnel. The VNC server we will be using is TightVNC, a fast and lightweight remote control package. This choice will ensure that our VNC connection will be smooth and stable even on slower internet connections.
      • Thanks very much, that makes sense. Am I right that DO Linuxes don't have framebuffers, as in the discussions in the links above? I wasn't able to get that to run, despite modifying GRUB and so on.

Have another answer? Share your knowledge.