0

I've been trying to get a Linux kernel to run that I've configured and compiled myself, but so far without success. The machine is an Apple Macbook (Intel Core 2 Duo, 64-bit) that has the free Libreboot firmware installed, with GRUB2 as a payload. I am trying to use this custom kernel to boot up a Linux From Scratch installation that I have built. I have Trisquel GNU/Linux (version 7) installed on another partition on the machine, which works fine, so I know it is possible to boot up GNU/Linux on this hardware/firmware configuration.

The kernel version is 4.13.1 (linux-libre) and it is the first time I've tried to compile my own kernel. When I try to boot it from the GRUB command prompt, the screen goes black and no output shows; however, it does write to the /var/log/kern.log file. In particular, I am puzzled by the following message at the start of the log file:

Oct 9 17:24:17 <lee_lfs> kernel: klogd 1.5.1, log source = /proc/kmsg started.
Oct 9 17:24:17 <lee_lfs> kernel: Inspecting /boot/System.map
Oct 9 17:24:17 <lee_lfs> kernel: Cannot find map file.
Oct 9 17:24:17 <lee_lfs> kernel: Loaded 100800 symbols from 32 modules.
Oct 9 17:24:17 <lee_lfs> kernel: [ 0.000000] random: get_random_bytes called from start_kernel+0x30/0x3bc with crng_init=0
Oct 9 17:24:17 <lee_lfs> kernel: [ 0.000000] Linux version 4.13.1-gnu (nobody@lee-LibreBook) (gcc version 7.2.0 (GCC)) #1 SMP PREEMPT Mon Oct 9 13:39:53 EDT 2017 

The second line down there seems to indicate that it has found the /boot/System.map file; however, the following line suggests that the file is being rejected (which I suspect may be at least partly responsible for the failure of the kernel to fully boot up).

Does anyone have any idea of what might be causing this? I asked this question before on the Linux Questions site (link here); however, no-one there was able to figure it out. (That link contains some more background to the problem and things that have been suggested before).

Edit - to answer a suggestion that was made in the comments:

One user suggested that the 'Inspecting ...' line might not literally mean that klogd is accessing the file, but might just mean that it has started looking for it. However, I initially had forgotten to add a line in /etc/fstab for the /boot partition (in which case, it obviously wouldn't be able to find the file) and that 'Inspecting ...' line wasn't being printed. It was only after I fixed /etc/fstab that that line started to appear in the log, and with the correct path to the map file. This is why I suspect that klogd is finding the map file, but doesn't seem to be accepting it for some reason.

  • 1
    No a specialist, but as I read it, Inspecting /boot/System.map is hist an announcement that any following message will be about /boot/System.map but this doesn't mean it has already even attempted to open it. So IMHO it's not rejected, it is just not found exactly as the Cannot find map file message implies. – xenoid Oct 27 '17 at 22:22
  • Thanks for your comment, xenoid. However, previously I had forgotten to add a line in /etc/fstab for the /boot partition (in which case it obviously wouldn't be able to locate the file) and that 'Inspecting ...' line wasn't being printed. After I rectified /etc/fstab, that line appeared, with the correct path to the file, which is why I suspect that klogd is finding the map file, but just doesn't 'like' it, for some reason. – Time4Tea Oct 28 '17 at 0:22
2

So, I've been digging through the source code for klogd, and I think I know what the answer is:

Firstly, the Inspecting ... line does indeed mean that klogd has found the map file in that location and has successfully opened it.

However, the reason it is printing the Cannot find map file. line is because it is looking for a line in the map file of the form:

[address] [type] _Version_XXXXX

where 'XXXXX' is the kernel version, encoded in base 256.

However, this version line is not present in any of the map files that have been generated during my kernel build (nor in the map files that are supplied with my pre-packaged Trisquel installation). So, because it can't find this version line, klogd is rejecting the map file.

Obviously, this leads to further questions, though ...

Edit: I have created these follow-on questions:

How big a problem is 'Cannot find map file.' boot message?

Why does my System.map file not contain a 'Version_XXXXX' line?

Edit: I added a 'dummy' version line to the start of my System.map file:

0FFFFFFFFFFFFFFF d Version_265223

The address is one that shouldn't exist in the virtual memory map (so hopefully shouldn't interfere or clash with any other symbols in the file). '265223' is my kernel version (4.12.7) encoded in base 256. I now get the following in my kern.log file on booting:

Nov  3 19:12:02 <lee_lfs> kernel: klogd 1.5.1, log source = /proc/kmsg started.
Nov  3 19:12:02 <lee_lfs> kernel: Inspecting /boot/System.map-4.12.7
Nov  3 19:12:02 <lee_lfs> kernel: Loaded 86148 symbols from /boot/System.map-4.12.7.
Nov  3 19:12:02 <lee_lfs> kernel: Symbols match kernel version 4.12.7.
Nov  3 19:12:02 <lee_lfs> kernel: Loaded 11257 symbols from 31 modules.

So it seems to have worked - klogd finally recognized the map file! The kernel still didn't boot up, although that is probably due to another problem, which I'll have to look into next. This seems to work as a temporary fix for now; however, I will contact the kernel dev team to see what is going on with this.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.