LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 10-02-2017, 10:23 AM   #1
Time4Tea
LQ Newbie
 
Registered: Oct 2017
Posts: 16

Rep: Reputation: Disabled
Linux Kernel Loading Issue - GRUB


Hi, this is my first post on here.

I'm trying to boot up a linux kernel that I've compiled for the first time and I seem to be having some problems. The kernel version is 4.13.1 (linux-libre) and I am trying to compile and install it on a Macbook (Intel Core 2 Duo, 64-bit) that has the free Libreboot firmware installed, with GRUB2 as a payload. I have Trisquel GNU/Linux (version 7) installed on it already, so I know it is possible to boot up GNU/Linux on this hardware/firmware configuration.

I've made a separate partition where I have created a minimal Linux From Scratch (LFS) system, which I am trying to boot with the new kernel. The root partition for LFS is /dev/sda4; Trisquel is intalled on /dev/sda1. I have also created another partition, /dev/sda2, which I want to use as the /boot partition for LFS, which is where I have installed the newly-compiled kernel.

So, (I think) I have all of the files built and installed in the right places and I am trying to boot the system for the first time. This is what I am typing at the GRUB command prompt:

grub> insmod ext2
grub> set root=(ahci0,gpt2)
grub> linux /vmlinuz-4.13.1-lee1 root=/dev/sda4 ro
grub> boot

(LFS doesn't use initrd)

When I press return after typing 'boot', the GRUB cursor moves to a newline and then everything hangs. I don't see any kernel boot text at all.

Does anyone know what the problem here might be, or have any idea where I should start to debug it? I can boot the Triquel system from the GRUB command line, so it seems like there must be some problem with my kernel configuration /build.

Thanks in advance!
 
Old 10-03-2017, 07:04 PM   #2
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
A lot of times folks make some errors during the configuration and don't realize it.

This is a good guide and it should help if you would like to follow it.

http://www.berkes.ca/guides/linux_kernel.html

There are thousands of ways to configure a kernel and if it's your first time it can be tricky.
Try that link.

-::-If the compilation gives an error check the configuration. Compile Errors are usually caused by fault .conffile.-::-

Do you just have a grub prompt or grub rescue?
 
Old 10-03-2017, 07:08 PM   #3
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
http://www.tldp.org/LDP/lfs/LFS-BOOK...er08/grub.html

HTH
 
Old 10-03-2017, 10:26 PM   #4
Time4Tea
LQ Newbie
 
Registered: Oct 2017
Posts: 16

Original Poster
Rep: Reputation: Disabled
Thanks for the links, Ztcoracat. I will read those and see if they help. I am currently going through the .config file for the pre-packaged kernel that does boot up and comparing it with the one I've compiled, to see if there are any differences that might give me a clue. I'll let you know if I get it working
 
Old 10-04-2017, 10:14 AM   #5
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
Originally Posted by Time4Tea View Post
Thanks for the links, Ztcoracat. I will read those and see if they help. I am currently going through the .config file for the pre-packaged kernel that does boot up and comparing it with the one I've compiled, to see if there are any differences that might give me a clue. I'll let you know if I get it working
You're Welcome.

Hope you can get it working.

If not you could always start over if need be:- <hope not>
 
Old 10-06-2017, 06:12 AM   #6
Time4Tea
LQ Newbie
 
Registered: Oct 2017
Posts: 16

Original Poster
Rep: Reputation: Disabled
So, I took the .config file for the pre-packaged kernel that does boot up (vmlinuz-3.13.0-132-lowlatency) and ran 'make oldconfig' on that in the source tree for the new kernel I am trying to build (linux 4.13.1). That took a while, as I had to go through and yay/nay all the options that had been added between those two versions. I then went into menuconfig and stripped out all the device modules that obviously don't apply to my system (as I didn't want it to take 2 days to compile).

At first, I got a compiler error about not having openssl, which isn't included in the basic LFS, so I installed that. After that, everything seemed to compile fine with no errors. I copied the new kernel into the /boot partition and rebooted into GRUB, tried to boot the kernel, but I'm still getting the same hanging on the GRUB command line.

I'm not really sure where to go from here. I wasn't expecting it to work first time, but I was hoping to at least see some boot log text, which might give me a clue. Is there anything else I can do, in terms of debugging or checking the kernel that I've built before I try to boot with it?

I also tried copying the pre-packed 3.13 kernel into the /boot partition, in case there was some issue there, but I can still boot up Trisquel just fine with it.

(P.S. To answer the question you asked before, Ztcoracat, I have a grub prompt, not grub rescue)
 
1 members found this post helpful.
Old 10-06-2017, 08:58 PM   #7
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Does booting into Trisquel and updating Grub show LFS?

Are you getting any errors when the system tries to boot but hangs?

Is there a 'menuentry for LFS in your grub.cfg?

- the set root=(...) entry should point to your boot partition,
- the root=/dev/... entry points to your root partition.

Quote:
I have also created another partition, /dev/sda2, which I want to use as the /boot partition for LFS,
Than unless I am mistaken; your "set root=" should point to /dev/sda2 (hd0,2 <OR> whatever it is on your machine)

How to debug a Linux kernel that freezes during boot
https://stackoverflow.com/questions/...es-during-boot

https://www.linuxquestions.org/quest...st-4175427842/

See post #6 and post #8 for an example-
https://www.linuxquestions.org/quest...-grub2-921286/
 
1 members found this post helpful.
Old 10-07-2017, 11:03 PM   #8
Time4Tea
LQ Newbie
 
Registered: Oct 2017
Posts: 16

Original Poster
Rep: Reputation: Disabled
Thanks again for the advice, Ztcoracat. I'm still trying to work through and figure out what the problem is. One question I have is that the documentation for the 4.13.1 kernel says that module-init-tools is required; however LFS includes kmod instead. I understand that module-init-tools is now defunct and kmod is the replacement (which I should use). Is that correct?

To answer your questions:

Quote:
Does booting into Trisquel and updating Grub show LFS?
I haven't tried this, but perhaps I should. Although, with the LFS /boot and root directories on different partitions, I'm not sure how GRUB would find it without me editing a config file.

Quote:
Are you getting any errors when the system tries to boot but hangs?
No, nothing at all. After I type 'boot' at the GRUB prompt and press return, the GRUB cursor moves to a new line and nothing else happens.

Quote:
Is there a 'menuentry for LFS in your grub.cfg?
No, I'm not using a GRUB config file atm. I wanted to try to get it working from the command line first, before getting into the config files. Trisquel seems to boot fine from the command line.

Quote:
- the set root=(...) entry should point to your boot partition,
- the root=/dev/... entry points to your root partition.
Yes, this is what I have been doing.

Quote:
Than unless I am mistaken; your "set root=" should point to /dev/sda2 (hd0,2 <OR> whatever it is on your machine)
I've been using set root=(ahci0,gpt2), which is how GRUB seems to be designating /dev/sda2, according to the 'ls' command (within GRUB). Again, this is working fine for Trisquel with the pre-packaged kernel, so I'm fairly sure the problem isn't down to the way I'm handling the GRUB part of it.

It seems to me that either the kernel is incorrectly configured, or there is something wrong with the LFS toolchain I am using. I may try to compile it using the Trisquel toolchain, to see if that fares any better.
 
Old 10-08-2017, 01:45 PM   #9
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
You're Welcome.

Yes, you should use kmod.
I'd stick with what the LFS documentation recommends.

Quote:
No, I'm not using a GRUB config file atm. I wanted to try to get it working from the command line first, before getting into the config files. Trisquel seems to boot fine from the command line.
Ok than go with getting it to work from the cmd-line and see how it goes.

Quote:
No, nothing at all. After I type 'boot' at the GRUB prompt and press return, the GRUB cursor moves to a new line and nothing else happens.
Since your not getting any errors maybe have a look at the boot log:-

Quote:
, I'm not sure how GRUB would find it without me editing a config file.
Yup, your right-
Otherwise; Grub wouldn't know where to look to boot:-

Quote:
It seems to me that either the kernel is incorrectly configured, or there is something wrong with the LFS toolchain I am using. I may try to compile it using the Trisquel toolchain, to see if that fares any better.
IF I had to guess it's the kernel configured incorrectly.
A lot of people make mistakes at first (and when it's the first go at it) when compiling a new kernel or miss something during the process.

I personally read all of the documentation I could get my hands on for about 2 months before I fully understood how to compile and install a new kernel.

I'm not sure if the Trisquel toolchain would fair any better as I'm not familiar with it.

Did you get any errors during compilation?
 
1 members found this post helpful.
Old 10-08-2017, 09:31 PM   #10
Time4Tea
LQ Newbie
 
Registered: Oct 2017
Posts: 16

Original Poster
Rep: Reputation: Disabled
Ok, I think I've managed to make some progress ...

I re-compiled the kernel using the Trisquel toolchain, with the exact same (copy-pasted) .config file. It seemed to build ok - there were a handful of compiler warnings, but nothing that looked too serious. I then tried to boot with that kernel and it also failed to boot up or print any text to the console; however, the screen did turn black a couple of times, which it hadn't done with the kernel I compiled using the LFS toolchain. Although, it still didn't boot up or give me any log text.

However, I had a look at the /var/log/boot.log file on the LFS system, and there was some text in there:

Quote:
Oct 08 22:09:17 -04:00 (none) Mounting virtual file systems: /run /proc /sys OK
Oct 08 22:09:18 -04:00 (none) Bringing up the loopback interface... OK
Oct 08 22:09:18 -04:00 (none) Setting hostname to <lee_lfs>... OK
Oct 08 22:09:18 -04:00 <lee_lfs> Populating /dev with device nodes... OK
Oct 08 22:09:24 -04:00 <lee_lfs> Activating all swap files/partitions... OK
Oct 08 22:09:24 -04:00 <lee_lfs> Mounting root file system in read-only mode... OK
Oct 08 22:09:24 -04:00 <lee_lfs> Checking file systems... OK
Oct 08 22:09:25 -04:00 <lee_lfs> Remounting root file system in read-write mode... OK
Oct 08 22:09:25 -04:00 <lee_lfs> Mounting remaining file systems... OK
Oct 08 22:09:25 -04:00 <lee_lfs> Cleaning file systems: /tmp OK
Oct 08 22:09:25 -04:00 <lee_lfs> Retrying failed uevents, if any... OK
Oct 08 22:09:25 -04:00 <lee_lfs> Starting system log daemon... OK
Oct 08 22:09:25 -04:00 <lee_lfs> Starting kernel log daemon... OK
Oct 08 22:09:26 -04:00 <lee_lfs> Bringing up the eth0 interface...
Oct 08 22:09:26 -04:00 <lee_lfs> Adding IPv4 address 192.168.1.2 to the eth0 interface... OK
Oct 08 22:09:26 -04:00 <lee_lfs> Setting up default gateway... OK
Oct 08 22:09:26 -04:00 <lee_lfs> Bringing up the wlan0 interface...
Oct 08 22:09:26 -04:00 <lee_lfs> Adding IPv4 address 192.168.1.3 to the wlan0 interface... OK
SKIP
--------
So, the kernel is loading up and doing something. It has clearly managed to mount the LFS root partition, as it is logging to this file. Seems like it is trying to initialize the network devices and then either falling over or switching to a different logging file/device, which I'm not aware of.

I'll keep poking around and see if I can find anything else. There were a couple of very similar logs in that same file, from earlier booting attempts.
 
Old 10-08-2017, 09:43 PM   #11
Time4Tea
LQ Newbie
 
Registered: Oct 2017
Posts: 16

Original Poster
Rep: Reputation: Disabled
Oh, here we go .. /var/log/kern.log contains the full bootlog text! Jeez, I feel like a dummy for not noticing this before :-)

It's pretty long, but these are the first few lines:

Quote:
Oct 8 19:14:46 <lee_lfs> kernel: klogd 1.5.1, log source = /proc/kmsg started.
Oct 8 19:14:46 <lee_lfs> kernel: Cannot find map file.
Oct 8 19:14:46 <lee_lfs> kernel: Loaded 104687 symbols from 28 modules.
Oct 8 19:14:46 <lee_lfs> kernel: [ 0.000000] random: get_random_bytes called from start_kernel+0x33/0x3f2 with crng_init=0
Oct 8 19:14:46 <lee_lfs> kernel: [ 0.000000] Linux version 4.13.1-gnu (lee@lee-LibreBook) (gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)) #1 SMP PREEMPT Sun Oct 8 17:13:36 EDT 2017
Oct 8 19:14:46 <lee_lfs> kernel: [ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-4.13.1-lfs-8.1 root=/dev/sda4 ro
Oct 8 19:14:46 <lee_lfs> kernel: [ 0.000000] KERNEL supported cpus:
Oct 8 19:14:46 <lee_lfs> kernel: [ 0.000000] Intel GenuineIntel
Oct 8 19:14:46 <lee_lfs> kernel: [ 0.000000] AMD AuthenticAMD
Oct 8 19:14:46 <lee_lfs> kernel: [ 0.000000] Centaur CentaurHauls
Oct 8 19:14:46 <lee_lfs> kernel: [ 0.000000] x86/fpu: x87 FPU will use FXSAVE
Oct 8 19:14:46 <lee_lfs> kernel: [ 0.000000] e820: BIOS-provided physical RAM map:
Eventually, it ends up here:

Quote:
Oct 8 19:14:46 <lee_lfs> kernel: [ 11.484369] EXT4-fs (sda5): mounting ext3 file sys
tem using the ext4 subsystem
Oct 8 19:14:46 <lee_lfs> kernel: [ 11.575684] EXT4-fs (sda5): mounted filesystem wit
h ordered data mode. Opts: barrier=1
Oct 8 19:14:46 <lee_lfs> kernel: [ 12.279698] sky2 0000:01:00.0 eth0: enabling inter
face
Oct 8 19:14:46 <lee_lfs> kernel: [ 12.279808] IPv6: ADDRCONF(NETDEV_UP): eth0: link
is not ready
Oct 8 19:14:46 <lee_lfs> kernel: [ 12.359716] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
Oct 8 19:14:46 <lee_lfs> kernel: [ 12.731755] evbug: Event. Dev: input3, Type: 3, Code: 0, Value: 2
Oct 8 19:14:46 <lee_lfs> kernel: [ 12.731757] evbug: Event. Dev: input3, Type: 0, Code: 0, Value: 0
Oct 8 19:14:48 <lee_lfs> kernel: [ 14.604899] evbug: Event. Dev: input3, Type: 3, Code: 0, Value: 4
and then it seems to get stuck in this 'evbug' loop that it can't seem to get out of. So, this seems to be an issue, as well as the fact that it isn't initializing the screen/console properly.
 
1 members found this post helpful.
Old 10-08-2017, 09:48 PM   #12
Time4Tea
LQ Newbie
 
Registered: Oct 2017
Posts: 16

Original Poster
Rep: Reputation: Disabled
I guess what I can do now is compare this to the log for the pre-packaged kernel and try to see what it is doing differently ..
 
1 members found this post helpful.
Old 10-09-2017, 12:09 PM   #13
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
Originally Posted by Time4Tea View Post
I guess what I can do now is compare this to the log for the pre-packaged kernel and try to see what it is doing differently ..
Yeah, I would compare the and see what's different.

There are a few things that I'm not sure are a problem or not but they stood out to me when I read them.

Code:
Oct 8 19:14:46 <lee_lfs> kernel: Cannot find map file.

Oct 8 19:14:46 <lee_lfs> kernel: [ 12.279808] IPv6: ADDRCONF(NETDEV_UP): eth0: link
is not ready
I know that the map file is important and I think it's needed for proper booting. Our Guru business_kid explains it here:
https://www.linuxquestions.org/quest...p-file-689274/

The IPv6: ADDRCONF message is related to your wireless connection.


The evbug that you can't seem to get out of is greek to me. Sorry.
- Here's a Solved thread with similar output as yours.
https://www.linuxquestions.org/quest...syslog-785238/

The evbug is a bug in Ubuntu:
https://bugs.launchpad.net/ubuntu/+s...ls/+bug/240553

You said you had a black screen, have a look here.
https://unix.stackexchange.com/quest...t-black-screen
 
Old 10-09-2017, 12:55 PM   #14
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
I found out that the system.map file is a symbol table used by the kernel.

When you ran 'make install' did you copy the kernel and the .config file to the /boot folder to generate the system.map file?
 
Old 10-09-2017, 02:32 PM   #15
Time4Tea
LQ Newbie
 
Registered: Oct 2017
Posts: 16

Original Poster
Rep: Reputation: Disabled
Thanks again for your comments, Ztcoracat. Regarding the System.map thing, it seems like that may be part of the problem, as the pre-packaged Trisquel kernel doesn't throw that error. However, I have exactly followed the LFS instructions, given here. This is the command I used to copy System.map, from the top of the linux source tree, as root:

Quote:
cp -v System.map /boot/System.map-4.12.7
Except that I substituted '4.12.7' for '4.13.1', as that is the kernel version I am trying to build (my current kernel is called vmlinuz-4.13.1-lee1). I have also gone into the LFS /boot directory and verified that the file copied ok.

In that other thread you linked, business_kid said that doing that should solve the problem. However, another user posted at the end to say that they also could not resolve the problem using his instructions.

Possibly there is an unresolved issue here?
 
1 members found this post helpful.
  


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
grub file issue in loading splashimage Izra Linux - Software 5 11-21-2013 08:05 AM
Issue with loading kqemu module into linux kernel ba$h Linux - Virtualization and Cloud 7 08-27-2010 07:04 AM
tried to delete linux partition. restart grub loading stagel1.5. grub loading, please aknntharnld Linux - Newbie 8 12-04-2009 06:51 PM
Grub loading issue. [USB related] RaptorX Linux - Software 4 08-08-2009 10:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

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