# IPtables not working in kernel 4.8.10[SOLVED]

## jserink

Hi All:

This is my machine:

```
jserinki7 vde # uname -a

Linux jserinki7 4.8.10-gentoo #44 SMP PREEMPT Sun Nov 27 05:09:30 SGT 2016 x86_64 Intel(R) Core(TM) i7-2720QM CPU @ 2.20GHz GenuineIntel GNU/Linux
```

To run windows7x64 in qemu-kvm, I run this script to setup my machine:

```
jserinki7 vde # cat vdepreparewlan0.sh

#!/bin/bash

vde_switch --numports 4 --mod 777 --group users --tap tap0 -x -d

ip addr add dev tap0 192.168.100.1/24 brd 192.168.100.255

ip link set dev tap0 up

echo "1" > /proc/sys/net/ipv4/ip_forward

dnsmasq --log-queries --interface=tap0

#iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

iptables -t nat -A POSTROUTING -o wlp3s0 -j MASQUERADE

iptables -A FORWARD -j ACCEPT

iptables -A INPUT -i tap0 -j ACCEPT
```

Here is the IPtables output:

```
iptables v1.4.21: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.
```

Here is my iptables:

```
jserinki7 jserink # emerge -pv  iptables

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

Calculating dependencies... done!

[ebuild   R    ] net-firewall/iptables-1.4.21-r1::gentoo  USE="ipv6 -conntrack -netlink -static-libs" 535 KiB

Total: 1 package (1 reinstall), Size of downloads: 535 KiB
```

I've been getting this all night so I built EVERYTHING in the net filters section into the kernel and I'm still getting these errors.

Anyone have any thoughts on this?

kernel config is here:

http://pastebin.com/raw/1jw1gEH6

Cheers,

john

[Moderator edit: added [code] tags to preserve output layout.  As a courtesy to readers, please consider using these as part of your post. -Hu]Last edited by jserink on Thu Dec 01, 2016 3:44 am; edited 1 time in total

----------

## Logicien

Hello,

what I do, is to put everything I can related to the Linux firewall Netfilter in modules [m]. By doing so, I can enable all options and I am sure non of them will be missing. I compile the iptables package with the conntrack ipv6 and netlink USE flags enabled.

To have the Security table I enable some options in the Security options of the Linux kernel.

----------

## Ant P.

That kernel's 2 days old, are you sure you installed the one corresponding to that config after recompiling it?

----------

## jserink

Hi all:

Thank you for the tips.

My HDD crashed about 10 days ago and that kernel is the only one on my machine so i'm fairly sure that is what's being loaded.

I tried compiling as modules but was getting a strange error when I tried loading some of them...can't recall exactly, something like 'exec error'.

I got the same thing when trying to compile my sound stuff, Intel-hda, as modules.

Wierd.

John

----------

## Jaglover

Yup, that error means you are trying to load modules into running kernel and the versions of modules and kernel do not match. Check your running kernel version with uname -a.

----------

## jserink

 *Jaglover wrote:*   

> Yup, that error means you are trying to load modules into running kernel and the versions of modules and kernel do not match. Check your running kernel version with uname -a.

 

That is weird.

Everthing is compiles with make -j6

make -j6 modules_install

make install

How could the modules not match the kernel?

Should I do a make clean before I install and delete the /lib/modules/gentoo-4.8.10 directory just before I do make modules_install?

Cheers,

John

----------

## jserink

More good news.....

There is a new thing called nftables.....just when I was getting my head around iptables, the world is changing again.

I was mixing this stuff up in my kernel config....i was also getting a lot of kernel panics with certain builds...i've never seen that before. 

Maybe nftable modules don't coexist nicely with iptables modules?

Thoughts?

Cheers

,john

----------

## Jaglover

 *Quote:*   

> How could the modules not match the kernel? 

 

Easy, you forget to mount /boot before you install the new kernel and the next boot will be with old kernel, again.

----------

## jserink

Ahhhh.....in that case t modules are updated but no the kernel.

Makes sense except this is a brand new install so I have /boot mounting automatically in fstab....or so I thought.

I better that checking the vmlinux file age after I run make install just to make sure.

Cheers,

John

----------

## Hu

Normally, I would suggest that you consult /proc/config.gz instead of linking to a static .config that may or may not be current.  However, I see in your static .config that you have IKCONFIG=n, so you will not have a /proc/config.gz.  I suggest enabling that with your next rebuild.  Keeping the configuration embedded in the live kernel is very convenient for handling questions about whether the running kernel has enabled the options that you think you did.

----------

## jserink

Good tip Hu.

Done.

----------

## jserink

Another question 'slightly' off topic.....

I want to place a copy of a kernel I know will boot properly with video and heat sensors into boot, grub-mkconfig says it sees it but it never shows up in the menu which I have to go through after a kernel panic with a test kernel.

I'm left with getting a 640x480 console, going to /usr/src/linux, copying over a .configIknowWorks to .config make -j6 && make -j6 modules_install then make install.

I want to jump past this by having a working kernel in there....this was a doddle with old grub how to do this with grub2?

Cheers,

John

----------

## jserink

Hi guys:

Really strange behaviour on this new install of mine....

The tun module gets installed, I can see it with lsmod but when I do an IP link, it's not there.

I try and give it an IP address with ip addr and the command never returns and can't be killed. Then when I try and shutdown, half way through it kernel panics.....

Then KVM and KVM-Intel modules won't look, I get that exec error but I built them with this kernel, this build. I even deleted my /lib/modules/4.8.10-gentoo directory and watched make modules_install put the directory back. Make install put the just compiled kernel in boot, I confirmed with the time on the file.

After some google FU the only possible explanation is a bollixed up toolchain. So i'm going to take a few hours and rebuild the bastard. I'm still running on the stage 3 toolchain.

I'll let you know how it goes.

Cheers,

John

----------

## jserink

Hi All:

No difference after rebuilding the tool chain.

Ok, this is related to the iptables issue as when I try and put iptables as modules, it won't load.

Lets look at the loop module:

jserinki7 jserink # modinfo loop

filename:       /lib/modules/4.8.10-gentoo/kernel/drivers/block/loop.ko

alias:          devname:loop-control

alias:          char-major-10-237

alias:          block-major-7-*

license:        GPL

depends:        

intree:         Y

vermagic:       4.8.10-gentoo SMP preempt mod_unload 

parm:           max_loop:Maximum number of loop devices (int)

parm:           max_part:Maximum number of partitions per loop device (int)

jserinki7 jserink # uname -a

Linux jserinki7 4.8.10-gentoo #44 SMP PREEMPT Sun Nov 27 05:09:30 SGT 2016 x86_64 Intel(R) Core(TM) i7-2720QM CPU @ 2.20GHz GenuineIntel GNU/Linux

jserinki7 jserink # modprobe loop

modprobe: ERROR: could not insert 'loop': Exec format error

jserinki7 jserink # insmod loop

insmod: ERROR: could not load module loop: No such file or directory

 < >     MAC-VLAN support                                                              │ │  

  │ │                < >     IP-VLAN support                                                               │ │  

  │ │                < >     Virtual eXtensible Local Area Network (VXLAN)                                 │ │  

  │ │                < >     IEEE 802.1AE MAC-level encryption (MACsec)                                    │ │  

  │ │                <*>     Network console logging support                                               │ │  

  │ │                <M>     Universal TUN/TAP device driver support                                       │ │  

  │ │                [ ]     Support for cross-endian vnet headers on little-endian kernels                │ │  

  │ │                < >     Virtual ethernet pair device                                                  │ │  

  │ │                < >     Virtual netlink monitoring device                                 

I just rebuilt the kernel and this module 5 minutes ago. Why do I get that error.

Tun is even stranger....

It will load:

jserinki7 linux # ip link

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

2: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1

    link/sit 0.0.0.0 brd 0.0.0.0

3: enp0s25: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000

    link/ether d0:67:e5:33:04:bf brd ff:ff:ff:ff:ff:ff

4: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000

    link/ether 24:77:03:04:61:50 brd ff:ff:ff:ff:ff:ff

jserinki7 linux # modprobe tun

jserinki7 linux # ip link

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

2: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1

    link/sit 0.0.0.0 brd 0.0.0.0

3: enp0s25: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000

    link/ether d0:67:e5:33:04:bf brd ff:ff:ff:ff:ff:ff

4: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000

    link/ether 24:77:03:04:61:50 brd ff:ff:ff:ff:ff:ff

But there is no tap0 interface.

WTF?

I am really lost here.

Kernel setup is here:

http://pastebin.com/raw/inrsWiqb

Dmesg is here:

http://pastebin.com/raw/K49juTf8

Looking for any tips that might help.

Cheers,

John

----------

## Jaglover

You are still not running the kernel you think you are.

```
Linux version 4.8.10-gentoo (root@livecd) (gcc version 4.9.3 (Gentoo 4.9.3 p1.5, pie-0.6.4) ) #44 SMP PREEMPT Sun Nov 27 05:09:30 SGT 2016
```

^^ See the date and time?

----------

## jserink

Well spotted.

Then it's a grub2 issue.

I run 'make install' and it moves the kernel over to boot. I can see it, it has the correct time......

Hmmmm....

----------

## jserink

Right, on my laptop now, check this out:

jserinki7 jserink # ls -l /boot

total 23908

-rw-r--r-- 1 root root  107501 Dec  1 00:31 config-4.8.10-gentoo

-rw-r--r-- 1 root root  107037 Nov 30 23:41 config-4.8.10-gentoo.old

drwxr-xr-x 6 root root    4096 Nov 30 11:32 grub

-rw-r--r-- 1 root root 3032772 Dec  1 00:31 System.map-4.8.10-gentoo

-rw-r--r-- 1 root root 3031670 Nov 30 23:41 System.map-4.8.10-gentoo.old

-rw-r--r-- 1 root root 6058800 Dec  1 00:31 vmlinuz-4.8.10-gentoo

-rw-r--r-- 1 root root 6058160 Nov 30 23:41 vmlinuz-4.8.10-gentoo.old

-rw-r--r-- 1 root root 6060016 Nov 30 00:41 vmlinuz-4.8.10-gentoo-working

jserinki7 jserink # uname -a

Linux jserinki7 4.8.10-gentoo #44 SMP PREEMPT Sun Nov 27 05:09:30 SGT 2016 x86_64 Intel(R) Core(TM) i7-2720QM CPU @ 2.20GHz GenuineIntel GNU/Linux

So I'm running a kernel built on November 27....but checkout my /boot directory, there is not kernel built on November 27.

So where did Grub2 get the kernel that I'm currently running?

Cheers,

john

----------

## jserink

Ok guys, my problem is DEFINITELY grub2....the systemd of boot loaders.....sigh.

To the devs out there, a boot loader is just supposed to boot the system, nohthing else. Its NOT supposed to be a mini-OS to find, troubleshoot, diagnose, discover what's on a system...we have USB boot systems for that. Grub2 took grub, which was functional, and made it into s dis-functioning load of bloat...EXACTLY the same as systemd. Sometimes developers need adult supervision, alas in this case....

SO, I compile a new kernel...

I run make install...

and you can see it here:

jserinki7 jserink # ls -l /boot

total 23908

-rw-r--r-- 1 root root  107501 Dec  1 00:31 config-4.8.10-gentoo

-rw-r--r-- 1 root root  107037 Nov 30 23:41 config-4.8.10-gentoo.old

drwxr-xr-x 6 root root    4096 Dec  1 10:22 grub

-rw-r--r-- 1 root root 3032772 Dec  1 00:31 System.map-4.8.10-gentoo

-rw-r--r-- 1 root root 3031670 Nov 30 23:41 System.map-4.8.10-gentoo.old

-rw-r--r-- 1 root root 6058800 Dec  1 00:31 vmlinuz-4.8.10-gentoo

-rw-r--r-- 1 root root 6058160 Nov 30 23:41 vmlinuz-4.8.10-gentoo.old

-rw-r--r-- 1 root root 6060016 Nov 30 00:41 vmlinuz-4.8.10-gentoo-working

There it is, lovely little thing compiled on Dec 1 along wiht its system.map and config.

I run:

grub-mkconfig -o /boot/grub/grub.cfg

It updated everything and is SUPPOSED to set the most recent kernel as default.

Now, recall, there is NO kernel there from November 27.

I reboot, select the default and I get this:

jserinki7 jserink # uname -a

Linux jserinki7 4.8.10-gentoo #44 SMP PREEMPT Sun Nov 27 05:09:30 SGT 2016 x86_64 Intel(R) Core(TM) i7-2720QM CPU @ 2.20GHz GenuineIntel GNU/Linux

Just where in the fxxk did grub find a kernel from November 27 to boot? 

1. I chose the default which must mean that grub set this 'magic' Nov 27 kernel as default and NOT the Dec 1 kernel,

2. Where is this Nov 27 kernel? Where is it hiding?

SO, for number 2, lets check.....

rebuild th emlocate database with updatedb

and....

jserinki7 jserink # locate vmlinuz

/boot/vmlinuz-4.8.10-gentoo

/boot/vmlinuz-4.8.10-gentoo-working

/boot/vmlinuz-4.8.10-gentoo.old

/usr/src/linux-4.8.10-gentoo/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c

/usr/src/linux-4.8.4-gentoo/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c

This is nuts! There is no kernel from Nov 27 but that is what is running. I'm telling you, grub2 is phsyco.

I'm deleting all the junk out of boot:

jserinki7 jserink # ls -l /boot

total 8996

-rw-r--r-- 1 root root  107501 Dec  1 00:31 config-4.8.10-gentoo

drwxr-xr-x 6 root root    4096 Dec  1 10:22 grub

-rw-r--r-- 1 root root 3032772 Dec  1 00:31 System.map-4.8.10-gentoo

-rw-r--r-- 1 root root 6058800 Dec  1 00:31 vmlinuz-4.8.10-gentoo

alright....

jserinki7 jserink # !470

grub-mkconfig -o /boot/grub/grub.cfg

Generating grub configuration file ...

Found background: /boot/grub/KidsPool.jpg

Found linux image: /boot/vmlinuz-4.8.10-gentoo

done

Now, we try a reboot.

Fxxk I have this....I just want my KVM back, I have autocad work to do.....sheese.

Cheers,

John

----------

## jserink

Ok....so.....

As you saw above, there is NO other kernel in /boot except for the one build on Dec 1, 2016.

You saw me above delete everything in boot except for that kernel....

You saw me issue:

grub-mkconfig -o /boot/grub/grub.cfg

Which reported that it found only ONE kernel in boot....

yet I reboot and there is the old selection menu....

with 6 kernels included the old 4.8.4 one that I deleted long ago.

WTF?

And where is my grub splash photo of my kids:

jserinki7 jserink # ls -l /etc/default/grub

-rw-r--r-- 1 root root 2534 Nov 30 11:01 /etc/default/grub

# Background image used on graphical terminal.

# Can be in various bitmap formats.

GRUB_BACKGROUND="/boot/grub/KidsPool.jpg"

jserinki7 jserink # ls -l /boot/grub

total 1416

drwxr-xr-x 2 root root    4096 Nov 25 22:36 fonts

-rw------- 1 root root    5219 Dec  1 11:21 grub.cfg

-rw-r--r-- 1 root root    1024 Nov 25 22:36 grubenv

drwxr-xr-x 2 root root   12288 Nov 25 22:36 i386-pc

-rw-r--r-- 1 root root 1411140 Nov 30 11:00 KidsPool.jpg

drwxr-xr-x 2 root root    4096 Nov 25 22:36 locale

drwxr-xr-x 3 root root    4096 Nov 25 22:36 themes

The grub.cfg file from /boot/grub:

jserinki7 jserink # cat /boot/grub/grub.cfg

#

# DO NOT EDIT THIS FILE

#

# It is automatically generated by grub-mkconfig using templates

# from /etc/grub.d and settings from /etc/default/grub

#

### BEGIN /etc/grub.d/00_header ###

if [ -s $prefix/grubenv ]; then

  load_env

fi

if [ "${next_entry}" ] ; then

   set default="${next_entry}"

   set next_entry=

   save_env next_entry

   set boot_once=true

else

   set default="0"

fi

if [ x"${feature_menuentry_id}" = xy ]; then

  menuentry_id_option="--id"

else

  menuentry_id_option=""

fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then

  set saved_entry="${prev_saved_entry}"

  save_env saved_entry

  set prev_saved_entry=

  save_env prev_saved_entry

  set boot_once=true

fi

function savedefault {

  if [ -z "${boot_once}" ]; then

    saved_entry="${chosen}"

    save_env saved_entry

  fi

}

function load_video {

  if [ x$feature_all_video_module = xy ]; then

    insmod all_video

  else

    insmod efi_gop

    insmod efi_uga

    insmod ieee1275_fb

    insmod vbe

    insmod vga

    insmod video_bochs

    insmod video_cirrus

  fi

}

if [ x$feature_default_font_path = xy ] ; then

   font=unicode

else

insmod part_msdos

insmod ext2

set root='hd0,msdos4'

if [ x$feature_platform_search_hint = xy ]; then

  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  60f4cbf7-3ea3-4a14-a924-1ad5b3a95086

else

  search --no-floppy --fs-uuid --set=root 60f4cbf7-3ea3-4a14-a924-1ad5b3a95086

fi

    font="/usr/share/grub/unicode.pf2"

fi

if loadfont $font ; then

  set gfxmode=auto

  load_video

  insmod gfxterm

  set locale_dir=$prefix/locale

  set lang=en_US

  insmod gettext

fi

terminal_output gfxterm

insmod part_msdos

insmod ext2

set root='hd0,msdos4'

if [ x$feature_platform_search_hint = xy ]; then

  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  60f4cbf7-3ea3-4a14-a924-1ad5b3a95086

else

  search --no-floppy --fs-uuid --set=root 60f4cbf7-3ea3-4a14-a924-1ad5b3a95086

fi

insmod jpeg

background_image -m stretch /boot/grub/KidsPool.jpg

if [ x$feature_timeout_style = xy ] ; then

  set timeout_style=menu

  set timeout=5

# Fallback normal timeout code in case the timeout_style feature is

# unavailable.

else

  set timeout=5

fi

### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###

menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-60f4cbf7-3ea3-4a14-a924-1ad5b3a95086' {

	load_video

	insmod gzio

	insmod part_msdos

	insmod ext2

	set root='hd0,msdos4'

	if [ x$feature_platform_search_hint = xy ]; then

	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  60f4cbf7-3ea3-4a14-a924-1ad5b3a95086

	else

	  search --no-floppy --fs-uuid --set=root 60f4cbf7-3ea3-4a14-a924-1ad5b3a95086

	fi

	echo	'Loading Linux 4.8.10-gentoo ...'

	linux	/boot/vmlinuz-4.8.10-gentoo root=/dev/sda4 ro  

}

submenu 'Advanced options for Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-60f4cbf7-3ea3-4a14-a924-1ad5b3a95086' {

	menuentry 'Gentoo GNU/Linux, with Linux 4.8.10-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.8.10-gentoo-advanced-60f4cbf7-3ea3-4a14-a924-1ad5b3a95086' {

		load_video

		insmod gzio

		insmod part_msdos

		insmod ext2

		set root='hd0,msdos4'

		if [ x$feature_platform_search_hint = xy ]; then

		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  60f4cbf7-3ea3-4a14-a924-1ad5b3a95086

		else

		  search --no-floppy --fs-uuid --set=root 60f4cbf7-3ea3-4a14-a924-1ad5b3a95086

		fi

		echo	'Loading Linux 4.8.10-gentoo ...'

		linux	/boot/vmlinuz-4.8.10-gentoo root=/dev/sda4 ro  

	}

	menuentry 'Gentoo GNU/Linux, with Linux 4.8.10-gentoo (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.8.10-gentoo-recovery-60f4cbf7-3ea3-4a14-a924-1ad5b3a95086' {

		load_video

		insmod gzio

		insmod part_msdos

		insmod ext2

		set root='hd0,msdos4'

		if [ x$feature_platform_search_hint = xy ]; then

		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  60f4cbf7-3ea3-4a14-a924-1ad5b3a95086

		else

		  search --no-floppy --fs-uuid --set=root 60f4cbf7-3ea3-4a14-a924-1ad5b3a95086

		fi

		echo	'Loading Linux 4.8.10-gentoo ...'

		linux	/boot/vmlinuz-4.8.10-gentoo root=/dev/sda4 ro single 

	}

}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###

### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###

# This file provides an easy way to add custom menu entries.  Simply type the

# menu entries you want to add after this comment.  Be careful not to change

# the 'exec tail' line above.

### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###

if [ -f  ${config_directory}/custom.cfg ]; then

  source ${config_directory}/custom.cfg

elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then

  source $prefix/custom.cfg;

fi

### END /etc/grub.d/41_custom ###

This file looks correct......there is one entry, to the only kernel that is in boot.....but that's not what is booting....

its a phantom kernel that does not reside on my mounted disks AND from a phantom grub menu that does not match the above.

Ok, did this again...

jserinki7 jserink # grub-install /dev/sda

Installing for i386-pc platform.

Installation finished. No error reported.

jserinki7 jserink # grub-mkconfig -o /boot/grub/grub.cfg

Generating grub configuration file ...

Found background: /boot/grub/KidsPool.jpg

Found linux image: /boot/vmlinuz-4.8.10-gentoo

done

Reboot time....

I'll let you know how it goes.....

this is aging me.

john

----------

## jserink

Ok, so it seems with grub2 if you change anything you need to:

1. grub-install /dev/sda 

2. grub-mkconfig -o /boot/grub/grub.cfg 

Everything I read said you only need to do number 2....LIES!

So now, when I recompile a new kernel BEFORE running make install, I need to go to /boot and rename the current stuff to Systemap*-A, config*-A and vmlinuz*-A then run make install then do 1 and 2 above.

Ok, I get it.....6 days to learn this?

I've read the gentoo grub2 wiki about 30 times in the last week and I can't find that above advice anywhere.

Thanx for all the tips guys, especially pointing me the OBVIOUS fact that I was NOT running kernel I thought.

Its still a mystery to me just WHERE grub2 was hiding that the November 27 kernel that it kept booting.....does it cache it in the MBR or something? I guess it must because it needs a file system to mount /boot which it doesn't have until the kernel boots.

Anyhow, I'm up and this now explains all the trouble I've been having since day 1 of this reinstall....

I can get back to work.

Cheers,

john

----------

## Jaglover

Grub does read your boot partition filesystem but it really does not mount it in normal sense. Once the kernel starts it does not mount /boot either because there is nothing needed on that partition.

----------

## Tony0945

I'm glad I stayed with grub legacy. I just nano /boot/grub/menu.lst and change the kernel number. Or cut and copy three lines and change the kernel number if I want to save the old kernel temporarily.

----------

## Jaglover

I am even lazier than that, my current kernel is always bzImage and the previous working one is bzImage.pre. No bootloader edit needed when upgrading.

----------

## jserink

I'm with you guys....

I had grub legacy on my old HDD and stayed with it. I had read over the Grub2 upgrade wiki and decided that was just too much to digest simply for booting my system.

Alas, when my HDD failed, I went with the default....MISTAKE!

At least now I know how it works......

I can't believe that over the last 10 days part of my frustration on getting my machine working with the new HDD was bloody grub2.

As I said, grub2 is like systemd, an example of mission creep writ large.

Cheers,

John

----------

## ct85711

a very common issue when you are booting the wrong kernel is that you did not mount the boot partition before copying it over (or using make install, which usually copies the compiled kernel over).

By default the /boot partition is NOT automatically mounted.  This does not mean you won't have a /boot on your system...

A easy way to check, is run mount  and check what it says.  (nothing after mount will list your mounted filesystems).

----------

## jserink

boot is mounted, otherwise ls -l /boot will return nothing.

I'll adjust fstab to have it unmounted after my system is stable but during the install phase I have it set to auto mount.

Cheers,

johh

----------

