You are not logged in.

#1 2012-07-29 02:30:54

battlepanic
Member
Registered: 2009-08-22
Posts: 76

[SOLVED] Unable to change the console font in early userspace

I have made my own custom bitmap font and I'm able to successfully use it for all virtual consoles by setting the CONSOLEFONT variable in rc.conf.  However, I'd like the console to use the font as soon as the kernel boots as opposed to having the font set midway through the boot process.

According the the mkinitcpio documentation there is an option to enable such a feature:

$ mkinitcpio -H consolefont
==> Help for hook 'consolefont':
This hook loads consolefont specified in locale.conf or rc.conf during early
userspace.

==> This hook has runtime scripts:
  -> pre-mount hook

I've tried adding consolefont to the HOOKS array in mkinitcpio.conf and rebuilding the initramfs image by issuing the following command.

# mkinitcpio -p linux

However, upon rebooting this doesn't appear to work and I get the following error message.

setfont: KDFONTOP: Invalid argument

I'd love to get this working and I've tried putting the consolefont hook in every possible position in the HOOKS array to no avail.  Can anyone provide some insight?

Last edited by battlepanic (2012-07-31 01:03:55)

Offline

#2 2012-07-29 13:08:59

battlepanic
Member
Registered: 2009-08-22
Posts: 76

Re: [SOLVED] Unable to change the console font in early userspace

Upon further testing, it looks like some fonts will indeed work correctly in early userspace.  This Ubuntu thread tipped me off to the possibility that the KDFONTOP error is limited to only certain fonts.

For example, setting CONSOLEFONT to "lat1-08" in /etc/rc.conf and then rebuilding the initramfs image works just fine.

For some reason trying to load my custom font at this early stage in the boot process gives the KDFONTOP error.  However, this very same font has no problems loading if it is done later in the init process.  It both cases it is the setfont command which is used to load the font but something must be different.

What could be causing setfont to fail in early userspace with only certain fonts?

Offline

#3 2012-07-30 00:56:41

battlepanic
Member
Registered: 2009-08-22
Posts: 76

Re: [SOLVED] Unable to change the console font in early userspace

I've found a solution to the problem.  It occurred to me that the setfont command rolled into the initramfs image and used in early userspace was perhaps not the same setfont that is installed on my system.

I confirmed this by unpacking my initramfs image and having a look.  A copy of the initramfs file system can be created by issuing the following commands.  Note that you will need the cpio package installed.

$ mkdir ~/initramfs && cd ~/initramfs
$ cat /boot/initramfs-linux.img | gunzip -c | cpio -i --no-absolute-filenames

This will unpack the initramfs image under the ~/initramfs directory.  Browsing the ~/initramfs/bin directory it became clear that the copy of setfont was a symlink to the busybox executable and hence the busybox implementation.

The problem can be solved by adding setfont to the BINARIES array in mkinitcpio.conf and rebuilding the initramfs image.  This will copy the version of setfont provided by the kbd package into the initramfs image instead of relying on the busybox version of setfont which would otherwise be used by default.

Though this solves my problem, I'm not sure why the setfont provided by busybox chokes on my font but works with others.  Busybox being what it is, tends to provide commands that are less full-featured than their usual counterparts.  If anyone has any ideas though, I'd love to know.

Last edited by battlepanic (2017-07-27 18:36:15)

Offline

Board footer

Powered by FluxBB