# wacky kernel

## raven.sorrow

I needed to rebuild my kernel (2.6.22-r5) to include 802.1d and tun/tap support so that I could create a bridging device for QEMU. I figured in the process, why not just get the latest gentoo-sources so I did and got 2.6.22-r8, I then proceeded to rebuild a new kernel from scratch (nothing new here, been doing this for several years now). Build and install and reboot. Now I get anoyed because my only network device fails to start with the following error:

```
RTNETLINK answers: Network unreachable
```

I would paste my .config but I don't have an easy way to get it off and onto my wife's computer. I was able to hackup some networking early this am, but it worked for about 5 minutes and then started w/:

```
Destination Host Unreachable
```

I am currently *re* compiling a fresh kernel (ran make mrproper) of 2.6.22-r8, took my time and made tun/tap and 802.1d modules as that was the only significant change in my kernel. Hopefully this one works, but in the meantime, can anyone offer any suggestions as to this may have happened.

----------

## John R. Graham

There's no real reason to throw away the .config from the old kernel.  Just copy it to the new kernel directory and run "make oldconfig".  Then, at least, you'll know that you're starting out from where you left off.

- John

----------

## raven.sorrow

Ok, I rebooted into yet another kernel, this time I did ./etc/init.d/net.eth0 stop and then ran a little script called /root/net that has manual configureations of ifconfig and route and started sshd manually, below I will paste some more *hopefully* helpful data

```

 * Starting eth0

 *   Bringing up eth0                                                  [ ok ]

 *   Adding routes

 *     default via 192.168.0.1 ...

RTNETLINK answers: Network is unreachable                              [ !! ]

/usr/src/linux/.config -> http://rafb.net/p/MtNKju56.html

```

----------

## raven.sorrow

 *john_r_graham wrote:*   

> There's no real reason to throw away the .config from the old kernel.  Just copy it to the new kernel directory and run "make oldconfig".  Then, at least, you'll know that you're starting out from where you left off.
> 
> - John

 

First time in my life I ditched my old kernel and Murphy's Law has come to slap me in the face :/ I got just a tag bit over confident.

----------

## raven.sorrow

This issue is still unresolved, can anyone shed some light on it?

----------

## pdr

Slightly off-topic: when I copy my kernel to /boot, I also copy the config file. Also I keep 3 kernels around "just in case". For example, my /boot on my laptop contains:

config-2.6.22-gentoo-r5

config-2.6.22-gentoo-r6

config-2.6.22-gentoo-r8

kernel-2.6.22-gentoo-r5

kernel-2.6.22-gentoo-r6

kernel-2.6.22-gentoo-r8

/usr/src has 3 linux directories (and one symlink).

When I get a new kernel, I:

1. cd /usr/src, unlink linux, ln -s <the new kernel directory> linux, and cd linux

2. cp ../<previous kernel dir>/.config ./ (if something happened to it, I can mount /boot and copy it from there)

3. make oldconfig and answer for any new options

4. If something looked interesting, make menuconfig

5. make && make modules_install

6. mount /boot

7. cp arch/<i386 or x86_64>/boot/bzImage /boot/kernel-<new kernel version>-gentoo-r<new kernel rev>

8. cp .config /boot/config-<new kernel version>-gentoo-r<new kernel rev>

9. cp System.map /boot/System.map-<new kernel version>-gentoo-r<new kernel rev>

10 vi /boot/grub/grub.conf, move the oldest (bottom) title/root/etc block to the top, and change kernel version/rev so that default grub title is newest kernel

11. rm /boot/kernel-<oldest kernel version>-gentoo-r<oldest kernel rev>; same for oldest System.map and config

12 umount /boot

13. emerge -Cp gentoo-sources-<oldest kernel version>-r<oldest kernel rev>; if looks right, remove the 'p' option.

14. (still in /usr/src/linux) rm -fr linux-<oldest version>-r<oldest rev> since unmerge does not remove it (because of object modules)

15. rm -fr /lib/modules/<oldest version>-gentoo-r<oldest rev>

16. reboot

(once you have more than 1 kernel, tab completion in bash is your friend here)

Maybe someday I'll write a bash script to automate all this. I haven't yet because new kernels don't come out all THAT often, and it helps me to remember all the pieces.

If something goes bad, I can select the previous kernel from the grub menu. For paranoia purposes I can also select the one before that - it isn't very much extra disk space. And, of course, after every successful new kernel install I update my backup.

----------

## raven.sorrow

yeah I am *usually* pretty keen on keeping a few kernels around but this is a new install and it was late and I copied over my old kernel by mistake (and I didn't keep the old srcs) ... but now I think about it, I wonder if it's some bizzar amd64/gentoo-sources-2.6.22-r8 issue ....

I have some hacked up network access now, I should emerge the last version and build a fresh kernel from that

----------

## pdr

Sorry - can't help much. The only times I have had problems with network access was:

Had udev making my device be eth1 instead of eth0; solution was to remove the "cache" entry in /etc/udev/rules.d that "remembered" my old network and considered the new setup to be a different device and thus named it eth1 instead.

Goofed up config_eth0 and routes_eth0 variables in /etc/conf.d/net. I use static IP addresses and goofy entry made it want to use dhcp.

Had an unsupported onboard chip (had to get a cheap 1x PCIe card that works extremely great).

Had my router flake out once - restarted it and all was fine.

----------

