Unix Technical Forum

chroot and mount -t proc

This is a discussion on chroot and mount -t proc within the Gentoo Linux Support forums, part of the Unix Operating Systems category; --> I have been using chroot recently to do some compiling in a different environment and distro. Sometimes, I forget ...


Go Back   Unix Technical Forum > Unix Operating Systems > Gentoo Linux Support

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-21-2008, 11:27 AM
Peter
 
Posts: n/a
Default chroot and mount -t proc

I have been using chroot recently to do some compiling in a different
environment and distro. Sometimes, I forget to do mount -t proc
none /mnt/chroot/proc before doing the chroot.

Most everything works OK when compiling. Only failings I have seen are
the failure of certain programs to locate the correct kernel source when
compiling and mkinitrd reports /proc not found.

My question is: Exactly what is the reason for mounting a local copy
of /proc prior to chrooting? Some FAQ show proc being mounted AFTER
chrooting:

# mount /dev/hda## /mnt/chroot
# chroot /mnt/chroot
# mount -t proc none /proc

as opposed to:

# mount /dev/hda## /mnt/chroot
# mount -t proc none /mnt/chroot/proc
# chroot /mnt/chroot

Are these two identical? Any clarification or links to clear FAQ are
appreciated!

--
Peter


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-21-2008, 11:27 AM
Mogens V.
 
Posts: n/a
Default Re: chroot and mount -t proc

Peter wrote:
> I have been using chroot recently to do some compiling in a different
> environment and distro. Sometimes, I forget to do mount -t proc
> none /mnt/chroot/proc before doing the chroot.
>
> Most everything works OK when compiling. Only failings I have seen are
> the failure of certain programs to locate the correct kernel source when
> compiling and mkinitrd reports /proc not found.
>
> My question is: Exactly what is the reason for mounting a local copy
> of /proc prior to chrooting? Some FAQ show proc being mounted AFTER
> chrooting:
>
> # mount /dev/hda## /mnt/chroot
> # chroot /mnt/chroot
> # mount -t proc none /proc
>
> as opposed to:
>
> # mount /dev/hda## /mnt/chroot
> # mount -t proc none /mnt/chroot/proc
> # chroot /mnt/chroot
>
> Are these two identical? Any clarification or links to clear FAQ are
> appreciated!


I won't try to explain weather or not the two ways might work identical,
but since the proc filesystem is a kernel interface, I would never
chroot without first having mounted the proc fs belonging to the kernel
I'm chroot'ing to.
Everytime I do it the Right Way, it works fine for me.

Usually, I do this when installing Gentoo from a USB disk image, booting
off the cd.
Sometimes, a new netcard (i.e. Broadcom or Intel Gbit on a Dell) is not
supported, so I compile the driver. I'll later emerge the Gentoo driver.

--
Kind regards,
Mogens V.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-21-2008, 11:27 AM
Peter
 
Posts: n/a
Default Re: chroot and mount -t proc

On Sat, 2006-05-06 at 13:24 +0200, Mogens V. wrote:

snip...

> I won't try to explain weather or not the two ways might work identical,
> but since the proc filesystem is a kernel interface, I would never
> chroot without first having mounted the proc fs belonging to the kernel
> I'm chroot'ing to.
> Everytime I do it the Right Way, it works fine for me.
>
> Usually, I do this when installing Gentoo from a USB disk image, booting
> off the cd.
> Sometimes, a new netcard (i.e. Broadcom or Intel Gbit on a Dell) is not
> supported, so I compile the driver. I'll later emerge the Gentoo driver.
>


So, you're saying
mount -t proc none /mnt/chroot/proc
chroot /mnt/chroot

is the "right" way? When I do it this way, the errors I noted are
absent, which _is_ good!

Thx

--
Peter

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-21-2008, 11:27 AM
Mogens V.
 
Posts: n/a
Default Re: chroot and mount -t proc

Peter wrote:
> On Sat, 2006-05-06 at 13:24 +0200, Mogens V. wrote:
>
>>I won't try to explain weather or not the two ways might work identical,
>>but since the proc filesystem is a kernel interface, I would never
>>chroot without first having mounted the proc fs belonging to the kernel
>>I'm chroot'ing to.

>
> So, you're saying
> mount -t proc none /mnt/chroot/proc
> chroot /mnt/chroot
>
> is the "right" way?


Yup

--
Kind regards,
Mogens V.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:26 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com