13 ms·
Linux from Scratch
- dark-star 5y agoI built a Cross-LFS setup for my SGI Indy, some 10+ years ago. It was an awesome experience that took about a whole week due to the Indy's 150 MHz CPU and only 128 megs of RAM. But it was totally worth it :)
- pdenton 5y ago> The LFS system will be built by using an already installed Linux distribution It would be totally cool if there wasn't a chicken-and-egg problem with LFS, imho. I've tried to cross-build it from OpenBSD but failed miserably. https://trac.clfs.org/wiki/download https://trac.clfs.org/wiki/download if anyone else wants to attempt this
- Doxin 5y agoI mean step 1 in LFS is building a cross compiler to build new build tools. Surely that should work even from a different operating system?
- GolDDranks 5y agoI tried to do it from MacOS once, but run into problems. Tried again with Docker, but run into problems again, but they weren't insurmountable, so I managed to do this thing: A docker image that makes building Linux From Scratch easy. It's fully commented, to promote understanding, which is the point of LFS. It, however, intends to automatize some of the groundwork needed, as I felt it wasn't strictly necessary for understanding. https://github.com/golddranks/lfs_docker https://github.com/golddranks/lfs_docker
- 1vuio0pswjnm7 5y agoI have wanted to do this for many years. I start with NetBSD and try to use Linux emulation, i.e., install glibc or musl libraries under /emul/linux, then try to compile a small Linux kernel. It is easy to compile NetBSD kernel on Linux but not vice versa. The significance of that if any is left as question for the reader.
- andreareina 5y agoDid this way back when, it really dispelled the mystery of what all a distribution is.
- tharkun__ 5y agoHaha, agree! So fun seeing this posted after so many years of doing this myself! Let's get this upvoted and into the hands of the next generation so to speak! So much you can learn and like you say "dispel" from doing this. Even if you're 'just' running a bunch of scripts with the right amount of curiosity paired with it it can teach so much! Like trying out a bunch of optimizations on the C compiler and actually getting programs to fail because of it and such. Fond memories! Personally I "moved on" to Gentoo at some point. And I remember "arguing" w/ my dad about compiling my own operating system from scratch. Of course I was that "teenager with lots of time on my hands" and he was working on production systems w/ uptime guarantees. Thanks for the fun memories in crazy times!
- mekster 5y agoI still believed compiling everything with proper arch and cflags would make the system run a bit better than using distributed binaries for hardware's from 20 years ago. Had fun doing distributed compiling with distcc.
- tharkun__ 5y agoAnother great memory, thank you! I do remember setting up distcc just for trying it out (and fun) and knowing how to do it. It was completely not really worth it for what I was doing, because the only other machine I had was the old Pentium 200 MMX (! ;)) I was using as my router. But it sure was fun to do and learn from. So many things "kids these days" probably won't experience as there's a cloud option for that that already does this for you and better. Then again, I suppose there are so many things we never got to play with (and instead played w/ the aforementioned). Like when I told my dad I was playing around with vmware and xen and such and he'd just be like "Oh yeah right, virtualization, like what we've been running on our IBM mainframe since like forever". But sure, have fun, explore, learn! If anything, Linux and all this free software has done a great job of taking this out of the hands of huge corporations and having to work for them just be allowed to play and learn. Anyone could do that now.
- TheDesolate0 5y ago
- Decabytes 5y agoI think 2022 will be the year I finally take a crack at this
- adamnemecek 5y agoIt’s kinda pointless.
- mdp2021 5y ago"The Hacker who did not look into things". Of course there may exist interpretations that bring your statement to the level of debatable, but if you keep them inexplicit, should the reader divinate?
- belkarx 5y agoDepends on what your goal is. If you want a useable OS, it's not worth the time. If you wish to learn about compilation and the "core" of Linux, then go for it
- eternityforest 5y agoStill seems slightly more point-ful than the other enthusiast distros
- shmoe 5y agoIt's a good exercise, you're not doing much with the resulting box though, for sure.
- silisili 5y agoDownvoted comment, but agreed. Compiling every package is a pointless exercise. Even benchmarks showed Ubuntu was faster than Gentoo. Package based build your own distros like Arch or Slackware give you most of the same experience in 1/100th the time.
- yjftsjthsd-h 5y ago> Even benchmarks showed Ubuntu was faster than Gentoo. Source/details? I would easily believe that Ubuntu was nearly as fast, or perhaps even exactly as fast, but I can't think of any way for a custom-compiled program to be slower than a distro-provided binary.
- deleted 5y ago[deleted]
- opiniateddev 5y agoThis is/was an awesome resource which helped me understand the basics of Linux installations, distributions. Used it to build really minimal distros.
- deleted 5y ago[deleted]
- mindwok 5y agoI remember doing this because I thought it would teach me to be proficient with Linux. After hours of spamming compilers and watching things build, I gave up. I realise now what I was trying to learn was how to use a Unix system, ie shell commands and the inner workings. This will teach you more about how to build your own Linux distribution.
- hulitu 5y agoThen you should try slackware, install a minimal system and compile the rest. It helps if you have programmer experience since, although there are build script for every package you need to find the dependencies yourself by looking at error messages.
- illegalmemory 5y agoFor me it taught, that how open independent systems, talking same language, can come together and build something truly open. If you don't like one library, you can write/find another and just plug that in. Such beauty.
- yjftsjthsd-h 5y agoIn fairness, I struggle to imagine that someone who finished LFS wouldn't be at least decently familiar with unixy systems; it's a load of practice running stuff in a shell and if you're paying any attention it makes you look at most of the core packages installed on most systems, so you should walk away with passing familiarity with all those parts.
- belkarx 5y agoThis teaches you: - How to compile things - How to follow instructions - How to overcome failure and troubleshoot - How to design a package manager (if you get that far) - Basic configuration Also takes a good few hours (it took me 2 days but I had to restart once and had subpar hardware). Weigh the advantages/disads
- wutXthreex3 5y agoUh, shouldn't you do item 2 before item 1?
- HPsquared 5y agoIt works as presented: 1 then 2 leads to 3.
- AtlasBarfed 5y agoDoes systemd vs init.d come into play here? Those are the primary boot/startup frameworks, correct? Is LFS only init.d? Or do you make your own bootstrap process along the way?
- FateOfNations 5y agoThey have versions for both: https://linuxfromscratch.org/blfs/read.html https://linuxfromscratch.org/blfs/read.html
- Sophira 5y agoHeads-up: You linked to Beyond LFS, the book for extending an already finished LFS system. The book for installing LFS is https://linuxfromscratch.org/lfs/read.html https://linuxfromscratch.org/lfs/read.html, which also has a regular and a systemd version.
- Rediscover 5y agoNo, it sorta does not come into play... The first time, it is whatever is suggested. Then whatever works for You. After doing LFS or similar, You have most of the knowledge to choose. Me, I use rc files, but then I'm a Slackware Linux/OpenBSD snob. (Oh, init.d drives me up the wall. Learn which kill signals do what You want) Edit: s/ if / of /
- User23 5y agoI did this to get Linux on an original Bondi Blue iMac. I had to cross compile a kernel with USB support. I was also naive and didn’t read the gcc build instructions so I only did a single stage bootstrap. That was the most oddly unstable system. I finally realized my error did a proper three stage bootstrap and rebuilt everything. I did it out if necessity and there was no excellent documentation like LFS, but it was still doable and extremely educational. I highly recommend it.
- shmoe 5y agoThis one seems to be popping up every few weeks. I really enjoyed successfully bootstrapping my own Linux box from scratch after a few unsuccessful tries. Then you have this box that helps you realize how difficult it is to maintain a Linux box without a package manager :P
- Shared404 5y ago> Then you have this box that helps you realize how difficult it is to maintain a Linux box without a package manager :P Indeed. I will say though, I'm seriously considering using this for a custom built appliance, probably for audio work - I always get annoyed at purpose focused distros because I can't quite fit it all in brainspace, and then it updates and changes under me. Audio specifically because I can never remember if my laptop is set up with Pulse/ALSA/JACK/OSS/Pipewire, and always break things when I try to set things up (I'm kinda dumb). But perhaps a custom LFS which never needs to be changed or connected to the internet after installation...
- shmoe 5y agoMan I remember back in the day trying to run a media PC connected to a TV on Linux and all the fun times with audio. Not a fun time for anyone.
- lambda_dn 5y agoOr How to waste a few days copy/pasting configure commands, watching the output of make to be left with a minimal, insecure and unmaintainable system. Only think it will teach you is why distros and package managers exist.
- yjftsjthsd-h 5y ago> to be left with a minimal, insecure and unmaintainable system Minimal yes, unmaintainable maybe, but insecure? Really depends on your threat model; courtesy of "minimal", there's not much attack surface to go around. > Only think it will teach you is why distros and package managers exist. And more importantly, how a distro works and what a package manager (and package build process) has to do. LFS isn't a terribly practical output for many people, but building it is a good learning experience regardless of if/how you use the built system.
- lambda_dn 5y agoI agree it's important to understand how linux eco system work, if you are interested. I don't think LFS does that, it's simply page after page of .configure..make..make install. It would be more valuable to read a sysadmin book on unix/linux and play around with a minimal distro.
- hsbauauvhabzb 5y agoDo you think distribution managers (the staff that work at canonical, etc) are just born with the ability to create distributions, rather than it being a learned skill? Just because you don’t see the value, doesn’t mean it has none.
- five82 5y agoAgreed. I went through about 70% of the runbook last year before running out of time and giving up. I used Gentoo in the early 2000’s and building an LFS system had been on my Linux bucket list since then. Maybe it’s just me but the instructions seemed to focus too much on what to do and not nearly enough on why. I came out of it thinking that I learned much less than I expected.
- markus_zhang 5y agoQuestion for Linux gurus: if I use Ubuntu as Windows(i.e. only run software and some cli experience without touching anything else), what's my next stepstone to LTS? I don't really know much about Linux and frankly Googled my way out if I had to, say run a bash script without typing "bash", or to find where a piece of software is installed. I do write programs in Python and SQL but never touch compiling things, except in hobby projects which involves VSCode and some gcc.
- b5n 5y agoI recommend this to newcomers: http://www.linuxcommand.org/tlcl.php/ http://www.linuxcommand.org/tlcl.php/ Spin up a VM and dive in.
- svennek 5y agoYou could start out with LFS in a VM, and would likely manage if you kept up.. Most is copy paste anyways... A youtuber called Ncommander did a livestream a few months ago. If you want a gentler slope, maybe something like (in this order, and keep doing stuff on a "earlier level" on the list): 1) Install packages via your packagemanager from the cli and other sysadm tasks 2) Change settings for stuff by files and not by gui 3) Install things not packaged by your package manager 4) Try arch (no compiling but a lot of setup) 5) Try gentoo (lots of setup and lots of compiling) 6) Try LFS in a VM (NEVER on a system, that you actually need)
- sparcpile 5y agoNCommander had a multi-part stream of building LFS up to Firefox. He's gotten up to building Xorg and the Firefox prereqs so far. I don't know when he plans on doing the final push to building Firefox. Part 1: https://www.youtube.com/watch?v=tCh0XjyIAKU https://www.youtube.com/watch?v=tCh0XjyIAKU Part 2: https://www.youtube.com/watch?v=egzyIFsQ3Nw https://www.youtube.com/watch?v=egzyIFsQ3Nw He also managed to dig up a copy of the proto LiveCD of Yggdrasil Linux and get it working. https://www.youtube.com/watch?v=Cynd0guSUvM https://www.youtube.com/watch?v=Cynd0guSUvM
- m3adow 5y ago
- dang 5y agoRelated: Linux from Scratch with Training Wheels - https://news.ycombinator.com/item?id=28820602 https://news.ycombinator.com/item?id=28820602 - Oct 2021 (41 comments) Linux from Scratch 10.0 - https://news.ycombinator.com/item?id=24350738 https://news.ycombinator.com/item?id=24350738 - Sept 2020 (49 comments) Linux from Scratch - https://news.ycombinator.com/item?id=24238015 https://news.ycombinator.com/item?id=24238015 - Aug 2020 (86 comments) Major Proposed Changes to Linux From Scratch - https://news.ycombinator.com/item?id=23787526 https://news.ycombinator.com/item?id=23787526 - July 2020 (93 comments) Linux from Scratch - https://news.ycombinator.com/item?id=20168343 https://news.ycombinator.com/item?id=20168343 - June 2019 (15 comments) Ask HN: Is the Linux From Scratch project still relevant? - https://news.ycombinator.com/item?id=20149111 https://news.ycombinator.com/item?id=20149111 - June 2019 (7 comments) Linux from Scratch - https://news.ycombinator.com/item?id=16823110 https://news.ycombinator.com/item?id=16823110 - April 2018 (1 comment) Linux from Scratch Version 8.2 released - https://news.ycombinator.com/item?id=16510333 https://news.ycombinator.com/item?id=16510333 - March 2018 (2 comments) Linux from Scratch – build your own Linux distro - https://news.ycombinator.com/item?id=11829373 https://news.ycombinator.com/item?id=11829373 - June 2016 (57 comments) Linux from Scratch - https://news.ycombinator.com/item?id=8392057 https://news.ycombinator.com/item?id=8392057 - Sept 2014 (1 comment) Welcome to Linux From Scratch - https://news.ycombinator.com/item?id=4488162 https://news.ycombinator.com/item?id=4488162 - Sept 2012 (71 comments) Linux From Scratch 7.1 Published - 3.2.6 Kernel + GCC 4.6.2 - https://news.ycombinator.com/item?id=3677350 https://news.ycombinator.com/item?id=3677350 - March 2012 (13 comments) Linux From Scratch 7 Released - https://news.ycombinator.com/item?id=3171448 https://news.ycombinator.com/item?id=3171448 - Oct 2011 (27 comments) Ask HN: Linux from Scratch.. Should I try it? - https://news.ycombinator.com/item?id=1779665 https://news.ycombinator.com/item?id=1779665 - Oct 2010 (58 comments) Ask HN: The best site to learn linux from scratch? - https://news.ycombinator.com/item?id=1513838 https://news.ycombinator.com/item?id=1513838 - July 2010 (1 comment) How to build custom Linux from source code - https://news.ycombinator.com/item?id=743843 https://news.ycombinator.com/item?id=743843 - Aug 2009 (1 comment)
- tokumei 5y agoNever messed with LFS. I used Gentoo (and then Arch) when I had the luxury of more free time. Very fun to tinker with. With Gentoo, waiting for your DE or web browser to compile was a great excuse to step away from the computer and go for a walk. The little things in life.
- darkwater 5y agoor run "emerge world"[1] before going to sleep and wake up at 3AM to check if it didn't halt on some missing deps while updating KDE... [1] tbh I don't rememeber the exact emerge syntax, it was almost 20 years ago!
- dirkc 5y agoI did this a very long time ago, really helped me understand what goes into building a running linux environment. I also had expensive dial-up internet at the time, so had some lessons in patience too! I still recommend this to people interested in learning more about linux and operating systems.
- riccardomc 5y agoLFS is great to learn how a Linux based system works without all the sweet, sweet magic modern distributions give us. On a personal, nostalgic, note: running LFS on your laptop in my university was the ultimate Linux nerd cred. A step below, immediately following, there was Slackware. The reason I feel confident enough working with Linux today is because I started back in the early '00 using Slackware, which recently had a new release[1]. Don't get me wrong, compiling your own kernel, solving shared libraries compilation hell, messing up your init.d and starting over, leaving your Pentium 4 compile for several hours was a massive waste of my 20s. But, boy, did I enjoy it! [1]http://www.slackware.com/announce/15.0.php http://www.slackware.com/announce/15.0.php
- heurisko 5y ago> Don't get me wrong, compiling your own kernel, solving shared libraries compilation hell, messing up your init.d and starting over, leaving your Pentium 4 compile for several hours was a massive waste of my 20s. But, boy, did I enjoy it! I had the same experience. I'm surprised how far I went with tasks I wouldn't particularly like to attempt now, purely motivated by the reward of tinkering with things without a sense of fear.
- newswasboring 5y ago>Don't get me wrong, compiling your own kernel, solving shared libraries compilation hell, messing up your init.d and starting over, leaving your Pentium 4 compile for several hours was a massive waste of my 20s. But, boy, did I enjoy it! Apropos to this, I remember back in early 2010s arch linux IRC had a bot which used to make fun of Gentoo for its compile time. One of them was something like "Watching compile text fly by is fun for the whole family". I still think about this some time. Which is funny because in day to day I don't use any compiled languages :P Edit: forgot to quote relevant text. PS: If someone does remember the exact quote, please tell me, it would make my day.
- bmn__ 5y ago"Watching shit scroll by for hours makes me a Linux expert overnight!" https://web.archive.org/web/2002/http://funroll-loops.org/ https://web.archive.org/web/2002/http://funroll-loops.org/
- reacweb 5y agoI did it a long time ago. Regularly, I monitor to see the new packages. I will redo it as soon as it includes chromium (and systemd).
- mekster 5y agoI've tried LFS about 15 years ago. It actually teaches you better to learn the inner workings of Linux if you follow Gentoo (or the likes) that makes you actually type in each of the steps to get the OS running like setting up swap and configuring kernel options but LFS tells you what the OS is made of like what packages are required to get a minimal system going. Good to learn both if you're interested.
- dschuetz 5y agoThis is missing CLFS, Cross-compiled Linux From Scratch, another amazing LFS project. It's unfortunate that the project apparently has been abandoned some years ago.
- sparcpile 5y agoThere is an interesting fork of LFS that uses Musl instead of glibc. https://github.com/dslm4515/Musl-LFS https://github.com/dslm4515/Musl-LFS I played with it for a while as the base OS for my KVM hypervisor servers. A couple of years ago, I tried to find all the source archives for the old LFS releases. I ended up using the Debian and kernel.org archives to find most of the old package versions. Packages from before 2004 started disappearing like as86 and the PowerPC patches. I was never able to find the PowerPC patches because they were never mirrored on anything but FTP sites. The Internet Archive did not pick up any of those mirrors. https://archive.org/details/linuxfromscratch-releases https://archive.org/details/linuxfromscratch-releases I eventually replaced the Musl-LFS build and replaced it with a buildroot set of configs and scripts when I had issues replicating my work with later package versions. Buildroot allowed me to more rapidly test and deploy my hypervisor config. I wanted a simple /etc/rc init like what was in SunOS 4, no GRUB, and QEMU with VDE networking. I ended up with SYSLINUX for BIOS MBR and gummiboot(before it was converted into systemd-boot) for EFI because my EFI machine (Dell R810) did not allow for direct booting of EFI binaries.
- throwawaydroid 5y agoLinux is fun though can be a pain in the ass. Test can i still post on HN? Edit: looks like i can, cool!
- syndacks 5y agoIn typical Linux fashion, this website is a complete UX nightmare. Where do I click? Why are there so many links? Why does the navigation bar on the right change? I'd like to learn Linux from scratch, but this is making it very hard for me...
- UltraViolence 5y agoIsn't there a Rust version of the Linux Standard Library as well?
- hulitu 5y agoThere is a rust version of a lot of utilities. Unfortunately (if we believe rust evanghelists, that rust is the best thing since sliced bread) 1) they are in an early stage of development and 2) they are mostly reinventing the wheel having different options than the standard utilities.
- sprior 5y agoI built my first LFS system in early 2001, it was the most educational thing I've done in my career up to that point.