LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 02-02-2008, 03:41 PM   #1
dtmbmw325i
Member
 
Registered: May 2006
Location: Lebanon, PA
Distribution: Ubuntu 7.10
Posts: 47

Rep: Reputation: 16
Compiling Linux kernel trouble at mkinitramfs


I was following a guide from http://www.linuxforums.org/desktop/t...st_kernel.html which is probably pretty old but I got down to the part where it says about mkinitramfs -o initrd.img-2.6.24 2.6.24. I get an error that says:

cp: cannot stat '/etc/modprobe.conf' : no such file or directory.

I am trying to compile a 2.6.24 kernel from kernel.org. My other question is that if this isnt the way to go since I am seeing people installing with .deb files, how can I undo what I did, to go that way. I did reboot my computer to see if anything changed and my computer still boots fine to the current kernel which is 2.6.22 stock one from Ubuntu 7.10

I am in need of some major help. This isnt the first time I tried this I would really like to learn to compile my own kernel. Thank you very much in advance.
 
Old 02-02-2008, 04:25 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,127

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Depends what you are trying to achieve - do you want to "play" with the kernel, or do you want to "fix" a Ubuntu kernel.
If the former, probably Ubuntu isn't the place to start - too much gets in the way.

Try reading this for the "sanctioned" way to do it. Lot easier than it used to be.
Have a look at the link at the bottom of that page for how to bring in a kernel.org source tree - it's written for Dapper, but should be o.k. for you.
 
Old 02-02-2008, 05:35 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I don't have Ubuntu but if you can install the Ubuntu kernel source that may be a better starting point. The README file in the source should be the first thing to read. It will outline what you need to do. It should mostly be the same, but there may be slight differences.

You may be using a general tool (mkinitramfs) instead of one that is for Ubuntu. For example, look for a mkinitrd command. It may also look at the scripts in /etc/modprobe.d/ for example, which may be the cause of your particular problem. The mkinitramfs or mkinitrd programs will probably be bash or perl scripts that work with your distro's /etc/ files.
 
Old 02-02-2008, 08:19 PM   #4
dtmbmw325i
Member
 
Registered: May 2006
Location: Lebanon, PA
Distribution: Ubuntu 7.10
Posts: 47

Original Poster
Rep: Reputation: 16
Well I wanted to try and create a kernel around my hardware to make it a little bit more agile. No need for legacy stuff that I dont need. With Ubuntu what would be the best tutorial. I tried one for feisty and some commands were missing. I did want to go a little further with my linux experimentation but I am thinking maybe that may not be the best thing for me yet.
 
Old 02-02-2008, 08:28 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
If you run "make oldconfig" it will copy your old settings for the old kernel. From there you can tweak the settings as you want. You do want to become familiar with your Ubuntu system however, such as what files are used for the modprobe settings. I'm sure the Ubuntu wiki has a howto outlining compiling a kernel from source. Follow their instructions. Generic instructions might be different in what packages you need to install before you start and how to create the initrd file and update grub. On my system I have both. You could try creating an empty /etc/modprobe.conf file if your system doesn't have on. Maybe all of the needed entries are in files in /etc/modprobe.d/.

It is possible that the Ubuntu initrd file is a compressed cpio archives instead of a filesystem. Try to work off of a more recent howto. An Ubuntu howto would be better.

---

I just took a look at the web page you referred to. It is a recent HOWTO. If you found out what Ubuntu uses to create it's initrd file, you probably will do OK. You still need to edit your /boot/grub/menu.lst file to add an entry for the new kernel. Don't make it the default yet, and then you can boot up to your old kernel if there is a problem with the new one.

Last edited by jschiwal; 02-02-2008 at 11:48 PM.
 
Old 02-04-2008, 03:31 PM   #6
dtmbmw325i
Member
 
Registered: May 2006
Location: Lebanon, PA
Distribution: Ubuntu 7.10
Posts: 47

Original Poster
Rep: Reputation: 16
I was able to get past that. Basically what I did was use fakeroot make-kpkg --initrd --append-to-version=jn1 kernel_image kernel_headers and that made me end up with 2 .deb files which I used dpkg to install. It begins installing and comes up with the exact same error. So I then created a blank modprobe.conf and presto it installed correctly, but it doesn't boot. So then it sits and looks for a root device which I checked over in menu.lst and everything looks fine. I didn't happened to look over an Ubuntu guide yet, that's next.

Thank you so far for your help. I guess I am doing all of this work for nothing as I see a lot of threads about there is no reason for doing this unless you need to fix a problem. Well my thought was I would be doing good for my system removing things that I didn't need. Is there really anything to gain except for knowing how to do it when you may need it some day? Am I racking my brain for nothing?
 
Old 02-04-2008, 06:23 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,127

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
I would never discourage anyone getting in and having a paddle around in the kernel. But as I said, Ubuntu probably isn't the best place to start - too many hoops to jump through.

For my kernel testing/patching I (now) prefer Arch. I used to use gentoo, but I've moved away from that for kernel maintenence. Slack is another option - easy to build kernels on.

Edit: perhaps I should also mention that I never use an initrd. If I'm going to the trouble to build a kernel, I do it for my kit. Why the hell would I bother with an initrd ... ???.

Last edited by syg00; 02-04-2008 at 06:49 PM.
 
Old 02-04-2008, 07:10 PM   #8
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You would probably have better luck if you installed the kernel source for Ubuntu and followed an Ubuntu howto. My system (SuSE) uses "mkinitrd" to create the initrd file. Each distro will have a custom version to create the initrd file, and it is usually a bash or perl script. The initrd file might contain a startup script that the system expects you to be using. This would be the most painless way of compiling your own kernel. On some distros it may be easier using a stock kernel and module tools then on others.

You may have gotten it on your last attempt, but were too aggressive disabling modules and options. After the kernel fails to boot, you might try boot up in rescue mode and try reading the boot log from the last attempt.

If you haven't compiled a kernel before a starting point might be to install the source for the current running kernel, using "make oldconfig" to start with the old kernel settings, and make only modest config settings to begin with. See if that kernel/initrd boots.
 
Old 02-05-2008, 06:11 AM   #9
dtmbmw325i
Member
 
Registered: May 2006
Location: Lebanon, PA
Distribution: Ubuntu 7.10
Posts: 47

Original Poster
Rep: Reputation: 16
I did use the old config, but I also started going through settings and turning things off that I felt I didn't need but I felt I was being very cautious because I would leave alone what I didn't know about. An example would be my NIC card. Its a 3com 905b which I believe they call a tornado. I didn't it on the list and I have problems with it every now and then so I left them all enabled. I could just go back to that step and do a make xconfig and just recompile from that point correct?

Also when you talk about booting from a rescue disk, do I need to since I can still boot my older kernel? I have my default set as the original untouched kernel. Also what logs would I look at? The more I think of this the more excited I feel about getting it to work because of these issues. I know that sounds geeky but ever since I started using linux about a year ago I have been really impressed and found it very fun to work with. Of course when I started it was a lot of compiling programs from source because I knew nothing else. Then I found apt-get which was a lot easier to say the least. I guess it never hurts to go back and keep refreshed on how to do that. Anyway thank you for your time and patience guys! Thats why I love this forum!
 
Old 02-05-2008, 06:55 PM   #10
dtmbmw325i
Member
 
Registered: May 2006
Location: Lebanon, PA
Distribution: Ubuntu 7.10
Posts: 47

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by syg00 View Post
Edit: perhaps I should also mention that I never use an initrd. If I'm going to the trouble to build a kernel, I do it for my kit. Why the hell would I bother with an initrd ... ???.
Do you mind explaining a little bit more?
 
Old 02-05-2008, 09:45 PM   #11
dtmbmw325i
Member
 
Registered: May 2006
Location: Lebanon, PA
Distribution: Ubuntu 7.10
Posts: 47

Original Poster
Rep: Reputation: 16
Well now I guess I am faced with something I wish I never had to. Ubuntu released a kernel update today which I decided since it should know what its doing should not hurt anything. Well after a reboot I get nothing. Nothing meaning I see

searching for root device **+++++****+++++*
and then it tries to fsck which gets a 126 error. I cannot find anything on this. I cannot boot into any kernel. The good thing is the drive checks fine if I boot to a cd and fsck it. How can I possibly undo the kernel update or find out what caused my issue. I would like to not have to reformat the drive. I dont have data to be lost but settings and programs I installed. I do have an Ubuntu cd that I can boot to, to make changes. I will surely provide any info needed. Right now my pc is basically dead. Thanks in advance.
 
Old 02-05-2008, 11:22 PM   #12
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,127

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
let's have a look at the /boot/grub/menu.lst and /etc/fstab from the hard-disk system. Toss in a "sudo fdisk -l" while you're at it.
 
Old 02-06-2008, 06:05 AM   #13
dtmbmw325i
Member
 
Registered: May 2006
Location: Lebanon, PA
Distribution: Ubuntu 7.10
Posts: 47

Original Poster
Rep: Reputation: 16
I will assume, because it would seem to make sense, that you want this from the working system. Since I can't boot into it I will be using a gutsy cd and opening menu.lst and fstab from my system, not from the cd. I just started work, its 0703est and I get off of work at 1500est. You should see this sometime after that. I don't have anything to do tonight that I am aware of so I will frequently be checking back.
 
Old 02-06-2008, 06:38 AM   #14
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,127

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Yep, any liveCD ...
 
Old 02-06-2008, 02:54 PM   #15
dtmbmw325i
Member
 
Registered: May 2006
Location: Lebanon, PA
Distribution: Ubuntu 7.10
Posts: 47

Original Poster
Rep: Reputation: 16
Menu.lst
Code:
# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default		10

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout		3

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line)  and entries protected by the
# command 'lock'
# e.g. password topsecret
#      password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title		Windows 95/98/NT/2000
# root		(hd0,0)
# makeactive
# chainloader	+1
#
# title		Linux
# root		(hd0,1)
# kernel	/vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
##      kopt_2_6_8=root=/dev/hdc1 ro
##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=4ab875ce-d2bb-4865-9682-f836d5564fb0 ro

## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,0)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
##      alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
##      lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash

## should update-grub lock old automagic boot options
## e.g. lockold=false
##      lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
##      howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
##      memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false

## ## End Default Options ##

##title		Ubuntu 7.10, kernel 2.6.24 Default
##root		(hd0,0)
##kernel		/boot/vmlinuz root=UUID=4ab875ce-d2bb-4865-9682-f836d5564fb0 ro quiet splash
##quiet

##title		Ubuntu 7.10, kernel 2.6.24 Default (recovery mode)
##root		(hd0,0)
##kernel		/boot/vmlinuz root=UUID=4ab875ce-d2bb-4865-9682-f836d5564fb0 ro single

##title		Ubuntu 7.10, kernel 2.6.24.old Previous
##root		(hd0,0)
##kernel		/boot/vmlinuz.old root=UUID=4ab875ce-d2bb-4865-9682-f836d5564fb0 ro quiet splash
##quiet

##title		Ubuntu 7.10, kernel 2.6.24.old Previous (recovery mode)
##root		(hd0,0)
##kernel		/boot/vmlinuz.old root=UUID=4ab875ce-d2bb-4865-9682-f836d5564fb0 ro single

##title		Ubuntu 7.10, kernel 2.6.24jn1
##root		(hd0,0)
##kernel		/boot/vmlinuz-2.6.24jn1 root=UUID=4ab875ce-d2bb-4865-9682-f836d5564fb0 ro quiet splash
##initrd		/boot/initrd.img-2.6.24jn1
##quiet

##title		Ubuntu 7.10, kernel 2.6.24jn1 (recovery mode)
##root		(hd0,0)
##kernel		/boot/vmlinuz-2.6.24jn1 root=UUID=4ab875ce-d2bb-4865-9682-f836d5564fb0 ro single
##initrd		/boot/initrd.img-2.6.24jn1

##title		Ubuntu 7.10, kernel 2.6.24.old
##root		(hd0,0)
##kernel		/boot/vmlinuz-2.6.24.old root=UUID=4ab875ce-d2bb-4865-9682-f836d5564fb0 ro quiet splash
##quiet

##title		Ubuntu 7.10, kernel 2.6.24.old (recovery mode)
##root		(hd0,0)
##kernel		/boot/vmlinuz-2.6.24.old root=UUID=4ab875ce-d2bb-4865-9682-f836d5564fb0 ro single

##title		Ubuntu 7.10, kernel 2.6.24
##root		(hd0,0)
##kernel		/boot/vmlinuz-2.6.24 root=UUID=4ab875ce-d2bb-4865-9682-f836d5564fb0 ro quiet splash
##quiet

##title		Ubuntu 7.10, kernel 2.6.24 (recovery mode)
##root		(hd0,0)
##kernel		/boot/vmlinuz-2.6.24 root=UUID=4ab875ce-d2bb-4865-9682-f836d5564fb0 ro single

title		Ubuntu 7.10, kernel 2.6.22-14-generic
root		(hd0,0)
kernel		/boot/vmlinuz-2.6.22-14-generic root=UUID=4ab875ce-d2bb-4865-9682-f836d5564fb0 ro quiet splash
initrd		/boot/initrd.img-2.6.22-14-generic
quiet

title		Ubuntu 7.10, kernel 2.6.22-14-generic (recovery mode)
root		(hd0,0)
kernel		/boot/vmlinuz-2.6.22-14-generic root=UUID=4ab875ce-d2bb-4865-9682-f836d5564fb0 ro single
initrd		/boot/initrd.img-2.6.22-14-generic

title		Ubuntu 7.10, memtest86+
root		(hd0,0)
kernel		/boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

Fstab
Code:
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# /dev/hda1
UUID=4ab875ce-d2bb-4865-9682-f836d5564fb0 /               reiserfs notail          0       1
/dev/hdb1 /media/200INT     ext3    auto,rw
/dev/hda2
UUID=8f599c66-ca39-47c4-b712-ce911c8d86b7 none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec 0       0
/dev/hdd        /media/cdrom1   udf,iso9660 user,noauto,exec 0       0
/dev/sda1	/media/500INTA	ext3 auto,rw,
/dev/sdb1	/media/500INTB 	ext3 auto,rw
fdisk -l
Code:
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000dffd3

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       60801   488384001   83  Linux

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000bd41d

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       60801   488384001   83  Linux

Disk /dev/hda: 122.9 GB, 122942324736 bytes
255 heads, 63 sectors/track, 14946 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x3e7f7ee2

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1       14314   114977173+  83  Linux
/dev/hda2           14315       14946     5076540   82  Linux swap / Solaris

Disk /dev/hdb: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0004d2a8

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1               1       24321   195358401   83  Linux
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
trouble compiling kernel sancho1980 Debian 14 09-30-2006 04:44 PM
Trouble compiling Kernel 2.6.10 AJones Debian 8 02-13-2005 03:28 AM
having trouble while compiling kernel.. The_eXXe Mandriva 12 09-02-2004 01:53 PM
Having trouble compiling 2.6.3 kernel s1lv1a9999 Linux - Software 2 03-03-2004 01:14 AM
Trouble when compiling the 2.6.2 kernel Menestrel Linux - Software 1 02-14-2004 07:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration