# Is possible to chroot FreeBSD from Linux?



## Meroque (Sep 1, 2011)

I'd like to modify FreeBSD so I downloaded FreeBSD iso and I tried to chroot it from Fedora, but it says ''bin/bash no such file or directory''

So is possible to chroot it on Fedora?


----------



## Beeblebrox (Sep 1, 2011)

DK about to what extent chroot would work cross-distro, but the error you posted has to do with the fact that bash is not included in the FreeBSD base distribution and must be installed extra.  Use /bin/sh.


----------



## Alt (Sep 1, 2011)

I think you can chroot if you change your feodora's user shell to a shell that exists in freebsd's /bin/
But dunno about libs will they work or not

btw, why you need it?


----------



## Meroque (Sep 1, 2011)

```
[m@host-xx-xxx-xxx-x ~]$ /bin/sh
sh-4.2$ sudo chroot /home/m/Desktop/freebsd
[sudo] password for m: 
chroot: failed to run command `/bin/bash': No such file or directory
```


```
chsh -s /bin/sh
Changing shell for m.
Password: 
Shell changed.

[m@host-xx-xxx-xxx-x ~]$ su
Password: 
[root@host-xx-xxx-xxx-x m]# chroot /home/m/Desktop/freebsd
chroot: failed to run command `/bin/bash': No such file or directory
```



> btw, why you need it?


I want to have installed KDE and others after install FreeBSD out of the box.


----------



## kpedersen (Sep 1, 2011)

Meroque said:
			
		

> I want to have installed KDE and others after install FreeBSD out of the box.



Installing the KDE FreeBSD package via `pkg_add` is going to be much easier than this.

Also... I doubt this is possible. Surely the running kernel wouldn't know how to run the binaries.


----------



## adamk (Sep 1, 2011)

kpedersen is correct.  The linux kernel can not run FreeBSD binaries.


----------



## Oxyd (Sep 1, 2011)

You probably want [cmd=]sudo chroot /home/m/Desktop/freebsd /bin/sh[/cmd] or simillar.

And I don't think it'll work anyway, as FreeBSD and Linux are not binary compatible. But who knows -- maybe Linux has a FreeBSD emulation layer?


----------



## davidgurvich (Sep 2, 2011)

The emulation layer is called "Why use emulation when you can use virtualization?".  The only method I know of using FreeBSD on a Linux machine is through virtualization.  Pick any of qemu, kvm, xen, vmware, or virtualbox.  Not sure which of these work other than qemu.


----------



## anomie (Sep 2, 2011)

Right. You want emulation or a hypervisor (if your CPU supports it).


----------



## ManaHime (Sep 4, 2011)

Meroque said:
			
		

> I want to have installed KDE and others after install FreeBSD out of the box.



If you want KDE out of the box with FreeBSD I'de recommand going with PC-BSD which is based on FreeBSD


----------

