Hello, I've been testing full disk encryption using the softraid crypto discipline on an old Thinkpad T61, using OpenBSD amd64 6.1-release (dmesg below). I just followed the FAQ: creating a wd0a RAID partition, then an encrypted sd1 using bioctl (sd0 was the USB thumb drive I booted from), then installed OpenBSD as usual, rebooted from the disk (sd0 was then the encrypted partition), and everything worked great. Very neat.
Then, out of curiosity, I did the following while the system was running: # bioctl -d sd0 Somehow I expected a "device busy" error message and no consequences, just like when one tries to unmount a busy file system, but instead the kernel immediately panicked ("init died"). Well, that was a bit harsh but I guess I only got what I asked for. Anyway, the interesting part happened when I rebooted the machine. Instead of asking me for my passphrase as before, I got the following (copied by hand): Using drive 0, partition 0. Loading ...... probing: pc0 mem[630K 997M a20=on] disk: hd0+ sr0 >> OpenBSD amd64 BOOT 3.33 open(hd0a:/etc/boot.conf): Invalid argument boot> cannot open hd0a:/etc/random.seed: Invalid argument booting hd0a:/bsd: open hd0a:/bsd: Invalid argument failed(22). will try /bsd boot> cannot open hd0a:/etc/random.seed: Invalid argument booting hd0a:/bsd: open hd0a:/bsd: Invalid argument failed(22). will try /bsd Turning timeout off. boot> So I booted from the USB thumb drive again and tried to re-attach the softraid device: # bioctl -c C -l /dev/wd0a softraid0 Passphrase: sd1 at scsibus4 targ 1 lun 0: <OPENBSD, SR CRYPTO, 006> SCSI2 0/direct fixed sd1: 114473MB, 512 bytes/sector, 234441056 sectors softraid0: volume sd1 is roaming, it used to be sd0, updating metadata softraid0: volume sd1 is roaming, it used to be sd0, updating metadata softraid0: CRYPTO volume attached as sd1 # I was then able to fsck all the partitions on sd1 and mount them with no apparent problem. Re-booting from the computer's disk still failed with the same "Invalid argument" error messages as above though. So I guess that detaching the softraid volume while in use somehow trashed part of the softraid metadata, enough to prevent booting but not enough to prevent the softraid device from being re-attached. Just for fun I wiped the disk clean with dd and tried the whole thing a second time and got the exact same result again. Moral of the story: don't detach the softraid volume while in use (duh). Still, I have a few questions, just out of curiosity: - is the panic intended (well, known to the developers and considered normal; I hesitate to call it a feature) or is it an oversight? - I would have thought that, once the softraid volume has been created, its metadata wouldn't need to change (unless the passphrase is changed, or the volume is roaming, as seen above). Any idea why part of it gets trashed? - is there a way to get the computer to boot again, short of wiping the disk with dd and starting from scratch again? Cheers, Philippe OpenBSD 6.1 (GENERIC.MP) #20: Sat Apr 1 13:45:56 MDT 2017 dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 1030422528 (982MB) avail mem = 994574336 (948MB) mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xe0010 (73 entries) bios0: vendor LENOVO version "7LETD0WW (2.30 )" date 02/27/2012 bios0: LENOVO 7659AE6 acpi0 at bios0: rev 2 acpi0: sleep states S0 S3 S4 S5 acpi0: tables DSDT FACP SSDT ECDT TCPA APIC MCFG HPET SLIC BOOT ASF! SSDT SSDT SSDT SSDT SSDT acpi0: wakeup devices LID_(S3) SLPB(S3) IGBE(S4) EXP0(S4) EXP1(S4) EXP2(S4) EXP3(S4) EXP4(S4) PCI1(S4) USB0(S3) USB1(S3) USB2(S3) USB3(S3) USB4(S3) EHC0(S3) EHC1(S3) [...] acpitimer0 at acpi0: 3579545 Hz, 24 bits acpiec0 at acpi0 acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Core(TM)2 Duo CPU T7300 @ 2.00GHz, 2194.88 MHz cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,NXE,LONG,LAHF,PERF,SENSOR cpu0: 4MB 64b/line 16-way L2 cache cpu0: smt 0, core 0, package 0 mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges cpu0: apic clock running at 199MHz cpu0: mwait min=64, max=64, C-substates=0.2.2.2.2, IBE cpu1 at mainbus0: apid 1 (application processor) cpu1: Intel(R) Core(TM)2 Duo CPU T7300 @ 2.00GHz, 1995.01 MHz cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,NXE,LONG,LAHF,PERF,SENSOR cpu1: 4MB 64b/line 16-way L2 cache cpu1: smt 0, core 1, package 0 ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 20, 24 pins acpimcfg0 at acpi0 addr 0xf0000000, bus 0-63 acpihpet0 at acpi0: 14318179 Hz acpiprt0 at acpi0: bus 0 (PCI0) acpiprt1 at acpi0: bus -1 (AGP_) acpiprt2 at acpi0: bus 2 (EXP0) acpiprt3 at acpi0: bus 3 (EXP1) acpiprt4 at acpi0: bus 4 (EXP2) acpiprt5 at acpi0: bus 5 (EXP3) acpiprt6 at acpi0: bus 13 (EXP4) acpiprt7 at acpi0: bus 21 (PCI1) acpicpu0 at acpi0: !C3(250@17 mwait.3@0x20), !C2(500@1 mwait.1@0x10), C1(1000@1 mwait.1), PSS acpicpu1 at acpi0: !C3(250@17 mwait.3@0x20), !C2(500@1 mwait.1@0x10), C1(1000@1 mwait.1), PSS acpipwrres0 at acpi0: PUBS, resource for USB0, USB2, USB4, EHC0, EHC1 acpitz0 at acpi0: critical temperature is 127 degC acpitz1 at acpi0: critical temperature is 100 degC acpibtn0 at acpi0: LID_ acpibtn1 at acpi0: SLPB "PNP0303" at acpi0 not configured "IBM0057" at acpi0 not configured tpm0 at acpi0: TPM_ addr 0xfed40000/0x5000: Atmel 97SC3203 rev 0x5 acpibat0 at acpi0: BAT0 model "92P1131" serial 8030 type LION oem "SANYO" acpiac0 at acpi0: AC unit online acpithinkpad0 at acpi0 "PNP0C14" at acpi0 not configured acpidock0 at acpi0: GDCK not docked (0) acpivideo0 at acpi0: VID_ acpivout0 at acpivideo0: LCD0 acpivideo1 at acpi0: VID_ cpu0: Enhanced SpeedStep 2194 MHz: speeds: 2001, 2000, 1600, 1200, 800 MHz pci0 at mainbus0 bus 0 pchb0 at pci0 dev 0 function 0 "Intel GM965 Host" rev 0x0c inteldrm0 at pci0 dev 2 function 0 "Intel GM965 Video" rev 0x0c drm0 at inteldrm0 intagp0 at inteldrm0 agp0 at intagp0: aperture at 0xe0000000, size 0x10000000 inteldrm0: msi inteldrm0: 1440x900, 32bpp wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation) wsdisplay0: screen 1-5 added (std, vt100 emulation) "Intel GM965 Video" rev 0x0c at pci0 dev 2 function 1 not configured em0 at pci0 dev 25 function 0 "Intel ICH8 IGP M AMT" rev 0x03: msi, address 00:1a:6b:d2:10:56 uhci0 at pci0 dev 26 function 0 "Intel 82801H USB" rev 0x03: apic 1 int 20 uhci1 at pci0 dev 26 function 1 "Intel 82801H USB" rev 0x03: apic 1 int 21 ehci0 at pci0 dev 26 function 7 "Intel 82801H USB" rev 0x03: apic 1 int 22 usb0 at ehci0: USB revision 2.0 uhub0 at usb0 configuration 1 interface 0 "Intel EHCI root hub" rev 2.00/1.00 addr 1 azalia0 at pci0 dev 27 function 0 "Intel 82801H HD Audio" rev 0x03: msi azalia0: codecs: Analog Devices AD1984, Conexant/0x2bfa, using Analog Devices AD1984 audio0 at azalia0 ppb0 at pci0 dev 28 function 0 "Intel 82801H PCIE" rev 0x03: msi pci1 at ppb0 bus 2 ppb1 at pci0 dev 28 function 1 "Intel 82801H PCIE" rev 0x03: msi pci2 at ppb1 bus 3 iwn0 at pci2 dev 0 function 0 "Intel Wireless WiFi Link 4965" rev 0x61: msi, MIMO 2T3R, MoW1, address 00:13:e8:a3:b8:29 ppb2 at pci0 dev 28 function 2 "Intel 82801H PCIE" rev 0x03: msi pci3 at ppb2 bus 4 ppb3 at pci0 dev 28 function 3 "Intel 82801H PCIE" rev 0x03: msi pci4 at ppb3 bus 5 ppb4 at pci0 dev 28 function 4 "Intel 82801H PCIE" rev 0x03: msi pci5 at ppb4 bus 13 uhci2 at pci0 dev 29 function 0 "Intel 82801H USB" rev 0x03: apic 1 int 16 uhci3 at pci0 dev 29 function 1 "Intel 82801H USB" rev 0x03: apic 1 int 17 uhci4 at pci0 dev 29 function 2 "Intel 82801H USB" rev 0x03: apic 1 int 18 ehci1 at pci0 dev 29 function 7 "Intel 82801H USB" rev 0x03: apic 1 int 19 usb1 at ehci1: USB revision 2.0 uhub1 at usb1 configuration 1 interface 0 "Intel EHCI root hub" rev 2.00/1.00 addr 1 ppb5 at pci0 dev 30 function 0 "Intel 82801BAM Hub-to-PCI" rev 0xf3 pci6 at ppb5 bus 21 cbb0 at pci6 dev 0 function 0 "Ricoh 5C476 CardBus" rev 0xba: apic 1 int 16 "Ricoh 5C832 Firewire" rev 0x04 at pci6 dev 0 function 1 not configured sdhc0 at pci6 dev 0 function 2 "Ricoh 5C822 SD/MMC" rev 0x21: apic 1 int 18 sdhc0: SDHC 1.0, 33 MHz base clock sdmmc0 at sdhc0: 4-bit, sd high-speed, mmc high-speed "Ricoh 5C843 MMC" rev 0x11 at pci6 dev 0 function 3 not configured "Ricoh 5C592 Memory Stick" rev 0x11 at pci6 dev 0 function 4 not configured "Ricoh 5C852 xD" rev 0x11 at pci6 dev 0 function 5 not configured cardslot0 at cbb0 slot 0 flags 0 cardbus0 at cardslot0: bus 22 device 0 cacheline 0x8, lattimer 0xb0 pcmcia0 at cardslot0 pcib0 at pci0 dev 31 function 0 "Intel 82801HEM LPC" rev 0x03 pciide0 at pci0 dev 31 function 2 "Intel 82801HBM SATA" rev 0x03: DMA, channel 0 wired to compatibility, channel 1 wired to compatibility wd0 at pciide0 channel 0 drive 0: <HITACHI HTS541612J9SA00 3H> wd0: 16-sector PIO, LBA48, 114473MB, 234441648 sectors wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5 atapiscsi0 at pciide0 channel 1 drive 0 scsibus1 at atapiscsi0: 2 targets cd0 at scsibus1 targ 0 lun 0: <HL-DT-ST, DVDRAM GSA-U10N, 1.05> ATAPI 5/cdrom removable cd0(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 2 ichiic0 at pci0 dev 31 function 3 "Intel 82801H SMBus" rev 0x03: apic 1 int 23 iic0 at ichiic0 usb2 at uhci0: USB revision 1.0 uhub2 at usb2 configuration 1 interface 0 "Intel UHCI root hub" rev 1.00/1.00 addr 1 usb3 at uhci1: USB revision 1.0 uhub3 at usb3 configuration 1 interface 0 "Intel UHCI root hub" rev 1.00/1.00 addr 1 usb4 at uhci2: USB revision 1.0 uhub4 at usb4 configuration 1 interface 0 "Intel UHCI root hub" rev 1.00/1.00 addr 1 usb5 at uhci3: USB revision 1.0 uhub5 at usb5 configuration 1 interface 0 "Intel UHCI root hub" rev 1.00/1.00 addr 1 usb6 at uhci4: USB revision 1.0 uhub6 at usb6 configuration 1 interface 0 "Intel UHCI root hub" rev 1.00/1.00 addr 1 isa0 at pcib0 isadma0 at isa0 pckbc0 at isa0 port 0x60/5 irq 1 irq 12 pckbd0 at pckbc0 (kbd slot) wskbd0 at pckbd0: console keyboard, using wsdisplay0 pms0 at pckbc0 (aux slot) wsmouse0 at pms0 mux 0 wsmouse1 at pms0 mux 0 pms0: Synaptics touchpad, firmware 6.2 pcppi0 at isa0 port 0x61 spkr0 at pcppi0 aps0 at isa0 port 0x1600/31 vmm0 at mainbus0: VMX uvideo0 at uhub1 port 5 configuration 1 interface 0 "Chicony Electronics Co., Ltd. Integrated Camera" rev 2.00/3.20 addr 2 video0 at uvideo0 vscsi0 at root scsibus2 at vscsi0: 256 targets softraid0 at root scsibus3 at softraid0: 256 targets sd0 at scsibus3 targ 1 lun 0: <OPENBSD, SR CRYPTO, 006> SCSI2 0/direct fixed sd0: 114473MB, 512 bytes/sector, 234441056 sectors root on sd0a (d782c9a66e2d2c5b.a) swap on sd0b dump on sd0b umass0 at uhub1 port 1 configuration 1 interface 0 "General USB Flash Disk" rev 2.00/11.00 addr 3 umass0: using SCSI over Bulk-Only scsibus4 at umass0: 2 targets, initiator 0 sd1 at scsibus4 targ 1 lun 0: <General, USB Flash Disk, 1100> SCSI0 0/direct removable serial.090c1000000000011599 sd1: 15474MB, 512 bytes/sector, 31690752 sectors Automatic boot in progress: starting file system checks. /dev/sd0a (d782c9a66e2d2c5b.a): file system is clean; not checking /dev/sd0e (d782c9a66e2d2c5b.e): file system is clean; not checking /dev/sd0d (d782c9a66e2d2c5b.d): file system is clean; not checking setting tty flags pf enabled starting network reordering libraries: done. starting early daemons: syslogd pflogd ntpd. starting RPC daemons:. savecore: no core dump checking quotas: done. clearing /tmp kern.securelevel: 0 -> 1 creating runtime link editor directory cache. preserving editor files. starting network daemons: sshd smtpd sndiod. starting local daemons: cron. Wed Aug 16 16:09:25 CST 2017