Partager l'article ! Patching a miniroot image (astuce): Petite astuce pour la mise à jour kernel d'un miniroot Solaris 10. Mais avant de commencer, ...
Petite astuce pour la mise à jour kernel d'un miniroot Solaris 10. Mais avant de commencer, parlons un peu du contexte. Lors d'une migration p2v d'un serveur Sparc vers une Ldom, j'ai rencontré l'erreur suivante lors de l'extraction de l'archive flar.
{0} ok boot net - install
Requesting Internet Address for xx:xx:xx:xx:xx:xx
SunOS Release 5.10 Version Generic_147440-01 64-bit
Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights reserved.
[…]
No local customization defined
Extracting archive: flar01
Extracted 0.00 MB ( 0% of 11387.00 MB archive)
could not generate hash
ERROR: Could not write to pipe while processing 10.0.0.1:/export/flar/flar01.flar
ERROR: Errors occured during the extraction of flash archive.
The file /tmp/flash_errors contains the list of errors encountered
ERROR: Could not extract Flash archive
ERROR: Flash installation failed
Solaris installation program exited.
# cat /tmp/flash_errors
cannot receive: stream has unsupported feature, feature flags = 0
Le bug ZFS (cannot receive: stream has unsupported feature) est corrigé dans la version kernel 147440-21. Il est donc nécessaire de mettre à jour le miniroot (version kernel actuelle du miniroot 147440-01). Si comme moi, vous suivez la procédure indiquée dans la documentation Oracle, l'installation du patch kernel ne fonctionne pas :
# mkdir /JUMPSTART/miniroot /JUMPSTART/miniroot.patch
# cd /export/install/S10_u0811/Solaris_10/Tools
# ./setup_install_server /JUMPSTART/miniroot
Verifying target directory...
Calculating the required disk space for the Solaris_10 product
Calculating space required for the installation boot image
Copying the CD image to disk...
Copying Install Boot Image hierarchy...
Copying /boot netboot hierarchy...
Install Server setup complete
# /boot/solaris/bin/root_archive unpackmedia /JUMPSTART/miniroot /JUMPSTART/miniroot.patch
# cd /JUMPSTART/miniroot.patch/sbin
# cp rc2 rc2.orig
# cp sulogin sulogin.orig
# patchadd -C /JUMPSTART/miniroot.patch /var/tmp/147440-23
Checking installed patches...
Executing prepatch script...
df: (/JUMPSTART/miniroot.patch/var/tmp/patchadd-3259121710) not a block device, directory or mounted
resource
Insufficient space in /JUMPSTART/miniroot.patch/var/tmp/patchadd-3259121710 to save old files.
Space required in kilobytes: 206535
Space available in kilobytes: 0
Patchadd is terminating.
umount: /JUMPSTART/miniroot.patch/tmp/root/var busy
umount: /JUMPSTART/miniroot.patch/tmp busy
umount: /JUMPSTART/miniroot.patch/mnt busy
Le patch n’a pas été installé (problème dans le script de prepatch). Un cas de figure non validé par l’engineering Oracle !? Etonnant !?
# umount: /JUMPSTART/miniroot.patch/tmp/root/var
# umount: /JUMPSTART/miniroot.patch/tmp
# umount: /JUMPSTART/miniroot.patch/mnt
# mount -F lofs /JUMPSTART/miniroot.patch/var/tmp /JUMPSTART/miniroot.patch/var/tmp
Pour contourner ce petit problème j’ai trouvé une petite astuce banale mais qui fonctionne :
# patchadd -C /JUMPSTART/miniroot.patch /var/tmp/147440-23
Checking installed patches...
Executing prepatch script...
Installing patch packages...
Patch 147440-23 has been successfully installed.
See /JUMPSTART/miniroot.patch/var/sadm/patch/147440-23/log for details
Executing postpatch script...
Patch packages installed:
SUNWcakr
SUNWcakr.3
SUNWcakr.2
SUNWcar.2
SUNWckr
SUNWcsl
SUNWcslr
SUNWcsr
SUNWcsu
[…]
C’est légèrement mieux. Non ? Vérifions sommairement la présence du patch dans le miniroot :
# cd /JUMPSTART/miniroot.patch/var/sadm/patch
# ls
124337-01 147440-23
Encore quelques modifications nécessaires pour finaliser le miniroot :
# export SVCCFG_REPOSITORY=/JUMPSTART/miniroot.patch/etc/svc/repository.db
# svccfg -s system/manifest-import setprop start/exec = :true
# svccfg -s system/filesystem/usr setprop start/exec = :true
# svccfg -s system/identity:node setprop start/exec = :true
# svccfg -s system/device/local setprop start/exec = :true
# svccfg -s network/loopback:default setprop start/exec = :true
# svccfg -s network/physical:default setprop start/exec = :true
# svccfg -s milestone/multi-user setprop start/exec = :true
# cd /JUMPSTART/miniroot.patch/sbin
# mv rc2.orig rc2
# mv sulogin.orig sulogin
# /boot/solaris/bin/root_archive packmedia /JUMPSTART/miniroot /JUMPSTART/miniroot.patch
Voilà le miniroot est à jours, reste à savoir si celui-ci est fonctionnel.
{0} ok boot net -s
Boot device: /virtual-devices@100/channel-devices@200/network@0 File and args: -s
Requesting Internet Address for xx:xx:xx:xx:xx:xx
SunOS Release 5.10 Version Generic_147440-23 64-bit
Copyright (c) 1983, 2012, Oracle and/or its affiliates. All rights reserved.
Booting to milestone "milestone/single-user:default".
Configuring devices.
Using RPC Bootparams for network configuration information.
Attempting to configure interface vnet1...
Skipped interface vnet1
Attempting to configure interface vnet0...
Configured interface vnet0
Requesting System Maintenance Mode
SINGLE USER MODE
#
Le miniroot patché semble fonctionnel. Allez hop, testons avec le flar :
{0} ok boot net - install
Boot device: /virtual-devices@100/channel-devices@200/network@0 File and args: -s
Requesting Internet Address for xx:xx:xx:xx:xx:xx
SunOS Release 5.10 Version Generic_147440-23 64-bit
Copyright (c) 1983, 2012, Oracle and/or its affiliates. All rights reserved.
[…]
Processing profile
- Saving Boot Environment Configuration
- Opening Flash archive
- Validating Flash archive
- Selecting all disks
- Configuring boot device
- Configuring / (any)
ZFS send stream rpool/ROOT/ABE gets extracted to rpool/ROOT/root
ZFS send stream rpool/export gets extracted to rpool/export
Verifying disk configuration
Verifying space allocation
Preparing system for Flash install
Configuring disk (c0d0)
- Creating Solaris disk label (VTOC)
- Creating pool rpool
- Creating swap zvol for pool rpool
- Creating dump zvol for pool rpool
Beginning Flash archive processing
Predeployment processing
16 blocks
32 blocks
16 blocks
No local customization defined
Extracting archive: flar01
Extracted 0.00 MB ( 0% of 11387.00 MB archive)
Extracted 1.00 MB ( 0% of 11387.00 MB archive)
Extracted 2.00 MB ( 0% of 11387.00 MB archive)
Extracted 3.00 MB ( 0% of 11387.00 MB archive)
[…]
Extracted 11384.42 MB ( 99% of 11387.00 MB archive)
Extracted 11385.42 MB ( 99% of 11387.00 MB archive)
Extracted 11386.42 MB ( 99% of 11387.00 MB archive)
Extracted 11387.00 MB (100% of 11387.00 MB archive)
Extraction complete
[…]
Rien de plus simple qu'un petit montage lofs pour contourner le problème dans le script de prepatch du kernel. Astuce valable pour le kernel 147440-23, à voir si dans les versions inférieurs (ou suppérieurs), cette erreur est (ou sera) encore présente.
Ci-joint quelques références sur ce sujet :