Draklive

From Mandriva Community Wiki

Jump to: navigation, search
draklive is a mastering tool that builds a live distribution according to a configuration file, creates a master image, and optionally installs it on a device. It is the tool used and maintained by Mandriva to build the distribution.


Contents

Why a new live mastering tool?

Mandriva Move

The Move1/Move2 technologies have been deprecated. Their purpose was to load writable files into RAM, and using the dnotify daemon to monitor file modifications and copy any modified files to a connected USB key.

Unfortunately, both Move1 and Move2 required a special boot process and a complex mastering process. The technology will probably be supersceded by unionfs or similar, which allows for transparent filesystem overlays - whereby modified files would be automatically written to a USB key using a 'Copy On Write' scheme. This also allows for file deletion, which is something the current scheme lacks.

mklivecd

mklivecd allows users to create live distributions, but it is not easy keeping it's packages and dependencies in sync with the latest hardware and technical updates. mklivecd requires a special initrd script (linuxrc), and a new rc.sysinit file. This complicates the boot process, and it has proven difficult to maintain all three programs (linuxrc, rc.sysinit, mklivecd).

linux-live / Slax

The linux-live scripts are quite similar. The downside to them is that they both require additional libraries to be copied into the initrd, and neither provide a comprehensive list of hardware drivers in their initrd, so they don't work on all machines.

Advantages

draklive's philosophy is to keep the live distribution as close as possible to a normal Mandriva Linux distribution. All live-specific tweaks are done in a tiny initrd script. Since the Draklive initrd script is generated on-the-fly, it is very small, and is quite easy to debug should there be any problems.

The list of drivers included in the initrd is adjusted during the live distribution creation, according to the medium type. draklive uses the DrakX libraries ensure an up-to-date drivers list is used.

Once the initrd script has finished booting, the systems root device will be used transparently by the distribution, and no additional tricks are required.

Hardware detection is done with harddrake, providing reliable integration with the host system.

Features

  • live CD
  • live distribution on USB key
  • easy to test over NFS
  • uses the Mandriva installer to create the live system
  • fully read-write live system (using unionfs)
  • automatic hardware configuration (using harddrake)
  • generic code structure to make new technical choices quickly usable


Quickstart

Before continuing :
The following packages must be installed on your system: x11-server-xnest squashfs-tools syslinux mkisofs rsync curl mtools.
For a better compression squashfs3-tools is required.


Getting the tool and config files

svn co http://svn.mandriva.com/svn/soft/draklive/trunk draklive
svn co http://svn.mandriva.com/svn/config/One/trunk live-config
cd live-config

Then, edit the repository address (and other local settings) in config/settings.cfg.


Building a live CD or live USB

Image:Konsole.png
[root@computer ~]# perl -I../draklive/lib ../draklive/draklive --clean --all

See the output of draklive --help for more details.


Recording a live USB

Image:Konsole.png
[root@computer ~]# perl -I../draklive/lib ../draklive/draklive --record --device /dev/sdX

Where /dev/sdX is your USB key disk device (not partition)

Configuration

Example

  {
    system => {
        root => '/chroot/live/2010.0',
        repository => '/mnt/BIG/dis/2010.0/i586',
        auto_install => 'config/auto_inst.cfg.pl',
        rpmsrate => 'config/rpmsrate',
        vga_mode => 788,
    },
    media => {
        storage => 'cdrom',
    },
    mount => $predefined{mounts}{volatile_squash_union},
  };

Example: Creating a bootable cdrom for old computers which cannot boot from the USB key

Modify the file config/live.cfg media hash as follows:

media => { storage => 'usb', boot => 'cdrom' },

And then run the command:

perl -I../draklive/lib ../draklive/draklive --config config/live.cfg --boot-only --boot --master

This will create the iso file: /your_workdir/images/boot.iso (your_workdir is /var/lib/draklive by default)


Exhaustive description

The configuration file should contain a hash of settings. Some settings have to be filled in the top-level, others have to be grouped in sub-hashes.

system sub-hash

This hash describes the installed distribution.

  • root: path of the installed distribution
  • repository: path to the installer repository
  • auto_install: installer auto_inst.cfg.pl file
  • patch_install: installer patch file (actually defcfg file)
  • postInstall: commands to be run (using bash -c after all the additional_media/rpm/patches steps are done)
  • install_env: hash reference of variables that should be passed to install (they will be usable in the auto_inst.cfg.pl as well)
  • additional_modules: array reference of .ko modules to be copied and loaded in the initrd
  • rpmsrate: local rpmsrate path (useful to add/modify/remove packages rate)
  • patches: array reference of patches to be applied directly in system root
  • rpms: array reference of rpms to be installed after installation
  • vga_mode: graphical mode which the live distribution should use,
  • splash: set to no if you don't want to use a splash (default is yes)
  • kernel: default kernel release (optional)

media sub-hash

This hash describes which medium access should be used.

  • storage: medium type (cdrom or usb)

Optional fields:

  • boot: boot medium type to be used with --boot-only option, if any (cdrom or usb)

Or customised settings:

  • $custom{media}{nfs}->(module name, live system IP address, NFS source)

extra_media sub-array

This array should contain all extra media (see media sub-hash description) that the live system should support. This allows to make live systems using different boot types, using the copy wizard. For example, if the default media is of the cdrom type, and the extra media array contains a media using the usb type, the running live CD will allow to duplicate itself to both USB keys and CDs.

mount sub-hash

This hash describes how the live components have to be mounted together.

Some basic setups are predefined:

  • $predefined{mounts}{simple_union} : use the media contents as raw root, and mount it with a tmpfs using unionfs, to get a RW system
  • $predefined{mounts}{volatile_squash_union} : compress the distribution in a distrib.sqfs file, uses a tmpfs, and mounts them together using unionfs
  • $predefined{mounts}{squash_union} : compress the distribution in a distrib.sqfs file, a system.loop ext2 read-writable loopback file, and mounts them together using unionfs
  • $predefined{mounts}{multi_squash_union} : compress the distribution in a distrib.sqfs file, optionally uses a read-only system.sqfs "patch", a tmpfs, and mounts them together using unionfs

Or build your own mount type:

top-level settings

Live settings:

  • post: array of commands to be run at end of initrd
  • copy_initrd: copy the initrd to this location at the end of the initrd step (e.g. to /var/lib/tftpboot/live.rdz)
  • debug: include some debug tools in initrd (busybox, strace, ping) and run a debug shell at beginning of initrd

Directory settings (all optional):

  • workdir: draklive working directory (defaults to /tmp/draklive)
  • mnt: temporary mount point for draklive


References

draklive tools and One configuration files


Other live tools


Overlay filesystems

UnionFS

Other


Debug

If you need to debug the draklive you need to search for the file ddebug.log in the build directory of the live installation.

FAQ

  • Missing squashfs and lzma files ?

In case you get an error "missing squashfs" and "missing lzma" you should uninstall the dkms-lzma and dkms-squashfs and install kernel-lzma and kernel-squashfs. You have to reboot the system after this and before starting draklive, modprobe squashfs. Also you can add in live.cfg in the section "rpms": "media/main/squashfs-lzma-kernel-2.6.31.5-desktop-1mnb-3.3-11mdv2010.0.i586.rpm" and "media/main/lzma-kernel-2.6.31.5-desktop-1mnb-4.43-28mdv2010.0.i586.rpm".

Personal tools
In other languages