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 05-18-2021, 12:12 AM   #16
George528
Member
 
Registered: May 2021
Location: Moldova
Distribution: Arch, Debian
Posts: 95

Original Poster
Rep: Reputation: 2

Quote:
Originally Posted by colorpurple21859 View Post
at the grub menu press c for a grub prompt grub>
at the grub prompt
Code:
grub>set
post the following line
Code:
prefix=
In post 9 you say your mounting /dev/sda9 to /boot but according to your grub.cfg /dev/sda2 is the partition where your kernel is located not /dev/sda9

Which partition is suppose to be the / partition?
/dev/sdb6 is supposed to be /

do i have to enter grub loader during boot or in live cd terminal
 
Old 05-18-2021, 05:41 AM   #17
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,352

Rep: Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590
Quote:
/dev/sdb6 is supposed to be /
at the grub menu, that come up when you first boot, the picture in your first link.
press e for edit and change these lines to this:
Code:
set root=(hd0,6)

linux   /boot/vmlinuz-5.10.17-lfs-10.1 root=/dev/sda6 ro
press ctrl-x to boot

Last edited by colorpurple21859; 05-18-2021 at 05:46 AM.
 
Old 05-18-2021, 06:20 AM   #18
George528
Member
 
Registered: May 2021
Location: Moldova
Distribution: Arch, Debian
Posts: 95

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by colorpurple21859 View Post
at the grub menu, that come up when you first boot, the picture in your first link.
press e for edit and change these lines to this:
Code:
set root=(hd0,6)

linux   /boot/vmlinuz-5.10.17-lfs-10.1 root=/dev/sda6 ro
press ctrl-x to boot
but the book clearly says that i have to remove /boot from linux code if i have a separate boot partition. Where should i remove it then? i think i misunderstood
 
Old 05-18-2021, 08:45 AM   #19
George528
Member
 
Registered: May 2021
Location: Moldova
Distribution: Arch, Debian
Posts: 95

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by colorpurple21859 View Post
at the grub menu, that come up when you first boot, the picture in your first link.
press e for edit and change these lines to this:
Code:
set root=(hd0,6)

linux   /boot/vmlinuz-5.10.17-lfs-10.1 root=/dev/sda6 ro
press ctrl-x to boot
i did that but i get the following error:

https://i.imgur.com/MwZbYrE.jpg

this what i typed in grub menu

https://i.imgur.com/9tvD0wn.jpg

Last edited by George528; 05-18-2021 at 08:49 AM.
 
Old 05-18-2021, 09:24 AM   #20
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,352

Rep: Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590
Try
Code:
root=(hd0,1) 
linux   /vmlinuz-5.10.17-lfs-10.1 root=/dev/sda1 ro
Try it with /boot also. Change the 1 on each line to 5-9 till you find the kernel
 
Old 05-18-2021, 09:30 AM   #21
George528
Member
 
Registered: May 2021
Location: Moldova
Distribution: Arch, Debian
Posts: 95

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by colorpurple21859 View Post
Try
Code:
root=(hd0,1) 
linux   /vmlinuz-5.10.17-lfs-10.1 root=/dev/sda1 ro
i did

Code:
ls (hd,0)/boot
but it was empty, my /boot directory has no kernel in it

Quote:
Try it with /boot also. Change the 1 on each line to 5-9 till you find the kernel
i know for a fact that root directory is in /dev/sdb6

Last edited by George528; 05-18-2021 at 09:33 AM.
 
Old 05-18-2021, 09:31 AM   #22
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,352

Rep: Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590
You can also use the ls command at the grub prompt to seach
ls (hd0,1)/
ls (hd0,5)/boot
 
Old 05-18-2021, 09:45 AM   #23
George528
Member
 
Registered: May 2021
Location: Moldova
Distribution: Arch, Debian
Posts: 95

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by colorpurple21859 View Post
You can also use the ls command at the grub prompt to seach
ls (hd0,1)/
ls (hd0,5)/boot
i am not sure how this will help me, nor i understand what you are telling me to do
i am trying to boot from LFS's /boot, not initial host's /boot (in my case ubuntu)
 
Old 05-18-2021, 11:05 AM   #24
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,352

Rep: Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590
You don't know what partition the lfs kernel is on or if it is in / of the partition or /boot of the partition. You will need to search through the partitions sda1 and sda5-sda9 to find out where your kernel is located. You can do this from the grub prompt with the ls command or from the host by mounting each partition and do a search until you find it.

Last edited by colorpurple21859; 05-18-2021 at 11:06 AM.
 
Old 05-18-2021, 11:21 AM   #25
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,576
Blog Entries: 19

Rep: Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453
Look, George, I don't want to belittle you or anything. I think it's really impressive that you finished LFS, but I think you should drop it for a while and read up some more about Linux. You need to learn:
1) about partitioning and how to find out quickly what partitions are on a hard drive;
2) about booting and bootloaders, specifically GRUB and how it works;
3) about having a separate boot partition, what goes on it, why, and where you mount it in your different systems.

The book recommends a separate partition because once you have finished your LFS build, you will have at least two independent Linux OS's on your machine. The writers thought it was easier to boot them if you have all the kernels and initrds in one place, though I must admit that I never did it that way.

You say that your boot partition is empty, which suggests to me that perhaps you didn't have it mounted on /boot when you installed your kernel. That also suggests that you didn't really understand what you were doing and why. So I suggest you read up the background stuff, then redo the LFS build from scratch and it should work the second time around.

Last edited by hazel; 05-18-2021 at 11:26 AM.
 
Old 05-18-2021, 11:32 AM   #26
George528
Member
 
Registered: May 2021
Location: Moldova
Distribution: Arch, Debian
Posts: 95

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by hazel View Post
Look, George, I don't want to belittle you or anything. I think it's really impressive that you finished LFS, but I think you should drop it for a while and read up some more about Linux. You need to learn:
1) about partitioning and how to find out quickly what partitions are on a hard drive;
2) about booting and bootloaders, specifically GRUB and how it works;
3) about having a separate boot partition, what goes on it, why, and where you mount it in your different systems;

The book recommends a separate partition because once you have finished your LFS build, you will have at least two independent Linux OS's on your machine. The writers thought it was easier to boot them if you have all the kernels and initrds in one place, though I must admit that I never did it that way.

You say that your boot partition is empty, which suggests to me that perhaps you didn't have it mounted on /boot when you installed your kernel. That also suggests that you didn't really understand what you were doing and why. So I suggest you read up the background stuff, then redo the LFS build from scratch and it should work the second time around.
thanks
i understand what you are saying and agree with it, i will read more about linux (linux bible) but for now i want to finish lfs asap. The GNU tools work perfectly so i don't see why i have to recomplie everything again. I think i will eneter chroot eviroment from live cd and install compile linux kernel and install grub again. i will be more careful this time.

but i don't understand this part from here:

Caution
If the host system has a separate /boot partition, the files copied below should go there. The easiest way to do that is to bind /boot on the host (outside chroot) to /mnt/lfs/boot before proceeding. As the root user in the host system:

Code:
mount --bind /boot /mnt/lfs/boot
what i did was open another terminal without chroot and pasted the command there, because the command wasn't working in chroot. I don't understand why i did this, i already mounted the device in chapter 2.6. Then when i opened gparted to see whats going on. sdb1 (host) was mounted on / and /mnt/lfs/boot, and sdb9 (the /boot partition) was giving me a warning. Then i proceeded to unmount sdb1 (so only / remains). Now that i think of this, that was the mistake i made
 
Old 05-18-2021, 12:12 PM   #27
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,352

Rep: Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590
Your using a live cd, keep it simple, don’t use a boot partition. Mount lfs to /mnt, chroot into lfs, edit the /etc/fstab to only mount the root partition/dev/sda6 and swap partition,re-install your kernel, re-run grub- install, edit the grub.cfg for (hd0,6) /dev/sd6

Last edited by colorpurple21859; 05-18-2021 at 12:16 PM.
 
Old 05-18-2021, 12:14 PM   #28
George528
Member
 
Registered: May 2021
Location: Moldova
Distribution: Arch, Debian
Posts: 95

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by colorpurple21859 View Post
Your using a live cd, keep it simple, don’t use a boot partition. Mount lfs to /mnt, chroot into lfs, re-install your kernel, re-run grub- install, edit the grub.cfg for (hd0,6) /dev/sda6
ok i'll try and tell you later
 
Old 05-18-2021, 12:22 PM   #29
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,576
Blog Entries: 19

Rep: Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453
Quote:
Originally Posted by George528 View Post
but i don't understand this part from here:

Caution
If the host system has a separate /boot partition, the files copied below should go there. The easiest way to do that is to bind /boot on the host (outside chroot) to /mnt/lfs/boot before proceeding. As the root user in the host system:

Code:
mount --bind /boot /mnt/lfs/boot
A "bind" mount causes a partition that is already mounted to be additionally mounted elsewhere. If you look at the pre-chroot instructions, you will see a number of mounts of this kind to bind virtual filesystems on your host, such as /proc and /sys, to your growing LFS system.
Quote:
what i did was open another terminal without chroot and pasted the command there, because the command wasn't working in chroot. I don't understand why i did this, i already mounted the device in chapter 2.6.
No you didn't! You mounted the new LFS system onto Ubuntu's /mnt/lfs. Now you need to check if Ubuntu is using a separate boot partition and bind that to LFS's /boot directory. Not the same thing at all!

Also don't confuse mounting a system with chrooting into it. They are two different things. When you mount you new system on /mnt/lfs, you are just making it accessible from the host system. When you chroot into it, you are turning it into your new temporary root partition (chroot=change root). From that point on, you are in LFS, not Ubuntu, and have no access to any Ubuntu software except the running kernel. Also any paths will be relative to this new root directory. So any binding mounts must be carried out before chrooting.
Quote:
Then when i opened gparted to see whats going on. sdb1 (host) was mounted on / and /mnt/lfs/boot, and sdb9 (the /boot partition) was giving me a warning.
Then you mounted it wrong. You were not told to bind-mount the host's root partition, but to check if there was a separate boot partition and bind-mount that.

Last edited by hazel; 05-18-2021 at 12:33 PM.
 
Old 05-18-2021, 01:14 PM   #30
Bonzoo
Member
 
Registered: Sep 2018
Location: Costa Rica
Distribution: Antix21a2,Parrot rolling,MXfce19.4,Sparky Openbox
Posts: 233

Rep: Reputation: 48
Burn an MX USB, Boot it and select grub repair ? Boot repair ? (= Reinstall grub)
 
  


Reply

Tags
grub



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
Dualboot [HD1: Ubuntu14.04] / [HD2: Win7(truecrypted) ] DexterMorgan Ubuntu 3 04-30-2015 02:30 PM
fixmbr for WinXP killed GRUB-cannot boot into Ubuntu - HD1+HD2 not recognized Mousy Linux - General 9 08-16-2007 05:39 AM
HD1:IDE Suse 10.2 & Windows Xp Pro HD HD2: SATA XP PRO X64 HOW TO MOUNT HD 2 blazintilda2005 Linux - Hardware 1 04-13-2007 08:30 PM
64-bit Suse9.1 on HD1, need WinXP on HD2 sharkcatcher Linux - Newbie 4 01-22-2005 01:16 PM
red hat on hd1 windows on hd2 FireWolf Linux - Newbie 6 02-12-2003 03:40 AM

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

All times are GMT -5. The time now is 07:14 AM.

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