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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
10-03-2005, 09:51 AM
|
#1
|
Member
Registered: May 2005
Location: Utah
Posts: 102
Rep:
|
How To Install LiveCD to Hard Drive
Here is a procedure that I used to install the LFS 6.1 Live CD to my hard drive. Use it at your own risk. The installed size is about 1.6 GB. You can delete the /sources directory and a file in / named .root.sqfs (or something similar) and reduce the size to about 1.3 GB.
1. Prepare a partition on your hard drive for LFS Live CD installation. Or maybe you want to use the whole hard drive. Format and install the file system of your choice. I used ext3.
2. Also prepare a swap partition. I used a swap equal in size to my RAM.
3. Boot the LFS Live CD. Configure your network so that you can connect to the Internet.
4. Mount the partition you want for your LFS Live CD hard drive installation
on /mnt. I used the following command.
# mount /dev/hda4 /mnt
5. Copy the system to your mounted partition. I used the following procedure.
# tar -C / -l -cpvf - . | tar -C /mnt -xpf -
6. Download a kernel source tar ball from kernel.org and put it in /mnt/usr/src. I used kernel 2.6.13.2. Make sure the kernel is in /usr/src of your new system, not in /usr/src of the Live CD.
7. chroot into your new system.
# chroot /mnt
8. Install the LFS bootscripts. I used the following procedure.
# cp /sources/lfs-bootscripts-3.2.1.tar.bz2 /usr/src/
# cd /usr/src
# tar -xvjf lfs-bootscripts-3.2.1.tar.bz2
# cd lfs-bootscripts-3.2.1
# make
# make install
9. Edit /etc/fstab. You need to delete references to union file system and add normal entries for a hard drive installation. The first two lines in my /etc/fstab are:
/dev/hda4 / ext3 defaults 1 1
/dev/hda5 swap swap defaults 0 0
10. Install the new kernel. I used the following procedure.
# cd /usr/src
# tar -xvjf linux-2.6.13.2.tar.bz2
# cd linux-2.6.13.2
# make mrproper
# make menuconfig (Set all configuration options that you need or want.)
# make
# make modules
# make modules_install
# cp arch/i386/boot/bzImage /boot/lfskernel-2.6.13.2
# cp System.map /boot/System.map-2.6.13.2
# cp .config /boot/config-2.6.13.2
11. Edit the bootloader of your choice for your new LFS Live CD system. I had another Linux system on my hard drive, so I added an entry to my existing /etc/lilo.conf as follows.
image=/mnt/hda4/boot/lfskernel-2.6.13.2
vga=791
label=LFS-LiveCD
root=/dev/hda4
read-only
12. Boot into your new hard drive installation of the LFS 6.1 Live CD and enjoy.
Good luck, jimbo
|
|
|
10-03-2005, 04:35 PM
|
#2
|
LQ Newbie
Registered: Sep 2005
Posts: 7
Rep:
|
Neat tip. You should submit it as a hint to the LFS web site. I already finished my first LFS 6.1, but I'll definitely consider it the next time I do an LFS build. It was quite annoying having to find the CD every time I returned to the LFS build or listening to my loud CD drive spin up whenever I had to run something off the disk in another console while I was chroot'd in my LFS environment.
One question: why does the HD install require over 1 GB if the disk itself is only a couple hundred MB?
|
|
|
10-03-2005, 06:30 PM
|
#3
|
Member
Registered: May 2005
Location: Utah
Posts: 102
Original Poster
Rep:
|
Thanks for the reply. I am not sure the LFS web site would appreciate a procedure that "short circuits" all of the painful compile steps.
The installed size does seem very large. I know that Live CDs use compressed file systems, but I didn't know they got that much compression.
jimbo
|
|
|
10-04-2005, 02:30 PM
|
#4
|
LQ Newbie
Registered: Mar 2005
Posts: 15
Rep:
|
Why not? You should browse through the list of current hints to see how many there are that 'goes against the grain' of LFS, so to speak. I'm sure there are several people that would appreciate the hint. Though, as I'm sure you realize, that particular hint isn't likely to ever be officially supported by LFS or the LFS Livecd project.
Btw, the compression we get on the LiveCD is about 50%.  Thanks to squashfs.
Also, your system ends up being more than double the size of the iso (approx 400Mb) because you are including the /proc and /sys filesystems in your dump. Those aren't necessary for the 'install' and take up a bunch of space when you dump them like that. You should find a way to skip those two directories in your dump.
--
JH
|
|
|
10-05-2005, 02:41 PM
|
#5
|
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 11,258
|
I think that it would be a fine idea if the LFS (and BLFS) projects included that kind of information, if only as a last-resort step if you happen to really hose something up.
Also, the rsync command is very useful to look at. When used in strictly local mode (not involving the network... source and destination systems are the same) it is quite good at replicating things like symlinks and so-on which can confuse simpler commands. It's also clever at deciding what actually needs to be copied and what does not.
I agree that these instructions should be fleshed-out and published as an official document. It certainly has its place.
|
|
|
10-06-2005, 02:09 PM
|
#6
|
Member
Registered: May 2004
Distribution: Slackware / GoboLinux / LFS / VoidLinux
Posts: 145
Rep:
|
Ok all worked except for the last one:
"11. Edit the bootloader of your choice for your new LFS Live CD system. I had another Linux system on my hard drive, so I added an entry to my existing /etc/lilo.conf as follows."
I dont have an existing bootloader (or working ones), should i just create the file /etc/lilo.conf and put up the settings for the kernel i compiled in there?
|
|
|
10-06-2005, 06:34 PM
|
#7
|
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 11,258
|
lilo... ick! That's one place where I've always completely-ignored the LFS instructions. grub is a much better boot-loader, imho. Easy to set up, a great deal smarter overall, and if you encounter a glitch at boot-time you can quite easily fix it without grabbing for that rescue-CD. The configuration files are ordinary text-files and there's none of this balderdash of having to execute the 'lilo' command...
|
|
|
10-06-2005, 07:54 PM
|
#8
|
LQ Newbie
Registered: Mar 2005
Posts: 15
Rep:
|
Quote:
Originally posted by sundialsvcs
lilo... ick! That's one place where I've always completely-ignored the LFS instructions.
|
When was the last time you actually looked at LFS then? Grub replaced Lilo in the LFS instructions a long time ago.
--
JH
|
|
|
10-07-2005, 05:21 AM
|
#9
|
Member
Registered: May 2004
Distribution: Slackware / GoboLinux / LFS / VoidLinux
Posts: 145
Rep:
|
I personally dont really care if its Lilo, or Grub, i want an installed LFS system to HDD
with a working bootloader.
I think this last information lacks, for either lilo or Grub, so that you can boot into
your hdd installed LFS.
"I had another Linux system on my hard drive, so I added an entry to my existing /etc/lilo.conf as follows."
I try to google for the answer meanwhile 
|
|
|
10-07-2005, 09:03 AM
|
#10
|
Member
Registered: May 2005
Location: Utah
Posts: 102
Original Poster
Rep:
|
The entry I gave for my lilo.conf file is what you would use for any other lilo. But you would need normal lilo.conf entries preceeding the LFS section. Just look up an example lilo.conf file.
Good luck, jimbo
|
|
|
11-12-2005, 02:58 PM
|
#11
|
LQ Newbie
Registered: Nov 2005
Posts: 4
Rep:
|
Quote:
Originally posted by shevegen
I think this last information lacks, for either lilo or Grub, so that you can boot into
your hdd installed LFS.
|
The livecd has the sources for an LFS 6.1 build, you can just chroot into /mnt and build a copy of grub and install it.
This was a great hint, Jimbo, thanks. This is probably going to save my butt, as I've been trying to get an LFS 6.1 build to work for a little while now. I kept running into problem after problem, and it always came down to the fact that glibc does not compile properly if you compile it on a host that's running a 2.6.x kernel compiled with gcc 2.95 (which most distros still do). It took me forever to finally find a distro that worked, only to find it's glibc was too old and I had issues after a few of the temp tools were built. An LFS 6.1 makes a perfect host to build an LFS 6.1 on. It meets all the requirements AND for those few places where little things can creep into your build from the host...who cares? It's the same version! 
|
|
|
11-12-2005, 04:18 PM
|
#12
|
LQ Newbie
Registered: Aug 2005
Distribution: PSkINk.
Posts: 1
Rep:
|
The problem is that You need to be root in order to run X windows. Also You don't need to compile The kernel, There is a file called "linux" on the cd and thats the kernal.
|
|
|
11-16-2005, 12:28 PM
|
#13
|
LQ Newbie
Registered: Nov 2005
Posts: 4
Rep:
|
Quote:
Originally posted by jhuntwork
Also, your system ends up being more than double the size of the iso (approx 400Mb) because you are including the /proc and /sys filesystems in your dump. Those aren't necessary for the 'install' and take up a bunch of space when you dump them like that. You should find a way to skip those two directories in your dump.
|
Actually, it doesn't because he's using the "-l" (which is replaced in the next version with --one-file-system), this limits it to the root fs. Mounted filesystems, including /proc and /sys, aren't done. The only drawback is I've found different versions of tar implement this more or less right, depending on which one you get. The latest on the CD seems to handle it right, though.
-S
|
|
|
11-20-2005, 10:34 PM
|
#14
|
Member
Registered: May 2005
Location: Utah
Posts: 102
Original Poster
Rep:
|
Quote:
Originally posted by GoldCPUfish
The problem is that You need to be root in order to run X windows. Also You don't need to compile The kernel, There is a file called "linux" on the cd and thats the kernal.
|
The reason that I compiled a kernel was to eliminate any Live CD specific stuff that might be in there. Maybe not necessary, but I wanted to be sure I had a "clean" hard drive installation.
Good luck, jimbo
|
|
|
12-02-2005, 05:18 PM
|
#15
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Rep:
|
Hi jimbo-62,
Tks for your work.
What about if I expect keeping /var and /home in separate partitions, say /dev/hda6 and /dev/hda7. How to make it after mounting them? Just moving them from /dev/hda4? TIA
BR
satimis
|
|
|
All times are GMT -5. The time now is 06:24 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|