Jump to content

Why can't I perform chroot to mandriva from ubuntu


Recommended Posts

Hello

 

I want to perform chroot to mandriva from ubuntu to check the wine version for this topic:

https://mandrivausers.org/index.php?showtopic=36804

 

But I get permission denied while I'm in root:

$ sudo su
root@nadav-desktop:/# chroot /media/hda
hda1/ hda5/ hda7/
root@nadav-desktop:/# chroot /media/hda5
chroot: cannot run command `/bin/bash': Permission denied
root@nadav-desktop:/# ls /media/hda5/bin/bas
basename  bash	  bash3

 

What is the problem?

 

How It's possibility to block the root?

Link to comment
Share on other sites

You might have to use the sudo command to run chroot. Ubuntu is different in the way it operates. I only installed it the other day, and trying to get used to the way it works.

 

Seems odd that it's not letting you though after the su.

Link to comment
Share on other sites

Check the /etc/sudoers file and see if it has anything in there about the chroot command. You can edit this file with visudo, and remove the offending line, or allow access to this command where applicable.

 

That should do it for you.

Link to comment
Share on other sites

 
$ sudo cat /etc/sudoers
Password:
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
# Host alias specification

# User alias specification

# Cmnd alias specification

# Defaults

Defaults		!lecture,tty_tickets,!fqdn

# User privilege specification
root	ALL=(ALL) ALL
root	ALL=(ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

 

Nothing special.

Link to comment
Share on other sites

Hmm, that's rather odd. I did a google and found this:

 

http://ubuntuforums.org/showthread.php?t=24575

 

and this one too which might be better:

 

http://www.ubuntuforums.org/showthread.php?t=157412

 

maybe you need to install a package to get it to work. The problem is with Ubuntu and it's weird methods. Have you asked the question on the Ubuntu forums?

 

Alternatively, try a google. The other thing I'm used to when doing chroot is this:

 

chroot /dev/sda1 /bin/bash

 

which you've not specified, but it also hints that for some reason it cannot do a /bin/bash from your error message.

Link to comment
Share on other sites

I've run into this with some livecds. One way you can get around it is to unmount the drive you want to chroot to and then remount it like so:

 

# sudo umount /media/hda5

# sudo mount -t <filesystem> /dev/hda5 /media/hda5

# sudo chroot /media/hda5

 

where "filesystem" correponds to the filesystem on hda5, eg reiserfs, ext3, etc. In fact, I pretty much always unmount and remount per the above when I want to chroot and it seems to solve a lot of problems.

Link to comment
Share on other sites

you don't need to sudo into chroot. but you do have to have an active root account, which ubuntu does not have, and I believe this may be the problem. You might need to activate the root account on Ubuntu by doing "sudo passwd" and giving it a password. I believe there are a few other things you might need to change, too, but I do not remember...

Link to comment
Share on other sites

Hello

 

I want to perform chroot to mandriva from ubuntu to check the wine version for this topic:

https://mandrivausers.org/index.php?showtopic=36804

 

But I get permission denied while I'm in root:

$ sudo su
root@nadav-desktop:/# chroot /media/hda
hda1/ hda5/ hda7/
root@nadav-desktop:/# chroot /media/hda5
chroot: cannot run command `/bin/bash': Permission denied
root@nadav-desktop:/# ls /media/hda5/bin/bas
basename  bash	  bash3

 

What is the problem?

 

How It's possibility to block the root?

 

Try this:

$ sudo ln -sf bash /bin/sh
$ sudo chroot FOO
$ sudo ln -sf dash /bin/sh

Link to comment
Share on other sites

  • 4 months later...
Guest Philippe Rathe

It is probably because of your entry in /etc/fstab that you cannot chroot on that mount point. It should looks like it :

 

/dev/hda3 /gentoo ext3 noatime 0 0

 

Look for the tags. It should not coutain the words : user and maybe those too : suid, noatime

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...