azurelinux icon indicating copy to clipboard operation
azurelinux copied to clipboard

Add runtime require on gawk to dracut

Open dmcilvaney opened this issue 1 year ago • 3 comments

Merge Checklist

All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)

  • [ ] The toolchain has been rebuilt successfully (or no changes were made to it)
  • [ ] The toolchain/worker package manifests are up-to-date
  • [ ] Any updated packages successfully build (or no packages were changed)
  • [ ] Packages depending on static components modified in this PR (Golang, *-static subpackages, etc.) have had their Release tag incremented.
  • [ ] Package tests (%check section) have been verified with RUN_CHECK=y for existing SPEC files, or added to new SPEC files
  • [ ] All package sources are available
  • [ ] cgmanifest files are up-to-date and sorted (./cgmanifest.json, ./toolkit/scripts/toolchain/cgmanifest.json, .github/workflows/cgmanifest.json)
  • [ ] LICENSE-MAP files are up-to-date (./SPECS/LICENSES-AND-NOTICES/data/licenses.json, ./SPECS/LICENSES-AND-NOTICES/LICENSES-MAP.md, ./SPECS/LICENSES-AND-NOTICES/LICENSE-EXCEPTIONS.PHOTON)
  • [ ] All source files have up-to-date hashes in the *.signatures.json files
  • [ ] sudo make go-tidy-all and sudo make go-test-coverage pass
  • [ ] Documentation has been updated to match any changes to the build system
  • [ ] Ready to merge

Summary

We contributed https://github.com/dracutdevs/dracut/commit/67591e8855006eb02aa0ffab7349ab770e471473 / https://github.com/dracutdevs/dracut/issues/2323 to upstream dracut, but since it hasn't made it into ver. 59 yet we have a patch. See https://github.com/microsoft/azurelinux/pull/5424 for details.

This patch adds a requirement on awk to prep an initramfs that isn't present in Fedora etc., so likely isn't found in any other .spec for dracut.

This failure is non-fatal since the fallback path of cache-miss still works (as it did for the selinux errors), but the log is very ugly:

WARN[0022][imager] initramfs 3.0-3.azl3 posttrans               
WARN[0023][imager] dracut: Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]!=y 
WARN[0023][imager] /usr/lib/dracut/dracut-functions.sh: line 247: awk: command not found 
WARN[0023][imager] /usr/lib/dracut/dracut-functions.sh: line 247: awk: command not found 
WARN[0023][imager] /usr/lib/dracut/dracut-functions.sh: line 247: awk: command not found 
WARN[0023][imager] /usr/lib/dracut/dracut-functions.sh: line 247: awk: command not found 
WARN[0023][imager] /usr/lib/dracut/dracut-functions.sh: line 247: awk: command not found 
WARN[0023][imager] /usr/lib/dracut/dracut-functions.sh: line 247: awk: command not found 
WARN[0023][imager] /usr/lib/dracut/dracut-functions.sh: line 247: awk: command not found 
WARN[0023][imager] /usr/lib/dracut/dracut-functions.sh: line 247: awk: command not found 
WARN[0023][imager] /usr/lib/dracut/dracut-functions.sh: line 247: awk: command not found 
...

Adding a Requires: gawk fixes this error. Checking the change in runtime requirements (as understood by our build tools via depsearch) gives gawk and mpfr as new (853K + 358K = 1.2M)

diff --git a/toolkit/before.txt b/toolkit/after.txt
index 190c75ad4..a3a3fc3da 100644
--- a/toolkit/before.txt
+++ b/toolkit/after.txt
@@ -1,31 +1,33 @@
 audit
 bash
 coreutils
 cpio
 dbus
 dracut
 expat
 filesystem
 findutils
+gawk
 glibc
 gmp
 grep
 gzip
 kbd
 kmod
 libdb
 libkcapi
 libselinux
 libsepol
+mpfr
 ncurses
 nspr
 nss
 openssl
 pcre2
 procps-ng
 readline
 sed
 sqlite
 systemd
 util-linux
 xz
Change Log
  • Add Requires: gawk to dracut.
Does this affect the toolchain?

NO

https://microsoft.visualstudio.com/DefaultCollection/OS/_queries/edit/50085799/?triage=true

Test Methodology
  • Local build

dmcilvaney avatar Apr 10 '24 21:04 dmcilvaney

New dracut with core-efi.json: image image

dmcilvaney avatar Apr 10 '24 22:04 dmcilvaney

Old dracut: image image

dmcilvaney avatar Apr 10 '24 22:04 dmcilvaney

gawk is VERY large for what it is, this adds ~4MB to the image. Given we are actively trying to minimize our images we need to fix gawk first.

dmcilvaney avatar Apr 12 '24 17:04 dmcilvaney

superseded by https://github.com/microsoft/azurelinux/pull/9210

dmcilvaney avatar May 29 '24 22:05 dmcilvaney