Using installboot(8) in dry-run mode aka. -vn (verbose + nowrite) and first
reading "would install" followed by an "installing" made me uneasy.
Luckily, nothing was written in dry-run mode, it's just that the
softraid specific code fails to honour -n/nowrite.
So make sure it does and pull the printf out of `if (!nowrite)' so we
see the "would install" messages in dry-run mode in the first place.
Output diff for root on CRYPTO softraid on biosboot(8/amd64) to illustrate:
-# installboot -nv sd1
+# ./obj/installboot -nv sd1
would install bootstrap on /dev/rsd1c
using first-stage /usr/mdec/biosboot, second-stage /usr/mdec/boot
sd1: softraid volume with 1 disk(s)
+sd1: would install boot loader on softraid volume
/usr/mdec/boot is 6 blocks x 16384 bytes
-sd0a: installing boot blocks on /dev/rsd0c, part offset 144
+sd0a: would install boot blocks on /dev/rsd0c, part offset 144
master boot record (MBR) at sector 0
partition 3: type 0xA6 offset 64 size
488392001
/usr/mdec/biosboot will be written at sector 64
OK jsing
-/* $OpenBSD: efi_softraid.c,v 1.1 2022/08/15 17:06:43 kn Exp $ */
+/* $OpenBSD: efi_softraid.c,v 1.2 2022/08/29 18:54:43 kn Exp $ */
/*
* Copyright (c) 2012 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2022 Klemens Nanni <kn@openbsd.org>
err(1, "open: %s", realdev);
if (verbose)
- fprintf(stderr, "%s%c: installing boot blocks on %s\n",
- bd.bd_vendor, part, realdev);
+ fprintf(stderr, "%s%c: %s boot blocks on %s\n", bd.bd_vendor,
+ part, (nowrite ? "would install" : "installing"), realdev);
/* Write boot blocks to device. */
md_installboot(diskfd, realdev);
-/* $OpenBSD: i386_softraid.c,v 1.18 2021/10/24 21:24:18 deraadt Exp $ */
+/* $OpenBSD: i386_softraid.c,v 1.19 2022/08/29 18:54:43 kn Exp $ */
/*
* Copyright (c) 2012 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2010 Otto Moerbeek <otto@drijf.net>
sym_set_value(pbr_symbols, "_p_offset", poffset);
if (verbose)
- fprintf(stderr, "%s%c: installing boot blocks on %s, "
- "part offset %u\n", bd.bd_vendor, part, dev, poffset);
+ fprintf(stderr, "%s%c: %s boot blocks on %s, part offset %u\n",
+ bd.bd_vendor, part,
+ (nowrite ? "would install" : "installing"), dev, poffset);
/* Write boot blocks to device. */
write_bootblocks(diskfd, dev, &dl);
bb.bb_bootblk = "XXX";
bb.bb_bootblk_size = sizeof("XXX");
strncpy(bb.bb_dev, dev, sizeof(bb.bb_dev));
+ if (verbose)
+ fprintf(stderr, "%s: %s boot loader on softraid volume\n", dev,
+ (nowrite ? "would install" : "installing"));
if (!nowrite) {
- if (verbose)
- fprintf(stderr, "%s: installing boot loader on "
- "softraid volume\n", dev);
if (ioctl(devfd, BIOCINSTALLBOOT, &bb) == -1)
errx(1, "softraid installboot failed");
sr_status(&bb.bb_bio.bio_status);
-/* $OpenBSD: sparc64_softraid.c,v 1.5 2020/06/08 19:17:12 kn Exp $ */
+/* $OpenBSD: sparc64_softraid.c,v 1.6 2022/08/29 18:54:43 kn Exp $ */
/*
* Copyright (c) 2012 Joel Sing <jsing@openbsd.org>
*
err(1, "open: %s", realdev);
if (verbose)
- fprintf(stderr, "%s%c: installing boot blocks on %s\n",
- bd.bd_vendor, part, realdev);
+ fprintf(stderr, "%s%c: %s boot blocks on %s\n", bd.bd_vendor,
+ part, (nowrite ? "would install" : "installing"), realdev);
/* Write boot blocks to device. */
md_installboot(diskfd, realdev);
bb.bb_bootldr = ldrstore;
bb.bb_bootldr_size = ldrsize;
strncpy(bb.bb_dev, dev, sizeof(bb.bb_dev));
+ if (verbose)
+ fprintf(stderr, "%s: %s boot loader on softraid volume\n", dev,
+ (nowrite ? "would install" : "installing"));
if (!nowrite) {
- if (verbose)
- fprintf(stderr, "%s: installing boot loader on "
- "softraid volume\n", dev);
if (ioctl(devfd, BIOCINSTALLBOOT, &bb) == -1)
errx(1, "softraid installboot failed");
sr_status(&bb.bb_bio.bio_status);