Thursday, May 30, 2013

Firefly: failsafe image for illumos-based distros

If somebody is looking for illumos-based filesafe image, I've created small iso (usb image is available also) at sourceforge. This image provides the same method as old Solaris iso's: looks for bootable root pool, imports it to /a and mounts bootfs:

I hope someone will find this image useful for recovery purposes on any illumos-based distributions.

10 comments:

Robin Smidsrød said...

I've created a fairly simple netboot recipe for Firefly using iPXE here:

https://gist.github.com/robinsmidsrod/5781653

Hope it might be useful for others.

atar said...

Nice! Are you going to make a SPARC iso as well?

alhazred said...

Unfortunately I have not any sparc system anymore...

Shadow Cat said...

Hi there, how do I install Firefly, IPS, and Xfce to my hdd?

alhazred said...

Look at http://sourceforge.net/projects/xstreamos/

JimKlimov said...

Hi Alex,

I've recently tried the latest firefly image on a recent OmniOS bloody, and its rpool feature flags are not compatible with those supported by your image. Can you please re-spin with a more recent illumos-gate and/or publish the recipes for others to do so?

Can the image be built by a running system from its binary bits, like the old Solaris 10 failsafe images were generated?

Otherwise, it was not a hassle to run Firefly from the HDD: I created an rpool/ROOT/firefly and copied all the contents from the ISO image into it, and updated grub.conf accordingly:


title Firefly Recovery 14/01
bootfs rpool/ROOT/firefly
kernel$ /platform/i86pc/kernel/amd64/unix
module$ /platform/i86pc/amd64/firefly

HTH,
Jim Klimov

JimKlimov said...

Also, it may be an issue especially regarding the "repair boot" intent, that Firefly only seems to provide 64-bit kernel bits in both the ISO and the compressed image (while userspace binaries have the usual 32-bit variants with 64-bit as needed).

JimKlimov said...

Well, in the end (just for kicks) I copied the current kernel from OmniOS into a clone of the firefly dataset, mounted the firefly image and updated the files in its /kernel and /platform with those available in OmniOS (not all drivers were available though), and the resulting BE is indeed bootable and able to import and mount the rpool with its features. Not surprisingly, however, it does not take into account my split-root setup (the rpool/SHARED/var/* stuff became just /a/var, while rpool/ROOT/omnios became /a/ROOT) but this suffices for testing or repairs.

Thanks Alex, great job preparing the bulk of the image and its logic! ;)

Here is what I did to update the image I had (locally installed per my comment above):

:; beadm mount firefly-151013 /a
:; gzcat /a/platform/i86pc/amd64/firefly > /tmp/ff.img

:; mkdir /tmp/a
:; mount /dev/lofi/1 /tmp/a

Added and ran this script in the image root:

####################
:; cat > /tmp/a/update-kernel.sh << EOF
#!/bin/sh

# Update the kernel bits in this image with files from the running system
# (C) 2014 by Jim Klimov

for D in `pwd`/kernel `pwd`/platform; do
cd "$D" && \
find . -type f | while read F; do
RFP="/platform/$F"; RFK="/kernel/$F"; RF=""
[ -s "$RFP" ] && RF="$RFP"
[ -s "$RFK" -a -z "$RF" ] && RF="$RFK"
[ -n "$RF" ] && \
{ echo "+++ Got '$RF'"; cp -pf "$RF" "$F"; } || \
echo "=== No $RFP nor $RFK !"
done
done

EOF
####################

:; cd /tmp/a && chmod +x update-kernel.sh && ./update-kernel.sh

:; cd /
:; umount /tmp/a
:; lofiadm -d /tmp/ff.img

:; cp -pf /platform/i86pc/kernel/amd64/unix /a/platform/i86pc/kernel/amd64/unix
:; cp -pf /platform/i86pc/kernel/kmdb/amd64/unix /a/platform/i86pc/kernel/kmdb/amd64/unix

:; gzip -c -9 < /tmp/ff.img > /a/platform/i86pc/amd64/firefly

:; beadm umount /a
:; rm /tmp/ff.img

If all went well, you are ready to reboot into this updated firefly (via manual selection at boot) as the good old locally-installed failsafe image :)

//Jim

alhazred said...

Glad to hear that it helps you. As soon as the free time (laugh), I will try to update it

JimKlimov said...

Pardon me, the copy-paste above missed an important line:

:; lofiadm -a /tmp/ff.img

This returns the "/dev/lofi/1" (or some other device path) to use in the mount under it.

The filesystem in the image is UFS (mount -F ufs) if this is not detected automagically for some reason.

Also, before the described procedure, the BE apparently had to be cloned bofore mounting:

:; beadm create -e firefly firefly-151013

(The original "firefly" contained an rsync'ed copy of the ISO contents).

HTH,
//Jim Klimov