Skip to content

Instantly share code, notes, and snippets.

@chutsu
Last active August 29, 2025 21:32
Show Gist options
  • Select an option

  • Save chutsu/59a51a2a1954f0c6bafb06a3e4056282 to your computer and use it in GitHub Desktop.

Select an option

Save chutsu/59a51a2a1954f0c6bafb06a3e4056282 to your computer and use it in GitHub Desktop.

Revisions

  1. chutsu revised this gist Aug 29, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion bootstrap.bash
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@ fi
    # Setup APT sources
    cat > ${CHROOT_DIR}/etc/apt/sources.list <<EOF
    deb http://archive.ubuntu.com/ubuntu $UBUNTU_VERSION main universe restricted multiverse
    deb http://archive.ubuntu.com/ubuntu $UBUNTU_VERSION-updates main universe restriicted multiverse
    deb http://archive.ubuntu.com/ubuntu $UBUNTU_VERSION-updates main universe restricted multiverse
    deb http://archive.ubuntu.com/ubuntu $UBUNTU_VERSION-security main universe restricted multiverse
    deb http://packages.ros.org/ros/ubuntu $UBUNTU_VERSION main
    EOF
  2. chutsu revised this gist Aug 29, 2025. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions bootstrap.bash
    Original file line number Diff line number Diff line change
    @@ -20,9 +20,7 @@ fi
    # Setup APT sources
    cat > ${CHROOT_DIR}/etc/apt/sources.list <<EOF
    deb http://archive.ubuntu.com/ubuntu $UBUNTU_VERSION main universe restricted multiverse
    deb http://archive.ubuntu.com/ubuntu $UBUNTU_VERSION-updates main universe restri
    i
    cted multiverse
    deb http://archive.ubuntu.com/ubuntu $UBUNTU_VERSION-updates main universe restriicted multiverse
    deb http://archive.ubuntu.com/ubuntu $UBUNTU_VERSION-security main universe restricted multiverse
    deb http://packages.ros.org/ros/ubuntu $UBUNTU_VERSION main
    EOF
  3. chutsu renamed this gist Aug 29, 2025. 1 changed file with 0 additions and 0 deletions.
  4. chutsu revised this gist Aug 29, 2025. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    Chroot Jail - Ubuntu 20.04 + ROS Noetic

    ```
    sudo bash bootstrap.bash # creates a chroot jail at $HOME/bootstrap
    sudo chroot $HOME/bootstrap # Type exit to exit the chroot jail
    ```
  5. chutsu created this gist Aug 29, 2025.
    38 changes: 38 additions & 0 deletions bootstrap.bash
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    #!/bin/bash
    set -e

    # Settings
    USER_HOME=$(eval echo "~$SUDO_USER")
    CHROOT_DIR=${USER_HOME}/bootstrap
    UBUNTU_VERSION="focal"
    ROS_VERSION="noetic"

    # Script dependencies
    apt-get update -q
    apt-get install -q debootstrap wget curl lsb-release

    # Bootstrap Ubuntu base installation
    mkdir -p ${CHROOT_DIR}
    if [ ! -f "${CHROOT_DIR}/bin/bash" ]; then
    debootstrap $UBUNTU_VERSION $CHROOT_DIR http://archive.ubuntu.com/ubuntu
    fi

    # Setup APT sources
    cat > ${CHROOT_DIR}/etc/apt/sources.list <<EOF
    deb http://archive.ubuntu.com/ubuntu $UBUNTU_VERSION main universe restricted multiverse
    deb http://archive.ubuntu.com/ubuntu $UBUNTU_VERSION-updates main universe restri
    i
    cted multiverse
    deb http://archive.ubuntu.com/ubuntu $UBUNTU_VERSION-security main universe restricted multiverse
    deb http://packages.ros.org/ros/ubuntu $UBUNTU_VERSION main
    EOF

    # Install ROS
    cat << 'EOF' | chroot $CHROOT_DIR /bin/bash
    export DEBIAN_FRONTEND=noninteractive
    apt-get install -yqq curl
    curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
    apt-get install -yqq ros-noetic-ros-base
    exit
    EOF
    ~