3

I would like to run a "naked" X server (using a framebuffer for output) on the Pi.

However, startx will also start LXDE, just as startlxde and startlxde-pi do, and I cannot find a way to get around that. (LXDE does work fine with the framebuffer and all. It's just that I don't need+want a full DE for an embedded, single application system.)

What's the right way to launch an X server without LXDE on the Pi?

(Linux raspberrypi 4.1.13+ #826 PREEMPT Fri Nov 13 20:13:22 GMT 2015 armv6l GNU/Linux)

1 Answer 1

2

xinit(1) is the script/command you are looking for!

Literal excerpt from the manpage:

EXAMPLES
Below are several examples of how command line arguments in xinit are used.

  • xinit This will start up a server named X and run the user's .xinitrc, if it exists, or else start an xterm.
  • xinit -- /usr/bin/Xvnc :1 This is how one could start a specific type of server on an alternate display.
  • xinit -geometry =80x65+10+10 -fn 8x13 -j -fg white -bg navy This will start up a server named X, and will append the given arguments to the default xterm command. It will ignore .xinitrc.
  • xinit -e widgets -- ./Xorg -l -c This will use the command .Xorg -l -c to start the server and will append the arguments -e widgets to the default xterm command.
  • xinit /usr/ucb/rsh fasthost cpupig -display ws:1 -- :1 -a 2 -t 5 This will start a server named X on display 1 with the arguments -a 2 -t 5. It will then start a remote shell on the machine fasthost in which it will run the command cpupig, telling it to display back on the local workstation.

Below is a sample .xinitrc that starts a clock, several terminals, and leaves the window manager running as the last application. Assuming that the window manager has been configured properly, the user then chooses the Exit menu item to shut down X.

    xrdb -load $HOME/.Xresources
    xsetroot -solid gray &
    xclock -g 50x50-0+0 -bw 0 &
    xload -g 50x50-50+0 -bw 0 &
    xterm -g 80x24+0+0 &
    xterm -g 80x24+0-0 &
    twm

Sites that want to create a common startup environment could simply create a default .xinitrc that references a site-wide startup file:

#!/bin/sh
. /etc/X11/xinit/site.xinitrc

Another approach is to write a script that starts xinit with a specific shell script. Such scripts are usually named x11, xstart, or startx and are a convenient way to provide a simple inter‐face for novice users:

#!/bin/sh
xinit /etc/X11/xinit/site.xinitrc -- /usr/bin/X -br
2
  • startx and xinit are really near synonyms. However, if you read the man page it does explain why they might end up invoking lxde, and from there you can get how to have them run something else (or nothing but X). Hint: It has to do with an initialization file with several potential names.
    – goldilocks
    Dec 25, 2015 at 8:29
  • Thanks for the hints. Reading up on xinit, which seems to require some more configuration, I got to the point of only running X (capital X!). That looks like what I wanted. If it turns out that it's not enough, I know that I should look into xinit now. Someone also recommended Matchbox as a light-weight alternative to a DE. Might give that a try too.
    – JimmyB
    Dec 25, 2015 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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