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 10-16-2022, 11:12 PM   #1
Don Pedro
LQ Newbie
 
Registered: Aug 2022
Location: Sydney NSW
Distribution: Archlinux, LFS, Debian.
Posts: 27

Rep: Reputation: 11
Kernel Installation issues, 11.2, section 10.3.1


Hi out there

It's exciting: I'm getting closer and closer. I've managed two installations, on ThinkPads X200 and X230, and each one works, except ... I've had to improvise (cheat?) by manually moving files into place to get it past GRUB. I'm still a little vague, but if I remember it correctly, I had to move the vmlinuz file out of the boot directory on my boot partition, and then the system would boot. But it was different the first time (X230), where I didn't actually have a 'boot' directory on my Boot Partition at all. Sorry to be imprecise.

Clearly I'm making mistakes, and am probably lucky I could get the system up. HOWEVER, I think I'm zeroing in the problem. At the three 'cp' commands at the end of section 10.3.1 I got the error message "no such file or directory" and frankly I can't work out what's going on here. What's with the "arch" image? Yes, I'm using Archlinux as my host system, but the book doesn't know that! Apologies: I copied the terminal output but lost it. Duh. I'll save it next time, perhaps, unless someone can help me solve the issue first. Nothing else SEEMS to be going wrong.

Once again, apologies for not reporting this properly. If I hear nothing, I'll make a bigger effort to save the output. Somehow, I've managed to **** up my root password on the host system, so don't have proper root access.

But I'm getting so close, it's tantalising. Thanks for all the help you experts dish out for us aspirants

Don Pedro

Last edited by Don Pedro; 10-17-2022 at 04:25 AM.
 
Old 10-17-2022, 02:12 AM   #2
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,830
Blog Entries: 1

Rep: Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069
Traditionally, kernels and initrds are kept in /boot/, so this is where bootloaders traditionally to look for them. However, when a separate filesystem is employed to keep these and other boot files, they are expected to be in its root in order for the mounted filesystem to show them in a /boot/ directory while they are normally mounted. The traditional solution for this is a symlink of the current directory of a /boot/ filesystem to a subdirectory named boot:
Code:
# ls -l /boot/boot
lrwxrwxrwx 1 root root 1 May 16  2015 /boot/boot -> .
#
Hopefully this will help with your boot files confusion.
 
Old 10-17-2022, 12:58 PM   #3
Don Pedro
LQ Newbie
 
Registered: Aug 2022
Location: Sydney NSW
Distribution: Archlinux, LFS, Debian.
Posts: 27

Original Poster
Rep: Reputation: 11
Hi Mr Mazda

What you say doesn't immediately solve my problem, and it occurs to me I'd really better make myself clearer. I'll do some thinking and try again. Thank you for your response.
 
Old 10-17-2022, 01:26 PM   #4
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,365

Rep: Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591
Quote:
I've had to improvise (cheat?) by manually moving files into place to get it past GRUB
The grub menyentry in lfs is incorrect if using a boot partition. The "set root=(?,?)" will be set to the boot partition and the linux line will be "linux /vmlinuz-5.19.2-lfs-11.2 root=</dev of lfs filesystem root partition>".
Quote:
but if I remember it correctly, I had to move the vmlinuz file out of the boot directory on my boot partition, and then the system would boot
Move it to where? If you moved it to /boot of the root partition, the vmlinuz will not be seen when the boot partition is mounted to /boot

Quote:
I didn't actually have a 'boot' directory on my Boot Partition at all.
Where was the boot partition mounted? A separate boot partition should be mounted to /boot of the lfs filesystem, When mounted to /boot or any other directory, only kernel, grub directory, and a few other files and directories, no boot directory.

Last edited by colorpurple21859; 10-17-2022 at 05:39 PM.
 
Old 10-18-2022, 12:47 AM   #5
Don Pedro
LQ Newbie
 
Registered: Aug 2022
Location: Sydney NSW
Distribution: Archlinux, LFS, Debian.
Posts: 27

Original Poster
Rep: Reputation: 11
Thanks colorpurple

Again, I realise I should have provided more informative details, and I will; I made a pig's breakfast over this post. To exacerbate, 'other life' has taken over the last couple of days which is why I've not had time to replace my original. But briefly, my grub.cfg was correct (I think!) and exactly as you suggested. My partitioning set up, too, was correct I think, though I noted the recent debate about GPT rather then MBR. It was an MBR table, with a 256M ext4 boot partition, a generous swap, and an ext4 root partition.

What I was confused about was getting the 'file or directory not found' for each of the three cp commands on page 10.3.1 and the truth is I didn't really understand those commands, nor why the first one had the term "arch" in it.

More later, and thanks for the response. Back soon.
 
Old 10-18-2022, 05:25 AM   #6
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,365

Rep: Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591
The cp commands are done while still in the kernel build directory after doing "make modules_install".

"arch" is a directory in the kernel build directory. The new bzImage will be in arch/x86/boot of the kernel build directory regardless of whether it is a 64bit or 32bit kernel.

Last edited by colorpurple21859; 10-18-2022 at 05:28 AM.
 
Old 10-18-2022, 06:26 AM   #7
Don Pedro
LQ Newbie
 
Registered: Aug 2022
Location: Sydney NSW
Distribution: Archlinux, LFS, Debian.
Posts: 27

Original Poster
Rep: Reputation: 11
A fuller report (Don Pedro)

LFS Installation (ThinkPad X200)

Partition Table = Master Boot Record
/dev/sda1 = 268 MB Ext4 Bootable
/dev/sda2 = Swap
/dev/sdae = 16 GB Ext4

After LFS installation:

/dev/sda1
/grub/fonts
/i386-pc
/locale
grub.cfg **
grubenv
vmlinuz-5.19.2-lfs-11.2

I moved the vmlinuz out of the grub directory, after which LFS booted fine.

/dev/sda3 /boot/grub/grub.cfg *


Note that the layouts of the two occurences of 'grub.cfg' differ.

*
# Begin /boot/grub/grub.cfg **
set default=0
set timeout=5
insmod ext2
set root=(ahci0,msdos1)
menuentry "GNU/Linux, Linux 5.19.2-lfs-11.2" {
linux /vmlinuz-5.19.2-lfs-11.2 root=/dev/sda3 ro
}

**
set default=0
set timeout=5

insmod ext2
set root=(ahci0,msdos1)

menuentry "GNU/Linux, Linux 5.19.2-lfs-11.2" {
linux /vmlinuz-5.19.2-lfs-11.2 root=/dev/sda3 ro
}

======

The original question of my post was regard to page 10.3.1 of the 11-2 book. On each of the 3 'cp' commands, terminal output was 'no such file or directory'. I ignored that and pressed ahead, but wondered if doing so was the reason for the initial boot failure, and the grub anomalies. I did/do not understand these commands and hoped someone could explain them. In particular, what is 'arch/x86/boot/bzimage'?

After 'shutdown -r now' booting started but LFS would not progress past the GRUB screen, so I rebooted from the Host System (Archlinux) and moved the vmlinuz file OUT of the grub directory on the boot partition, where I had found it. After that the new system booted fine.
 
Old 10-18-2022, 06:27 AM   #8
Don Pedro
LQ Newbie
 
Registered: Aug 2022
Location: Sydney NSW
Distribution: Archlinux, LFS, Debian.
Posts: 27

Original Poster
Rep: Reputation: 11
Thanks colorpurple for explaining the 'arch' item.
 
Old 10-19-2022, 06:56 PM   #9
Don Pedro
LQ Newbie
 
Registered: Aug 2022
Location: Sydney NSW
Distribution: Archlinux, LFS, Debian.
Posts: 27

Original Poster
Rep: Reputation: 11
I'm going to recast aspects of this question as a New Thread. Sorry if I've been confusing.
 
Old 10-20-2022, 08:41 AM   #10
wiigelec
Member
 
Registered: Nov 2021
Distribution: Devuan
Posts: 67

Rep: Reputation: Disabled
Quote:
In particular, what is 'arch/x86/boot/bzimage'?
this is the compressed kernel image. the three copy (cp) commands copy the kernel image (bzImage), the kernel config file (.config) and the kernel map file (System.map) from the build directory into the system /boot directory. these files are renamed to differentiate them from other kernel files that may be used on the same system

the placement of these files into the /boot directory is arbitrary, as technically they can be placed anywhere accessible to the boot loader (grub) as long as the boot loader is appropriately informed of their location

Last edited by wiigelec; 10-20-2022 at 08:43 AM.
 
Old 10-20-2022, 10:04 AM   #11
wiigelec
Member
 
Registered: Nov 2021
Distribution: Devuan
Posts: 67

Rep: Reputation: Disabled
Quote:
On each of the 3 'cp' commands, terminal output was 'no such file or directory'.
please post the output of findnmt when you get the error with cp

eta: also please post output of pwd when you get the cp error

Last edited by wiigelec; 10-20-2022 at 10:08 AM.
 
Old 10-20-2022, 10:18 AM   #12
wiigelec
Member
 
Registered: Nov 2021
Distribution: Devuan
Posts: 67

Rep: Reputation: Disabled
Quote:
Note that the layouts of the two occurences of 'grub.cfg' differ.
this is all dependent on whether or not you have /dev/sda1 mounted to /boot when you run the grub-install /dev/sda command

if /dev/sda1 is not mounted to /boot when you run grub-install then the grub files will be installed to /boot on the root file system partition which would be /dev/sda3/boot

if /dev/sda1 is mounted to /boot when you on run grub-install then the grub files will be installed to the root level of /dev/sda1 since the /boot directory is on /dev/sda3 partition but its contents reside on /dev/sda1 partition

eta:

Quote:
After LFS installation:

/dev/sda1
/grub/fonts
/i386-pc
/locale
grub.cfg **
grubenv
vmlinuz-5.19.2-lfs-11.2

I moved the vmlinuz out of the grub directory, after which LFS booted fine.

/dev/sda3 /boot/grub/grub.cfg *
i see what you are saying here with the grub.cfg file not being in the grub directory. hard to say what would cause this to happen. i would delete the contents of the boot directory and the /dev/sda1 partition, mount /dev/sda1 to /boot, and rerun grub-install /dev/sda. better yet, i would forget about the separate /boot partition for now and just run everything off /dev/sda3 until you get that working the way you expect, then add in the additional layer of complexity with the /dev/sda1 /boot partition

Last edited by wiigelec; 10-20-2022 at 10:35 AM.
 
Old 10-20-2022, 12:17 PM   #13
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,365

Rep: Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591
Based on this, it looks like at one point the boot partition was mounted to /boot/grub and not /boot and maybe at one point installed grub without the boot partition mounted /boot.
Quote:
/dev/sda1
/grub/fonts
/i386-pc
/locale
grub.cfg **
grubenv
vmlinuz-5.19.2-lfs-11.2

Last edited by colorpurple21859; 10-20-2022 at 12:21 PM.
 
Old 10-20-2022, 07:46 PM   #14
Don Pedro
LQ Newbie
 
Registered: Aug 2022
Location: Sydney NSW
Distribution: Archlinux, LFS, Debian.
Posts: 27

Original Poster
Rep: Reputation: 11
I've since managed to disentangle this, and (having started 'from scratch'!! again) had a success, which boots fine = doesn't need 'tinkering' with. Thanks to everyone, I've learned a lot in this process.

The 'from scratch' thing isn't really a joke. I've gone back and restarted quite a few times, but by now have evolved a 'script' which works.
 
  


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
[SOLVED] LFS 7.2, chapter 5., section 5.4.1 Installation of Cross Binutils Lakhan Kumar Linux From Scratch 7 11-12-2012 04:22 PM
[SOLVED] Problems in glibc section section 5.7.1 lfs 6.7 abhiklall Linux From Scratch 1 04-19-2011 02:42 AM
make fails in section 6.16.1. Installation of GCC ankycooper Linux From Scratch 3 02-25-2011 01:58 AM
network printer installation in user/passwd section shibu_sp Linux - Newbie 1 08-29-2007 03:00 PM
Confused with Mandriva 2007 Free installation (bootloader section) suselinuxfan Mandriva 3 11-04-2006 04:59 PM

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

All times are GMT -5. The time now is 02:00 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