Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2247940
Currently, CoreOS image fails to be built. This is because since commit 00c37d8c ("spec: Drop special handling for IA64 machines"), the last command is now kdump-migrate-action.sh and it fails to run in such invocation environment. Thus the %post scriptlet returns a non-zero exit code which breaks package installation,
Running scriptlet: kexec-tools-2.0.27-4.fc40.ppc64le /proc/ is not mounted. This is not a supported mode of operation. Please fix your invocation environment to mount /proc/ and /sys/ properly. Proceeding anyway. Your mileage may vary. servicelog_notify: is not supported on the Unknown platform warning: %post(kexec-tools-2.0.27-4.fc40.ppc64le) scriptlet failed, exit status 1 Error in POSTIN scriptlet in rpm package kexec-tools
Quoting [1],
Non-zero exit codes from scriptlets can break installs/upgrades/erases such that no further actions will be taken for that package in a transaction (see Ordering), which may for example prevent an old version of a package from being erased on upgrades, ...
All scriptlets MUST exit with the zero exit status. Because RPM in its default configuration does not execute shell scriptlets with the -e argument to the shell, excluding explicit exit calls (frowned upon with a non-zero argument!), the exit status of the last command in a scriptlet determines its exit status...
Usually the most important bit is to apply this to the last command executed in a scriptlet, or to add a separate command such as plain “:” or “exit 0” as the last one in a scriptlet.
Following the above suggestion, add a separate command ":" as the last one to the %post scriptlet.
[1] https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/
Reported-by: Colin Walters walters@redhat.com Cc: Dusty Mabe dustymabe@redhat.com Cc: Philipp Rudo prudo@redhat.com Fixes: 00c37d8c ("spec: Drop special handling for IA64 machines") Signed-off-by: Coiby Xu coxu@redhat.com --- kexec-tools.spec | 1 + 1 file changed, 1 insertion(+)
diff --git a/kexec-tools.spec b/kexec-tools.spec index cb1a408c..19b0b69d 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -271,6 +271,7 @@ touch /etc/kdump.conf servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh 2>/dev/null servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin >/dev/null %endif +:
%postun
On 11/16/23 04:23, Coiby Xu wrote:
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2247940
Currently, CoreOS image fails to be built. This is because since commit 00c37d8c ("spec: Drop special handling for IA64 machines"), the last command is now kdump-migrate-action.sh and it fails to run in such invocation environment. Thus the %post scriptlet returns a non-zero exit code which breaks package installation,
Running scriptlet: kexec-tools-2.0.27-4.fc40.ppc64le /proc/ is not mounted. This is not a supported mode of operation. Please fix your invocation environment to mount /proc/ and /sys/ properly. Proceeding anyway. Your mileage may vary. servicelog_notify: is not supported on the Unknown platform warning: %post(kexec-tools-2.0.27-4.fc40.ppc64le) scriptlet failed, exit status 1 Error in POSTIN scriptlet in rpm package kexec-tools
Quoting [1],
Non-zero exit codes from scriptlets can break installs/upgrades/erases such that no further actions will be taken for that package in a transaction (see Ordering), which may for example prevent an old version of a package from being erased on upgrades, ...
All scriptlets MUST exit with the zero exit status. Because RPM in its default configuration does not execute shell scriptlets with the -e argument to the shell, excluding explicit exit calls (frowned upon with a non-zero argument!), the exit status of the last command in a scriptlet determines its exit status...
Usually the most important bit is to apply this to the last command executed in a scriptlet, or to add a separate command such as plain “:” or “exit 0” as the last one in a scriptlet.
Following the above suggestion, add a separate command ":" as the last one to the %post scriptlet.
[1] https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/
Reported-by: Colin Walters walters@redhat.com Cc: Dusty Mabe dustymabe@redhat.com Cc: Philipp Rudo prudo@redhat.com Fixes: 00c37d8c ("spec: Drop special handling for IA64 machines") Signed-off-by: Coiby Xu coxu@redhat.com
kexec-tools.spec | 1 + 1 file changed, 1 insertion(+)
diff --git a/kexec-tools.spec b/kexec-tools.spec index cb1a408c..19b0b69d 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -271,6 +271,7 @@ touch /etc/kdump.conf servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh 2>/dev/null servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin >/dev/null %endif +:
I usually see people use `mycommmand || :` when they are explicitly OK with a command failing. I don't often see it just added at the end of a scriptlet, but maybe I don't see that many spec files or I'm not paying attention.
With that being said, is it really OK that this command would fail? what does `servicelog_notify` do? Why is it only done for powerpc? Should we somehow make that command run in a different place that would work for ostree or non-ostree systems?
Dusty
On Thu, Nov 16, 2023 at 05:04:09PM -0500, Dusty Mabe wrote:
On 11/16/23 04:23, Coiby Xu wrote:
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2247940
Currently, CoreOS image fails to be built. This is because since commit 00c37d8c ("spec: Drop special handling for IA64 machines"), the last command is now kdump-migrate-action.sh and it fails to run in such invocation environment. Thus the %post scriptlet returns a non-zero exit code which breaks package installation,
Running scriptlet: kexec-tools-2.0.27-4.fc40.ppc64le /proc/ is not mounted. This is not a supported mode of operation. Please fix your invocation environment to mount /proc/ and /sys/ properly. Proceeding anyway. Your mileage may vary. servicelog_notify: is not supported on the Unknown platform warning: %post(kexec-tools-2.0.27-4.fc40.ppc64le) scriptlet failed, exit status 1 Error in POSTIN scriptlet in rpm package kexec-tools
Quoting [1],
Non-zero exit codes from scriptlets can break installs/upgrades/erases such that no further actions will be taken for that package in a transaction (see Ordering), which may for example prevent an old version of a package from being erased on upgrades, ...
All scriptlets MUST exit with the zero exit status. Because RPM in its default configuration does not execute shell scriptlets with the -e argument to the shell, excluding explicit exit calls (frowned upon with a non-zero argument!), the exit status of the last command in a scriptlet determines its exit status...
Usually the most important bit is to apply this to the last command executed in a scriptlet, or to add a separate command such as plain “:” or “exit 0” as the last one in a scriptlet.
Following the above suggestion, add a separate command ":" as the last one to the %post scriptlet.
[1] https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/
Reported-by: Colin Walters walters@redhat.com Cc: Dusty Mabe dustymabe@redhat.com Cc: Philipp Rudo prudo@redhat.com Fixes: 00c37d8c ("spec: Drop special handling for IA64 machines") Signed-off-by: Coiby Xu coxu@redhat.com
kexec-tools.spec | 1 + 1 file changed, 1 insertion(+)
diff --git a/kexec-tools.spec b/kexec-tools.spec index cb1a408c..19b0b69d 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -271,6 +271,7 @@ touch /etc/kdump.conf servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh 2>/dev/null servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin >/dev/null %endif +:
I usually see people use `mycommmand || :` when they are explicitly OK with a command failing. I don't often see it just added at the end of a scriptlet, but maybe I don't see that many spec files or I'm not paying attention.
Indeed, `mycommmand || :` is more common but some packages like arpwatch [2] added ":" to the end. Anyway I think the guidance is clear about the message "all scriptlets MUST exit with the zero exit status" and adding ":" as the last command is the one of the recommended method. One benefit is it can help prevent this problem this patch tries to address because the command servicelog_notify may also be moved or there is a new command inserted in the scriptlet.
With that being said, is it really OK that this command would fail? what does `servicelog_notify` do? Why is it only done for powerpc? Should we somehow make that command run in a different place that would work for ostree or non-ostree systems?
According to commit 71b7a2f4 ("kdump/ppc64: rebuild initramfs image after migration"), the purpose of servicelog_notify to rebuild the kdump initrd after partition migration (LPM) which is ppc-only. Personally, I think it's OK to fail in the case of pre-built image and it's a also separate issue. Hi Hari, do you have any comment?
[2] https://src.fedoraproject.org/rpms/arpwatch/blob/rawhide/f/arpwatch.spec
Dusty
On 11/21/23 20:20, Coiby Xu wrote:
On Thu, Nov 16, 2023 at 05:04:09PM -0500, Dusty Mabe wrote:
On 11/16/23 04:23, Coiby Xu wrote:
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2247940
Currently, CoreOS image fails to be built. This is because since commit 00c37d8c ("spec: Drop special handling for IA64 machines"), the last command is now kdump-migrate-action.sh and it fails to run in such invocation environment. Thus the %post scriptlet returns a non-zero exit code which breaks package installation,
Running scriptlet: kexec-tools-2.0.27-4.fc40.ppc64le /proc/ is not mounted. This is not a supported mode of operation. Please fix your invocation environment to mount /proc/ and /sys/ properly. Proceeding anyway. Your mileage may vary. servicelog_notify: is not supported on the Unknown platform warning: %post(kexec-tools-2.0.27-4.fc40.ppc64le) scriptlet failed, exit status 1 Error in POSTIN scriptlet in rpm package kexec-tools
Quoting [1],
Non-zero exit codes from scriptlets can break installs/upgrades/erases such that no further actions will be taken for that package in a transaction (see Ordering), which may for example prevent an old version of a package from being erased on upgrades, ...
All scriptlets MUST exit with the zero exit status. Because RPM in its default configuration does not execute shell scriptlets with the -e argument to the shell, excluding explicit exit calls (frowned upon with a non-zero argument!), the exit status of the last command in a scriptlet determines its exit status...
Usually the most important bit is to apply this to the last command executed in a scriptlet, or to add a separate command such as plain “:” or “exit 0” as the last one in a scriptlet.
Following the above suggestion, add a separate command ":" as the last one to the %post scriptlet.
[1] https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/
Reported-by: Colin Walters walters@redhat.com Cc: Dusty Mabe dustymabe@redhat.com Cc: Philipp Rudo prudo@redhat.com Fixes: 00c37d8c ("spec: Drop special handling for IA64 machines") Signed-off-by: Coiby Xu coxu@redhat.com
kexec-tools.spec | 1 + 1 file changed, 1 insertion(+)
diff --git a/kexec-tools.spec b/kexec-tools.spec index cb1a408c..19b0b69d 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -271,6 +271,7 @@ touch /etc/kdump.conf servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh 2>/dev/null servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin >/dev/null %endif +:
I usually see people use `mycommmand || :` when they are explicitly OK with a command failing. I don't often see it just added at the end of a scriptlet, but maybe I don't see that many spec files or I'm not paying attention.
Indeed, `mycommmand || :` is more common but some packages like arpwatch [2] added ":" to the end. Anyway I think the guidance is clear about the message "all scriptlets MUST exit with the zero exit status" and adding ":" as the last command is the one of the recommended method. One benefit is it can help prevent this problem this patch tries to address because the command servicelog_notify may also be moved or there is a new command inserted in the scriptlet.
With that being said, is it really OK that this command would fail? what does `servicelog_notify` do? Why is it only done for powerpc? Should we somehow make that command run in a different place that would work for ostree or non-ostree systems?
According to commit 71b7a2f4 ("kdump/ppc64: rebuild initramfs image after migration"), the purpose of servicelog_notify to rebuild the kdump initrd after partition migration (LPM) which is ppc-only. Personally, I think it's OK to fail in the case of pre-built image and it's a also separate issue. Hi Hari, do you have any comment?
[2] https://src.fedoraproject.org/rpms/arpwatch/blob/rawhide/f/arpwatch.spec
Thanks Coiby,
Any further updates from your side on this?
Dusty
Hi Coiby,
On Thu, 16 Nov 2023 17:23:14 +0800 Coiby Xu coxu@redhat.com wrote:
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2247940
Currently, CoreOS image fails to be built. This is because since commit 00c37d8c ("spec: Drop special handling for IA64 machines"), the last command is now kdump-migrate-action.sh and it fails to run in such invocation environment. Thus the %post scriptlet returns a non-zero exit code which breaks package installation,
Running scriptlet: kexec-tools-2.0.27-4.fc40.ppc64le /proc/ is not mounted. This is not a supported mode of operation. Please fix your invocation environment to mount /proc/ and /sys/ properly. Proceeding anyway. Your mileage may vary. servicelog_notify: is not supported on the Unknown platform warning: %post(kexec-tools-2.0.27-4.fc40.ppc64le) scriptlet failed, exit status 1 Error in POSTIN scriptlet in rpm package kexec-tools
Quoting [1],
Non-zero exit codes from scriptlets can break installs/upgrades/erases such that no further actions will be taken for that package in a transaction (see Ordering), which may for example prevent an old version of a package from being erased on upgrades, ...
All scriptlets MUST exit with the zero exit status. Because RPM in its default configuration does not execute shell scriptlets with the -e argument to the shell, excluding explicit exit calls (frowned upon with a non-zero argument!), the exit status of the last command in a scriptlet determines its exit status...
Usually the most important bit is to apply this to the last command executed in a scriptlet, or to add a separate command such as plain “:” or “exit 0” as the last one in a scriptlet.
Following the above suggestion, add a separate command ":" as the last one to the %post scriptlet.
[1] https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/
The patch looks good to me. The only question I ask myself is if we should add a ":" to the other scriplets as well. At least in my opinion that would be consequent when _all_ scriplets must exit with zero. But this can also be done in a subsequent patch.
In order to get on with this patch.
Reviewed-by: Philipp Rudo prudo@redhat.com
Reported-by: Colin Walters walters@redhat.com Cc: Dusty Mabe dustymabe@redhat.com Cc: Philipp Rudo prudo@redhat.com Fixes: 00c37d8c ("spec: Drop special handling for IA64 machines") Signed-off-by: Coiby Xu coxu@redhat.com
kexec-tools.spec | 1 + 1 file changed, 1 insertion(+)
diff --git a/kexec-tools.spec b/kexec-tools.spec index cb1a408c..19b0b69d 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -271,6 +271,7 @@ touch /etc/kdump.conf servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh 2>/dev/null servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin >/dev/null %endif +:
%postun
I think actually the best fix would be changing servicelog_notify to detect it's not in a booted host (a good proxy is whether /run/systemd exists).
But in the meantime any form of ignoring the failure is OK by me.
(I do think longer term we actually want to change how we handle RPM so that we *do* properly check errors...it's what rpm-ostree is trying to do because it can, but that's a whole other thing)