# [solved] rebuilding the kernel

## iurii

Hello,

I ask for help in rebuilding the kernel (I’ve been doing something wrong for the fourth time)

Download with lilo aborts with an error:

```
[   1.769766]List of all partitions:

[   1.769822]No filesystem could mount root, tried:

[   1.769823]

[   1.769919]Kernel panic – not syncing:VFS:Unable to mount root fs on unknown-block(8,6)

[   1.769992]CPU: 0 PID:1 Comm: swapper Not tainted 4.19.97-gentoo-x86_64 #1

[   1.770045]Hardware name: ASUSTeK Computer Inc. K50C/K50C, BIOS 209 01/06/2010

[   1.770115]Call Trace:

[   1.770174]panic+0xdf/0x234

[   1.770226]mount_block_root+0x2e3/0x307

[   1.770279]prepare_namespace+0x136/0x16c

[   1.770329]kernel_init_freeable+0x1aa/0x1b8

[   1.770382]? rest_init+0x81/0x81

[   1.770430]kernel_init+0xa/0xfa

[   1.770480]ret_from_fork+0x35/0x40

[   1.770533]Kernel Offset: 0x1e000000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)

[   1.770610]---[ end Kernel panic – not syncing:VFS: Unable to mount root fs on unknown-block(8,6)]---
```

Fortunately, I have an old bootable kernel vmlinuz-4.19.86-gentoo-x86_64.

I go into the /etc/kernels directory and move kernel-config-4.19.97-gentoo-x86_64 from it, leaving only kernel-config-4.19.86-gentoo-x86_64.

(As i understand, it is this kernel-config-4.19.86-gentoo-x86_64 file that is used as a starting configuration when running  genkernel --menuconfig all.)

And then I change the two items in the menuconfig  : 1)Processor family “Intel P4/older Netburst based Xeon” 2) turn off “symmetric multi-processing support”.

Then I save and close menuconfig   and wait for the end of genkernel's work. But I get a kernel vmlinuz-4.19.97-gentoo-x86_64 unable to boot. 

What am I doing wrong ?Last edited by iurii on Fri Feb 21, 2020 11:14 am; edited 1 time in total

----------

## jfp

 *Quote:*   

> (As i understand, it is this kernel-config-4.19.86-gentoo-x86_64 file that is used as a starting configuration when running  genkernel --menuconfig all.) 

 

This is wrong. See the output below where I installed a new gentoo-sources (gentoo-sources-4.19.102).

(obviously all of the commands shown below need to be run as root)

The first run of genkernel all uses the config: Using kernel config file '/usr/share/genkernel/arch/x86_64/generated-config' ..

This is some generic config that may or may not work. 

It does not make any effort to copy your old config or make any use of it at all

To fix that I cd'd to /etc/kernels and ran the cp command shown below.

Then I ran genkernel again. This time it used the config: Using kernel config file '/etc/kernels/kernel-config-4.19.102-gentoo-x86_64' ...

There are other ways to get the kernel .config file as well but this method works. (Note: I did not allow either genkernel run to complete and I never booted what would been the new kernel.

Also remember to run the grub-mkconfig command after genkernel to update your /boot/grub/grub.cfg (That seems to be the documented default location/name, but it may or may not be what your using)

```
NAShost /etc/kernels # emerge =sys-kernel/gentoo-sources-4.19.102 -a

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild  NS   ~] sys-kernel/gentoo-sources-4.19.102:4.19.102::gentoo [4.19.86:4.19.86::gentoo, 4.19.96:4.19.96::gentoo, 4.19.97:4.19.97::gentoo] USE="experimental -build -symlink" 2,962 KiB

Total: 1 package (1 in new slot), Size of downloads: 2,962 KiB

Would you like to merge these packages? [Yes/No] 

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) sys-kernel/gentoo-sources-4.19.102::gentoo

>>> Installing (1 of 1) sys-kernel/gentoo-sources-4.19.102::gentoo

>>> Recording sys-kernel/gentoo-sources:4.19.102 in "world" favorites file...

>>> Jobs: 1 of 1 complete                           Load avg: 0.75, 0.23, 0.07

>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.

 * GNU info directory index is up-to-date.

NAShost /etc/kernels # eselect kernel list

Available kernel symlink targets:

  [1]   linux-4.19.86-gentoo

  [2]   linux-4.19.97-gentoo *

  [3]   linux-4.19.102-gentoo

NAShost /etc/kernels # eselect kernel set 3

NAShost /etc/kernels # genkernel all

* Gentoo Linux Genkernel; Version 4.0.2

* Using genkernel configuration from '/etc/genkernel.conf' ...

* Running with options: all

* Working with Linux kernel 4.19.102-gentoo for x86_64

* Using kernel config file '/usr/share/genkernel/arch/x86_64/generated-config' ...

* 

* Note: The version above is subject to change (depends on config and status of kernel sources).

* kernel: >> Initializing ...

*         >> Running 'make mrproper' ...

*         >> Running 'make oldconfig' ...

*         >> Re-running 'make oldconfig' due to changed kernel options ...

*         >> Kernel version has changed (probably due to config change) since genkernel start:

*            We are now building Linux kernel 4.19.102-gentoo-x86_64 for x86_64 ...

*         >> Compiling 4.19.102-gentoo-x86_64 bzImage ...

^C

* Genkernel was unexpectedly terminated (signal SIGINT received).

* Please consult '/var/log/genkernel.log' for more information and any

* errors that were reported above.

NAShost /etc/kernels # ls -al

total 551

drwxr-xr-x   2 root root     14 Jan 19 08:09 .

drwxr-xr-x 103 root root    191 Feb 18 09:22 ..

-rw-r--r--   1 root root 112141 Jan 17 08:12 kernel-config-4.19.82-gentoo-x86_64

-rw-r--r--   1 root root 112587 Feb  7 07:46 kernel-config-4.19.86-gentoo-x86_64

-rw-r--r--   1 root root 117167 Dec 31 08:09 kernel-config-4.19.88-gentoo-x86_64

-rw-r--r--   1 root root 117190 Jan  2 08:57 kernel-config-4.19.91-gentoo-x86_64

-rw-r--r--   1 root root 117238 Jan  9 12:38 kernel-config-4.19.93-gentoo-x86_64

-rw-r--r--   1 root root 117271 Jan 18 07:16 kernel-config-4.19.96-gentoo-x86_64

-rw-r--r--   1 root root 117271 Feb  7 14:52 kernel-config-4.19.97-gentoo-x86_64

NAShost /etc/kernels # cp kernel-config-4.19.97-gentoo-x86_64 kernel-config-4.19.102-gentoo-x86_64

NAShost /etc/kernels # genkernel all

* Gentoo Linux Genkernel; Version 4.0.2

* Using genkernel configuration from '/etc/genkernel.conf' ...

* Running with options: all

* Working with Linux kernel 4.19.102-gentoo-x86_64 for x86_64

* Using kernel config file '/etc/kernels/kernel-config-4.19.102-gentoo-x86_64' ...

* 

* Note: The version above is subject to change (depends on config and status of kernel sources).

* kernel: >> Initializing ...

*         >> Previous config backed up to .config--2020-02-18--09-24-37.bak

*         >> Running 'make mrproper' ...

*         >> Running 'make oldconfig' ...

*         >> Re-running 'make oldconfig' due to changed kernel options ...

*         >> Compiling 4.19.102-gentoo-x86_64 bzImage ...

^C

* Genkernel was unexpectedly terminated (signal SIGINT received).

* Please consult '/var/log/genkernel.log' for more information and any

* errors that were reported above.

NAShost /etc/kernels # ^C

```

----------

## iurii

 *jfp wrote:*   

>  *Quote:*   (As i understand, it is this kernel-config-4.19.86-gentoo-x86_64 file that is used as a starting configuration when running  genkernel --menuconfig all.)  
> 
> This is wrong. See the output below where I installed a new gentoo-sources (gentoo-sources-4.19.102).
> 
> (obviously all of the commands shown below need to be run as root)
> ...

 

The second line in all files in the /etc/kernels directory contains an instruction DO NOT EDIT. Can it be ignored? 

And I did not find the “Intel P4/older Netburst based Xeon” and “symmetric multi-processing support” lines in the kernel config files. How to recognize them there?

----------

## NeddySeagoon

iurii,

```
[   1.769919]Kernel panic – not syncing:VFS:Unable to mount root fs on unknown-block(8,6) 
```

The kernel is trying to mount  /dev/sda6 as root but can't read what it finds there. 

That suggests that /dev/sda6 is not root or that the filesystem to read /dev/sda6 is not available.

--- edit ---

```
[   1.769766]List of all partitions:

[   1.769822]No filesystem could mount root, tried:

[   1.769823] 
```

That's important information but it looks like its been removed.

----------

## jfp

First, as NeddySeagoon suggests, there may be a fundamental disk partioning problem that must be dealt with first. My genkernel example assume you have a correctly partitioned/formatted disk and something is amiss in your kernel config. Basically, I think your saying that your 4.19.86 kernel does boot. It's just that the new 4.19.97 kernel your trying to move to fails.

 *Quote:*   

> The second line in all files in the /etc/kernels directory contains an instruction DO NOT EDIT. Can it be ignored?
> 
> And I did not find the “Intel P4/older Netburst based Xeon” and “symmetric multi-processing support” lines in the kernel config files. How to recognize them there?

 

You should not manually edit kernel config files. However, in my example, you are not editing the config, but are simply copying an existing one to a new file that genkernel will find. There are multiple other ways (beyond my example) to get a known to be working kernel config. The example I gave just seemed like the easiest to explain.

In your case, the config for your gentoo-sources-4.19.86 seems to be working and boots, so that is the config I would start with.

After copying the config file in /etc/kernels I would

Run genkernel all (without the menuconfig)

run grub-mkconfig (for example grub-mkconfig -o /boot/grub/grub.cfg)

(At this point your new 4.19.97 kernel is configured exactly the same as your known to be working 4.19.86 kernel)

Now reboot. I would expect this to work and boot you into the 4.19.97 kernel

Now go ahead and do  genkernel --menuconfig all, make your config changes and genkernel do its thing

Now you can reboot again. If it boots Yay!! if you get that VFS not sincing messages then that will need to be figured out.\

[EDIT: fixed the grub-mkconfig example to include the  -o]

----------

## iurii

 *NeddySeagoon wrote:*   

> iurii,
> 
> ```
> [   1.769919]Kernel panic – not syncing:VFS:Unable to mount root fs on unknown-block(8,6) 
> ```
> ...

 

Definitely /dev/sda6 is the root :

```
..

/dev/sda1                   2048 164812799 164810752  78,6G             7 HPFS/NTFS/exFAT

/dev/sda2              283596800 488394751 204797952  97,7G             7 HPFS/NTFS/exFAT

/dev/sda3  *           164812800 165861375   1048576   512M            83 Linux

/dev/sda4              165861376 283596799 117735424  56,1G             5 extended

/dev/sda5              165863424 167960575   2097152     1G            82 Linux swap / Solaris

/dev/sda6              167962624 283596799 115634176  55,1G            83 Linux
```

```
# /etc/fstab: static file system information.

#

...

# <fs>         <mountpoint>   <type>      <opts>      <dump/pass>

...

/dev/sda3   /boot      ext2      noauto,noatime   1 2

/dev/sda6   /      ext3      defaults   0 1

/dev/sda5   none      swap      sw      0 0

/dev/cdrom   /mnt/cdrom   auto      noauto,ro   0 2
```

```
# Author: Ultanium

#

# Start LILO global section

#

# Faster, but won't work on all systems:

#compact

# Should work for most systems, and do not have the sector limit:

lba32

# If lba32 do not work, use linear:

#linear

# MBR to install LILO to:

boot = /dev/sda

map = /boot/.map

# If you are having problems booting from a hardware raid-array

# or have a unusual setup, try this:

#disk=/dev/ataraid/disc0/disc bios=0x80  # see this as the first BIOS disk

#disk=/dev/sda bios=0x81                 # see this as the second BIOS disk

#disk=/dev/hda bios=0x82                 # see this as the third BIOS disk

# Here you can select the secondary loader to install.  A few

# examples is:

#

#    boot-text.b

#    boot-menu.b

#    boot-bmp.b

#

install = /boot/boot-menu.b   # Note that for lilo-22.5.5 or later you

                              # do not need boot-{text,menu,bmp}.b in

                              # /boot, as they are linked into the lilo

                              # binary.

menu-scheme=Wb

prompt

# If you always want to see the prompt with a 15 second timeout:

#timeout=150

delay = 5000

# Normal VGA console

vga = normal

# VESA console with size 1024x768x16:

#vga = 791

#

# End LILO global section

#

#

# Linux bootable partition config begins

#

image = /boot/vmlinuz-4.19.86-gentoo-x86_64

   root = /dev/sda6

   #root = /devices/discs/disc0/part3

   label = Gentoo

   read-only # read-only for checking

#

# Linux bootable partition config ends

#

#

# DOS bootable partition config begins

#

other = /dev/sda1

   #other = /devices/discs/disc0/part1

   label = Windows

   table = /dev/sda

#

# DOS bootable partition config ends  

#
```

but when I started looking at the kernel-config files (/etc/kernels) for ext2 and ext3   :Confused: 

kernel-config-4.19.86-gentoo-x86_64:

```

.. 

CONFIG_EXT2_FS=y

CONFIG_EXT2_FS_XATTR=y

CONFIG_EXT2_FS_POSIX_ACL=y

CONFIG_EXT2_FS_SECURITY=y

CONFIG_EXT3_FS=y

CONFIG_EXT3_FS_POSIX_ACL=y

CONFIG_EXT3_FS_SECURITY=y

..
```

kernel-config-4.19.97-gentoo-x86_64:

```
..

# CONFIG_EXT2_FS is not set

# CONFIG_EXT3_FS is not set

..
```

/usr/share/genkernel/arch/x86_64/generated-config:

```
..

# CONFIG_EXT2_FS is not set

# CONFIG_EXT3_FS is not set

..
```

But how can this be? I saw the stars opposite ext2 and ext3 in the utility menuconfig?

----------

## iurii

 *jfp wrote:*   

> First, as NeddySeagoon suggests, there may be a fundamental disk partioning problem that must be dealt with first. My genkernel example assume you have a correctly partitioned/formatted disk and something is amiss in your kernel config. Basically, I think your saying that your 4.19.86 kernel does boot. It's just that the new 4.19.97 kernel your trying to move to fails.
> 
>  *Quote:*   The second line in all files in the /etc/kernels directory contains an instruction DO NOT EDIT. Can it be ignored?
> 
> And I did not find the “Intel P4/older Netburst based Xeon” and “symmetric multi-processing support” lines in the kernel config files. How to recognize them there? 
> ...

 

Thanks for the detailed explanation, now I understand your offer completely. But in the light of the disconnections of ext2 and ext3 in the configuration files of the new kernel discovered by NeddySeagoon, I don’t even know where to start. What do you advise?

----------

## jfp

First, let me say that is has been many years since i used lilo so I am kind of guessing here...

 *Quote:*   

> # Linux bootable partition config begins
> 
> #
> 
> image = /boot/vmlinuz-4.19.86-gentoo-x86_64
> ...

 

In this I see the reference to your 4.19.86 kernel, but do not see any reference to your new 4.19.97 kernel... That seems wrong. I seem to recall, that after building a new kernel you need to run lilo to get it to update it's configuration, but I have no recollection on how to do that.

Let's take this sequence;

you install your new gentoo-sources, in this case =sys-kernel/gentoo-sources-4.19.97

Next you use "eselect kernel list" followed by "eselect kernel set x" where x is the number of the new kernel that list provided

Then you run genkernel --menuconfig all

genkernel will look in /etc/kernels for a saved config for kernel 4.19.97, but it won't find one, so genkernel will simply use it's default configuration, which it copies to /usr/src/linux/.config. Now genkernel launches menuconfig and you make whatever changes in you need to in menuconfig. When you exit menuconfig the file /usr/src/linux/.config will get updated to reflect those changes and genkernel will continue doing the things it does to compile your kernel. at the end genkernel copies /usr/src/linux/.config to /etc/kernels as kernel-config-4.19.97-gentoo-x86_64 or something similiar depending on how old your genkernel is.  In my case I'm running =sys-kernel/genkernel-4.0.8 and that is the filename I get. Older versions of genkernel will create something like kernel-config-x86_64-4.19.97-gentoo.However, Please note!, That saved configuration is the default genkernel config except as modified by you. I don't think that is what you want.

At this point I assume your running with your old 4.19.86 kernel. 

Another way to get 4.19.86 config and use it for your 4.19.97 kernel is to make use of the fact that your 4.19.86 kernel config is actually stored in the running kernel itself.

To see if that's true in your case do 

```
NAShost /etc/kernels # ls -al /proc/config.gz 

-r--r--r-- 1 root root 28085 Feb 18 09:13 /proc/config.gz

```

assuming that /proc/config.gz exists you would then run

```
NAShost /etc/kernels # zcat /proc/config.gz > /tmp/.config # please note the "." in .config!! It is required

NAShost /etc/kernels # ls -al /tmp/.config

-rw-r--r-- 1 root root 117271 Feb 18 13:48 /tmp/.config
```

Note I sent the .config to /tmp, you would do zcat /proc/config.gz > /usr/src/linux/.config

To use that .config you would run genkernel liike this

genkernel --no-clean --menuconfig all

The --no-clean option simply tells genkernel to not run the kernel's make clean. Make clean deletes any existing .config.

Also, and again I am not at all familiar with lilo, Not only do I not see mention of 4.19.97 in your lilo config, but I don't see mention of the initramfs that that genkernel created. I think you can configure things so that the initramfs is build into the actual kernel module, but I've never done that and don't know how it works.

This what my /boot directory contains after running the genkernel

```
NAShost /etc/kernels # ls -al /boot

total 50354

drwxr-xr-x  4 root root      13 Feb  7 14:52 .

drwxr-xr-x 21 root root      21 Feb 15 13:33 ..

drwxr-xr-x  3 root root    4096 Dec 31  1969 efi

drwxr-xr-x  5 root root       7 Feb 13 10:28 grub

-rw-r--r--  1 root root 4552228 Feb  7 07:46 initramfs-4.19.86-gentoo-x86_64.img

-rw-r--r--  1 root root 6211344 Feb  7 14:52 initramfs-4.19.97-gentoo-x86_64.img

-rw-r--r--  1 root root 4475144 Feb  4 14:27 initramfs-4.19.97-gentoo-x86_64.img.old

-rw-r--r--  1 root root 3539524 Feb  7 07:41 System.map-4.19.86-gentoo-x86_64

-rw-r--r--  1 root root 4073489 Feb  7 14:49 System.map-4.19.97-gentoo-x86_64

-rw-r--r--  1 root root 4073489 Feb  4 14:19 System.map-4.19.97-gentoo-x86_64.old

-rw-r--r--  1 root root 7279264 Feb  7 07:41 vmlinuz-4.19.86-gentoo-x86_64

-rw-r--r--  1 root root 8262304 Feb  7 14:49 vmlinuz-4.19.97-gentoo-x86_64

-rw-r--r--  1 root root 8262304 Feb  4 14:19 vmlinuz-4.19.97-gentoo-x86_64.old
```

----------

## iurii

 *jfp wrote:*   

> First, let me say that is has been many years since i used lilo so I am kind of guessing here...
> 
>  *Quote:*   # Linux bootable partition config begins
> 
> #
> ...

 

Of course, the /etc/lilo.conf sent by me refers to the current configuration of the old kernel.

So, I went the first way:

1) I successfully executed emerge =sys-kernel/gentoo-sources-4.19.97 -a

2) I also re-selected the kernel (although it is the only one on the list) 

```
 eselect kernel list

Available kernel symlink targets:

[1] linux-4.19.97-gentoo *
```

```
eselect kernel set 1
```

3)

```
genkernel --menuconfig all
```

further I checked on the "Gentoo Linux amd64 Handbook:

Installing Gentoo "the following kernel installations  are marked with asterisks:

a)Device Drivers --->

Generic Driver Options --->

[*] Maintain a devtmpfs filesystem to mount at /dev

[*] Automount devtmpfs at /dev, after the kernel mounted the rootfs

b)Device Drivers --->

SCSI device support --->

<*> SCSI disk support

c)File systems --->

<*> Second extended fs support

<*> The Extended 3 (ext3) filesystem

<*> The Extended 4 (ext4) filesystem

<*> Reiserfs support

<*> JFS filesystem support

<*> XFS filesystem support

<*> Btrfs filesystem support

DOS/FAT/NT Filesystems --->

<*> MSDOS fs support

<*> VFAT (Windows-95) fs support

and yes ext2, ext3 really weren't tagged

<*>NTFS file system support

d)Pseudo Filesystems --->

[*] /proc file system support

[*] Tmpfs virtual memory file system support (former shm fs)

e) Device Drivers --->

Network device support --->

<*> PPP (point-to-point protocol) support

<*> PPP support for async serial ports

<*> PPP support for sync tty ports

f)Processor type and features --->

[ ] Symmetric multi-processing support

Processor family (Intel P4/ older Netburst based Xeon) --->

g)Device Drivers --->

HID support --->

-*- HID bus support

<*>Generic HID driver

[*]Battery level reporting for HID devices

USB HID support --->

<*> USB HID transport layer

[*] USB support --->

<*>xHCI HCD (USB 3.0) support

<*>EHCI HCD (USB 2.0) support

<*>OHCI HCD (USB 1.1) support

h)-*- Enable the block layer --->

Partition Types --->

[*] Advanced partition selection

[*] EFI GUID Partition support

i)Processor type and features --->

[*] EFI runtime service support

[*]EFI stub support

[*]EFI mixed-mode support

j)Firmware Drivers --->

EFI (Extensible Firmware Interface) Support

<*> EFI Variable Support via sysfs--->

k)<> <ATA/ATAPI/MFM/RLL support>

<*> Serial ATA and Parallel ATA drivers

saved, and now genkernel is continueing to work, it will take half a day

----------

## NeddySeagoon

iurii,

You actually have an option here.

```
<*> Second extended fs support

<*> The Extended 3 (ext3) filesystem

<*> The Extended 4 (ext4) filesystem 
```

When you turn off 

```
< > Second extended fs support

< > The Extended 3 (ext3) filesystem
```

and leave 

```
<*> The Extended 4 (ext4) filesystem
```

 you get a new menuconfig entry to Use ext4 for ext3 and ext2.

Both ways work.

----------

## Whissi

@jfp: Please check genkernel-4 features. You can do 

```
genkernel --kernel-config=/proc/config.gz all
```

in case you want to build new kernel based on current running config. No need to copy stuff manually. Of course you can still combine with --menuconfig to alter that config.

Also, I wouldn't recommend using "--no-clean" and manually edit config in --kernel-dir for normal operations: It makes things complicated and because genkernel saves config by default in /etc/kernels, it's not that obvious for new user which config will get used (genkernel-4 is verbose and will tell user but you still have to read and understand that information). Just use defaults and specify --kernel-config so you know for sure which config will be used.

----------

## jfp

 *Quote:*   

> @jfp: Please check genkernel-4 features. You can do
> 
> Code:	
> 
> genkernel --kernel-config=/proc/config.gz all	
> ...

 

I did not know that... Excellent! 

Thanks very much!

BTW, despite my misuse of the tool, I am a great fan!

----------

## iurii

4) at the end of the genkernel's work, I performed :

```
#cp /usr/src/linux-4.19.97-gentoo/arch/x86_64/boot/bzImage  /boot/bzImage
```

5) changed to lilo.сonf

```
..

image=/boot/vmlinuz-4.19.97-gentoo-x86_64

..
```

6) performed successfully /sbin/lilo

7) rebooted and got an unbootable kernel again  :Sad: 

```
[   2.812879] VFS: Cannot open root device “806” or unknown-block(8,6): error -6

[   2.812955] Please append a correct “root=” boot option; here are the available partitions:

[   2.813029] Kernel panic – not syncing:VFS:Unable to mount root fs on unknown-block(8,6)

[   2.813102] CPU: 0 PID:1 Comm: swapper Not tainted 4.19.97-gentoo-x86_64 #1

[   2.813155] Hardware name: ASUSTeK Computer Inc. K50C/K50C, BIOS 209 01/06/2010

[   2.813225] Call Trace:

[   2.813285] panic+0xdf/0x234

[   2.813337] mount_block_root+0x25c/0x307

[   2.813389] prepare_namespace+0x136/0x16c

[   2.813439] kernel_init_freeable+0x1aa/0x1b8

[   2.813492] ? rest_init+0x81/0x81

[   2.813540] kernel_init+0xa/0xfa

[   2.813590] ret_from_fork+0x35/0x40

[   2.813643] Kernel Offset: 0xa000000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)

[   2.813720] ---[ end Kernel panic – not syncing:VFS: Unable to mount root fs on unknown-block(8,6)]---
```

I ask you to comment on the genkernel message after completing the kernel assembly (perhaps it also contains the reason why the kernel does not boot)

```
# genkernel --menuconfig all

* Gentoo Linux Genkernel; Version 4.0.2

* Using genkernel configuration from '/etc/genkernel.conf' ...

* Running with options: --menuconfig all

* Working with Linux kernel 4.19.97-gentoo-x86_64 for x86_64

* Using kernel config file '/etc/kernels/kernel-config-4.19.97-gentoo-x86_64' ...

* 

* Note: The version above is subject to change (depends on config and status of kernel sources).

* mount: >> Boot partition was temporarily mounted on '/boot' ...

* kernel: >> Initializing ...

*         >> Running 'make mrproper' ...

*         >> Running 'make oldconfig' ...

*         >> Invoking menuconfig ...

*         >> Re-running 'make oldconfig' due to changed kernel options ...

*         >> Compiling 4.19.97-gentoo-x86_64 bzImage ...

*         >> Compiling 4.19.97-gentoo-x86_64 modules ...

*         >> Installing 4.19.97-gentoo-x86_64 modules (and stripping) ...

*         >> Generating module dependency data ...

*         >> Saving config of successful build to '/etc/kernels/kernel-config-4.19.97-gentoo-x86_64' ...

* initramfs: >> Initializing ...

*         >> Appending devices cpio data ...

*         >> Appending base_layout cpio data ...

*         >> Appending auxilary cpio data ...

*         >> Appending blkid cpio data ...

*         >> Appending busybox cpio data ...

*         >> Appending modprobed cpio data ...

*         >> Appending modules cpio data ...

*         >> Appending linker cpio data ...

*         >> Deduping cpio ...

*         >> Pre-generating initramfs' /etc/ld.so.cache ...

*         >> Compressing cpio data (.xz) ...

* Kernel compiled successfully!

* 

* --no-bootloader set; Skipping bootloader update ...

* 

* Required kernel parameter:

* 

*    root=/dev/$ROOT

* 

* Where $ROOT is the device node for your root partition as the

* one specified in /etc/fstab

* If you require Genkernel's hardware detection features, you MUST

* tell your bootloader to use the provided initramfs file '/boot/initramfs-4.19.97-gentoo-x86_64.img'.

* WARNING... WARNING... WARNING...

* Additional kernel parameters that *may* be required to boot properly:

* 

* With support for several ext* filesystems available, it may be needed to

* add "rootfstype=ext3" or "rootfstype=ext4" to the list of boot parameters.

* mount: >> Automatically unmounting boot partition from '/boot' as it was previously ...

* Do NOT report kernel bugs as genkernel bugs unless your bug

* is about the default genkernel configuration...

* 

* Make sure you have the latest ~arch genkernel before repo
```

My \etc\fstab is :

```
..

/dev/sda3   /boot      ext2      noauto,noatime   1 2

/dev/sda6   /      ext3      defaults   0 1

/dev/sda5   none      swap      sw      0 0

/dev/cdrom   /mnt/cdrom   auto      noauto,ro   0 0
```

My \etc\lilo.conf is:

```
# Author: Ultanium

#

# Start LILO global section

#

# Faster, but won't work on all systems:

#compact

# Should work for most systems, and do not have the sector limit:

lba32

# If lba32 do not work, use linear:

#linear

# MBR to install LILO to:

boot = /dev/sda

map = /boot/.map

# If you are having problems booting from a hardware raid-array

# or have a unusual setup, try this:

#disk=/dev/ataraid/disc0/disc bios=0x80  # see this as the first BIOS disk

#disk=/dev/sda bios=0x81                 # see this as the second BIOS disk

#disk=/dev/hda bios=0x82                 # see this as the third BIOS disk

# Here you can select the secondary loader to install.  A few

# examples is:

#

#    boot-text.b

#    boot-menu.b

#    boot-bmp.b

#

install = /boot/boot-menu.b   # Note that for lilo-22.5.5 or later you

                              # do not need boot-{text,menu,bmp}.b in

                              # /boot, as they are linked into the lilo

                              # binary.

menu-scheme=Wb

prompt

# If you always want to see the prompt with a 15 second timeout:

#timeout=150

delay = 5000

# Normal VGA console

vga = normal

# VESA console with size 1024x768x16:

#vga = 791

#

# End LILO global section

#

#

# Linux bootable partition config begins

#

   image=/boot/vmlinuz-4.19.97-gentoo-x86_64

#   image = /boot/bzImage

   root=/dev/sda6

   #root = /devices/discs/disc0/part3

   append="rootfstype=ext3"

   label=Gentoo

   read-only # read-only for checking

#

# Linux bootable partition config ends

#

# Linux bootable partition number two begins

   image=/boot/vmlinuz-4.19.86-gentoo-x86_64

   root=/dev/sda6

   label=OldGentoo

   read-only # read-only for checking

# Linux bootable partition number two ends

#

# DOS bootable partition config begins

#

other = /dev/sda1

   #other = /devices/discs/disc0/part1

   label = Windows

   table = /dev/sda

#

# DOS bootable partition config ends  

#

```

----------

## jfp

As mentioned I know nothing about lilo so...

 *Quote:*   

> 4) at the end of the genkernel's work, I performed :
> 
> Code:	
> 
> #cp /usr/src/linux-4.19.97-gentoo/arch/x86_64/boot/bzImage  /boot/bzImage

 

1) There is no need to do this. genkernel will copy three files to /boot like:

```
NAShost ls -al /boot

-rw-r--r--  1 root root 6211344 Feb  7 14:52 initramfs-4.19.97-gentoo-x86_64.img

-rw-r--r--  1 root root 4073489 Feb  7 14:49 System.map-4.19.97-gentoo-x86_64

-rw-r--r--  1 root root 8262304 Feb  7 14:49 vmlinuz-4.19.97-gentoo-x86_64

```

With genkernel there is no way I know of to avoid using the initramfs. lilo seems to support this although lilo uses the term initrd. In this case, initrd is the same as initramfs. In any case unless you configure lilo to use the initramfs the boot will fail.

 *Quote:*   

> #
> 
> # Linux bootable partition config begins
> 
> #
> ...

 

 *Quote:*   

> # MBR to install LILO to:
> 
> boot = /dev/sda
> 
> map = /boot/.map

 

The "map =" line. I do not know if this matters or what lilo uses if for. I am wildly guessing it's a reference to the system map file. If that's true then update it to point to the system map file placed in /boot by genkernel. (I have never had any idea what this file accomplishes or is used for. I know that for many years before I started to use genkernel I never copied it and never had any problems)

In the lilo example I'm looking at (which might be ancient) I see a space before/after the = signs. I have no idea if this is significant but...

 *Quote:*   

> * --no-bootloader set; Skipping bootloader update ...

 

I do not think this message matters. It only applies when you are use grub as the boot manager/loader. Otherwise, I see nothing else in the genkernel output that looks suspicious or weird.

I also have no idea if, after updating the lilo.conf, you need to re-run lilo or run some other lilo command to "install" it. My total knowledge of lilo is limited to 5 minutes of googleing lilo.

There is also another possibility regarding lilo. It seems to me that there was some restriction about the root partition being within the first 1024 cylinders of the disk. I have no idea if that is actually true of if that restriction still exists.

Beyond what's above, I am not sure what the next steps to debugging this would be. If it were me, I would switch from lilo to grub if that is at all possible. I think the genkernel way of doing think is very good, but it does add a layer of obscurity to the process (.config confusion, initramfs), so I think I would probably back off of using genkernel and do the kernel update/build/install the manual way. That's certainly the way I did things way for years until I was forced to start using an initramfs.

----------

## CaptainBlood

EDIT:Bullshit deleted.

Sorry.Last edited by CaptainBlood on Wed Feb 19, 2020 11:41 pm; edited 1 time in total

----------

## NeddySeagoon

jfp,

The command you are looking for is 

```
/sbin/lilo
```

.

Lilo cannot read any filesystem itself during booting.

To have lilo find a new kernel, you update /etc/lilo.conf then run sbin/lilo.

This writes a new block list corresponding to the blocks holding the files listed in /etc/lilo.conf

Forgetting to run /sbin/lilo after an update can have all sorts of undesirable consequences.

lilo loads the contents of its block list. If the files directory entry has been deleted, the file content is still present (on rotating rust anyway)

Lilo is quite happy to boot 'deleted' kernels this way.

It gets more interesting if some or all of the space has been reallocated. Still, that what a liveCD is for.

----------

## iurii

I am trying to execute the recommendations of Whissi:

I downloaded Gentoo with  vmlinuz-4.19.86-gentoo-x86_64 kernel and gave the command:

```

genkernel --kernel-config=/proc/config.gz --menuconfig all
```

----------

## NeddySeagoon

iurii

That will build a kernel and matching initrd and put the bits into /boot for you.

An initrd and initramfs vary only in their internal structure.

Originally, the initrd was a compressed ext2 filesystem in a file.

The inirtamfs is a compressed CPIO archive of CPIO archives.

Bootloaders use the term initrd to refer to the temporary root filesystem in a file that holds all the thing needed to be able to mount the real root filesystem.

As jfp said *Quote:*   

>  initrd = /boot/initramfs-4.19.97-gentoo-x86_64.img <=== You must include this line!!!! 

 

You will need to tell lilo about the initrd. Do check the file name in /boot. 

Remember to run /sbin/lilo.

----------

## iurii

 *NeddySeagoon wrote:*   

> iurii
> 
> As jfp said *Quote:*    initrd = /boot/initramfs-4.19.97-gentoo-x86_64.img <=== You must include this line!!!!  
> 
> You will need to tell lilo about the initrd. Do check the file name in /boot. 
> ...

 

Thanks, I understand You, I will execute.

----------

## iurii

When the kernelkernel finished working, I tried to load the kernel that it built, but the assembled kernel did not boot.

Then i inserted 

```
initrd = /boot/initramfs-4.19.97-gentoo-x86_64.img
```

 into /etc/lilo.conf and gave command /sbin/lilo with result:

```
Fatal: open /boot/vmlinuz-4.19.97-gentoo-x86_64: No such file or directory
```

i cheсked /boot

```
 ls -al /boot

итого 6772

drwxr-xr-x  2 root root    4096 фев 20 10:44 .

drwxr-xr-x 21 root root    4096 янв  9 00:53 ..

-rw-r--r--  1 root root     512 фев 16 14:32 boot.0800

-rw-r--r--  1 root root     512 фев 19 17:19 boot.0810

-rw-r--r--  1 root root 6787744 фев 20 11:25 bzImage

-rw-r--r--  1 root root       0 янв  9 00:53 .keep

-rw-r--r--  1 root root       0 фев 20 02:04 .keep_sys-boot_lilo-0

-rw-------  1 root root  108032 фев 19 17:31 .map
```

(sorry for my localization)

Then i rebooted with LiveDVD and executed as earlier

sudo su

swapon /dev/sda5

mount /dev/sda6 /mnt/gentoo

mount /dev/sda3 /mnt/gentoo/boot

mount --types proc /proc /mnt/gentoo/proc

mount --rbind /sys /mnt/gentoo/sys

mount --make-rslave /mnt/gentoo/sys

mount --rbind /dev /mnt/gentoo/dev

mount --make-rslave /mnt/gentoo/dev

chroot /mnt/gentoo /bin/bash

source /etc/profile

export PS1="(chroot) ${PS1}"

and i get:

```
(chroot) livecd / # etc-update

Scanning Configuration files...

Exiting: Nothing left to do; exiting. :)

(chroot) livecd / # ls -al /boot

���������� 80304

drwxr-xr-x  4 root root    4096 ������ 20 10:56 .

drwxr-xr-x 21 root root    4096 ������  9 00:53 ..

-rw-r--r--  1 root root     512 ������ 13 18:37 boot.0800

-rw-r--r--  1 root root 7238304 ������ 18 17:48 bzImage

drwxr-xr-x  5 root root    4096 ������ 14 19:49 grub

-rw-r--r--  1 root root 7544896 ������ 14 15:59 initramfs-4.19.86-gentoo-x86_64.img

-rw-r--r--  1 root root 8075256 ������ 13 16:57 initramfs-4.19.86-gentoo-x86_64.img.old

-rw-r--r--  1 root root 7286236 ������ 20 08:32 initramfs-4.19.97-gentoo-x86_64.img

-rw-r--r--  1 root root 7314620 ������ 19 11:54 initramfs-4.19.97-gentoo-x86_64.img.old

-rw-r--r--  1 root root       0 ������ 14 20:26 .keep_sys-boot_lilo-0

drwx------  2 root root   16384 ������ 12 22:15 lost+found

-rw-------  1 root root  229376 ������ 20 10:56 .map

-rw-r--r--  1 root root 3557274 ������ 14 04:07 System.map-4.19.86-gentoo-x86_64

-rw-r--r--  1 root root 3309939 ������ 13 05:17 System.map-4.19.86-gentoo-x86_64.old

-rw-r--r--  1 root root 3472616 ������ 20 04:07 System.map-4.19.97-gentoo-x86_64

-rw-r--r--  1 root root 4249912 ������ 19 04:26 System.map-4.19.97-gentoo-x86_64.old

-rw-r--r--  1 root root 7238304 ������ 14 04:08 vmlinuz-4.19.86-gentoo-x86_64

-rw-r--r--  1 root root 6541984 ������ 13 05:18 vmlinuz-4.19.86-gentoo-x86_64.old

-rw-r--r--  1 root root 6787744 ������ 20 04:07 vmlinuz-4.19.97-gentoo-x86_64

-rw-r--r--  1 root root 9176960 ������ 19 04:29 vmlinuz-4.19.97-gentoo-x86_64.old

(chroot) livecd / # /sbin/lilo

Added Gentoo  +  *

Added OldGentoo

Added Windows

(chroot) livecd / # 

```

and then:

exit

cd

umount -l /mnt/gentoo/dev{/shm,/pts,}

umount -R /mnt/gentoo

halt

after loading a new kernel, I got an error:

```

...

>>Determining root device (trying 806) ........

!! Block device 806 is not a valid root device ...

!! Could not find the root block device in 806.

!! Please specify another value or:

!! - press Enter for the  same

!! - type "shell" for a shell

!! - type "q" to skip ...

root block device(806) ::
```

----------

## jfp

I am at a loss...

I am busy this morning but will continue to look at this sometime this afternoon/evening.

First, please confirm that you ARE able to boot the 4.19.86 kernel. If so, please boot that kernel. From previous posts I think you said that you could boot thr 4.19.86 kernel, but are having problems in compiling the 4.16.97 kernel and getting that new kernel to boot.

I am very concerned that the contents of /boot you posted are different. One ls -al /boot shows almost nothing. the second, from the LiveCD chroot looks like what I expect it to look like (although I'm surprised to see the grub directory. This, to me, shows that something is wrong, so the first step is to figure out what that is. Basically, the contents of /boot should be the same (obviously, the /boot of the actual LiveCD will be whatever is actually on the LiveCD and has nothing to do with the work you've done)

So...

If you can boot the 4.19.86 kernel please do so.

If you cannot boot the 4.19.86 kernel. please boot the live CD and enter into the chroot as normal.

It is critical that the output of the commands below be from either the 4.19.86 boot or from the chroot within the LiveCD. 

From whichever environment (4.19.86 or LiveCD chroot) you have booted, post the output of:

uname -a    #will help me make sure I understand what booted environment you are in

fdisk -l /dev/sda    # I need to make sure I understand how your disk is partitioned. Please comment on what you believe each partition is.

mount      # mount with no options ;istss everything that is mounted

cat /etc/lilo.conf

tree /boot   # the tree command comes from app-text/tree you might need to emerge app-text/tree

cat /etc/fstab

The output of these command may make me ask for additional information. We will see...

----------

## iurii

jfp,

thank you for your participation. You are absolutely right that I load the gentoo with the vmlinuz-4.19.86-gentoo-x86_64 kernel without any problems. 

But I wanted to rebuild the kernel by changing only two parameters: 

Processor type and features --->[] Symmetric multi-processing support

Processor type and features --->Processor family (Intel P4 / older Netburst based Xeon) --->. 

And over and over again I get the unbootable kernel vmlinuz-4.19.97-gentoo-x86_64. 

Moreover, as it turned out, I am not even able to successfully execute the /sbin/lilo command to rebuild the lilo bootloader if the kernel vmlinuz-4.19.86-gentoo-x86_64 is loaded. 

It is also not clear why I cannot get an adequate output from the ls -al /boot command by loading the gentoo under the kernel vmlinuz-4.19.86-gentoo-x86_64. All these problems led me, as a beginner, to the idea that something was wrong with LILO. And I decided to give two commands(kernel vmlinuz-4.19.86-gentoo-x86_64 is loaded):

```
localhost /home/lyudmila # lilo -V

LILO version 24.0 (released 07-Juni-2013)

localhost /home/lyudmila # genkernel --version

4.0.2
```

I think it's time to switch to grub2 (although i have some problems installing it).

The result of the execution of the commands you ordered from under vmlinuz-4.19.86-gentoo-x86_64 too:

```

localhost /home/lyudmila # uname -a

Linux 192.168.1.3 4.19.86-gentoo-x86_64 #1 SMP Tue Jan 14 00:44:09 MSK 2020 x86_64 Intel(R) Celeron(R) D CPU 220 @ 1.20GHz GenuineIntel GNU/Linux

localhost /home/lyudmila # fdisk -l /dev/sda

Диск /dev/sda: 232,9 GiB, 250059350016 байт, 488397168 секторов

Disk model: ST9250315AS     

Единицы: секторов по 1 * 512 = 512 байт

Размер сектора (логический/физический): 512 байт / 512 байт

Размер I/O (минимальный/оптимальный): 512 байт / 512 байт

Тип метки диска: dos

Идентификатор диска: 0xbab9ab9d

Устр-во    Загрузочный    начало     Конец   Секторы Размер Идентификатор Тип

/dev/sda1                   2048 164812799 164810752  78,6G             7 HPFS/NTFS/exFAT

/dev/sda2              283596800 488394751 204797952  97,7G             7 HPFS/NTFS/exFAT

/dev/sda3  *           164812800 165861375   1048576   512M            83 Linux

/dev/sda4              165861376 283596799 117735424  56,1G             5 Расширенный

/dev/sda5              165863424 167960575   2097152     1G            82 Linux своп / Solaris

/dev/sda6              167962624 283596799 115634176  55,1G            83 Linux

Элементы таблицы разделов упорядочены не так, как на диске.

localhost /home/lyudmila # mount

/dev/sda6 on / type ext3 (rw,relatime)

devtmpfs on /dev type devtmpfs (rw,nosuid,relatime,size=10240k,nr_inodes=382780,mode=755)

proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)

tmpfs on /run type tmpfs (rw,nodev,relatime,size=306632k,mode=755)

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)

securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)

debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)

selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)

pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)

cgroup_root on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755)

openrc on /sys/fs/cgroup/openrc type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/lib/rc/sh/cgroup-release-agent.sh,name=openrc)

none on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)

cpuset on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)

cpu on /sys/fs/cgroup/cpu type cgroup (rw,nosuid,nodev,noexec,relatime,cpu)

cpuacct on /sys/fs/cgroup/cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct)

blkio on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)

memory on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)

devices on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)

freezer on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)

net_cls on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)

perf_event on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)

pids on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)

mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)

devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)

shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)

binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)

tmpfs on /run/user/995 type tmpfs (rw,nosuid,nodev,relatime,size=306628k,mode=700,uid=995,gid=995)

tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=306628k,mode=700,uid=1000,gid=1000)

localhost /home/lyudmila # cat /etc/lilo.conf

# Author: Ultanium

#

# Start LILO global section

#

# Faster, but won't work on all systems:

#compact

# Should work for most systems, and do not have the sector limit:

lba32

# If lba32 do not work, use linear:

#linear

# MBR to install LILO to:

boot = /dev/sda

map = /boot/.map

# If you are having problems booting from a hardware raid-array

# or have a unusual setup, try this:

#disk=/dev/ataraid/disc0/disc bios=0x80  # see this as the first BIOS disk

#disk=/dev/sda bios=0x81                 # see this as the second BIOS disk

#disk=/dev/hda bios=0x82                 # see this as the third BIOS disk

# Here you can select the secondary loader to install.  A few

# examples is:

#

#    boot-text.b

#    boot-menu.b

#    boot-bmp.b

#

install = /boot/boot-menu.b   # Note that for lilo-22.5.5 or later you

                              # do not need boot-{text,menu,bmp}.b in

                              # /boot, as they are linked into the lilo

                              # binary.

menu-scheme=Wb

prompt

# If you always want to see the prompt with a 15 second timeout:

#timeout=150

delay = 5000

# Normal VGA console

vga = normal

# VESA console with size 1024x768x16:

#vga = 791

#

# End LILO global section

#

#

# Linux bootable partition config begins

#

   image=/boot/vmlinuz-4.19.97-gentoo-x86_64

   initrd=/boot/initramfs-4.19.97-gentoo-x86_64.img

#   image = /boot/bzImage

   root=/dev/sda6

   #root = /devices/discs/disc0/part3

   append="rootfstype=ext3"

   label=Gentoo

   read-only # read-only for checking

#

# Linux bootable partition config ends

#

# Linux bootable partition number two begins

   image=/boot/vmlinuz-4.19.86-gentoo-x86_64

   root=/dev/sda6

   label=OldGentoo

   read-only # read-only for checking

# Linux bootable partition number two ends

#

# DOS bootable partition config begins

#

other = /dev/sda1

   #other = /devices/discs/disc0/part1

   label = Windows

   table = /dev/sda

#

# DOS bootable partition config ends  

#

localhost /home/lyudmila # tree /boot

/boot

├── boot.0800

├── boot.0810

└── bzImage

0 directories, 3 files

localhost /home/lyudmila # cat /etc/fstab

# /etc/fstab: static file system information.

#

# noatime turns off atimes for increased performance (atimes normally aren't 

# needed); notail increases performance of ReiserFS (at the expense of storage 

# efficiency).  It's safe to drop the noatime options if you want and to 

# switch between notail / tail freely.

#

# The root filesystem should have a pass number of either 0 or 1.

# All other filesystems should have a pass number of 0 or greater than 1.

#

# See the manpage fstab(5) for more information.

#

# <fs>         <mountpoint>   <type>      <opts>      <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

#

# NOTE: Even though we list ext4 as the type here, it will work with ext2/ext3

#       filesystems.  This just tells the kernel to use the ext4 driver.

#

# NOTE: You can use full paths to devices like /dev/sda3, but it is often

#       more reliable to use filesystem labels or UUIDs. See your filesystem

#       documentation for details on setting a label. To obtain the UUID, use

#       the blkid(8) command.

/dev/sda3   /boot      ext2      noauto,noatime   1 2

/dev/sda6   /      ext3      defaults   0 1

/dev/sda5   none      swap      sw      0 0

/dev/cdrom   /mnt/cdrom   auto      noauto,ro   0 0

localhost /home/lyudmila # 

```

excuse me for my localization:

localhost /home/lyudmila # fdisk -l /dev/sda

Disk /dev/sda: 232,9 GiB, 250059350016 bytes, 488397168 sectors

Disk model: ST9250315AS     

units: sectors for 1 * 512 = 512 bytes

Sector Size (Logical / Physical): 512 bytes / 512 bytes

Size I/O (minimum/optimal): 512 bytes / 512 bytes

Drive label type: dos

Drive id: 0xbab9ab9d

Device      Boot ..........                  Start            ..........        End            ..........          Sectors         ..........       Size       ..........     Identifier Type

/dev/sda1         ..........                    2048          ..........      164812799   ..........        164810752      ..........      78,6G     ..........        7 HPFS/NTFS/exFAT

/dev/sda2         ..........               283596800     ..........      488394751    ..........       204797952      ..........     97,7G       ..........      7 HPFS/NTFS/exFAT

/dev/sda3  *     ..........                164812800     ..........      165861375    ..........           1048576      ..........       512M      ..........      83 Linux

/dev/sda4        ..........                165861376     ..........      283596799    ..........       117735424      ..........      56,1G      ..........       5 Advanced

/dev/sda5          ..........              165863424     ..........      167960575     ..........          2097152       ..........        1G        ..........    82 Linux swap / Solaris

/dev/sda6          ..........              167962624     ..........      283596799     ..........      115634176       ..........     55,1G      ..........      83 Linux

Partition table items are not ordered as they are on disk.

----------

## NeddySeagoon

iurii,

There are several things going wrong here, all at the same time.

First, your system has two different regions that it calls /boot. You may get confused but your system won't.

The first one is 

```
Устр-во    Загрузочный    начало     Конец   Секторы Размер Идентификатор Тип 

/dev/sda3  *           164812800 165861375   1048576   512M            83 Linux
```

That's your boot partition.

That's the only one that lilo can see during booting.

Then there is your /boot directory on your root filesystem.

```
Устр-во    Загрузочный    начало     Конец   Секторы Размер Идентификатор Тип 

/dev/sda6              167962624 283596799 115634176  55,1G            83 Linux 
```

This is used as the mount point for the boot partition. 

Your /etc/fstab contains

```
# <fs>         <mountpoint>   <type>      <opts>      <dump/pass>

/dev/sda3   /boot      ext2      noauto,noatime   1 2 
```

The noauto option there tells the localmount service not to automatically the boot partition when the system starts.

Indeed, You posted 

 *Quote:*   

>  cheсked /boot
> 
> ```
>  ls -al /boot
> 
> ...

 

Which must be the /boot directory on the root filesystem without boot mounted as there are no genkernel built kernels nor initramfs there.

Google tells me that  фев 20, is Feb 20. That's today.

The  boot.0800 and boot.0810 are written by lilo. They are images of the first block of /dev/sda (the MBR) and /dev/sda1 respectively.

From that, I infer that you booted your Gentoo today did not mount the boot partition to /boot then installed a new kernel.

You did not add an initrd, because none is listed above and did not run /sbin/lilo, or /sbin/lilo failed as all the boot.* files are older than your kernel. 

```
 фев 20 11:25 bzImage
```

The takeaway from that is that you must mount the boot partition manually when you install a new kernel or the kernel correctly installs to the wrong place.

As you did something from the liveCD, you also posted the content of the boot partition. 

```
chroot) livecd / # ls -al /boot

���������� 80304

drwxr-xr-x  4 root root    4096 ������ 20 10:56 .

drwxr-xr-x 21 root root    4096 ������  9 00:53 ..

-rw-r--r--  1 root root     512 ������ 13 18:37 boot.0800

-rw-r--r--  1 root root 7238304 ������ 18 17:48 bzImage

drwxr-xr-x  5 root root    4096 ������ 14 19:49 grub

-rw-r--r--  1 root root 7544896 ������ 14 15:59 initramfs-4.19.86-gentoo-x86_64.img

-rw-r--r--  1 root root 8075256 ������ 13 16:57 initramfs-4.19.86-gentoo-x86_64.img.old

-rw-r--r--  1 root root 7286236 ������ 20 08:32 initramfs-4.19.97-gentoo-x86_64.img

-rw-r--r--  1 root root 7314620 ������ 19 11:54 initramfs-4.19.97-gentoo-x86_64.img.old

-rw-r--r--  1 root root       0 ������ 14 20:26 .keep_sys-boot_lilo-0

drwx------  2 root root   16384 ������ 12 22:15 lost+found

-rw-------  1 root root  229376 ������ 20 10:56 .map

-rw-r--r--  1 root root 3557274 ������ 14 04:07 System.map-4.19.86-gentoo-x86_64

-rw-r--r--  1 root root 3309939 ������ 13 05:17 System.map-4.19.86-gentoo-x86_64.old

-rw-r--r--  1 root root 3472616 ������ 20 04:07 System.map-4.19.97-gentoo-x86_64

-rw-r--r--  1 root root 4249912 ������ 19 04:26 System.map-4.19.97-gentoo-x86_64.old

-rw-r--r--  1 root root 7238304 ������ 14 04:08 vmlinuz-4.19.86-gentoo-x86_64

-rw-r--r--  1 root root 6541984 ������ 13 05:18 vmlinuz-4.19.86-gentoo-x86_64.old

-rw-r--r--  1 root root 6787744 ������ 20 04:07 vmlinuz-4.19.97-gentoo-x86_64

-rw-r--r--  1 root root 9176960 ������ 19 04:29 vmlinuz-4.19.97-gentoo-x86_64.old

(chroot) livecd / # /sbin/lilo

Added Gentoo  +  *

Added OldGentoo

Added Windows

(chroot) livecd / # 
```

There are your vmlinuz-* compressed kernel files and your matching initramfs-* files.

Notice how both quoted code blocks are for 

```
 ls -al /boot 
```

and both are different.

The one above is the content of the boot partition that lilo sees on booting.

Your lilo.conf contains 

```
# Linux bootable partition number two begins

   image=/boot/vmlinuz-4.19.86-gentoo-x86_64

   root=/dev/sda6

   label=OldGentoo

   read-only # read-only for checking

# Linux bootable partition number two ends 
```

which appears to work with no initrd entry.

Thats entirely possible if the kernel contains all the code required to mount the root filesystem build in, so even though you have an initrd its not required.

A pastebin of dmesg with this kernel booted would be interesting.  wgetpaste can help you here.

Your own kernel is booted by

```
# Linux bootable partition config begins

#

   image=/boot/vmlinuz-4.19.97-gentoo-x86_64

   initrd=/boot/initramfs-4.19.97-gentoo-x86_64.img

#   image = /boot/bzImage

   root=/dev/sda6

   #root = /devices/discs/disc0/part3

   append="rootfstype=ext3"

   label=Gentoo

   read-only # read-only for checking

#

# Linux bootable partition config ends 
```

 and ends with a kernel panic

```
>>Determining root device (trying 806) ........

!! Block device 806 is not a valid root device ...

!! Could not find the root block device in 806.

!! Please specify another value or:

!! - press Enter for the  same

!! - type "shell" for a shell

!! - type "q" to skip ...

root block device(806) ::
```

so for some reason the kernel cannot access /dev/sda6.

However, the initrd must have loaded as it generates the 

```
!! - press Enter for the  same

!! - type "shell" for a shell

!! - type "q" to skip ...
```

message.

Boot that again, then  

```
type "shell" for a shell
```

You will be in the initrd busybox shell.

What does 

```
ls -l /dev/sda*
```

 show?

Is /dev/sda6 present?

If so, is it mounted?

What mount points exist in /mnt?

Make one if you need to 

```
mkdir /mnt/test
```

This is only in RAM.

What error messafe do you get from 

```
mount -o ro /dev/sda6 /mnt/test
```

Is /dev/sda the only sd* in /dev ?

If you leave a USB block storage device connected, your root may have become /dev/sdb6.  

There is a way arond that too.

Is /dev/sda a USB deveice?  

No need to give up on lilo yet.

----------

## iurii

 *NeddySeagoon wrote:*   

> iurii,
> 
> ...
> 
> ...
> ...

 

```

rescueshell / # ls -l /dev/sda*

brw-rw----    1 0       6        8,   0 Feb 21 00:30 /dev/sda

brw-rw----    1 0       6        8,   1 Feb 21 00:30 /dev/sda1

brw-rw----    1 0       6        8,   2 Feb 21 00:30 /dev/sda2

brw-rw----    1 0       6        8,   3 Feb 21 00:30 /dev/sda3

brw-rw----    1 0       6        8,   4 Feb 21 00:30 /dev/sda4

brw-rw----    1 0       6        8,   5 Feb 21 00:30 /dev/sda5

brw-rw----    1 0       6        8,   6 Feb 21 00:30 /dev/sda6

rescueshell / # ls -l /mnt

rescueshell / # ls -al /mnt

drwxr-xr-x    2 0           0         0 Feb 20 05:32 .

drwxr-xr-x  17 0           0         0 Feb 21 00:31 ..

rescueshell / # ls -l /dev/sd*

brw-rw----    1 0       6        8,   0 Feb 21 00:30 /dev/sda

brw-rw----    1 0       6        8,   1 Feb 21 00:30 /dev/sda1

brw-rw----    1 0       6        8,   2 Feb 21 00:30 /dev/sda2

brw-rw----    1 0       6        8,   3 Feb 21 00:30 /dev/sda3

brw-rw----    1 0       6        8,   4 Feb 21 00:30 /dev/sda4

brw-rw----    1 0       6        8,   5 Feb 21 00:30 /dev/sda5

brw-rw----    1 0       6        8,   6 Feb 21 00:30 /dev/sda6

rescueshell / # mkdir /mnt/test

rescueshell / # mount -o ro /dev/sda6 /mnt/test

rescueshell / # ls -l /mnt/test

drwxr-xr-x    2 0        0             4096 Feb  8 05:35 bin

drwxr-xr-x    2 0        0             4096 Feb 20 07:44 boot

drwxr-xr-x    3 0        0             4096 Jan  8 21:54 dev

drwxr-xr-x   86 0        0             4096 Feb 20 23:35 etc

drwxr-xr-x    3 0        0             4096 Jan 18 23:36 home

drwxr-xr-x   11 0        0             4096 Feb  8 01:28 lib

drwxr-xr-x    7 0        0             4096 Feb  8 05:45 lib64

drwx------    2 0        0            16384 Jan 12 19:16 lost+found

drwxr-xr-x    2 0        0             4096 Jan  8 21:53 media

drwxr-xr-x    5 0        0             4096 Jan 19 02:44 mnt

drwxr-xr-x    2 0        0             4096 Jan  8 21:53 opt

drwxr-xr-x    2 0        0             4096 Jan  8 21:49 proc

drwx------    6 0        0             4096 Feb 21 00:29 root

drwxr-xr-x    2 0        0             4096 Feb 19 16:49 run

drwxr-xr-x    2 0        0             4096 Feb 19 23:04 sbin

-rwxr-xr-x    1 0        0        213632124 Jan 12 19:21 stage3-amd64-20200108T214502Z.tar.xz

drwxr-xr-x    2 0        0             4096 Jan  8 21:53 sys

drwxrwxrwt    6 0        0             4096 Feb 21 00:29 tmp

drwxr-xr-x   12 0        0             4096 Jan  8 22:09 usr

drwxr-xr-x    9 0        0             4096 Feb  4 01:10 var

rescueshell / # 
```

No, /dev/sda is not a USB deveice. /dev/sda is laptop's hdd.

----------

## jfp

[edit: I see NeddySeagon posted a much more understandable answer that what follows. He is much more knowledgeable that I am]

When you first installed Gentoo, following the Gentoo Handbook, you successfully installed Gentoo and were able to boot it.

The partitions for Gentoo are:

/dev/sda3 as your boot partition

/dev/sda5 as your swap partition

/dev/sda6 as your root partition

The output of mount indicates that your boot partition is not mounted. BUT the tree output shows there are files in it. That is not good.

Please run as root:

umount /dev/sda3   # This should say that it is not mounted. Basically we want your boot partition (/dev/sda3) to not be mounted

mv /boot /bootbackup  # rename the existing /boot directory

mkdir /boot            # create a nice new empty /boot directory

mount /dev/sda3 /boot     # mount the boot partition

ls -al /boot           # I think this will show the all of the initramfs .img files and the vmlinuz kernel files. 

Please post the output of the ls -al /boot 

Your /etc/fstab does NOT automatically mount the /dev/sda3 boot partition. I think this is actually part of the real problem. I think that genkernel DOES mount and unmount your boot partition. Then after genkernel finishes, you update your /etc/lilo.conf and run /sbin/lilo but your /dev/sda3 boot partition is not mounted so lilo does not see any of your kernels! Also, I am now thinking that while genkernel does create an initramfs, I no longer think you actually need it. The whole point of an initramfs is to mount partitions (the root partition and perhaps many other things), that the kernel cannot do itself. However, given that your have builtin to the kernel support for ext2 and ext3 the kernel can mount the root partition and access the root partition all by itself. It just needs to be told that root=/dev/sda6.

The other part of the problem is that genkernel does NOT make any effort to find any older config file. If it can';t find a kernel config file for the current kernel (the one that usr/src/linux points to. it just generates a new default config. That fact led to all of the confusion on somehow getting the config for 4.19.86. We now know you can tell genkernel what file to use as the starting config for a new kernel. genkernel --config=/proc/config.gz or even genkernel --config=/etc/kernels/<some older config file>

Anyway, that is what I think I am now seeing. I hope I'm not just adding more confusion.

----------

## iurii

 *jfp wrote:*   

> Please run as root:
> 
> umount /dev/sda3   # This should say that it is not mounted. Basically we want your boot partition (/dev/sda3) to not be mounted
> 
> mv /boot /bootbackup  # rename the existing /boot directory
> ...

 

Yes, my partitions are exactly as you indicated.

I loaded the laptop under kernel-config-4.19.86-gentoo-x86_64 and did the following:

```
lyudmila@localhost ~ $ su root

Пароль: 

localhost /home/lyudmila # umount /dev/sda3

umount: /dev/sda3: not mounted.

localhost /home/lyudmila # mv /boot /bootbackup

localhost /home/lyudmila # mkdir /boot

localhost /home/lyudmila # mount /dev/sda3 /boot

localhost /home/lyudmila # ls -al /boot

итого 80304

drwxr-xr-x  4 root root    4096 фев 20 11:49 .

drwxr-xr-x 22 root root    4096 фев 21 04:45 ..

-rw-r--r--  1 root root     512 янв 13 18:37 boot.0800

-rw-r--r--  1 root root 7238304 фев 18 17:48 bzImage

drwxr-xr-x  5 root root    4096 янв 14 19:49 grub

-rw-r--r--  1 root root 7544896 янв 14 15:59 initramfs-4.19.86-gentoo-x86_64.img

-rw-r--r--  1 root root 8075256 янв 13 16:57 initramfs-4.19.86-gentoo-x86_64.img.old

-rw-r--r--  1 root root 7286236 фев 20 08:32 initramfs-4.19.97-gentoo-x86_64.img

-rw-r--r--  1 root root 7314620 фев 19 11:54 initramfs-4.19.97-gentoo-x86_64.img.old

-rw-r--r--  1 root root       0 янв 14 20:26 .keep_sys-boot_lilo-0

drwx------  2 root root   16384 янв 12 22:15 lost+found

-rw-------  1 root root  229376 фев 20 11:49 .map

-rw-r--r--  1 root root 3557274 янв 14 04:07 System.map-4.19.86-gentoo-x86_64

-rw-r--r--  1 root root 3309939 янв 13 05:17 System.map-4.19.86-gentoo-x86_64.old

-rw-r--r--  1 root root 3472616 фев 20 04:07 System.map-4.19.97-gentoo-x86_64

-rw-r--r--  1 root root 4249912 фев 19 04:26 System.map-4.19.97-gentoo-x86_64.old

-rw-r--r--  1 root root 7238304 янв 14 04:08 vmlinuz-4.19.86-gentoo-x86_64

-rw-r--r--  1 root root 6541984 янв 13 05:18 vmlinuz-4.19.86-gentoo-x86_64.old

-rw-r--r--  1 root root 6787744 фев 20 04:07 vmlinuz-4.19.97-gentoo-x86_64

-rw-r--r--  1 root root 9176960 фев 19 04:29 vmlinuz-4.19.97-gentoo-x86_64.old

localhost /home/lyudmila # 
```

----------

## NeddySeagoon

iurii,

Do you have grub or lilo installed to your MBR?

You can only have one or the other.

Which one do you really want to use?

----------

## iurii

 *NeddySeagoon wrote:*   

> iurii,
> 
> Do you have grub or lilo installed to your MBR?
> 
> You can only have one or the other.
> ...

 

Yes, I ran the copy command 

```
#cp /usr/src/linux-4.19.97-gentoo/arch/x86_64/boot/bzImage  /boot/bzImage
```

after genkernel had finished.

Installed LILO and let it stay.

----------

## iurii

I loaded the laptop under kernel-config-4.19.86-gentoo-x86_64 and brought the line of the boot partition of the file /etc/fstab to this form:

```
...

/dev/sda3   /boot      ext2      defaults   0 2

...
```

After rebooting under kernel-config-4.19.86-gentoo-x86_64 , I was able to get the correct result of the command ls -al /boot  and I was able to execute the command /sbin/lilo successfully.

----------

## jfp

This is good news!

 *Quote:*   

> After rebooting under kernel-config-4.19.86-gentoo-x86_64 , I was able to get the correct result of the command ls -al /boot and I was able to execute the command /sbin/lilo successfully.

 

Now that /sbin/lilo was successful, were you able to reboot into the 4.19.97 kernel?

----------

## iurii

 *jfp wrote:*   

> This is good news!
> 
>  *Quote:*   After rebooting under kernel-config-4.19.86-gentoo-x86_64 , I was able to get the correct result of the command ls -al /boot and I was able to execute the command /sbin/lilo successfully. 
> 
> Now that /sbin/lilo was successful, were you able to reboot into the 4.19.97 kernel?

 

Unfortunately,

I downloaded Gentoo with vmlinuz-4.19.86-gentoo-x86_64 kernel and gave the command again:

```

genkernel --kernel-config=/proc/config.gz --menuconfig all
```

After completing the genkernel, I commented out the line in /etc/lilo.conf

```
...

#   initrd=/boot/initramfs-4.19.97-gentoo-x86_64.img

...

```

successfully executed /sbin/lilo,

And successfully loaded my laptop under vmlinuz-4.19.97-gentoo-x86_64 first time all time.

gave the command again:

```

genkernel --kernel-config=/proc/config.gz --menuconfig all
```

and yes, the current config already contains installed kernel options:

Processor type and features --->[   ] Symmetric multi-processing support

Processor type and features --->Processor family (Intel P4 / older Netburst based Xeon) --->. 

Many thanks to NeddySeagoon for pointing out my error in the file /etc/fstab. 

Thank you very much jfp for your guiding instructions. 

Thanks Whissi for your genkernel's key.

Now I can move on.

----------

## jfp

Congratulations!

 *Quote:*   

> And successfully loaded my laptop under vmlinuz-4.19.97-gentoo-x86_64 first time all time.
> 
> gave the command again:
> 
> Code:	
> ...

 

You only need to do that the first time you install a new kernel. At the completion of the first genkernel run, the new config is copied to /etc/kernels and is then used for future kernel compiles for that kernel.

----------

## iurii

 *jfp wrote:*   

> Congratulations!
> 
>  *Quote:*   And successfully loaded my laptop under vmlinuz-4.19.97-gentoo-x86_64 first time all time.
> 
> gave the command again:
> ...

 

Yes, I understand, in theory, I could probably give the command 

```
genkernel  --menuconfig all   
```

to check the kernel config. And the genkernel would use an existing configuration file /etc/kernels/kernel-config-4.19.97-gentoo-x86_64

----------

