# freebsd 8-beta2 and pf



## z0ran (Aug 15, 2009)

First of all i couldn't enable pf with "pfctl -e", then i couldn't load module with "kldload pf.ko", it gives me

```
%  kldload /boot/kernel/pf.ko
kldload: can't load /boot/kernel/pf.ko: Exec format error
```
and at the end i couldn't find in kernel:

device pf
device pflog
device pfsync
is it something with the 8-beta2 or..I did something wrong..and i dont remember where and what.

This is my 

```
% uname -a
FreeBSD freebsd.svarog-r00lz.info 8.0-BETA2 FreeBSD 8.0-BETA2 #0: Wed Jul 15 21:48:41 UTC 2009     root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
```

and

```
% file /boot/kernel/pf.ko
/boot/kernel/pf.ko: ELF 64-bit LSB relocatable, x86-64, version 1 (FreeBSD), not stripped
```


```
% kldstat
Id Refs Address            Size     Name
 1   15 0xffffffff80100000 ef0820   kernel
 2    1 0xffffffff80ff1000 196498   zfs.ko
 3    2 0xffffffff81188000 3a98     opensolaris.ko
 4    1 0xffffffff8118c000 23f48    snd_hda.ko
 5    2 0xffffffff811b0000 86d88    sound.ko
```

any idea please, thanks!


----------



## rolle (Aug 15, 2009)

Did you changed your kern.securelevel ?


----------



## z0ran (Aug 15, 2009)

no, i didn't do anything about securelevel


----------



## rolle (Aug 15, 2009)

On my i386 everything working fine.

```
FreeBSD workstation.rolltek.net 8.0-BETA2 FreeBSD 8.0-BETA2 #1: Mon Aug 10 12:21:50 CEST 2009     root@workstation.xxxx.xxx:/usr/obj/usr/src/sys/GENERIC  i386
```

But you are using amd64.
hmm ... whats about your make.conf ? do you use special build options and the latest sources ?


----------



## rolle (Aug 15, 2009)

On my i386 everything working fine.

```
FreeBSD workstation.xxxx.xxx 8.0-BETA2 FreeBSD 8.0-BETA2 #1: Mon Aug 10 12:21:50 CEST 2009     root@workstation.xxxx.xxx:/usr/obj/usr/src/sys/GENERIC  i386
```

But you are using amd64.
hmm ... whats about your make.conf ? do you use special build options and the latest sources ?


----------



## z0ran (Aug 15, 2009)

no, nothing special in there, but i just found this:


```
% more /var/run/dmesg.boot
Copyright (c) 1992-2009 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 8.0-BETA2 #0: Wed Jul 15 21:48:41 UTC 2009
    root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC
WARNING: WITNESS option enabled, expect reduced performance.
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: AMD Phenom(tm) 9550 Quad-Core Processor (2200.09-MHz K8-class CPU)
  Origin = "AuthenticAMD"  Id = 0x100f23  Stepping = 3
  Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x802009<SSE3,MON,CX16,POPCNT>
  AMD Features=0xee500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM,3DNow!+,3DNow!>
  AMD Features2=0x7ff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,IBS>
  TSC: P-state invariant
real memory  = 3221225472 (3072 MB)
avail memory = 2829471744 (2698 MB)
ACPI APIC Table: <073108 APIC1642>
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
FreeBSD/SMP: 1 package(s) x 4 core(s)
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
 cpu2 (AP): APIC ID:  2
 cpu3 (AP): APIC ID:  3
This module (opensolaris) contains code covered by the
Common Development and Distribution License (CDDL)
see http://opensolaris.org/os/licensing/opensolaris_license/
ioapic0 <Version 2.1> irqs 0-23 on motherboard
kbd1 at kbdmux0
acpi0: <073108 RSDT1642> on motherboard
acpi0: [ITHREAD]
acpi0: Power Button (fixed)
acpi0: reservation of fee00000, 1000 (3) failed
acpi0: reservation of ffb80000, 80000 (3) failed
acpi0: reservation of fec10000, 20 (3) failed
acpi0: reservation of 0, a0000 (3) failed
acpi0: reservation of 100000, aff00000 (3) failed
ACPI HPET table warning: Sequence is non-zero (2)
Timecounter "ACPI-safe" frequency 3579545 Hz quality 850
acpi_timer0: <32-bit timer at 3.579545MHz> port 0x808-0x80b on acpi0
acpi_hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0
Timecounter "HPET" frequency 14318180 Hz quality 900
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pcib1: <ACPI PCI-PCI bridge> at device 1.0 on pci0
pci1: <ACPI PCI bus> on pcib1
vgapci0: <VGA-compatible display> port 0xc000-0xc0ff mem 0xd0000000-0xdfffffff,0xfe9f0000-0xfe9fffff,0xfe800000-0xfe8fffff irq 18 at device 5.0 on pci1
hdac0: <ATI RS780 High Definition Audio Controller> mem 0xfe9e8000-0xfe9ebfff irq 19 at device 5.1 on pci1
hdac0: HDA Driver Revision: 20090624_0136
hdac0: [ITHREAD]
pcib2: <ACPI PCI-PCI bridge> irq 18 at device 6.0 on pci0
pci2: <ACPI PCI bus> on pcib2
re0: <RealTek 8168/8168B/8168C/8168CP/8168D/8111B/8111C/8111CP PCIe Gigabit Ethernet> port 0xd800-0xd8ff mem 0xfeaff000-0xfeafffff,0xfdff0000-0xfdffffff irq 18 at device 0.0 on pci2
re0: Using 1 MSI messages
re0: Chip rev. 0x3c000000
re0: MAC rev. 0x00400000
miibus0: <MII bus> on re0
rgephy0: <RTL8169S/8110S/8211B media interface> PHY 1 on miibus0
rgephy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
re0: Ethernet address: 00:21:97:08:14:22
re0: [FILTER]
atapci0: <ATI IXP700/800 SATA300 controller> port 0xb000-0xb007,0xa000-0xa003,0x9000-0x9007,0x8000-0x8003,0x7000-0x700f mem 0xfe7ff800-0xfe7ffbff irq 22 at device 17.0 on pci0
atapci0: [ITHREAD]
atapci0: AHCI v1.10 controller with 4 3Gbps ports, PM supported
ata2: <ATA channel 0> on atapci0
ata2: port is not ready (timeout 0ms) tfd = 000001d0
ata2: software reset clear timeout
ata2: [ITHREAD]
ata3: <ATA channel 1> on atapci0
ata3: [ITHREAD]
ata4: <ATA channel 2> on atapci0
ata4: [ITHREAD]
ata5: <ATA channel 3> on atapci0
ata5: [ITHREAD]
ohci0: <OHCI (generic) USB controller> mem 0xfe7fe000-0xfe7fefff irq 16 at device 18.0 on pci0
ohci0: [ITHREAD]
usbus0: <OHCI (generic) USB controller> on ohci0
ohci1: <OHCI (generic) USB controller> mem 0xfe7fd000-0xfe7fdfff irq 16 at device 18.1 on pci0
ohci1: [ITHREAD]
usbus1: <OHCI (generic) USB controller> on ohci1
ehci0: <EHCI (generic) USB 2.0 controller> mem 0xfe7ff000-0xfe7ff0ff irq 17 at device 18.2 on pci0
ehci0: [ITHREAD]
usbus2: EHCI version 1.0
usbus2: <EHCI (generic) USB 2.0 controller> on ehci0
ohci2: <OHCI (generic) USB controller> mem 0xfe7fc000-0xfe7fcfff irq 18 at device 19.0 on pci0
ohci2: [ITHREAD]
usbus3: <OHCI (generic) USB controller> on ohci2
ohci3: <OHCI (generic) USB controller> mem 0xfe7fb000-0xfe7fbfff irq 18 at device 19.1 on pci0
ohci3: [ITHREAD]
usbus4: <OHCI (generic) USB controller> on ohci3
ehci1: <EHCI (generic) USB 2.0 controller> mem 0xfe7fa800-0xfe7fa8ff irq 19 at device 19.2 on pci0
ehci1: [ITHREAD]
usbus5: EHCI version 1.0
usbus5: <EHCI (generic) USB 2.0 controller> on ehci1
pci0: <serial bus, SMBus> at device 20.0 (no driver attached)
atapci1: <ATI IXP700/800 UDMA133 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xff00-0xff0f at device 20.1 on pci0
ata0: <ATA channel 0> on atapci1
ata0: [ITHREAD]
ata1: <ATA channel 1> on atapci1
ata1: [ITHREAD]
hdac1: <ATI SB600 High Definition Audio Controller> mem 0xfe7f4000-0xfe7f7fff irq 16 at device 20.2 on pci0
hdac1: HDA Driver Revision: 20090624_0136
hdac1: [ITHREAD]
isab0: <PCI-ISA bridge> at device 20.3 on pci0
isa0: <ISA bus> on isab0
pcib3: <ACPI PCI-PCI bridge> at device 20.4 on pci0
pci3: <ACPI PCI bus> on pcib3
rl0: <RealTek 8139 10/100BaseTX> port 0xe800-0xe8ff mem 0xfebffc00-0xfebffcff irq 20 at device 5.0 on pci3
miibus1: <MII bus> on rl0
rlphy0: <RealTek internal media interface> PHY 0 on miibus1
rlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
rl0: Ethernet address: 00:a1:b0:01:38:1a
rl0: [ITHREAD]
ohci4: <OHCI (generic) USB controller> mem 0xfe7f9000-0xfe7f9fff irq 18 at device 20.5 on pci0
ohci4: [ITHREAD]
usbus6: <OHCI (generic) USB controller> on ohci4
acpi_button0: <Power Button> on acpi0
acpi_tz0: <Thermal Zone> on acpi0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
atkbd0: [ITHREAD]
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
psm0: [ITHREAD]
psm0: model IntelliMouse, device ID 3
atrtc0: <AT realtime clock> port 0x70-0x71 irq 8 on acpi0
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
uart0: [FILTER]
ACPI Warning: \\_SB_.PCI0.SBRG.FDC_._FDE: Return type mismatch - found Package, expected Buffer 20090521 nspredef-1051
fdc0: <floppy drive controller (FDE)> port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on acpi0
fdc0: [FILTER]
driver bug: Unable to set devclass (devname: (null))
cpu0: <ACPI CPU> on acpi0
acpi_throttle0: <ACPI CPU Throttling> on cpu0
hwpstate0: <Cool`n'Quiet 2.0> on cpu0
cpu1: <ACPI CPU> on acpi0
cpu2: <ACPI CPU> on acpi0
cpu3: <ACPI CPU> on acpi0
driver bug: Unable to set devclass (devname: (null))
orm0: <ISA Option ROM> at iomem 0xcf000-0xcffff on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
ppc0: cannot reserve I/O port range
WARNING: ZFS is considered to be an experimental feature in FreeBSD.
Timecounters tick every 1.000 msec
usbus6: 12Mbps Full Speed USB v1.0
usbus0: 12Mbps Full Speed USB v1.0
usbus1: 12Mbps Full Speed USB v1.0
usbus2: 480Mbps High Speed USB v2.0
usbus3: 12Mbps Full Speed USB v1.0
usbus4: 12Mbps Full Speed USB v1.0
usbus5: 480Mbps High Speed USB v2.0
ZFS NOTICE: system has less than 4GB and prefetch enable is not set... disabling.
ZFS filesystem version 13
ZFS storage pool version 13
ugen6.1: <ATI> at usbus6
uhub0: <ATI OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus6
ugen0.1: <ATI> at usbus0
uhub1: <ATI OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0
ugen1.1: <ATI> at usbus1
uhub2: <ATI OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus1
ugen2.1: <ATI> at usbus2
uhub3: <ATI EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus2
ugen3.1: <ATI> at usbus3
uhub4: <ATI OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus3
ugen4.1: <ATI> at usbus4
uhub5: <ATI OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus4
ugen5.1: <ATI> at usbus5
uhub6: <ATI EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus5
acd0: DVDR <Optiarc DVD RW AD-5200A/1.05> at ata1-master UDMA66
ad4: 238475MB <Hitachi HDT725025VLA380 V5DOA7EA> at ata2-master SATA300
hdac0: HDA Codec #0: ATI RS690/780 HDMI
pcm0: <HDA ATI RS690/780 HDMI PCM #0 Digital> at cad 0 nid 1 on hdac0
hdac1: HDA Codec #0: IDT 92HD206X
pcm1: <HDA IDT 92HD206X PCM #0 Analog> at cad 0 nid 1 on hdac1
pcm2: <HDA IDT 92HD206X PCM #1 Digital> at cad 0 nid 1 on hdac1
pcm3: <HDA IDT 92HD206X PCM #2 Analog> at cad 0 nid 1 on hdac1
SMP: AP CPU #3 Launched!
SMP: AP CPU #1 Launched!
SMP: AP CPU #2 Launched!
WARNING: WITNESS option enabled, expect reduced performance.
GEOM: ad4s1: geometry does not match label (255h,63s != 16h,63s).
uhub0: 2 ports with 2 removable, self powered
uhub1: 3 ports with 3 removable, self powered
uhub2: 3 ports with 3 removable, self powered
uhub4: 3 ports with 3 removable, self powered
uhub5: 3 ports with 3 removable, self powered
Root mount waiting for: usbus5 usbus2
Root mount waiting for: usbus5 usbus2
uhub3: 6 ports with 6 removable, self powered
uhub6: 6 ports with 6 removable, self powered
Trying to mount root from zfs:tank/root
KLD pf.ko: depends on kernel - not available
linker_load_file: Unsupported file type
KLD pflog.ko: depends on pf - not available
linker_load_file: Unsupported file type
KLD pf.ko: depends on kernel - not available
linker_load_file: Unsupported file type
```
why is pf.ko not available?


----------



## DutchDaemon (Aug 15, 2009)

I think I saw something similar on an AMD64 kernel. I could only solve it by taking the -CURRENT debugging stuff out. Try commenting out (in /usr/src/sys/amd64/conf/GENERIC):


```
makeoptions     DEBUG=-g
```

and the entire 'chapter' starting with


```
# Debugging for use in -current
```

Rename it from GENERIC to something else ('NEWNAME'), and rebuild the kernel with [cmd=]cd /usr/src && make kernel KERNCONF=NEWNAME[/cmd].


----------



## z0ran (Aug 15, 2009)

i tried to rebuild kernel but after is everything finish it refuse to load new kernel, weird! so many time..and always same, loads GENERIC no matter what i do.


----------



## z0ran (Aug 15, 2009)

once again i tried to rebuild my kernel, i commented out "make options DEBUG=-g" and entire chapter starting with:

# Debugging for use in -current

options KDB
options GDB
options DDB
options INVARIANTS

just like you said DuchDaemon, everything went great, but at the end it loads GENERIC..i don't know, i'll wait for rwspond from the mailing list..or something


----------



## DutchDaemon (Aug 15, 2009)

Did you also use a different *ident* line in the NEWNAME kernel config? Or else it will still identify as GENERIC


----------



## z0ran (Aug 15, 2009)

i did, i also used Michael Lucas advice to use:

ident MYKERNEL
include GENERIC

same thing, anyway, just for the record, i rebuilded 6 times, it always load GENERIC..so far, at list i have so many names for kernel..


----------



## DutchDaemon (Aug 15, 2009)

Why include GENERIC? Just copy GENERIC to MYKERNEL, take out the stuff you want to take out, change ident, and build/install MYKERNEL.


----------



## z0ran (Aug 15, 2009)

that was only one option, the rest was just like you said.

cd /usr/src/sys/amd64/conf
cp GENERIC MYKERNEL and in MYKERNEL i used for *ident MYKERNEL*
cd /usr/src
make buildkernel KERNCONF=MYKERNEL
make installkernel KERNCONF=MYKERNEL
reboot

it loading GENERIC

and why did i include GENERIC, when i add some things in kernel, that is good option not if i'm striping kernel, this is what michael lucas said in his book:
"if you have configuration as GENERIC with a couple extra tidbits you could include GENERIC, that way it can be described as GENERIC plus my option"
anyway, i tried it only one time, the rest was by the handbook, but still results was same.


----------



## DutchDaemon (Aug 15, 2009)

But you wanted to take stuff *out* of GENERIC ... you were not using GENERIC +/+ add-ons, but GENERIC -/- debug stuff. So inlcuding GENERIC will bring it all back _and_ it will probably override your ident, so it is called GENERIC once again.


```
cd /usr/src/sys/amd64/conf
cp GENERIC MYKERNEL
edit MYKERNEL
Change ident to MYKERNEL
Remove 'makeoptions     DEBUG=-g'
Remove everything from '# Debugging for use in -current'
Save MYKERNEL
cd /usr/src
make kernel KERNCONF=MYKERNEL
reboot
```

There is no way that this leads to a GENERIC kernel in 
	
	



```
uname -a
```
 after the reboot.


----------



## z0ran (Aug 15, 2009)

DutchDaemon said:
			
		

> But you wanted to take stuff *out* of GENERIC ... GENERIC -/- debug stuff.



exactly, in this example like you pointing out, i didn't use *include GENERIC* i used only *ident MYKERNEL* but i also tried to add (everything is same in that case, except that i add options for pf) and in that case i tried to include GENERIC, that was only one time out of 6 times, and no, GENERIC will not override MYKERNEL, i tried that way in my stable 7.1, and that was no problems what so ever.

uname -a was MYKERNEL

inlude GENERIC i used to use when i add +/+ something, i don't use it when i try to strip -/- kernel


----------



## DutchDaemon (Aug 15, 2009)

Then I guess I simply don't understand all of this:



> * loads GENERIC no matter what i do
> * but at the end it loads GENERIC
> * it always load GENERIC
> * it loading GENERIC



Unless you have a possessed copy of FreeBSD ..


----------



## z0ran (Aug 15, 2009)

have no idea, but thanks for the reply and sugestions, i'll wait little bit more for 8-stable, then, i guess it'll be much better


----------



## iic2 (Aug 17, 2009)

AMD64 - Because I decided to wait for release, I went back from 8.0 Beta 2 to 8.0 current to make final install until than.  I saw nothing wrong but what do i know.

Just yesterday I did all of the things DutchDaemo just mentioned but under "Debugging for use in -current" I comment out all seven options along with a bunch of other stuff since it will be only for a simple webserver in the end. I also had to type in those three pf options.  I did not test pf yet but if it is easy I will try tonight.  I just wanted to include them.  Than I compile the old-fashion way and now I'm using BABY_BSD.


```
make LINT
/usr/sbin/config BABY_BSD
cd ../compile/BABY_BSD

make cleandepend
make depend
make
make install
```


----------

