Skip to content

check-sb-key.sh script is exiting with 1 instead of 0, when key is already enrolled, causing check-sb-key.service to fail. #2251

Description

@theOxifier

Describe the bug

After rebooting recently, I checked systemd to see if any services were failed, and found that the check-sb-key.service had failed.

Image

It appears though from reading the log messages that it should actually be reporting a SUCCESS not an error since "...akmods-ublue.der is already enrolled", and the script inters the clean upstate. Once in the clean up state if it doesn't find $KEY_WARN_FILE, it exits with 1. Causing the service to be in a failed state.

What did you expect to happen?

I would expect that if it didn't find a script to clean up it would simply exit cleanly and not error, as the logic is clearly setup to ensure that the rm action is only executed on finding the file.

something like this on line 23 of /usr/libexec/check-sb-key.sh would probably work well to resolve this issue

([ -e $KEY_WARN_FILE ] && rm $KEY_WARN_FILE) || true
# or 
([ -e $KEY_WARN_FILE ] && rm $KEY_WARN_FILE) || exit 0
# or 
([ -e $KEY_WARN_FILE ] && rm $KEY_WARN_FILE) || echo "No $KEY_WARN_FILE found"
exit 0

Output of bootc status

sudo bootc status
Place your finger on the fingerprint reader
● Booted ostree
           Commit: 8060a4538d1a1789bd1a534441bfabaa01d0b44afff112be7076bbbf89ce59f5

  Rollback ostree
           Commit: 1cc3ec396be8de37e522eb7cf5519d20b79755f221ed9efd088b645e2f382739

Output of groups

<myuser> wheel

Extra information or context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededkind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions