Skip to content

how to workaround rpm dependency? #468

Closed

Description

@akdev1l

Hi bootupd team,

I love the idea behind bootc so I've been trying to create a bootc image based on archlinux.

As part of creating a bootc image bootupd backend generate-metadata is called but this fails on arch linux as there is not rpm binary.

Is there a way I can work around this dependency? I am happy to hack around this in my image as it is just a proof of concept but not sure what to do

Also the readme suggest bootupd should be OS agnostic but looking for rpm means it is not really agnostic :-( are there plans to remove this dependency?

Activity

  1. cgwalters commented on May 5, 2023

    @cgwalters
    Member

    Absolutely, we can support other backends here in bootupd. It should be relatively straightforward to do. Do you know any Rust?

  2. added
    enhancement
    triaged
    on May 5, 2023
  3. akdev1l commented on May 6, 2023

    @akdev1l
    Author

    I know a little bit of rust, I can probably try and get it working on arch linux if you can provide some guidance on:

    1. what is bootupd expecting from the package manager?
    2. what is the purpose of the metadata being generated?
    3. how does it relate to the grub configuration?

    we were able to hack around this dependency by reusing generated files from fedora but naturally the resulting image couldn't boot (I think because the metadata pointed to Fedora-specific grub configuration?)

  4. cgwalters commented on May 20, 2023

    @cgwalters
    Member

    We basically just need version information. I think instead of hardcoding knowledge of rpm in bootupd, we could try having an external script that can be provided by the OS output it?

  5. bigpod98 commented on Jul 11, 2023

    @bigpod98
  6. symbioquine commented on Oct 8, 2023

    @symbioquine

    @cgwalters I'm curious about this too. Can you provide a bit more detail about what you mean when you say "We basically just need version information"?

    Specifically, what I'm wondering is what it would take to boot existing container images (say Arch Linux) without any of the package layering stuff? I don't mind needing to build a custom image in order to install things. It looks like someone has actually already been trying to get that working. Maybe you can comment about whether that would be expected to work?

  7. BoukeHaarsma23 commented on Jul 28, 2024

    @BoukeHaarsma23

    @cgwalters is there any way I can help here? Can you give me some pointers on what needs to be done?

  8. cgwalters commented on Nov 21, 2024

    @cgwalters
    Member

    I was poking again at this; looking specifically at Debian for example, it looks like the deb already in /usr: /usr/lib/grub/x86_64-efi/monolithic/grubx64.efi.

    So this one then also relates a lot to #766 in that we should potentially just be able to take over or move what happens in the maintainer scripts? I am not finding offhand how that happens, I see at least

    cat /var/lib/dpkg/info/grub-efi-amd64-signed.postinst 
    #! /bin/sh
    set -e
    
    . /usr/share/debconf/confmodule
    
    case $1 in
        configure)
    	target=x86_64-efi
    	# Check /boot/grub to see if we previously installed to an ESP. We don't
    	# want to trigger the install code just by installing the package,
    	# normally the installer installs grub itself first.
    	if test -e /boot/grub/$target/core.efi; then
    	    if [ -x /usr/share/grub/grub-check-signatures ]; then
    		    /usr/share/grub/grub-check-signatures
    	    fi
    	    if [ -x /usr/lib/grub/grub-multi-install ]; then
    		    /usr/lib/grub/grub-multi-install --target=$target
    	    elif grub-install --help | grep -q 'auto-nvram'; then
    		    grub-install --target=$target --auto-nvram
    	    else
    		    grub-install --target=$target
    	    fi
    	fi
    
    	;;
    esac
    
    
    
    exit 0
    

    But I don't think that's it, since I think the configure phase only runs once? Needs investigation.

  9. cgwalters commented on Nov 21, 2024

    @cgwalters
    Member

    OK and openSUSE is the same - grub is already in /usr, and they have a /sbin/update-bootloader program (in Perl 😢 ) - looks like the source is https://github.com/openSUSE/perl-bootloader

  10. frap129 commented on Feb 17, 2025

    @frap129

    Hello! I've been working on getting bootc working with archlinux, and found this issue linked from containers/bootc#865. I'd like to help contribute to getting bootupd working on archlinux as well, to simplify installing a bootc based system.

    The main issue with bringing bootupd support to archlinux is how the package version and build time are requested. Correct me if I'm wrong, but as far as I can tell, bootupd looks for files in /usr/lib/bootupd/updates/<arch>, replaces the prefix with /boot/efi/EFI/, and queries rpm for info about the package that owns them. This is problematic in two ways for archlinux:

    1. The grub and shim packages do not install files to the efi parition. For grub, it is up to the user to use grub-install to install grub, and copy shimx64.efi to the right location to install shim.
    2. archlinux does not have a standard esp mount point. If installing the kernel and initram to the efi partition, it would be /boot, making the efi directory /boot and not /boot/efi. For installations using separate esp and boot partitions, the arch wiki suggests /efi.

    I'm fine with requiring that the efi mount point for bootupd compatible be /boot/efi, and I can work on a modified grub package that installs grubx64.efi to /boot/efi/EFI/arch. I'm by no means a "rust developer", I know enough of the language that I could modify bootupd to call pacman instead of rpm, but would need some guidance on handling the abstraction to account for both package managers.

    A few questions I would like answered before I work on this:

    1. Is there an intent to change how bootupd queries package versions? I see that debian installs grub to /usr/lib/grub/x86_64-efi/monolithic/grubx64.efi, which also would not be covered by bootupd currently.
    2. Does bootupd require shim? In the bootupd code, I found that shimx64.efi seems to be used to determine the efi vendor, but that call path doesn't seem to throw any fatal errors if its None. I personally do not use it on archlinux, as I use sbctl to sign my kernel and bootloader locally.
    3. Is there interest in supporting archlinux? Compared to RHEL/Fedora/Debian, archlinux leaves a lot of the decisions and responsibility for system management to the user. Making these assumptions and hacking in pacman support that depends on a specific setup may not make sense for bootupd as a project.

    I should also note that I am in no way affiliated with the archlinux project, I'm just interested in bootc for personal use.

  11. yjftsjthsd-g commented on Mar 27, 2025

    @yjftsjthsd-g

    Curiously, as of my attempt to build an Arch+bootc VM today (full writeup: https://brianecole.com/blog/2025-03-27_bootc-movingarch.html ), we've switched from an "rpm" dependency to

    [-] Manifest generation step
    Message: Generating manifest manifest-qcow2.json
    2025/03/27 22:53:27 error: cannot build manifest: initializing dnf in 349dc08b74e9b50c9a5af43d1c28a49bafffeb1a622977babf01026e4ba57318 container failed: exit status 127
    output:
    Error: crun: executable file `dnf` not found in $PATH: No such file or directory: OCI runtime attempted to invoke a command that was not found
    

    Perhaps it's because I'm not a developer, but I can't tell from reading along - why does it care about the package manager at all? What version information does it need that isn't in /etc/os-release?

    EDIT: It has since been pointed out to me that https://github.com/osbuild/bootc-image-builder is a separate project, so this may actually not be relevant to this thread.

  12. bigpod98 commented on Mar 28, 2025

    @bigpod98

    I have no idea how bootc image builser works but it might be trying to either install something or find version of a package like grub

    Which is what i saw with bootupd when this was posted(me and poster were working at same time sharing notes) bootupd triea to find version of grub whuch is something that wouldnt be in /etc/os-release

  13. cgwalters commented on Apr 8, 2025

    @cgwalters
    Member

    Is there an intent to change how bootupd queries package versions? I see that debian installs grub to /usr/lib/grub/x86_64-efi/monolithic/grubx64.efi, which also would not be covered by bootupd currently.

    Yes. Part of bootupd is really working around the fact that Fedora (only?) installs grub to /boot and doesn't have a direct install script. There's work to rectify that finally.

    Does bootupd require shim?

    It doesn't need to conceptually, no.

    Is there interest in supporting archlinux?

    Yes definitely.

    could modify bootupd to call pacman instead of rpm, but would need some guidance on handling the abstraction to account for both package managers.

    I think my strawman here is we should move the rpm-querying thing out into a helper binary and not be in Rust. Something similar was done in e.g. bootc-dev/bootc#1105 (comment)

  14. travier commented on Apr 8, 2025

    @travier
    Member
  15. 4 remaining items

  16. cgwalters commented on Aug 19, 2026

    @cgwalters
    Member

    UPDATE: I made a better solution using grub-install --version: #1130

    Yes, I think querying --version is an OK fallback, but I also think in the general case where e.g. an distro/OS adds downstream patches it may not actually bump that version - so we need to handle that.

    There is work in progress to move the binaries out of /boot into versioned folders in /usr. With that change, we would no longer need to rely on RPM to query the version in the image, it would be directly part of the path.

    But to me this approach is the best.

  17. krolmiki2011 commented on Aug 19, 2026

    @krolmiki2011
    Contributor

    You know what, @cgwalters, I think I actually prefer the approach where, instead of using RPM, we use a script—provided by the base image or the distribution developer—that returns the package data. 🤔

  18. cgwalters commented on Aug 19, 2026

    @cgwalters
    Member

    Yes, I think that approach will be very simple to implement. Something like /usr/lib/bootupd/packagesystem query-file-owner is probably all we need. We can carry reference implementations upstream for rpm/dpkg/etc., but ultimately probably best included in downstream packaging.

  19. krolmiki2011 commented on Aug 20, 2026

    @krolmiki2011
    Contributor

    My Concept for package version script to replace rpm

    • The script will be in /usr/lib/bootupd/query_files
    • Script will be for BIOS and ostree-boot only
    • Script will be having a sysroot argument and binary files
    • On the upstream will be a script template for maintainers
    • Script will be returning EVR and timestamp (or installtime) (unless it gets removed, because in my opinion, it's unnecessary) and output will look like this:
      {package-name} {EVR}

    But for me the issue is package-name, beacuse if we gonna update between distros, we gonna having a problem like this:
    grub2-tools(fedora) -> grub (arch)

  20. Rolv-Apneseth commented on Aug 20, 2026

    @Rolv-Apneseth
    Member

    There is work in progress to move the binaries out of /boot into versioned folders in /usr. With that change, we would no longer need to rely on RPM to query the version in the image, it would be directly part of the path.

    But to me this approach is the best.

    @cgwalters Fedora is the only to implement this though, right? At least for now. So we are trying that first, but we need reasonable fallbacks.


    @krolmiki2011 in reply to the concept:

    The script will be in /usr/lib/bootupd/query_files

    I'd go with the suggestion from @cgwalters and use /usr/lib/bootupd/packagesystem query-file-owner in case we ever need any other information from the package manager. Though, do we think we realistically would for bootupd? Maybe just /usr/lib/bootupd/query-file-owner is fine.

    Script will be for BIOS and ostree-boot only

    Yep, just the fallbacks.

    Script will be having a sysroot argument and binary files

    Do we need a sysroot? Can it not just be the paths to the files?

    On the upstream will be a script template for maintainers

    Yeah, we can maintain some reference implementations in bootupd.

    • Script will be returning EVR and timestamp (or installtime) (unless it gets removed, because in my opinion, it's unnecessary) and output will look like this:
      {package-name} {EVR}

    I think we can drop the build time requirement just use SystemTime::now() for the fallbacks too. From the output in #1130 (comment), those are currently inconsistent with each other.

    But for me the issue is package-name, beacuse if we gonna update between distros, we gonna having a problem like this:
    grub2-tools(fedora) -> grub (arch)

    IIUC that's #810, right?

  21. krolmiki2011 commented on Aug 20, 2026

    @krolmiki2011
    Contributor

    There is work in progress to move the binaries out of /boot into versioned folders in /usr. With that change, we would no longer need to rely on RPM to query the version in the image, it would be directly part of the path.

    But to me this approach is the best.

    @cgwalters Fedora is the only to implement this though, right? At least for now. So we are trying that first, but we need reasonable fallbacks.

    @krolmiki2011 in reply to the concept:

    The script will be in /usr/lib/bootupd/query_files

    I'd go with the suggestion from @cgwalters and use /usr/lib/bootupd/packagesystem query-file-owner in case we ever need any other information from the package manager. Though, do we think we realistically would for bootupd? Maybe just /usr/lib/bootupd/query-file-owner is fine.

    Script will be for BIOS and ostree-boot only

    Yep, just the fallbacks.

    Script will be having a sysroot argument and binary files

    Do we need a sysroot? Can it not just be the paths to the files?

    On the upstream will be a script template for maintainers

    Yeah, we can maintain some reference implementations in bootupd.

    • Script will be returning EVR and timestamp (or installtime) (unless it gets removed, because in my opinion, it's unnecessary) and output will look like this:
      {package-name} {EVR}

    I think we can drop the build time requirement just use SystemTime::now() for the fallbacks too. From the output in #1130 (comment), those are currently inconsistent with each other.

    But for me the issue is package-name, beacuse if we gonna update between distros, we gonna having a problem like this:
    grub2-tools(fedora) -> grub (arch)

    IIUC that's #810, right?

    @Rolv-Apneseth I guess we can go with /usr/lib/bootupd/packagesystem query-file-owner, and for sysroot im not sure because i look into rpm_cmd(), and i see it use sysroot to specify a database, what do you think about it?

  22. Rolv-Apneseth commented on Aug 20, 2026

    @Rolv-Apneseth
    Member

    @Rolv-Apneseth I guess we can go with /usr/lib/bootupd/packagesystem query-file-owner, and for sysroot im not sure because i look into rpm_cmd(), and i see it use sysroot to specify a database, what do you think about it?

    I don't think we need that in the script since it comes from:

    let sysroot = opts.sysroot.as_deref().unwrap_or("/");
    if sysroot != "/" {
        anyhow::bail!("Using a non-default sysroot is not supported: {}", sysroot);
    }
    bootupd::generate_update_metadata(sysroot).context("generating metadata failed")?;
  23. krolmiki2011 commented on Aug 20, 2026

    @krolmiki2011
    Contributor

    @Rolv-Apneseth I guess we can go with /usr/lib/bootupd/packagesystem query-file-owner, and for sysroot im not sure because i look into rpm_cmd(), and i see it use sysroot to specify a database, what do you think about it?

    I don't think we need that in the script since it comes from:

    let sysroot = opts.sysroot.as_deref().unwrap_or("/");
    if sysroot != "/" {
    anyhow::bail!("Using a non-default sysroot is not supported: {}", sysroot);
    }
    bootupd::generate_update_metadata(sysroot).context("generating metadata failed")?;

    Oh, in that case, thats fine 👍

  24. krolmiki2011 commented on Aug 20, 2026

    @krolmiki2011
    Contributor

    Here updated concept, with @Rolv-Apneseth sugestions

    • The script will be in /usr/lib/bootupd/packagesystem query-file-owner
    • Script will be for BIOS and ostree-boot only
    • Script will be having binary files argument
    • On the upstream will be a script template for maintainers
    • Script will be returning NEVRA and timestamp (with is SystemTime::now()) and output will look like this:
      , to not making big changes into packagesystem.rs
  25. krolmiki2011 commented on Aug 21, 2026

    @krolmiki2011
    Contributor

    @cgwalters I think i made a little script in my PR, but i not implemended in te bootupd code yet

  26. krolmiki2011 commented on Aug 21, 2026

    @krolmiki2011
    Contributor

    This script is looking like this:

    #!/usr/bin/bash
    set -euo pipefail
    
    # Script to detect package ownership of a file in a Linux system.
    
    # Usage: ./query-file-owner <file_path> <file_path> ... <file_path>
    
    if [ "$#" -eq 0 ]; then
        echo "Usage: $0 <file_path> <file_path> ... <file_path>"
        exit 1
    fi
    
    # Check if the files exists
    for FILE in "$@"; do
        if [ ! -e "$FILE" ]; then
            echo "Error: File '$FILE' does not exist."
            exit 1
        fi
    
        # Use your package manager to find the package that owns the file, we use rpm for example
        # Package Manager should return something like this: NAME-VERSION-RELEASE.ARCH
        PACKAGE=$(rpm -qf "$FILE")
        echo $PACKAGE
    done
    
  27. krolmiki2011 commented on Aug 22, 2026

    @krolmiki2011
    Contributor

    UPDATE: I added to rust code and it works perfecly!

  28. krolmiki2011 commented on Nov 20, 2026

    @krolmiki2011
    Contributor

    I Think we can close this btw

  29. Rolv-Apneseth commented on Nov 20, 2026

    @Rolv-Apneseth
    Member

    Indeed! Thanks again @krolmiki2011. Release is tracked in #1184

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementtriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions