General NAS-Central Forums

Welcome to the NAS community
It is currently Sun Sep 24, 2017 10:25 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Mon Mar 11, 2013 5:11 pm 
Offline

Joined: Fri Mar 08, 2013 5:21 pm
Posts: 2
Hi,

I am trying to install a debian on my ReadyNAS Duo V2 since a week now.
It's far from easy....
Well, my current problem is, that I would like to mount my root filesystem instead of the stock one.

I simply add INIT=/bin/sh to the BOOTARGS, so the boot stops before mounting the root fs from harddisk.
I provided my root filesystem on USB drive.

Now, this is what I did after booting into initrd:

Code:
~ # mkdir new-root
~ # mount /dev/sda1 new-root
~ # cd new-root
/new-root # mkdir old-root
/new-root # pivot_root . old-root
pivot_root: Invalid argument


this more or less cut&pasted from the pivot_root man page.

Tried to move the other mounts, as I found a suggestion in the web.
Code:
$ mount --move /sys /new-root/sys
$ mkdir /new-root/dev/pts
$ mount --move /dev/pts /new-root/dev/pts
$ mount --move /dev /new-root/dev
$ mount --move /proc /new-root/proc


Tried rotating root using switch_root.
And added EXEC in front...

Code:
$ exec switch_root -c /dev/ttyS0 /new-root /init
[... outputs usage info but no meaningful error message ...]
Bringing up RAID arrays...mdev: /sys/class: No such file or directory
done
Bringing up network...done
ERROR: Could not mount data partition [/dev/mtdblock4] (No such file or directory)
mdev: /sys/class: No such file or directory
/bin/ash: can't access tty; job control turned off


Code:
$ exec pivot_root . old-root
pivot_root: Invalid argument
Bringing up RAID arrays...mdev: /sys/class: No such file or directory
done
Bringing up network...done
ERROR: Could not mount data partition [/dev/mtdblock4] (No such file or directory)
mdev: /sys/class: No such file or directory
/bin/ash: can't access tty; job control turned off


But it does not behave like expected. My observations are:
- when I add a exec in front of pivot_root or switch_root, I get the same error message, but some init seems to be executed afterwards.
- the init called seems to be the init from initrd, it did not rotate root.

Does anyone have a hint?


thanks,

JPT


Top
 Profile  
 
PostPosted: Mon Mar 11, 2013 7:13 pm 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 6039
Quote:
/new-root # pivot_root . old-root
pivot_root: Invalid argument
Are you sure old-root and newroot aren't the same filesystem?


Top
 Profile  
 
PostPosted: Tue Mar 12, 2013 7:23 am 
Offline

Joined: Fri Mar 08, 2013 5:21 pm
Posts: 2
Quote:
Are you sure old-root and newroot aren't the same filesystem?

As far as I understood, old-root is where / gets mounted after new-root is /
That's why old-root has to be a directory on the new filesystem.


Top
 Profile  
 
PostPosted: Tue Mar 12, 2013 10:25 am 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 6039
Yes, that is true, but the kernel isn't happy with the parameters you pass. The error message you see is from the kernel, rejecting the current parameters.

From the man pages:
Quote:
The following restrictions apply to new_root and put_old:

- They must be directories.

- new_root and put_old must not be on the same file system as the current
root.

- put_old must be underneath new_root, that is, adding a nonzero number of
/.. to the string pointed to by put_old must yield the same directory as
new_root.

- No other file system may be mounted on put_old.
So in your snippet of code the only reason I can think of why it fails, is because sda1 already is mounted on / before the pivot_root is called.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group