Bug 2223794

Summary: preuninstall call to kernel-install Failing With Updated systemd-udev
Product: [Fedora] Fedora Reporter: Jonathan Steffan <jonathansteffan>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: acaringi, adscvr, airlied, alciregi, bskeggs, hdegoede, hpa, jarodwilson, josef, kernel-maint, kocelfc, lgoncalv, linville, masami256, mchehab, ptalbert, steved, yaneti
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Full DNF5 transaction
none
kernel.spec patch to call updated kernel-install correctly none

Description Jonathan Steffan 2023-07-19 00:13:25 UTC
During a full update on rawhide, there was a failed transaction.

[jon@fedora ~]$ sudo rpm -ve kernel-core-6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64
Preparing packages...
Too many arguments.
error: %preun(kernel-core-6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64) scriptlet failed, exit status 1
error: kernel-core-6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64: erase failed

This seems to be the only thing that failed. This is likely related to the kernel-install command being rewritten (C) as the old kernel-install (bash) silently ignores the extra option.





Reproducible: Always

Steps to Reproduce:
1. DNF5 transaction on rawhide with systemd-udev-254~rc2-4.fc39.x86_64+ and remove an old kernel-core package
2. `kernel-install remove` during old package %preun
Actual Results:  
Old kernel-core package remains installed and in a broken state.

Expected Results:  
Package is removed.

[jon@fedora ~]$ sudo rpm -vve kernel-core-6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64
D: PRAGMA secure_delete = OFF: 0
D: PRAGMA case_sensitive_like = ON: 0
D: loading keyring from rpmdb
D:  read h#    1863 
Header SHA256 digest: OK
Header SHA1 digest: OK
D: added key gpg-pubkey-18b8e74c-62f2920f to keyring
D:  read h#    1864 
Header SHA256 digest: OK
Header SHA1 digest: OK
D: added key gpg-pubkey-a15b79cc-63d04c2c to keyring
D:  read h#    2089 
Header V4 RSA/SHA256 Signature, key ID 18b8e74c: OK
Header SHA256 digest: OK
Header SHA1 digest: OK
D: Plugin: calling hook init in systemd_inhibit plugin
D: ========== --- kernel-core-6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39 x86_64/linux 0x0
D:  read h#    1743 
Header V4 RSA/SHA256 Signature, key ID 18b8e74c: OK
Header SHA256 digest: OK
Header SHA1 digest: OK
D:  read h#    2674 
Header V4 RSA/SHA256 Signature, key ID 18b8e74c: OK
Header SHA256 digest: OK
Header SHA1 digest: OK
D:  Requires: kernel >= 5.6.14                              YES (db provides)
D:  read h#    2752 
Header V4 RSA/SHA256 Signature, key ID 18b8e74c: OK
Header SHA256 digest: OK
Header SHA1 digest: OK
D:  read h#    3270 
Header V4 RSA/SHA256 Signature, key ID 18b8e74c: OK
Header SHA256 digest: OK
Header SHA1 digest: OK
D:  read h#    3545 
Header V4 RSA/SHA256 Signature, key ID 18b8e74c: OK
Header SHA256 digest: OK
Header SHA1 digest: OK
D:  read h#    2673 
Header V4 RSA/SHA256 Signature, key ID 18b8e74c: OK
Header SHA256 digest: OK
Header SHA1 digest: OK
D:  read h#    2675 
Header V4 RSA/SHA256 Signature, key ID 18b8e74c: OK
Header SHA256 digest: OK
Header SHA1 digest: OK
D:  read h#    2753 
Header V4 RSA/SHA256 Signature, key ID 18b8e74c: OK
Header SHA256 digest: OK
Header SHA1 digest: OK
D:  read h#    2862 
Header V4 RSA/SHA256 Signature, key ID 18b8e74c: OK
Header SHA256 digest: OK
Header SHA1 digest: OK
D:  read h#    2876 
Header V4 RSA/SHA256 Signature, key ID 18b8e74c: OK
Header SHA256 digest: OK
Header SHA1 digest: OK
D:  read h#    3271 
Header V4 RSA/SHA256 Signature, key ID 18b8e74c: OK
Header SHA256 digest: OK
Header SHA1 digest: OK
D:  read h#    3461 
Header V4 RSA/SHA256 Signature, key ID 18b8e74c: OK
Header SHA256 digest: OK
Header SHA1 digest: OK
D:  read h#    3463 
Header V4 RSA/SHA256 Signature, key ID 18b8e74c: OK
Header SHA256 digest: OK
Header SHA1 digest: OK
D:  read h#    3546 
Header V4 RSA/SHA256 Signature, key ID 18b8e74c: OK
Header SHA256 digest: OK
Header SHA1 digest: OK
D: ========== recording tsort relations
D: ========== tsorting packages (order, #predecessors, #succesors, depth)
D:     0    0    0    1   -kernel-core-6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64
D: erasing packages
D: PRAGMA secure_delete = OFF: 0
D: PRAGMA case_sensitive_like = ON: 0
D: PRAGMA journal_mode = WAL: 0
D: PRAGMA wal_autocheckpoint = 10000: 0
D: CREATE INDEX IF NOT EXISTS 'Name_key_idx' ON 'Name'(key ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Basenames_key_idx' ON 'Basenames'(key ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Basenames_hnum_idx' ON 'Basenames'(hnum ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Group_key_idx' ON 'Group'(key ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Requirename_key_idx' ON 'Requirename'(key ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Requirename_hnum_idx' ON 'Requirename'(hnum ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Providename_key_idx' ON 'Providename'(key ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Providename_hnum_idx' ON 'Providename'(hnum ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Conflictname_key_idx' ON 'Conflictname'(key ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Conflictname_hnum_idx' ON 'Conflictname'(hnum ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Obsoletename_key_idx' ON 'Obsoletename'(key ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Obsoletename_hnum_idx' ON 'Obsoletename'(hnum ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Triggername_key_idx' ON 'Triggername'(key ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Triggername_hnum_idx' ON 'Triggername'(hnum ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Dirnames_key_idx' ON 'Dirnames'(key ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Dirnames_hnum_idx' ON 'Dirnames'(hnum ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Sha1header_key_idx' ON 'Sha1header'(key ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Filetriggername_key_idx' ON 'Filetriggername'(key ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Filetriggername_hnum_idx' ON 'Filetriggername'(hnum ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Transfiletriggername_key_idx' ON 'Transfiletriggername'(key ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Transfiletriggername_hnum_idx' ON 'Transfiletriggername'(hnum ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Recommendname_key_idx' ON 'Recommendname'(key ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Recommendname_hnum_idx' ON 'Recommendname'(hnum ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Suggestname_key_idx' ON 'Suggestname'(key ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Suggestname_hnum_idx' ON 'Suggestname'(hnum ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Supplementname_key_idx' ON 'Supplementname'(key ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Supplementname_hnum_idx' ON 'Supplementname'(hnum ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Enhancename_key_idx' ON 'Enhancename'(key ASC): 0
D: CREATE INDEX IF NOT EXISTS 'Enhancename_hnum_idx' ON 'Enhancename'(hnum ASC): 0
D: sanity checking 1 elements
D:  read h#    2089 
Header V4 RSA/SHA256 Signature, key ID 18b8e74c: OK
Header SHA256 digest: OK
Header SHA1 digest: OK
D: Plugin: calling hook tsm_pre in selinux plugin
D: selabel_open: (/etc/selinux/targeted/contexts/files/file_contexts) 
D: Plugin: calling hook tsm_pre in systemd_inhibit plugin
D: System shutdown blocked (fd 10)
D: running %pretrans scripts
D: computing 15 file fingerprints
Preparing packages...
D: computing file dispositions
D: 0x0000fc02     4096       143922        65485 rotational:-1 /boot
D: 0x00000027     4096      2973851           -1 rotational:-1 /
D: running %preuntrans scripts
D: Plugin: calling hook psm_pre in selinux plugin
D: ========== +++ kernel-core-6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39 x86_64-linux 0x0
D:     erase: kernel-core-6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64 has 15 files
D: Plugin: calling hook psm_pre in selinux plugin
D: %preun(kernel-core-6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64): scriptlet start
D: %preun(kernel-core-6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64): execv(/bin/sh) pid 14992
D: Plugin: calling hook scriptlet_fork_post in selinux plugin
D: setexecfilecon: (/bin/sh, rpm_script_t) 
+ /bin/kernel-install remove 6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64 /lib/modules/6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64/vmlinuz
Too many arguments.
+ exit 1
D: %preun(kernel-core-6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64): waitpid(14992) rc 14992 status 100
error: %preun(kernel-core-6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64) scriptlet failed, exit status 1
error: kernel-core-6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64: erase failed
D: running %posttrans scripts
D: running %postuntrans scripts
D: Plugin: calling hook tsm_post in selinux plugin
D: Plugin: calling hook tsm_post in systemd_inhibit plugin
D: System shutdown unblocked
D: syncing fs /boot
D: syncing fs /
D: PRAGMA synchronous = FULL: 0
D: PRAGMA optimize: 0
D: PRAGMA wal_checkpoint = TRUNCATE: 0
D: Exit status: 1
[jon@fedora ~]$ sudo /bin/kernel-install remove 6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64 /lib/modules/6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64/vmlinuz
Too many arguments.
[jon@fedora ~]$ sudo /bin/kernel-install remove 6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64 /lib/modules/6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64/vmlinuz --help
kernel-install [OPTIONS...] COMMAND ...

Add and remove kernel and initrd images to and from /boot

Usage:
  kernel-install [OPTIONS...] add KERNEL-VERSION KERNEL-IMAGE [INITRD-FILE...]
  kernel-install [OPTIONS...] remove KERNEL-VERSION
  kernel-install [OPTIONS...] inspect [KERNEL-IMAGE]

Options:
  -h --help              Show this help
     --version           Show package version
  -v --verbose           Increase verbosity
     --esp-path=PATH     Path to the EFI System Partition (ESP)
     --boot-path=PATH    Path to the $BOOT partition
     --make-entry-directory=yes|no|auto
                         Create $BOOT/ENTRY-TOKEN/ directory
     --entry-token=machine-id|os-id|os-image-id|auto|literal:…
                         Entry token to use for this installation

See the kernel-install(8) man page for details.

Comment 1 Jonathan Steffan 2023-07-19 00:15:08 UTC
Created attachment 1976426 [details]
Full DNF5 transaction

Comment 2 Jonathan Steffan 2023-07-19 00:25:34 UTC
Created attachment 1976427 [details]
kernel.spec patch to call updated kernel-install correctly

https://src.fedoraproject.org/fork/jsteffan/rpms/kernel/c/310ae617253d103d5aa1a98cb30eb5557e4be3a9?branch=rawhide

Comment 3 Jonathan Steffan 2023-07-19 00:32:31 UTC
https://github.com/systemd/systemd/issues/28448 to track the likely need for a backwards compatible `kernel-install` update.

Comment 4 Jonathan Steffan 2023-07-19 00:36:18 UTC
To successfully remove the kernel-core package using the updated `kernel-install`:

[jon@fedora ~]$ sudo rpm -e --noscripts kernel-core-6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64
warning: file modules.builtin.modinfo: remove failed: No such file or directory
warning: file modules.builtin: remove failed: No such file or directory
[jon@fedora ~]$ sudo /bin/kernel-install remove 6.4.0-0.rc7.20230620git692b7dc87ca6.54.fc39.x86_64

Comment 5 Yanko Kaneti 2023-07-24 10:15:08 UTC
*** Bug 2224878 has been marked as a duplicate of this bug. ***

Comment 6 Jonathan Steffan 2023-07-25 05:02:37 UTC
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2618 has been filed for the SPEC update.