Building LFS in a VM
Recently, while on an airplane without wifi, I decided the only thing worth doing to pass the time was to disassociate and see what ideas floated into me. One such thing was that I should finally build out the Linux From Scratch project. Here is my personal screenshot of it being booted. This could of course be faked, but it is not.
This is not a new or particuarly novel idea; its been around for a very long time and a lot of people have built it. But this is a project I have tried 4 times in the past, and always getting foiled at the same spot; GRUB.
And foiled again I became, as I accidentally overwrote the wrong drive and rendered the entire build useless in a mad dash to the finish line after compiling the kernel a few days ago. Theres a lesson here, something something percent of crashes happen within x metres of ones house. I know I read this factoid and its real, I am sure of it. I will not be looking for the source however.
After a very angry lie down, restarting the process and straightening out grub, it turns out there has always been another problem Ive never actually seen before; the OOB setup (or the stock lfs config) is not actually built for a VM!
Yes I am building it inside a VM. I do not have spare hardware I can dedicate to this sort of toy project. And assuming that I didn’t get royally ass fucked by grub every other time I tried this, I would have seen years ago that it’s not meant for a vm.
Kernel panics are slightly fascinating as an issue; you are presented with an unscrollable mountain of text you cannot read or paroose and exceptionally UNhelpful messages providing literally zero fucking context clues.
Ironically searching the error gives less than nothing, it wasn’t until I started to think about what was different from the hundreds of successful builds on the LFS subreddit that it started to dawn on me. You know when you have stumbled upon a research topic that is worthwhile when the only sources to guide you are chinese blogs. This brings up something I mentioned to my hacking homie in the past many years ago, that learning some chinese is probably worthwhile, as good shit was being dropped constantly on ak.47.re and it just didnt feel like I was getting the whole picture running it through google translate. Something was missing, but this is not the point of this post.
And the solution was actually impressively simple, it made me stagger when it dawned on me how obtuse and “focussed” I was on solving the problem; not focussed at all but stubborn, a focused mind would have had the idea occur - simply enable every option containing “VMware” in it within the kernel.
And that did it. What follows is a very large script that I have attached, which will automate 90% of the build. I am vaguely aware of the automated LFS project, ALFS, but have not looked into it at all. The project is done, and packed into a little folder it will go until I decide to upgrade it to BLFS. The irony of my free flowing disassociation state is the ideas it gave me as fun projects have all turned into albatrosses that I feel compelled by external forces to complete as fast as humanely possible in order to get them off my todo list.
But this is getting a tad too macabre and instead I will end this small post with a note of all the mini projects I have finished in the 4 weeks since coming back from holidays
•a burp plug-in to replay all traffic piped through the proxy with alternative http verbs (inspired by this article where a FILTHY win was found)
•the realisation of some 5ish year old design docs me and my hacking homie built up for a little python game (there is no link as it is a private repo for us to chuckle about)
•a replacement for the crto open lab on my nuc
•a dirty but EFFECTIVE web crawler script
•set my rpi up as a c64 emulator (another idea that came to me in my dissociated state - I’ve always wanted to do this and just..never did)
•stable diffusion on my new 3060 (ironic that since getting it the number of images in these posts have decreased)
•testing tools I have been missing for ages and suffered without (you know shits bad when you cant find ten minutes to test a new msbuild calc popping dll because theres too many fucking fires to put out)
I will end this with a stub of a thought I thought about expanding upon, but simply decided to not.