Add support for zstd

Bug #1932542 reported by Dimitri John Ledkov
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
initramfs-tools (Ubuntu)
Fix Released
Undecided
Unassigned
Bionic
Fix Released
Undecided
Unassigned
Focal
Fix Released
Undecided
Unassigned

Bug Description

[Impact]

 * initramfs-tools in impish has changed default initrd compression to zstd. To allow compressing and uncompressing such initrds on Focal LTS release we should backport zstd support in the mkinitramfs & unmkinitramffs tooling. For example ubuntu-cdimage uses unmkinitramfs tool to unpack and inspect impish initrds on a focal host.

 * Cherrypicking the feature from 0.138 release, which is also present in Hirsute and Impish.

[Test Plan]

 * Create initrd with zstd $ mkinitramfs -c zstd -o zstd-initrd.img

 * Uncompress it with $ unmkinitramfs ./zstd-initrd.img zstd-initrd-unpacked

 * For bionic also repeat the same with lz4.

[Where problems could occur]

 * This adds support for zstd compressed initrd in both mkinitramfs and unmkinitramfs. However our GA kernels do not support zstd compressed initrds. And depends on zstd package is not added either. Meaning one still has to install zstd to gain the unpack support. Changing initramfs.conf to zstd may result in unbootable instance when used with GA kernel.

description: updated
Changed in initramfs-tools (Ubuntu):
status: New → Fix Released
Changed in initramfs-tools (Ubuntu Focal):
status: New → In Progress
tags: added: zstd
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Dimitri, or anyone else affected,

Accepted initramfs-tools into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/initramfs-tools/0.136ubuntu6.6 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-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. 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 initramfs-tools (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

When reviewing this package I was actually thinking if maybe we should add a depends on zstd to initramfs-tools, even though this wasn't the case for the devel series.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

@sil2100 zstd depends was added in the devel series. Historically, we only had the depends on the tool that is needed at a time for a given series... ie. gzip, xz, lz4, zstd.

Given that zstd compressed initrds are not supported by the linux GA kernel in Focal, I am hesitant to impose zstd dependency on everyone in focal.

Only .3 hwe will have support for zstd compressed initrds.

Note we don't add depends on other compression methods that are supported either, ie. bzip2.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

# mkinitramfs -czstd -o /boot/initrd.img-5.4.0-76-generic 5.4.0-76-generic
# unmkinitramfs /boot/initrd.img-5.4.0-76-generic foo
# ls foo/
bin conf etc init lib lib64 run sbin scripts usr

# dpkg-query -W initramfs-tools zstd
initramfs-tools 0.136ubuntu6.6
zstd 1.4.4+dfsg-3ubuntu0.1

# apt remove --purge zstd
# unmkinitramfs /boot/initrd.img-5.4.0-76-generic no-zstd
cpio: premature end of archive

With zstd package installed initramfs-tools 0.136ubuntu6.6 works with zstd compressed initrds correctly.

tags: added: verification-done verification-done-focal
removed: verification-needed verification-needed-focal
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Thanks for the verification! Even though I REALLY hate releasing things early, with the nature of this package and the SRUed changes, I think we can do it conditionally - just this one time - to unblock image builds for impish. Please be sure to keep your eyes open for any weird bug reports on focal.

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

This bug was fixed in the package initramfs-tools - 0.136ubuntu6.6

---------------
initramfs-tools (0.136ubuntu6.6) focal; urgency=medium

  * Cherrypick zstd support from upstream. LP: #1932542

 -- Dimitri John Ledkov <email address hidden> Fri, 18 Jun 2021 14:22:25 +0100

Changed in initramfs-tools (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for initramfs-tools 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.

description: updated
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Uploading to ubuntu (via sftp to upload.ubuntu.com):
  Uploading initramfs-tools_0.130ubuntu3.13.dsc: done.
  Uploading initramfs-tools_0.130ubuntu3.13.tar.xz: done.
  Uploading initramfs-tools_0.130ubuntu3.13_source.buildinfo: done.
  Uploading initramfs-tools_0.130ubuntu3.13_source.changes: done.
Successfully uploaded packages

Changed in initramfs-tools (Ubuntu Bionic):
status: New → In Progress
Revision history for this message
Chris Halse Rogers (raof) wrote : Please test proposed package

Hello Dimitri, or anyone else affected,

Accepted initramfs-tools into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/initramfs-tools/0.130ubuntu3.13 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-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. 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 initramfs-tools (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-bionic
removed: verification-done
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

(bionic-amd64)root@ottawa:/tmp# dpkg-query -W initramfs-tools liblz4-tool zstd
initramfs-tools 0.130ubuntu3.13
liblz4-tool 0.0~r131-2ubuntu3.1
zstd 1.3.3+dfsg-2ubuntu1.2

(bionic-amd64)root@ottawa:/tmp# mkinitramfs -c zstd -o zstd-initrd.img 4.15.0-150-generic
(bionic-amd64)root@ottawa:/tmp# mkinitramfs -c lz4 -o lz4-initrd.img 4.15.0-150-generic
(bionic-amd64)root@ottawa:/tmp# unmkinitramfs ./zstd-initrd.img zstd-unpacked
(bionic-amd64)root@ottawa:/tmp# unmkinitramfs ./lz4-initrd.img lz4-unpacked
(bionic-amd64)root@ottawa:/tmp# ls zstd-unpacked/
bin conf etc init lib lib64 run sbin scripts
(bionic-amd64)root@ottawa:/tmp# ls lz4-unpacked/
bin conf etc init lib lib64 run sbin scripts

(bionic-amd64)root@ottawa:/tmp# file zstd-initrd.img
zstd-initrd.img: Zstandard compressed data (v0.8+), Dictionary ID: None
(bionic-amd64)root@ottawa:/tmp# file lz4-initrd.img
lz4-initrd.img: LZ4 compressed data (v0.1-v0.9)

All is good.

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

This bug was fixed in the package initramfs-tools - 0.130ubuntu3.13

---------------
initramfs-tools (0.130ubuntu3.13) bionic; urgency=medium

  * Backport zstd and lz4 support from focal. LP: #1932542

 -- Dimitri John Ledkov <email address hidden> Thu, 01 Jul 2021 14:11:48 +0100

Changed in initramfs-tools (Ubuntu Bionic):
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.