Copyright © 2015 jsd
There are three categories of things:
Example: lightdm is a display manager, and gdm is another.
In contrast: There are a lot of things that can go wrong with a display, so for machines that I care about, I set it up so that runlevel 2 does not start a display manager. Instead, there is a text-mode login.
Example: gnome-session is a session manager. Read the manpage for gnome-session for more information.
Example: compiz is a compositing window manager. Metacity is an another window manager. Metacity is older, simpler, more reliable, and places less of a burden on the graphics system and CPU. Allegedly mutter is another window manager, but I’ve never gotten it to work.
Ubuntu tries to make you use compiz, which is a problem if compiz is broken. A workaround is discussed in section 2.
Sometimes compiz is broken. I’ve seen this happen far too many times.
When the window manager is broken, the windowing system is unusable or nearly so. You may have no command prompt and no easy way of getting one. (This is one of the many reasons why it is nice to have a text-mode login available, as mentioned in section 1 and detailed in section 3.)
To verify that the symptoms are caused by a broken window manager, you can read your /.xsession-errors file. If it contains something like the following, you know you’ve got a broken compiz:
compizconfig - Info: Backend : gsettings compizconfig - Info: Integration : true compizconfig - Info: Profile : Default x-session-manager[2603]: WARNING: App 'compiz.desktop' exited with code 1 x-session-manager[2603]: WARNING: App 'compiz.desktop' respawning too quickly x-session-manager[2603]: CRITICAL: We failed, but the fail whale is dead. Sorry.... compiz (core) - Info: Loading plugin: core compiz (core) - Info: Starting plugin: core compiz (core) - Info: Loading plugin: ccp compiz (core) - Info: Starting plugin: ccp compiz (core) - Info: Loading plugin: composite compiz (core) - Info: Starting plugin: composite compiz (core) - Info: Loading plugin: opengl compiz (core) - Info: Starting plugin: opengl compizconfig - Info: Backend : gsettings compizconfig - Info: Integration : true compizconfig - Info: Profile : Default x-session-manager[2603]: WARNING: App 'compiz.desktop' respawning too quickly x-session-manager[2603]: WARNING: App 'compiz.desktop' exited with code 1 x-session-manager[2603]: WARNING: App 'compiz.desktop' respawning too quickly
I have no idea why compiz is failing.
The simplest way forward is to forget about compiz and use metacity instead. It is less fancy but perfectly reasonable.
Here are some of the required steps:
This brings in the metacity window manager, and some configuration files that can be used to tell gnome-session that we want to use metacity instead of compiz.
The configuration files are stored in /usr/share/gnome-session/sessions on my machine.
The key is to pass the --session=gnome-fallback argument to gnome-session. I did this by editing the file /etc/X11/Xsession.d/99x11-common-start from
echo "$STARTUP" > /tmp/foobar exec $STARTUP
to
echo "$STARTUP" > /tmp/foobar exec $STARTUP --session=gnome-fallback
That seems like a bit of a hack, but I couldn’t think of any cleaner way of doing it
Also note: Your .xinitrc is probably calling (directly or indirectly) x-session-manager.
However: /usr/bin/x-session-manager is a symlink to /etc/alternatives/x-session-manager which is a symlink to /usr/bin/gnome-session which is an actual session manager.
As mentioned in section 1, for machines that I care about, I like to set it up so that in runlevel 2 there is no display manager. Instead there is a text-mode login.
Once I am logged in, if I want to start a windowing system, I can always give the startx command.
Here is an outline of how to set this up. Let’s use lightdm as an example; gdm is very similar.
start on ((filesystem and runlevel [!06] and started dbus and plymouth-ready) or runlevel PREVLEVEL=S) stop on runlevel [016]
You need to change that to something like
start on (filesystem and runlevel [345] and started dbus and plymouth-ready) stop on runlevel [!345]
I have no idea what the ‘plymouth-ready’ event signifies. Let’s leave it alone.
start on (starting gdm or starting kdm or starting xdm or starting lxdm or starting lightdm or starting uxlaunch or starting ubiquity or starting oem-config or stopped rc RUNLEVEL=[2345] or starting rcS or starting mountall-shell)
You need to add a term involving runlevel 2, so it looks like:
start on (starting gdm or starting kdm or starting xdm or starting lxdm or starting lightdm or starting uxlaunch or starting ubiquity or starting oem-config or runlevel 2 or stopped rc RUNLEVEL=[2345] or starting rcS or starting mountall-shell)
If you skip this step, ugly things are going to happen when you boot into runlevel 2. The boot process will peter out, but no login prompt will appear, because plymouthd still owns the display. You can salvage the situation by hitting Alt-F4 ... but if you’re smart enough to think of that, you should be smart enough to prevent such a situation from arising. It’s simple: make sure plymouthd stops and the display-manager doesn’t start.
Here is the diff:
commit d1d713023430fa3ad7a9c31b77bb21a7b5077fc0 Author: John Denker <jsd@av8n.com> Date: Sun Mar 22 18:48:36 2015 -0700 setup for text-mode login in runlevel 2 diff --git a/lightdm.conf b/lightdm.conf index ff9201d..4dc0f6f 100644 --- a/lightdm.conf +++ b/lightdm.conf @@ -8,13 +8,12 @@ description "LightDM Display Manager" author "Robert Ancell <robert.ancell@canonical.com>" -start on ((filesystem - and runlevel [!06] +start on (filesystem + and runlevel [345] and started dbus and plymouth-ready) - or runlevel PREVLEVEL=S) -stop on runlevel [016] +stop on runlevel [345] emits login-session-start emits desktop-session-start diff --git a/plymouth-stop.conf b/plymouth-stop.conf index 8b86725..c68e9e1 100644 --- a/plymouth-stop.conf +++ b/plymouth-stop.conf @@ -13,6 +13,7 @@ start on (starting gdm or starting uxlaunch or starting ubiquity or starting oem-config + or runlevel 2 or stopped rc RUNLEVEL=[2345] or starting rcS or starting mountall-shell)
Copyright © 2015 jsd