Thursday, August 31, 2006

Random password one-liner

I recently came up with this method for generating reasonable random 8-character passwords:

$ dd if=/dev/random bs=6 count=1 2>/dev/null | openssl base64
LCia46S4
If 8 characters is not long enough, increase the number after bs= to 75% of the number of characters you would like in the password.

Saturday, August 26, 2006

Install Solaris from DVD image on disk

My personal SPARC machine is pathetic by today's standards - An Ultra II with a pair of 300 MHz processors, 768 MB RAM, and a very slow CDROM drive. This is pretty much the slowest machine that is supported by Solaris 10. That, and today I decided it was time to get a fresh installation of Solaris Express (build 46) on it.

I first tried the live upgrade route. However, that didn't work out too well because I had previously used bfu to get some newer OpenSolaris bits on the machine. I really did not want to repeat the download process for all the CD ISO's (already had downloaded the DVD ISO). Now, if you think that downloading and burning is slow - you should see the speed of the installation on this CDROM drive. It was probably OK in the days when Solaris fit on one CD, but not today with 5(?) CD's to complete the installation.

The disk layout of the machine was as follows:

  • c0t0d0 32 GB disk
    • c0t0d0s0 - 4.5 GB available for new /
    • c0t0d0s1 - ~500 MB swap
    • c0t0d0s7 - remainder as zfs pool "pool0"
  • c0t1d0 4 GB disk
    • c0t1d0s0 - Root with build 36 (?) + random BFU bits
I had the DVD image in a subdirectory of my home directory that was in the pool0/home file system in the zfs pool. To make use of that DVD image without buying a SCSI DVD drive, I did the following:
  1. Burn build 46 CD0 to a CD-R
  2. Boot from the CD-R
  3. Go clean up the shop from the woodworking I was doing earlier
  4. Do some laundry
  5. Return to the Ultra II to find that it was just about to ask me which language I speak. Really, it was still working on it. Now do you know why I didn't want to feed it 5 CD's?
  6. Answer sysidcfg questions
  7. Exit the installer
  8. zpool import pool0. After the import was complete but before mounting file systems, zpool crashed with a segv. Later I saved that core file to /a for later analysis
  9. zfs set mountpoint=/tmp/home pool0/home
  10. zfs mount pool0/home
  11. lofiadm -a /tmp/home/build46.iso
  12. umount /cdrom
  13. mount -F hsfs -o ro /dev/lofi/1 /cdrom
  14. install-solaris
  15. Go blog about a cool hack. :)
The installation is now about 40% done. Looks like the hack is working just fine. I wonder if I could bundle this all up in a begin script (especially the laundry) to automate the installation from an ISO image after booting from local media.