1️⃣ Enter Chroot & Run Script Manually
If you need interactive control, first enter the chroot:
bash
sudo schroot -c debian12_rocm
Then, navigate to where the script is stored:
bash
cd /path/to/script
chmod +x setup_rocm_chroot.sh
./setup_rocm_chroot.sh
This allows you to monitor the output directly.
2️⃣ Run Script Without Entering Chroot
For automation, run the script without manually entering the chroot:
bash
sudo schroot -c debian12_rocm -- /path/to/setup_rocm_chroot.sh
This executes the script directly inside the chroot without requiring interactive login.
3️⃣ Copy the Script Inside Chroot for Execution
If the script is outside the chroot but needs to run inside, copy it into the chroot first:
bash
sudo cp setup_rocm_chroot.sh /var/chroots/debian12_rocm/root/
sudo schroot -c debian12_rocm -- /root/setup_rocm_chroot.sh
This ensures all necessary dependencies inside the chroot are present.
🔥 Additional Best Practices
✅ Always make the script executable:
bash
chmod +x setup_rocm_chroot.sh
✅ Use absolute paths inside the chroot to avoid file location issues. ✅ Redirect logs to a file for debugging:
bash
sudo schroot -c debian12_rocm -- /root/setup_rocm_chroot.sh > rocm_setup.log 2>&1
✅ Ensure permissions inside the chroot allow execution (chmod +x
).