« Création d'une image debian bootable (système de rescue, live system) » : différence entre les versions

De Linux Server Wiki
Aller à la navigation Aller à la recherche
Ligne 44 : Ligne 44 :
--archive-areas "main contrib non-free" --apt-indices false \
--archive-areas "main contrib non-free" --apt-indices false \
--mirror-bootstrap http://ftp.fr.debian.org/debian/ --mirror-binary http://ftp.fr.debian.org/debian/ \
--mirror-bootstrap http://ftp.fr.debian.org/debian/ --mirror-binary http://ftp.fr.debian.org/debian/ \
--bootappend-live "boot=live config locales=en_US.UTF-8 keyboard-layouts=fr hostname=rescue \
--bootappend-live "boot=live components locales=en_US.UTF-8 keyboard-layouts=fr hostname=rescue \
username=root noprompt noeject"
username=root noprompt noeject autologin"
</pre>
</pre>



Version du 1 octobre 2015 à 20:25


Via le web

Génération : http://cgi.build.live-systems.org/cgi-bin/live-build (le mieux est d'utiliser standard en package list)

Vous pouvez ajouter des packages à installer à la ligne cgipackages.list.chroot

Password user : live

Password root : aucun (se su avec sudo -i)

Pour générer une image en français passez le paramètre suivant dans la section Advanced binary options: :

--bootappend-live: 	locales=fr_FR.UTF-8 keyboard-layouts=fr noprompt

install-keymap /usr/share/keymaps/i386/querty/fr-latin9*

ou

loadkeys usr/share/keymaps/i386/querty/fr-latin9*

Vous même

aptitude install live-build
mkdir live-default && cd live-default

Pour debian wheezy :

lb config --distribution wheezy --binary-images iso-hybrid --architectures amd64 --linux-flavours amd64 \
--archive-areas "main contrib non-free" --apt-indices false \
--mirror-bootstrap http://ftp.fr.debian.org/debian/ --mirror-binary http://ftp.fr.debian.org/debian/ \
--bootappend-live "boot=live config locales=en_US.UTF-8 keyboard-layouts=fr hostname=rescue \
username=root noprompt noeject"

Pour debian jesse :

lb config --distribution jessie --binary-images iso-hybrid --architectures amd64 --linux-flavours amd64 \
--archive-areas "main contrib non-free" --apt-indices false \
--mirror-bootstrap http://ftp.fr.debian.org/debian/ --mirror-binary http://ftp.fr.debian.org/debian/ \
--bootappend-live "boot=live components locales=en_US.UTF-8 keyboard-layouts=fr hostname=rescue \
username=root noprompt noeject autologin"
echo "live-tools user-setup sudo eject" > config/package-lists/recommends.list.chroot

Attention, si vous utilisez live-build 4.X, il faut remplacer l'option config par components

Pour installer une liste personnalisée de package, après avoir lancé lb config, créez un fichier mespackets.list.chroot dans config/package-lists

Pour debian jessie avec systemd, afin d'activer l'autologin, il faut créer un script personnalisé dans config/hooks/autologin.chroot :

#!/bin/sh

set -e

mkdir /etc/systemd/system/getty@tty1.service.d

echo "[Service]" > /etc/systemd/system/getty@tty1.service.d/autologin.conf
echo "ExecStart=" >> /etc/systemd/system/getty@tty1.service.d/autologin.conf
echo "ExecStart=-/sbin/agetty --autologin "root" %I" >> /etc/systemd/system/getty@tty1.service.d/autologin.conf

Enfin, pour lancer la création de l'image :

lb build

Modifier une iso déjà préparée

aptitude install genisoimage squashfs-tools
mount /var/lib/vz/templates/iso/rescue_amd64.iso /mnt/01 -o loop
cp -a 01/* 02/
mount /mnt/01/live/filesystem.squashfs /mnt/03/ -o loop
cp -a 03/* 04/

04 : a modifier pour debian 02 : a modifier pour le cd

Pour modifier les fichiers debian, le mieux est de

chroot /mnt/04

Vous pouvez par exemple rajouter des paquets que vous auriez oublié (dnsutils, ntfsprogs, dosfstools ...), en reconfigurer certains (locales, console-data)

Une fois 04 modifié :

cd /mnt
rm 04/root/.*_history
mksquashfs 04/ blah.squashfs
mv blah.squashfs 02/live/filesystem.squashfs 
chmod 444 02/live/filesystem.squashfs 
sha256sum

Vous pouvez ensuite modifier 02 : par exemple, ajouter dans 02/isolinux/isolinux.cfg : timeout 1

genisoimage -J -r -v -o test.iso -V rescue \
-b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table 02/