fwupd: shutdown hook fails with exit status 1 because /bin/sh is unavailable

Open Beginner friendly
#587,307 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Domain
devops

Research direction

Start with the Nixpkgs fwupd package expression at pkgs/by-name/fw/fwupd/package.nix and the upstream hook linked in the issue. Check how the package installs fwupd.shutdown and how NixOS provides the runtime shell. Done means the installed hook uses an interpreter available during shutdown; the issue reports that changing its shebang to ${pkgs.runtimeShell} fixes the error.

Written by the indexing model from the issue text.

Description

Describe the bug

The fwupd 2.1.9 shutdown hook starts with #!/bin/sh. On NixOS, shutdown can unmount /bin before executing systemd shutdown hooks. The console then reports that fwupd.shutdown failed with exit status 1.

Upstream hook.
Nixpkgs package source.

Steps to reproduce
  1. Enable services.fwupd.enable = true; on NixOS.
  2. Build and activate the configuration.
  3. Inspect the installed fwupd.shutdown hook: its interpreter is /bin/sh.
  4. Shut down using systemctl poweroff.
  5. Observe the console message: fwupd.shutdown failed with exit status 1.

The shutdown journal records Unmounted /bin. before Shutting down.. The hook error appears on the console after journald stops.

Expected behaviour

Patch the installed shutdown hook to use an interpreter in the Nix store that remains available during shutdown.

Workaround and validation

Replacing only #!/bin/sh with #!${pkgs.runtimeShell} fixes the shutdown error. The rest of the hook, including firmware activation, is unchanged.

The system build passed. After activating the patched configuration and testing shutdown, the console error no longer appeared.

Dominant language
Nix
Stars
26.8k
Forks
20.7k
Avg merge
6h 55m
Merged PRs (30d)
535

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NixOS/nixpkgs

All issues in NixOS/nixpkgs

Similar issues

More DevOps issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.