Install and use Homebrew on Fedora

Context

I have ascertained the workaround for that.

Apologies for mentioning it.


Evaluation

Consequently, @glb, I’ve got to evaluating brew inside toolbox. However, I’ve already hit something strange. Specifically, brew states:

Install Homebrew’s dependencies if you have sudo access:

…and provides sudo dnf5 group install development-tools as the example. However, upon installation, I see some worrisome errors (“failed: Operation not permitted”):

[115/115] Installing diffstat-0:1.66-2.fc41.x86_64                                                                                                                                                                                                                                 100% |  39.3 KiB/s |  78.0 KiB |  00m02s
>>> Running trigger-install scriptlet: systemd-0:256.12-1.fc41.x86_64                                                                                                                                                                                                                                                      
>>> Finished trigger-install scriptlet: systemd-0:256.12-1.fc41.x86_64                                                                                                                                                                                                                                                     
>>> Scriptlet output:                                                                                                                                                                                                                                                                                                      
>>> fchownat() of /run/systemd/sessions failed: Operation not permitted                                                                                                                                                                                                                                                    
>>> fchownat() of /run/systemd/users failed: Operation not permitted                                                                                                                                                                                                                                                       
>>> fchownat() of /var/lib/systemd/coredump failed: Operation not permitted                                                                                                                                                                                                                                                
>>> fchownat() of /tmp failed: Operation not permitted                                                                                                                                                                                                                                                                     
>>> Setting access ACL "u::rwx,g::r-x,g:adm:r-x,g:wheel:r-x,g:4294967295:r-x,g:4294967295:r-x,m::r-x,o::r-x" on /var/log/journal failed: Invalid argument                                                                                                                                                                  
>>> Failed to reopen '/var/log/journal': Operation not permitted                                                                                                                                                                                                                                                           
>>> fchownat() of /var/log/journal failed: Operation not permitted                                                                                                                                                                                                                                                         
>>> Setting access ACL "u::rwx,g::r-x,g:adm:r-x,g:wheel:r-x,g:4294967295:r-x,g:4294967295:r-x,m::r-x,o::r-x" on /var/log/journal/b4f0bef5ffd640fba0ab31fdaa2820b8 failed: Invalid argument                                                                                                                                 
>>> Failed to reopen '/var/log/journal/b4f0bef5ffd640fba0ab31fdaa2820b8': Operation not permitted                                                                                                                                                                                                                          
>>> fchownat() of /var/log/journal/b4f0bef5ffd640fba0ab31fdaa2820b8 failed: Operation not permitted                                                                                                                                                                                                                        
>>> fchownat() of /dev/snd/seq failed: Operation not permitted                                                                                                                                                                                                                                                             
>>> fchownat() of /dev/snd/timer failed: Operation not permitted                                                                                                                                                                                                                                                           
>>> fchownat() of /dev/loop-control failed: Operation not permitted                                                                                                                                                                                                                                                        
>>> fchownat() of /dev/kvm failed: Operation not permitted                                                                                                                                                                                                                                                                 
>>> fchownat() of /dev/vhost-net failed: Operation not permitted                                                                                                                                                                                                                                                           
>>> fchownat() of /dev/vhost-vsock failed: Operation not permitted                                                                                                                                                                                                                                                         
>>> Setting access ACL "u::rw-,g::r-x,g:adm:r--,g:wheel:r--,g:4294967295:r--,g:4294967295:r--,m::r--,o::---" on /var/log/journal/b4f0bef5ffd640fba0ab31fdaa2820b8/system.journal failed: Invalid argument                                                                                                                  
>>> fchownat() of /var/log/journal/b4f0bef5ffd640fba0ab31fdaa2820b8/system.journal failed: Operation not permitted                                                                                                                                                                                                         
>>>                                                                                                                                                                                                                                                                                                                        
>>> Running trigger-install scriptlet: systemd-0:256.12-1.fc41.x86_64                                                                                                                                                                                                                                                      
>>> Finished trigger-install scriptlet: systemd-0:256.12-1.fc41.x86_64                                                                                                                                                                                                                                                     
>>> Scriptlet output:                                                                                                                                                                                                                                                                                                      
>>> Reload daemon failed: Access denied                                                                                                                                                                                                                                                                                    
>>>                                                                                                                                                                                                                                                                                                                        
Complete!

Otherwise, brew appears to operate as well inside toolbox as it does outside of it:

  1. ⬢ [RokeJulianLockhart@toolbx ~]$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    ==> Checking for `sudo` access (which may request your password)...
    ==> This script will install:
    /home/linuxbrew/.linuxbrew/bin/brew
    /home/linuxbrew/.linuxbrew/share/doc/homebrew
    /home/linuxbrew/.linuxbrew/share/man/man1/brew.1
    /home/linuxbrew/.linuxbrew/share/zsh/site-functions/_brew
    /home/linuxbrew/.linuxbrew/etc/bash_completion.d/brew
    /home/linuxbrew/.linuxbrew/Homebrew
    ==> The following new directories will be created:
    /home/linuxbrew/.linuxbrew/bin
    /home/linuxbrew/.linuxbrew/etc
    /home/linuxbrew/.linuxbrew/include
    /home/linuxbrew/.linuxbrew/lib
    /home/linuxbrew/.linuxbrew/sbin
    /home/linuxbrew/.linuxbrew/share
    /home/linuxbrew/.linuxbrew/var
    /home/linuxbrew/.linuxbrew/opt
    /home/linuxbrew/.linuxbrew/share/zsh
    /home/linuxbrew/.linuxbrew/share/zsh/site-functions
    /home/linuxbrew/.linuxbrew/var/homebrew
    /home/linuxbrew/.linuxbrew/var/homebrew/linked
    /home/linuxbrew/.linuxbrew/Cellar
    /home/linuxbrew/.linuxbrew/Caskroom
    /home/linuxbrew/.linuxbrew/Frameworks
    
    Press RETURN/ENTER to continue or any other key to abort:
    ==> /usr/bin/sudo /usr/bin/install -d -o RokeJulianLockhart -g RokeJulianLockhart -m 0755 /home/linuxbrew/.linuxbrew
    ==> /usr/bin/sudo /bin/mkdir -p /home/linuxbrew/.linuxbrew/bin /home/linuxbrew/.linuxbrew/etc /home/linuxbrew/.linuxbrew/include /home/linuxbrew/.linuxbrew/lib /home/linuxbrew/.linuxbrew/sbin /home/linuxbrew/.linuxbrew/share /home/linuxbrew/.linuxbrew/var /home/linuxbrew/.linuxbrew/opt /home/linuxbrew/.linuxbrew/share/zsh /home/linuxbrew/.linuxbrew/share/zsh/site-functions /home/linuxbrew/.linuxbrew/var/homebrew /home/linuxbrew/.linuxbrew/var/homebrew/linked /home/linuxbrew/.linuxbrew/Cellar /home/linuxbrew/.linuxbrew/Caskroom /home/linuxbrew/.linuxbrew/Frameworks
    ==> /usr/bin/sudo /bin/chmod ug=rwx /home/linuxbrew/.linuxbrew/bin /home/linuxbrew/.linuxbrew/etc /home/linuxbrew/.linuxbrew/include /home/linuxbrew/.linuxbrew/lib /home/linuxbrew/.linuxbrew/sbin /home/linuxbrew/.linuxbrew/share /home/linuxbrew/.linuxbrew/var /home/linuxbrew/.linuxbrew/opt /home/linuxbrew/.linuxbrew/share/zsh /home/linuxbrew/.linuxbrew/share/zsh/site-functions /home/linuxbrew/.linuxbrew/var/homebrew /home/linuxbrew/.linuxbrew/var/homebrew/linked /home/linuxbrew/.linuxbrew/Cellar /home/linuxbrew/.linuxbrew/Caskroom /home/linuxbrew/.linuxbrew/Frameworks
    ==> /usr/bin/sudo /bin/chmod go-w /home/linuxbrew/.linuxbrew/share/zsh /home/linuxbrew/.linuxbrew/share/zsh/site-functions
    ==> /usr/bin/sudo /bin/chown RokeJulianLockhart /home/linuxbrew/.linuxbrew/bin /home/linuxbrew/.linuxbrew/etc /home/linuxbrew/.linuxbrew/include /home/linuxbrew/.linuxbrew/lib /home/linuxbrew/.linuxbrew/sbin /home/linuxbrew/.linuxbrew/share /home/linuxbrew/.linuxbrew/var /home/linuxbrew/.linuxbrew/opt /home/linuxbrew/.linuxbrew/share/zsh /home/linuxbrew/.linuxbrew/share/zsh/site-functions /home/linuxbrew/.linuxbrew/var/homebrew /home/linuxbrew/.linuxbrew/var/homebrew/linked /home/linuxbrew/.linuxbrew/Cellar /home/linuxbrew/.linuxbrew/Caskroom /home/linuxbrew/.linuxbrew/Frameworks
    ==> /usr/bin/sudo /bin/chgrp RokeJulianLockhart /home/linuxbrew/.linuxbrew/bin /home/linuxbrew/.linuxbrew/etc /home/linuxbrew/.linuxbrew/include /home/linuxbrew/.linuxbrew/lib /home/linuxbrew/.linuxbrew/sbin /home/linuxbrew/.linuxbrew/share /home/linuxbrew/.linuxbrew/var /home/linuxbrew/.linuxbrew/opt /home/linuxbrew/.linuxbrew/share/zsh /home/linuxbrew/.linuxbrew/share/zsh/site-functions /home/linuxbrew/.linuxbrew/var/homebrew /home/linuxbrew/.linuxbrew/var/homebrew/linked /home/linuxbrew/.linuxbrew/Cellar /home/linuxbrew/.linuxbrew/Caskroom /home/linuxbrew/.linuxbrew/Frameworks
    ==> /usr/bin/sudo /bin/mkdir -p /home/linuxbrew/.linuxbrew/Homebrew
    ==> /usr/bin/sudo /bin/chown -R RokeJulianLockhart:RokeJulianLockhart /home/linuxbrew/.linuxbrew/Homebrew
    ==> Downloading and installing Homebrew...
    remote: Enumerating objects: 296590, done.
    remote: Counting objects: 100% (225/225), done.
    remote: Compressing objects: 100% (174/174), done.
    remote: Total 296590 (delta 114), reused 95 (delta 51), pack-reused 296365 (from 4)
    remote: Enumerating objects: 55, done.
    remote: Counting objects: 100% (33/33), done.
    remote: Total 55 (delta 33), reused 33 (delta 33), pack-reused 22 (from 1)
    ==> Updating Homebrew...
    ==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:ece69c4b930308e50187f2df4f909026610a943cefa5e2b5942a327e3ad0d8f8
    ######################################################################################################################################################################################################################################################### 100.0%
    ==> Pouring portable-ruby-3.3.7.x86_64_linux.bottle.tar.gz
    Warning: /home/linuxbrew/.linuxbrew/bin is not in your PATH.
      Instructions on how to configure your shell for Homebrew
      can be found in the 'Next steps' section below.
    ==> Installation successful!
    
    ==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
    Read the analytics documentation (and how to opt-out) here:
      https://docs.brew.sh/Analytics
    No analytics data has been sent yet (nor will any be during this install run).
    
    ==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
      https://github.com/Homebrew/brew#donations
    
    ==> Next steps:
    - Run these commands in your terminal to add Homebrew to your PATH:
        echo >> /home/RokeJulianLockhart/.bashrc
        echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/RokeJulianLockhart/.bashrc
        eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
    - Install Homebrew's dependencies if you have sudo access:
        sudo dnf group install development-tools
      For more information, see:
        https://docs.brew.sh/Homebrew-on-Linux
    - We recommend that you install GCC:
        brew install gcc
    - Run brew help to get started
    - Further documentation:
        https://docs.brew.sh
    
  2. ⬢ [RokeJulianLockhart@toolbx ~]$ echo >> /home/RokeJulianLockhart/.bashrc
    ⬢ [RokeJulianLockhart@toolbx ~]$ echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/RokeJulianLockhart/.bashrc
    ⬢ [RokeJulianLockhart@toolbx ~]$ eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
    ⬢ [RokeJulianLockhart@toolbx ~]$ brew tap facebook/fb
    brew install idb-companion
    ==> Tapping facebook/fb
    Cloning into '/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/facebook/homebrew-fb'...
    remote: Enumerating objects: 424, done.
    remote: Counting objects: 100% (66/66), done.
    remote: Compressing objects: 100% (39/39), done.
    remote: Total 424 (delta 37), reused 54 (delta 26), pack-reused 358 (from 1)
    Receiving objects: 100% (424/424), 5.46 MiB | 3.45 MiB/s, done.
    Resolving deltas: 100% (233/233), done.
    Tapped 6 formulae (22 files, 5.5MB).
    ==> Downloading https://formulae.brew.sh/api/formula.jws.json
    ==> Fetching facebook/fb/idb-companion
    ==> Downloading https://github.com/facebook/idb/releases/download/v1.1.8/idb-companion.universal.tar.gz
    ==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/41870517/575ed35e-48e0-4562-bd32-e553840df67e?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20250321%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250321T153552Z&X-Amz-Expires=300&X-Amz-Sig
    ######################################################################################################################################################################################################################################################### 100.0%
    ==> Installing idb-companion from facebook/fb
    ==> Downloading https://formulae.brew.sh/api/cask.jws.json
    🍺  /home/linuxbrew/.linuxbrew/Cellar/idb-companion/1.1.8: 216 files, 77.3MB, built in 2 seconds
    ==> Running `brew cleanup idb-companion`...
    Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
    Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
    

Blocker

I am solely able to evaluate so much, due to my choice of project being nigh unmaintained:

However, hopefully that provides some insight.

Environment

  1. Installed packages
    Name            : toolbox
    Epoch           : 0
    Version         : 0.1.1
    Release         : 1.fc41
    Architecture    : x86_64
    Installed size  : 11.1 MiB
    Source          : toolbox-0.1.1-1.fc41.src.rpm
    From repository : @stored_transaction
    Vendor          : Fedora Project
    
  2. IMAGE ID      IMAGE NAME                                    CREATED
    90f8866c5ce6  registry.fedoraproject.org/fedora-toolbox:41  33 hours ago
    
    CONTAINER ID  CONTAINER NAME     CREATED       STATUS   IMAGE NAME
    4ff57e111d4c  fedora-toolbox-41  16 hours ago  running  registry.fedoraproject.org/fedora-toolbox:41
    
1 Like

@glb, that’s not particularly intuitive. Reckon that the lads developing toolbox would agree? I don’t mind mentioning it to them, if it’s not been said 100 times before.

A quick test appears to indicate that I was wrong about Toolbox being able to run software installed on the host system. My mistake.

Edit: Let me delete that statement so people don’t find it and get confused.

1 Like

FWIW, here is the documentation I could find about Toolbox being able to run software on the host system:

Excerpted from docs.fedoraproject.org – Toolbox – How it works:

In most cases, when a command is run inside a container, the program from inside the container is used. However, there are a few special cases where the program on the host is used instead (using flatpak-spawn). One example of this is the toolbox command itself; this makes it possible to use toolbx from inside toolbx containers.

1 Like

@glb, even if it failing is expected, it shouldn’t partially install - dnf should refuse to function, in that case. Have I misunderstood?

Regardless, I’ve tentatively filed the undermentioned:

Hopefully, it’s actionable. Irrespective, should we conclude that toolbox isn’t ready for Homebrew, or is this fairly unimportant?

Well, dnf does a pre-install transaction check and if it finds problems at that stage (e.g. missing dependancies), it will cancel the entire operation. However, if a package reports an error in its post-run scripts (after the files have been copied into place), that is just reported at the end and it is up to the user to decide how severe the error/warning is and either manually fix the problem or uninstall the software. I don’t think there is any problem with dnf. It is doing the best it can.

From what I can make of the error message, it is just the diffstat command that is failing to install in Toolbox because Toolbox’s isolation is too restrictive for whatever diffstat needs to do. There might be workarounds such as using flatpak-spawn to run diffstat on the host system when it is needed or granting Toolbox access to the system files that diffstat needs.

As to how critical diffstat is to Homebrew, I cannot say. It is quite possible that Homebrew does not need diffstat at all (in which case you could ignore the error message entirely and everything should be fine).

1 Like