From 3e60ac0b0f45b4b5146acf33210cf8935f12922a Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 24 May 2021 22:28:19 +0200 Subject: [PATCH] Add tips on debugging errors in a chroot --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index f76c213..ba1535f 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,29 @@ Troubleshooting - Actual logs appear in tty 4, you can switch to it by pressing Alt+F4 - You can manually launch commands from another tty (e.g. the 2nd) but the output will appear in tty4... - To actually enter the real system (chroot ?) you'll need to run `in-target` +- see also .. next section + +### Debugging errors in a chroot + +The .deb install can crash for stupid reasons during ISO install because it's in fact ran inside a chroot. + +To easily reproduce and investigate the issue, it's easier to manually create a chroot (for example inside an ynh-dev LXC): + +```bash +apt install cdebootstrap -y +cd /root/ +mkdir mychroot +cdebootstrap --arch=amd64 buster ./mychroot/ http://deb.debian.org/debian/ +mount -t proc none ./mychroot/proc +mount -o bind /dev ./mychroot/dev +chroot ./mychroot/ bash +``` + +- Running `systemctl` should display "Running in chroot, ignoring request." (compared to some error about PID1 if you didnt mount proc and dev) +- Then run the install, for example using the install script `curl https://install.yunohost.org | bash` (you'll need to install curl first) +- The install will crash (otherwise you wouldn't be reading this ? ;)) +- You can `nano /var/lib/dpkg/info/yunohost.postinst` and edit that script ... for example adding `-x` to the shebang (= very first line) to have the debug detail when the script will run. Possibly you may want to also tweak the init regen conf hook call (for example also adding `-x` to the bash call there) +- Re-run the install with `apt install yunohost` ### Errors related to mysql-password debconf