-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With what Linux distro can you actually build this in 2021? #541
Comments
Official builds are currently built on an arm64 machine running Ubuntu 20.04.2 LTS. You should be able to build on a pi running Raspberry Pi OS too, but I haven't tried that in a while. qemu is in a bit of a broken state right now, which makes building things on non-arm hosts tricky. Once this issue is fixed and makes it into stable releases, I can take a look at improving amd64 support: https://gitlab.com/qemu-project/qemu/-/issues/385 If you build your own i386 qemu binary from the commit just before the one referenced in the issue above, you should be able to get it to work with newer versions of Ubuntu. There are some instructions included in the comments. I've seen reports that the amd64 issue (that makes readdir quietly return nothing on 32-bit guests, IIRC) may have been resolved upstream, so maybe there's a right combination of software to make builds work without relying on i386 qemu builds. However, last time I tried it, I didn't get far and didn't have time to investigate how the fix was meant to work or why it hasn't. |
I also just installed Debian 11 - there was a 32bit one.
But if I apt install parted debootstrap zerofree dosfstools libcap2-bin kpartx , it says for every single thing that the newest version is already installed, ... I tried to build it on 64bit Ubuntu 21 before, got a bunch of errors, and when I found the issue about 64bit systems linked above, I did not look further into it. I realize one can do this on a Raspi itself, but that seems rather impractical. Alone because of storage. If I had a big and fast USB3 external drive laying around, ok... but I don't... Might get one if all else fails, but it obviously is much preferable to build this on a VM. |
Alright, thanks for giving Debian 11 a go. It'll have to work there at some point, so I'll check what's going on. |
Since I wrecked the desktop by apt remove dosfstools libcap2-bin with a lot of dependencies that were also removed, I rebooted, this time without desktop. For the heck of it, I ran build.sh, and now it is running still... weird. No idea whether just a reboot would have sufficed, or any of my manual copying from sbin to bin did any of it. |
I currently have builds running on debian 11 xfce arm64 and i386 in virtualbox. Not seeing the issues you've mentioned so far. Not seeing any of the issues you've mentioned so far. I suspect both builds will result in broken images due to qemu, but I'll provide a workaround once I've confirmed it works. |
On the i686 host, I just hit #454 |
With Debian 10.10 i386, it's running much further now. Although I do see the occasional "no such file or directory", but it does continue... |
Now it ended with:
Not sure those complaints were fatal or not. Never built this before. |
Yes, very much fatal. The qcow images aren't what you're after. Successful builds end up in deploy/ Have you made any local changes like removing dphys-swapfile from stage2/01-sys-tweaks/00-packages? |
Oh, it looks like it! My aim was to make an image that contains only stuff my device needs. While I attempted to make sense of the short descriptions of the standard packages in some list I found, I might have erred there. Hopefully not much more. Edit: Fixed that, now I also got thte "Directory not empty" / issue #454 |
Building on the Raspi4 now... Seems the "... not empty" error is "fixed" by deleting the work folder, which means, after every change, all is done all over. Ok, but that at least works.
As for the locale thing, before that line, I get some dozen times "perl: warning: Setting locale failed", I wonder why it tries so often. I can't remember changing anything about locale in the config file etc, weird. Edit: Ok, I didn't get that this somehow uses things of the image to do stuff with it during assembling the image. |
It now put something into deploy. The lite image is 1.6 GB. Can I, realistically, get that significanly smaller, like half or so? (I really need a rather bare bones image, basically a Linux that can run C++ apps I put on it, with USB gadget / network capability, but that's about it - no installing of new packages on the running device, only selfmade binaries of GCC-compiled programs) What is weird is that it complains about stage4.qcow2 missing. It's not in the work folder either - but a stage5 folder is there. Would be cool if someone got this to work with e.g. Debian11, I must say this takes quite a while on the RasPi4 with some lame SDcard in it ;) |
Edit: That's interesting. |
My findings so far are that everything works if you use the right version of QEMU. The version of QEMU in every current distro is broken. I build an i686 qemu-arm-static binary from
The change is not persistent and will be lost after reboot. I also needed to set |
For what it's worth I've successfully built several images on 64-bit Ubuntu 20 ("Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-54-generic x86_64)") |
Yes, that's the issue that occurs when you use 64-bit qemu. Desktop images would also be missing icons when booted. If you switched to Ubuntu's version of qemu-user-static:i386 you'd run into a different set of issues. For everything to work right now on a non-arm host, you'd have to build the binary yourself, as mentioned in the previous comment. I could bundle it in with pi-gen, but I don't think people should run mystery binaries from github repos. |
Btw., what part of the build uses qemu, and why was this path of doing things chosen? I assume something from a running system that's the same as the target is needed, which somehow cannot (with reasonable effort) be done otherwise? |
Having some trouble parsing what you mean there. qemu (in user, not system mode) is used to run arm binaries inside the chroot, which we have to be able to do to set everything up. Otherwise things would fall over right after the base packages are extracted. The next step is to configure all those packages, which will run maintainer scripts that tend to call other binaries on the system. Without qemu, there's no dpkg, apt or anything else. |
I just have not seen things done this way. Linux image generation I saw before seems to rely on cross compilation - although I don't know how the "set everything up" part works there. Where does the info come from what GCC version to incorporate in the image? I've only seen GCC mentioned in general in a packages file, but not a version. I wonder whether it's possible to use a newer version. |
The image isn't built like you'd see with yocto of buildroot. Things aren't built from source, nor does GCC come into it. debootstrap pulls in core .deb files (which already contain binaries), extracts them, runs their maintainer scripts and then you get a small rootfs to work with which contains all the tools necessary to build up the rest of the system. |
Ah, thanks. W.r.t. GCC, I mean the GCC that will be present in the resulting image - can this be made a newer version than 8? |
It depends on what's default and what's available in the distro being built. In our current releases based on Buster, that's GCC 8 and I'm not sure if a newer version is available. In the next release (bullseye), it will be GCC 10. |
Ah... right, as Debian11 is out... I haven't tracked this at all before, usual cycles of new Debian vs. new Raspberry OS, is there a rough estimate when the new one will be out? Then maybe I'll just wait for that one. |
I'm a bit cautious about giving estimates, since sometimes people take it as a promise and complain if it takes longer. |
To sum up the answer to the original question. None, unless you can work around the qemu issues (#541 (comment)), If you have the workaround in place, Ubuntu 20.04 LTS, Debian Buster and Bullseye have been tested to work. |
I, for one, would be interested in the set of sub-instructions to use to set this up, and generate my own copy of qemu, or download it from a github repo, even if you decide not to include the qemu in the bundle. I have my own set of added in scripts, that work quite well, but using one of my Pi-4Bs to do the build takes them out of service for most of a day, and tossing up a VM using Debian Buster or Ubuntu would take a lot off of their plates. |
I found this issue, telling me I need a 32bit Linux.
The last 32bit Ubuntu LTS I found was 16.04.7, so that's what I put on a VirtualBox VM.
Did apt-get update, upgrade, and attempted install the list of dependencies mentioned in the readme.md here.
One of them refuses to install:
Does this mean that that particular Linux distro, as is, is broken w.r.t. that library, or the way the packages are set up rather?
Can that be fixed?
Or is there, by chance, some Linux VM image floating around somewhere that's known to allow one to build this project?
I read Debian is also supposed to work, I have no experience with Debian, though, and probably it won't be easier to get a 32bit version that still allows me to install dependency packages, for desktop PC i.e. x86, anyway.
What are you guys actually using?
The text was updated successfully, but these errors were encountered: