You are not logged in.

#1 2023-05-13 18:20:34

donaastor
Member
Registered: 2022-03-14
Posts: 73

[SOLVED] Failing to run bash in a chroot environment.

Hello. I have followed all steps from the archwiki to setup my chroot environment: https://wiki.archlinux.org/title/Chroot#Using_chroot. I have also mounted efivars. To avoid copying various config files, I have mounted lib, bin, lib64 and etc using "mount --bind". The directory I am trying to make the new root is a folder from a mounted external hard drive; the drive is mounted on "/run/media/username/disk-name/". (It is because I am trying to run Android Studio there and prevent it from messing with my system.) Also, I have read the warning on the archwiki so I used "-o bind" instead of "--rbind" when binding "/dev". The problem is that chroot can't find "/bin/bash" no matter what I do. Can someone please tell me what's going on here?

Last edited by donaastor (2023-05-13 18:56:26)

Offline

#2 2023-05-13 18:27:33

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,255

Re: [SOLVED] Failing to run bash in a chroot environment.

Mounting the lib and bin dirs makes the chroot pointless, what is it that you actually want to do?

Offline

#3 2023-05-13 18:30:09

donaastor
Member
Registered: 2022-03-14
Posts: 73

Re: [SOLVED] Failing to run bash in a chroot environment.

V1del wrote:

Mounting the lib and bin dirs makes the chroot pointless, what is it that you actually want to do?

Why do you say its pointless? It will be read only for Android Studio becuase these directories are owned by root. I am trying to force Android Studio to install its sheetton of stuff on my external disk instead my internal precious SSD.

Anyway, I am failing to simply follow the wiki, that's why I came here to ask for help.

Offline

#4 2023-05-13 18:56:02

donaastor
Member
Registered: 2022-03-14
Posts: 73

Re: [SOLVED] Failing to run bash in a chroot environment.

It turns out that I have originally just wrongly mounted (bound) the lib64 folder. I should have (symbolically) linked it instead. So, after a reboot I tried that and now it works. All I had to do is mount lib, bin and link lib64. Bash now works. etc also works, that's optional.

Offline

Board footer

Powered by FluxBB