LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-03-2013, 11:24 PM   #1
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Rep: Reputation: 55
Server won't boot with compiled kernel: switchroot: mount failed: No such file or dir


I've tried it about 20 times.

Its CentOS 5.9, and gives this message:
Code:
        Setting up new root fs
        setuproot: moving /dev failed: No such file or directory
        no fstab.sys, mounting internal defaults
        setuproot: error mounting /proc: No such file or directory
        setuproot: error mounting /sys: No such file or directory
        Switching to new root and running init.
        unmounting old /dev
        unmounting old /proc
        unmounting old /sys
        switchroot: mount failed: No such file or directory
        Kernel panic - not syncing: Attempted to kill init!
On an almost identical server with CentOS 6, it works A OK.

To make the .img files I used make bzImage

I also tried with:
Code:
/sbin/mkinitrd /boot/initrd-3.2.39.img 3.2.39
Booting with the old kernel still works fine.

Any ideas why it wont work with the new kernel?

TIA
 
Old 03-04-2013, 12:30 AM   #2
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
Can you share decompressed initrd file

mkdir /opt/test
cd /opt/test
gunzip -dc /boot/initrd-3.2.39.img |cpio -i

Thanks
 
Old 03-04-2013, 01:51 AM   #3
fortran
Member
 
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 300
Blog Entries: 2

Rep: Reputation: 51
Can you check that if new kernel entry is in file grub.conf or menu.lst?
 
Old 03-04-2013, 03:46 AM   #4
war49
LQ Newbie
 
Registered: Feb 2012
Location: Indonesia
Distribution: Slackware, Centos, Debian, RHEL
Posts: 13

Rep: Reputation: Disabled
Hi,

Your problem is similar to kernel 2.6.24.1 after compilation at this thread:

http://ubuntuforums.org/archive/index.php/t-858831.html
 
Old 03-04-2013, 09:25 AM   #5
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Original Poster
Rep: Reputation: 55
Quote:
Originally Posted by war49 View Post
Hi,

Your problem is similar to kernel 2.6.24.1 after compilation at this thread:

http://ubuntuforums.org/archive/index.php/t-858831.html
Thanks, but I don't have an Nvidia sata controller

---------- Post added 03-04-13 at 03:26 PM ----------

Quote:
Originally Posted by pavi_kanetkar View Post
Can you check that if new kernel entry is in file grub.conf or menu.lst?
Grub.conf is the one I change, I have both files though:
Code:
root# [opt/test]# diff /boot/grub/menu.lst /etc/grub.conf
root# [/opt/test]# ll /etc |grep grub.conf
lrwxrwxrwx  1 root  root      22 May 16  2011 grub.conf -> ../boot/grub/grub.conf
-rw-------  1 root  root     985 Mar  3 12:16 grub.conf.bak
 
Old 03-04-2013, 09:27 AM   #6
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Original Poster
Rep: Reputation: 55
Quote:
Originally Posted by vishesh View Post
Can you share decompressed initrd file

mkdir /opt/test
cd /opt/test
gunzip -dc /boot/initrd-3.2.39.img |cpio -i

Thanks
Code:
root [/opt/test]# gunzip -dc /boot/initrd-3.2.39.img |cpio -i 
11419 blocks
root [/opt/test]# ll
total 44
drwxr-xr-x 9 root root 4096 Mar  4 09:26 ./
drwxr-xr-x 8 root root 4096 Mar  4 09:24 ../
drwx------ 2 root root 4096 Mar  4 09:26 bin/
drwx------ 3 root root 4096 Mar  4 09:26 dev/
drwx------ 2 root root 4096 Mar  4 09:26 etc/
-rwx------ 1 root root 1597 Mar  4 09:26 init*
drwx------ 3 root root 4096 Mar  4 09:26 lib/
drwx------ 2 root root 4096 Mar  4 09:26 proc/
lrwxrwxrwx 1 root root    3 Mar  4 09:26 sbin -> bin/
drwx------ 2 root root 4096 Mar  4 09:26 sys/
drwx------ 2 root root 4096 Mar  4 09:26 sysroot/
 
Old 03-04-2013, 09:45 AM   #7
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
Now verify that mount command exist, /opt/test/bin/mount

if not then there is need to create initrd again .

You can also give a look on /opt/test/init to understand whats wrong going on

Thanks
 
Old 03-04-2013, 09:53 AM   #8
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Original Poster
Rep: Reputation: 55
Thanks, I think I found the problem(s) now but don't know how to fix it.

Problem 1, mount doesn't exist:
Code:
root@backup3 [/opt/test]# ll /opt/test/bin/mount 
/bin/ls: /opt/test/bin/mount: No such file or directory
root@backup3 [/opt/test]# find ./ -name mount 
root@backup3 [/opt/test]#
Problem 2, init refers to sda, but when the new kernel boots, I believe its changing everything to sdb:
Code:
root@backup3 [/opt/test]# cat init 
echo Scanning and configuring dmraid supported devices
resume /dev/sda2
echo Creating root device.
mkrootdev -t ext3 -o defaults,ro /dev/sda5
echo Mounting root filesystem.
In grub.conf, as well as fstab, I have the UUID, so I'm not sure why init is using /dev/sda, rather than the UUID, grub.conf:
Code:
title CentOS (3.2.39new2)
	root (hd0,0)
	kernel /vmlinuz-3.2.39new2 ro root=UUID=5560defe-1bde-440e-9135-a79cabcb9f87
	initrd /initrd-3.2.39new2.img
fstab:
Code:
root@backup3 [/opt/test]# cat /etc/fstab
UUID=5560defe-1bde-440e-9135-a79cabcb9f87               /                       ext3    defaults        1 2
UUID=b1f031d7-3f0a-471c-9bd7-dee6d05a2bef               /tmp                    ext3    defaults        1 2
UUID=60a71d20-4ca9-4769-abeb-2a8c75c9463c               /boot                   ext3    defaults        1 1
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/swapfile1	        swap                    swap    defaults        0 0
#/dev/sdb1		/backup			ext3	defaults	1 2
/tmp             /var/tmp                    ext3    defaults,bind,noauto        0 0
Is there a way to get the kernel to us the UUID instead of /dev/sd(a-b)#?
 
Old 03-04-2013, 10:09 AM   #9
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
You can edit init file and recreate initrd using following steps , But here the concern is mount command
cd /opt/test
find .|cpio --create --format 'newc'>/tmp/myinit
gzip /tmp/myinit
cp /tmp/myinit /boot/


I would recommend you to recreate initrd file using following command

/sbin/mkinitrd /boot/initrd-'your-kernel-version'.img your-kernel-version

for example
/sbin/mkinitrd /boot/initrd-2.6.18-238.el5.img 2.6.18-238.el5

Ensure that /lib/module hold that particular kernel version file

Thanks
 
  


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
[SOLVED] Ubuntu - System won;t boot after failed kernel update stoneym Linux - Software 3 02-23-2012 01:28 AM
Fedora 8 boot failure. "switchroot: mount failed..." hacker supreme Fedora 10 09-25-2010 01:59 AM
[SOLVED] One of my file systems failed to auto-mount on boot taylorkh Linux - Newbie 5 12-29-2009 03:11 PM
kernel panic - custom kernel won't mount file system j-osh Fedora 8 11-19-2008 01:13 AM
Newly compiled kernel won't boot nivantha Linux - Kernel 3 09-14-2006 03:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:12 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