DoudouLinux dev's blog

To content | To menu | To search

Tag - tricks

Entries feed - Comments feed

Wednesday 20 February 2013

Booting a DoudouLinux ISO from an USB key

The current stable version of DoudouLinux, Gondwana 1.x, requires to download a different file if you want to burn a CD or to write an USB key. Since Grub2 is now able to boot the kernel image that is contained into an ISO file, it is possible to boot a Live ISO written onto an USB key and then to only use the ISO file whatever the target support. This is of course very practical but doesn't work on Debian Squeeze Live images without a dedicated patch called findiso. We have included this patch in the latest development release, 2013-02, that will be turned into the next stable release Hyperborea 2.0 around April/May. Doing so provides several advantages:

  • Only one file to be downloaded, per language.
  • Easy system update on the USB key: just replace the ISO file with the newer one! (and update Grub parameters)
  • A single FAT partition can be preserved on the USB key, allowing the normal use of an USB key, especially on capricious systems that can only read FAT :p (do you really keep using these old-fashion systems???).
  • Ability to have several flavors of DoudouLinux on the same key, for example the stable release and the development one, or several languages.
  • Does not require to reformat the USB key and then should lead to better R/W access performances by preserving factory settings.

Of course it is better for DoudouLinux developers too since we don't need to test the USB image anymore. This also solves the issue we had with isohybrid images that don't run on every computer and also broke our persistence activation tool… So now let's see how to take benefit of this new feature :). Beware: the process to turn an ISO file into an USB live system is done from the command line! Ready?

Installing Grub2

NB: Here we are using Grub2 from a Debian system but, if you don't care about copying the kernel image and its ramdisk onto the USB key too, this should also be possible to use any other bootloader (no test ever achieved though).

You need to have Grub2 installed in your system. If not, install the corresponding package. A particularity of Grub2 is that it doesn't fit anymore on the very small 512 first bytes of a disk. It has then 2 alternatives:

  • If the first partition starts at the cylinder number 1 instead of number 0, there may be enough space after the first 512 bytes for Grub to copy all its files. As they are outside any partition, they should be preserved from any modification.
  • If there is not enough space before the first partition, Grub uses sectors in the first partition and records their position in the first 512 bytes. Of course the file system in the first partition may move these sectors without Grub knowing, this is then not 100% reliable.

If you are in the second situation and want to change to the first one, you have no other choice but reformatiing your USB disk. Grub displays a message during its installation when you are in the second situation.

So now let's install grub onto the USB key. We need to mount it and launch the Grub installation command:

$ sudo mount /dev/sdx1 /mnt/
$ sudo grub-install --force --no-floppy --root-directory=/mnt/ /dev/sdx

That's it! Take care of replacing the USB device path /dev/sdx by the actual path of your key ;).

Making the USB key bootable

(update of 2013/02/21)

Your USB key will probably not boot if you don't set its partition as active, the so-called boot flag. This operation can be quickly achieved with fdisk. First start fdisk onto your USB key:

$ sudo fdisk /dev/sdx

You should get a prompt. Type p to display information about your disk partitions:

Command (m for help): p

Disk /dev/sdh: 2 GB, 2070216704 bytes
64 heads, 62 sectors/track, 1019 cylinders
Units = cylinders of 3968 * 512 = 2031616 bytes

   Device Boot      Start         End      Blocks   Id  System 
/dev/sdh1               1        1019     2021665    b  FAT32
Command (m for help): 

As you can see, the boot flag (second column of the partition information table) is not set since there is no * sign in this column. So in the fdisk prompt, type a to activate the partition. fdisk will ask you to enter the partition number (ie. 1). You then just need to write the partition table by pressing w:

Command (m for help): a                                                   
Partition number (1-1): 1                                                 
Command (m for help): w                                                   

Copying files

You can now copy the ISO file – it takes few minutes, the Unicode font and the Grub background image:

$ sudo cp doudoulinux-2013-02-fr.iso /mnt/boot/
$ sudo cp /usr/share/grub/unicode.pf2 /mnt/boot/grub/
$ sudo mkdir /mnt/boot/grub/splash
$ wget
$ sudo mv witch-knight-grub.png /mnt/boot/grub/splash/background.png
$ sudo sync

We have chosen to put all the files into the /boot directory that Grub made, but you can choose any other directory on your USB key. The Unicode font is required if you want translated messages in the Grub splash screen. So now everything is ready to get DoudouLinux boot, except that Grub hasn't been configured…

Setting Grub2, quickly

The Grub configuration must be placed in the file “/mnt/boot/grub/grub.cfg” that does not exist yet. A very basic setting of Grub2, to start the ISO, is the following:

set timeout=5
set default=0

menuentry "DoudouLinux testing 2013-02" {
  set isofile=doudoulinux-2013-02-fr.iso
  loopback loop /boot/$isofile

  linux (loop)/live/vmlinuz findiso=boot/$isofile boot=live config locales=fr_FR.UTF-8 keyboard-layouts=fr keyboard-variant=oss keyboard-options=grp:alt_shift_toggle,terminate:ctrl_alt_bksp utc=yes timezone=Europe/Paris nox11autologin quiet splash nomodeset video=uvesafb:mode_option=640x480-16,mtrr=3,scroll=ywrap persistent persistent-subtext=doudoulinux username=tux hostname=doudoulinux
  initrd (loop)/live/initrd.img

Of course isofile is the name of the ISO you want to boot, change it to fit your needs! In these settings we tell Grub to mount the ISO file so that he can access the kernel image and the ramdisk image file into it. This feature is only needed to launch the kernel with the minimalistic system in the ramdisk. This minimalistic system will then use the boot parameter findiso to find the ISO file and mount it into the final Linux system, DoudouLinux.

If you wonder how we could have written so long a boot parameter line, well, that's just the LiveCD boot line with few arguments removed or added :). To retrieve it, mount the DoudouLinux CD and look in the file “isolinux/live.cfg”. Note that you may have to change the localization parameters of this boot command for your particular use:

  • locales → your language settings
  • keyboard-layouts → your keyboard layout
  • keyboard-variant → your keyboard variant
  • keyboard-options → your keyboard options
  • utc → whether your computer clock is UTC or local time
  • timezone → your timezone

Don't forget to unmount your key:

$ sudo sync
$ sudo umount /mnt/

So now you should have a booting USB key that launches DoudouLinux, except that the Grub screen is not very nice. Let's see how to improve this.

(update of 2013/02/21) NB: once you've launched DoudouLinux on your USB key, you can use its persistence tool to make a persistence file on the USB key so that your DoudouLinux system won't loose user's work :).

Setting Grub2 for real

In the following Grub configuration file we have added:

  • language settings, to get translated Grub messages
  • video modules to show the background image
  • colors and background image
  • classes to the DoudouLinux system entry, in case you want to graphically customize this entry

This is a bit more complicated but the result is as expected: a graphical boot as early as Grub! You now have no reason to not have DoudouLinux everywhere with you since it can also be on your USB stick of everyday use :).

set lang=fr

set timeout=5
set default=0

function load_video {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
  insmod png

if loadfont /boot/grub/unicode.pf2 ; then
  set gfxmode=640x480
  insmod gfxterm
terminal_output gfxterm

set locale_dir=/boot/grub/locale
insmod gettext

if background_image /boot/grub/splash/background.png; then
  set color_normal=black/black
  set color_highlight=black/white

menuentry "DoudouLinux testing 2013-02" --class doudoulinux --class gnu-linux --class gnu --class os {
  set isofile=doudoulinux-2013-02-fr.iso
  loopback loop /boot/$isofile

  linux (loop)/live/vmlinuz findiso=boot/$isofile noeject boot=live config locales=fr_FR.UTF-8 keyboard-layouts=fr keyboard-variant=oss keyboard-options=grp:alt_shift_toggle,terminate:ctrl_alt_bksp utc=yes timezone=Europe/Paris nox11autologin quiet splash nomodeset video=uvesafb:mode_option=640x480-16,mtrr=3,scroll=ywrap persistent persistent-subtext=doudoulinux username=tux hostname=doudoulinux
  initrd (loop)/live/initrd.img

Saturday 19 January 2013

DoudouLinux ISO relocalization

One issue we have with the DoudouLinux ISO images is that, since it is designed to start without any user interaction, localization parameters are preset inside the ISO and cannot be easily changed. While this can be acceptable for most language variations (eg. French from Canada and French from France do not differ that much), this can be a real issue for the keyboard layout and the timezone. Indeed, if you try to teach children the keyboard and that it outputs an Azerty layout while you only have Qwerty ones in your country, this is rather annoying… This is however the case between France (Azerty), Canada (Qwerty) and Switzerland (Qwertz) in which French is spoken. Currently the only official solution is to play with combinations of Left Alt+Shift to change between predefined CD keyboard layouts[1].

So, as we can't propose an ISO for each country and each timezone, we have created a ticket quite a long time ago about this issue[2]. The problem to solve is that localization parameters are computed at each CD boot. It is then not possible to make changes persistent without patching the Debian live tools we're using for DoudouLinux. The only solution right now is then to unpack an ISO, change whatever needed, then repack a new ISO. We are indeed lucky enough to not have to unpack the whole CD filesystem because the CD localization parameters need to be accessed during the early boot process and then are contained in the CD boot parameters. Our relocalization process is then simply the following:

  1. Unpack the ISO image
  2. Change the boot configuration file
  3. Repack the ISO image

To achieve this, we will use rsync and genisoimage from the Debian packages of the same name. So first let's “loop” mount the ISO then copy its content into an empty directory:

$ sudo mount -o loop doudoulinux-2012-10-fr.iso /mnt/
$ mkdir isofs
$ rsync -at --del /mnt/ isofs/

File copying just takes few seconds. Now we can directly edit the boot configuration file:

$ sudo nano isofs/isolinux/live.cfg

You will find inside two boot lines of the following form (it's a very long line):

append initrd=/live/initrd.img boot=live config locales=fr_FR.UTF-8 keyboard-layouts=fr,us,de keyboard-variant=oss,, keyboard-options=grp:alt_shift_toggle,lv3:ralt_switch,compose:menu,terminate:ctrl_alt_bksp notimezone nox11autologin quiet splash nomodeset video=uvesafb:mode_option=640x480-16,mtrr=3,scroll=ywrap live-media=removable  persistent persistent-subtext=doudoulinux username=tux hostname=doudoulinux  quiet

The first line is the default boot entry, the second one allows to disable any live persistence that would have been set formerly. You can change or add the following parameters:

  • locales, this is the interface language, eg. fr_FR.UTF-8
  • keyboard-layouts, self-explanatory, it can be a single layout, eg. fr, or a series, eg. fr,us,de
  • keyboard-variant if you need to use a particular variant, eg. the French variant in Canada fr-legacy
  • keyboard-options if you don't need all the stuff we added to DoudouLinux like Left Shift+Alt
  • notimezone can be replaced with a particular timezone, eg. timezone=America/Montreal
  • utc=yes sets the hardware clock to UTC, utc=no sets it to the local time

Note that if your machine is unluckily running Windows :p, you have to set the hardware clock to local time. If it runs Linux, you probably have to set it to UTC. On the other hand, if the hardware clock is the local time, preserving the setting no timezone should automatically get the correct date and time. A list of timezones can be found on Wikipedia. Concerning keyboard layouts, the answer is at the bottom of one of our README files. Finally language codes and country codes can be found on Wikipedia too.

So, for a Canadian/Québec setting, we might use the following parameters:


Now we have to recompute the MD5 checksum of the modified file since the ISO integrity can be checked using it:

$ MD5=$(md5sum isofs/isolinux/live.cfg | grep -o '^[^ ]*')
$ sudo sed -ri 's|^[^ ]+(\s+./isolinux/live.cfg)|'$MD5'\1|' isofs/md5sum.txt

And we now just have to repack the ISO:

$ TITLE=$(file doudoulinux-2012-10-fr.iso | grep -o "'[^']*'" | sed "s/'//g")
$ sudo genisoimage -o doudoulinux-2012-10-fr_CA.iso -b isolinux/isolinux.bin -c isolinux/ -no-emul-boot -boot-load-size 4 -boot-info-table -V "$TITLE" -cache-inodes -r -J -l isofs/

Of course, once the job is done, cleaning useless files is a good idea:

$ sudo rm -fr isofs/
$ sudo umount /mnt/

Here is a screenshot of the resulting environment that you can't currently get out of one of our CD's without modification:

DoudouLinux fr relocalized into fr_CA

That's it!

What we are now dreaming of is a simple set of web pages that would allow to queue such ISO customization online. Our web server would do the job of unpacking/setting/repacking using its own set of CD's and would then send an email to users for them to download the resulting ISO before it is removed to make room for other users :). Any volunteer?

PS: credits to the Linux Mint ISO relocalization tool for the source of the command lines.


[1] DoudouLinux CD's are often configured with Azerty, Qwerty and Qwertz keyboards

[2] Unfortunately our project management software is temporarily down…

Sunday 15 January 2012

LxLauncher: automatic icon size for a nicer interface

One issue we had in mind for a while is the fixed size of icons in LxLauncher. Depending on screen resolution, this size can be fitting well (small resolutions) or really too small (large resolutions). In the later case, the interface of advanced activities like “Whole DoudouLinux” and “Mini DoudouLinux” can look very empty, just as the screenshot that is unfortunately available on our DistroWatch page.

With automatic icon size computation, we are now able to get a similar rendering on various screen resolutions as shown on the photo composition below. In this case, screen resolutions are 1280×800 (HP), 1280×1024 (CRT display), 1024×768 (Dell) and 1024×600 (Genesi), leading to screen size ratios 5÷4, 4÷3 or between 16÷10 and 16÷9. If you want to give it a try, just download one of our recent dailybuilds, in English or French only.

Automatic icon size for LxLauncher

We hope then to not see this kind of screenshot anymore:

LxLauncher without automatic icon size

Now few words about the way we achieved it.

In Debian Squeeze, the LxLauncher version, v0.2.1, features icon size tuning in a configuration file, /etc/xdg/lxlauncher/settings.conf. This is an easy way to change the icon size but, of course, requires user action. This is why we've developed a shell script that is called during GDM initialization to adapt the icon size to the actual screen resolution. The algorithm is the following:

  1. compute screen surface in pixels-square
  2. compute the width of icons to have a given number of them in a given portion of the screen (45% in our script)
  3. compute the rounded number of icons per row using the previous width
  4. compute the final icon width using screen width and number of icons per row

This script is available on our SVN server. Its algorithm is designed to be independent of screen orientation since it does not uses the screen width to compute the icon size but the screen surface. We hope then to be able to run DoudouLinux on any device in the future, from the smallest handheld devices to the largest TV screens :).

Finally, what about the stable DoudouLinux release Gondwana? Well it is shipping with LxLauncher v0.2.0 which does not allow to set icon size (it is hard-coded). Nevertheless trials have been performed to backport icon size setting from 0.2.1 and it seems to work! We should then release the latest update of Gondwana, v1.2, with this new feature :).

Friday 25 November 2011

Automatic login now available

The default behavior of DoudouLinux is to show the menu of activities (see below) after the system has started and as soon as any activity is leaved. This is good for small children because the activities menu offers activities in the increasing order of difficulties, from top to bottom. However, for older children, the first activities are or will quickly become of poor interest. This is why the list of activities shown – but not their order – can be changed with the activities menu editor .

Activities menu (small)

However the oldest children may still have no interest at all in seeing a menu of activities, since they will surely login into “Whole DoudouLinux”. The new version of the activities menu editor can now do this. The trick is quite simple: if only one activity is selected in the menu, DoudouLinux will not show the activities menu but instead will enter this activity directly. Activities menu settings are recorded in the directory /home/etc/, which means that any data persistence (user data or user+system) is sufficient to make settings survive a reboot or a shutdown.

This new version of the activities menu editor will be available with next releases: the coming development release numbered 2011-11 and the planned official release update Gondwana 1.2, due to mid January.

Wednesday 19 January 2011

Changing the session menu

A question that is regularly asked is how to remove some entries in the session menu (shown on the screenshot below). The standard session menu has 7 sessions. If you want a DoudouLinux for very young children, you may wonder how to remove the two most advanced sessions, Mini and Whole DoudouLinux. On the contrary the first 2 or 3 sessions are quite useless if your children are bigger.

GDM session menu (Chinese)

The solution is to enter the session Whole DoudouLinux and open a console. Because the session menu is based on GDM, the tool that will allow you to hide sessions is “gdmsetup”:

$ sudo gdmsetup

In the latest tab you can add or remove users in the list of users who are not shown in the menu:

gdmsetup – user's tab

Of course changes are lost after shutdown or reboot if you have not installed DoudouLinux on hard disk or if full persistence is not set. The session names to be used in the order of session difficulty are:


The resulting session menu with “5doudoulinux” and “tux” removed is the following:

GDM session menu modified (Chinese)

So everything is OK but you may have noticed that a problem occurs if you want to change the sound volume or to make removed sessions reappear: you do not have access to the required tools anymore through the remaining sessions… The solution is simple: just type the name of the Whole DoudouLinux session user, which is “tux”, then press Return. This is shown in the following screenshot:

GDM type user name (Chinese)

To conclude there is just one thing to add: it would be better to have a small but nice interface to set the session menu. Be patient, this will come!

Sunday 22 August 2010

Installer DoudouLinux définitivement - suite

Dans le billet précédent Installer DoudouLinux définitivement, on a expliqué les détails techniques qui permettent d'installer DoudouLinux définitivement sur l'ordinateur - en détruisant tout ce qui est dessus au passage. Comme cette procédure va effrayer plus d'un utilisateur, j'avais sous-entendu en fin de billet que ça devrait pouvoir s'automatiser…

Et bien oui, c'est fait ! J'ai un script Python doudou-installer qui devine tout seul comme un grand où est la clef USB et où est le disque interne de la machine. L'utilisation est ultra simple lorsqu'il n'y a qu'un seul disque interne : il faut simplement valider le choix proposé par le script ! Il effectuera ensuite les opérations suivantes :

  • copie bas niveau de la clef USB
  • création d'une partition swap d'environ 350 Mo
  • utilisation de l'espace restant pour activer la persistance des données

Le type de persistance mis en place est persistance complète (système + données utilisateurs) avec stockage directement sur la partition, laquelle est formatée ext3. Par contre le système demande toujours à enlever le support à l'extinction (!), un bogue identifié fait qu'il croit toujours être sur un CD malgré mes tentatives…

Au niveau intégration à DoudouLinux, je précise tout de suite qu'il n'y aura pas d'icône pour installer facilement. Même si le script doit poser 3 fois la question « Êtes-vous vraiment sûr de vouloir tout écraser ? », les enfants ne doivent pas pouvoir accéder facilement à cet outil sinon comment papa et maman vont-ils garder l'esprit tranquille ?

NB: côté interface graphique, ne vous attendez pas à de beaux boutons translucides, je développe pour le moment dans l'urgence et je vais à l'essentiel → les fonctionnalités. On verra plus tard pour les beaux boutons !

Saturday 24 July 2010

Installer DoudouLinux définitivement

Pour le moment l'installation de DoudouLinux n'est pas activée via le système officiel des LiveCD Debian. Cependant, comme ceci ajoute une sur-couche logicielle de plusieurs dizaines de Mo, ceci veut dire qu'il faudra opérer des choix sur les logiciels installés… Une solution, pour ceux qui n'ont pas besoin de multiboot, c'est de copier tout simplement les données Live vers le disque dur local.

Avec le LiveCD, c'est compliqué car la structure d'un CD n'est pas celle d'un disque. Par contre avec la clef LiveUSB c'est très simple, il suffit de demander au système de faire une copie de bas niveau. C'est la commande dd qui permet de faire cela :

$ sudo dd if=/dev/sda of=/dev/hda
1434580+0 enregistrements lus
1434580+0 enregistrements écrits
734504960 bytes (735 MB) copied, 437,301 s, 1,7 MB/s

Toute la question est de retrouver les bons chemins /dev/sda et /dev/hda… Dans notre cas, manuel, on s'en sort en analysant les disques du système :

$ sudo fdisk -l

Disk /dev/hda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/hda doesn't contain a valid partition table

Disk /dev/sda: 2070 MB, 2070937600 bytes
255 heads, 63 sectors/track, 251 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0005800f

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          92      738958+  83  Linux
/dev/sda2              93         251     1277167+  83  Linux

On a donc deux disques de 40 Go et 2 Go respectivement, le premier est forcément celui de la machine alors que le second est la clef USB. On peut vérifier en regardant ce qui est monté dans le système DoudouLinux en fonctionnement (via df -h). Cependant pour une utilisation en mode automatique (= interface graphique dans DoudouLinux), il faudra un processus de détermination des disques source et cible :

  • la clef USB est connectée sur le bus USB (!) et devrait être montée
  • le disque dur est forcément monté sur un bus interne (IDE ou SCSI)

La clef USB a peut-être aussi des partitions avec un nom en rapport avec DoudouLinux, comme l'image ISO de CD (à vérifier…).

Remarque : cette technique a été testée avec succès depuis une clef USB Live en cours de fonctionnement. Normalement on peut aussi activer la persistance des données avec l'outil intégré à DoudouLinux, mais ça n'a pas été testé. Le seul truc qui manque vraiment : retirer le message à l'extinction qui dit d'enlever la clef !