Solved How to read error messages at initial stage of the boot process

Hello,

First of all, I want to thank the FreeBSD developers and community. I have discovered and I have been using FreeBSD as a desktop operating system for about 1 year. Thanks to the forums and the documentation I have already learned so much : how to install FreeBSD, configure it, update from sources, use pkg and ports, create a jail, use zfs, etc. I am grateful to the FreeBSD community for all their work.
Recently, I have done a(nother) fresh installation of FreeBSD, using the installer using ZFS (UEFI+BIOS) option. Everything seems to work. However I get some error messages at startup (UEFI start), just before the FreeBSD logo display. They only appear during a fraction of second, and start with "zio error" I think. I don't know if these messages can be ignored safely.
Can someone explain to me how I can read these messages since they don't appear in /var/run/dmesg.boot. I am not sure they are logged somewhere.

Code:
FreeBSD dorayaki 13.0-RELEASE-p4 FreeBSD 13.0-RELEASE-p4 #0 releng/13.0-n244760-940681634ee: Sun Oct 31 15:10:12 CET 2021     root@dorayaki:/usr/obj/usr/src/amd64.amd64/sys/DORAYAKI  amd64

Here is the result of gpart show /dev/ada0 :
Code:
=>        40  1953525088  ada0  GPT  (932G)
          40      532480     1  efi  (260M)
      532520        1024     2  freebsd-boot  (512K)
      533544         984        - free -  (492K)
      534528    16777216     3  freebsd-swap  (8.0G)
    17311744  1936211968     4  freebsd-zfs  (923G)
  1953523712        1416        - free -  (708K)

Thank you for any help.
 
Can you video the boot process and see if you can catch a frame with the error message on it?

Otherwise it's a bit vague and people might not be able to help - so if you can find a way to get a bit more of the message that might help you get some answers.
 
They are working on a boot logger. Maybe in FreeBSD14 ?
The message could be harmless like something that was tried in the zpool.cache.
 
Can you video the boot process and see if you can catch a frame with the error message on it?
Good idea. I made a video with my phone and could read the messages :
Code:
zio_read error : 5
zio_read error : 5
zio_read error : 5
ZFS : i/o error - all block copies unavailable
ZFS : can't read MOS of pool zdata
Reading loader env vars from /efi/freebsd/loader.env
Setting currdev to disk0p1:
FreeBSD/amd64 EFI loader, Revision 1.1
[...]
Ignoring Boot0001: Only one DP found
Trying ZFS pool
ZFS : can't find pool by guid
Setting currdev to
ZFS : can't find pool by guid
Trying ESP : [...]
[then, the boot messages seem normal]

I have a guess about this issue. Before the installation, this disk was used to store my multimedia files, in a ZFS pool named zdata (my FreeBSD system was on another SSD disk in the pool zroot). My guess is that bsdinstall did not completely overwrite the pool zdata. So the boot process seems to detect some old traces of zdata and trying to boot or mount this zfs pool?

I also tried to the locate /efi/freebsd/loader.env file but it does not exist in my /boot.

The problem seems harmless and the solution might be to locate and erase the old information about zdata.
 
Okay, I am adding more info.

My zpool import command say:
Code:
pool: zsys
     id: 6006566476775889469
  state: FAULTED
status: One or more devices contains corrupted data.
 action: The pool cannot be imported due to damaged devices or data.
    The pool may be active on another system, but can be imported using
    the '-f' flag.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-5E
 config:

    zsys        FAULTED  corrupted data
      ada1      UNAVAIL  corrupted data

   pool: zdata
     id: 4451086499332285680
  state: UNAVAIL
status: One or more devices are missing from the system.
 action: The pool cannot be imported. Attach the missing
    devices and try again.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-3C
 config:

    zdata       UNAVAIL  insufficient replicas
      ada0p1    UNAVAIL  cannot open
zsys is my previous zfs pool where FreeBSD was installed, it was on my SSD disk (ada1).
zdata is my previous zfs pool where I stored multimedia files, it was on ada0.

The ada1 disk also contains Linux filesystems. I resized my linux /home paritition "over" the zsys pool, then I used bsdinstall to install a fresh BSD on the whole ada0 disk.
I didn't think that there still would be information about these two pools somewhere.

Could someone explain to me where exactly this information is and how to remove it?
 
I managed to solve one problem but I am stuck with the other one.

As ada1 do not contain anything concerning FreeBSD and ZFS anymore, I just did :
zpool labelclear ada1
I assume that there still existed zfs labels on ada1 describing a zsys pool that does not exist anymore.

Now zpool import gives me:
Code:
pool: zdata
     id: 4451086499332285680
  state: UNAVAIL
status: One or more devices are missing from the system.
 action: The pool cannot be imported. Attach the missing
    devices and try again.
   see: [URL]https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-3C[/URL]
 config:

    zdata       UNAVAIL  insufficient replicas
      ada0p1    UNAVAIL  cannot open
This was my old zpool on this disk that was at the time located at slice ada0p1. However, after my bsd installation the ada0 disk is organized this way:
Code:
=>        40  1953525088  ada0  GPT  (932G)
          40      532480     1  efi  (260M)
      532520        1024     2  freebsd-boot  (512K)
      533544         984        - free -  (492K)
      534528    16777216     3  freebsd-swap  (8.0G)
    17311744  1936211968     4  freebsd-zfs  (923G)
  1953523712        1416        - free -  (708K)
You can see that ada0p1 is now the efi partition and not a zfs partition anymore.
I suppose I don't want to use labelclear on ada0 since this time I have my zroot zfs pool on this disk.

I tried to zpool destroy zdata, but it says that zdata doesn't exist. I tried to zpool import zdata but it also says zdata doesn't exist. I am a bit confused.
 
I managed to solve my issue. Thank you for your advice. The problem was my lack of understanding of how zfs labels work + bsdinstall not completely erasing previous data.

I figured out that the ZFS labels can be located at the "slice level". I found the faulty unremoved old label using zdb -l /dev/ada0p1 , then I cleared the label using labelclear but first I had to unmount the efi partition :

Code:
umount -f /boot/efi
zpool labelclear ada0p1
mount /boot/efi

Now zfs import tells me that there is no other pool to be imported and the error messages during boot are gone. Problem solved.

I would suggest that :
- the boot process pauses (at least a few seconds) when an error occurs before the BSD logo, so one can actually read the messages
- to improve bsdinstall so that a better "clean up" is performed during the automatic zfs install. When I saw the message warning me that everything would be erased on ada0 when installing FreeBSD, I believed that, but the truth was that the old zfs labels were not deleted (I think this because ada0p1 was now a efi partition and not a zfs filesystem partition anymore).

Anyway thank you for all your help.
 
Back
Top