Adding Solaris packages, under Qemu

So you know the drill, someone wants to do something with Solaris, and they’ve already installed the OS, and done a bunch of customization and whatnot, now they call up all in a panic as they copy in a binary distribution of GCC, but they can’t compile anything because they are missing values-Xa.o , or worse just about everything from the development tools.

Well I’m not sure about ancient Qemu, but 2.2 can mount the CD-ROM’s post install! … manually.

The poor guy didn’t want to re-install, but one option was to boot up the CD in single user mode, mount his disk, and copy the /cdrom path onto some partition so he could then install the packages as needed, and even better have the whole tree ready if need be.

But the better thing is to just mount the CD, install the package and be done with it right?

I’ve only tested this with Solaris 2.6…

While booting up single user mode from the CD (boot disk2:d -s) I noticed this line in the mount table:

/cdrom             (/devices/iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@2,0:a):       0 blocks        0 files

So I thought I’d try to mount that once the copy was done.  The first thing I did was make a symbolic link as that name is a little hard to type, and I didn’t want to remember that path after this day.

mkdir /cdrom
cd /dev
ln -s /devices/iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@2,0:a jr0

this gives me a /dev/jr0 linking to where the Solaris 2.6 install path was.

# mount -oro /dev/jr0 /mnt
mount: /dev/jr0 is not this fstype.

Well that was disappointing.  Could I even read the CD?

# head -1 /dev/jr0
CD-ROM Disc for SunOS Solaris Installation

Ok, so it must be the file-system type.  The ‘bootable’ partition on the CD contains a SYSV filesystem, as it’s a “live CD”..

mount -o ro /dev/dsk/c0t2d0s1 /mnt

# ls /mnt
a dev kernel opt reconfigure usr
bin devices lib platform sbin var
cdrom etc mnt proc tmp

You can even fsck it!

# fsck /dev/dsk/c0t2d0s1
** /dev/dsk/c0t2d0s1 (NO WRITE)
** Last Mounted on /tmp/MntDev.12554
** Phase 1 – Check Blocks and Sizes
** Phase 2 – Check Pathnames
** Phase 3 – Check Connectivity
** Phase 4 – Check Reference Counts
** Phase 5 – Check Cyl groups
2445 files, 19114 used, 4873 free (17 frags, 1214 blocks, 0.0% fragmentation)
#

But the part of the CD-ROM that we want, with all the packages uses a different file-system, and with a bit of hunting I found the right string:

mount -F hsfs -r /dev/jr0 /cdrom

Now we can manually add in the missing packages!

# mount -F hsfs -r /dev/jr0 /cdrom
# ls /cdrom
Copyright Solaris_2.6

We just have to point the pkgadd command to where the CD-ROM is mounted.  In my case I just had to type in:

pkgadd -d /cdrom/Solaris_2.6/Product/

And then I got the “interactive” mode showing off all 471 packages.  Don’t just slam the enter key or you’ll start installing everything.  Hit control-d and then we can manually add them in.

<RETURN> for more choices, <CTRL-D> to stop display:^D

Select package(s) you wish to process (or ‘all’ to process
all packages). (default: all) [?,??,q]:

And in this case, the packages I wanted were:

SUNWarc
SUNWbtool

With those installed, now I can see the object files I wanted:

# find / -name ‘*.o’ -print
/usr/lib/adb/adbsub.o
/usr/ccs/lib/values-Xa.o
/usr/ccs/lib/values-Xc.o
/usr/ccs/lib/values-Xs.o
/usr/ccs/lib/values-Xt.o
/usr/ccs/lib/values-xpg4.o

Wasn’t that great?  Nobody had to re-install, no disk space is wasted, and now if other packages are needed, it’ll be easy to add them.

This entry was posted in gcc, qemu, solaris by neozeed. Bookmark the permalink.
avatar

About neozeed

What is there to tell? I've loved UNIX like things since I was first exposed to QNX in highschool (we had the Unisys ICONS!), and spent the better time of my teenage years trying to get my own UNIX... I should have bought Coherent in retrospect.. Anyways latched onto Linux in 1992, and then got some old BSD admin books and have been hooked on the VAX BSD & other big/ancient things since...!

7 thoughts on “Adding Solaris packages, under Qemu

  1. Nice article. I tried to copy some files into a Solaris 2.6 running on qemu on Windows (setup with no network connectivity), so I thought the easiest would be to compile them into an iso image and mount this image as a CD. Unfortunately I can’t get this to work although I am using the full link (/device…) that I see during startup. I am not sure what I am doing wrong. Also it does not make a difference if I provide this image to qemu as -cdrom or -hdb.

    • qemu is a fast moving target, but I want to say for the sake of solaris and it’s non standard sector sized CD’s, the 512 block (ie install media) should be a hard disk, and the 2048 block sized ISO FS stuff should be CD-ROM.

      • Doh – the image was made with the UFS 1.02 filesystem. I made an ISO9660 image and the automounter worked instantly. However ISO9660 is limited to 8+3 characters and is not case sensitive, and I have Solaris CDs here from that time that do not have these limitations. Which filesystem do they use (hsfs?)? I made a sector to sector copy from a Solaris CD into an iso image and that works as the original. But I have not come up yet with a good way to create images out of my own data that are not ISO9660 but can be mounted in Solaris.

        Do you know an elegant way to get data out of the VM? I only need to transfer a couple of text files. An emulated serial port would be enough ;-). I have trouble setting up connectivity for Solaris on qemu on Windows. Also CDE and OpenWin are stuck during startup, apparently waiting for some network initializiation or very long time out before anything happens. Without connection they start up instantly.

      • The easiest way to get data out is HTTP. Just redirect a port, and it’s super easy… something like -redir tcp:4480::80
        This will listen on port 4480 on the host, and redirect it to port 80 on 10.0.2.15 (ie the VM). With some CGI or scripting you can find file upload and download stuff to work with that. Likewise if your Solaris is new enough ssh can transfer files as well. I’ve heard of people doing NFS (udp only) out of Qemu and it working as well.

        As for the ISO 8.3 limitation, I just make a tar file, and put that on the CD, and un-tar it in the VM, and your long names will come back….

  2. The “tar file in an ISO” solution works from Unix systems, but not from Windows – I tried this and although my long file names were kept, case sensitivity was lost (and some of the programs I need to run have case sensitive directories, files, …).
    I tried hard to setup the VM with connectivity on 10.0.2.15, but CDE or OpenWin hang after graphical login (dtlogin), apparently waiting for some connection that never times out… when I set up the VM without an IP address in the installation setup, I can boot right into the window manager without issues. So at this point the Solaris 2.6 VM does not have any network adapter configured.

    • there is definitely networking issues with Qemu + Solaris… Although try the newer builds, I see that the SS-5 and SS-20 can run the SUN PROMs graphically now!

      The kernel from NeXTSTEP boots, but mine gets lost trying to mount the CD-ROM..

  3. After many many many tries to get some files (basic tar.gz archives) onto Solaris 2.4 via mounting an ISO image I made, I just can’t get it to work.
    I tried using quite a few different programs to create an ISO9660 image, to see if that was the problem, but none of them seemed to do the trick.
    Even though I put the image under hdb / cdrom, the OS doesn’t seem to recognize it… (While installing Solaris everything worked perfectly)
    I’m probably missing something obvious 😛
    Any tips?

Leave a Reply

Your email address will not be published.

Notify me of followup comments via e-mail. You can also subscribe without commenting.