Bug 282465 - Corrupted bootloader font after update to 14.2-STABLE #0 stable/14-4e8444d575 after 26 October
Summary: Corrupted bootloader font after update to 14.2-STABLE #0 stable/14-4e8444d575...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 14.1-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: Warner Losh
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2024-11-01 08:48 UTC by jakub_lach
Modified: 2024-11-07 00:51 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jakub_lach 2024-11-01 08:48:31 UTC
26 Oct was fine, now after a rebuild the booting menu looks similar to bug #275304 (garbled)
Comment 1 jakub_lach 2024-11-01 08:55:32 UTC
I've noticed https://cgit.freebsd.org/src/commit/?h=stable/14&id=4d3b05a8530e42f7494dd3fbab8d017adb433b14 but it shouldn't brake font? I don't recall I've set anything nonstandard part from autoboot_delay="1"
Comment 2 Martin Birgmeier 2024-11-01 15:24:45 UTC
I just upgraded to 4e8444d5750a and have the same issue (amd64 and i386)

-- Martin
Comment 3 Martin Birgmeier 2024-11-01 15:31:30 UTC
(In reply to jakub_lach from comment #1)

This commit is certainly the root cause: LOADER_BIOS_TEXTONLY has been turned on.

Do you have loader_logo="beastie" in /boot/loader.conf? - This is what I have, and maybe it needs some fancy text graphics capabilities.

-- Martin
Comment 4 jakub_lach 2024-11-01 15:45:31 UTC
(In reply to Martin Birgmeier from comment #3)

No beastie here, just defaults. Ascii border is garbled as previously with ports.
Comment 5 Martin Birgmeier 2024-11-02 06:50:39 UTC
Try this patch on /boot/lua/drawer.lua:

--- /boot/lua/drawer.lua        2024-05-10 18:42:55.000000000 +0200
+++ /tmp/drawer.lua     2024-11-02 07:49:23.444324000 +0100
@@ -210,7 +210,7 @@
        if core.isSerialConsole() then
                return "ascii"
        end
-       return "double"
+       return "ascii"
 end
 
 local function drawframe()

-- Martin
Comment 6 jakub_lach 2024-11-02 12:06:25 UTC
(In reply to Martin Birgmeier from comment #5)

Do you know why double would stop working? Just making sure I know what's going on, as I really cannot afford to brick loader.
Comment 7 Martin Birgmeier 2024-11-02 13:01:00 UTC
(In reply to jakub_lach from comment #6)

I am already using this on my machines, so no worries :-)

As far as I could see, this file just deals with character art for drawing boxes. It uses escape sequences to draw pretty double lines, but these are not supported anymore with LOADER_BIOS_TEXTONLY being set.

Using "ascii" instead of "double" seems to use old-fashioned ASCII characters instead.

-- Martin
Comment 8 Martin Birgmeier 2024-11-02 13:09:31 UTC
I just looked a bit closer at /boot/loader/drawer.lua. It seems you can also set

loader_menu_frame=ascii

in /boot/loader.conf to achieve the same effect.

-- Martin
Comment 9 Martin Birgmeier 2024-11-02 13:12:08 UTC
(In reply to Martin Birgmeier from comment #8)

Just tried it (without the patch), and it is working.

Use

loader_menu_frame="ascii"

in /boot/loader.conf

-- Martin
Comment 10 Warner Losh freebsd_committer freebsd_triage 2024-11-02 15:23:47 UTC
thanks for this analysis... It will save me a lot of time. the drawer.lua stuff isn't quite right, but it's very close.
Comment 11 Warner Losh freebsd_committer freebsd_triage 2024-11-02 16:34:51 UTC
https://reviews.freebsd.org/D47403 works for me.
I also think this may be a duplicate of other, earlier filed bugs on this topic.
Comment 12 jakub_lach 2024-11-02 16:50:30 UTC
(In reply to Martin Birgmeier from comment #8)

So it is quite similar to non UTF-8 with ports in a way (D4PASCIILINES=Y needed there).
Comment 13 commit-hook freebsd_committer freebsd_triage 2024-11-02 22:04:00 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=c2ba66d4d01f23303352bfe3cbd50ff5d9a05947

commit c2ba66d4d01f23303352bfe3cbd50ff5d9a05947
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-11-02 22:02:44 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-11-02 22:02:44 +0000

    loader: Fix boot menu on BIOS

    Only the gfx-enabled boot loader supports unicode. Otherwise, we have to
    use the old cons25 / ibmpc upper code page drawing characters. Check to
    see if we have the gfx.term_drawbox function. If we do, we support the
    unicode drawing characters. If we don't, then we have an older loader
    that doesn't support it *OR* we have the reduced function, text-only
    boot loader. In either of those cases, we need to use the old graphics
    characters. Abstract all those details into core.hasUnicode function.

    PR: 282465
    MFC After: 2 day
    Sponsored by: Netflix
    Differential Revision:  https://reviews.freebsd.org/D47403

 stand/lua/core.lua   |  9 +++++++++
 stand/lua/drawer.lua | 32 +++++++++++++++++++++++++++-----
 2 files changed, 36 insertions(+), 5 deletions(-)
Comment 14 Warner Losh freebsd_committer freebsd_triage 2024-11-02 22:06:23 UTC
Committed to main. Will commit to stable/14 Monday, should be fixed in BETA2 release.
Multiple people have reported this fixes things for them, plus I've booted two different machines with EFI (one with serial, one without), so I have good confidence this is fixed.
And I can't find any other bug report for this, so anything new that comes in will be marked as a duplicate of this one :)
Comment 15 jakub_lach 2024-11-02 22:50:25 UTC
(In reply to Warner Losh from comment #14)
Thanks!
Comment 16 commit-hook freebsd_committer freebsd_triage 2024-11-04 04:59:12 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=f2103edaf5229271f3f6769844c0c747d8352228

commit f2103edaf5229271f3f6769844c0c747d8352228
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-11-02 22:02:44 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-11-04 00:51:24 +0000

    loader: Fix boot menu on BIOS

    Only the gfx-enabled boot loader supports unicode. Otherwise, we have to
    use the old cons25 / ibmpc upper code page drawing characters. Check to
    see if we have the gfx.term_drawbox function. If we do, we support the
    unicode drawing characters. If we don't, then we have an older loader
    that doesn't support it *OR* we have the reduced function, text-only
    boot loader. In either of those cases, we need to use the old graphics
    characters. Abstract all those details into core.hasUnicode function.

    PR: 282465
    MFC After: 2 day
    Sponsored by: Netflix
    Differential Revision:  https://reviews.freebsd.org/D47403

    (cherry picked from commit c2ba66d4d01f23303352bfe3cbd50ff5d9a05947)

 stand/lua/core.lua   |  9 +++++++++
 stand/lua/drawer.lua | 32 +++++++++++++++++++++++++++-----
 2 files changed, 36 insertions(+), 5 deletions(-)
Comment 17 Warner Losh freebsd_committer freebsd_triage 2024-11-04 23:09:49 UTC
All merged now.
Comment 18 jakub_lach 2024-11-05 20:43:15 UTC
(In reply to Warner Losh from comment #17)
Thanks, looks good.
Comment 19 commit-hook freebsd_committer freebsd_triage 2024-11-07 00:51:22 UTC
A commit in branch releng/14.2 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=0d2b7892cd3aa4666dee7211a76a3a4d99c4c18b

commit 0d2b7892cd3aa4666dee7211a76a3a4d99c4c18b
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-11-02 22:02:44 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-11-06 23:13:14 +0000

    loader: Fix boot menu on BIOS

    Only the gfx-enabled boot loader supports unicode. Otherwise, we have to
    use the old cons25 / ibmpc upper code page drawing characters. Check to
    see if we have the gfx.term_drawbox function. If we do, we support the
    unicode drawing characters. If we don't, then we have an older loader
    that doesn't support it *OR* we have the reduced function, text-only
    boot loader. In either of those cases, we need to use the old graphics
    characters. Abstract all those details into core.hasUnicode function.

    PR: 282465
    MFC After: 2 day
    Sponsored by: Netflix
    Differential Revision:  https://reviews.freebsd.org/D47403

    (cherry picked from commit c2ba66d4d01f23303352bfe3cbd50ff5d9a05947)
    (cherry picked from commit f2103edaf5229271f3f6769844c0c747d8352228)

    Approved-by: re (cperciva)

 stand/lua/core.lua   |  9 +++++++++
 stand/lua/drawer.lua | 32 +++++++++++++++++++++++++++-----
 2 files changed, 36 insertions(+), 5 deletions(-)