Installing CLI apps on the host?

I know we’re not supposed to be using rpm-ostree install on the host, or only as a last resort.

But sometimes I want to work in the host on the command line and I don’t know the best way to get my favorite terminal apps installed, like say micro which is in the fedora repositories and mcfly which isn’t.

In my Fedora container, I used dnf to install micro. I also installed Homebrew, and then mcfly via homebrew.

I thought I would be clever and try “distrobox-export -a mcfly” but that fails with “/usr/bin/distrobox-export: line 240: CONTAINER_ID: unbound variable”. But anyway that’s a crutch – I do want to be able to install CLI apps in the host.

Any ideas?

For my part, I’ve been doing three things for CLI programs:

  1. Alias to distrobox enter <container> -- <command>. Ex: home-manager/default/alias.nix at 4bb5183fa3f5ddb4791759b74ad1e09fc2fda9a1 · bayazidbh/home-manager · GitHub

  2. Alias to flatpak run --command=<command> <flatpak.ref>. Ex: home-manager/default/alias.nix at 4bb5183fa3f5ddb4791759b74ad1e09fc2fda9a1 · bayazidbh/home-manager · GitHub

  3. Use it through Conty GitHub - Kron4ek/Conty: Easy to use unprivileged Linux container packed into a single portable executable. I built my own in GitHub - bayazidbh/Conty: Easy to use unprivileged Linux container packed into a single portable executable

  4. Use Nix, see How to install Nix on Fedora Silverblue though there is also a ujust option for it. I install what I want to use often via home-manager, the rest I just alias to nix shell -p <nixpkgs>.

That last one is probably what you want, as it just gives you the command. It’s wrapped in Nix, but otherwise it’s almost native.

3 Likes

ujust brew will set up brew on your host, then:

brew install micro mcfly
2 Likes

ujust brew worked brilliantly, thanks @j0rge. Seems more approachable than Nix.

A few quick questions on this just so I understand –

  1. brew and apps installed via brew appear not to be available when I change shell to fish. I must be missing something basic.

  2. apps installed via brew on the host are not available on any containers, right? (I understand you wouldn’t want apps in containers available on other containers, but was wondering about host->container).

  3. What about apps that need to run as root? If I install with brew, they go into my /home directory. But when I try “sudo app” it says not found. And if I try “sudo brew install app” it says brew is not found. So catch-22 there.

  4. If I install apps in the host that differ from the container, and all have access to ~/.bashrc, I often have errors on startup that this or that is not available. Seems like I should have unique ~/.bashrc for every container/host (in addition to having something in common)?

In a rush so sorry for being curt. I think we only have zsh and bash right now. If you could file an issue here someone can take a look: Issues · ublue-os/config · GitHub

Right, decoupled from the host so if you want a tool inside the container you have to ensure it’s installed in there.

If you sudo -i you can do this (for example to use micro to edit a file in /etc), but maybe we can make this easier, can you file this as an issue also?

You can use the -h flag with distrobox to create a separate home directory for a container, this ensures that your boxes and your host don’t collide with shared dot files.

You could also add the packages you want to a distrobox.ini so that your containers always have the stuff you want inside of them, then you can just match what’s on the host. I’m sure others will have tips too.

1 Like

Thanks for writing back!

I wrote an issue for the fish shell problem and one for the sudo problem.

Great idea about the distrobox.ini. And understood about creating separate home directories.

1 Like

For the fish problem:

Create a file either in ~/.config/fish/conf.d or /etc/fish/conf.d
Name it however you like, but it needs to end with .fish

Save this into the file:

test -d /home/linuxbrew/.linuxbrew; and status --is-interactive; and eval (/home/linuxbrew/.linuxbrew/bin/brew shellenv | source)

That’s what I use. Alternatively, have a look here.

2 Likes

That worked perfectly for the fish issue! Wow!

1 Like

What it be possible to copy whatever Bluefin-DX & Aurora-DX are doing?
I had the same problem as OP @chicagonyc regarding fish shell & brew on Bazzite.

On Aurora-DX it just worked out of the box.
I used ujust configure-shell to switch to fish shell and was able to access everything brew related.
image


Additionally I think it would be nice to add ujust configure-shell to Bazzite!

Also I am not sure if this was only recently fixed on Aurora-DX because I found this: fix: move fish and zsh brew code to shared code branch. by citrixscu · Pull Request #1207 · ublue-os/bluefin · GitHub [2 days old]

Kind regards,
android

I don’t think so. GUI apps should work ok. I remember having Vivaldi browser and an email app running from distroboxes. You just have to share them with distrobox-export plus parameters. You can also export the GUI app from BuddyBox.

The only GUI app I had problem running it from distrobox is Gparted. But I think is related to permissions.

  • Extremely good mouse support. This means mouse dragging to create a selection, double click to select by word, and triple click to select by line.

This makes it worth trying it!

Thanks for sharing.

1 Like

homebrew or even better, homebrew with it’s own user GitHub - dnkmmr69420/brew-user: A seperate user that manages homebrew