{"id":46,"date":"2025-04-27T12:48:55","date_gmt":"2025-04-27T12:48:55","guid":{"rendered":"https:\/\/8p8c.org\/?page_id=46"},"modified":"2025-04-27T14:33:27","modified_gmt":"2025-04-27T14:33:27","slug":"breaking-free-ditching-containers-for-a-functional-chroot-based-rocm-environment","status":"publish","type":"page","link":"https:\/\/8p8c.org\/?page_id=46","title":{"rendered":"Breaking Free: Ditching Containers for a Functional Chroot-Based ROCm Environment"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>Introduction<\/strong><\/h2>\n\n\n\n<p>For too long, containerization has been presented as the <strong>only<\/strong> way to isolate workloads, but our experiment proves otherwise. Instead of relying on <strong>Podman\/Docker<\/strong>, we\u2019ve successfully deployed <strong>ROCm<\/strong> inside a <strong>Debian 12 chroot<\/strong>, achieving full functionality without unnecessary complexity. This document outlines <strong>why containers were unnecessary<\/strong>, <strong>how we built a streamlined environment<\/strong>, and <strong>provides full scripts for reproducibility<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\ud83d\ude80 Why Chroot Over Containers?<\/strong><\/h2>\n\n\n\n<p>Containers are often bloated with:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Unnecessary abstraction<\/strong>\u2014web interfaces, complex security policies, artificial restrictions.<\/li>\n\n\n\n<li><strong>Corporate lock-in<\/strong>\u2014forcing users into ecosystems where usability is monetized.<\/li>\n\n\n\n<li><strong>Opaque behavior<\/strong>\u2014too many layers between the user and actual system hardware.<\/li>\n<\/ul>\n\n\n\n<p>Chroot, however, offers: \u2714 <strong>Direct control<\/strong>\u2014no sandbox limitations. \u2714 <strong>Lightweight isolation<\/strong>\u2014no unnecessary layers. \u2714 <strong>Minimal dependencies<\/strong>\u2014no tangled runtime management.<\/p>\n\n\n\n<p>Instead of wrestling with Podman, we <strong>went back to basics<\/strong>\u2014and it worked.<\/p>\n\n\n\n<p><strong>Pre-reqs:<\/strong><\/p>\n\n\n\n<p>Here\u2019s a list of <strong>critical prerequisites<\/strong> for setting up and managing chroot environments:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\ud83d\ude80 Essential Chroot Management Packages<\/strong><\/h3>\n\n\n\n<p>Install these first on a fresh Debian 12 server, net install is recommended:<\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update &amp;&amp; sudo apt install -y \\\ndebootstrap \\\nschroot \\\nwget \\\ncurl \\\nsudo \\\nnano \\\nvim \\\nbuild-essential \\\ntar \\\ngzip \\\nlsb-release\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\ud83d\udd27 System Utilities (Recommended)<\/strong><\/h3>\n\n\n\n<p>These improve usability and troubleshooting inside the chroot:<\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install -y \\\nhtop \\\ntmux \\\nopenssh-server \\\ngnupg \\\nca-certificates \\\nsoftware-properties-common\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\ud83d\udcbe GPU-Specific Dependencies (For ROCm)<\/strong><\/h3>\n\n\n\n<p>If you plan to install <strong>ROCm<\/strong>, you\u2019ll also need:<\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install -y \\\npython3-setuptools \\\npython3-wheel \\\npciutils \\\nlibnuma-dev\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\ud83d\udca1 Verifying Prerequisites<\/strong><\/h3>\n\n\n\n<p>Once installed, confirm everything is in place:<\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dpkg -l | grep -E \"debootstrap|schroot|build-essential|sudo\"\n<\/code><\/pre>\n\n\n\n<p>This will ensure <strong>your net-installed Debian 12 system is ready for chroot management<\/strong>.<\/p>\n\n\n\n<p>The installation instructions for Debian 12 for ROCm can be found below if the weblink doesn&#8217;t break (it will but anyway)<\/p>\n\n\n\n<p>:<a href=\"https:\/\/rocm.docs.amd.com\/projects\/install-on-linux\/en\/latest\/install\/quick-start.html\">https:\/\/rocm.docs.amd.com\/projects\/install-on-linux\/en\/latest\/install\/quick-start.html<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>ROCm Install Script for Debian 12 <\/strong><\/h3>\n\n\n\n<p><strong>(<\/strong><code>install_rocm_base.sh<\/code><strong>)<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n# ROCm Installation Script for Base Debian 12 (Not Chroot)\n# Author: 8p8c\n# Description: Sets up ROCm on Debian 12 and prepares GPU drivers.\n\nset -e  # Exit on error\n\necho \"Updating package lists...\"\nsudo apt update\n\necho \"Installing required dependencies...\"\nsudo apt install -y wget python3-setuptools python3-wheel\n\necho \"Adding AMD ROCm repository...\"\necho 'deb &#91;trusted=yes] http:\/\/repo.radeon.com\/rocm\/apt\/latest bookworm main' | sudo tee \/etc\/apt\/sources.list.d\/rocm.list\nsudo apt update\n\necho \"Installing AMD GPU package...\"\nwget https:\/\/repo.radeon.com\/amdgpu-install\/6.4\/ubuntu\/jammy\/amdgpu-install_6.4.60400-1_all.deb\nsudo apt install .\/amdgpu-install_6.4.60400-1_all.deb\n\necho \"Updating package lists after installation...\"\nsudo apt update\n\necho \"Adding current user to render and video groups...\"\nsudo usermod -a -G render,video $LOGNAME\n\necho \"Installing ROCm...\"\nsudo apt install -y rocm\n\necho \"Verifying ROCm installation...\"\nrocminfo\nclinfo\n\necho \"ROCm setup is complete!\"\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How to Use This Script<\/strong><\/h3>\n\n\n\n<p>1\ufe0f\u20e3 <strong>Save the script<\/strong> as <code>install_rocm_base.sh<\/code>. 2\ufe0f\u20e3 <strong>Make it executable:<\/strong><\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod +x install_rocm_base.sh\n<\/code><\/pre>\n\n\n\n<p>3\ufe0f\u20e3 <strong>Run on your base Debian 12 OS (not inside a chroot):<\/strong><\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo .\/install_rocm_base.sh\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Why This Is Important<\/strong><\/h3>\n\n\n\n<p>\u2705 <strong>Ensures the base OS has proper GPU support<\/strong> before installing ROCm inside a chroot. \u2705 <strong>Avoids dependency issues inside the chroot<\/strong> by handling drivers at the system level. \u2705 <strong>Prepares the host system for chroot-based ROCm installations<\/strong>.<\/p>\n\n\n\n<p>Once this is installed on <strong>Debian 12 (outside the chroot)<\/strong>, you can safely install <strong>ROCm inside the chroot<\/strong> without conflicts.<\/p>\n\n\n\n<p>Lest set up the chroot next:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Setting Up ROCm in a Debian 12 Chroot<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Creating the Base Chroot Environment<\/strong><\/h3>\n\n\n\n<p>First, we establish a clean Debian environment:<\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir \/mnt\/myenv\ndebootstrap --arch=amd64 bookworm \/mnt\/myenv http:\/\/deb.debian.org\/debian\n<\/code><\/pre>\n\n\n\n<p>Then, we enter it:<\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chroot \/mnt\/myenv \/bin\/bash\n<\/code><\/pre>\n\n\n\n<p>Below is a <strong>script<\/strong> that automates the <strong>ROCm installation<\/strong> inside your Debian 12 chroot. It ensures everything is set up cleanly, including <strong>user group permissions, dependencies, and ROCm itself<\/strong>. n.b. the script is accessible on the host OS  via the chroot once suitably named and saved &#8211; with run permissions active &#8211; this will need to be checked if working via transferring from a daily driver to your server &#8211; if working that way. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>ROCm Install Script (<\/strong><code>install_rocm.sh<\/code><strong>)<\/strong><\/h3>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n# ROCm Installation Script for Debian 12 Chroot\n# Author: 8p8c\n# Description: Automates ROCm setup inside a chroot environment.\n\nset -e  # Exit immediately if a command fails\n\necho \"Updating package lists...\"\nsudo apt update\n\necho \"Installing required dependencies...\"\nsudo apt install -y wget python3-setuptools python3-wheel\n\necho \"Downloading AMD GPU installer...\"\nwget https:\/\/repo.radeon.com\/amdgpu-install\/6.4\/ubuntu\/jammy\/amdgpu-install_6.4.60400-1_all.deb\n\necho \"Installing AMD GPU package...\"\nsudo apt install .\/amdgpu-install_6.4.60400-1_all.deb\n\necho \"Updating package lists after installation...\"\nsudo apt update\n\necho \"Adding current user to render and video groups...\"\nsudo usermod -a -G render,video $LOGNAME\n\necho \"Installing ROCm...\"\nsudo apt install -y rocm\n\necho \"Installation complete! Verifying setup...\"\nrocminfo\nclinfo\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How to Use This Script<\/strong><\/h3>\n\n\n\n<p>1\ufe0f\u20e3 <strong>Save the script<\/strong> as <code>install_rocm.sh<\/code>. 2\ufe0f\u20e3 <strong>Make it executable:<\/strong><\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod +x install_rocm.sh\n<\/code><\/pre>\n\n\n\n<p>3\ufe0f\u20e3 <strong>Run inside your chroot:<\/strong><\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo schroot -c debian12 -- .\/install_rocm.sh\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>What This Script Does<\/strong><\/h3>\n\n\n\n<p>\u2705 <strong>Handles dependency installation automatically.<\/strong> \u2705 <strong>Ensures correct user permissions for ROCm compatibility.<\/strong> \u2705 <strong>Performs verification after installation.<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\ud83d\udd39 Snapshot and Clone<\/strong><\/h3>\n\n\n\n<p>Once your chroot environment is set up, you can <strong>snapshot it<\/strong> for reuse:<\/p>\n\n\n\n<ul start=\"1\" class=\"wp-block-list\">\n<li><strong>Compress the template<\/strong>:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>tar -czvf myenv-template.tar.gz \/mnt\/myenv<\/code><\/pre>\n\n\n\n<ul start=\"1\" class=\"wp-block-list\">\n<li><strong>Clone it<\/strong> whenever you need a new instance: <\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>\ntar -xzvf myenv-template.tar.gz -C \/mnt\/newenv chroot \/mnt\/newenv \/bin\/bash<\/code><\/pre>\n\n\n\n<p>Be aware that error trapping is a distant dream at the moment &#8211; this is the raw stuff and you are on your own &#8211; no guarantees &#8211; no warranty &#8211; and your mileage may vary. This is also obviously not meant for spaceflight or medical or&#8230; yeah, it&#8217;s working, bells and whistles? that&#8217;s for you to add. Don&#8217;t rely on this for production or critical systems &#8211; I know,  I know, but I have to put this bit in, and as you got this far&#8230;<\/p>\n\n\n\n<p>Here&#8217;s some more test commands before you go conquer the universe in the nicest possible way:<\/p>\n\n\n\n<p>The primary <strong>System Management Interface (SMI) command<\/strong> for ROCm is <code>rocm-smi<\/code>, but AMD has also introduced <code>amd-smi<\/code> as an alternative tool for managing GPUs.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Key ROCm SMI Commands<\/strong><\/h3>\n\n\n\n<p>1\ufe0f\u20e3 <strong>Check GPU status &amp; utilization<\/strong><\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rocm-smi\n<\/code><\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>amd-smi list\n<\/code><\/pre>\n\n\n\n<p>2\ufe0f\u20e3 <strong>Show detailed GPU hardware info<\/strong><\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rocm-smi --showhw\n<\/code><\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>amd-smi static\n<\/code><\/pre>\n\n\n\n<p>3\ufe0f\u20e3 <strong>Monitor GPU temperature &amp; power usage<\/strong><\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rocm-smi --showtemp --showpower\n<\/code><\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>amd-smi metric\n<\/code><\/pre>\n\n\n\n<p>4\ufe0f\u20e3 <strong>List installed GPUs<\/strong><\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rocm-smi --listgpu\n<\/code><\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>amd-smi list --gpu\n<\/code><\/pre>\n\n\n\n<p>5\ufe0f\u20e3 <strong>Reset GPU settings<\/strong><\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rocm-smi --gpureset\n<\/code><\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<p>bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>amd-smi reset\n<\/code><\/pre>\n\n\n\n<p>Both <code>rocm-smi<\/code> and <code>amd-smi<\/code> provide similar functionality, but <code>amd-smi<\/code> is newer and offers additional features for monitoring and managing AMD GPUs<\/p>\n\n\n\n<p>Ok &#8211; that&#8217;s all folks &#8211; no containers and nothing up the sleeves &#8211; there are some refinements and niggles &#8211; this is the first draft.<\/p>\n\n\n\n<p>Remember &#8211; With great power comes great responsibility &#8211; that&#8217;s probably Cicero by  the way &#8211; not Peter Parker<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction For too long, containerization has been presented as the only way to isolate workloads, but our experiment proves otherwise. Instead of relying on Podman\/Docker, we\u2019ve successfully deployed ROCm inside a Debian 12 chroot, achieving full functionality without unnecessary complexity. This document outlines why containers were unnecessary, how we built a streamlined environment, and provides [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-46","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/8p8c.org\/index.php?rest_route=\/wp\/v2\/pages\/46","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/8p8c.org\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/8p8c.org\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/8p8c.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/8p8c.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=46"}],"version-history":[{"count":11,"href":"https:\/\/8p8c.org\/index.php?rest_route=\/wp\/v2\/pages\/46\/revisions"}],"predecessor-version":[{"id":64,"href":"https:\/\/8p8c.org\/index.php?rest_route=\/wp\/v2\/pages\/46\/revisions\/64"}],"wp:attachment":[{"href":"https:\/\/8p8c.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}