Bug 219849

Summary: Attention: 11.0-RELEASE (or 10.3-RELEASE) reuse of "bsdinstall/diskmgmt" DESTROY a gpt partitions, OS cant boot!
Product: Base System Reporter: Demis <demis>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Some People CC: demis, jwb
Priority: --- Keywords: install
Version: 11.0-RELEASE   
Hardware: amd64   
OS: Any   

Description Demis 2017-06-07 17:38:06 UTC
Re-install FreeBSD 11.0 amd64 killing system boot.

How to reproduce?

The description is long.
The source data:

Make setup on factory clean hdd.
boot from CD
install
keymap selection
set hosname
distribution select
add doc
add src

Partitioning
Manual

Create
Select GPT
Create -> freebsd-boot 64KB
Create -> freebsd-ufs 4GB / (uncheck journal in options)
Create -> freebsd-swap 4GB
Create -> freebsd-ufs 16GB /var (uncheck journal in options)
Create -> freebsd-ufs 40GB /usr (uncheck journal in options)
(Not all space)

Finish
Commit

Wait to end setup.
(set root pass, network, time zone,date,time, ntpd)
System hardening select all but NOT selected only "randomize the PID" and "disable sendmail"
Adding one user witch invate "wheel"
Reboot.
Remove CD.

logon as root.
Ok.
Good.
It's working

=================
Next step.
I want re-install with change partition size.
Reboot.
Load again from CD
=================

install
keymap selection
set hosname
distribution select
add doc
add src

Partitioning
Manual

See old partition, delete all, no touch GPT sheme.

select freebsd-ufs 40GB /usr -> delete
select freebsd-ufs 16GB /var -> delete
select freebsd-swap 4GB -> delete
select freebsd-ufs 4GB / -> delete
select freebsd-boot 64KB -> delete

Create -> freebsd-boot 64KB
Create -> freebsd-ufs 3GB / (uncheck journal in options)
Create -> freebsd-swap 3GB (auto recalc to 2Gb)
Create -> freebsd-ufs 15GB /var (auto recalc to 13Gb) (uncheck journal in options)
Create -> freebsd-ufs 30GB /usr (auto recalc to 27Gb) (uncheck journal in options)
(Not all space)

Finish
Commit

Wait to end setup.
(set root pass, network, time zone,date,time, ntpd)
System hardening select all but NOT selected only "randomize the PID" and "disable sendmail"
Adding one user witch invate "wheel"
Reboot.
Remove CD.

Fail boot.

Get messages:
Code:

Starting file system checks:
/dev/ada0p2: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ada0p2: clean, 724414 free (342 frags, 90509 blocks, 0.0% fragmentation)
Cannot find file system super block
Cannot find file system super block
Cannot find file system super block
Cannot find file system super block
THE FOLOWING FILE SYSTEMS HAD AN UNEXPECTED INCONSISTENCY:
ufs: /dev/ada0p4 (/var), ufs: /dev/ada0p5 (/usr)
Warning! Some of the devices might not be available : retrying
Waiting 30s for the root mount holders: usbus1 usbus0
...
(white message from usb, keyboard, etc (no errors)
...
Restarting file system checks:
/dev/ada0p2: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ada0p2: clean, 724414 free (342 frags, 90509 blocks, 0.0% fragmentation)
Cannot find file system super block
Cannot find file system super block
Cannot find file system super block
Cannot find file system super block
THE FOLOWING FILE SYSTEMS HAD AN UNEXPECTED INCONSISTENCY:
ufs: /dev/ada0p4 (/var), ufs: /dev/ada0p5 (/usr)
Unknown error 3: help!
ERRROR: ABORTING BOOT (sending GIGTERM to parent)!
[date] [time] init: /bin/sh on /etc/rc terminated abnormally, going to single user mode
Enter  full pathname of shell or RETURN for /bin/sh:
Cannot read termcap database:
using dumb terminal settings.
#

For next setup use from CLI
gpart delete -i {1,2,3,4,5,} ada0
gpart destroy ada0 
or other method to destruct data.

This persist on VM too.
Virtual machine with fixed(!) size of VM (VirtualBox) file shows the problem.
(https://forums.freebsd.org/threads/61191/)
Comment 1 Demis 2017-06-08 12:37:33 UTC
It's tested on versions:
First instal		Second install
FreeBSD 11.0 amd64 disk1 - FreeBSD 11.0 amd64 disk1
FreeBSD 11.0 amd64 disk1 - FreeBSD 10.3 amd64 disk1
FreeBSD 10.3 amd64 disk1 - FreeBSD 10.3 amd64 disk1

No error when:
First instal		Second install
FreeBSD 11.0 amd64 disk1 - FreeBSD 7.1 amd64 disk1

i386 NOT tested.
Comment 2 Demis 2017-06-09 08:22:24 UTC
It's tested on versions:
First instal		Second install
FreeBSD 11.0 amd64 disk1 - FreeBSD 9.3 amd64 disk1
Comment 3 Jason W. Bacon freebsd_committer freebsd_triage 2020-06-19 21:20:00 UTC
I'm seeing something similar on 12.1-RELEASE.  PowerEdge R415 set to boot via BIOS, not UEFI.

I tried doing a scripted install with the following in installerconfig:

PARTITIONS="mfid0 gpt { 128G freebsd-ufs /, 4G freebsd-swap }"

The system had been running with root on zfs.

( Note also that the "gpt" tag in PARTITIONS is undocumented, which is another issue. Without it, the partition scheme defaults to MBR, which seems odd. )

Installation went fine, but upon reboot I got "no bootable disks found".

I tried a manual install, deleting and recreating the partitions, but not the GPT itself.  Still same problem.

Then did another manual install, deleting and recreating the GPT, and now it works fine.