Start ubuntu without a desktop environment but start an X application

  1. In /usr/share/xsessions/ create a file in the ".desktop" format to create your custom, minimal session. For running Google Chrome as the only application after logging in, do this:

    [Desktop Entry]
    Type=Application
    Exec=google-chrome
    Name=Google Chrome
    Comment=Testing
    
  2. Restart your display manager, e.g.

    sudo restart lightdm  # or kdm, gdm, etc.
    

    Or simply log out.

  3. "Google Chrome" should appear in the session list to select (next to regular Unity or other DEs you have installed).

    Log in and enjoy.

optional

  • XDM is a very minimal display manager - LightDM, GDM and KDM are quite "big". Install that using the package xdm Install xdm and reconfigure the default for when your system boots up using

    sudo dpkg-reconfigure lightdm
    
  • Configure your display manager to automatically log in a specific user. See the documentation for your display manager.


I know this one is outdated, but I couldn't see the correct answer for the request as I understand it, so here it goes:

I've had a project for creating an embedded system running a specific graphical java application on a simple computer with an Atom processor and a touch screen. My decision was to avoid the use of window managers as such, to keep it a) simple, b) light, and c) avoid all kind of system messages bursting to the screen.

The system looks like this:

  1. Installing the base Ubuntu system, lightest variant of 12.04 (still close to 1GB, but ok for me even on a 2GB flash disk). You can torture it a bit to make a smaller installation, of course, there are several ways for that. Also, you don't have to use Ubuntu, but then my instructions below should be reviewed - there are differences between distributions, especially on configuration files and their locations.

  2. Installing the xorg and some other nice pieces of helpful software, like the xinput-calibrator for my resistive touchscreen, ifplugd for live ethernet connection detection, acpid for power button operation detection and so on.

  3. Open /etc/init/tty1.conf and change exec /sbin/getty -8 -i 38400 tty1 line to something like exec /sbin/getty -8 -i 38400 tty1 -a username, where "username" is the name of the user you want to auto-login.

  4. To start the X session automatically, open your user's .bashrc file ~/.bashrc and add something like this to the end of the file:

    if [ $(tty) == "/dev/tty1" ]; then
        while true; do startx -- -nocursor -depth 16; echo "Again [$?]..."; done
    fi
    

    (The -nocursor stuff is for touchscreens, remove it for normal screen to see the mouse pointer) This will respawn the X server, so if your application quits for any reason, it will restart the X server automatically.

  5. Now in your user's .xsession file, ~/.xsession, write something like this (remember that each command here is executed in series, so use the & symbol at the end of the line if you want to launch a server):

    xrandr --output VGA1 --mode 800x600      #For setting a video mode
    xrandr --fb 800x600                      #Not always required, sets the framebuffer size
    xsetbg -center background.png &          #To set the background, comes from the xloadimage package
    xset -dpms s off                         #To avoid screen going blank after a while
    ~username/start.sh                       #Start your application
    #You can put some other application calls here that will be run when your application exits
    

There are plenty of other things to consider for such a system, this is only the basic setup. Hope it helps someone. Good luck.


In the olden days, you could just run X, and X would fire up with a blank screen. Then you could set DISPLAY=:0 and run something there. Perhaps this still works? From a shell you'll want X& to background it.

Look into the -geometry standard X command line parameter to adjust the placement of the window, since you won't have a window manager to help you with that.

To run something as non-root, you'll need to look into xauth to set up X authorization for the non-root user.


(My reputation is too low to comment. --> I used the solution posted by @gertvdijk and experienced the same problem as @tumbudu)

If you don't have access to google chrome (Alpine Linux), the firefox package lets you pass the screen resolution that the app should open with as parameters:

firefox -height 1920 -width 1080