Auteur Sujet: Ubuntu Openbox Remix 12.04 without a session manager (lighter)  (Lu 7342 fois)

0 Membres et 1 Invité sur ce sujet

Hors ligne melodie

  • Administrateur
  • Membre Héroïque
  • *****
  • Messages: 1777
    • Citrotux
I have done this in a Virtualbox machine where I installed Bento2 (Ubuntu Openbox Remix) and updated it.

The first aim is to gain on memory and come to use less than 100 MB RAM in Virtualbox when idle, even with the Virtualbox additions installed and running. The second subsequent goal to achieve will be to be able to reach the desktop in a shorter time.

Lightdm is one of the components which uses the more RAM when the system is idle. Therefore, in a virtual machine, or in a machine with low specs, let's get rid of it and of any other unnecessary bits.

First, I removed lightdm along with the configuration files, then removed all plymouth packages which can be possibly removed without breaking the system. The plymouth packages removed are:
* plymouth-label
* plymouth-theme-solar
* plymouth-theme-text
* plymouth-theme-ubuntu-text

but not
libplymouth2 and plymouth because while trying to remove them it is obvious that doing so would break the system.

I had to modify Grub2 to boot to init 3. To do so I edited /etc/default/grub. First I did a backup of the file:
$ cd /etc/default
$ sudo -s
# cp grub grub-BACKUP

then searched for these two lines:
Citer
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

and changed them to:
Citer
GRUB_CMDLINE_LINUX_DEFAULT=
GRUB_CMDLINE_LINUX="3"

after that still as root:
# update-grub
this command updated the /boot/grub.cfg configuration file. (I is also possible to edit grub.cfg but I find the /etc/default/grub less crowded and therefore easier to work on).

Then something will be needed so that obsession (the power management gui) still works correctly, that's to say provides all the features such as shutdown, reboot, suspend, hibernate, logout and cancel. A configuration file for polkit will have to be added into the system, otherwise, we will only get "Logout" and "Cancel", which might seem a bit short.

Here is a configuration file fit for our purpose, which we can name "55-myconfig.pkla", make it belong to root:root with 644 permissions and install to /etc/polkit-1/localauthority/50-local.d

Here is a content to allow the first user to shutdown and reboot, even if there is another session started:
[Storage Permissions]
Identity=unix-group:sudo
Action=org.freedesktop.udisks.filesystem-mount;org.freedesktop.udisks.drive-eject;org.freedesktop.udisks.drive-detach;org.freedesktop.udisks.luks-unlock;org.freedesktop.udisks.inhibit-polling;org.freedesktop.udisks.drive-set-spindown;org.freedesktop.udisks.filesystem-unmount-others
ResultAny=yes
ResultActive=yes
ResultInactive=no

[Redemarrage kinik root]
Identity=unix-group:sudo
Action=org.freedesktop.consolekit.system.stop;org.freedesktop.consolekit.system.stop-multiple-users;org.freedesktop.consolekit.system.restart;org.freedesktop.consolekit.system.restart-multiple-users
ResultAny=yes
ResultActive=yes
ResultInactive=no

[UPowser suspend hibernate]
Identity=unix-group:sudo
Action=org.freedesktop.upower.suspend;org.freedesktop.upower.hibernate
ResultAny=yes
ResultActive=yes
ResultInactive=no

If you want the system to refuse a reboot or shutdown when other users/sessions are opened, then remove these parts from the custom polkit configuration file:
org.freedesktop.consolekit.system.stop-multiple-users and org.freedesktop.consolekit.system.restart-multiple-users

Now we can login from a tty, or if we want to boot directly to the desktop without the need to login we can install nodm. We are still root in the console and we assume we have already invoked "apt-get update" as root at least once, so we just type:
# apt-get install nodm
which returns:
Citer
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances       
Lecture des informations d'état... Fait
Les NOUVEAUX paquets suivants seront installés :
  nodm
0 mis à jour, 1 nouvellement installés, 0 à enlever et 0 non mis à jour.
Il est nécessaire de prendre 0 o/31,5 ko dans les archives.
Après cette opération, 123 ko d'espace disque supplémentaires seront utilisés.
Préconfiguration des paquets...
Sélection du paquet nodm précédemment désélectionné.
(Lecture de la base de données... 114560 fichiers et répertoires déjà installés.)
Dépaquetage de nodm (à partir de .../nodm_0.11-1.1ubuntu1_i386.deb) ...
Traitement des actions différées (« triggers ») pour « man-db »...
Traitement des actions différées (« triggers ») pour « ureadahead »...
ureadahead will be reprofiled on next reboot
Paramétrage de nodm (0.11-1.1ubuntu1) ...
update-rc.d: warning: nodm stop runlevel arguments (0 1 6) do not match LSB Default-Stop values (none)
* Not starting nodm because NODM_ENABLED is 'false' in /etc/default/nodm

The part in red tells us we need to configure the nodm configuration file, so we will edit /etc/default/nodm and change the line:
NODM_ENABLED=false
to true:
NODM_ENABLED=true
and we will also change the line:
# User to autologin for
NODM_USER=root

to our login, because we don't want to login as root to X:
NODM_USER=melodie
logout, start nodm from a tty (you can access it with the keys Ctrl+Alt+F1, or F2 … F6 pressed together) and once logged to a tty type "sudo service nodm start", to get to the desktop. For now all is fine.

Let's see what happens next.
We hit "Quit" in the openbox main menu, we see we have all the options and we reboot.

That works! nodm has brought us to the desktop again. Reboot and shutdown, boot again, nodm brings us to the desktop, session after session.

This was really successful after a good handful of trials and errors at different stages. I have been helped on the way by caymus and coyotus, so thanks to them both.
Good leaders being scarce, following yourself is allowed.