I've run into an odd problem trying to use with installboot(8) on a
softraid-crypto disk, and I wonder if anyone can suggest a
workaround/solution.


Background
----------

As described in <http://marc.info/?l=openbsd-misc&m=143209815622554&w=1>,
I have an amd64 laptop (Thinkpad T60p) which has multiple sets of
softraid-crypto root/var/usr partitions, sharing common swap and home
partitions:

  sd0
  ---
   |  a    -+- (sd1) softraid crypt, size = 44.5G
   |        | a = root   256M
   |        | d = root2  256M
   |        | e = var    2G
   |        | f = var2   2G
   |        | g = usr    20G
   |        | h = usr2   20G
   |       -+-----
   |  b       swap       6G
   |  j    -+- (sd2) softraid crypt, size = all remaining space
   |        | j = home
  ---      -+-----

sd0 is the physical disk.  It has 3 openbsd-partitions: a, b, and j.

sd1 is a softraid-crypto disk living inside sd0a.  sd1 stores all the
OS partitions.  More precisely, sd1 stores *two* sets of root, var, and
usr partitions.  My starting point is that sd1[aeg] contain a working
OpenBSD 5.6-stable/amd64, and sd1[dfh] are empty.

sd2 is a softraid-crypt disk living inside sd0j.  sd2 stores /home,
and (I think) isn't relevant here.

The boot procedure is to turn the laptop on, and (after memory tests etc)
enter the sd1 passphrase.  The machine will then boot from sd1[aeg] (or
sd1[dfh] if I enter 'boot sr1d:/bsd' at the "boot>" prompt, assuming there's
an OpenBSD installation on those partitions).  I activate sd2 and mount
/home via a perl script run after the machine is running multiuser, i.e.,
this doesn't form part of the OS-level boot sequence.


Problem
-------

I want to move to 5.8... *but* I want to keep the ability to
boot and run 5.6-stable as a backup even after 5.8 is running.
        [I'm pretty confident that 5.8 will install/run fine,
        but I'm less confident that all the perl modules I
        currently use under 5.6 will grok 5.8 properly.]
That is, I'd like to have a new 5.8 install in sd1[aeg], and (a copy of)
my previous 5.6-stable in sd1[dfh], with the latter bootable via entering
"boot sr1d:/bsd" at the "boot>" prompt.

My plan was the following:
1. copy the 5.6-stable OpenBSD installation from sd1[aeg] to sd1[dfh]
2. install 5.8-release on sd1[aeg] from the CD set
3. update 5.8-release on sd1[aeg] to 5.8-stable as usual

However, I've run into trouble with step 1.  In more detail, I did this:

(boot 5.6-stable from partitions sd1[aeg])
# newfs /dev/rsd1d
# mount -o softdep,noatime /dev/sd1d /mnt
# tar|tar copy from / to /mnt
#
# newfs /dev/rsd1f
# mount -o softdep,noatime,nodev,nosuid /dev/sd1d /mnt/var
# tar|tar copy from /var to /mnt/var
#
# newfs /dev/rsd1h
# mount -o softdep,noatime,nodev /dev/sd1d /mnt/usr
# tar|tar copy from /usr to /mnt/usr
#
# edit /mnt/etc/fstab to change from mounting sd1[aeg] to sd1[dfh]
# fiddle around a bit, including unmounting /mnt/var
#
# mount
/dev/sd1a on / type ffs (local, noatime, softdep)
mfs:1891 on /tmp type mfs (asynchronous, local, nodev, nosuid, size=5000000 
1024-blocks)
/dev/sd1e on /var type ffs (local, noatime, nodev, nosuid, softdep)
/dev/sd1g on /usr type ffs (local, noatime, nodev, softdep)
mfs:17343 on /usr/tmp type mfs (asynchronous, local, nodev, nosuid, 
size=2000000 1024-blocks)
/dev/sd1d on /mnt type ffs (local, noatime, softdep)
/dev/sd1h on /mnt/usr type ffs (local, noatime, nodev, nosuid, softdep)
# installboot -v -r /mnt sd1             <----- note  -r /mnt  here
Using /mnt as root
installing bootstrap on /dev/rsd1c
using first-stage /mnt/usr/mdec/biosboot, second-stage /mnt/usr/mdec/boot
sd1: softraid volume with 1 disk(s)
sd1: installing boot loader on softraid volume
/mnt/usr/mdec/boot is 5 blocks x 16384 bytes
sd0a: installing boot blocks on /dev/rsd0c, part offset 208
master boot record (MBR) at sector 0
        partition 3: type 0xA6 offset 64 size 1465144001
/mnt/usr/mdec/biosboot will be written at sector 64
# reboot

(N.b. all the tar|tar copies use GNU tar from the gtar-1.27.1-static
package.  This handles sparse files, and can copy (create) /dev entries
fine.)

At this point the machine can boot and run sd1[aeg] fine.  *But* if I
enter "boot sr1d:/bsd" at the "boot>" prompt, the machine boots sd1[aeg],
not the desired sd1[dfh].  In other words, at this point my "backup"
sd1[dfh] partitions aren't usefully bootable :(.


Questions
---------
I guess my basic question is, what's wrong here and what's the cleanest
way to achieve my desired ends (assuming they're achievable)?

Of course, I could go ahead install 5.8 on sd1[aeg]... but then I wouldn't
have the ability to (easily) boot 5.6-stable as a backup.

I read with interest krw@'s recent Undeadly description
<http://www.undeadly.org/cgi?action=article&sid=20151101173739&mode=expanded&count=3>
of fixing a softraid-crypto bug in installboot(8),
| I spent some time helping stsp@ fix installboot(8) to handle softraid
| crypto installs, while stoutly maintaining my ignorance of softraid
| crypto. I failed to see a bug stsp@ introduced, which lead to some
| hilarity a few days later when I backed out the change at the same
| time that stsp@ was committing a real fix. Fortunately stsp@ was
| able to set things right, and installboot(8) now works for softraid
| crypto setups and non-softraid setups.

Is this bug relevant to my situation?  If so, then one route forward
might be to grab the -current installboot(8) source, nuke any pledge(2),
compile it on my 5.6-stable, and use that binary for my 'installboot'
invocation.  Would this be a good way to proceed?

ciao,

-- 
-- "Jonathan Thornburg [remove -animal to reply]" 
<jth...@astro.indiana-zebra.edu>
   Dept of Astronomy & IUCSS, Indiana University, Bloomington, Indiana, USA
   "There was of course no way of knowing whether you were being watched
    at any given moment.  How often, or on what system, the Thought Police
    plugged in on any individual wire was guesswork.  It was even conceivable
    that they watched everybody all the time."  -- George Orwell, "1984"

Reply via email to