LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 11-12-2018, 07:13 AM   #1
AdriaanP
LQ Newbie
 
Registered: Nov 2018
Location: Cape Town
Distribution: Arch
Posts: 6

Rep: Reputation: 0
Question Starting an LFS but have some caveats (LVM/LUKS, BusyBox, Dual-boot, EFI, SecureBoot)


I am starting on the journey to compile my own Linux Operating System, and have decided on some technologies that I feel would serve in in the long run, but this has created some caveats on how to start/continue.

TL;DR: Is is possible to create an LFS via a VM Linux (Debian, since I cannot get rid of Windows just yet), then 'move' this over to the non-VM Windows as a dual-boot? I don't have access to another Linux at the moment.
  • Would it work if I configured LVM and LUKS during the initial process, or should I configure and start LUKS/LVM up once I am done and ready to move it to the real partition?
  • I would like to use BusyBox instead of systemd or systemv. Is this possible?
  • I need to dual-boot between Windows 10 and LSF in the end. Could I complete the process in an Linux VM (Debian) and then move the completed LSF-OS over to a non-VM partition and make it bootable?
  • My BIOS has SecureBoot enabled and my boot-loader is EFI currently. Do any if these have to change for the dual-boot to work at the end?

Any words of wisdom are welcome
 
Old 11-12-2018, 08:31 AM   #2
AdriaanP
LQ Newbie
 
Registered: Nov 2018
Location: Cape Town
Distribution: Arch
Posts: 6

Original Poster
Rep: Reputation: 0
Did some more research and LFS book reading

So I read some more and this is what I came with as a solution. If someone could check on on this and let me know if this gameplan will work, I would appreciate!
  • Follow the LFS Book to the letter, using SystemV and and standard partitions etc. Do this on the Linux VM (Debian) as the host so I can have access to all the Linux commands
  • Once I hit Chapter 8, things will get a little more complicated as I still need to compile the kernal in the VM environment, creaate fstab and afterwards move this to the non-VM partition and up fstab with the dual-boot details like Windows drives, etc. I will also have to setup GRUB at this stage to cater for the dual-boot
  • Once I can boot into the LFS, I should be able to install and configure LVM and LUKS
  • I can then attempt to replace systemv with BusyBox or even sinit by suckless.org
  • I will keep SecureBoot if it still works, otherwise just disable in the BIOS. Would have loved to replace with libreboot though.
 
Old 11-12-2018, 10:47 AM   #3
ordealbyfire83
Member
 
Registered: Oct 2006
Location: Leiden, Netherlands
Distribution: LFS, Ubuntu Hardy
Posts: 302

Rep: Reputation: 89
Welcome, and congratulations on making the choice to take your computing in your own hands.

To answer your questions:

- Don't configure LVM or LUKS until the end. It will only complicate things initially. Also when compiling any software there is a lot of writing to the hard disk so encrypting all of this may slow things down a bit. Also I know many tutorials use LVM and LUKS together but LVM is unnecessary and will break resuming from hibernate. Its only advantage is only using one password to unlock the root partition and the swap as they would be one logical volume.

- As for BusyBox, probably not. Is there any specific use case for using this over sysvinit? Other users have gotten runit (another init system) going, so there are other options.

- Yes, of course you can build everything in a VM and it doesn't matter what virtualization solution you use (Qemu, VirtualBox, etc.) The tricky part is at the end where you move everything out of the VM. There are any number of ways to do that.

- As for SecureBoot/UEFI, probably, yes, you'll have to change it. Building LFS and having total control over what you are building/installing is about as opposite to the philosophy of that stuff anyway, so you may seriously want to consider a different computer. In my view there is no legitimate reason for UEFI to be on the mass market, anyway.

You mention still needing Windows at the moment. What exactly do you do in Windows? If it is nothing that requires heavy 3D graphics (gaming, etc.), once you have finished LFS, you could consider running Windows in a virtual machine from inside LFS.
 
1 members found this post helpful.
Old 11-12-2018, 06:48 PM   #4
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
Busybox has a simple init system and can be used with lfs quite easily, I used it myself for a while with no problems, there are a couple of threads on this sub forum about alternative init systems.
 
1 members found this post helpful.
Old 11-12-2018, 07:07 PM   #5
ordealbyfire83
Member
 
Registered: Oct 2006
Location: Leiden, Netherlands
Distribution: LFS, Ubuntu Hardy
Posts: 302

Rep: Reputation: 89
Looks like your post had some delay, so I didn't see it before posting.

Yes the Chapter 8 part might seem tricky at first. Compiling the kernel in a VM isn't a problem if you know what features/modules you need. One way to test this is to boot your real computer from a live CD - preferably live Slackware with the 'generic' kernel. (This is actually a live DVD.) This kernel leaves almost everything built as modules, so you can run 'lsmod' and see what hardware you should configure for. Of course, it's your call whether you compile these features as modules or as built-in.

Regarding Grub, you'll need to build it from within LFS but don't actually configure anything yet. Once you have your LFS installation on your real hard drive, you can boot a live CD and chroot into your LFS and configure grub from there. You'll at least need the /dev and /proc directories bind-mounted for this to actually work.

I didn't realize BusyBox would work - sysvinit works fine here so I haven't needed to explore any alternatives.
 
1 members found this post helpful.
Old 11-13-2018, 02:18 AM   #6
AdriaanP
LQ Newbie
 
Registered: Nov 2018
Location: Cape Town
Distribution: Arch
Posts: 6

Original Poster
Rep: Reputation: 0
Thumbs up

@ordealbyfire83:

It was my first posting to the forum, so I think the moderators had to do some checking before it went live. Thanks for the replies! I didn't think of the constant writing to the drive, so encryption beforehand would be bad, agreed. I forgot to mention, this is not on a laptop, but a desktop, so I don't really use hibernate, and unlocking with one password seems a better choice, so I will probably still want LVM, but I will see.

There is no reason for SecureBoot and I have had it disabled at times (actually, when I got the desktop, it was disabled and I naively enabled it, thinking it would with protecting my PC). I will disable it again, as well as UEFI, as there is no real reason for it to be used.

windows is purely for gaming still, but I have slowly been moving my gaming to a console, only a few games still needed and played on the PC. The plan was to eventually get rid of Windows altogether.

@Keith Hedger, @ordealbyfire83:

I only wanted to try BusyBox as it seemed to have gotten some praise from various people, and in the same breath many users have raised concerns over systemd, and systemv seems... old? I will definitely check out the other links, thank you for sending it.

-------------------------------------------------------------

I found the following concept for moving the completed LFS from the VM to the real PC. Is this a good way? I have never used rsync.

In short:
  • rsync everything to one mount on the VM
  • rsync that mount to a USB
  • rsync the USB to the target partition on the real PC
  • update fstab on the destination
  • recreate grub on the destination

Code:
rsync -avHX SOURCE_IP::all/mnt/slash/ /mnt/slash/

rsync -avHX /mnt/slash/ /mnt/usb/slash/

rsync -avHX /mnt/usb/slash/ /mnt/slash/
 
Old 12-04-2018, 07:00 PM   #7
ordealbyfire83
Member
 
Registered: Oct 2006
Location: Leiden, Netherlands
Distribution: LFS, Ubuntu Hardy
Posts: 302

Rep: Reputation: 89
I'm sorry I haven't been very active on here as of late. Were you able to get your system built?

I'm not sure about the rsync part - along the way you will have created some device "nodes" which aren't real files, and I'm not sure whether the proper permissions would stay in tact. I might be wrong, and someone fluent with rsync would be able to answer.

Typically when I move a partition from inside a virtual machine to outside (or vice versa) I use a combination of dd and ssh. For example, say you want to move your partition from inside the VM to the host. First shrink the partition to its minimum size - run fsck, then do resize2fs (in contrast to some other programs, the man page actually explains pretty well how to use it), and the fsck again (forced, if necessary). Resize2fs will tell you how big your partition is; now create a partition on your host for this size, plus a little extra (I usually do 8 megabytes) in case hard drive geometry is different. Now the tricky part. From inside the guest:

dd if=/dev/vm_partition | ssh username@hostip "dd of=/dev/host_partition"

Be mindful of the quotes, they are part of the command. ssh can take a third argument, which you pass along to the host, which is the entire dd command with arguments of its own. That may be slow. To speed it up, try adding bs=8192 or similar, though when doing this you need to explicitly tell _both_ dd instances of this:

dd bs=8192 if=/dev/vm_partition | ssh username@hostip "dd bs=8192 of=/dev/host_partition"
 
1 members found this post helpful.
Old 12-05-2018, 01:55 AM   #8
AdriaanP
LQ Newbie
 
Registered: Nov 2018
Location: Cape Town
Distribution: Arch
Posts: 6

Original Poster
Rep: Reputation: 0
@ordealbyfire83:

Thanks for the reply. I didn't know I could actually pipe a DD through an SSH! This shows the magic of Linux right here!

I started with my LFS creation, but decided to rather leave it until our summer holidays now in December, as I can spend many hours in front of the PC tinkering away with no distractions, rather than having to do it 2 hours a time at night after work.

Also, I am considering buying an old laptop, so I don't HAVE to dual-boot, but still thing to do it on the dual boot as a learning experience, ironing out all the things I don't understand yet, so I can do a more clean creation on the laptop itself. I am trying to get one that is compatible with the libreboot requirements, also to learn more about freeing my BIOS.

I will come bug you guys again in the holidays!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to have luks encryption with keyfile OR passphrase (efi full disk encryption including boot)? byroncollege Linux - Security 2 03-30-2017 07:45 AM
resize efi question [/boot/efi] with boot flag gparted mtdew3q Fedora 4 03-19-2017 10:02 PM
[SOLVED] Partitioning for (U)EFI, LVM and LUKS, maybe dual boot later gargamel Linux - General 7 07-15-2015 03:58 PM
[SOLVED] Making X11 work reliably on a Xen 4.1 dom0, with some caveats Gullible Jones Linux - Virtualization and Cloud 1 07-12-2013 10:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 03:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration