原创 setuproot: moving /dev failed: No such file or dir

2011-6-14 21:15 10429 7 7 分类: MCU/ 嵌入式
我在所装的系统中,自己在grub里面加了几条代码,就是加入title、root、Kernel、initrd等几项,把Kernel中root的路径指定为我认为系统的安装路径,也就是/dev/hda1或者/dev/hdb1,但是在从我设定的这个选项启动的时候,总是给出错误提示,然后就Kernel Panic了,不知为啥,上网搜了一下,发现很多人也有此问题,但是还灭有明确解决方案,把几个有借鉴意义的内容拿过来留存。
======================================================================
======================================================================
环境介绍:Centos5.2+2.6.18-8.el5内核,编译器是GCC4.1.2。
要编译的内核2.6.18-8.el3
仅仅修改了部分内核的配置信息,没有大的变化。
然后:make ;make modules;make modules_install;
编译没有出问题,生成了内核,mkinitrd生成了initrd,加到lilo.conf中,重启选择新内核,出现一下问题:

hub 3-0:1.0: USB hub found
hub 3-0:1.0: 2 ports detected
Scanning and configuring dmraid supported devices
Trying to resume from LABEL=SWAP-hdc4
No suspend signature on swap, not resuming.
Creating root device.
Mounting root filesystem.
mount: could notKernel panic - not syncing: Attempted to kill init!
find filesystem  '/dev/root'
Setting up other filesystems.
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
两者区别就是编译器版本一个是gcc3.4,一个是gcc4.1,后者编译通过,但是不能引导系统。

解决方法:
Here's the fix
After almost giving up on Fedora 5, I finally got the fix to this problem.

The suspend signature on swap error, "Trying to resume from LABEL=SWAP-hdd3. No suspend signature on swap, not resuming", can be ignored. It gives this error because when the volumes are activated (look at the output previous to this error), it resumes the swap partition in that step. Therefore, it's trying to resume something that isn't suspended.

The error that causes all the trouble is "mount: could not find filesystem '/dev/root'". Appartently, in the init script within initrd-2.6.15-1.2054_FC5.img, the command 'mount /sysroot' is trying to mount /dev/root to /sysroot. Fedora 5 does not use /dev/root like in the previous versions of Fedora. Instead, it uses '/dev/VolGroup00/LogVol00' or '/dev/hda1' (or whereever '/' is located) to mount to /sysroot. For some reason, when init calls 'mount /sysroot', it's trying to mount /dev/root to /sysroot, instead of /dev/VolGroup00/LogVol00 to /sysroot. This messes up everything after this step in the init process. When it does a switchroot at the end, it fails. After killing init, it causes the kernel panic.

Here's the fix:

1) Boot with the rescue CD
2) Type 'chroot /mnt/sysimage' (wherever it mounts the Fedora 5 partition)
3) 'cd /boot'
4) 'mkdir newinit'
5) 'cd newinit'
6) 'gunzip -c ../initrd-2.6.15-1.2054_FC5.img | cpio -idmv'
7) 'vi init'
8) Find 'mount /sysroot' (near the end of the file)
9) Delete or comment this out
10) Replace with 'mount -o defaults --ro -t ext3 /dev/VolGroup00/LogVol00 /sysroot' where /dev/VolGroup00/LogVol00 is the mount point for /
11) ':wq' out of vi
12) 'find . | cpio --quiet -c -o >../newinitrd'
13) 'cd ..' - you are now in /boot
14) 'mv initrd-2.6.15-1.2054_FC5.img initrd-2.6.15-1.2054_FC5.bak' - backup current initrd img file (just in case)
15) 'gzip -9 < newinitrd > initrd-2.6.15-1.2054_FC5.img'
16) Reboot the computer without the CD

* Steps 4-6,12,13,15 were taken from another site, but I couldn't post the URL. I'll try in my next post.

This should fix it. I'm glad I can finally run Fedora 5 on my box.

MarkCole, I'm not sure if you were experiencing the exact same problems I was with mounting root. However, I hope this helps anyone else experiencing the same problems I had.

Andy
======================================================================
======================================================================
 
Xen-users] mkinitrd problem when LVM volume group names differ between
How can I make "mkinitrd" generate a correct ramdisk image when the LVM volume group names differ between the Dom0 and DomU?
The details:

In Dom0, the root filesystem is LVM in volume group "VGShark", as follows:

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VGShark-LogVol00
                      450G  119G  308G  28% /
/dev/sda1              99M   45M   49M  48% /boot
tmpfs                 1.9G     0  1.9G   0% /dev/shm

In the DomU, the root filesystem is LVM in volume group "VolGroup00".

Back in Dom0, I run the following to create the initrd...

#mkinitrd -f initrd-2.6.16.29-xen.img 2.6.16.29-xen

...which produces the following (snippet) in the generated "init" file in the ramdisk image:
echo Making device-mapper control node
mkdmnod
mkblkdevs
echo Scanning logical volumes
lvm vgscan --ignorelockingfailure
echo Activating logical volumes
lvm vgchange -ay --ignorelockingfailure  VGShark
resume /dev/VGShark/LogVol01
echo Creating root device.
mkrootdev -t ext3 -o defaults,ro /dev/VGShark/LogVol00
echo Mounting root filesystem.
mount /sysroot
echo Setting up other filesystems.
setuproot
echo Switching to new root and running init.
switchroot

The DomU config file is:

kernel = "/boot/vmlinuz-2.6.16.29-xen"
ramdisk = "/boot/initrd-2.6.16.29-xen.img"
root = "/dev/VolGroup00/LogVol00 ro"
name = "minnow"
memory = "512"
disk = [ 'file:/var/vm/minnow/disk0.img,xvda,w' ]
vif = [ 'mac=00:16:3e:00:e6:8f' ]
uuid = "7e6aa8bb-37da-3a7f-e72e-63290fcf2713"

..which produces the following error at domU boot time:

Making device-mapper control node
Scanning logical volumes
  Reading all physical volumes.  This may take a while...
  Found volume group "VolGroup00" using metadata type lvm2
Activating logical volumes
  Unable to find volume group "VGShark"
Creating root device.
Mounting root filesystem.
mount: could not find filesystem '/dev/root'
Setting up other filesystems.
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!

So --

Here is the /etc/fstab (in Dom0):

#cat fstab
/dev/VGShark/LogVol00   /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
sysfs                   /sys                    sysfs   defaults        0 0
/dev/VGShark/LogVol01   swap                    swap    defaults        0 0

I copy this file to create fstab.domU, and change the references to VGShark to VolGroup00, which is:
#cat fstab.domU
/dev/VolGroup00/LogVol00   /                    ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
sysfs                   /sys                    sysfs   defaults        0 0
/dev/VolGroup00/LogVol01   swap                 swap    defaults        0 0

This matches exactly what DomU is expecting.

I rebuild initrd with the following command:

# mkinitrd -f --fstab=/etc/fstab.domU initrd-2.6.16.29-xen.img 2.6.16.29-xen

...which produces the following (snippet) in the generated "init" file in the ramdisk image:
mkblkdevs
resume /dev/VolGroup00/LogVol01
echo Creating root device.
mkrootdev -t ext3 -o defaults,ro /dev/VolGroup00/LogVol00
echo Mounting root filesystem.
mount /sysroot
echo Setting up other filesystems.
setuproot
echo Switching to new root and running init.
switchroot

I try again to boot the DomU with the same config file listed above and I get this error:
Creating root device.
Mounting root filesystem.
mount: could not find filesystem '/dev/root'
Setting up other filesystems.
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!

Next --

I modify the generated "init" file in the ramdisk image to the following (replace VGShark with VolGroup00):
mkdmnod
mkblkdevs
echo Scanning logical volumes
lvm vgscan --ignorelockingfailure
echo Activating logical volumes
lvm vgchange -ay --ignorelockingfailure  VolGroup00
resume /dev/VolGroup00/LogVol01
echo Creating root device.
mkrootdev -t ext3 -o defaults,ro /dev/VolGroup/LogVol00
echo Mounting root filesystem.
mount /sysroot
echo Setting up other filesystems.
setuproot
echo Switching to new root and running init.
switchroot

I rebuild the initrd image, and change the ramdisk line in the domU config to:

kernel = "/boot/vmlinuz-2.6.16.29-xen"
ramdisk = "/boot/initrdDomU.img"
root = "/dev/VolGroup00/LogVol00 ro"
name = "minnow"
memory = "512"
disk = [ 'file:/var/vm/minnow/disk0.img,xvda,w' ]
vif = [ 'mac=00:16:3e:00:e6:8f' ]
uuid = "7e6aa8bb-37da-3a7f-e72e-63290fcf2713"

...and the DomU boots up!

The conclusion I draw is that mkinitrd is not creating a good ramdisk image.

How can I make mkinitrd generate a correct ramdisk image when the volume group names differ between the Dom0 and DomU?
TIA,

- Mike
======================================================================
======================================================================
 

converting full to para

virt-p2v was able to convert my centOS 5.2 physical machine to xen virtual machine and it runs great. Now, I am working on to convert this full virt machine to para virt .


Under my domU i have installed kernel-xen (since it is needed ) , and edited my grub menu to use the installed kernel. 

My grub menu file in domU looks like:

----
kernel /vmlinuz-2.6.18-92.1.17.el5xen ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-92.1.17.el5xen.img                              
----

Here is my config file that I have used (for para):

-----
name = "localhost_localdomain"
uuid = "a57400f11c2138ec41087b80e813496e"
maxmem = 512
memory = 512
vcpus = 1
bootloader = "/usr/bin/pygrub"
disk = [ "file:/freespace/p2v-localhost_localdomain-200811061823-hda.img,hda,w" ]
vif = [ "mac=00:16:3e:e6:3b:e2" ]
on_poweroff = "destroy"
on_reboot = "restart"
on_crash = "restart"
#keymap = "en-us"
#serial = "pty"
extra = "xencons=tty"
bootloader = "/usr/bin/pygrub"
vfb = [  ]
vif = [ "mac=00:16:3e:17:03:9f,bridge=xenbr0" ]
----


The error I am getting is:

--

[root@ha2 xen]# xm create /etc/xen/localhost_localdomain -c
Using config file "/etc/xen/localhost_localdomain".
Started domain localhost_localdomain
PCI: Fatal: No PCI config space access function found
rtc: IRQ 8 is not free.
PCI: Fatal: No PCI config space access function found
rtc: IRQ 8 is not free.
i8042.c: No controller found.
Red Hat nash version 5.1.19.6 starting
  Reading all physical volumes.  This may take a while...
  No volume groups found
  Volume group "VolGroup00" not found
mount: could not find filesystem '/dev/root'
setuproot: moving /dev failed: No such file or directory
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
switchroot: mount failed: No such file or directory
Kernel panic - not syncing: Attempted to kill init!
---



Any help will be appreciated.

Thanks !
Paras.

 
======================================================================
======================================================================

_______________________________________________
> if (Nabble.searchterms != null && Nabble.searchterms.length > 0) { Nabble.hilt(Nabble.searchterms, Nabble.get("nabble.msgtxt20383827")); }

Re: converting full to para

Click to flag this post >document.write(Nabble.ratingStars(3)); icon_star_blue.pngicon_star_blue.pngicon_star_blue.png

by >document.write(''); Joey Boggs-2 >document.write(''); >document.write(Nabble.formatDateLong(new Date(1226326470000))); Nov 10, 2008; 10:14pm :: Rate this Message: - Use ratings to moderate (?)

> document.writeln('Reply | '); Reply | Reply | Reply to Author > if( Nabble.user == 1244985 ) { document.writeln('| Delete'); } else if( Nabble.user == 916818 ) { document.writeln('| Delete'); } document.writeln('| Print'); | Print | View Threaded | Show Only this Message

I was using this process a few months back. Most likely what's happening
is that it's missing the disk controller modules in the in initrd so
it's not able to find your logical volumes. You'll will need to update
your  /etc/modprobe.conf to use the paravirt modules (xennet/xenblk)
then rebuild the initrd. Should boot at that point.

Paras pradhan wrote:

> virt-p2v was able to convert my centOS 5.2 physical machine to xen
> virtual machine and it runs great. Now, I am working on to convert
> this full virt machine to para virt .
>
> Under my domU i have installed kernel-xen (since it is needed ) , and
> edited my grub menu to use the installed kernel.
>
> My grub menu file in domU looks like:
>
> ----
> kernel /vmlinuz-2.6.18-92.1.17.el5xen ro root=/dev/VolGroup00/LogVol00
> rhgb quiet
> initrd /initrd-2.6.18-92.1.17.el5xen.img                              
> ----
>
> Here is my config file that I have used (for para):
>
> -----
> name = "localhost_localdomain"
> uuid = "a57400f11c2138ec41087b80e813496e"
> maxmem = 512
> memory = 512
> vcpus = 1
> bootloader = "/usr/bin/pygrub"
> disk = [
> "file:/freespace/p2v-localhost_localdomain-200811061823-hda.img,hda,w" ]
> vif = [ "mac=00:16:3e:e6:3b:e2" ]
> on_poweroff = "destroy"
> on_reboot = "restart"
> on_crash = "restart"
> #keymap = "en-us"
> #serial = "pty"
> extra = "xencons=tty"
> bootloader = "/usr/bin/pygrub"
> vfb = [  ]
> vif = [ "mac=00:16:3e:17:03:9f,bridge=xenbr0" ]
> ----
>
>
> The error I am getting is:
>
> --
>
> [root@ha2 xen]# xm create /etc/xen/localhost_localdomain -c
> Using config file "/etc/xen/localhost_localdomain".
> Started domain localhost_localdomain
> PCI: Fatal: No PCI config space access function found
> rtc: IRQ 8 is not free.
> PCI: Fatal: No PCI config space access function found
> rtc: IRQ 8 is not free.
> i8042.c: No controller found.
> Red Hat nash version 5.1.19.6 <http://5.1.19.6> starting
>   Reading all physical volumes.  This may take a while...
>   No volume groups found
>   Volume group "VolGroup00" not found
> mount: could not find filesystem '/dev/root'
> setuproot: moving /dev failed: No such file or directory
> setuproot: error mounting /proc: No such file or directory
> setuproot: error mounting /sys: No such file or directory
> switchroot: mount failed: No such file or directory
> Kernel panic - not syncing: Attempted to kill init!
> ---
>
>
>
> Any help will be appreciated.
>
> Thanks !
> Paras.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> et-mgmt-tools mailing list
> et-mgmt-tools@...
> https://www.redhat.com/mailman/listinfo/et-mgmt-tools

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@...
https://www.redhat.com/mailman/listinfo/et-mgmt-tools
> if (Nabble.searchterms != null && Nabble.searchterms.length > 0) { Nabble.hilt(Nabble.searchterms, Nabble.get("nabble.msgtxt20420703")); }

Re: [Xen-users] converting full to para

Click to flag this post >document.write(Nabble.ratingStars(3)); icon_star_blue.pngicon_star_blue.pngicon_star_blue.png

by >document.write(''); Paras pradhan >document.write(''); >document.write(Nabble.formatDateLong(new Date(1226334958000))); Nov 11, 2008; 12:35am :: Rate this Message: - Use ratings to moderate (?)

> document.writeln('Reply | '); Reply | Reply | Reply to Author > if( Nabble.user == 32262 ) { document.writeln('| Delete'); } else if( Nabble.user == 916818 ) { document.writeln('| Delete'); } document.writeln('| Print'); | Print | View Threaded | Show Only this Message



On Mon, Nov 10, 2008 at 4:24 AM, John Haxby <john.haxby@...> wrote:
Paras pradhan wrote:
virt-p2v was able to convert my centOS 5.2 physical machine to xen virtual machine and it runs great. Now, I am working on to convert this full virt machine to para virt .

Under my domU i have installed kernel-xen (since it is needed ) , and edited my grub menu to use the installed kernel. [snip]
Red Hat nash version 5.1.19.6 <http://5.1.19.6> starting

 Reading all physical volumes.  This may take a while...
 No volume groups found
 Volume group "VolGroup00" not found
mount: could not find filesystem '/dev/root'
setuproot: moving /dev failed: No such file or directory
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
switchroot: mount failed: No such file or directory
Kernel panic - not syncing: Attempted to kill init!
---

I think you're missing the xenblk driver.   Try editing /etc/modprobe.conf to look like this:

  alias eth0 xennet
  alias scsi_hostadapter xenblk

and then

  mkinitrd -f /boot/initrd-2.6.18-92.1.17.el5xen.img 2.6.18-92.1.17.el5xen

jch


Thanks !. It worked....


Paras. 


_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@...
https://www.redhat.com/mailman/listinfo/et-mgmt-tools
> if (Nabble.searchterms != null && Nabble.searchterms.length > 0) { Nabble.hilt(Nabble.searchterms, Nabble.get("nabble.msgtxt20423341")); }
======================================================================
======================================================================
 

求助:内核升级问题,非常感谢!

我在FC6 下编译2.6.23 的代码(采用默认选项),编译过程:
make menuconfig
make bzImage
make modules
make modules_install
make install
然后重启选2.6.23内核,出现如下错误:
mount: could not find filesystem '/dev/root'
setuproot: moving /dev failed: No such file or directory
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
switchroot: mount failed: No such file or directory
Kernel panic - not syncing: Attempted to kill init!

请高手赐教,非常感谢。    
-------------------
你还需要mkinitrd  initrd-2.6.23.img 2.6.23,然后把生成img文件拷到 /boot下面。
 
======================================================================
======================================================================
 
Problem solved. The trouble is that I don't _exactly_ know what changed.

I switched back to grub from lilo.
Then grub-install.
Then changed grub config and removed "quiet".

Then the UP kernel boots in.
The SMP still crashes, but that is a different issue.
======================================================================
======================================================================
 
Hi,

I'm trying to move my linux server to a new machine, this machine only supports SATA drives rather than the PATA of my old machine.

I've cloned the disk image to the new SATA drive, but when I boot Fedora FC5 I get the following error and then a kernel panic:

Trying to resume from /dev/hda3
Unable to access resume device (/dev/hda3)

I've edited grub.conf and fstab (and did a grub-install /dev/sda), but I still have the error. I can get into the partition using the rescue CD to perform edits.

Would anyone be kind enough to point me in the direction of what I need to do to fix this?
-------------------------------
You must have missed something in grub.conf or menu.lst. It's probably a parameter of the kernel, look for "resume=/dev/hda3".
-------------------------------
Hi,

I did a cat /boot/grub/* |grep rescue with no result, also the same with hda - nothing.
-------------------------------
try "grep -R resume /boot" or "grep -R hda /boot"
-------------------------------
It reported nothing of any significance for 'resume' and nothing at all for 'hda'.

This is driving me crazy!
If it helps:

fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225290 bytes

Device Boot Start End Blocks id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 30393 244027350 83 Linux
/dev/sda3 30394 30515 979965 82 Linux swap / Solaris

more /boot/grub/device.map
(fd0) /dev/fd0
(hd0) /dev/sda

more /boot/grub/grub.conf

# grub.conf generated by anaconda
# ...
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/sda2
#boot=/dev/sda
default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Fedora Core (2.6.17-1.2187_FC5)
root (hd0,0)
kernel /vmlinuz-2.6.17-1.2187_FC5 ro root=LABEL=/ rhgb
initrd /initrd-2.6.17-1.2187_FC5.img
 
This is the result of the boot:

Code:
Mounting sysfs filesystem
Creating /dev
Creating initial device nodes
Setting up hotplug
Creating block device nodes.
Loading jdb.ko module
Loading ext3.ko module
Trying to resume from /dev/hda3
Unable to access resume device (/dev/hda3)
Creating root device
Mounting root filesystem
mount: could not find filesystem '/dev/root/'
Setting up other filesystems
Setting up new root fs
setuproot: moving /dev failed: No such file or direcroty
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!
fstab:

Code:
LABEL=/              /              ext3         defaults        1 1
LABEL=/boot          /boot          ext3         defaults        1 2
none                 /dev/pts       devpts       gid=5,mode=620  0 0
none                 /proc          proc         defaults        0 0
none                 /dev/shm       tmpfs        defaults        0 0
/dev/sda3            swap           swap         defaults        0 0
 
--------------------------------
 
Okay, in the end I used the FC5 DVD and did an 'upgrade' overwriting the boot records. As far as I can see it didn't change a thing in the files, but it worked.
--------------------------------
Fedora uses the partition/Filesystem label with Grub to dictate which partition is which FS (/,/boot, etc). Likely, these didn't transfer with your image move.

You'll notice that the device column in your fstab uses labels, rather than device names to specify what is what (except the swap partition). Booting with a live CD and changing those to the actual device names would probably have solved this issue for you

http://www.linuxquestions.org/questions/linux-general-1/hda-to-sda-help-493893/
======================================================================
 

文章评论0条评论)

登录后参与讨论
我要评论
0
7
关闭 站长推荐上一条 /2 下一条