Setfont error due to deprecated PIO_FONTX ioctl

Bug #1996619 reported by Heather Lemon
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
subiquity
Invalid
Undecided
Unassigned
kbd (Ubuntu)
Fix Released
Undecided
dann frazier
Jammy
Fix Released
Undecided
Heather Lemon
Kinetic
Fix Released
Undecided
Heather Lemon

Bug Description

[Impact]

There is an error message that get thrown in in syslog.
There is a suggestion to fix by upgrading the KDB package to version 2.5.1+ (upstream) has a fix.

It is caused by this line in subiquity
https://github.com/canonical/subiquity/blob/46f671d14d57a5da6bc3d60b1da6715b43954f0d/bin/subiquity-service#L11

It's due to PIO_FONTX ioctl removed from kernel since 5.12
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ff2047fb755d4415ec3c70ac799889371151796d

In 2.4.5 of kbd which provide setfont in user space, they already switched over to use KDFONTOP only.

[ Test Plan ]

### REPRODUCER STEPS ###

# install libvirt
sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system virtinst bridge-utils

sudo systemctl enable libvirtd
sudo systemctl start libvirtd

# check libvirtd process is running
virsh
virsh list

# get iso
wget https://releases.ubuntu.com/22.04/ubuntu-22.04.1-live-server-amd64.iso

# install vm
sudo virt-install --cdrom='./ubuntu-22.04.1-live-server-amd64.iso' --name=setfont-repo --vcpus=2 --memory=2048 --disk size=20 --serial pty --graphics none --boot=uefi --debug

# you can either do the full install,
the error will be in the /var/log/installer.log file

# or on the first page of the installer press Tab-> go to Help, -> Shell
and cd /var/log/
grep setfont* syslog

# to show error message cd to
/snap/subiquity/3698

#execute
setfont $SNAP/subiquity.psf

# error
root@ubuntu-server:/snap/subiquity/3698# setfont $SNAP/subiquity.psf
setfont: ERROR kdfontop.c:266 put_font_piofontx: ioctl(PIO_FONTX): 512,8x16: failed: Inappropriate ioctl for device

# grep
grep setfont* syslog
Nov 14 18:22:11 ubuntu-server console-setup.sh[1107]: setfont: ERROR kdfontop.c:266 put_font_piofontx: ioctl(PIO_FONTX): 512,8x16: failed: Inappropriate ioctl for device
Nov 14 18:22:29 ubuntu-server subiquity.subiquity-service[1878]: setfont: ERROR kdfontop.c:266 put_font_piofontx: ioctl(PIO_FONTX): 512,8x16: failed: Inappropriate ioctl for device

[ Where problems could occur ]

There could be a failure to correctly parse fonts.
https://man7.org/linux/man-pages/man8/setfont.8.html

[Other Notes]

# github link to upstream repo & commit
https://github.com/legionus/kbd
https://github.com/legionus/kbd/commit/2b68ba3ef22e6f68dcd9dc5c7fc47f72761f3764

Revision history for this message
Dan Bungert (dbungert) wrote :

After discussion with Heather we determined that
* We want this font for display of the snap list results
* kbd 2.4.5 is believed to have the fix
* The fixed kbd package should be merged to lunar, and a SRU appropriate fix to jammy

dann frazier (dannf)
Changed in kbd (Ubuntu):
assignee: nobody → dann frazier (dannf)
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package kbd - 2.5.1-1ubuntu1

---------------
kbd (2.5.1-1ubuntu1) lunar; urgency=medium

  * Merge from Debian unstable. Remaining changes:
    - Add setfont, kbd_mode, and loadkeys to initramfs for console-setup.
    - Added initramfs hook to have setfont/loadkeys available in initramfs.
    - Use ckbcomp to get the keyboard layout if other data files are not
      available.
    - Change loadkeys to find any console not in raw mode when invoked
      without an explicit console parameter, in case the foreground console
      is in raw mode.
    - Add setvtrgb to kbd-udeb.
    - Fix incorrect keymap sanity check in loadkeys_ckbcomp.diff.
    - debian/control: Depend on console-setup | console-setup-mini, since
      console-setup-mini also Depends on kbd now through console-setup-linux.
    - debian/patches/loadkeys_find_usable_console.diff: fix wrong type
      argument to ioctl(..., KDGKBMODE), which causes consoles to not be
      correctly detected on 64-bit archs. LP: #1621824.

  * Removed obsolete patches/changes:
    - d/p/fix_use_after_free.patch to clean up a use-after-free of
       pipe_cmd, now merged upstream.

  * New upstream release drops deprecated ioctls removed in Linux v5.12.
    LP: #1996619.

kbd (2.5.1-1) unstable; urgency=medium

  * Team upload.

  [ Andreas Henriksson ]
  * New upstream release.
  * Unfuzz debian/patches/Miscellaneous-manpage-corrections-and-additions.patch
  * Unfuzz debian/patches/Check-for-X-in-kbd_mode.patch
  * Revert "Cherry-pick no install libtswrap internal library"
  * Let `gbp pq <import|export>` refresh patches
  * Bump debhelper from old 10 to 13.
  * Set debhelper-compat version in Build-Depends.
  * Set upstream metadata fields: Bug-Database, Bug-Submit.
  * debian/copyright: Update paths of moved files

  [ nick black ]
  * refer to deallocvt(8), not disalloc(8) (Closes: #989525)

  [ Osamu Aoki ]
  * update d/control for console-setup (Closes: #998086)

 -- dann frazier <email address hidden> Tue, 15 Nov 2022 17:21:19 -0700

Changed in kbd (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Dan Bungert (dbungert) wrote :

I am marking this invalid for Subiquity as I believe no changes are needed there. When we rebuild for 22.04.2 this change should be picked up, once that SRU to Jammy is done.

Changed in subiquity:
status: New → Invalid
Changed in kbd (Ubuntu Jammy):
assignee: nobody → Heather Lemon (hypothetical-lemon)
status: New → In Progress
Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

Okay, Thanks Dan B. & Dann F. I started the Jammy SRU this morning.

Changed in kbd (Ubuntu Kinetic):
status: New → In Progress
assignee: nobody → Heather Lemon (hypothetical-lemon)
Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

kbd kinetic debdiff

Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

kbd jammy debdiff

tags: added: verification-needed-jammy verification-needed-kinetic
tags: added: sts-sponsor
Revision history for this message
dann frazier (dannf) wrote :

@hypothetical-lemon - thanks for preparing theses! Some quick feedback:

 - The jammy and kinetic packages need to have different versions. See the following for a versioning scheme:
   https://wiki.ubuntu.com/SecurityTeam/UpdatePreparation#Update_the_packaging

 - Just a nit, but when you respin for version strings, would you mind making the actual patch file identical between the 2 versions? Right now at least the Subject: line is different. That would make a debdiff between your 2 updates cleanly show that they are identical code-wise.

Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

@dannf, I will make those 2 changes tomorrow. Thanks for catching!

Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

revised jammy debdiff

Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

kinetic revised debdiff

tags: removed: verification-needed-jammy verification-needed-kinetic
description: updated
description: updated
description: updated
description: updated
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Heather and I internally discussed some feedback/review for the revised debdiffs.

tags: added: se-sponsor-mfo
removed: sts-sponsor
Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

Updated headers, fix version for jammy

Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

fix version for kinetic

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Thanks, Heather!
Uploaded to Kinetic and Jammy (minor adjustments; build tested on supported archs w/ -proposed).

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Ok, this feels like safe, especially that these ioctls are indeed obsolete for all the kernels available for jammy and kinetic. Let's get this in.

Changed in kbd (Ubuntu Kinetic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-kinetic
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Heather, or anyone else affected,

Accepted kbd into kinetic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/kbd/2.3.0-3ubuntu4.22.10 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-kinetic to verification-done-kinetic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-kinetic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in kbd (Ubuntu Jammy):
status: In Progress → Fix Committed
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello Heather, or anyone else affected,

Accepted kbd into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/kbd/2.3.0-3ubuntu4.22.04 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

tags: added: verification-needed-jammy
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (kbd/2.3.0-3ubuntu4.22.10)

All autopkgtests for the newly accepted kbd (2.3.0-3ubuntu4.22.10) for kinetic have finished running.
The following regressions have been reported in tests triggered by the package:

systemd/251.4-1ubuntu7 (ppc64el, amd64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/kinetic/update_excuses.html#kbd

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (kbd/2.3.0-3ubuntu4.22.04)

All autopkgtests for the newly accepted kbd (2.3.0-3ubuntu4.22.04) for jammy have finished running.
The following regressions have been reported in tests triggered by the package:

systemd/249.11-0ubuntu3.6 (amd64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/jammy/update_excuses.html#kbd

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

For documentation purposes.

The autopkgtests failures for systemd were unrelated to this
(not regressions).

I checked their logs and reran with the migration-reference/0
trigger so not to use kbd from -proposed; that failed as well.

The pending SRU and update-excuses pages no longer show kbd
blocked on the autopkgtests failures.

https://people.canonical.com/~ubuntu-archive/pending-sru.html
https://people.canonical.com/~ubuntu-archive/proposed-migration/jammy/update_excuses.html#kbd
https://people.canonical.com/~ubuntu-archive/proposed-migration/kinetic/update_excuses.html#kbd

Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

I started testing this yesterday, but got stuck on the rich console not showing/continuing after I created the vrish vm with

sudo virt-install --cdrom='./ubuntu-22.04.1-live-server-amd64.iso' --name=setfont-repo --vcpus=2 --memory=2048 --disk size=10 --serial pty --graphics none --boot=uefi --debug

the virsh console setfont-repo
shows this in the terminal
Connected to domain 'setfont-repo'
Escape character is ^] (Ctrl + ])

but no text console

Revision history for this message
Heather Lemon (hypothetical-lemon) wrote (last edit ):

### VERIFICATION DONE KINETIC ###

sudo apt-get update
sudo apt install qemu-kvm libvirt-clients libvirt-daemon-system virtinst bridge-utils -y

sudo systemctl enable libvirtd
sudo systemctl status libvirtd

wget https://releases.ubuntu.com/kinetic/ubuntu-22.10-live-server-amd64.iso

virsh list

sudo chown -R ubuntu:ubuntu ubuntu-22.10-live-server-amd64.iso
* you will get a permission denied if you don't do this part*

sudo virt-install --location='./ubuntu-22.10-live-server-amd64.iso', --name=setfont-repo --vcpus=2 --memory=2048 --disk size=10 --console pty,target_type=virtio --serial pty --graphics none --boot=uefi,kernel='/boot/vmlinuz',initrd='/boot/initrd.img',kernel_args='console=/dev/ttyS0' --extra-args='console=ttyS0,115200n8 serial' --debug

virsh console setfont-repo <name of vm>

select Tab-> Help -> Enter Shell

sudo apt-cache policy kbd

kbd package version previous
2.3.0-3ubuntu4

#Error message thrown in logs

root@ubuntu-server:/# setfont $SNAP/subiquity.psf
setfont: ERROR kdfontop.c:266 put_font_piofontx: ioctl(PIO_FONTX): 512,8x16: failed: Inappropriate ioctl for device

### ENABLE PROPOSED ###

# create new VM for kinetic
sudo virt-install --location='./ubuntu-22.10-live-server-amd64.iso', --name=setfont-repo03 --vcpus=2 --memory=2048 --disk size=10 --console pty,target_type=virtio --serial pty --graphics none --boot=uefi,kernel='/boot/vmlinuz',initrd='/boot/initrd.img',kernel_args='console=/dev/ttyS0' --extra-args='console=ttyS0,115200n8 serial' --debug

select Tab-> Help -> Enter Shell

# edit sources.list
deb http://archive.ubuntu.com/ubuntu kinetic-proposed universe multiverse restricted main
sudo apt-get upgrade kbd
Check version installed
sudo apt-cache policy kbd
Candidate: 2.3.0-3ubuntu4.22.10

sudo apt --only-upgrade install kbd

# execute command
setfont $SNAP/subiquity.psf
bash:

# no error messages are thrown
# we don't have any error messages being thrown in the logs -
/var/log/installer/subiquity-client-debug.log

# if you need to log back into the vm
virsh list
virsh console setfont-repo03

# notes
ctl+5 = exit rich console command or CTRL+]

### VERIFICATION DONE KINETIC ###

Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

### VERIFICATION DONE JAMMY ###

sudo apt-get update
sudo apt install qemu-kvm libvirt-clients libvirt-daemon-system virtinst bridge-utils -y

sudo systemctl enable libvirtd
sudo systemctl status libvirtd

wget https://releases.ubuntu.com/jammy/ubuntu-22.04.1-live-server-amd64.iso

sudo chown ubuntu:ubuntu ubuntu-22.04.1-live-server-amd64.iso
sudo chmod +rwx ubuntu-22.04.1-live-server-amd64.iso
*you will get a permission denied if you don't do this part*

virsh list

sudo virt-install --location='./ubuntu-22.04.1-live-server-amd64.iso', --name=setfont-repo01 --vcpus=2 --memory=2048 --disk size=10 --console pty,target_type=virtio --serial pty --graphics none --boot=uefi,kernel='/boot/vmlinuz',initrd='/boot/initrd.img',kernel_args='console=/dev/ttyS0' --extra-args='console=ttyS0,115200n8 serial' --debug

select Tab-> Help -> Enter Shell

sudo apt-cache policy kbd

# Check version installed
Installed: 2.3.0-3ubuntu4

#Error message thrown in logs

root@ubuntu-server:/# setfont $SNAP/subiquity.psf
setfont: ERROR kdfontop.c:266 put_font_piofontx: ioctl(PIO_FONTX): 512,8x16: failed: Inappropriate ioctl for device

### ENABLE PROPOSED ###

# create new VM for kinetic
sudo virt-install --location='./ubuntu-22.04.1-live-server-amd64.iso', --name=setfont-repo03 --vcpus=2 --memory=2048 --disk size=10 --console pty,target_type=virtio --serial pty --graphics none --boot=uefi,kernel='/boot/vmlinuz',initrd='/boot/initrd.img',kernel_args='console=/dev/ttyS0' --extra-args='console=ttyS0,115200n8 serial' --debug

select Enter -> Tab-> Help -> Enter Shell

# update /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu jammy-proposed universe multiverse restricted main

sudo apt --only-upgrade install kbd
Check version installed
sudo apt-cache policy kbd
Installed: 2.3.0-3ubuntu4.22.04

# execute command
setfont $SNAP/subiquity.psf
bash:
# no error messages thrown
# we don't have any error messages being thrown in the logs -
/var/log/installer/subiquity-client-debug.log

# if you need to log back into the vm
virsh list
virsh console setfont-repo03

# notes
ctl+5 = exit rich console command or CTRL+]

### VERIFICATION DONE KINETIC ###

tags: added: verification-done-jammy verification-done-kinetic
removed: verification-needed-jammy verification-needed-kinetic
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package kbd - 2.3.0-3ubuntu4.22.10

---------------
kbd (2.3.0-3ubuntu4.22.10) kinetic; urgency=medium

  * d/p/libkfont-Use-only-KDFONTOP.patch:
    Fixes error thrown in syslog from deprecated setfont (LP: #1996619)

 -- Heather Lemon <email address hidden> Fri, 16 Dec 2022 14:23:08 +0000

Changed in kbd (Ubuntu Kinetic):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for kbd has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package kbd - 2.3.0-3ubuntu4.22.04

---------------
kbd (2.3.0-3ubuntu4.22.04) jammy; urgency=medium

  * d/p/libkfont-Use-only-KDFONTOP.patch:
    Fixes error thrown in syslog from deprecated setfont (LP: #1996619)

 -- Heather Lemon <email address hidden> Fri, 16 Dec 2022 14:14:33 +0000

Changed in kbd (Ubuntu Jammy):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.