Notre blog en mousse \o/ - Mot-clé - pxe2024-03-01T10:31:54+01:00Les Lamas !urn:md5:16d806c26b4faf0eabfff608393c3d26DotclearInstaller Windows 10 depuis un PXE Linuxurn:md5:6fdd873b270477166755be876d08da5d2018-04-30T16:09:00+02:002018-04-30T15:20:28+02:00RulianeAdministrationlinuxlivemicrosoftpxesevenwindowswinpe <p>Un certain temps s'est écoulé depuis la rédaction de <a href="https://www.leslamas.net/index.php?post/2012/07/07/Installer-Windows-depuis-un-serveur-PXE-Linux" hreflang="fr">ce billet</a> expliquant comment installer Windows sur un PXE Linux. Il existe désormais une méthode plus simple grâce au bootloader <a href="http://ipxe.org/wimboot" hreflang="en">wimboot</a>, développé par le projet iPXE.<br />
<br />
Sur un machine sous Windows, installer le Windows 10 ADK (Assessment and Deployment Kit). Copier les éléments suivants dans un répertoire acessible en TFTP :<br /></p>
<ul>
<li>C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\Media\Boot\boot.sdi</li>
<li>C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\Media\Boot\BCD</li>
<li>C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\en-us\winpe.wim</li>
<li><a href="http://git.ipxe.org/releases/wimboot/wimboot-latest.zip">wimboot</a></li>
</ul>
<p><br />
Ajouter un fichier "startnet.cmd" avec la liste des commandes à lancer au démarrage :<br /></p>
<pre>
wpeinit
net use Y: \\boot\windows10 /user:user pass
Y:\setup.exe
</pre>
<p><br />
Pour du PXElinux, ajouter une entrée dans le menu :<br /></p>
<pre>
# Installation de Windows 10
LABEL win10installer
MENU LABEL Installation de Windows 10 Professionnel 64 bits
COM32 linux.c32
APPEND win10installer/wimboot initrdfile=win10installer/startnet.cmd,win10installer/BCD,win10installer/boot.sdi,win10installer/boot.wim
</pre>
<p>Attention : il faut avoir une version de pxelinux assez récente pour pouvoir lancer wimboot !</p>Debian : The attempt to mount a file system with type ext4 ... at / failed.urn:md5:f892eb775a24dc06d2d1f925150ed3362017-02-05T18:42:00+01:002017-02-09T14:30:39+01:00RulianeAdministrationbootdebiandisklessinstallerlinuxpxe <p>En installant Debian depuis un serveur PXE (netboot), il arrive parfois que l'installeur n'arrive pas à monter la partition où installer l'OS :</p>
<blockquote><p>The attempt to mount a file system with type ext4 [...] at / failed.</p></blockquote>
<p><br />
L'explication se trouve ici : <a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=780812" hreflang="en">https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=780812</a></p>
<blockquote><p>This is due to kernel and module version mis-match in debian-installer [...] which was built with an older kernel version</p></blockquote>
<p><br />
Solution : mettre à jour debian-installer sur le serveur PXE, tout simplement. Il suffit de récupérer les derniers noyau et initrd en date :</p>
<ul>
<li>http://ftp.fr.debian.org/debian/dists/stable/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux</li>
<li>http://ftp.fr.debian.org/debian/dists/stable/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz</li>
</ul>Échec de l'installation de Mint 17 depuis un live-PXEurn:md5:5af325fc61ccd1c1e7cff22050a2ed262015-05-18T14:32:00+02:002017-02-09T14:14:31+01:00RulianeGeekeriebootdisklessinstallationinstallerlinuxlivemintpxe <p>Suite à <a href="http://www.leslamas.net/index.php?post/2012/08/02/Linux-Mint-Live-en-PXE-par-NFS" hreflang="fr" title="Linux Mint Live en PXE par NFS">ce billet</a>, je me suis rendu compte que l'installateur plante s'il est lancé depuis un "live-PXE".<br />
À l'origine du problème, la procédure de fabrication du fichier de configuration d'APT (gestionnaire de paquets), qui n'est pas adaptée à un "live-PXE". Néanmions, voici comment le contourner.<br />
<br /></p>
<h3>Solution 1 : one-shot</h3>
<p>Une fois Mint démarré, éditer /usr/lib/ubiquity/apt-setup/apt-setup et trouver la ligne suivante :<br /></p>
<pre>
mv $ROOT/etc/apt/sources.list.new $ROOT/etc/apt/sources.list
</pre>
<p>La remplacer par ceci :</p>
<pre>
if [ -f $ROOT/etc/apt/sources.list.new ]; then
mv $ROOT/etc/apt/sources.list.new $ROOT/etc/apt/sources.list
fi
</pre>
<p>Attention : cette modification n'est pas enregistrée. Elle doit donc être faite à chaque redémarrage.<br />
<br /></p>
<h3>Solution 2 : correction permanente</h3>
<p>Cette solution consiste à appliquer le patch ci-avant à l'image SquashFS. Pour ceci, installer les outils squashfs :<br /></p>
<blockquote><p>apt-get install squashfs-tools</p></blockquote>
<p>Décompresser le squashfs de Mint :</p>
<blockquote><p>unsquashfs casper/filesystem.squashfs</p></blockquote>
<p>Appliquer le patch indiqué précédemment.<br />
Recompresser le squashfs :<br /></p>
<blockquote><p>mksquashfs squashfs-root/ filesystem.squashfs -noappend -always-use-fragments</p></blockquote>
<p><br />
3... 2... 1... bootez !</p>Linux Mint Live en PXE par NFSurn:md5:d949a4a9011100bce40c585f91170f442012-08-02T12:33:00+02:002012-11-21T21:24:04+01:00RulianeGeekeriebootdisklesslinuxlivenfspxe <p>Il est possible, très simplement, de démarrer la distribution Linux Mint depuis un serveur PXE. Cette façon de faire peut être adaptée à d'autres distributions, elle est d'ailleurs inspirée de celle d'Ubuntu (d'où est tirée Mint).<br /></p>
<ul>
<li>Télécharger l'ISO : <a href="http://www.linuxmint.com/download.php" hreflang="en">http://www.linuxmint.com/download.php</a><br /></li>
<li>Monter l'image et copier le répertoire <em>casper</em> à un endroit accessible en TFTP :</li>
</ul>
<pre>
mount -o loop linuxmint-13-mate-dvd-64bit.iso /media/imagecd
mkdir /tftpboot/mint
cp -r /media/imagecd/casper /tftpboot/mint/
umount /media/imagecd
</pre>
<ul>
<li>Rendre ce répertoire accessible en NFS. Pour cela, installer le serveur NFS et ajouter une ligne d'export au fichier /etc/exports :</li>
</ul>
<pre>
apt-get install nfs-kernel-server
echo '/tftpboot/mint *(ro,no_root_squash,no_subtree_check,async)' >> /etc/exports
/etc/init.d/nfs-kernel-server restart
</pre>
<ul>
<li>Ajouter une entrée dans le fichier <racine TFTP>/pxelinux.cfg/default. Pour ma part j'ai aussi passé l'OS en français :</li>
</ul>
<pre>
LABEL mint
MENU LABEL Mint Live (NFS)
KERNEL mint/casper/vmlinuz
APPEND initrd=mint/casper/initrd.lz boot=casper netboot=nfs nfsroot=192.168.1.1:/tftpboot/mint locale=fr_FR keymap=fr console-setup/layoutcode=fr
</pre>
<p><br />
<br />
Mise à jour (21/11/2012) : le réseau fonctionne sous Linux Mint 13, mais plus sous Mint 14. Il faut alors redemander une IP :</p>
<pre>
sudo dhclient eth0
</pre>Installer Windows depuis un serveur PXE Linuxurn:md5:a86d3b9aa8d21f380f8806a27ba0a69d2012-07-07T20:50:00+02:002014-02-24T20:36:19+01:00RulianeAdministrationdisklessinstallationpxesevenwindowswinpe<p>Voyons comment installer Windows depuis un démarrage PXE. Ceci revient en fait à lancer l'installation de Windows (7 par exemple) depuis un environnement WinPE personnalisé de la manière suivante :<br />
- intégration du pilote Realtek Gigabit PCIe, de plus en plus répandu et indispensable pour lancer l'installation par le réseau ;<br />
- une fois WinPE chargé, montage du media en CIFS contenant le répertoire "source" du média d'installation et lancement de l'assistant.</p> <p>Cette méthode et ce billet sont très largement inspirée de ce très bon billet : <a href="http://doomclaw.de/index.php/2009/08/18/installing-windows-7-with-a-pxe-boot-server/trackback/" hreflang="en" title="Installing Windows 7 with a PXE boot server">Installing Windows 7 with a PXE boot server</a>. Il consiste essentiellement en quelques modifications du script.<br />
<br /></p>
<ul>
<li><a href="http://www.microsoft.com/fr-fr/download/details.aspx?id=5753" title="WAIK pour Windows 7">Télécharger</a> et installer le Windows Automated Installation Kit (WAIK) ;<br /></li>
<li><a href="http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=13&PFid=5&Level=5&Conn=4&DownTypeID=3&GetDown=false#1" hreflang="en">Télécharger</a> le pilote Realtek et le décompresser.<br /></li>
<li>Dans un nouveau fichier (par exemple build.cmd), coller le code suivant après avoir adapté les variables :</li>
</ul>
<pre>
@echo off
cls
REM Variables
echo Setting variables ...
REM the path to your WAIK installation
set WAIKPath=%ProgramFiles%\Windows AIK
echo Set WAIK directory to %WAIKPath%.
REM possible values are: x86, amd64 and ia64
set ARCH=amd64
echo Set architecture to %ARCH%.
set PEPath=C:\winpe_%ARCH%
echo Set temporary working directory for Windows PE to %PEPath%.
set TFTPPath=C:\tftp\Boot
echo Set TFTP boot directory to %TFTPPath%.
set CIFSShare=\\boot\seven_x64
echo Set CIFS share containing the media to %CIFSShare%
set AdditionalDriver=C:\GBE\64\rt64win7.inf
echo Set driver to be added to %AdditionalDriver%
set BCDStore=%TFTPPath%\BCD
echo Set BCDStore to %BCDStore%.
echo All variables set!
echo.
REM Environment check
echo Checking for clean environment...
if not exist "%WAIKPATH%" set NoWAIK=1 && goto :end
if not exist "%WAIKPath%\Tools\PETools\%ARCH%" set NoARCH=1 && goto :end
if exist %PEPath% echo Temporary working directory not empty! Need to remove && rd %PEPath% /S
if exist %PEPath% echo Temporary working directory still not empty! Trying again ... && cd "%WAIKPath%\Tools\%ARCH%" && imagex /unmount %PEPath%\mount && rd %PEPath% /S /Q
if exist %PEPath% set NotClean=1 && goto :end
if exist %TFTPPath% echo TFTP boot directory not empty! Need to remove && rd %TFTPPath% /S
if exist %TFTPPath% set NotClean=1 && goto :end
echo.
echo Starting real work now ...
cd "%WAIKPath%\Tools\PETools"
echo Copying PE-Files ...
call copype %ARCH% %PEPath%
imagex /mountrw %PEPath%\winpe.wim 1 %PEPath%\mount
echo Personnalisation de l'environnement WinPE
echo net use y: %CIFSShare% >> "%PEPath%\mount\Windows\System32\startnet.cmd"
echo y:\setup.exe >> "%PEPath%\mount\Windows\System32\startnet.cmd"
dism /image:%PEPath%\mount /add-driver /driver:%AdditionalDriver%
md %TFTPPath% > NUL
copy %PEPath%\mount\Windows\Boot\PXE\*.* %TFTPPath% > NUL
copy "%WAIKPath%\Tools\PETools\%ARCH%\boot\boot.sdi" %TFTPPath% > NUL
echo Creation du BCD...
cd %PEPath%\mount\Windows\System32
bcdedit -createstore %BCDStore%
bcdedit -store %BCDStore% -create {ramdiskoptions} /d "Ramdisk options"
bcdedit -store %BCDStore% -set {ramdiskoptions} ramdisksdidevice Boot
bcdedit -store %BCDStore% -set {ramdiskoptions} ramdisksdipath \Boot\boot.sdi
REM Tokens=3 sur un WAIK en anglais
for /f "Tokens=2" %%i in ('bcdedit /store %BCDStore% /create /d "Windows 7 Install Image" /application osloader') do set GUID=%%i
bcdedit -store %BCDStore% -set %GUID% systemroot \Windows
bcdedit -store %BCDStore% -set %GUID% detecthal yes
bcdedit -store %BCDStore% -set %GUID% winpe yes
bcdedit -store %BCDStore% -set %GUID% osdevice ramdisk=[boot]\Boot\winpe.wim,{ramdiskoptions}
bcdedit -store %BCDStore% -set %GUID% device ramdisk=[boot]\Boot\winpe.wim,{ramdiskoptions}
bcdedit -store %BCDStore% -create {bootmgr} /d "Windows 7 Boot Manager"
bcdedit -store %BCDStore% -set {bootmgr} timeout 30
bcdedit -store %BCDStore% -set {bootmgr} displayorder %GUID%
cd "%WAIKPath%\Tools\PETools"
imagex /unmount /commit %PEPath%\mount
copy %PEPath%\winpe.wim %TFTPPath%
goto :exit
:end
if %NoWAIK%=1 echo "Your WAIK directory was not found. Execution aborted." && pause && goto :exit
if %NoARCH%=1 echo "Your Architecture doesn't seem to be right. Or at least it is not known by your WAIK installation. Execution aborted." && pause && goto :exit
if %NotClean%=1 echo "Your environment was not clean. Execution aborted." && pause && goto :exit
:exit
</pre>
<p><br /></p>
<ul>
<li>Démarrer la console ("Deployment Tools Command Prompt") <strong>en administrateur</strong> et lancer le script build.cmd. Cela génère dans %TFTPPath% plusieurs fichiers à copier dans un répertoire "Boot", lui-même à la racine du serveur TFTP.<br /></li>
</ul>
<p><br /></p>
<ul>
<li>Ajouter le remapping suivant grâce à l'option -m de tftpd-hpa :</li>
</ul>
<pre>
rg \\ /
</pre>
<p><br /></p>
<ul>
<li>Il faut créer le lien symbolique suivant dans <racine TFTP>/Boot :</li>
</ul>
<pre>
ln -s pxeboot.n12 startrom.0
</pre>
<p><br /></p>
<ul>
<li>Ajouter une entrée dans le fichier <racine TFTP>/pxelinux.cfg/default :</li>
</ul>
<pre>
LABEL winpe
MENU LABEL Installation de Windows 7 64 bits
KERNEL Boot/startrom.0
</pre>
<p><br />
<br /></p>
<p>EDIT 24/02/2014 : correction de quelques erreurs dans le script.</p>