Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Chroot Fails

  1. #1
    Join Date
    Feb 2009
    Beans
    61

    Chroot Fails

    I have a ubuntu server. I needed to modify the network config so I did but when restarting the network interface it refused to respond. OVH offers a Rescue mode. After botting to rescue mode you have to mount your hard drive, chroot the mountpoint. I did this before on a on-raid box like so:
    Code:
    mkdir /mymount && mount /dev/sda1 /mymount
    chroot /mymount
    mount /dev/sda2 /home
    Now I had a box with RAID mode enabled. I have identified /dev/md3 as the mount point for the RAID since this partition is the size of both hard drives. So I try:
    Code:
    mkdir /mymount && mount /dev/md3 /mymount
    chroot /mymount
    mount /dev/sda9 /home
    But when I run chroot, I get this:
    Code:
    root@rescue:~# chroot /mymount
    chroot: failed to run command `/bin/bash': No such file or directory
    If I run mount I see the partition is properly mounted. I can cd in to /mymount but not chroot. If I cd in to /mymount I see users home dirs so I now I have the right partition.

    How come I can not chroot the active mount point?

  2. #2
    Join Date
    Feb 2005
    Location
    Melbourne, Australia
    Beans
    13,505
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Chroot Fails

    Quote Originally Posted by Xplorer4x4 View Post
    I have a ubuntu server. I needed to modify the network config so I did but when restarting the network interface it refused to respond. OVH offers a Rescue mode.
    ..........
    How come I can not chroot the active mount point?
    You must boot the same architecture. If you have a 64-bit system then you must boot a 64-bit rescue disk to use chroot.
    Regards, David.
    Please use the Forum search and Wiki search for immediate help
    Please mark your thread as Solved when appropriate
    New to technical forums?: How To Ask Questions The Smart Way

  3. #3
    Join Date
    Feb 2009
    Beans
    61

    Re: Chroot Fails

    OVH handles that. I double checked and the rescue environment is 64 bit.
    Code:
    root@rescue:/dev# uname -mrsn
    Linux rescue.ovh.net 3.2.2-xxxx-std-ipv6-64 x86_64
    And the server is running Precise 64bit.
    Last edited by Xplorer4x4; October 12th, 2012 at 09:06 AM.

  4. #4
    Join Date
    Feb 2005
    Location
    Melbourne, Australia
    Beans
    13,505
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Chroot Fails

    Quote Originally Posted by Xplorer4x4 View Post
    OVH handles that. I double checked and the rescue environment is 64 bit.
    Code:
    root@rescue:/dev# uname -mrsn
    Linux rescue.ovh.net 3.2.2-xxxx-std-ipv6-64 x86_64
    And the server is running Precise 64bit.
    Then look in the mountpoint for valid files like /bin/bash.
    Regards, David.
    Please use the Forum search and Wiki search for immediate help
    Please mark your thread as Solved when appropriate
    New to technical forums?: How To Ask Questions The Smart Way

  5. #5
    Join Date
    Feb 2009
    Beans
    61

    Re: Chroot Fails

    Quote Originally Posted by dcstar View Post
    Then look in the mountpoint for valid files like /bin/bash.
    What do you mean? For what it is worth I can see that chroot is available in rescue mode.
    Code:
    root@rescue:/# chroot --version
    chroot (GNU coreutils) 8.5
    Copyright (C) 2010 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    
    Written by Roland McGrath.
    root@rescue:/#

  6. #6
    Join Date
    Jan 2005
    Location
    South Africa
    Beans
    2,098
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Chroot Fails

    For a chroot'ed environment, you need to copy all programs that you possibly want to use. So you need e.g. a /bin directory in /dev/md3 and it should contain bash. Also check with ldd which libraries might be required.
    If you don't make backups of your important data, your data is obviously not important to you.

  7. #7
    Join Date
    Feb 2009
    Beans
    61

    Re: Chroot Fails

    My hard disk contains a fully working Ubuntu Server install other then network configuration file so of course it has bash installed. All I need to do is chroot the disk so I can modify the network configuration file.

  8. #8
    Join Date
    Jan 2005
    Location
    South Africa
    Beans
    2,098
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Chroot Fails

    Quote Originally Posted by Xplorer4x4 View Post
    My hard disk ...
    Which one? /dev/md3? If so, I don't know.
    If you don't make backups of your important data, your data is obviously not important to you.

  9. #9
    Join Date
    Feb 2009
    Beans
    61

    Re: Chroot Fails

    Quote Originally Posted by Wim Sturkenboom View Post
    Which one? /dev/md3? If so, I don't know.
    Considered this is what I am trying to mount to fix the network config file...yes. And you don't know what exactly?

  10. #10
    Join Date
    Feb 2009
    Beans
    61

    Re: Chroot Fails

    Quote Originally Posted by Wim Sturkenboom View Post
    For a chroot'ed environment, you need to copy all programs that you possibly want to use. So you need e.g. a /bin directory in /dev/md3 and it should contain bash. Also check with ldd which libraries might be required.
    Got me thinking, so I checked fdisk and it made me suspect I hate the data storage area rather then the root filesystem, so I switched to /dev/md1 and it worked right away.

    The last mount command failed complaining baout not specifying the filesystem, which even if I did, it refused to mount. Edited network/interfaces and rebooted and had a working machine. Thanks for atleast getting my mind contomplainting this and finding the proper partition.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •