Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 06 May 2023 06:05:12 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 271262] bsdinstaller in AutoZFS + MBR mode always wipes disklabel - rendering system non-bootable
Message-ID:  <bug-271262-227-99E0lURLTf@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-271262-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-271262-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271262

--- Comment #2 from Henryk Paluch <hpaluch@seznam.cz> ---
Additional details:

The original installation disklabel looks that way:
(the da0s1a was create by install using: gpart add  -i 1 -t freebsd-zfs -s
2147483648b "da0s1")

# /dev/da0s1:
8 partitions:
#          size     offset    fstype   [fsize bsize bps/cpg]
  a:    4194304          0       ZFS=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20
  b:    4194304    4194304      swap=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20
  c:   18874304          0    unused        0     0     # "raw" part, don't
edit
  d:    4194304    8388608       ZFS=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20

Please notice that da0s1 starts at 0 - so extreme care must be taken
to not overwrite disklabel on 2nd sector (byte offest from 512 to 1023).

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Using development machine with 2nd disk and GDB I have found following
stacktrace (by putting breakpoint just at __sys_write):

reakpoint 1.2, _write () at _write.S:4
4       _write.S: No such file or directory.
(gdb) bt
#0  _write () at _write.S:4
#1  0x00000008011af1f6 in __thr_write (fd=3D6, buf=3D0x7fffffffb040, nbytes=
=3D4096)
    at /usr/src/lib/libthr/thread/thr_syscalls.c:618
#2  0x000000000104c900 in zero_label (path=3Dpath@entry=3D0x7fffffffc190
"/dev/da1s1a")
    at /usr/src/sys/contrib/openzfs/cmd/zpool/zpool_vdev.c:905
#3  0x000000000104b5f0 in make_disks (zhp=3Dzhp@entry=3D0x0, nv=3D0x801c104=
20)
    at /usr/src/sys/contrib/openzfs/cmd/zpool/zpool_vdev.c:1048
#4  0x000000000104b333 in make_disks (zhp=3Dzhp@entry=3D0x0,
nv=3Dnv@entry=3D0x801c1d080)
    at /usr/src/sys/contrib/openzfs/cmd/zpool/zpool_vdev.c:1070
#5  0x000000000104b8e1 in make_root_vdev (zhp=3D0x6, zhp@entry=3D0x0,
props=3D<optimized out>, force=3Dforce@entry=3D1,=20
    check_rep=3D<optimized out>, replacing=3Dreplacing@entry=3DB_FALSE,
dryrun=3Ddryrun@entry=3DB_FALSE, argc=3D1,=20
    argv=3D0x801c36040) at
/usr/src/sys/contrib/openzfs/cmd/zpool/zpool_vdev.c:1864
#6  0x0000000001036ef9 in zpool_do_create (argc=3D<optimized out>,
argv=3D<optimized out>)
    at /usr/src/sys/contrib/openzfs/cmd/zpool/zpool_main.c:1587
#7  0x00000000010364b6 in main (argc=3D9, argv=3D0x7fffffffeb38)
    at /usr/src/sys/contrib/openzfs/cmd/zpool/zpool_main.c:10755

The problematic code is on=20

#3  0x000000000104b5f0 in make_disks (zhp=3Dzhp@entry=3D0x0, nv=3D0x801c104=
20)
    at /usr/src/sys/contrib/openzfs/cmd/zpool/zpool_vdev.c:1048

Which looks like:

                       ret =3D zero_label(udevpath);
                        if (ret)
                                return (ret);


Here is source pointer but the line offset is a bit different from what I s=
ee
in local sources of 13.2. release:
-
https://cgit.freebsd.org/src/blame/sys/contrib/openzfs/cmd/zpool/zpool_vdev=
.c?h=3Dreleng/13.2#n1080


And this is problem - overwriting disklabel..

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-271262-227-99E0lURLTf>