-
Notifications
You must be signed in to change notification settings - Fork 58
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
Live mode boot slow, needs 4GB+ RAM #4
Comments
Been experimenting in the Line 33 in dea799d
fails. Any help appreciated. |
Check what NomadBSD does, as it uses unionfs and hence boots the Live system quickly. |
My experiements in the pure-zfs-test branch resulted in a kernel panic so far: |
This seems like an issue that, if possible, really ought to be referenced in a little "echo" message in the bootloader, before the system attempts to load further. It's a source of confusion for a lot of people, and I'm sure there are people who have tested helloSystem, seen this, thought it was fundamentally broken and given up on it (myself included, had I not checked the GitHub issues!) |
Pinned the issue @Tunas1337 |
Thanks to the help of @pkgdemon we have an experimental Live build that should address this issue: https://github.com/helloSystem/ISO/releases/tag/continuous-12.2-unionfs Note that this build contains fluxbox rather than helloSystem to make the ISO smaller (and because the 12.2-unionfs branch has diverged a lot from the current experimental branch of helloSystem), but it should be possible to port the changes over to the helloSystem builds in case everything turns out to work well. So let's test, especially
Username: liveuser, no password @pkgdemon noted on IRC:
|
I was privately contacted by a helloSystem user who wishes to remain unnamed, and has summarized the issues as follows:
The user presented two solutions to problem 2 and noted that 3 and 4 need to be addessed separately and noted:
For problem 4 the use of swap space was suggested, which unfortunately does not work on truly read-only media such as DVD. So the solutions suggested by the unnamed user appear to be (partial) alternatives to what @pkgdemon has implemented and what seems to address at least 3 and 4. Probably all solutions come with specific pros and cons which I currently do not fully understand yet. So some experimentation will be needed to see what works best for helloSystem. Thank you everyone sharing your ideas and code! 👍 |
Porting @pkgdemon's commits to the
If we can get everything else to behave properly, those trade-offs are probably worth it. Further results with the
|
On Intel GPU machines I cannot boot helloSystem ISOs from the However, the non-helloSystem build from the Possibly we are running into a conflict with @pkgdemon wrote in https://github.com/furybsd/furybsd-livecd/commit/29fb0a18db7e1d44613954b2b9561c0eb1575aec:
Maybe we are missing something. Do you have any ideas @pkgdemon? |
This is what happens with https://github.com/helloSystem/ISO/releases/tag/experimental-unionfs-12.1 (commit 8544ac2) when booted with Boot stalls just above the section with the red arrows. On this machine (Acer Revo RL85) I get The very same ISO boots on a machine with Nvidia GPU (but not using the Nvidia driver). It may or may not be related to GPUs at all. More testing on different systems would be helpful. |
Just a thought, but we can probably get around the chroot/module issues by nullfs mounting /boot with all of the modules etc onto the chroot's /sysroot/boot, or wherever necessary. Obviously this needs doing before the chroot call. |
Worth a try @pkgdemon? |
Interesting. Normally devmatch starts after devd. Wonder what it is trying to chmod? Perhaps booting with verbose mode enabled as well would reveal more? Maybe try boot -v as well @probonopd. |
geom_rowr booted great, although because of an issue with my USB stick (I need to go down to the shop and get one that works properly) after about 10 minutes I got I/O errors. All. Of. The. Time. But that's most likely only a problem that affects me, so it's great. |
Please try with another USB stick. It's surprising how many go bad relatively quickly, even brand ones... |
Note to self: Directly after booting, one can use It looks like these things need to be writeable in order to boot into Xorg with graphics autodetection using initgfx (
|
Issues with
To be verified wether these things work correctly with the equivalent non- |
Tests show that Need to check out how we can use The book Absolute FreeBSD by Michael Lucas, describes it like this:
So Does this mean that we can just create the file Apparently no:
Looks like it is hardwired to use NFS whereas we do not want to use NFS because we are using a local rather than a network filesystem. |
FWIW I habitually use StressDisk to test disks before using them for anything of value. sysutils/stressdisk | https://lists.freebsd.org/pipermail/freebsd-questions/2021-August/294600.html HDAT2 excels, but it's not available for FreeBSD. |
Looks like @mszoek has got unionfs based Live ISOs to work properly for Airyx. It boots way faster and needs less RAM than helloSystem does at the moment. Are there downsides, such as no more automatic kernel module loading? (Still to be checked.) |
"Properly" remains to be seen :)
I believe so from what we've seen so far. It also ran out of disk (overlay FS) running from the LiveCD overnight. |
Are there any test builds of |
No. |
Presenting: The FreeBSD read-only Xorg challengeWe need to find a way to boot into a fully working Xorg desktop (including working initgfx) on a read-only system. This would greatly improve our Live ISO options, and would also be the foundation for a future image-based system where the operating system itself could stay inside a read-only image file. My earlier experiments at achieving this resulted in a lot of failures and frustration, with countless half-working or not-working Live ISOs build. So there is another approach about trying this.
You will notice that the system can no longer boot into a working Xorg desktop. Now our task is to find a way of strategically creating unionfs, nullfs, tmpfs in the right places and/or copying/moving files around until we find a way to get into a graphical desktop again. The following leads to an instant reboot:
Why? A working solution__The following seems to work: Change the
(Of course this should eventually go into its own rc file but putting it into the existing one was the quickest way for me to ensure it runs at the correct place within the rc order.) With this in place, the mounts on my test system are looking like this (notice those nice
Now that we have a baseline to work from we should be able to experiment more, e.g., also with selectively using unionfs. |
Actually, now we have proof that it is possible tor run a graphical desktop from a fully read-only medium, we can rethink the whole Live ISO architecture. Currently we use:
Can we do without most of this and instead boot directly into a uzip? Should be doable according to its manpage:
Sounds exactly like what we need, doesn't it? |
Current line of thinking is to have an rc script very early in the boot process inside the compressed filesystem image that kicks off the "make writable the essential locations" process, so that no scripts/initial ramdisks outside of the compressed filesystem are needed to do trigger this. This allows us to just tell the kernel to boot from the compressed filesystem, and once that is booting, it will make parts of itself r/w "by itself". Like this
Also, the compressed filesystem image must not contain unsuitable entries in
By the way, a fast way to make changes on the compressed filesystem image is:
...and yes, I can boot into a graphical desktop like this. No ramdisks! No reroot! No chroot! In fact, no files on the bootable medium outside of Here is the running system:
For the last line, I cheated a bit by using a little bit of unionfs because Which brings me to the overall question: How much less stable will everything become if we replace the tmpfs usage with unionfs? Only one way to find out: Try it out. Which is now pretty easy given that we have a neat procedure for experimentation. |
For even faster development/debugging cycles it would be neat if we could made changes without having to re-spin the compresssed filesystem image all the time, right? Using this
we can now have our actual script outside of the compressed filesystem image in
This means we have a fully read-only filesystem image but we can make changes to practically everything without having to go through the timely read-only filesystem image generation process during the development cycle. I like it! The development cycle is now:
Very fast. TODO: Replace the hardcode |
(the one unionfs in the screenshot will go away; it's only being used to monkey-patch the system on-the-fly) With a lovingly crafted Benchmark:
*0.6.0 Fwiw, Fedora 35 live system takes 1:08 under the same conditions. |
Now the question is, how do we get the uzip partition onto a DVD-ROM image, in a way that the kernel finds it? Just appending the uzip to the end of the iSO9660 file won't allow the kernel to magically find it. We needs some sort of a partition table. man geom_uzip is not exactly verbose here:
Probably we should start with https://github.com/furybsd/furybsd-livecd/blob/master/scripts/mkisoimages-amd64.sh. and extend the But how exactly? Experiments: Edit: Even after a lot of experimentation I couldn't figure it out. The geniuses working on https://github.com/freebsd/freebsd-src/blob/main/tools/boot/install-boot.sh are probably the ones to ask about how to put together an ISO that also contains a valid ufs/uzip partition - that script is quite the wizardry! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Live system development methodologyHere I am descibing the development process I just went through recently; mainly as a reference for my future self but also for anyone interested in tinkering with FreeBSD Live systems in general. Eventually the information from this ticket should be cleaned up and rewritten as developer documentation. If you don't start from scratch (as I did) but want to make changes/improvements, you can skip step 1. Stage 1: Make installed system read-only and bootableThe timesaver trick to speed up the development-test cycle in this stage is is to start from a working system that can be toggled between being read-write and read-only
Example for stage 1: #4 (comment) Stage 2: Make compressed filesystem image bootable, without ISOThe timesaver trick to speed up the development-test cycle in this stage is to have an rc script on the compressed filesystem that runs as one of the very first rc scripts, and that executes code from outside of the compressed filesystem image.
No chroot/reroot is needed since we can get the kernel to use If you don't need booting from CD-ROM/DVD-ROM, then you can stop here. But we want a DVD-ROM. Hence we need to use ISO (or at least this is what I assume). Example for stage 2: #4 (comment) Stage 3: Using ISOThe timesaver trick to speed up the development-test cycle in this stage is to have an rc script on the compressed filesystem that runs as one of the very first rc scripts, and that executes code from outside of the compressed filesystem image (since it is still inside the ISO, we need to respin the ISO each time).
We cannot do without chroot/reroot since I was not able to create an ISO that also contains a partition that the kernel can see, can can use with We cannot do without chroot (using reroot) because apparently the kernel cannot boot into loop-mounted filesystem images without copying them into RAM entirely, something we want to avoid at all cost. https://wiki.freebsd.org/AndriyGapon/AvgLiveCD seems to support that notion. The ability for the kernel to reroot into loop-mounted filesystem images would make for a great feature (FreeBSD WISHLIST). So, unless we find a way to put a uzip partition on a (hybrid) ISO (which I still think might be feasible - I just couldn't find a way to do it), and unless any of my FreeBSD WISHLIST items are fulfilled, we will have to live with a chroot based Live ISO. What is the downside of a chroot based system? (But as soon as we drop the requirement of using ISO9660, then we can boot into the live system either from a partition by the virtues of using |
For stage 3, this script can be used to produce an ISO:
|
Or so I thought. Until it dawned upon me that the official FreeBSD Live ISO https://download.freebsd.org/ftp/releases/ISO-IMAGES/13.0/FreeBSD-13.0-RELEASE-amd64-bootonly.iso does not use a chroot neither reroot at all. It simply boots the files that are on the ISO9660 filesystem. Now, that won't quite work for as as we want that fancy uzip compression, but who says that we can't mount all the individual directories beneath And Voilà! No chroot needed, no reroot needed, and still getting to use uzip on an ISO. Downside: Can't create new files or directories in |
In the Remaining showstopperDoes not boot all the way into the desktop, due to overly aggressive boot time optimization. Xorg and/or slim get started before something that they apparently need. We need to find out what that is. Workaround
|
Currently we need at least 4 GB of RAM for the Live system when the booted sytem in theory only needs <1. This is because everything gets copied into RAM at boot time.
I would like to remove the need for so much RAM, e.g., by loop-mounting
system.uzip
, and merging it with a tmpfs using unionfs, and then chrooting into that.FuryBSD had a unionfs setup but it was more involved: https://github.com/furybsd/furybsd-livecd/tree/union-tar-nochroot
I'd like the simple version (loop-mount read-only filesystem, overlay it with tmpfs usion unionfs, chroot into that). If it doesn't work, then collaborate with unionfs kernel devs (who maintains unionfs? @mjguzik, @cemeyer?) to make it work.
The text was updated successfully, but these errors were encountered: