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
    Code:
    make menuconfig
    ?
     
  2. ikkem

    ikkem Member

    hi....:)
    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
    Code:
    grep -i iptables /boot/[I]kernel_config[/I]
    ?
     
  4. ikkem

    ikkem Member

    hi....:)

    the output is:

    Code:
    # grep -i iptables /boot/config-2.6.20.1-raysun3
    CONFIG_IP_NF_IPTABLES=y
    CONFIG_IP6_NF_IPTABLES=m
    
    this time I got it working I did not make a symlink to linux instead I cd into /usr/src/linux-2.6.20.1 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:

    Code:
    # 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

    Hi....:)
    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
    Code:
    which iptables
    and
    Code:
    modprobe iptables
    ?
     
  9. ikkem

    ikkem Member

    the out is:
    Code:
    # which iptables
    /usr/local/sbin/iptables
    
    Code:
    # 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(2.6.20.3)....
    here is the how to:

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


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

    Code:
    [COLOR="Red"]apt-get install kernel-package libncurses5-dev fakeroot wget bzip2 build-essential udev[/COLOR]
    cd /usr/src/linux-2.6.20.3
    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
    Code:
    cd /usr/src/patch-o-matic-ng-20070322
    # KERNEL_DIR=/usr/src/linux-2.6.20.3 ./runme extras
    
    Once you issue that command you will be prompt with the following

    Code:
    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.

    Code:
    cd /usr/src/iptables-1.3.7
    make KERNEL_DIR=/usr/src/linux-2.6.20.3
    make install KERNEL_DIR=/usr/src/linux-2.6.20.3
    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

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

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

    Code:
    apt-get install libhtml-template-perl libparse-recdescent-perl
    cd /tmp
    wget http://downloads.howtoforge.com/files/yaird_0.0.12-8bpo1_i386.deb
    dpkg -i yaird_0.0.12-8bpo1_i386.deb
    
    nano -w /boot/config-2.6.20.3-raysun1
    [....]
    # CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
    [....]
     
    create ramdisk
    Code:
    mkinitrd.yaird -o /boot/initrd.img-2.6.20.3-raysun1 2.6.20.3-raysun1 
    update grub
    Code:
     update-grub
    reboot system
    Code:
    shutdown -r now 

    hope it helps....:)

    source:
    http://www.linux-noob.com/forums/index.php?showtopic=2182&hl=
    http://www.howtoforge.com/kernel_compilation_debian
     
    Last edited: Apr 13, 2007
  11. boom84

    boom84 New Member

    hi

    maybe you could help me i have some troubles with compiling debian kernel 2.6.18.3. 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.

    thanks
     
  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...

    thanks.




    --
    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/2.6.15.4/modules.dep : 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 2.6.15.4 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-2.6.15.4_10.00.Custom_i386.deb
    drwxrwxrwx 21 root root 4096 2006-03-19 17:44 linux-2.6.15.4
    -rwx------ 1 root src 39846379 2006-03-18 16:11 linux-2.6.15.4.tar.bz2
    DeusEtMachine:/usr/src#

    In /lib/modules I have

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

    In /lib/modules/2.6.15.4 there are next files

    DeusEtMachine:/lib/modules/2.6.15.4# ls -l
    total 1008
    lrwxrwxrwx 1 root root 23 2006-03-19 17:34 build -> /usr/src/linux-2.6.15.4
    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-2.6.15.4
    DeusEtMachine:/lib/modules/2.6.15.4#

    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-2.6.15.4
    -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-2.6.15.4
    -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 System.map-2.6.15.4
    -rw-r--r-- 1 root root 865733 2005-05-19 11:26 System.map-2.6.8-2-386
    -rw-r--r-- 1 root root 1680929 2006-03-19 17:33 vmlinuz-2.6.15.4
    -rw-r--r-- 1 root root 1097419 2005-05-19 11:25 vmlinuz-2.6.8-2-386
    DeusEtMachine:/boot#

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

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

    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
    savedefault
    boot

    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
    savedefault
    boot
     
  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