# Fatal trap when recompiling kernel



## leboeuf (Jul 11, 2011)

Hello, I've got a server on FreeBSD 7.2-RELEASE 32 bits. A month ago I recompile my kernel GENERIC with some other options, it works good. But today, I decided to recompile my kernel "in" PAE for using more ram but now I can't access my server. I've got this error when I try to boot with vkvm.

http://imageshack.us/photo/my-images/52/fataltrap.jpg/

So the kernel is the problem.

How can I boot on an other kernel (for example the oldest wich works or another) with bsd-rescue or anything else ?

Sorry for my bad english, I try to be the most clear I can.


----------



## SirDice (Jul 11, 2011)

Handbook: 8.7 If Something Goes Wrong


----------



## leboeuf (Jul 11, 2011)

I've already seen this but I don't understand. I read the /var/log/messages but the kernel is the rescue kernel so I haven't got anything that can help me. 


> If your new kernel does not boot, or fails to recognize your devices, do not panic! Fortunately, FreeBSD has an excellent mechanism for recovering from incompatible kernels. Simply choose the kernel you want to boot from at the FreeBSD boot loader. You can access this when the system boot menu appears. Select the â€œEscape to a loader promptâ€ option, number six. At the prompt, type boot kernel.old, or the name of any other kernel that will boot properly. When reconfiguring a kernel, it is always a good idea to keep a kernel that is known to work on hand.


I have a got a server so I cannot access this because I never see the system boot menu. So I can't Select the â€œEscape to a loader promptâ€ option, number six. Maybe there is a method to see this boot menu in rescue-bsd or in vkvm. And in rescue-bsd I haven't got /boot/kernel.old so I don't know how to backup the old kernel in rescue-bsd.


----------



## SirDice (Jul 11, 2011)

Try:
`# nextboot -k kernel.old`

See nextboot(8)


----------



## leboeuf (Jul 11, 2011)

The problem is I haven't got the /boot/kernel.old
In the bsd-rescue, I doesn't see the /usr/src, the /boot/kernel.old , /home, ect,... so I've got the error :

```
Error: /boot/kernel.old doesn't exist. Use -f to override.
```
When I write `# nextboot -k kernel.old -f` I've got:

```
/sbin/nextboot: cannot create /boot/nextboot.conf: Read-only file system
```
Maybe another mod that bsd-rescue can works for this ? Or how can I set this with bsd-rescue.


----------



## leboeuf (Jul 11, 2011)

I arrive to put my server on vkvm and I boot on the hard disk.
Now I have the boot menu and I select â€œEscape to a loader promptâ€
I write
`# unload kernel`
`# boot /boot/kernel.old/kernel`
Then I arrive here and I don't know what write:
http://imageshack.us/photo/my-images/405/fataltrap2.jpg/
What should I write here ?


----------



## Zare (Jul 11, 2011)

ufs:ad0s1a


----------



## leboeuf (Jul 11, 2011)

Yes but when I do that I must make :
`# fsck -y`
And I've got this error :
http://imageshack.us/photo/my-images/62/fataltrap3.jpg/
The problem is the line :

```
Can't stat /dev/ad4s1b : No such file or directory
```
I don't know what do next...
I really want to don't lost my datas.

I put here some informations wich maybe can help to fix the problem:

`# mount -u`

```
188.165.241.232:/home/pub/bsd-rescue7 on / (nfs)
devfs on /dev (devfs, local, multilabel)
/dev/md0 on /etc (ufs, local)
/dev/md1 on /root (ufs, local)
/dev/md2 on /var (ufs, local)
procfs on /proc (procfs, local)
devfs on /var/named/dev (devfs, local, multilabel)
/dev/md3 on /tmp (ufs, local)
```

`# disklabel /dev/ad4s1`

```
# /dev/ad4s1:
8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  a: 40960000        0    4.2BSD     4096 16384 20732
  b: 3865020416 40960000    4.2BSD     2048 16384 28552
  c: 3907029105        0    unused        0     0         # "raw" part, don't edit
  d:  1048689 3905980416      swap
```

`# fdisk ad4`

```
******* Working on device /dev/ad4 *******
parameters extracted from in-core disklabel are:
cylinders=3876021 heads=16 sectors/track=63 (1008 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=3876021 heads=16 sectors/track=63 (1008 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 63, size 3907029105 (1907729 Meg), flag 80 (active)
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 180/ head 15/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
```

`# cat /etc/fstab`

```
proc            /proc   procfs  rw      0 0
```

The problem is the partition ad4s1b, when I try to write 
ufs:ad0s1b (not ad0s1a)
I've got this:

```
Trying to mount root from ufs:ad0s1b
WARNING: /mnt/var was not properly dismounted
Lookup of /dev for devfs, error: 2
init: not found in path /sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall
panic: not init
cpuid = 0
Uptime: 2m43s
Cannot dump. No dump device defined.
Automatic reboot in 15 seconds...
```

When I try to mount ad0s1b:
`# mount /dev/ad0s1b`
I got this:

```
Label ufsid/4e0ba617b766ee08 removed.
[color="Red"]WARNING: /mnt/var was not properly dismounted[/color]
```


----------



## leboeuf (Jul 12, 2011)

Anyone can help me? I just want put /boot/kernel.old in place of /boot/kernel
I've notice that in vkvm, FreeBSD recognizes the partition in ad0s1a as contrary as in bsd-rescue that the partition are like ad4s1a
So at the beginning of the mountroot, I must put ad0s1a and then it search ad4s1b wich it doesn't find because he wants ad0s1b.

EDIT: I solved my problem by myself.


----------

