You are not logged in.

#1 2015-05-02 19:16:48

kox
Member
Registered: 2015-05-01
Posts: 146

[SOLVED] command not found when chrooted into Debian

I have used Debian previously. I have a debian chroot on a separate partition which sole purpose is apache2 server. I use apache2 in chroot, so everytime I reinstall my main system, all my projects are left there in this system untouched. The chroot was created with Debian's debootstrap. Now when I moved from Debian to Arch, I can't use this chroot. When I chroot into it I can't execute any command there, all I get is command not found, even on things such as ls, rm, mv.

Does it mean that I have to create a chroot for server again, using Arch linux or is there a way to get this Debian working?

Last edited by kox (2015-05-02 20:13:22)

Offline

#2 2015-05-02 19:20:13

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] command not found when chrooted into Debian

Post the commands you are using to enter the chroot.

Also: https://wiki.archlinux.org/index.php/Systemd-nspawn

Offline

#3 2015-05-02 19:26:46

kox
Member
Registered: 2015-05-01
Posts: 146

Re: [SOLVED] command not found when chrooted into Debian

I tried 'chroot dirname' and 'arch-chroot dirname /bin/bash' The result was the same .

Offline

#4 2015-05-02 19:40:15

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,868
Website

Re: [SOLVED] command not found when chrooted into Debian

Note that Arch's default PATH only has "/usr/local/sbin", "/usr/local/bin", and "/usr/bin", whereas debian uses these directories as well as "/bin", "/sbin" and "/usr/sbin" (though the sbin dirs are only added to the root's PATH).

When you chroot, you retain Arch's PATH. You should run

export PATH="$PATH:/usr/sbin:/sbin:/bin"

in the chroot, or source /etc/profile.

Last edited by WorMzy (2015-05-02 19:40:59)


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2015-05-02 19:40:38

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] command not found when chrooted into Debian

I don't think the `arch-chroot` script will work for a Debian system but I could be wrong.

Have you tried mounting /proc, /sys & /dev first and sourcing the shell profiles afterwards?
https://wiki.archlinux.org/index.php/Ch … ing_chroot
This shouldn't make any difference as the chroot fstab should already have entries for these but you never know...

Maybe you should copy /etc/hosts & /proc/mounts from your new Arch system into your Debian chroot.
https://wiki.debian.org/Debootstrap

@WorMzy -- the shell built-ins are not working so I don't think it's a $PATH issue.

Last edited by Head_on_a_Stick (2015-05-02 19:41:44)

Offline

#6 2015-05-02 19:58:40

kox
Member
Registered: 2015-05-01
Posts: 146

Re: [SOLVED] command not found when chrooted into Debian

@WorMzy
It works out of the box. smile Thank you.

Offline

#7 2015-05-02 20:03:56

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,868
Website

Re: [SOLVED] command not found when chrooted into Debian

Head_on_a_Stick wrote:

@WorMzy -- the shell built-ins are not working so I don't think it's a $PATH issue.

ls, mv and rm aren't bash built-ins. They might be in other shells though.

@kox: Great. Remember to mark your thread as [SOLVED]. smile


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#8 2015-05-02 20:07:28

kox
Member
Registered: 2015-05-01
Posts: 146

Re: [SOLVED] command not found when chrooted into Debian

Is there a mark as solved button or do you mean to edit thread title and put [SOLVED] in it? Because I don't see such a button anywhere smile .

Last edited by kox (2015-05-02 20:07:43)

Offline

#9 2015-05-02 20:08:58

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,868
Website

Re: [SOLVED] command not found when chrooted into Debian

Nah, there's no button, you have to manually edit the title by editing the first post.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#10 2015-05-02 20:09:53

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,793

Re: [SOLVED] command not found when chrooted into Debian

Edit your first post -- It has the option to edit the thread title.  Prepend [SOLVED] to the title


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB