FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 05-31-2008, 12:50 PM
Wolf Canis
 
Default chroot problem

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Wolf Canis wrote:
> Peter Humphrey wrote:
> [...]
>> # cd /mnt/rescue
>> # mount -tproc proc proc
>> # mount -obind /dev dev
>
> I mean that the mount commands should be:
>
> # mount -tproc proc /mnt/rescue/proc
> # mount -obind /dev /mnt/rescue/dev

Ooops, I overlooked your cd command. Therefore the
mount command is of course correct. :-[

W. Canis

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhBSZgACgkQKT9zBKF0twXnmgCeKd9Bcrcinp SFZYlYHH6JkYmJ
TAUAnjVNmHArsqLbx3nclUPDhIZqQzbW
=nt4b
-----END PGP SIGNATURE-----
--
gentoo-user@lists.gentoo.org mailing list
 
Old 05-31-2008, 08:09 PM
Alexander Meinke
 
Default chroot problem

Wolf Canis wrote:

# mount -tproc proc /mnt/rescue/proc
# mount -obind /dev /mnt/rescue/dev


Ooops, I overlooked your cd command. Therefore the
mount command is of course correct. :-[


Hi,

I think this is, although the 'cd' command is executed, necessary as the mount
command looks at /etc/fstab and if e.g. 'proc' is specified at command line
mount uses information from fstab.

However, I think this problem is whether mount nor bash related. Try

# mount -tproc proc /mnt/rescue/proc
# mount -obind /dev /mnt/rescue/dev
# chroot /mnt/rescue /bin/bash

Especially check the permissions of /mnt/rescue/bin/bash and /bin/bash. They
should be at least 0755. In case of there are several permission problems last
time on my system ('up-to-date-system', no ~*) rebuild the package that include
'chroot' so that right permissions are set for the program and its libs.


I hope this helps in any way and excuse me for that bad English.


Regards,

acm.
 
Old 06-01-2008, 11:52 AM
"Duane Griffin"
 
Default chroot problem

2008/5/29 Peter Humphrey <peter@humphrey.ukfsn.org>:
> I have no problem chrooting into a system on the hard disk if I've booted
> from an installation CD, but every time I try it after booting from another
> HD partition I get e.g. this:
>
> # chroot /mnt/rescue /bin/bash
> chroot: cannot run command `/bin/bash': Permission denied

Are you using SELinux or anything similar? If so (or you aren't sure),
what do the following commands (as root) say:

id -Z
ls -alZR /mnt/rescue

If not then try strace'ing the chroot call, like so:

strace -etrace=chroot,chdir,execve chroot /mnt/rescue /bin/bash

That will show whether it is the chroot call itself that is failing or
the attempt to run bash afterwards.

Cheers,
Duane.

--
"I never could learn to drink that blood and call it wine" - Bob Dylan
--
gentoo-user@lists.gentoo.org mailing list
 
Old 06-01-2008, 05:51 PM
Peter Humphrey
 
Default chroot problem

On Saturday 31 May 2008 21:09:52 Alexander Meinke wrote:

> However, I think this problem is [neither] mount nor bash related. Try
>
> # mount -tproc proc /mnt/rescue/proc
> # mount -obind /dev /mnt/rescue/dev
> # chroot /mnt/rescue /bin/bash

That's almost exactly what I did. To be certain, I tried it with the full
paths you suggest, but of course I got the same result.

> Especially check the permissions of /mnt/rescue/bin/bash and /bin/bash.
> They should be at least 0755.

As I said the first time, the permissions are the same on both, thus:

# ls -l bin/bash
-rwxr-xr-x 1 root root 772120 2008-05-29 17:29 bin/bash
# ls -l /mnt/rescue/bin/bash
-rwxr-xr-x 1 root root 772120 2008-05-29 17:29 /mnt/rescue/bin/bash

As they're the same size, I assume they're the same version - but they could
have been compiled with different USE flags. I'll look into that. [Later:
on remerging bash in the main system the flags look perfectly innocent, and
I can't imagine having set them differently on the rescue system; but I
will look next time I boot the rescue system*.]

> ... rebuild the package that include 'chroot' so that right permissions
> are set for the program and its libs.

The permissions are right already, but I'll do that anyway.

> I hope this helps in any way and excuse me for that bad English.

I've no difficulty following you :-)

Thanks also to the others who've helped. Wolf's idea wouldn't help me
because I want a separate system that will boot even if the main one won't.
It's on a different physical disk as well.

* Is there a way to find out what USE flags a package has been compiled with
when it's not the current system but a rescue system mounted temporarily in
it? Anyone?

--
Rgds
Peter
--
gentoo-user@lists.gentoo.org mailing list
 
Old 06-01-2008, 07:10 PM
Neil Bothwick
 
Default chroot problem

On Sun, 1 Jun 2008 18:51:02 +0100, Peter Humphrey wrote:

> * Is there a way to find out what USE flags a package has been compiled
> with when it's not the current system but a rescue system mounted
> temporarily in it? Anyone?

Look in var/db/pkg/cate-gory/pkgname-version/USE


--
Neil Bothwick

Does the name Pavlov ring a bell?
 
Old 06-02-2008, 09:52 AM
Peter Humphrey
 
Default chroot problem

On Sunday 01 June 2008 20:10:22 Neil Bothwick wrote:
> On Sun, 1 Jun 2008 18:51:02 +0100, Peter Humphrey wrote:
> > * Is there a way to find out what USE flags a package has been compiled
> > with when it's not the current system but a rescue system mounted
> > temporarily in it? Anyone?
>
> Look in var/db/pkg/cate-gory/pkgname-version/USE

Thanks Neil.

--
Rgds
Peter
--
gentoo-user@lists.gentoo.org mailing list
 
Old 07-09-2010, 09:29 PM
Zachary Uram
 
Default chroot problem

i upgraded from vista to win7 on my pc which dual boots debian squeeze
so it wiped away the grub2 boot loader from MBR
so i burn copy of Debian Live (also tried Ubuntu 9.04) boot disc:

in order to get it working i tried to mount the root partition :
# mount /dev/sda5 /tmp/mnt

that is fine, but when i run chroot i get weird error:
# chroot /tmp/mnt
# chroot: cannot execute command '/bin/bash' : Exec format error

Both the Debian and Ubuntu Live CDs are x64 architecture, my Debian
squeeze kernel is x64 architecture too
so I reallly don't understand this problem!

I even tried running non-interactive chroot such as:
# chroot /tmp/mnt update-grub

Any idea how I can solve this and run update-grub on my root partition
to restore GRUB?

Thanks,
Zach

<>< http://www.fidei.org ><>


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: AANLkTimum2fsbGy4XdSaNYNPrSRGL-dfm01xLVv1vN36@mail.gmail.com">http://lists.debian.org/AANLkTimum2fsbGy4XdSaNYNPrSRGL-dfm01xLVv1vN36@mail.gmail.com
 
Old 07-09-2010, 11:40 PM
Bob Proulx
 
Default chroot problem

Zachary Uram wrote:
> in order to get it working i tried to mount the root partition :
> # mount /dev/sda5 /tmp/mnt
>
> that is fine, but when i run chroot i get weird error:
> # chroot /tmp/mnt
> # chroot: cannot execute command '/bin/bash' : Exec format error

Is it possible that your live cd mounts /tmp with the noexec flag?
Try mounting it at a different location such as /mnt.

Is it possible that you have several partitions and /usr/lib or /lib
is on one of them? In which case you will need to mount those
partitions too. Check your mounted /mnt/etc/fstab to see what you
normally mount and mount those up too.

I know you are already looking for this but verify that your running
kernel (with uname -a) matches your executable (with file /bin/bash).

If you boot a cdrom that uses grub as the bootloader then you can stop
the process there and redirect grub to the disk installation. This is
more complicated but I think you get the idea. Unfortunately most use
syslinux but there are some that use grub but I don't have a pointer
to one off the top of my head.

Bob
 
Old 07-10-2010, 03:54 AM
Anand Sivaram
 
Default chroot problem

On Sat, Jul 10, 2010 at 05:10, Bob Proulx <bob@proulx.com> wrote:

Zachary Uram wrote:

> in order to get it working i tried to mount the root partition :

> # mount /dev/sda5 /tmp/mnt

>

> that is fine, but when i run chroot i get weird error:

> # chroot /tmp/mnt

> # chroot: cannot execute command '/bin/bash' : Exec format error



Is it possible that your live cd mounts /tmp with the noexec flag?

Try mounting it at a different location such as /mnt.



Is it possible that you have several partitions and /usr/lib or /lib

is on one of them? *In which case you will need to mount those

partitions too. *Check your mounted /mnt/etc/fstab to see what you

normally mount and mount those up too.



I know you are already looking for this but verify that your running

kernel (with uname -a) matches your executable (with file /bin/bash).



If you boot a cdrom that uses grub as the bootloader then you can stop

the process there and redirect grub to the disk installation. *This is

more complicated but I think you get the idea. *Unfortunately most use

syslinux but there are some that use grub but I don't have a pointer

to one off the top of my head.



Bob


-----BEGIN PGP SIGNATURE-----

Version: GnuPG v1.4.9 (GNU/Linux)



iEYEARECAAYFAkw3s1QACgkQ0pRcO8E2ULZ9kACfZpL/pjAucK3edUjmVhybpqaT

lpkAn09MBHAz8lv5Fk3mCbkBl7Qm8Zg0

=tDZO

-----END PGP SIGNATURE-----



Since you are trying to write the grub mbr, also mount the following before doing chroot
assuming that you mounted your root partition at,
mount -o bind /proc /mnt/proc
mount -o bind /dev/ /mnt/dev


Go through the fstab of your root partition to see any other essential mount points like /var, /usr are there, then mount them also before doing chroot.
 

Thread Tools




All times are GMT. The time now is 04:41 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org