FS#65148 - [mkinitcpio] consolefont hook does not change font if a quiet boot
Attached to Project:
Arch Linux
Opened by solsTiCe (zebul666) - Wednesday, 15 January 2020, 10:30 GMT
Last edited by freswa (frederik) - Saturday, 12 August 2023, 13:11 GMT
Opened by solsTiCe (zebul666) - Wednesday, 15 January 2020, 10:30 GMT
Last edited by freswa (frederik) - Saturday, 12 August 2023, 13:11 GMT
|
Details
If you are using consolefont hook in mkinitcpio HOOKS and
encrypt hook for example, one can clearly see that the font
is not set when you have to enter your LUKS passphrase.
It happens when you are using a quiet boot using (quiet loglevel=3 vga=current for example) It seems the console is not initialiazed or something of the kind and setfont has no effect. During my tries, I found that an error outputted on screen, wakes up the console and let setfont do its job. I am using systemd-boot and mkinitcpio-busybox (the default udev one) A fix would be, when quiet is detected in /proc/cmdline to force something to be displayed on the screen so that setfont finally works. |
This task depends upon
Closed by freswa (frederik)
Saturday, 12 August 2023, 13:11 GMT
Reason for closing: Fixed
Additional comments about closing: https://gitlab.archlinux.org/archlinux/m kinitcpio/mkinitcpio/-/merge_requests/25 5
Saturday, 12 August 2023, 13:11 GMT
Reason for closing: Fixed
Additional comments about closing: https://gitlab.archlinux.org/archlinux/m kinitcpio/mkinitcpio/-/merge_requests/25 5
HOOKS="base udev autodetect keyboard keymap modconf block consolefont encrypt lvm2 resume filesystems fsck"
[0] https://wiki.archlinux.org/index.php/Linux_console#Persistent_configuration
$ grep -v ^# /etc/mkinitcpio.conf
MODULES="i915"
BINARIES=""
FILES=""
HOOKS="base udev autodetect keyboard keymap modconf block consolefont encrypt lvm2 resume filesystems fsck"
$ cat /etc/vconsole.conf:
KEYMAP=fr-latin1
FONT=ter-118b
$ pacman -Qs terminus
local/terminus-font 4.48-1
Monospace bitmap font (for X11 and console)
$ cat /boot/loader/loader.conf
default arch
auto-firmware
$ cat /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options quiet loglevel=3 vga=current root=/dev/vg/root cryptdevice=UUID=xxxxxxxx-yyyy-yyyy-yyyy-zzzzzzzzzzzz:arch cryptkey=/dev/disk/by-id/someusbdevice@123456@2048 udev.log_priority=3 vt.global_cursor_default=0 i915.fastboot=1 resume=/dev/vg/swap
(to get an explanation for the @ in cryptkey, see my comment in https://bugs.archlinux.org/task/60927#comments)
I can upload somewhere my initramfs.img if you really want to
The dracut folks seem to have tackled this a while ago... https://bugzilla.redhat.com/show_bug.cgi?id=811007
Like I said, if I output something on screen before setfont in consolefont hook, then the font is changed
I have double checked that the font is in the initramfs.img and is actually ter-118b
Please upload /run/initramfs/init.log here.
It gets stuck at a blank screen
So instead, I modifed the consolefont hook to get a log of the acces time of the font used as in the patch I attached.
and rerun mkinitcpio and rebooted.
the log file I get from that is:
$ cat /run/initramfs/consolefont.log
-rw-r--r-- 1 0 0 9983 Jan 1 1970 /consolefont.psf
-rw-r--r-- 1 0 0 9983 Jan 20 19:19 /consolefont.psf
So it is very likely that setfont is actually run (at least, it tries to access the font file)
The config file /etc/vconsole.conf where the font is specified is on the still encrypted root partition when the consolefont HOOK is encountered.
The encrypt HOOK, the passphrase entry, and access to /etc/vconsole.conf all happen later.
So, how can the consolefont HOOK ever work on an encrypted root partition?
`vconsole.conf` is copied by mkinitcpio into `initramfs-linux.img`. And this is the copy from there that is used during the early boot
I have now run mkinitcpio -P, and the font has properly changed for the "Enter passphrase" prompt.
I know it's the wrong place to ask this, but I now have a new problem: I can't enter the passphrase at the prompt.
In addition to changing the font via /etc/vconsole.conf, I also changed the keymap to remap CapsLock to Ctrl.
I have not found a wiki entry to help me with this.
Setup:
HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt lvm2 filesystems fsck)
/usr/local/share/kbd/keymaps/local_remap.map
keymaps 0-255
keycode 58 = Control
/etc/vconsole.conf
FONT=sun12x22
KEYMAP=/usr/local/share/kbd/keymaps/local_remap.map
Edit: Also, I am using systemd-boot, not GRUB
I have this issue, and don't see here what the solution is.
I have i915.fastboot=1 kernel parameter, nothing else related to vga. And if I have the quiet param the password prompt font doesn't change.
I don't understand what the "early KMS" is.
Can you help me?
Thanks
Thank you
I was able to add rd.debug rd.log=file as you suggested (just had to figure out I don't see the password prompt and have to type my disk password on a blank screen)
Inspected the log and the consolefont hook is ok.
I have spent a couple of hours with it and ended up with a workaround adding echo -en "a\010 \010" to /usr/lib/initcpio/hooks/consolefont before setfont -C /dev/console /consolefont.psf
Why?
It looks like setfont doesn't work if nothing was echo-ed before the console.
echo -n " " not works
echo -n "a" works
echo -n "a" ;clear works
Maybe I am wrong, but I thought maybe echo-ing just one char and deleting it back is faster than clear, so this is the echo -en "a\010 \010" ("a",back,overwrite with space,back)
With consolefont hook:
It does not matter if BINARIES="setfont" is set or not - the consolefont will not be applied at erly boot (LUKS password prompt e.g.)
Without BINARIES="setfont" in mkinitcpio.conf you'll get error message:
"setfont: KDFONTOP: Function not implemented"
with BINARIES="setfont" you will get error:
"setfont: ERROR kdfontop.c:183 put_font_kdfontop : Unable to load sich font with such kernel version"
But as explained earlier, it is a mattter of adding a line in /usr/lib/initcpio/hooks/consolefont
As the maintainer does not care to fix it (why?), I have made a pacman hook to fix it at each upgrade:
[Trigger]
Operation = Install
Operation = Upgrade
Type = Package
Target = mkinitcpio
[Action]
Description = Patching consolefont hook [#FS65148]
When = PostTransaction
Depends = sed
Exec = /usr/bin/sed -i '/ *setfont/i\ echo -en "a\\010 \\010"' /usr/lib/initcpio/hooks/consolefont
@reneagat works fine with this fix. no error for me here. you can ignore the message "setfont: KDFONTOP: Function not implemented" it is harmless