Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Kernel compile and install for newbies

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Message
Author
Stian1979
Posts: 316
Joined: 2007-07-29 14:57

Re: Kernel compile and install on Debian 5.0 for newbies

#41 Post by Stian1979 »

Rolling Stone wrote: Sure you've gotten the initrd part right?
Not suposed to have initrd on a initrd free kernel.
With initrd I got no problems.
Image
Debian Bullseye

User avatar
kanonmat
Posts: 59
Joined: 2008-10-28 21:33
Location: Linköping, Sweden

Re: Kernel compile and install on Debian 5.0 for newbies

#42 Post by kanonmat »

I compiled, rebooted and got a kernel panic. What's the approach to find what's wrong? As hazel posted, there is so much stuff in the kernel that I won't ever use. (I removed what I thought unnecessary and among other things changed timer frequency to 1000Hz and set voluntary kernel preemption.) Just changing one item at a time, compile for an hour and reboot feels very inefficient.
phenomII965, gigabyte ma790xt-ud4p, 8600gt on desktop
hp 6910p laptop. athlon 3200+, asus an8e, 6600gt on spare desktop
sid user

Stian1979
Posts: 316
Joined: 2007-07-29 14:57

Re: Kernel compile and install on Debian 5.0 for newbies

#43 Post by Stian1979 »

kanonmat wrote:I compiled, rebooted and got a kernel panic. What's the approach to find what's wrong? As hazel posted, there is so much stuff in the kernel that I won't ever use. (I removed what I thought unnecessary and among other things changed timer frequency to 1000Hz and set voluntary kernel preemption.) Just changing one item at a time, compile for an hour and reboot feels very inefficient.
Do you have a initrd for that kernel? for some reason it's not created automatically anymore.
Image
Debian Bullseye

User avatar
kanonmat
Posts: 59
Joined: 2008-10-28 21:33
Location: Linköping, Sweden

Re: Kernel compile and install on Debian 5.0 for newbies

#44 Post by kanonmat »

***TOTAL EDIT OF POST***
No, I didn't get an initrd. I'm using sid.
I read dbboltons post above, but I didnt follow the link :oops: I was trying to figure out why I couldn't boot with the new kernel, keeping myself busy trying to generate initrds and writing a lengthy post. Its shorter now.

Kernel panicked with this:

Code: Select all

no filesystem could mount root, tried:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
It wouldn't boot with an initrd borrowed from the other kernel. (The vanilla kernel wouldn't boot without an initrd either.) Maybe I don't need an initrd, a guru on irc said it was unnecessary. I guess I need to move some of the stuff that the initrd does to the kernel. What and how?

I cant see whats in the initrd. "file initrd.img-2.6.30-1-amd64" says its a gzip, but i can't gunzip it. What is it? I read in some post on a mailinglist from around 2003 that the debian initrd uses cramfs. This fails anyway:

Code: Select all

mount -o loop -t cramfs initrd.img-2.6.30-1-amd64 tmp/
***TOTAL EDIT OF POST***
Last edited by kanonmat on 2009-09-05 08:51, edited 1 time in total.
phenomII965, gigabyte ma790xt-ud4p, 8600gt on desktop
hp 6910p laptop. athlon 3200+, asus an8e, 6600gt on spare desktop
sid user

User avatar
dbbolton
Posts: 2129
Joined: 2007-06-20 08:17
Location: Iapetus

Re: Kernel compile and install on Debian 5.0 for newbies

#45 Post by dbbolton »

kanonmat wrote: Maybe I don't need an initrd, a guru on irc said it was unnecessary. I guess I need to move some of the stuff thats in the initrd to the kernel. The questions are: what and how?
You will need drivers for your hard disk (IDE/SATA) as well as drivers for your root filesystem build into the kernel (*), not as modules (m).

If you just want to fix the initrd for the new kernel, see the link I posted above.
GitHub | zsh docs in Letter PDF
Telemachus wrote:Put down the CGI.

User avatar
hazel
Posts: 135
Joined: 2009-08-01 16:34

Re: Kernel compile and install on Debian 5.0 for newbies

#46 Post by hazel »

If you're using sid, you have a later kernel than I do. Apparently some of these recent kernels don't use the traditional hd*/sd* distinction; they put all the hard drives in the sd* series. So if your grub menu gives the root partition as /dev/hda*, the kernel won't be able to find it.

The official Debian solution to this is to use the UUID of the partition rather than a device file but I found out the hard way that this doesn't work without an initrd. So if you've got /dev/hda* in your grub menu, it might be worth editing it to /dev/sda* and see if that makes a difference.

PS: Why should I write a howto? We've got a perfectly good one in this thread already.

User avatar
Tadeas
Posts: 1013
Joined: 2008-09-22 09:11
Location: Prague
Contact:

Re: Kernel compile and install on Debian 5.0 for newbies

#47 Post by Tadeas »

I've just compiled 2.6.31-rc9 and I've encountered two problems. I post here the solution if anybody is interested...

First, the compilation fails with missing zlib.h library. This is probably a bug in kernel-package that it doesn't depend on it. Anyway, you need to install zlib1g-dev package.

Second, the --initrd parameter to make-kpkg didn't create initrd. You create it with this command in /boot after you have installed the kernel .deb:
# mkinitramfs -oinitrd-2.6.31-rc9 2.6.31-rc9
Run dpkg-reconfigure grub-pc if you use grub2 or dpkg-reconfigure grub-legacy (or whatever is the grub1 package) to notify grub of the new initrd.

Hope this helps anybody :) .
Because let’s face it, the unfortunate aspect of software development is that it involves humans. Mewling, disorganized, miserably analog humans. Sometimes they smell bad.

milomak
Posts: 2168
Joined: 2009-06-09 22:20
Been thanked: 2 times

Re: Kernel compile and install on Debian 5.0 for newbies

#48 Post by milomak »

The initrd issue can be solved using the solution in this post

i copied the initramfs-tools script and the initrd is created when i install using dpkg.
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

jalu
Posts: 1389
Joined: 2008-11-19 23:26

Re: Kernel compile and install on Debian 5.0 for newbies

#49 Post by jalu »

i followed the how-to in the first post, step by step, but changed some things according to the advices given later in this thread:
i get this error massage :

Code: Select all

/usr/bin/make  EXTRAVERSION=jalu  ARCH=i386 \
			     -C Documentation/lguest
make[1]: Entering directory `/home/jalu/Kernel/linux-2.6-2.6.26/Documentation/lguest'
cc -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include    lguest.c  -lz -o lguest
lguest.c:34:18: error: zlib.h: No such file or directory
make[1]: *** [lguest] Error 1
after running this command:

Code: Select all

 fakeroot make-kpkg --append-to-version "jalu" --revision "090909" --initrd kernel_image kernel_headers
i dont know what im doing wrong here (about append-to-version and revision im pretty unsure...)

----
[
i also followed this howto:
http://wiki.debian.org/HowToRebuildAnOf ... nelPackage
but changed some things according to my book (as i didnt understand everything).
There i had to to add a "revision-thingy" to those files:
/home/jalu/Kernel/linux-2.6-2.6.26/debian{changelog,config/defines}
That build went thru (but wasnt known by the package-system afterwards).
]


greetings

User avatar
garrincha
Posts: 2335
Joined: 2006-06-02 16:38

Re: Kernel compile and install on Debian 5.0 for newbies

#50 Post by garrincha »

jalu wrote:i followed the how-to in the first post, step by step, but changed some things according to the advices given later in this thread:
i get this error massage :

Code: Select all

/usr/bin/make  EXTRAVERSION=jalu  ARCH=i386 \
			     -C Documentation/lguest
make[1]: Entering directory `/home/jalu/Kernel/linux-2.6-2.6.26/Documentation/lguest'
cc -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include    lguest.c  -lz -o lguest
lguest.c:34:18: error: zlib.h: No such file or directory
make[1]: *** [lguest] Error 1
You're getting zlib error, something that I never got before. Anyway, check the 1st post on this very trend by Rolling Stone, near bottom:
Troubleshooting:

If you get an error about missing zlib.h, make sure you have these packages installed
Image
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

jalu
Posts: 1389
Joined: 2008-11-19 23:26

Re: Kernel compile and install on Debian 5.0 for newbies

#51 Post by jalu »

thanks, its running again and will take some hours.

jalu
Posts: 1389
Joined: 2008-11-19 23:26

Re: Kernel compile and install on Debian 5.0 for newbies

#52 Post by jalu »

that was the problem. the build went through this time. :D
but when i booted i ran into kernel-panic/not syncing. :mrgreen:
(entries in menu.lst are ok, but i tried by-id too).

two things come in my mind: a) its in virtualbox b) i didnt run oldconfig or copied the /boot/config* over but went straight for a make menuconfig.

well, i`ll try it once again under different conditions.
-
no luck:
still kernel panic, different error:
kernel-panic not syncing; VFS Unable to mount root fs; unknown block.
search gave me: a) grub-entry is wrong (its correct)
b) driver for root system is not build into the kernel ( i thought thats why theres an initrd?)

How come that with an
make modules_install
make install
it did work, but not with the fakeroot make-kpkg*** ?

jalu
Posts: 1389
Joined: 2008-11-19 23:26

Re: Kernel compile and install on Debian 5.0 for newbies

#53 Post by jalu »

take that:
i mv /lib/modules/{2.6.30-1-686, 2.6.30-1-686_old}
no luck
i removed the deb via apt-get remove --purge
i cd into the source directory /home/jalu/Kernel/2.6.30
make modules_install
make install
update-initramfs -c -k 2.6.30-mt
update grub

Make install didnt build, but was finished within the blink of an eye.
The kernel is up and running now.

How come? :roll:

User avatar
garrincha
Posts: 2335
Joined: 2006-06-02 16:38

Re: Kernel compile and install on Debian 5.0 for newbies

#54 Post by garrincha »

jalu wrote: Make install didnt build, but was finished within the blink of an eye.
The kernel is up and running now.

How come? :roll:
I'm not sure as I'm somewhat unfamiliar with what you're doing. In any case if your kernel panic, check to make sure that menu.lst entry is correct including the initrd entry:

Code: Select all

title           Debian GNU/Linux, kernel 2.6.30.5 (verbose splash) on /dev/sda6
root            (hd0,5)
kernel          /boot/vmlinuz-2.6.30.5 root=/dev/sda6 ro
initrd          /boot/initrd.img-2.6.30.5
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

jalu
Posts: 1389
Joined: 2008-11-19 23:26

Re: Kernel compile and install on Debian 5.0 for newbies

#55 Post by jalu »

menu.lst entry is/was correct (if im not more nut than usual). I checked different times. I even re-installed to make sure its not a borked system (ex-live-cd; installed with mint-installer, *-table not in order any more).

i think this evening or tomorrow i`ll go for a hard-disk run. As long as that works all is fine.

jalu
Posts: 1389
Joined: 2008-11-19 23:26

Re: Kernel compile and install on Debian 5.0 for newbies

#56 Post by jalu »

just a curious question. on this side
http://wiki.debian.org/HowToRebuildAnOf ... nelPackage
it is said one should run an:

Code: Select all

apt-get build-dep linux-2.6
but no one seems to mention it over here. I guess the answer is simple

User avatar
Rolling Stone
Posts: 366
Joined: 2009-02-15 18:55
Location: Turku, Finland

Re: Kernel compile and install on Debian 5.0 for newbies

#57 Post by Rolling Stone »

That command should pull in and install the dependancies for the package linux-2.6. Basically the first step in my guide. It's handy if it works. I haven't tried it myself (while compiling a kernel) and don't know what packages it would get.

jalu
Posts: 1389
Joined: 2008-11-19 23:26

Re: Kernel compile and install on Debian 5.0 for newbies

#58 Post by jalu »

Rolling Stone wrote:That command should pull in and install the dependancies for the package linux-2.6. Basically the first step in my guide. It's handy if it works. I haven't tried it myself (while compiling a kernel) and don't know what packages it would get.
thats something i would have expected or understood. but after installing the apps you mentioned above apt-get build-dep linux-2.6 did install other stuff too (if im correct yesterday, on sid, it has been 350MB, and today, on lenny, it has been only 17MB)

as no-one mentions it over here i guess it does mean nothing.

btw: nice how-to, gave me hope and, with a big bunch of help, it did work.
greetings

User avatar
nadir
Posts: 5961
Joined: 2009-10-05 22:06
Location: away

Re: Kernel compile and install on Debian 5.0 for newbies

#59 Post by nadir »

a short question:
after installing the deb`s i got the source*tar.bz2 in /usr/src and in my ~/Kernel. Additionally i got the linux-source and the two debs in my ~/Kernel.
do i need to keep them? ok, i think the bz2`s and the deb`s i may remove safely, what about the linux-source (once i`ve linked /lib/modules... to /usr/src...). thanks.
Last edited by nadir on 2009-12-23 03:36, edited 1 time in total.
"I am not fine with it, so there is nothing for me to do but stand aside." M.D.

User avatar
Telemachus
Posts: 4574
Joined: 2006-12-25 15:53
Been thanked: 2 times

Re: Kernel compile and install on Debian 5.0 for newbies

#60 Post by Telemachus »

nadir wrote:a short question:
after installing the deb`s i got the source*tar.bz2 in /usr/src and in my ~/Kernel. Additionally i got the linux-source and the two debs in my ~/Kernel.
do i need to keep them? ok, i think the bz2`s and the deb`s i may remove safely, what about the linux-source (once i`ve linked /lib/modules... to /usr/src). thanks.
I apologize, but I haven't been following. So sorry if this is behind the times. You don't need (ever) to have the source in /usr/src, and in general the modern default is not to put source there (or build there). Do it in your home directory. (Doesn't mean you have to agree, but I think it's the norm now, and it makes a lot of sense to me.)

I always throw out the debs (they're installed, don't need extras), but keep the unzipped source and the original zipped source - at least for the latest kernel. I don't link anything to /usr/src, so I want to keep the sources I built against. I keep the clean source just in case I end up wanting to rebuild from scratch. At the end of the day, even 100 or 200 MB of source files aren't really that much space on a modern drive.
"We have not been faced with the need to satisfy someone else's requirements, and for this freedom we are grateful."
Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System

Post Reply