LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 04-15-2009, 03:44 AM   #1
LinuxNewman
Member
 
Registered: Apr 2009
Posts: 42

Rep: Reputation: 15
Exclamation Booting a custom kernel with a new root filesystem


Hi everybody !
I am using OpenSuSE 11.0 . I have built a custom kernel(2.6.25.5-1.1) and I have to boot it with a new root file system.I have created a separate partition (in this case /dev/sda4) and made ext2 filesystem and mounted it on a mount point(/mnt/point1 in this case). I also have populated the new file system with necessary directories like /dev,/bin,/proc etc...

But the major problem is how to boot the custom kernel with newly created file system as root? (i.e. When the kernel boots, "/" should not be root,instead, the root should be located in /mnt/point1/(new root???))
 
Old 04-15-2009, 04:06 AM   #2
eco
Member
 
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Rep: Reputation: 48
I can't imagine that would work!

What are you trying to do?

If you want to test a new kernel, you can do that without losing the previous version. Have a look at your grub/lilo man page depending on your boot loader.

If you are trying to test a new environment, you could simply chroot into it.

Code:
# chroot /bin/bash /mnt/point1
We need more info to be able to help you.
 
Old 04-15-2009, 04:10 AM   #3
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
You can try to add root= to the kernel options in /boot/grub/menu.lst. Opensuse uses the device name as listed in /dev/disk/by-id. You have to identify which id belongs to the new partition and use that in the kernel boot line. Also add the proper line in /etc/fstab to automatically mount the partition at boot.

An example from my system:
Code:
# In /etc/fstab:
/dev/disk/by-id/ata-FUJITSU_MHV2160BT_NU06T6527J10-part8 /                    ext3       acl,user_xattr        1 1

# In /boot/grub/menu.lst:
title openSUSE 11.1 - 2.6.27.21-0.1
    root (hd0,6)
    kernel /vmlinuz-2.6.27.21-0.1-pae root=/dev/disk/by-id/ata-FUJITSU_MHV2160BT_NU06T6527J10-part8 resume=/dev/disk/by-id/ata-FUJITSU_MHV2160BT_NU06T6527J10-part6 splash=silent showopts vga=0x317
    initrd /initrd-2.6.27.21-0.1-pae
Hope this helps!
 
Old 04-15-2009, 04:46 AM   #4
LinuxNewman
Member
 
Registered: Apr 2009
Posts: 42

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by eco View Post
I can't imagine that would work!

What are you trying to do?

If you want to test a new kernel, you can do that without losing the previous version. Have a look at your grub/lilo man page depending on your boot loader.

If you are trying to test a new environment, you could simply chroot into it.

Code:
# chroot /bin/bash /mnt/point1
We need more info to be able to help you.
Hi ! I have already tested the new kernel and it is working fine. All I need is to boot this kernel with new root file system.
Can I just change the boot flag by using fdisk on /dev/sda4? Or are there some other steps involved?
 
Old 04-15-2009, 04:56 AM   #5
LinuxNewman
Member
 
Registered: Apr 2009
Posts: 42

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by colucix View Post
You can try to add root= to the kernel options in /boot/grub/menu.lst. Opensuse uses the device name as listed in /dev/disk/by-id. You have to identify which id belongs to the new partition and use that in the kernel boot line. Also add the proper line in /etc/fstab to automatically mount the partition at boot.

An example from my system:
Code:
# In /etc/fstab:
/dev/disk/by-id/ata-FUJITSU_MHV2160BT_NU06T6527J10-part8 /                    ext3       acl,user_xattr        1 1

# In /boot/grub/menu.lst:
title openSUSE 11.1 - 2.6.27.21-0.1
    root (hd0,6)
    kernel /vmlinuz-2.6.27.21-0.1-pae root=/dev/disk/by-id/ata-FUJITSU_MHV2160BT_NU06T6527J10-part8 resume=/dev/disk/by-id/ata-FUJITSU_MHV2160BT_NU06T6527J10-part6 splash=silent showopts vga=0x317
    initrd /initrd-2.6.27.21-0.1-pae
Hope this helps!
Hi ! As suggested by you,I gave root= the device id(too long to write here). I had already modified fstab to mount the new partition. When I rebooted, all I got was a blank screen.No error,no warning,no display...simply nothing.

I had not mentioned anything about initrd because I don't have any initrd image associated with my new kernel.Is there need of initrd image? It should be noted that I booted successfully this new kernel earlier simply by mentioning root (hd0,1) and kernel=/boot/bzImage in grub.
 
Old 04-15-2009, 06:30 AM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,043

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
Quote:
Originally Posted by LinuxNewman View Post
Hi ! I have already tested the new kernel and it is working fine. All I need is to boot this kernel with new root file system.
Can I just change the boot flag by using fdisk on /dev/sda4? Or are there some other steps involved?
The kernel will use as its root whatever you tell it with the root= boot parameter, as has already been said. You usually set these in your bootloader config.

Another different question is whether that fs you created has all the necessary means to boot. Without a proper init system all you are going to get is a nice kernel panic "no init found, try passing init=... to kernel".

PS. Our posts crossed, I was a bit late

Last edited by i92guboj; 04-15-2009 at 06:37 AM.
 
Old 04-15-2009, 06:34 AM   #7
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,043

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
Quote:
Originally Posted by LinuxNewman View Post
Hi ! As suggested by you,I gave root= the device id(too long to write here). I had already modified fstab to mount the new partition. When I rebooted, all I got was a blank screen.No error,no warning,no display...simply nothing.
Fstab? what fstab??' the fstab of your old system? I hope not, since you are not going to be using that file system with your new kernel.

Quote:
I had not mentioned anything about initrd because I don't have any initrd image associated with my new kernel.Is there need of initrd image? It should be noted that I booted successfully this new kernel earlier simply by mentioning root (hd0,1) and kernel=/boot/bzImage in grub.
You don't need an initrd as long as all the modules you need to boot are compiled statically inside your kernel. You will need at least the hd controller driver and the fs driver for whatever fs you used to format your root partition.

If you are really going to do anything serious with this I suggest you to pick either Gentoo or LFS and learn how to install a linux os from scratch. You seem to be lacking the essential knowledge that you will need to do so successfully.
 
Old 04-16-2009, 12:00 AM   #8
LinuxNewman
Member
 
Registered: Apr 2009
Posts: 42

Original Poster
Rep: Reputation: 15
I mentioned root=(the device id of new partition) in grub. then while booting it showed error 15 file not found.
 
Old 04-16-2009, 03:02 AM   #9
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,043

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
According to the grub info page:

Code:
15 : File not found
     This error is returned if the specified file name cannot be found,
     but everything else (like the disk/partition info) is OK.
So, check again that the kernel file name is correct and exists inside the partition where /boot resides.
 
Old 04-18-2009, 02:25 PM   #10
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA
Distribution: Debian/ Fedora
Posts: 427

Rep: Reputation: 33
Quote:
Originally Posted by LinuxNewman View Post
Hi everybody !
I am using OpenSuSE 11.0 . I have built a custom kernel(2.6.25.5-1.1) and I have to boot it with a new root file system.I have created a separate partition (in this case /dev/sda4) and made ext2 filesystem and mounted it on a mount point(/mnt/point1 in this case). I also have populated the new file system with necessary directories like /dev,/bin,/proc etc...

But the major problem is how to boot the custom kernel with newly created file system as root? (i.e. When the kernel boots, "/" should not be root,instead, the root should be located in /mnt/point1/(new root???))
I would suggest using the 'root=LABEL=' kernel parm. you will need to change three things:
  • on the new file system, e2label /dev/xxx New
  • in grub.conf on the kernel line root=LABEL=New
  • in /etc/fstab on the new file system, LABEL=New / default blah
In this example I used 'New', you can use whatever you wish, check the e2label man page for limitations.
 
Old 04-19-2009, 10:53 PM   #11
LinuxNewman
Member
 
Registered: Apr 2009
Posts: 42

Original Poster
Rep: Reputation: 15
o.k friends I will try all this and report back here the result.Thanks :-)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to avoid force check of root filesystem while booting RHEL frcrce08 Linux - Software 1 02-02-2009 10:40 AM
kernel panic while booting custom compiled 2.6.24 kernel on RHEL 4 AS samkraju Red Hat 4 02-10-2008 12:55 AM
Problem checking root filesystem when booting Slackware daschaich Slackware 2 09-01-2006 09:55 PM
booting stops at - checking root filesystem varun_saa Mandriva 3 09-29-2005 12:58 AM
How do I make sure Im booting onto my custom kernel? Kramer Linux - General 10 10-21-2003 12:43 PM


All times are GMT -5. The time now is 01:31 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration