Now root works with ARM64 Ubuntu in Podman

The trick is, don’t use Distrobox.

podman run –arch=arm64 -it –name ubuntu-arm /bin/bash that command works just fine.

Nice, might not need Lima anymore. You can only use Lima with Podman Desktop, if you use Podman with Lima, my container is using the default thing.

But, you’ll need to adjust that, if you want persistent files, and to easily get the files from the host. And don’t put “-it” in the wrong spot, or it won’t work. I think you want the -v option.

Now to see what happens if I run it with –user. Probably sudo won’t work. You need an image with your user in it. Or make a custom image, don’t ask me how. I had enough trouble remembering how to use Podman.

I compiled in Lima as root though, so doesn’t really matter.

And you have to make a Dockerfile or something. Too bad I’m lazy.

FROM arm64v8/ubuntu:latest 
RUN apt update
RUN apt dist-upgrade -y
RUN apt install -y nano wget build-essential bison flex libncurses-dev libssl-dev libelf-dev
RUN useradd -m --uid 1000 --user-group -s /bin/bash xxx
USER xxx
ENTRYPOINT ["/bin/bash"]

Good luck using sudo or su, you can add sudo to apt install, but it won’t work with QEMU. But running podman exec -u 0 -it ubuntu-arm /bin/bash works. Or add everything you need to install to the apt install, and rebuild the image.

Or use the VM feature, perhaps that works. Or just use Lima and Podman. Hmm, not sure sudo works with Lima Podman either though. Probably not.

And the volume mounted in it, I have no permission to access. Maybe you need “–group-add keep-groups”.

And using run directly doesn’t work, but works with Podman Desktop. It isn’t running QEMU.

And I think it’s right now, add “keep-id” to the namespace in Podman Desktop. Still don’t know why I can’t use that image, without Podman Desktop though. And it works now.

“/bin/bash: /bin/bash: cannot execute binary file” that’s what it says if you use podman run directly. That is with –arch, and I think without it the same thing. How do you get the command it used? Well, you can create a systemd file, and the command will be in it. I might just use Podman Desktop, it’s a nice GUI, and I don’t have to rememeber how to use Podman from the terminal to use it. Just have to remember how to use Podman Desktop.