Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 733312

Summary: sys-kernel/genkernel-4.0.9-r1: create_initramfs(): append_data(): append_base_layout(): Invalid usage of is_psf_file(): File '/var/tmp/genkernel/gk_.../initramfs-base-temp/lib/console/font' does not exist!
Product: Gentoo Linux Reporter: Lars <gentoo>
Component: Current packagesAssignee: Gentoo Genkernel Maintainers <genkernel>
Status: RESOLVED CANTFIX    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Lars 2020-07-20 11:24:38 UTC
genkernel all fails with 

create_initramfs(): append_data(): append_base_layout(): Invalid usage of is_psf_file(): File '/var/tmp/genkernel/gk_.../initramfs-base-temp/lib/console/font' does not exist!

Reproducible: Always

Steps to Reproduce:
1. configure kernel
2. run `genkernel all`
Actual Results:  
```
* initramfs: >> Initializing ...
*         >> Appending devices cpio data ...
=================================================================
About to add these files (8.0K) from '/var/tmp/genkernel/gk_a2Ywl3dt/initramfs-devices-temp' to cpio archive:
drwxr-xr-x 3 root root 4096 20. Jul 10:48 .
drwxr-xr-x 2 root root 4096 20. Jul 10:48 ./dev
=================================================================
*         >> Appending base_layout cpio data ...
*                 >> Populating '/etc/fstab' ...
*                 >> Adding /etc/ld.so.conf ...
*                 >> Adding misc files ...
*                 >> Embedding current active console font ...
COMMAND: /usr/bin/setfont -O /var/tmp/genkernel/gk_a2Ywl3dt/initramfs-base-temp/lib/console/font

* ERROR: create_initramfs(): append_data(): append_base_layout(): Invalid usage of is_psf_file(): File '/var/tmp/genkernel/gk_a2Ywl3dt/initramfs-base-temp/lib/console/font' does not exist!
* Genkernel was unexpectedly terminated (signal SIGTERM received).
* Please consult '/var/log/genkernel.log' for more information and any
* errors that were reported above.
```

Expected Results:  
genkernel should not fail.

If I understand correctly genkernel tries to rund setfont. If I run setfont in the terminal emulator as root I get:

# /usr/bin/setfont -v -O /tmp/font
setfont: graphics console  skipped


No file is created at /tmp/font
Comment 1 Lars 2020-07-20 13:00:48 UTC
Workaround:

change 

BOOTFONT="current"

to empty/"none" or <PSF file>
Comment 2 Thomas Deutschmann (RETIRED) gentoo-dev 2020-07-20 15:29:37 UTC
I am not sure if there is much we can do about that.

Please notice that this feature is disabled by default.

If you enable it, i.e. asking genkernel to embed current active font, we expect that you are actually have a font set. If that's not the case there is not much we can do about that...
Comment 3 Thomas Deutschmann (RETIRED) gentoo-dev 2020-07-20 15:32:05 UTC
I am curious, do you get any output from `showconsolefont`?
Comment 4 Lars 2020-07-22 06:31:25 UTC
> ...we expect that you are actually have a font set.

I have a font set in `https://wiki.gentoo.org/wiki/Fonts#Console_font` as explained here:
https://wiki.gentoo.org/wiki/Fonts#Console_font

Where else do I have to set it?

> I am curious, do you get any output from `showconsolefont`?

yes, here it is:

```
sudo showconsolefont
SSH passphrase:
bug: getfont called with count<256
    !  "  #  $  %  &  '  (    )  *  +  ,  -  .  /  0
    1  2  3  4  5  6  7  8    9  :  ;  <  =  >  ?  @
    A  B  C  D  E  F  G  H    I  J  K  L  M  N  O  P
    Q  R  S  T  U  V  W  X    Y  Z  [  \  ]  ^  _  `
    !  "  #  $  %  &  '  (    )  *  +  ,  -  .  /  0
    1  2  3  4  5  6  7  8    9  :  ;  <  =  >  ?  @
    A  B  C  D  E  F  G  H    I  J  K  L  M  N  O  P
    Q  R  S  T  U  V  W  X    Y  Z  [  \  ]  ^  _  `

    !  "  #  $  %  &  '  (    )  *  +  ,  -  .  /  0
    1  2  3  4  5  6  7  8    9  :  ;  <  =  >  ?  @
    A  B  C  D  E  F  G  H    I  J  K  L  M  N  O  P
    Q  R  S  T  U  V  W  X    Y  Z  [  \  ]  ^  _  `
    !  "  #  $  %  &  '  (    )  *  +  ,  -  .  /  0
    1  2  3  4  5  6  7  8    9  :  ;  <  =  >  ?  @
    A  B  C  D  E  F  G  H    I  J  K  L  M  N  O  P
    Q  R  S  T  U  V  W  X    Y  Z  [  \  ]  ^  _  `
```
Comment 5 Lars 2020-07-22 06:32:14 UTC
(In reply to Lars from comment #4)
> I have a font set in `/etc/conf.d/consolefont` as
> explained here:
> https://wiki.gentoo.org/wiki/Fonts#Console_font
Comment 6 Thomas Deutschmann (RETIRED) gentoo-dev 2020-07-22 13:22:24 UTC
Which font are using and please show us content of '/etc/conf.d/consolefont'.
Comment 7 Lars 2020-07-24 11:37:06 UTC
(In reply to Thomas Deutschmann from comment #6)
> Which font are using

media-fonts/terminus-font-4.48

> and please show us content of '/etc/conf.d/consolefont'.

# The consolefont service is not activated by default. If you need to
# use it, you should run "rc-update add consolefont boot" as root.
#
# consolefont specifies the default font that you'd like Linux to use on the
# console.  You can find a good selection of fonts in /usr/share/consolefonts;
# you shouldn't specify the trailing ".psf.gz", just the font name below.
# To use the default console font, comment out the CONSOLEFONT setting below.
#consolefont="default8x16"
consolefont="ter-v18n"

# consoletranslation is the charset map file to use.  Leave commented to use
# the default one.  Have a look in /usr/share/consoletrans for a selection of
# map files you can use.
#consoletranslation="8859-1_to_uni"

# unicodemap is the unicode map file to use. Leave commented to use the
# default one. Have a look in /usr/share/unimaps for a selection of map files
# you can use.
#unicodemap="iso01"
Comment 8 Thomas Deutschmann (RETIRED) gentoo-dev 2020-07-27 12:13:30 UTC
I cannot reproduce.

But because you are running into this problem when calling setfont manually, it's not a genkernel problem. So you need to start debugging setfont.

Which setfont version are you using?
Comment 9 Lars 2020-07-27 21:37:14 UTC
(In reply to Thomas Deutschmann from comment #8)
 
> Which setfont version are you using?

sys-apps/kbd-2.2.0-r2

How can I debug this?

I have another question:

Now I set `BOOTFONT="/tmp/ter-v18n.psf"` in `/etc/genkernel.conf`.

When booting I see the kernel output in terminus font, then the font is switched to the "default" font.

`man setfont` says the default font is `/usr/share/consolefonts/default8xN` in my case it is /usr/share/consolefonts/default8x16.psfu.gz or /usr/share/consolefonts/default8x9.psfu.gz.

When `/etc/init.d/consolefont` starts the font is reset to terminus.

How can I change the "default" font to terminus, so I do not have this glitch during boot.
Comment 10 Thomas Deutschmann (RETIRED) gentoo-dev 2021-03-08 16:45:07 UTC
(In reply to Lars from comment #9)
> I have another question:
> 
> Now I set `BOOTFONT="/tmp/ter-v18n.psf"` in `/etc/genkernel.conf`.
> 
> When booting I see the kernel output in terminus font, then the font is
> switched to the "default" font.
> 
> `man setfont` says the default font is `/usr/share/consolefonts/default8xN`
> in my case it is /usr/share/consolefonts/default8x16.psfu.gz or
> /usr/share/consolefonts/default8x9.psfu.gz.
> 
> When `/etc/init.d/consolefont` starts the font is reset to terminus.
> 
> How can I change the "default" font to terminus, so I do not have this
> glitch during boot.

This is confusing. There are 3 phases during boot:

Phase 1: Kernel starts.

To my knowledge, we cannot control used kernel fonts. Well, kernel offers a limited set of fonts you can control via fbcon=font:TER16x32 kernel command-line argument but you cannot set your own font.

Phase 2: Initramfs starts.

That's when we (genkernel) will set the bootfont you specified during initramfs creation, i.e. your ter-v18n.psf.

Phase 3: Real system will take control.

Once the real system will take control, a OpenRC-based system will for example start consolefont service which could load a different font.


You probably cannot eliminate the switch between kernel and initramfs but between initramfs and real system. However, keep in mind that after initramfs, framebuffer usually loads which will change resolution which will look like another switch.

Closing as CANTFIX because I don't know what to do when setfont won't return any data. If you are still able to reproduce you could hack genkernel and add strace to setfont call for example -- maybe you understand why it doesn't return anything.
Comment 11 Maciej Mrozowski gentoo-dev 2023-03-11 04:15:01 UTC
Let me offer potential explanation for append_base_layout(): Invalid usage of is_psf_file()

When running genkernel from virtual terminal, setfont is unable to figure out linux console font.
When executed as root (or via sudo), it fails... silently. Just no file is written.
When executed as user, we actually learn the root cause: "Couldn't get a file descriptor referring to the console"

Passing any -C /dev/ttyX doesn't help.
So it actually deserves CANTFIX for BOOTFONT="current", unless genkernel implements console font deduction not based on setfont, but just reading /etc/vconsole.conf or /etc/conf.d/consolefont as fallback.