Welcome to the Linux Foundation Forum!

Lab 3.1 chroot not working as expected

I am running Lab 3.1 in a Oracle VM VirtualBox. When I run
sudo chroot /mnt/chroot-ubuntu-xenial/ /bin/bash
I get
chroot: failed to run command '/bin/bash': No such file or directory

How can I resolve this?

Answers

  • chrispokorni
    chrispokorni Posts: 2,372

    Hi @holfstephacy,

    What happens if you try running /bin/sh instead?

    Regards,
    -Chris

  • bdkdavid
    bdkdavid Posts: 32

    you need to copy all the /bin/bash dependencies into your chroot directory before you chroot into that directory otherwise you cannot run anything in the directory

  • chrispokorni
    chrispokorni Posts: 2,372

    Hi @bdkdavid,

    Provided that the debootstrap command was successfully executed, there would be no need to copy anything into the directory. That is what the debootstrap is doing for you - it populates the filesystem, files and tools of the new isolated/chrooted environment.

    Regards,
    -Chris

  • kneto
    kneto Posts: 1

    sudo chroot /mnt/chroot-ubuntu-xenial/http://archive.ubuntu.com/ubuntu/ /bin/bash

    this is the solution

  • luisefa98
    luisefa98 Posts: 1
    edited February 2023

    Try to run the following command:

    sudo chroot /mnt/chroot-ubuntu-xenial/http:/archive.ubuntu.com/ubuntu/ /bin/bash

Categories

Upcoming Training