Linux From Scratch?
chrisjbreisch opened this issue · 8 comments
I would love to have an LFS system in my WSL. What would be the best way to get there? I can build it all under WSL, I think (been a while since I tried). Should I try to put it in a SquashFS archive and then unsquash it as you mention in your blog for ArchLinux?
Actually, I don't think I can build LFS in WSL. I think there are chroot issues. No matter. I can build it in a VM. The problem isn't building it. It's getting it into WSL and still having a functioning system.
Can you send me a LFS (regardless whether it was built in WSL or not) rootfs? I'll check and see if I can make it work.
The creators update WSL supports chroot, so you shouldn't have issues if you updated. Also, make sure the LFS you're building is x64, since WSL does not currently support x86 binaries.
Sorry, I just saw this question. Have been swamped lately. I can do this over the weekend probably.
Is this still happening? I kinda want to try it out.
Actually, I don't think I can build LFS in WSL. I think there are chroot issues. No matter. I can build it in a VM. The problem isn't building it. It's getting it into WSL and still having a functioning system.
I dunno the possible WSL1 obstacle you may encounter as the message was from 2017, but it's feasible now in WSL2 w/ WSLg update. I finished it by following the latest stable manual (Version 11.2 Published September 1st, 2022) and everything just works.
The only difference is that I don't want to make a separate partition for the chroot (as I'll use it as a WSL distribution) so I created a raw VHDX in Windows and formatted it under WSL using GParted. When you've done the LFS stuff, just export the whole $LFS
to create a rootfs
by running cd $LFS && tar czf /mnt/<disk>/path/wherever-you-like/rootfs.tar.gz .
, and import it using wsldl.
All that being said, IMHO it's out of the scope of this repo😕.
Thanks for the reply to my 5-year old thread, @Vinfall.
I have pretty much settled upon Pengwin as my WSL distro of choice now. I do enjoy the flexibility of LFS, but it'd be challenging to get it up to the functionality of Pengwin. That would be deep into the BLFS book.
It's good to know that LFS works at this point. I may play with it again, but it would be merely for the interest in creating an LFS system, rather than to actually use it now. Also, I think that your raw VHDX only works in WSL2. I don't think you can mount an external file system in WSL1.
Still, good to know. Thanks for the efforts.
Also, I think that your raw VHDX only works in WSL2.
I guess you're right, since the Mount a Linux disk in WSL 2 documentation even requires an insider build (Windows 11 Build 22000 or later, I'm on Dev channel).
To make it fully from scratch, you may wanna build the WSL2-Linux-Kernel under LFS as well. I built the kernel from latest released linux-msft-wsl-5.15.62.1 and it works perfectly fine with the default setting.
Again, I guess LFS does not fit there😷 as LFS itself do not maintain an up-to-date live CD and the building process involves personal preferences.
BTW, Pengwin looks pretty interesting (although I may choose Gentoo instead for an optimized distro)!