From: Zachary Uram on
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(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/AANLkTimum2fsbGy4XdSaNYNPrSRGL-dfm01xLVv1vN36(a)mail.gmail.com
From: Bob Proulx on
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
From: Anand Sivaram on
On Sat, Jul 10, 2010 at 05:10, Bob Proulx <bob(a)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.