Compile Kernel 2.6 under Debian Sarge

Discussion in 'Kernel Questions' started by falko, Apr 21, 2005.

  1. falko

    falko Super Moderator Howtoforge Staff

    Did you enable iptables during
    make menuconfig
  2. ikkem

    ikkem Member

    yes I did enable iptables at first I thought I overlooked it but it is enabled....
  3. falko

    falko Super Moderator Howtoforge Staff

    There must be a config file for your new kernel in the /boot directory. What's the output of
    grep -i iptables /boot/[I]kernel_config[/I]
  4. ikkem

    ikkem Member


    the output is:

    # grep -i iptables /boot/config-
    this time I got it working I did not make a symlink to linux instead I cd into /usr/src/linux- and I followed your how to
    at my first and second attempt the system kept hanging on boottime and after it booted I could not connect to the net...
    thanks for reacting....
  5. ikkem

    ikkem Member

    I am not able to run shorewall anymore.
    Do I have to compile iptables against the new kernel? part of the output of shorewall show capabilities:

    # shorewall show capabilities
    NAT: Not available
    Packet Mangling: Not available
    Looked on google/clusty but I could not find a how to compile iptables against a kernel for debian/ubuntu....

    thanks in advance....
  6. falko

    falko Super Moderator Howtoforge Staff

    Did you use an old, working kernel configuration for configuring your new kernel? Or did you configure your new kernel from scratch?
  7. ikkem

    ikkem Member

    I used an old working kernel configuration I used the 2.6.8....configuration and then I enabled xtables... during menuconfig...
    Last edited: Feb 24, 2007
  8. falko

    falko Super Moderator Howtoforge Staff

    What's the output of
    which iptables
    modprobe iptables
  9. ikkem

    ikkem Member

    the out is:
    # which iptables
    # modprobe iptables
    FATAL: Module iptables not found.
    I am trying to compile iptables against the kernel I installed iptables-1.3.7 now I am going to compile the kernel hopefully it will work
    is there a debian/ubuntu way for this?
    thanks in advance....
    Last edited: Feb 25, 2007
  10. ikkem

    ikkem Member

    I finally got it working I compiled iptables against the kernel(
    here is the how to:

    to patch the kernel you will need to download iptables and patch-o-matic

    [COLOR="Red"]apt-get remove iptables ipchains --purge[/COLOR] 
    cd /usr/src
    iptables source - wget -c
    patch-o-matic - wget -c
    Linux kernel source - wget -c
    unpack the downloaded files:
    tar xjf patch-o-matic-ng-20070322.tar.bz2 
    tar xjf  iptables-1.3.7.tar.bz2
    tar xjf linux-
    First you need to run the make menuconfig command to
    preconfigure the kernel otherwise *PATCHING WILL FAIL* change into the
    linux- directory and run the make menuconfig command

    [COLOR="Red"]apt-get install kernel-package libncurses5-dev fakeroot wget bzip2 build-essential udev[/COLOR]
    cd /usr/src/linux-
    make clean && make mrproper
    cp /boot/config-`uname -r` ./.config
    make menuconfig
    exit and save the config file. Now you will need to go into the patch-o-matic directory
    cd /usr/src/patch-o-matic-ng-20070322
    # KERNEL_DIR=/usr/src/linux- ./runme extras
    Once you issue that command you will be prompt with the following

    Hey! IPTABLES_DIR is not set.
    Where is your iptables source code directory? [/usr/src/iptables]/usr/src/iptables-1.3.7

    Once that is done you will be prompt for which patches you would like to apply, they also give you a little description on
    what each patch does.

    Once you have finished selecting which patches you want installed you will need to compile your iptables so you will
    need to do the following in the iptables source directory.

    cd /usr/src/iptables-1.3.7
    make KERNEL_DIR=/usr/src/linux-
    make install KERNEL_DIR=/usr/src/linux-
    make clean
    your iptables have been compiled now you can start compiling your kernel so you can issue the following in the kernel source directory

    cd /usr/src/linux-
    make-kpkg clean
    make-kpkg --initrd kernel_image kernel_headers
    after the kernel build the kernel can be found in the /usr/src directory

    cd /usr/src
    dpkg -i *deb
    Create A Ramdisk

    apt-get install libhtml-template-perl libparse-recdescent-perl
    cd /tmp
    dpkg -i yaird_0.0.12-8bpo1_i386.deb
    nano -w /boot/config-
    # CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
    create ramdisk
    mkinitrd.yaird -o /boot/initrd.img- 
    update grub
    reboot system
    shutdown -r now 

    hope it helps....:)

    Last edited: Apr 13, 2007
  11. boom84

    boom84 New Member


    maybe you could help me i have some troubles with compiling debian kernel as i read the flip has the same problem with sbin/init cannot open dev/console. we tried to do it in differnt way but did not help.

  12. boom84

    boom84 New Member

    haloo anybody here?
  13. boom84

    boom84 New Member

    hello so i am here....
  14. martinfst

    martinfst Member Moderator

    Bumping a post every 30 minutes is not going to help you. Personally I think this is abusive. You're adding a vague question to the end of a long thread and the entry before yours is giving a solution. I suggest you start a new thread in which you explain what exactly is your problem. Expect you need to wait around 1-2 days. If you need quicker answers, consider paid support and/or hiring someone.
  15. boom84

    boom84 New Member

    ok i already did
  16. sayad

    sayad New Member

    Hey i need help with the same thing...i have had the same kinda trouble...


    Webkinz Recipes
  17. shae marks

    shae marks New Member

    I have problem and I do not know how to solve it myself. Last weekend I tried ( I said tried ) to recompile kernel on my Debian Sarge machine, but I encountered some problems.

    After compilation and rebooting my macnine and choosing new kernel to boot I got error as follows:
    modprobe: FATAL: Could not load /lib/modules/ : No such file or directory
    umount devfs: not mounted
    pivot_root: No such file or directory
    /sbin/init:432 cannot open dev/console
    kernel panic-Not syncing: Attempted to kill init

    I really do not what to do in order to compile kernel, I have many manuals, and I read them as you can see I made procedure of compilation on right way ( Tell me if I am wrong ) but still I cannot solve above mentioned errors.

    Please show me what I did wrong and what I should correct in order to make my works.

    Thank you in advance

    The procedure I used to compile kernel and files I got after cmpilation is as follows.

    I run make-kpkg kernel-image and after 20 minutes
    DeusEtMachine:/usr/src# ls -l
    total 52228
    -rw-r--r-- 1 root src 13558552 2006-03-19 17:33 kernel-image-
    drwxrwxrwx 21 root root 4096 2006-03-19 17:44 linux-
    -rwx------ 1 root src 39846379 2006-03-18 16:11 linux-

    In /lib/modules I have

    DeusEtMachine:/lib/modules# ls -l
    total 8
    drwxr-xr-x 3 root root 4096 2006-03-19 17:34
    drwxr-xr-x 5 root root 4096 2006-02-25 10:11 2.6.8-2-386

    In /lib/modules/ there are next files

    DeusEtMachine:/lib/modules/ ls -l
    total 1008
    lrwxrwxrwx 1 root root 23 2006-03-19 17:34 build -> /usr/src/linux-
    drwxr-xr-x 10 root root 4096 2006-03-19 17:34 kernel
    -rw-r--r-- 1 root root 201018 2006-03-19 17:34 modules.alias
    -rw-r--r-- 1 root root 69 2006-03-19 17:34 modules.ccwmap
    -rw-r--r-- 1 root root 212744 2006-03-19 17:34 modules.dep
    -rw-r--r-- 1 root root 813 2006-03-19 17:34 modules.ieee1394map
    -rw-r--r-- 1 root root 394 2006-03-19 17:34 modules.inputmap
    -rw-r--r-- 1 root root 21025 2006-03-19 17:34 modules.isapnpmap
    -rw-r--r-- 1 root root 182827 2006-03-19 17:34 modules.pcimap
    -rw-r--r-- 1 root root 98846 2006-03-19 17:34 modules.symbols
    -rw-r--r-- 1 root root 264449 2006-03-19 17:34 modules.usbmap
    lrwxrwxrwx 1 root root 23 2006-03-19 17:34 source -> /usr/src/linux-

    In /boot/ I have as follows

    DeusEtMachine:/boot# ls -l
    total 12964
    -rw-r--r-- 1 root root 63903 2006-03-04 15:51 config-
    -rw-r--r-- 1 root root 55809 2005-05-19 10:38 config-2.6.8-2-386
    drwxr-xr-x 2 root root 4096 2006-03-19 17:38 grub
    -rw-r--r-- 1 root root 4317184 2006-03-19 17:35 initrd.img-
    -rw-r--r-- 1 root root 4317184 2006-02-25 10:35 initrd.img-2.6.8-2-386
    -rw-r--r-- 1 root root 814523 2006-03-19 17:33
    -rw-r--r-- 1 root root 865733 2005-05-19 11:26
    -rw-r--r-- 1 root root 1680929 2006-03-19 17:33 vmlinuz-
    -rw-r--r-- 1 root root 1097419 2005-05-19 11:25 vmlinuz-2.6.8-2-386

    In /grub/menu.lst I have the next output
    title Debian GNU/Linux, kernel
    root (hd0,1)
    kernel /boot/vmlinuz- root=/dev/hda2 ro
    initrd /boot/initrd.img-

    title Debian GNU/Linux, kernel (recovery mode)
    root (hd0,1)
    kernel /boot/vmlinuz- root=/dev/hda2 ro single
    initrd /boot/initrd.img-

    title Debian GNU/Linux, kernel 2.6.8-2-386
    root (hd0,1)
    kernel /boot/vmlinuz-2.6.8-2-386 root=/dev/hda2 ro
    initrd /boot/initrd.img-2.6.8-2-386

    title Debian GNU/Linux, kernel 2.6.8-2-386 (recovery mode)
    root (hd0,1)
    kernel /boot/vmlinuz-2.6.8-2-386 root=/dev/hda2 ro single
    initrd /boot/initrd.img-2.6.8-2-386
  18. matey

    matey New Member

    I have seen this happen in Grub many times where it (for some strange reasons) changes the (hd 0,0) to (hd 1,0) or another form of it.
    I even had a server with hd 2,0 in the menu.lst file which changed itself to hd0,0 after an upgrade! then no boot!

    so always make backup copy of your (Working) menu.lst file BEFORE doing any updates/upgrades or recompiling kernel.
    2 cents worth from a noob!

Share This Page