init scripts don't set console fonts

Bug #1565542 reported by Evgeniy Yanyuk on 2016-04-03
This bug affects 263 people
Affects Status Importance Assigned to Milestone
console-setup (Ubuntu)
High
Evgeniy Yanyuk

Bug Description

1) lsb_release -rd
Description: Ubuntu 15.10
Release: 15.10

2) apt-cache policy keyboard-configuration
keyboard-configuration:
  Installed: 1.108ubuntu9
  Candidate: 1.108ubuntu9
  Version table:
 *** 1.108ubuntu9 0
        500 http://ru.archive.ubuntu.com/ubuntu/ wily/main amd64 Packages
        100 /var/lib/dpkg/status

3) I expected to have cyrillic font for consoles (/dev/tty[1-6]) after
sudo dpkg-reconfigure console-setup
and reboot

4) I have cyrrilic font until I reboot. After reboot I have black boxes instead cyrillic chars.
If I do:
setfont /etc/console-setup/Uni2-TerminusBold16.psf.gz
then I have cyrrilic font in current console

I found that these scripts
/usr/share/initramfs-tools/scripts/init-top/console_setup
/lib/udev/console-setup-tty
cannot properly set console fonts.
They don't recognize option CODESET="guess" and FONTSIZE="*x*" and check if exist only *.psf file, but we have *.psf.gz

I get part of code from /bin/setupcon and paste it in
/usr/share/initramfs-tools/scripts/init-top/console_setup
/lib/udev/console-setup-tty
and add extra test for psf.gz and acm.gz files

The attachment contain original scripts, fixed scripts and patches.

Related branches

The attachment "Here are original files+fixed files+patches" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Evgeniy Yanyuk (eugenenuke) wrote :

Sorry, I have overlooked two more files:
/usr/share/initramfs-tools/hooks/console_setup
/usr/share/initramfs-tools/scripts/panic/console_setup

The patch is in the attachment.

tags: added: wily
Evgeniy Yanyuk (eugenenuke) wrote :

Xenial also contain this bug. I did clean install xenial desktop amd64 in the VirtualBox. After installation I have switched to the text console (Ctrl+Alt+F1) and I've got boxes instead cyrillic fonts.

cat /etc/default/console-setup:
------------------------------------------------------------
# CONFIGURATION FILE FOR SETUPCON

# Consult the console-setup(5) manual page.

ACTIVE_CONSOLES="/dev/tty[1-6]"

CHARMAP="UTF-8"

CODESET="guess"
FONTFACE="Fixed"
FONTSIZE="8x16"

VIDEOMODE=

# The following is an example how to use a braille font
# FONT='lat9w-08.psf.gz brl-8x8.psf'
------------------------------------------------------------
And again we have CODESET="guess" and FONTSIZE="8x16"

cat /lib/udev/console-setup-tty:
I have cut other code and keep only setup_font ()
------------------------------------------------------------
setup_font () {
    # Set the font and ACM. setfont will silently do nothing for a console
    # in graphics mode.
    SETFONT_ARGS=
    if [ "$FONT" ]; then
 FONT="/etc/console-setup/${FONT##*/}"
 FONT="${FONT%.gz}"
    else
 FONT="/etc/console-setup/$CODESET-$FONTFACE$FONTSIZE.psf"
    fi
    if [ -f "$FONT" ]; then
 SETFONT_ARGS="${SETFONT_ARGS:+$SETFONT_ARGS }$FONT"
    fi
    if [ "$ACM" ]; then
 ACM="/etc/console-setup/${ACM##*/}"
 ACM="${ACM%.gz}"
    else
 ACM="/etc/console-setup/$CHARMAP.acm"
    fi
    if [ -f "$ACM" ]; then
 SETFONT_ARGS="${SETFONT_ARGS:+$SETFONT_ARGS }-m $ACM"
    fi
    if [ "$SETFONT_ARGS" ]; then
 setfont -C "$1" $SETFONT_ARGS
    fi
}
------------------------------------------------------------
In our case FONT will be "/etc/console-setup/guess-Fixed8x16.psf"

But we have
ls /etc/console-setup/
/etc/console-setup/Uni2-Fixed16.psf.gz

So FONT must be "/etc/console-setup/Uni2-Fixed16.psf" or even "/etc/console-setup/Uni2-Fixed16.psf.gz",
because the next check
    if [ -f "$FONT" ]; then
will fail with an uncompressed file.

The /bin/setupcon script has code for CODESET="guess" and FONTSIZE="8x16", but
 /lib/udev/console-setup-tty
/usr/share/initramfs-tools/scripts/init-top/console_setup
/usr/share/initramfs-tools/hooks/console_setup
/usr/share/initramfs-tools/scripts/panic/console_setup
have not

apt-cache policy keyboard-configuration
keyboard-configuration:
  Installed: 1.108ubuntu13
  Candidate: 1.108ubuntu13

tags: added: xenial
Evgeniy Yanyuk (eugenenuke) wrote :

My LANG="ru_RU.UTF-8"

Evgeniy Yanyuk (eugenenuke) wrote :

Finally I have patched files in console-setup-1.108ubuntu9 source code
To apply cd to root of source code and
zcat console-setup.patch.gz > patch -p1

Evgeniy Yanyuk (eugenenuke) wrote :

I have rebuilt keyboard-configuration with my fixes

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in console-setup (Ubuntu):
status: New → Confirmed
Pavel Sandovin (sandovin) wrote :

Please fix this trouble. How long can you keep in open? I remember this bug for at least 5 years!

Nazar Mokrynskyi (nazar-pc) wrote :

Thanks Eugene, hopefully this patch will land in 16.04.0

Alex_ander (ks-alexandr) wrote :

confirm this bug
it is very annoying

Gannet (ken20001) wrote :

Also tired of this bug. Please add this patch upstream. Thanks.

sedarmill (sedarmill) wrote :

1 year ago
http://unix.stackexchange.com/questions/198791/how-do-i-permanently-change-the-console-tty-font-type-so-it-holds-after-reboot
Affected all systemd versions - 15.04 15.10 16.04 This nigrodistr is awesome

Fedya (fedya-rtafov) wrote :

Actual for Xenial (16.04 LTS ).

san013 (san013) wrote :

+1

AsVetl (asvetl) on 2016-04-08
no longer affects: console-setup
Changed in console-setup (Ubuntu):
importance: Undecided → High
Evgeniy Yanyuk (eugenenuke) wrote :
Changed in console-setup (Ubuntu):
assignee: nobody → Evgeniy Yanyuk (eugenenuke)
Changed in console-setup (Ubuntu):
status: Confirmed → In Progress
description: updated
ShizaCat (tippet) on 2016-04-12
information type: Public → Public Security
information type: Public Security → Public
Alexander (sality) wrote :

+1

вовчик (mvi-vovchik) wrote :

5 years above us scoffed. love ubuntu is low.

Alexandr (jumpjet68) wrote :

Confirm bug in ubuntu 16.04 beta 2 with latest updates (2016.04.12)

Timur (timur-hisamov) on 2016-04-16
information type: Public → Public Security
information type: Public Security → Public

I'm reviewing this now. At first glance it looks pretty good, but I'll pretend I can read cyrillic and a few other languages and give it some extra testing before uploading :)

Evgeniy Yanyuk (eugenenuke) wrote :

Thanks for spending your time for this. You can switch to any text console (Ctrl+Alt+F[1-6]), and run:
LANG=ru_RU.UTF8 date
I suppose, you'll see white boxes instead day of week and month.

Yeah, I saw it with just 'sudo apt update', which is translated.

Running setupcon fixes this, and the changes look otherwise correct (I'll update to my test package and upload in a moment)

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package console-setup - 1.108ubuntu15

---------------
console-setup (1.108ubuntu15) xenial; urgency=medium

  * Properly handle settings CODESET and FONSIZE when they equals 'guess' or are unset.
    - console-setup-tty, debian/console-setup.initramfs-hook,
      debian/console-setup.initramfs-top
    (LP: #1565542)

 -- Evgeniy Yanyuk <email address hidden> Tue, 19 Apr 2016 15:22:17 -0400

Changed in console-setup (Ubuntu):
status: In Progress → Fix Released
Gannet (ken20001) wrote :

$ cat /etc/default/console-setup

# CONFIGURATION FILE FOR SETUPCON

# Consult the console-setup(5) manual page.

ACTIVE_CONSOLES="/dev/tty[1-6]"

CHARMAP="UTF-8"

CODESET="guess"
FONTFACE="Fixed"
FONTSIZE="16x8"

VIDEOMODE=

# The following is an example how to use a braille font
# FONT='lat9w-08.psf.gz brl-8x8.psf'

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers