Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#19109 - [mkinitcpio] consolefont hook only supports .psfu.gz files

Attached to Project: Arch Linux
Opened by Alex Griffin (fflarex) - Thursday, 15 April 2010, 02:58 GMT
Last edited by Dave Reisner (falconindy) - Sunday, 03 February 2013, 01:42 GMT
Task Type Bug Report
Category Arch Projects
Status Closed
Assigned To Thomas Bächler (brain0)
Roman Kyrylych (Romashka)
Dave Reisner (falconindy)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No

Details

Description:

The consolefont hook does not support non-unicode fonts. This means that popular fonts like Terminus don't work.
This task depends upon

Closed by  Dave Reisner (falconindy)
Sunday, 03 February 2013, 01:42 GMT
Reason for closing:  Fixed
Additional comments about closing:  Original bug is fixed. Do not reopen 3 year old bug reports with unrelated problems.
Comment by Karol Błażewicz (karol) - Friday, 16 April 2010, 20:38 GMT
I've seen your other bug report and tried the same fonts: 'ter-v12n', but nothing disappears (you wrote "the text that came before setfont was executed in rc.sysinit, disappears"), it just changes appearance. I normally use "Lat2-Terminus16.psfu.gz" and they're fine too. Maybe this is KMS issue?
I also added 'read -n1' to my /etc/rc.local so I can read all the error messages and only then press a key and get my login prompt.

Comment by Alex Griffin (fflarex) - Saturday, 17 April 2010, 02:43 GMT
I'm not sure what other bug report you're talking about, but I don't think I am who you think I am. This bug report is about setting the font right in the ramdisk, before any initscripts begin.

Anyways, I changed the file extension on my font of choice to give it the appearance of being a unicode font, and everything worked fine. I'm not sure I even understand why non-unicode fonts are explicitly disallowed.
Comment by Karol Błażewicz (karol) - Saturday, 17 April 2010, 12:44 GMT
I was talking about http://bugs.archlinux.org/task/19079, which - of course - you didn't post. I think I should be declared legally blind, sorry for mixing things up.
Comment by jackoneill (jackoneill) - Tuesday, 27 April 2010, 17:15 GMT
Renaming /usr/share/kbd/consolefonts/ter-116n.psf.gz to ter-116n.psfu.gz works for me.

The 'consolefont' hook should accept anything 'setfont' accepts, after all that's what is used to actually set the font.
Comment by Karol Błażewicz (karol) - Friday, 30 April 2010, 04:30 GMT
http://projects.archlinux.org/mkinitcpio.git/tree/install/consolefont?id=94130e25b50c7385b5befeb03a94668de1cf3601
line 11: it means, that .psfu.gz is hardcoded.
lines 17 & 18 should tell you this.

Maybe you can add a custom hook or other override.
I have no idea why only unicode fonts are allowed.
Comment by Mark (voidzero) - Friday, 30 April 2010, 07:37 GMT
This bug is a duplicate of bug  FS#19079 .
Comment by Karol Błażewicz (karol) - Sunday, 02 May 2010, 12:08 GMT
Again, I'm just a noob, but maybe it's upstream?

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ecb77fa96ceda9cae88015bfe3293ffe19006159

Console is utf-8 by default
author Samuel Thibault <samuel.thibault@ens-lyon.org>
Thu, 3 Jan 2008 16:17:54 +0000 (16:17 +0000)
committer Linus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 3 Jan 2008 20:06:40 +0000 (12:06 -0800)
Comment by Thomas Bächler (brain0) - Monday, 03 May 2010, 17:25 GMT
In my opinion, it is a waste of time to mess with console fonts in initramfs. If you need this changed, send a patch.
Comment by Mark (voidzero) - Monday, 03 May 2010, 19:00 GMT
That really isn't great quality control, Thomas. Besides your view of it being 'waste of time' is substantially subjective, it's actually not an argument at all. You're the developer, which makes me wonder, did you know that the word 'developer' is a noun that stems from a verb?

I have stated the obvious reason to include support for consolefonts: when one does not use them from the beginning but only from rc.conf, and when the font size differs therein, the text that came before consolefont was activated from rc.sysinit disappears. Try it, it's easy: set it to ter-v12n and see what happens. (You might need the terminus package).

I'd gladly send in a patch, but I don't know how to make this work. I am curious about what has changed after the boot process goes from initramfs (where setfont does not work with a non-unicode font - it says 'bad file length') to rc.sysinit where setfont obviously does work. Might it be that setfont is loaded too soon, i.e. before the appropriate framebuffer device has been loaded?

As a possible aside, it seems that ubuntu has either switched, or added the option, to use console-tools instead of kbd. And it seems like Karol's link might be of help.
Comment by Mark (voidzero) - Monday, 03 May 2010, 19:02 GMT
By the way, it's odd that previous text does not disappear for you, karol. I am using the vesa line "vga=795" in my boot options.
Comment by Aaron Griffin (phrakture) - Monday, 03 May 2010, 19:12 GMT
Can we keep the personal attacks to a minimum, please. There are others on the notification list for this bug.
Comment by Karol Błażewicz (karol) - Monday, 03 May 2010, 19:22 GMT
I don't want to be rude, gentlemen, but from my noobish understanding utf-8-by-default it's a thing Mr Torvalds and his gang came up with. It doesn't say utf-8-only, so it should be possible to add support for non-utf-8 consolefonts. However, renaming *.psf.gz to *.psfu.gz is trivial and I would consider it good enough of a fix. I would gladly help but I have only 24 hours in a day.

> By the way, it's odd that previous text does not disappear for you, karol. I am using the vesa line "vga=795" in my boot options.
I use KMS atm and thus I don't use any vga options.
Comment by Aaron Griffin (phrakture) - Monday, 03 May 2010, 19:31 GMT
What's wrong with changing "$CONSOLEFONT.psfu.gz" to "$CONSOLEFONT".psf*.gz

That'd cover all bases, wouldn't it?
Comment by Karol Błażewicz (karol) - Monday, 03 May 2010, 19:37 GMT
> What's wrong with changing "$CONSOLEFONT.psfu.gz" to "$CONSOLEFONT".psf*.gz
I think that was the original question.
I'm not a dev and it's easier for me to rename some files than to patch mkinitcpio. I've done some "research", posted a bunch of links. I don't think I can provide anything more. Take a look, take action. Or not.
Comment by Mark (voidzero) - Monday, 03 May 2010, 19:47 GMT
I'm sorry, it was not my intention to personally attack anyone.
If one changes the psfu.gz to psf.gz, or if one copies the font to ter-v12n.psf.gz, you get an error: setfont: input file: bad length.
Comment by Karol Błażewicz (karol) - Monday, 03 May 2010, 19:59 GMT
>If one changes the psfu.gz to psf.gz, or if one copies the font to ter-v12n.psf.gz, you get an error: setfont: input file: bad length.
But why would you do that?
"$CONSOLEFONT".psf*.gz would mean that both psf.gz and psfu.gz are OK.

>Renaming /usr/share/kbd/consolefonts/ter-116n.psf.gz to ter-116n.psfu.gz works for me.
This wouldn't be necessary anymore.
Comment by Roman Kyrylych (Romashka) - Monday, 03 May 2010, 20:19 GMT
Just adding an asterisk is not enough. Renaming fonts is not the best idea either.
I'm playing with the hook at the moment, be patient.
Comment by Mark (voidzero) - Monday, 03 May 2010, 20:27 GMT
karol: it still yields the error "input file: bad length".
I think that /dev/console might be the culprit; the consolefont hook sets it to there while rc.sysinit sets the fonts to /dev/tty and /dev/tty[0-9]* which are nonexistent on the initramfs.
Comment by Roman Kyrylych (Romashka) - Monday, 03 May 2010, 21:55 GMT
this has nothing to do with /dev/console vs /dev/tty* (you can check it by running /lib/initcpio/busybox setfont <fontname> from the normal system)
setfont from busybox seems to have problems with some fonts.
I get "bad length" error only for terminus, for other psf fonts I get "KDFONTOP: invalid argument".
Comment by Mark (voidzero) - Tuesday, 04 May 2010, 10:06 GMT
Found it. The setfont binary in busybox is different from kbd's setfont binary. Took me some time to figure that one out! :)

Attached are two consolefont patches (initcpio install and hooks) that solve this bug.
Comment by Mark (voidzero) - Tuesday, 04 May 2010, 10:10 GMT
Also, it might be wise to move rc.sysinit's consolefont setting more to the top of the file, so that less text disappears when people do not use the consolefont hook. On my system, to test it, I simply disabled the "loading consolefont" message and moved the rest of the consolefont code to the top, right after rc.conf gets sourced. That way the Archlinux credits (the first five printhl statements) don't get lost. Just a suggestion.
Comment by Roman Kyrylych (Romashka) - Tuesday, 04 May 2010, 10:31 GMT
huh? at that time the filesystem is not mounted yet
I mean - what if user has /usr on a separate partition?
It's not wise to do such tricks just for eye candy.
Comment by Roman Kyrylych (Romashka) - Tuesday, 04 May 2010, 11:21 GMT
As for the patch - I'd prefer to use busybox for loading fonts, if possible.
Perhaps by tuning the config of mkinitcpio-busybox it is possible to add more font support.
For example, according to http://git.busybox.net/busybox/commit/?id=8ce1dc03c1b2b61e51527b987579c09c991cc4b2
there are some interesting options, however they are totally missing (not even commented) in the config of mkinitcpio-busybox.
Comment by Thomas Bächler (brain0) - Tuesday, 04 May 2010, 11:40 GMT
I agree with Roman here, we should try to stick to busybox. However, if a feature is missing in busybox's setfont, that is a problem.

Roman, the commit you pointed to is in the master branch of busybox, it will be in the 1.17 release. We could backport that commit to our busybox 1.16.1 build, maybe Mark's patch will then work with busybox's setfont as well. If that works, that is the way to go, if not I will apply Mark's patch as he posted it above.
Comment by Roman Kyrylych (Romashka) - Tuesday, 04 May 2010, 11:50 GMT
Sounds like a plan.
In addition, for proper non-UTF8 console in initramfs we should also add CONSOLEMAP support.
Comment by Thomas Bächler (brain0) - Tuesday, 04 May 2010, 11:59 GMT
That's your task then, Roman. I don't use any console font or console map settings whatsoever (just the default font that is built into the kernel). I have no way of verifying whether the console maps and fonts work as expected, because I do not know what to expect.

I can try to build the patched busybox for you tonight, but the tests and enhancements to the hooks have to be made by Mark or you.
Comment by Mark (voidzero) - Tuesday, 04 May 2010, 12:11 GMT
Roman, I don't really know what you mean with "what if user has /usr on a seperate partition". This mkinitcpio patch simply adds the setfont binary to the initrd together with the font, as /bin/setconsolefont. And I just realised in retrospect that it is not even necessary to add that binary when we are using unicode fonts: those can still be handled by busybox's setfont. I'll update the patch.
Comment by Mark (voidzero) - Tuesday, 04 May 2010, 12:27 GMT
Updated patch.
Comment by Roman Kyrylych (Romashka) - Tuesday, 04 May 2010, 12:46 GMT
@Mark: that comment was about "Also, it might be wise to move rc.sysinit's consolefont setting more to the top of the file"
Comment by Mark (voidzero) - Tuesday, 04 May 2010, 16:18 GMT
Oh yes. Makes sense now. :)
Comment by Thomas Bächler (brain0) - Tuesday, 04 May 2010, 17:15 GMT
Mark, can you please try if the busybox package [1] supports non-UTF8 fonts and can be used instead of the one provided by the kbd package?

[1] http://dev.archlinux.org/~thomas/mkinitcpio/
Comment by Mark (voidzero) - Tuesday, 04 May 2010, 21:45 GMT
Can't even get this to boot, getting a segmentation fault, and the error "/init: export: line 52: bad variable name". Kernel panic follows and the system hangs.
Comment by Thomas Bächler (brain0) - Tuesday, 04 May 2010, 21:55 GMT
Hm, same here, I wonder why that is. Can't look into this right now, but I will later.
Comment by Thomas Bächler (brain0) - Tuesday, 04 May 2010, 22:10 GMT
Okay, the segfault is not caused by the patch, but by building busybox with gcc 4.5 as it seems. If I just rebuild busybox with gcc 4.5, it will segfault as you described - which means I have to fix that before we can test this further.
Comment by Mark (voidzero) - Wednesday, 05 May 2010, 10:30 GMT
Why not just add the patch? Or is it that bad of an idea to add_file /usr/bin/setfont to /bin/setconsolefont? It proves to always work when people need it to and for those that use a unicode font (most of the CONSOLEFONT users) it does not even use or add setconsolefont, it uses the busybox setfont binary in the second patch I submitted. So I don't see the reason for going through all those troubles tbh.
Comment by Thomas Bächler (brain0) - Wednesday, 05 May 2010, 11:02 GMT
I'd like to avoid adding more binaries to the initramfs when busybox can solve the problem. There's a bug report [1] for the gcc guys. If that doesn't get resolved soon, I'll simply add your patch and change it later, but I'd like to wait a few days first.

[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43987
Comment by Mark (voidzero) - Wednesday, 05 May 2010, 12:36 GMT
Roger that. Thank you for clearing that up for me.
Comment by Thomas Bächler (brain0) - Wednesday, 05 May 2010, 14:21 GMT
Mark, I uploaded new and hopefully working busybox packages at [1] again (I didn't boot with them, but I tested that the Segmentation faults at 'sed' are gone). Please redownload and try if the included setfont binary now handles the non-UTF8 fonts.

[1] http://dev.archlinux.org/~thomas/mkinitcpio/
Comment by Mark (voidzero) - Wednesday, 05 May 2010, 19:52 GMT
Hello Thomas, it works beautifully now. Here are the updated patches that need to be included. Thank you for helping us to solve this bug.
Comment by Thomas Bächler (brain0) - Saturday, 08 May 2010, 12:08 GMT Comment by Thomas Bächler (brain0) - Saturday, 08 May 2010, 12:27 GMT Comment by Mark (voidzero) - Saturday, 08 May 2010, 13:36 GMT
Hi Thomas, Roman and others,

This looks good. Thanks for putting your time and effort into this issue.

Kind regards,
-Mark
Comment by A Web (aweb) - Wednesday, 14 November 2012, 23:58 GMT
  • Field changed: Percent Complete (100% → 0%)
I think there may be a regression here. My vconsole.conf file has:

FONT=ter-v32n

My mkinitcpio.conf has:

MODULES="i915"
HOOKS="consolefont ..."

And when I boot I get the same error (setfont: input file: bad length) and the small font persists until much further in the boot sequence (systemd-vconsole-setup).

Note that if I add

BINARIES="/usr/bin/setfont"

to mkinitcpio.conf, then it works fine. I think the intent of this bug fix was to work with non-unicode fonts, but if that isn't the case, then it's fine to leave the bug closed.

At any rate I appreciate that the hook finds my .psf (as opposed to .psfu) file and makes everything work so long as I override the busybox setfont utility, so this is low priority.
Comment by Dave Reisner (falconindy) - Wednesday, 30 January 2013, 18:48 GMT
Not sure why this was reopened. Sounds more like a bug in busybox's setfont which is extremely unrelated to this 2 1/2 year old bug.

Loading...