Using VirtualBox for building Linux from Scratch

If it doesn't relate to Debian, but you still want to share it, please do it here

Using VirtualBox for building Linux from Scratch

Postby toxicspiritssssss » 2020-07-23 14:01

It's been few months since I started using Linux and I want to learn more about what's under the hood. I've seen people recommending LFS (Linux from Scratch) for people who want to learn more. But I cannot create a new partition on my Laptop's internal hard disk as it is almost full and I don't have any spare external hard disk.

My question is, can I use VirtualBox for building Linux from Scratch? If yes then how can I proceed? I have Kali Linux installed on VirtualBox as one of my Virtual Machine. Can I create a new partition on my Kali Virtual Disk and use that for building LFS?

Any help is highly appreciated

Edit: I've read many articles and forum threads regarding this but I cannot get any definitive answer. I'm confused.
toxicspiritssssss
 
Posts: 14
Joined: 2020-06-24 14:06

Re: Using VirtualBox for building Linux from Scratch

Postby eriefisher » 2020-07-23 14:12

I cannot offer any guidance with LFS but it doesn't matter whether it's in a VM or on actual hardware it's going to take up space. If your already approaching a full disk your going to have problems. To build your going to need space for all the sources and the OS build itself. It will get quite large quickly. Just a warning.
____________________________________________
There's a manual?
Siduction
Debian Sid
Xfce4 4.14
User avatar
eriefisher
 
Posts: 129
Joined: 2008-06-04 03:49
Location: Ontario's South Coast

Re: Using VirtualBox for building Linux from Scratch

Postby toxicspiritssssss » 2020-07-23 14:34

Hey @eriefisher thanks for your reply. I have allocated around 150 GB of fixed disk size to my Kali VM and most of it is free. I am planning to allocate at least 40-50 GB to my LFS build. But I'm not able to shrink the size of my Kali Virtual Disk to make space in my actual disk. So I thought if somehow I could use the Virtual Disk for my LFS.
toxicspiritssssss
 
Posts: 14
Joined: 2020-06-24 14:06

Re: Using VirtualBox for building Linux from Scratch

Postby Bulkley » 2020-07-23 15:48

My question is, can I use VirtualBox for building Linux from Scratch?


Probably but VirtualBox is problematic on Debian. If you are not using Debian you are on the wrong forum. If you are using Debian virt-manager might do what you want. If you have CLI ability then use qemu-kvm which can do just about anything you can imagine.
Bulkley
 
Posts: 5971
Joined: 2006-02-11 18:35

Re: Using VirtualBox for building Linux from Scratch

Postby toxicspiritssssss » 2020-07-23 16:51

Hey @Bulkley thanks for your reply. Yes I am using Debian 10 as my host OS. And I have VirtualBox 6.1 installed on it. I'll surely check out virt-manager and I'll get back to you here if I have any doubts. Hope you don't mind. I'm still a learner and I don't think my CLI ability is top notch but I'll still check out qemu-kvm.

How do you suggest I proceed with my LFS build on virt-manager?
toxicspiritssssss
 
Posts: 14
Joined: 2020-06-24 14:06

Re: Using VirtualBox for building Linux from Scratch

Postby Bulkley » 2020-07-23 17:10

toxicspiritssssss wrote:How do you suggest I proceed with my LFS build on virt-manager?


Follow the instructions at Linux from Scratch. You probably know that. As to virt-manager, it's been awhile so I don't have much advice other than use your search engine a lot. There is a ton of VM stuff on the Net and almost any issue you have has an answer so just keep plugging.

Your Linux from Scratch project looks like a great project. Enjoy.

Edited to add: When using a VM it is a big help to be able to transfer files from your host to the VM. That is accomplished with Spice. You need several Spice packages, including spice-client-gtk, in your host and spice-vdagent in your VM.
Bulkley
 
Posts: 5971
Joined: 2006-02-11 18:35

Re: Using VirtualBox for building Linux from Scratch

Postby Head_on_a_Stick » 2020-07-23 17:45

toxicspiritssssss wrote:I've seen people recommending LFS (Linux from Scratch) for people who want to learn more.

I've built a (test) system using LFS and all I learned from it was the importance of copy&paste :mrgreen:

toxicspiritssssss wrote:I cannot create a new partition on my Laptop's internal hard disk as it is almost full and I don't have any spare external hard disk

Backup your system and reformat the partition with btrfs (or zfs) so that you can install LFS to a subvolume. Or just make more partitions.

Using a VM will be painful because it will slow the compilation significantly, even with hardware virtualisation.

And as Bulkley notes if you do use a VM then don't bother with VirtualBox, QEMU/KVM is faster.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12316
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Using VirtualBox for building Linux from Scratch

Postby toxicspiritssssss » 2020-07-23 20:22

Thanks a lot @Bulkley for your suggestions and valuable insights. I'll keep them in mind while approaching my project.

I've built a (test) system using LFS and all I learned from it was the importance of copy&paste :mrgreen:

Yes. I kinda agree with you. Going through the LFS manual, I realized that anyone can do this using copy&paste. But I'm not able to find any other alternative to LFS. That's why I though I'll take an different approach. I have some good amount of knowledge in C/C++ programming. So I though I'll try to study the source code of the packages and file, if not all, at least the major and important ones, before compiling or building them. I don't know if this is the right approach. Maybe you can guide me in this one? Also if you do have any alternative to LFS, please do tell me.

Backup your system and reformat the partition with btrfs (or zfs) so that you can install LFS to a subvolume. Or just make more partitions.


The problem is that, I my MBR structure only allows 4 partitions. 3 of them already used by windows and I have Debian installed on the extended partition. I also don't have any external storage medium large enough to store all the the data of one particular partition.

I was thinking maybe I'll try deleting one of my Ubuntu VM and make some free space. After that I'll create a new partition inside my extended partition using that free space. This should work hopefully.


Using a VM will be painful because it will slow the compilation significantly, even with hardware virtualisation.

And as Bulkley notes if you do use a VM then don't bother with VirtualBox, QEMU/KVM is faster.


Okay understood. I'll try building LFS using QEMU/KVM as a part of my experimental project.

Thanks a lot @Head_on_a_Stick for your reply and advice. I'll keep them in mind.
toxicspiritssssss
 
Posts: 14
Joined: 2020-06-24 14:06

Re: Using VirtualBox for building Linux from Scratch

Postby cuckooflew » 2020-07-24 00:01

I did my first LFS experiment, build using a Debian sid that is on a QEMU VM, it was fine ,except extremely slow... Since I do have a fair amount of HD space available, I started using that instead.
The problem is that, I my MBR structure only allows 4 partitions. 3 of them already used by windows a----snip---

There you go, if it was me, I would delete all the MS windows stuff, no need for it, the disk space can be put to better use.
I was thinking maybe I'll try deleting one of my Ubuntu VM and make some free space.

Sounds like you actually have all sorts of space, just some major "house cleaning", and get rid of all the useless junk :mrgreen:
Also if you do have any alternative to LFS, please do tell me.

There are a few, you have the same tools available as I do, but I don't really have time now, hint; key words:
Code: Select all
How to build your own Linux system
 

== :mrgreen:
========edit=========
I have found Minix 3 to be a good learning tool, in fact that is what Linus was using to start with : https://wiki.minix3.org/doku.php?id=faq
What is the relationship between MINIX and Linux?

MINIX was released in 1987 as a small easy-to-understand UNIX clone for use in courses teaching operating systems. Linus Torvalds, then a student at the University of Helsinki, studied MINIX in an operating systems course and was sufficiently impressed that he bought a PC to run it. He then used MINIX as a platform, guide, and inspiration to develop a MINIX clone, named Linux, which he released in 1991. Here is his announcement of Linux.
Please Read What we expect you have already Done
Google knows a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
…one flew east, one flew west,
One flew over the cuckoo’s nest.
cuckooflew
 
Posts: 550
Joined: 2018-05-10 19:34
Location: Some where out west

Re: Using VirtualBox for building Linux from Scratch

Postby Deb-fan » 2020-07-24 01:37

A good example of planning to bite off more than someone can chew. Trying to eat the elephant in one bite vs one bite at a time. :) It's human nature though, am about 110% sure I thought and/or tried similar(exact same thing, doing LFS)when getting into gnu/Linux. Ohhhhh ... I'll just skip all this unimportant/pesky stuff like building knowledge/skill and hands on experience and just jump to being a Nix ninja overnight, lol ...

Ummmm ... doesn't work that way of course. Doing this thing with LFS can't hurt regardless, you'd be bound to learning something(s), agree with others in opting for a real hypervisor KVM vs Virtualbox if the hardware is capable of that, virtualization is a huge sub-specialty area of tech itself. Definitely would read the LFS documentation as a source of reference. Really want to know the intimate under the hood workings of gnu/Linux then that's a great place to start, the docs, ranging from the Linux kernel, the Debian wiki, Gentoo wiki, Arch wiki, Ubuntu wiki, Wikipedia wiki etc etc etc. There's no shortage of great information which details it all. Painfully details it all. While there are certainly effective shortcuts to employ, really no getting around paying your dues and putting in the time-effort for anyone aspiring to be a Nix-guru.

Note: Actually that's a good shortcut imo, a good chunk of people who have devoted tons of their time to learning about tech and gnu/Linux are happy to share, WANT (and/or even feel COMPELLED)to share what they've found and learned. In learning to identify such individuals and stalking their posts or whatever, much nixy knowledge goodness can be had freely. Sometimes no doubt even profound nuggets just laying there. Have seen fellow nixers which were clearly in a league of their own, almost ALWAYS had enlightening stuff they'd share. I probably should've stalked them to a greater extent myself, still should. Only saying it's common sense and of obvious benefit to listen to the folks who know what they're talking about, they already have the knowledge/skill and experience.

Grandmaster geeks, like Yoda ... only with a neckbeard. :D

The only 4 partitions thing is nonsense, even back when folks were stuck with 4 primaries, a majority going with 3 and an extended partition, there were many workarounds and people stacking partitions onto Mbr disks. Though that's also not something which can be clarified in an easy 1,2 .. 3. The specs of your system and how it's setup are a big part, how best someone might go about changing it or improving it for whatever goals, uses and preferences you have could be a complex topic itself.

Stuff like the tip Hoas gave you, filesystems like btrfs, others, junk like LVM etc so on, so forth.

Grasshoppa ... when you can snatch the kernel from Linus Torvald's hand, you will be ready to walk on rice paper. Nope you'd (we'd all) still have a MASSIVE chit-ton of things to learn, even then. :D
Last edited by Deb-fan on 2020-07-24 02:56, edited 1 time in total.
Most powerful FREE tech-support tool on the planet * HERE. *
Deb-fan
 
Posts: 814
Joined: 2012-08-14 12:27

Re: Using VirtualBox for building Linux from Scratch

Postby Deb-fan » 2020-07-24 01:51

There's a good starting point, look up and take some gnu/Linux 101 and 102 quizzes. Did, ... can you pass?

In keeping it real with the Yoda thing above, the opposite is also true. Not at all unusual to come across techies or nixers in varied forii whose join date makes it clear they've been using the gnu/nix OS for 10yrs or longer and the comments they make, opinions shared and advice they give, they'd be lucky to get a solid C- on a Linux 101 test.
Most powerful FREE tech-support tool on the planet * HERE. *
Deb-fan
 
Posts: 814
Joined: 2012-08-14 12:27

Re: Using VirtualBox for building Linux from Scratch

Postby toxicspiritssssss » 2020-07-24 07:09

Thanks a lot @cuckooflew for your reply.

There you go, if it was me, I would delete all the MS windows stuff, no need for it, the disk space can be put to better use.


I'd love to do this. But the problem is me and my brother share the same laptop. And he's adamant on not leaving Windows. But I don't blame him. He's on the younger side. Maybe when he's like 16 17 I'll give him a proper lecture on the importance of FOSS.

Sounds like you actually have all sorts of space, just some major "house cleaning", and get rid of all the useless junk :mrgreen:


I'm a cyber security student and at my university course, it's kinda necessary to have 2-3 VMs such as Kali Linux, windows VM, metasploitable, Ubuntu etc. Maybe I'll delete one or two of my little brother's game. :lol: Yes I'll surely do up some cleaning and remove some unused things.

I have found Minix 3 to be a good learning tool, in fact that is what Linus was using to start with : https://wiki.minix3.org/doku.php?id=faq


Damn. How come I didn't know bout this. I read Linus Torvald's whole Wikipedia page and there was not a single mention of MINIX. I've already started reading it's manual and I'm learning a lot of new things. Since I've already started with my LFS project, and I intend to finish it, I'll surely take up MINIX after it. Meanwhile I'll keep reading it's manual side by side.

Once again thanks a lot for your valuable insight and pointing me towards such an wonderful resource. :D
toxicspiritssssss
 
Posts: 14
Joined: 2020-06-24 14:06

Re: Using VirtualBox for building Linux from Scratch

Postby toxicspiritssssss » 2020-07-24 07:54

Thanks a lot @Deb-fan for your reply.

Reading your whole comment I realized that maybe I'm rushing things. I'll try to take it slow while building up my basics. I know this might go a bit off topic but I'd like to share a little bit about my Linux journey till now

I entered the Linux world almost 1 year ago. To be brutally honest, I was an windows fan before this, and I liked windows despite all of it's shortcomings and flaws. I knew a little bit bout Linux but I was intimidated by it's vastness. I finally made the jump to Linux and oh boy it's never been the same again. I did a lot of distro hoping before settling down with Debian as my daily driver and I've never looked back at windows since then.

To be honest, it wasn't an easy jump. I stumbled upon lots of problem. But I was able to solve all of them with the help of Internet. With each problem I solved I learned new things and felt a sense of accomplishment. Even my first successful Linux install felt like an big accomplishment. I realized the importance of manuals and I soon got into an habit of RTFM.

Only saying it's common sense and of obvious benefit to listen to the folks who know what they're talking about, they already have the knowledge/skill and experience.


+1 for this. Totally agree with you. I myself follow people on forum threads (such as this forum) and they do share their valuable knowledge and it's always beneficial to learn from them.

I'll surely take up the gnu/Linux 101 and 102 quizzes. Based on what I'm able to score, I'll plan my learning path and approach accordingly. Hope one day I'll become like y'all and like people who have tremendous knowledge bout a these stuff.

Thanks a lot once again for your valuable ideas and insights.
toxicspiritssssss
 
Posts: 14
Joined: 2020-06-24 14:06

Re: Using VirtualBox for building Linux from Scratch

Postby Deb-fan » 2020-07-24 10:02

^ Yep you got it, in my dorkish way was trying to convey that point. Making sure you've got a good foundation and the fundamentals down. Think you've got the makings of a true nixer. Someone with a real interest in tech. Be warned if you are indeed the type, gnu/Linux is highly addictive. You will never have a shortage of new and interesting things to learn, never run out of mysteries to solve, nor challenges to overcome.

It's kind of like that scene in the Matrix, once you've taken the red pill(gnu/Linux), there's no going back. You've been warned!

Errrr however, judging by what you've said,(are using Debian proper so early on)and fact that you're here. You've already swallowed the red pill, Mwah_ha.haha..haHaaaa! Enjoy! :D
Most powerful FREE tech-support tool on the planet * HERE. *
Deb-fan
 
Posts: 814
Joined: 2012-08-14 12:27

Re: Using VirtualBox for building Linux from Scratch

Postby Head_on_a_Stick » 2020-07-25 16:13

toxicspiritssssss wrote:my MBR structure only allows 4 partitions. 3 of them already used by windows and I have Debian installed on the extended partition.

MS-DOS ("MBR") partition tables only allow 4 primary partitions, if Debian is on an extended partition then you can create more logical partitions. Or just reformat that partition with btrfs (or zfs) and use subvolumes to hold both Debian & LFS.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12316
Joined: 2014-06-01 17:46
Location: /dev/chair

Next

Return to Offtopic

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable