# debootsrap and problems



## rdindir (Sep 10, 2022)

Hello All,

I wanted to use linux emulation/compatibility in FreeBSD (13.1).

I followed the handbook (https://docs.freebsd.org/en/books/handbook/linuxemu/) and the page about linux jails (https://wiki.freebsd.org/LinuxJails).

I have installed a debian system (version bullseye) with "debootstrap bullseye /compat/debian" (following the linux jails page).

I changed the fstab as described in the linux jails page, and chroot into /compat/debian  (with chroot /compat/debian /bin/bash). Installed some applications and development tools into /compat debian.

I did not pay attention to my / mount point or directory. Now I am seeing a couple of files in that folder/directory (with ls -al /). Here are the results.

*-rw-r--r--   2 root  wheel         1023 May 12 11:25 .cshrc
-rw-r--r--   2 root  wheel          507 May 12 11:25 .profile
drwxrwxr-x   2 root  operator       512 Jul 25 21:32 .snap
-r--------   1 root  wheel     33554432 Jul 25 21:32 .sujournal
-r--r--r--   1 root  wheel         6109 May 12 11:33 COPYRIGHT*
drwxr-xr-x   2 root  wheel         1024 May 12 11:25 bin
drwxr-xr-x  14 root  wheel         1536 Sep 10 11:03 boot
drwxr-xr-x   4 root  wheel          512 Sep 10 09:35 compat
dr-xr-xr-x  19 root  wheel          512 Sep 10 14:04 dev
-rw-------   1 root  wheel         4096 Sep 10 11:04 entropy
drwxr-xr-x  28 root  wheel         2560 Sep  6 06:43 etc
*lrwxr-xr-x   1 root  wheel            8 Jul 25 21:35 home -> usr/home*
drwxr-xr-x   5 root  wheel         1536 May 12 11:28 lib
drwxr-xr-x   3 root  wheel          512 May 12 11:25 libexec
drwxr-xr-x   2 root  wheel          512 May 12 11:15 media
drwxr-xr-x   2 root  wheel          512 Aug  4 18:04 mnt
drwxr-xr-x   2 root  wheel          512 May 12 11:15 net
dr-xr-xr-x   1 root  wheel            0 Sep 10 11:08 proc
drwxr-xr-x   2 root  wheel         2560 May 12 11:27 rescue
drwxr-x---   3 root  wheel          512 Sep 10 09:52 root
drwxr-xr-x   2 root  wheel         3072 May 12 11:31 sbin
*lrwxr-xr-x   1 root  wheel           11 May 12 11:15 sys -> usr/src/sys*
drwxrwxrwt   9 root  wheel         2048 Sep 10 11:05 tmp
drwxr-xr-x  15 root  wheel          512 Jul 25 21:35 usr
drwxr-xr-x  25 root  wheel          512 Sep 10 14:04 var

I do not remember how this directory looked like (the / directory). *I might have messed up somethings*. But I have highlighted the entries above that I am not sure of.

Could you tell me if the *home entry is correct?* It is a link to usr/home. I am not sure if that was as this before. *Is this OK?*

Could you also tell me if the *sys entry is correct*? It is again a link. Again I am not sure about this too. *Is this OK?*

Do you see *anything wrong with this root directory (/)*?

Obviously the files COPYRIGHT, .sujournal, .snap, .profile, .cshrc do not belong here (in the / directory). *Would this be correct?* I am *planning on deleting these files, but am not sure*, but I think they do not belong there.

I chroot from any place, using (*su root -c "chroot /compat/debian /bin/bash"*). *Would this usage be correct*? This does work fine as far as I can tell, because when I list the contents after chroot, I see the contents of the /compat/debian directory, but I am not sure.

Thanks in advance for any help. And I am sorry for a long message like this.

Regards
Riza


----------



## zirias@ (Sep 10, 2022)

This is all standard FreeBSD stuff (and btw, it's the point of chroot that you can't reach anything outside of the new / dir it sets).



rdindir said:


> *-rw-r--r--   2 root  wheel         1023 May 12 11:25 .cshrc
> -rw-r--r--   2 root  wheel          507 May 12 11:25 .profile*


Root config files. They *do* belong here, although I'm not entirely sure why.


rdindir said:


> *drwxrwxr-x   2 root  operator       512 Jul 25 21:32 .snap
> -r--------   1 root  wheel     33554432 Jul 25 21:32 .sujournal*


Those belong to UFS, journaling and snapshots.


rdindir said:


> *-r--r--r--   1 root  wheel         6109 May 12 11:33 COPYRIGHT*


The original FreeBSD copyright notice.


rdindir said:


> *lrwxr-xr-x   1 root  wheel            8 Jul 25 21:35 home -> usr/home*


You can place home directories wherever you like, but both /usr/home and /home are typical places. FreeBSD by default uses the location below /usr and sets a symlink.


rdindir said:


> *lrwxr-xr-x   1 root  wheel           11 May 12 11:15 sys -> usr/src/sys*


Direct symlink to the FreeBSD kernel source.


rdindir said:


> Obviously the files COPYRIGHT, .sujournal, .snap, .profile, .cshrc do not belong here (in the / directory). *Would this be correct?* I am *planning on deleting these files, but am not sure*, but I think they do not belong there.


No. Don't touch these.


rdindir said:


> I chroot from any place, using (*su root -c "chroot /compat/debian /bin/bash"*). *Would this usage be correct*?


That's correct usage of chroot.

You could also set up a jail in that location. Or you could even use it as an overlay for your real filesystem (like, by default, /compat/linux), so you can actually _share_ files with your host. But that's up to you.


----------



## rdindir (Sep 10, 2022)

zirias@ said:


> This is all standard FreeBSD stuff (and btw, it's the point of chroot that you can't reach anything outside of the new / dir it sets).
> 
> 
> Root config files. They *do* belong here, although I'm not entirely sure why.
> ...


Hello zirias,

Thank you very much for the information.


----------



## SirDice (Sep 12, 2022)

zirias@ said:


> Root config files. They *do* belong here, although I'm not entirely sure why.


Root's home directory was traditionally / until it got changed to /root. These files are often hard links to their counterparts in /root.


----------



## zirias@ (Sep 12, 2022)

SirDice said:


> Root's home directory was traditionally / until it got changed to /root.


Hehe, I kind of assumed that ^^ – then I guess in 2022, they _could_ be removed from / without causing any breakage for anyone. But they don't hurt, so probably nobody bothered...


----------

