Distrobox: Use any Linux distribution inside your terminal
github.com
github.com
The Steam Deck default OS (Steam OS 3) is a heavily locked down variant of Arch with only a couple of writable directories. With Distrobox, I can run an Ubuntu environment from one of those directories, ensuring that when I install SDKs or tools, they're being installed to a writable area of the OS but require no config to change what they think is intended install location.
Do you often use the terminal (or something like VS Code Remote extension) to do builds on a beefier machine, or do you do all your development literally on the SteamDeck hardware using tools like Distrobox? And what kind of development do you do?
I ask because I need to get a new laptop, but only for the once or twice per month I go physically to the office, and was thinking a Steam Deck might make more sense than a traditional laptop that would be idle ~340 days of the year. (I can almost always get a monitor and external keyboard at the office, so it would be a rare day that I was actually stuck with the 1280×800 screen.)
What kind of development do you do? In theory, it's possible for a lot of roles. If you can get your environment working smoothly on a distro that Distrobox supports then you should be able to work on it.
I'd love to see someone rock up to the office with a Steam Deck, plug it in, and just start working. That's quite the image.
[1] The Steam Deck has a kind of A/B boot. By default it loads into Gaming mode and the other is Desktop mode. In Gaming mode, most apps and services aren't running (as far as I can tell but now I want to check) so I don't think you could ensure a server stays running in the background if you switched back to Gaming mode. On the other hand, you could live totally in Desktop mode and game from there, only losing the nice Gaming mode GUI.
But for that, any laptop sucks, so I've been using suitcase-sized desktops for .. well basically forever. But then in recent years it got so easy to develop on a laptop, but have everything running on a remote machine. I mean there's GitPod and GitHub Codespaces, and before that there were... uh, some web-based IDEs that didn't really work...
But then there came VS Code Remote so like as long as your laptop/[cyber|steam]deck can run VS Code and maybe some browsers, you're good to go!
So I mean OH FUCK IT WHY AM I STILL EVEN TALKING... WHOOOO!!! ORDERED
Loving the trend, though. Between Distrobox and Docker, containers seem to be the inescapable "Matryoshka dolls" of the tech world.
But all jokes aside, the flexibility this provides is impressive. If you told me a few years ago that I'd be able to run a full Ubuntu environment on a handheld gaming device, I would've raised an eyebrow
If you want a portable DevOps station, you want a cheap laptop. You don't want to use the default Steam Deck keyboard for much more than entering a login name or something. A Steam Deck with a keyboard plugged into it is much closer to a desktop setup than anything I'd call portable.
But portability is the only question. It's still a full computer. It just isn't a very convenient one for anything other than games.
I personally do use it a lot like a Nintendo Switch, though. You can easily have a desktop-like setup at home behind a dock, and then pop it out and carry it off portably. It's not quite as slick as a Switch but it works. But, again, this is a desktop setup with the Deck standing in as the computer, not a portable setup.
Steam Deck apps (mostly) have to come from a Flatpak repo to install correctly but Flathub (the default repo and therefore defacto app store on the Steam Deck) has lots of the common apps for daily use, even if they are largely unofficial/unsupported versions. So for 95% of people, it's definitely usable as a laptop/desktop replacement, but if you want to develop or want stuff outside the Flatpak repos, it's a bit of a hassle.
That said, I love this thing.
Here is a link to a photo of my setup at office: https://i.imgur.com/yT8CRfp.jpg
It has a Ryzen Z1 Extreme CPU (Zen 4), RDNA3 graphics, 512Gb storage, 16Gb RAM and 1080P 7" screen, so I think it should be good enough for web development, at least anything that doesn't need more than 16Gb RAM and a beefier CPU, but if you need that sometimes you can go cloud when you need it.
Generally only really desktop-ish stuff stays on the host machine (e.g. i3, but also polybar and dmenu), but the rest goes into these distroboxes.
https://github.com/pkulak/boxkit
And yeah, like you, I basically live in Arch despite running Fedora. My terminal opens directly into the Arch container, and I’m even installing more and more GUI apps in there, since they are so easy to export to my host launcher.
I run an Arch VM on Windows; I started out setting up Arch in the VM while experimenting with booting into Arch raw (it's installed on a dedicated, physical disk), but I became distracted and never perfected the raw boot setup, so I just use it as a VM, which I tolerate. The idea of Distrobox intrigues me but I'm not imaginative enough to see how it would help me, so I'm keen to hear your thoughts.
Edit: ah I got to the part of your repo where you mention the below, and I'm watching your video (https://youtu.be/7-FPAWjROos). Makes sense.
>Also, I've never gotten really to know Alpine, the problem with running distros like this bare metal on my PC is that there's a whole bunch of hardware quirks and all sorts of little enablement things that more generalized distros tend to get right.
Basically, I use Fedora as an "immutable" base system, then install all my userland apps in an Arch container. It's just a really clean way to run things. My base install never really changes much, and tracks upstream Fedora. Then, if I want to do unsupported things, like install Python packages from Pip and Pacman at the same time, I can, knowing that if I get a conflict, I can just blow it all away and start over without even logging out.
At first you do it manually like keeping an ubuntu LTS box around for when I need to do that kind of stuff. Then over time you get annoyed that you have to maintain it and while you've removed the host-maintenance from your life it does feel like you've just shifted the problem to the right and multiplied it every time you make a new box.
So the next logical step is to just make it declarative, so it's one of the reasons we made boxkit. Distrobox has an exciting new feature coming out called assemble: https://github.com/89luca89/distrobox/blob/main/docs/usage/d...
And since all this stuff is just docker containers you can just pick your distro, pick your list of packages, and then let git and the automation deal with it, you'll always have your dev environment. Assemble was the last missing piece, I'm looking forward to duct taping all of this together!
https://github.com/ublue-os/boxkit is the "kit" if anyone wants to help out, when you fork it it'll bring the github actions with it, so you can set up builds of your boxes and they'll always be up to date. It's based on alpine but that part can be swapped out no problem.
And for those of you who think this is just too far, `distrobox upgrade` can be useful when you have way too many pets.
I love the idea of Chimera Linux and would love to daily drive it. However, package availability is going to be a constant drag. Oh, and it uses Musl as well. Both these problems go away running Distrobox / Arch on top. I could keep the base system clean and simple while having a dev environment that is frictionless and full featured ).
"Simply put it's a fancy wrapper around podman or docker to create and start containers highly integrated with the hosts"
("docker is sort of like a vm but more like chroot, and it has a dockerfile that is sort of like a recipe, and a filesystem that is sort of like version control, but..." bleh)
There are a small number of programs, usually those that need root (such as 'cpupower') which also need to be run "outside".
https://www.linux-magazine.com/Online/News/Arch-Based-blendO...
I removed snap for this reason.
It's pretty much the same from the outside; the difference is how the containers are built and managed. Flatpak uses OSTree with custom build scripts, while distrobox uses Dockerfiles and more standard packaging.
With support for running GUI applications, this becomes a viable solution for running apps from other distros, running an app as root when you aren't, and being able to install apps into a system that is immutable.
It is also a lot really really fast to enter that session. (It uses podman or docker rather than lxc like with LXD)
The last time I tried it (a few years ago) you needed to either run `lxc` as root or be a member of the `lxd` group which is equivalent to having root privileges. At that time the ability to launch and enter container instances as an unprivileged user (without a root backdoor like the docker or lxd group) was one of Podman's advantages. Have things changed since then?
LXD supports (all of these have pros and cons, and you must choose one of the type that solves your problem):
1. Privileged containers.
2. Unprivileged containers as an unprivileged user.
3. Unprivileged containers as root.
One frustrating issue is that many developers and IT professionals are reluctant to use Podman due to certain unique situations and edge cases. Docker is more commonly used and tested, making it the preferred option despite Podman's beneficial features.
lxd supports this too, as well as configuration profiles and a default configuration profile. So the only difference is in default configuration and perhaps ease of configuration.
This isn't really true - almost any virtualization or container solution will do this, in the case of containers it's typically just a local volume mapping. Of course the default is typically an isolated execution, that's one of the key tenets of containers or virtualization, but it's usually minimum effort to expose whatever local directory you like. I guess its nice this tool cuts out a small step to make the process convenient, but its not a must install for me personally vs my existing container runtime.
Mapping my entire home directory to a volume is a pretty rare use case for me too - i'm far more likely to just map a project directory to a working dir in the container. I don't think I have ever mapped my whole home folder to a container volume in my career, and can't imagine doing so in future either. This is a bunch of nice shell-scripting to do what you could already do with docker/podman a little quicker.
This is absoulutely what it is. The project does not try to hide this fact nor am I.
[0] https://www.cyberciti.biz/faq/how-to-install-lxd-on-debian-1...
https://www.youtube.com/@LXD https://linuxcontainers.org/lxd/introduction/
- https://github.com/systemd/mkosi
- man:systemd-nspawn(1)
- man:machinectl(1)
It implements the same concepts introduced by https://github.com/containers/toolbox but in a simplified way using POSIX sh and aiming at broader compatibility.
All the props go to them as they had the great idea to implement this stuff.If I understand correctly, Distrobox makes it convenient to launch (and destroy) lightweight VMs on demand, while nix shell makes it convenient to drop into a shell with some package installed. The documentation around nix has unfortunately been unapproachable in my experience.
Of course, Flatpaks+Podman will be a learning curve, but I'm eager to try Silverblue+Distrobox on one of my computers.
Stability of Ubuntu with the power of pacman, definitely a great tool!
If Distrobox can give me a full desktop Ubuntu in a container in stead of a VM that would be very welcome.
Thanks for the post, I'm diving in!
You are probably not going to run a “full Ubuntu Desktop” though. Is that what you want?
You would run your normal desktop ( from the host distro ). In Distrobox, you would have Ubuntu installed including whatever GUI apps you need. When you run those GUI apps, they appear on your regular desktop.
Of course this would also work with a regular Distrobox container but that requires more terminal action than some colleagues are comfortable with. Plus it's hard to see sometimes when a GUI app is from a container and when it's on your host. It's almost too seamless.
So having a single "window" into a full ubuntu container would be my preferred option.
For non-admin task, I don't think there are much different between distro.
For admin task, this won't go too far...
> Why
> Provide a mutable environment on an immutable OS, like Endless OS, Fedora Silverblue, OpenSUSE MicroOS or SteamOS3
> Provide a locally privileged environment for sudoless setups (eg. company-provided laptops, security reasons, etc...)
> To mix and match a stable base system (eg. Debian Stable, Ubuntu LTS, RedHat) with a bleeding-edge environment for development or gaming (eg. Arch, OpenSUSE Tumbleweed or Fedora with latest Mesa)
> Leverage high abundance of curated distro images for docker/podman to manage multiple environments
I don't have links on-hand (mobile), but the discussions should be easy to find by searching "distrobox" in the issue page of the respective GitHub repos. I also can't speak to the validity of it since I haven't really had problems with either.
I need to compile the most recent version possible of rsync (or one with some specific zip support) for Debian 7 but I can't install the build tools in Debian 7 in docker :/. What I got so far:
$ docker run -it debian/eol:wheezy /bin/dash
# apt-get update
E: Method http has died unexpectedly!
E: Sub-process http received a segmentation fault. $ cat s ; docker run -it --volume ./s:/etc/apt/sources.list:ro debian/eol:wheezy /bin/dash
deb http://archive.debian.org/debian wheezy main
#deb http://archive.debian.org/debian wheezy main contrib
#deb http://archive.debian.org/debian-archive/debian-security/ wheezy updates/main
# apt-get update
E: Method http has died unexpectedly!
E: Sub-process http received a segmentation fault.You can even setup booting into a container desktop environment from your login screen.
https://github.com/89luca89/distrobox/blob/main/docs/posts/r...
The only true Unix way is to use Slackware stable as base and build your own software from source. Bonus points for writing that source yourself.
/s
Is it a matter of mastering the `make` prefixes and arguments, and/or `autoconf`, in order to exactly specify the dependencies to use?
For simple projects, 'make' will do.