Bug 172550

Summary: stage booting via grub and loader does not work any more after revision 241053
Product: Base System Reporter: Ralf Wenk <IZ-FreeBSD0701>
Component: kernAssignee: Andrey V. Elsukov <ae>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 10.0-CURRENT   
Hardware: Any   
OS: Any   

Description Ralf Wenk 2012-10-09 23:30:26 UTC
loader(8) does not find the kernel any more after revision 241053.

The message shown is "can't load 'kernel'".

Comparing the show-command output between a loader build at Sep 3 2012 and
Oct 5 2012 shows that a lot of variables (e.g. "kernelname") are missing.

Fix: 

Reverting revision 241053 fixes the problem.
I just build loader with the pre 241053 versions of sys/boot/common/disk.c,
sys/boot/common/disk.h and sys/boot/i386/libi386/biosdisk.c and it worked again
as expected.
How-To-Repeat: This machine uses multiboot with grub as bootloader.
The menuentry in grub.cf for FreeBSD which used to work is
        menuentry "FreeBSD, via /boot/loader (on /dev/sda7[a])" {
        #   set root=(hd0,7,a)
            set root=(hd0,7)
            kfreebsd /boot/loader
        }

The partition layout as shown by gpart is:
# gpart show
=>       63  312581745  ada0  MBR  (149G)
         63     674667     1  linux-data  (329M)
     674730       1110        - free -  (555k)
     675840    1536000     2  ntfs  (750M)
    2211840       5130        - free -  (2.5M)
    2216970   65529135     3  ntfs  [active]  (31G)
   67746105  244830600     4  ebr  (116G)
  312576705       5103        - free -  (2.5M)

=>        0  244830600  ada0s4  EBR  (116G)
          0   65529135       1  linux-data  (31G)
   65529135    7823655  1040146  linux-swap  (3.7G)
   73352790   65529135  1164331  freebsd  (31G)
  138881925  105948675          - free -  (50G)

=>       0  65529072  ada0s7  BSD  (31G)
         0  65529072       1  freebsd-ufs  (31G)
#
Comment 1 Andrey V. Elsukov freebsd_committer freebsd_triage 2012-10-17 16:45:24 UTC
Responsible Changed
From-To: freebsd-bugs->ae

Take.
Comment 2 Andrey V. Elsukov freebsd_committer freebsd_triage 2012-10-19 15:44:01 UTC
This is a multi-part message in MIME format.
Comment 3 Ralf Wenk 2012-10-22 08:19:19 UTC
Hi Andrey,

> Can you please do several test to help debug this issue?

sure.

> I need to know these things:
> 1. With working loader, can you escape into the loader prompt and look,=

> what values have currdev and loaddev variables? You can do this with
> =60show=60 command.

OK show currdev
disk0p7:

OK show loaddev
disk0p7:

> 2. With recent loader that doesn't work with your system do the same st=
eps.

OK show currdev
disk0p7:

OK show loaddev
disk0p7:
=20
> Also can you run =60lsdev=60 command and make sure that all partitions =
will
> shown in both cases? Also if you have some free time, can you try the

1. working loader:

OK lsdev
cd devices:
disk devices:
    disk0:   BIOS drive C:
      disk0s1: Linux
      disk0s1: DOS/Windows
      disk0s3: DOS/Windows
      disk0s4: Unknown
      disk0s5: Linux
      disk0s6: Linux swap
      disk0s7: FreeBSD
        disk0s7a: FreeBSD UFS
pxe devices:
OK

2. recent loader:

OK lsdev
cd devices:
disk devices:
    disk0:   BIOS drive C:
      disk0s1: Linux
      disk0s1: DOS/Windows
      disk0s3: DOS/Windows
      disk0s4: Unknown
      disk0s5: Linux
      disk0s6: Linux swap
      disk0s7: FreeBSD
        disk0s7a: FreeBSD UFS
pxe devices:
OK

> loader, that is attached to this email? It compiled with enabled
> DISK_DEBUG support and will print several additional lines to the
> console. And if you will able to take a screenshot or photo, or log fro=
m
> serial console, this will be very helpful.

After the loader stops the screen looks:

FreeBSD/x86 bootstrap loader, Revision 1.1
(butcher=40butcher-nb, Fri Oct 19 18:34:36 MSK 2012)
disk_open: disk0p7: unit 0, slice 7, partition 255 =3D> 0xdcd48680
disk_open: disk0p7: could not open
disk_open: disk0p7: unit 0, slice 7, partition 255 =3D> 0xdcd48680
disk_open: disk0p7: could not open
disk_open: disk0p7: unit 0, slice 7, partition 255 =3D> 0xdcd48680
disk_open: disk0p7: could not open

disk_open: disk0p7: unit 0, slice 7, partition 255 =3D> 0xdcd5f230
disk_open: disk0p7: could not open
disk_open: disk0p7: unit 0, slice 7, partition 255 =3D> 0xdcd5f230
disk_open: disk0p7: could not open
disk_open: disk0p7: unit 0, slice 7, partition 255 =3D> 0xdcd5f230
disk_open: disk0p7: could not open
disk_open: disk0p7: unit 0, slice 7, partition 255 =3D> 0xdcd5f230
disk_open: disk0p7: could not open
disk_open: disk0p7: unit 0, slice 7, partition 255 =3D> 0xdcd5f230
disk_open: disk0p7: could not open
disk_open: disk0p7: unit 0, slice 7, partition 255 =3D> 0xdcd5f230
disk_open: disk0p7: could not open
can't load 'kernel'

Type '?' for a list of commands, 'help' for more detailed help.
OK

The value of the currdev and loaddev variables is 'disk0p7:'.
lsdev shows:

OK lsdev
cd devices:
disk devices:
    disk0:   BIOS drive C:
disk_open: disk0: unit 0, slice -1, partition -1 =3D> 0xdcd5f280
disk_insert: disk0: cached
disk_open: disk0: offset 0 =3D> 0xdcd5f280
      disk0s1: Linux
      disk0s1: DOS/Windows
      disk0s3: DOS/Windows
      disk0s4: Unknown
      disk0s5: Linux
      disk0s6: Linux swap
      disk0s7: FreeBSD
        disk0s7a: FreeBSD UFS
disk_close: disk0: closed =3D> 0xdcd5f280 =5B1=5D
pxe devices:
OK


Kind regards, Ralf
Comment 4 Andrey V. Elsukov freebsd_committer freebsd_triage 2012-10-22 12:14:57 UTC
State Changed
From-To: open->closed

Fixed in r241876. Thanks!