LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   How to finish lfs (https://www.linuxquestions.org/questions/linux-from-scratch-13/how-to-finish-lfs-507227/)

status1 12-03-2006 07:03 PM

How to finish lfs
 
Hello,
I am building lfs for the first time using the lfs 6.0 and livecd
I am getting close to the end (chapter 8)
I need a litle help/guidance on how to finish lfs
I know this is a bit tricky going from the livecd to booting for the first time
I want to try it out first if I can so I need to make some kind of boot floppy or some other way of booting than what is in the book
I read a little bit ahead and noticed the warning about grub
overwriting the current boot loader
I don't want to mess with the MBR at this time if I can avoid it.
I don't want to overwrite the boot loader and then find out that I don't have a working system and render my windows useless

weibullguy 12-03-2006 09:03 PM

If you have another Linux distro, just edit it's menu.lst or lilo.conf and add the LFS. Otherwise, the GRUB manual has instructions for creating a boot floppy or CD/DVD. Just insert the instructions for making a floppy when you get to section 8.4.

status1 12-04-2006 05:59 PM

Hello,
Thanks for the link to the grub manual.
I will look into that.

status1 12-09-2006 11:16 AM

Hello,
I got to the point of making the floppy but it doesn't seem to do anything.
I have to ask this first to make sure I am doing this right.
Do I make the floppy while I am inside chroot ?
I tried to mount the floppy while inside chroot but it did not work
I got "mount: /dev/fd0 is not a block device (maube try '-o loop'?)

I am thinking it may be a better idea to add lfs to the windows xp boot menu
but I am not sure how to do that.
I already have it set up for multi boot with windows98

Still, it would be nice if I could make a boot disk in case something goes wrong with the windows xp boot or the MBR.

status1 12-10-2006 08:42 AM

Hello,
I am still trying to make a boot floppy but it doesn't seem to work
After I enter the 2 commands for stage1 and stage2 I can look at /dev/fd0 and I can see that the file size has increased but nothing is happening on the floppy

Are those commands supposed to make the boot floppy ?
Should the floppy be mounted somewhere special ?
Seems like I am missing something here.

Vitalie Ciubotaru 12-10-2006 05:00 PM

If you can't do it chrooted into LFS, you still can do it from the other operating system (the host system you used to build your LFS).

status1 12-10-2006 06:40 PM

Hello,
Ammm... I am not sure I can do that because I used the live cd so I don't have a linux host on the computer. I just have windows 98 and xp

I tried to install it on the hard drive but that's not working either because
I get a grub error "Error 21: Selected disk does not exist"
Not that I want to do it but I just wanted to try it to see if that works

I tried "root (fd" and then the tab key and completed it so it found fd0 even though it doesn't see it as a floppy but it doesn't find hd0 no matter what partition I use.
I have to do more research and try different things in order learn more about this so I can figure out what is going on.

Vitalie Ciubotaru 12-15-2006 05:09 PM

Can't you do it from LFS livecd? I mean you can type "grub" and get into grub shell and do all the commands in it, right?

status1 12-15-2006 06:38 PM

Hello,
Yes I can use grub if I am not inside chroot .
It recognizes (hd0,6) as ext2fs filesystem which is where I have LFS installed
and also shows the other fat filesystems that I have but if I am inside chroot
it doesn't recognize any filesystem on hd
Is grub supposed to work the same inside and outside chroot ?
I noticed that outside of chroot it's probing for devices and finding them but it doesn't appear to do that inside chroot.
It just goes straight to the grub prompt.
Do you think there is something wrong with the grub command or something with the fstab file perhaps ?
Where is grub looking for the mounted devices and filesystems ?

Narc0tiq 12-15-2006 06:46 PM

The file size has increased?!?
 
Quote:

Originally Posted by status1
[...]I can look at /dev/fd0 and I can see that the file size has increased [...]

/dev/fd0 is not supposed to change in size, it's a device node.

Sadly, I don't have a Linux box with a floppy disk drive around, or I might be able to give you a mknod command to create it properly, but take my word for it, /dev/fd0 should not change in file size because it should not have a file size!

How to check:
Code:

ls -l /dev/fd0
The result should start with something like:
Code:

brw-r-----
Note the "b" at the start, denoting it as a block device.

Hm... according to some message on a mailing list somewhere (I'm tired, and my Google-fu is unwilling to play) the commands:
Code:

mknod /dev/fd0 b 2 0
chmod 660 /dev/fd0
chgrp floppy /dev/fd0

should create your /dev/fd0 entry, since udev didn't create it for you.

EDIT: P.S.: Please note - none of this is guaranteed to help in any way. If your system refuses to do any of this, dumps core, or starts a small fire, I take no responsibility.

status1 12-16-2006 08:09 AM

Hello,
I was going to try that this weekend since I saw it a couple of days ago on the
internet but that was for other situation so I wasn't sure if it was going to work for me.
It's a lot better to get confirmation plus I wouldn't have known about adding
the "chgrp" at the end so I am not sure if it would have worked.

Anyway I tried it out and it works.
Thanks for your help.

Now I have to figure out the next step
When I boot from the floppy it goes into grub.
I have to create the menu.lst I am just not sure where to place it.
Should I place it where it says in the book (that would be on the hard drive)
or on the boot floppy that I just made ?

status1 12-16-2006 09:00 AM

Hello,
Adding the menu.lst to the hard drive has no effect.
I can use the commands from the menu.lst but I am still in the grub shell

Looks like I am missing something here to be able to boot LFS.

status1 12-16-2006 10:27 AM

Hello,
I made a little more progress.
I typed boot after entering the commands from the menu.lst so it booted for the first time.
I am guessing I will have to create the menu.lst on the floppy or point to where it's located on the hard drive.

When it first booted it was checking the partition where lfs was installed and
found some errors and said to reboot which I did.
Then the second time I had an error something to do with the network.

This I should be able to fix I just need some advice.

In chapter 7.10 of the LFS 6.0 book there is a line
"echo "HOSTNAME=[lfs]" > /etc/sysconfig/network"
and the book says
"[lfs] needs to be replaced with the name the computer is to be called"
I wasn't sure what to put here so I skipped it at the time I was building
LFS but I guess now it's time to put something there.

The question is what should I replace it with ?
Can it be any name or does it have to be something specific to my computer ?

There is one other issue
After pressing Enter to continue after that error I get to a login
"(none) login:"
What should be entered here for login and password ?

Narc0tiq 12-16-2006 10:59 AM

Quote:

Originally Posted by status1
Hello,
I made a little more progress.
I typed boot after entering the commands from the menu.lst so it booted for the first time.
I am guessing I will have to create the menu.lst on the floppy or point to where it's located on the hard drive.

Yeah, if you'll be booting from the floppy, the grub on the floppy needs to be able to find it, and the best way to do that is to just put it in the grub/ dir on the floppy disk.

Quote:

Originally Posted by status1
In chapter 7.10 of the LFS 6.0 book there is a line
"echo "HOSTNAME=[lfs]" > /etc/sysconfig/network"
and the book says
"[lfs] needs to be replaced with the name the computer is to be called"
I wasn't sure what to put here so I skipped it at the time I was building
LFS but I guess now it's time to put something there.

The question is what should I replace it with ?
Can it be any name or does it have to be something specific to my computer ?

It can be anything - try "lfs" as a hostname, or "miranda", or "pandora".

Quote:

Originally Posted by status1
There is one other issue
After pressing Enter to continue after that error I get to a login
"(none) login:"
What should be entered here for login and password ?

The login should be root and the password should be whatever password you gave it earlier - if you've forgotten this, try booting the LiveCD and chrooting into it again, and issuing the command
Code:

passwd root
to change the root password.

status1 12-16-2006 01:27 PM

Hello,
This boot floppy seems to be different than the regular floppy.
I can't seem to mount it ar maybe I am not supposed to.
Should I be using the dd command to copy the menu.lst to the floppy ?

Thanks for the advice for the hostname
I used LFS.So now it doesn't stop at that error anymore
All that does is that it puts lfs instead of none at the login so now
I have [LFS]login
I was able to change the password too.
I must have forgot what I used for the password since it was quite a while ago
So now my prompt looks like this
-bash-3.00# Is that correct ?
One thing I noticed was that it doesn't show the working directory in the prompt but I think that can be fixed

So everything seems to be working
I still have to work on adding the menu.lst to the floppy but at least I can boot now.

Narc0tiq 12-16-2006 01:47 PM

Quote:

Originally Posted by status1
Hello,
This boot floppy seems to be different than the regular floppy.
I can't seem to mount it ar maybe I am not supposed to.
Should I be using the dd command to copy the menu.lst to the floppy ?

No, dd will not do that. To be honest, if you can boot from the floppy, you don't really need to do anything else to it.

Quote:

Originally Posted by status1
So now my prompt looks like this
-bash-3.00# Is that correct ?

Yes, you have booted successfully into the shiny, brand new LFS system. Congratulations!

Quote:

Originally Posted by status1
One thing I noticed was that it doesn't show the working directory in the prompt but I think that can be fixed

Yup. Try
Code:

export PS1="[\u@\h:\w]\$ "
, and if you like it, add the line into /etc/profile.

Quote:

Originally Posted by status1
So everything seems to be working
I still have to work on adding the menu.lst to the floppy but at least I can boot now.

Again, if it boots from the floppy, you don't need to add menu.lst to it at all. I haven't used a boot floppy in ages, and never with grub, so I honestly don't know how it works. However, I do know that menu.lst is used by grub to display the possible boot choices when booting from the hard-drive. So you probably don't need it for floppy boot.

status1 12-16-2006 03:41 PM

Hello,
The problem is that the boot floppy is not executing the menu.lst or at least it doesn't know where it is so I guess that's why it comes up in the grub shell
so I have to enter the root, kernel and boot commands in order to boot otherwise it's just waiting in the grub shell for me to type something
When I said "I can boot now" I meant by adding the commands from the menu list
at every boot

I found the PS command, I was just looking to find out where to place it
There is some question on weather it should be in profile or bashrc
I was reading in the "bash prompt HOWTO" where it says

"the PS1 string should be set in .bashrc. this is because non-interactive bashes go out of their way to unset PS1. the bash man page tells how the presence or absence of PS1 is a good way of knowing whether one is in an interactive vs non-interactive (ie script) bash session.

the way i realized this is that startx is a bash script. what this means is, startx will wipe out your prompt. when you set PS1 in .profile (or .bash_profile), login at console, fire up X via startx, your PS1 gets nuked in the process leaving you with the default prompt."

For now I will place it in profile since it will be a while untill I will be using X

Narc0tiq 12-16-2006 04:10 PM

Quote:

Originally Posted by status1
Hello,
The problem is that the boot floppy is not executing the menu.lst or at least it doesn't know where it is so I guess that's why it comes up in the grub shell
so I have to enter the root, kernel and boot commands in order to boot otherwise it's just waiting in the grub shell for me to type something
When I said "I can boot now" I meant by adding the commands from the menu list at every boot

Oh, I see. Hm... tell me more about not being able to mount the floppy - what you do and what you get.

Quote:

Originally Posted by status1
I found the PS command, I was just looking to find out where to place it
There is some question on weather it should be in profile or bashrc
I was reading in the "bash prompt HOWTO" where it says

"the PS1 string should be set in .bashrc. this is because non-interactive bashes go out of their way to unset PS1. the bash man page tells how the presence or absence of PS1 is a good way of knowing whether one is in an interactive vs non-interactive (ie script) bash session.

the way i realized this is that startx is a bash script. what this means is, startx will wipe out your prompt. when you set PS1 in .profile (or .bash_profile), login at console, fire up X via startx, your PS1 gets nuked in the process leaving you with the default prompt."

For now I will place it in profile since it will be a while until I will be using X

Thanks for that info - I didn't know that and will probably add the export PS1 line to my .bashrc, too. Speaking of good lines for interactive shells, alias ls='ls --color' is quite nice.

I'm mostly still just a beginner myself, so take everything I say with a grain of salt and a look at other documentation on the subject. :)

status1 12-16-2006 04:14 PM

Hello,
Here is what happens if I try to mount the boot floppy
When I type "mount /dev/fd0 /mnt/floppy" I get
"mount: you must specify the filesystem type"
Do I have to specify the filesystem even if it's ext2fs ?
I am thinking that it is asking because it's a boot floppy.
I could specify but I am thinking it may wipe out the boot
part of the floppy
I could give it a try with another floppy just to see what happens

If I use a regular ext2fs formated floppy I can mount it with no problem
It's not asking about the filesystem, so that's why I am thinking the boot floppy is somewhat different

status1 12-16-2006 04:33 PM

Hello,
Another oddball thing that I noticed with this Bash 3.00
If I have a long line after the prompt and I want to insert some text before it
and starts to wrap it goes onto the begining or starts wraping up over the the line above.
Is there a fix for that ?
I did not have a problem with the lfs live cd or throughout building lfs.
It was always wraping the text down one line not up.
Could it have something to do with trying to change the prompt with PS1 ?

status1 12-16-2006 05:15 PM

Hello,
I fixed the problem with the prompt.
I guess it did not like whatever I put in the PS command so I just copied the
whole profile file from the live cd to the /mnt/lfs/etc so now I have the same colors and style that is on the lfs livecd I just added the 2 export lines
with the "LC_ALL" and "LANG" the were in the existing profile.
I also copied the dircolors so now when I type ls I can tell right away what type of files I have and which are directories

By the way the PS is in the profile in the lfs live cd so I will leave it there for now untill it becomes an issue

Vitalie Ciubotaru 12-16-2006 06:00 PM

Why "menu.lst"? It is nothing, but a symbolic link to grub.conf which is a configuration file itself.

status1 12-16-2006 06:54 PM

Hello,
That would be fine if I had grub.conf
I would have to create it first in order to link to it, no ?

status1 12-16-2006 08:33 PM

Hello,
SUCCESS!!!!!
I finally made it.
I used another method which is much easier (I think)
Here is the link
http://www.gnu.org/software/grub/gru...faq.en.html#q4
It's not using the dd command to make the bootable floppy You copy stage1, stage2 and the menu.lst and then make the floppy bootable from grub
Now I just have to add my windows menu to it and I should be all set

Thanks for everyones help on this forum.
I don't think I could have done it without it

Narc0tiq 12-17-2006 12:58 AM

Quote:

Originally Posted by Vitalie Ciubotaru
Why "menu.lst"? It is nothing, but a symbolic link to grub.conf which is a configuration file itself.

This is not true on either my LFS install or my DSL install - perhaps your distribution is more esoteric.

Narc0tiq 12-17-2006 01:00 AM

Quote:

Originally Posted by status1
Hello,
SUCCESS!!!!!
I finally made it.
I used another method which is much easier (I think)
Here is the link
http://www.gnu.org/software/grub/gru...faq.en.html#q4
It's not using the dd command to make the bootable floppy You copy stage1, stage2 and the menu.lst and then make the floppy bootable from grub
Now I just have to add my windows menu to it and I should be all set

Thanks for everyones help on this forum.
I don't think I could have done it without it

I'm happy to hear you were successful, however I must point out you did most of the real detective work yourself - good job! :)

status1 12-17-2006 08:08 AM

Hello,
Well I try to find my own answeres as much as possible but sometimes I can't find it or it doesn't work for my situation so I need a little help to guide me in the right direction.
Just by trying something I may discover something that may help in figuring out what I am missing.

I have another question I am not sure how imortant this is.

At the end of the book it says to unmount the virtual and $LFS file systems
Does that reealy have to be done ?
Is there any harm in keeping them for a while ?
I don't plan on using them I just thought that if something goes wrong I may be able to go back and fix something in there.

Narc0tiq 12-17-2006 01:06 PM

Quote:

Originally Posted by status1
At the end of the book it says to unmount the virtual and $LFS file systems
Does that really have to be done ?
Is there any harm in keeping them for a while ?
I don't plan on using them I just thought that if something goes wrong I may be able to go back and fix something in there.

There's no harm in keeping them around - the book just assumes that by that point you haven't rebooted yet, so the unmount is to unmount them cleanly from the host system in order to do said reboot.

You can always remount them again if something does go wrong (like when I accidentally renamed my /lib/ directory - oops!).

hbinded 12-17-2006 11:26 PM

I did it this way:

chroot into the installed lfs and open another x-term window/console from the host NOT lfs!
make sure $LFS/dev is mounted (as per chapter 6).
Create your "menu.lst" per lfs-instructions (it doesn't really matter if you make this file in chroot) and then run this on the host console as root (after inserting a floppy):
Code:

# fdformat /dev/fd0
# mkfs -t msdos /dev/fd0
# mkdir -pv /floppy
# mount -t msdos /dev/fd0 /floppy
# mkdir -p /floppy/boot/grub
# cp /usr/local/share/grub/i386-pc/stage*/floppy/boot/grub
# umount -v /floppy

now run this in the chrooted console:
Code:

# grub
This will brings up grub's shell.

Then run these commands in the same window:
Code:

grub> setup (fd0)
grub> quit

There you are, you have your working boot floppy

p.s. I forgot, you should put the menu.lst file in the grub folder. And it wont hurt to copy the other stage* files into the floppy. I made an image of the floppy and used cdimage to create a bootable cd. I kinda find it faster.

status1 12-24-2006 08:53 AM

Hello,
Sounds a little more complicated than the way I did it but if it works that's all that matters.
I was wondering if it's possible to boot windows 98 and xp from the floppy directly.
Right now I am using hd0,0 which brings me to the xp boot menu and from there
I have a choice of booting either 98 or xp.
This is not a problem, it's just another extra step I have to take to boot the
os I want to use.
I tried to use hd0,4 which is the partition that windows 98 is installed on but I am getting a "system disk" error because the linux floppy doesn't contain the boot information for windows 98.

I have a different question.
Now that I finished LFS I was wondering what gui program I should install
I heard about KDE and Gnome but I was wondering if there are others that are
relatively smaller in size since I don't think I will be downloading a few hundred mb's on a 56k dial up
I heard about puppy linux and DSL and the entire linux program is 50 to 90 mb
so I figure the gui program should be somewhat less.
I was wondering what kind of gui DSL and puppy linux is using ?
Is there a smaller version of KDE or Gnome ?

zalmaygul 03-19-2007 01:15 AM

grub howto please help
 
Hello Also

I have succesfully installed all the modules and kernel of lfs-6.2.

When I am on preparation for the grub I am stuck with erros
I am installing lfs on hda5 on hda1 i have windows and on hda7 i am having redhat 9
and hda8 is my swap.
When I apply the comand from the grub menu as
root (hd0,3)
I am getting error
no such device
Then I changed it to root(hd0,6) to specify root to my lfs and again the same error.
please help me how to go through successfully and have my lfs-6.2 boot ready
thanks

na5m 03-19-2007 06:53 AM

maybe this is what you want
 
if you don't want to mess with your MBR (and risk not being able to boot into Window$), then simply install grub into your Linux partition's MBR like so:

A) enter the grub shell.
B) type "root (hdx,y)" (without the quotes, of course) and hit enter (replace x and y with the partition that your grub files are installed upon).
C) type "setup (hdm,n)" (without the quotes, of course) and hit enter (replace m and n with the root partition your Linux system).
D) quit the grub shell.
E) type "dd if=/dev/hdhk of=~/linux.bin bs=512 count=1" (without the quotes, of course) and hit enter (replace hk with the root partition of your Linux system). You will now have a 512-kilobyte file in your home directory named "linux.bin".
F) copy "linux.bin" to somewhere where Window$ can read it upon boot (the c: might be a popular choice).
H) edit the Window$ file, "boot.ini", and add a line that says something like <c:\linux.bin="Linux"> (without the braces, of course).
I) reboot and enjoy.


All times are GMT -5. The time now is 05:11 AM.