*New 11.3 series Release:
2019-10-19: XigmaNAS 11.3.0.4.7014 - released

*New 12.0 series Release:
2019-10-05: XigmaNAS 12.0.0.4.6928 - released!

*New 11.2 series Release:
2019-09-23: XigmaNAS 11.2.0.4.6881 - released!

We really need "Your" help on XigmaNAS https://translations.launchpad.net/xigmanas translations. Please help today!

Producing and hosting XigmaNAS costs money. Please consider donating for our project so that we can continue to offer you the best.
We need your support! eg: PAYPAL

[HOWTO] install Finch BSD in chroot

Jails with XigmaNAS
Forum rules
Set-Up GuideFAQsForum Rules
dreamcat4
experienced User
experienced User
Posts: 111
Joined: 21 Mar 2014 21:59
Status: Offline

Re: NEW PROJECT - FreeBSD in a chroot

#31

Post by dreamcat4 » 25 Apr 2014 19:52

MikeMac wrote:...
Thanks Mike. I took a look at it. Indeed all the installation was fine. No problems found in the logs about NAS4Free+FreeBSD 10. But did see a couple of minor bugs. Nothing important. Just "informational" things. Harmless / not any effect. All fixed now. Use the command "finch update" to update your installation and get the fixes. :D

andynw1
NewUser
NewUser
Posts: 11
Joined: 30 May 2014 19:13
Location: Madrid (España)
Status: Offline

Re: NEW PROJECT - FreeBSD in a chroot

#32

Post by andynw1 » 31 May 2014 08:06

Hi,

I have been trying since last night to install Finch and after rebooting my system according to the instructions nothing happened...as I am fairly new to all this I spent hours looking for the probably obvious reason why and finally I found it. What I had done wrong was to copy and paste the bootup/shutdown scripts exactly as they are instead of changing /data to the correct path! Now installing correctly it seems. Maybe for us with less experience a line after each command listed in the manual stating if we need to change the path to match our system...?

The other thing, to see the progress of the install, I type the command (and yes this time changing the path!) posted in the manual but I get an error, :Command not found. I am sure it is something I am doing wrong but I cannot for the life of me see it..

Last login: Sat May 31 07:18:10 on ttys000
MacBookPro:~ Andrew$ ssh -l root 192.168.1.199
root@192.168.1.199's password:
Last login: Sat May 31 07:18:23 2014 from 192.168.1.59
Welcome to NAS4Free!
nas4free: ~ # "tail -99999 -f /mnt/media/finch/var/log/finch/install.log"
tail -99999 -f /mnt/media/finch/var/log/finch/install.log: Command not found.

Thanks!!
Dell Poweredge T20
CPU: Intel Xeon E3-1225 v3 @ 3.20GHz
Intel C226 series chipset
RAM: 8GB DDR3 ECC
Storage: 2x1TB + 2x500gb laptop drives UFS
O/S: NAS4Free 10.2.0.2 1906 -amd64 embedded, on 16Gb USB flash drive

dreamcat4
experienced User
experienced User
Posts: 111
Joined: 21 Mar 2014 21:59
Status: Offline

Re: NEW PROJECT - FreeBSD in a chroot

#33

Post by dreamcat4 » 31 May 2014 13:10

andynw1 wrote:Hi,
I have been trying since last night to install Finch and after rebooting my system according to the instructions nothing happened...as I am fairly new to all this I spent hours looking for the probably obvious reason why and finally I found it. What I had done wrong was to copy and paste the bootup/shutdown scripts exactly as they are instead of changing /data to the correct path! Now installing correctly it seems. Maybe for us with less experience a line after each command listed in the manual stating if we need to change the path to match our system...?
Hi Andy,
Yeah sorry about that. I'll take that as a suggestion for improvement for the website documentation... some clearer explanation can be bolded in specific that place.
andynw1 wrote:The other thing, to see the progress of the install, I type the command (and yes this time changing the path!) posted in the manual but I get an error, :Command not found. I am sure it is something I am doing wrong but I cannot for the life of me see it..

Last login: Sat May 31 07:18:10 on ttys000
MacBookPro:~ Andrew$ ssh -l root 192.168.1.199
root@192.168.1.199's password:
Last login: Sat May 31 07:18:23 2014 from 192.168.1.59
Welcome to NAS4Free!
nas4free: ~ # "tail -99999 -f /mnt/media/finch/var/log/finch/install.log"
tail -99999 -f /mnt/media/finch/var/log/finch/install.log: Command not found.

Thanks!!
Again, apologies. That's just the quotation marks. If you remove them from around the outside then it aught to work. We can easily improve the documentation there also.

I am putting both those points near the top of my todo list.

dreamcat4
experienced User
experienced User
Posts: 111
Joined: 21 Mar 2014 21:59
Status: Offline

Re: NEW PROJECT - FreeBSD in a chroot

#34

Post by dreamcat4 » 31 May 2014 14:43

andynw1 wrote:Maybe ... a line after each command listed in the manual stating if we need to change the path to match our system...?

tail -99999 -f /mnt/media/finch/var/log/finch/install.log: Command not found.
Done. Done.

http://dreamcat4.github.io/finch/install/#toc_9

andynw1
NewUser
NewUser
Posts: 11
Joined: 30 May 2014 19:13
Location: Madrid (España)
Status: Offline

Re: NEW PROJECT - FreeBSD in a chroot

#35

Post by andynw1 » 31 May 2014 17:23

Thanks for the quick changes. The documentation was excellent before but now it should be fairly impossible to fail. Later I am going to try my first jail!
Dell Poweredge T20
CPU: Intel Xeon E3-1225 v3 @ 3.20GHz
Intel C226 series chipset
RAM: 8GB DDR3 ECC
Storage: 2x1TB + 2x500gb laptop drives UFS
O/S: NAS4Free 10.2.0.2 1906 -amd64 embedded, on 16Gb USB flash drive

laster13
PowerUser
PowerUser
Posts: 996
Joined: 01 Jun 2013 19:15
Location: France-Marseille
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#36

Post by laster13 » 08 Aug 2014 10:28

very good work, i install finch without any problem and it works perfectly, i test with plex with finch and it s work also

thanks

User avatar
ernie
Forum Moderator
Forum Moderator
Posts: 1416
Joined: 26 Aug 2012 19:09
Location: France - Val d'Oise
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#37

Post by ernie » 15 Aug 2014 22:31

Bonjour

Comment monter un répertoire existant sous finch ?

ici des explications:
http://dreamcat4.github.io/finch/mounting-filesystems/

Mais je ne sais pas encore comment le faire pour nas4free. Si quelqu'un comprend, je suis preneur.
NAS 1&2:
System: GA-6LXGH(BIOS: R01 04/30/2014) / 16 Go ECC
XigmaNAS 12.0.0.4.6766 embedded
NAS1: Xeon E3 1241@3.5GHz, 4HDD@2To/raidz2 (WD red), 3HDD@300Go/sas/raidz1 (Hitachi), 1SSD cache, Zlog on sas mirror
NAS2: G3220@3GHz, 3HDD@2To/raidz1 (Seagate), 1SSD cache, 1HDD@300Go/UFS
UPS: APC Back-UPS RS 900G
Case : Fractal Design XL R2

Extensions & services:
NAS1: OBI (Plex, extendedGUI, BTSync, zrep, rclone), nfs, UPS,
NAS2: OBI (extendedGUI, zrep (backup mode))

laster13
PowerUser
PowerUser
Posts: 996
Joined: 01 Jun 2013 19:15
Location: France-Marseille
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#38

Post by laster13 » 15 Aug 2014 22:49

Je te prépare ça demain

laster13
PowerUser
PowerUser
Posts: 996
Joined: 01 Jun 2013 19:15
Location: France-Marseille
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#39

Post by laster13 » 16 Aug 2014 10:33

hi dreamcat4 and all

i read your howto

http://dreamcat4.github.io/finch/mounting-filesystems/

but i don't mange to create a mount point on finch, if you can explain me with a exemple with ufs files system

/mnt/pool1/video -----> data in outside finch

/mnt/pool1/finch/usr/jails/owncloud/usr/local/www/owncloud/data/laster13/video ------> data inside finch

laster13
PowerUser
PowerUser
Posts: 996
Joined: 01 Jun 2013 19:15
Location: France-Marseille
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#40

Post by laster13 » 22 Aug 2014 21:16

Hi

Can i build ffmpeg in the jail ( root ) or i must build outside the jail (Finch)?

How van i do?

Thanks

BraM
Starter
Starter
Posts: 27
Joined: 09 Sep 2012 13:59
Location: Sydney, Australia
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#41

Post by BraM » 02 Sep 2014 14:05

I'm experiencing issues when attempting to enter the finch chroot environment, as root

Code: Select all

Using username "root".
Last login: Tue Sep  2 21:35:20 2014 from 192.168.1.101
Welcome to NAS4Free!
backup-server ~/ root~$ sudo finch chroot
sudo: unable to stat /usr/local/etc/sudoers: No error: 0
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
I've recently installed finch on my Nas4Free server. I believe that the install was a success (no errors observed). Actually dreamcat4 has checked the contents of my .../var/log/finch folder and all looks well.

However, when I go to install Plex I can only get as far as the initial 'sudo finch chroot' before I get sudo related errors (above). I'm logging in as root via a putty session. I have not carried out the 'configure accounts' as per the Post Install instructions as I'm happy with the default root account as configured during install.

My system event log:

Code: Select all

root : unable to stat /usr/local/etc/sudoers : Permission denied ; TTY=pts/0 ; PWD=/root ;
root : unable to stat /usr/local/etc/sudoers : Permission denied ; TTY=pts/0 ; PWD=/root ;
Is it user account related?

BraM
Starter
Starter
Posts: 27
Joined: 09 Sep 2012 13:59
Location: Sydney, Australia
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#42

Post by BraM » 03 Sep 2014 22:00

Fixed...

Rolled back, re-installed, working. That's an over simplification however, I rolled back and re-installed a couple of times with the exact same results. I decided to roll back to an earlier snapshot with success. Weird :? Most probably an error of my own making in the end :oops:

Thanks dreamcat for your off-line help and advice. Much appreciated.

Now I have to get my head around mounting folders for plex.

BraM
Starter
Starter
Posts: 27
Joined: 09 Sep 2012 13:59
Location: Sydney, Australia
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#43

Post by BraM » 04 Sep 2014 12:42

I spoke too soon.

It did finally work yesterday and I was able to finally install plex. Today I wanted to re-enter the finch chroot environment to look at mounting filesystems and complete the plex install, but the issue had returned. I'm unable to 'sudo finch chroot'.

These attempts have been on my embedded version backup server for testing and as a learning curve. I shall make an attempt on my full version primary server. If that is successful I'll try and compare the two and see where it is going wrong. Failing all that I'll return to 'The Brig' and perhaps come back to finch later on.

User avatar
raulfg3
Site Admin
Site Admin
Posts: 4923
Joined: 22 Jun 2012 22:13
Location: Madrid (ESPAÑA)
Contact:
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#44

Post by raulfg3 » 04 Sep 2014 13:38

I'm not sure and perhaps dreamcat4 can help a bit more, but if you log into finch as root

Code: Select all

Using username "root".
Last login: Tue Sep  2 21:35:20 2014 from 192.168.1.101
Welcome to NAS4Free!
backup-server ~/ root~$ sudo finch chroot
sudo: unable to stat /usr/local/etc/sudoers: No error: 0
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
you do not need to chroot finch, and do not need sudo (you are root is't it? )

try to execute

Code: Select all

finch chroot
or

Code: Select all

finch
alone and post what happens.
12.0.0.4 (revision 6766)+OBI on SUPERMICRO X8SIL-F 8GB of ECC RAM, 12x3TB disk in 3 vdev in RaidZ1 = 32TB Raw size only 22TB usable

Wiki
Last changes

BraM
Starter
Starter
Posts: 27
Joined: 09 Sep 2012 13:59
Location: Sydney, Australia
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#45

Post by BraM » 05 Sep 2014 13:37

raulfg3 wrote:try to execute

Code: Select all

finch chroot
or

Code: Select all

finch
alone and post what happens.
Same issue. However now and again I have success if I 'finch chroot /path/to/finch'. But not always. Strange.

Meanwhile I've installed without problem on my primary server which is a full Nas4Free install.
raulfg3 wrote:I'm not sure and perhaps dreamcat4 can help a bit more
dreamcat has been providing help via e-mail. The conclusion is that the sudoers file is being corrupted by the system somehow. Hence sudo related errors. Once I get plex properly configured I don't need to worry too much about chroot into finch. Unless I want to re-configure or install something else that is.

I can say one thing... it's been an excellent learning experience.

Ganimed
Starter
Starter
Posts: 15
Joined: 24 Jun 2012 01:57
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#46

Post by Ganimed » 09 Sep 2014 14:20

Subject:
Bug during installation on a 32-bit system
Description:

Hi all,

I've reactivated my old barebone server ARTIGO A2000 from VIA. This small NAS-Server works with an 32-bit processor. My plan is to install a jail system on this server.
I've decided to use Finch as jailing system. Before I install finch on the server, I tried firstly to install it on N4F (32-bit) in a virtual machine environment, i.e. VirtualBox.
After rebooting, during the installation process of finch on the 32-bit system, the installation process stops, rollback and write some error messages to /<path to finch>/var/log/finch/install.log.
I.e.

Code: Select all

requesting http://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/lib32.txz
 
  404 - Not Found
 
  404 - Not Found
 
fetch: http://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/lib32.txz: Not Found
+ return 1 
The postinit script looks for lib32.txz which is only required on a 64-bit system. Since in the above url there is no lib32.txz, the installation process aborts.
Here is my complete log of the installation process on my virtual machine:

Code: Select all

+ install_system
+ set +x

******************************************************************************
Installation started on Tue Sep  9 09:58:42 UTC 2014
******************************************************************************

+ date
+ date -j -f '%a %b %d %T %Z %Y' 'Tue Sep  9 09:58:42 UTC 2014' +%s
+ start_time_secs=1410256722
+ echo start_time_secs
+ [ -e /etc/prd.revision ]
+ cat /etc/prd.revision
+ echo 'Nas4Free Revision: 972'
Nas4Free Revision: 972
+ uname -iv
+ grep -i nas4free
+ [ 'FreeBSD 9.2-RELEASE-p4 #0 r264986M: Sun Apr 27 13:37:21 CEST 2014     root@dev.nas4free.org:/usr/obj/nas4free/usr/src/sys/NAS4FREE-i386  NAS4FREE-x86' ]
+ mount
+ grep -e 'on / '
+ grep read-only
+ [ '' ]
+ link_libc
+ [ ! -e /usr/lib/libc.so ]
+ try_send_email install_started
+ uname -iv
+ grep -i freenas
+ [ '' ]
+ uname -iv
+ grep -i nas4free
+ [ 'FreeBSD 9.2-RELEASE-p4 #0 r264986M: Sun Apr 27 13:37:21 CEST 2014     root@dev.nas4free.org:/usr/obj/nas4free/usr/src/sys/NAS4FREE-i386  NAS4FREE-x86' ]
+ _n4f_config=/conf/config.xml
+ command -v xml
+ [ /usr/local/bin/xml ]
+ [ -e /conf/config.xml ]
+ _msmtp_config=/var/etc/msmtp.conf
+ /usr/local/bin/xml sel -t -v //smartd/email/to /conf/config.xml
+ _smartd_email_to=''
+ /usr/local/bin/xml sel -t -v //email/from /conf/config.xml
+ _email_from=''
+ [ '' ]
+ uname -iv
+ grep -i pfsense
+ [ '' ]
+ [ '' ]
+ download_unpack_freebsd
+ ls '/mnt/jail/finch/var/distfiles/finch/*.txz'
+ [ '' ]
+ mkdir -p /mnt/jail/finch/var/distfiles/finch/
+ cd /mnt/jail/finch/var/distfiles/finch
+ uname -m
+ _arch=i386
+ uname -r
+ cut -d- -f1-2
+ _maj_min_rel=9.2-RELEASE
+ uname -r
+ cut -d- -f2
+ _rel=RELEASE
+ touch /mnt/jail/finch/var/distfiles/finch/FreeBSD-i386-9.2-RELEASE
+ [ RELEASE = RELEASE ]
+ _ftp_dir=pub/FreeBSD/releases/i386/i386/9.2-RELEASE
+ [ RELEASE = STABLE ]
+ [ RELEASE = CURRENT ]
+ fetch_distfiles http
+ local protocol=http
+ cd /mnt/jail/finch/var/distfiles/finch
+ fetch -T 30 http://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/MANIFEST
MANIFEST                                               661  B    0  Bps
+ fetch -T 30 -v http://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/base.txz
looking up ftp.freebsd.org
connecting to ftp.freebsd.org:80
requesting http://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/base.txz
remote size / mtime: 63593544 / 1380285913
base.txz                                                60 MB    0  Bps
+ fetch -T 30 -v http://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/doc.txz
looking up ftp.freebsd.org
connecting to ftp.freebsd.org:80
requesting http://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/doc.txz
remote size / mtime: 1443176 / 1380285909
doc.txz                                               1409 kB    0  Bps
+ fetch -T 30 -v http://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/games.txz
looking up ftp.freebsd.org
connecting to ftp.freebsd.org:80
requesting http://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/games.txz
remote size / mtime: 881888 / 1380285909
games.txz                                              861 kB    0  Bps
+ fetch -T 30 -v http://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/kernel.txz
looking up ftp.freebsd.org
connecting to ftp.freebsd.org:80
requesting http://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/kernel.txz
remote size / mtime: 71071248 / 1380285902
kernel.txz                                              67 MB    0  Bps
+ fetch -T 30 -v http://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/lib32.txz
looking up ftp.freebsd.org
connecting to ftp.freebsd.org:80
requesting http://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/lib32.txz




 
  404 - Not Found
 
 
  404 - Not Found
 

fetch: http://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/lib32.txz: Not Found
+ return 1
+ retry_active_ftp
+ echo 'cleaning failed distfiles.'
cleaning failed distfiles.
+ rm -Rf /mnt/jail/finch/var/distfiles/finch
+ mkdir -p /mnt/jail/finch/var/distfiles/finch
+ echo 'http fetch failure. Trying ftp in active mode.'
http fetch failure. Trying ftp in active mode.
+ export FTP_PASSIVE_MODE=NO
+ fetch_distfiles ftp
+ local protocol=ftp
+ cd /mnt/jail/finch/var/distfiles/finch
+ fetch -T 30 ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/MANIFEST
MANIFEST                                               661  B    0  Bps
+ fetch -T 30 -v ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/base.txz
looking up ftp.freebsd.org
connecting to ftp.freebsd.org:21
binding data socket
initiating transfer
remote size / mtime: 63593544 / 1380285913
base.txz                                                60 MB    0  Bps
+ fetch -T 30 -v ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/doc.txz
looking up ftp.freebsd.org
connecting to ftp.freebsd.org:21
binding data socket
initiating transfer
remote size / mtime: 1443176 / 1380285909
doc.txz                                               1409 kB    0  Bps
+ fetch -T 30 -v ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/games.txz
looking up ftp.freebsd.org
connecting to ftp.freebsd.org:21
binding data socket
initiating transfer
remote size / mtime: 881888 / 1380285909
games.txz                                              861 kB    0  Bps
+ fetch -T 30 -v ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/kernel.txz
looking up ftp.freebsd.org
connecting to ftp.freebsd.org:21
binding data socket
initiating transfer
remote size / mtime: 71071248 / 1380285902
kernel.txz                                              67 MB    0  Bps
+ fetch -T 30 -v ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/lib32.txz
looking up ftp.freebsd.org
connecting to ftp.freebsd.org:21
binding data socket
initiating transfer
fetch: ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.2-RELEASE/lib32.txz: File unavailable (e.g., file not found, no access)
+ return 1
+ unset FTP_PASSIVE_MODE
+ return 1
+ unset FTP_PASSIVE_MODE
+ check_distfiles
+ [ -e /mnt/jail/finch/var/distfiles/finch/MANIFEST ]
+ command -v sha256
+ [ /sbin/sha256 ]
+ cd /mnt/jail/finch/var/distfiles/finch
+ [ -e /mnt/jail/finch/var/distfiles/finch/base.txz ]
+ grep base.txz /mnt/jail/finch/var/distfiles/finch/MANIFEST
+ cut -f 2
+ sha256_in_manifest=87c9038ff9ba03b26d3b64611d9b8db4ef8a3915a6a27424759fdf9f15413a02
+ sha256 -q /mnt/jail/finch/var/distfiles/finch/base.txz
+ sha256_downloaded=87c9038ff9ba03b26d3b64611d9b8db4ef8a3915a6a27424759fdf9f15413a02
+ [ 87c9038ff9ba03b26d3b64611d9b8db4ef8a3915a6a27424759fdf9f15413a02 != 87c9038ff9ba03b26d3b64611d9b8db4ef8a3915a6a27424759fdf9f15413a02 ]
+ [ -e /mnt/jail/finch/var/distfiles/finch/doc.txz ]
+ grep doc.txz /mnt/jail/finch/var/distfiles/finch/MANIFEST
+ cut -f 2
+ sha256_in_manifest=d4e33fdf30abed3f4a80be4b65049f6aab073e432a7b0191b9353ece9ba5c2af
+ sha256 -q /mnt/jail/finch/var/distfiles/finch/doc.txz
+ sha256_downloaded=d4e33fdf30abed3f4a80be4b65049f6aab073e432a7b0191b9353ece9ba5c2af
+ [ d4e33fdf30abed3f4a80be4b65049f6aab073e432a7b0191b9353ece9ba5c2af != d4e33fdf30abed3f4a80be4b65049f6aab073e432a7b0191b9353ece9ba5c2af ]
+ [ -e /mnt/jail/finch/var/distfiles/finch/games.txz ]
+ grep games.txz /mnt/jail/finch/var/distfiles/finch/MANIFEST
+ cut -f 2
+ sha256_in_manifest=47822f50b5d08358137b9574034f3468a08c08fd96459c1d383cf2bf3d95ae27
+ sha256 -q /mnt/jail/finch/var/distfiles/finch/games.txz
+ sha256_downloaded=47822f50b5d08358137b9574034f3468a08c08fd96459c1d383cf2bf3d95ae27
+ [ 47822f50b5d08358137b9574034f3468a08c08fd96459c1d383cf2bf3d95ae27 != 47822f50b5d08358137b9574034f3468a08c08fd96459c1d383cf2bf3d95ae27 ]
+ [ -e /mnt/jail/finch/var/distfiles/finch/kernel.txz ]
+ grep kernel.txz /mnt/jail/finch/var/distfiles/finch/MANIFEST
+ cut -f 2
+ sha256_in_manifest=2cf173b2d106e658ab29a1c8958c87daea74092f3ed407271ca8f3cff2f22430
+ sha256 -q /mnt/jail/finch/var/distfiles/finch/kernel.txz
+ sha256_downloaded=2cf173b2d106e658ab29a1c8958c87daea74092f3ed407271ca8f3cff2f22430
+ [ 2cf173b2d106e658ab29a1c8958c87daea74092f3ed407271ca8f3cff2f22430 != 2cf173b2d106e658ab29a1c8958c87daea74092f3ed407271ca8f3cff2f22430 ]
+ [ -e /mnt/jail/finch/var/distfiles/finch/lib32.txz ]
+ [ -e /mnt/jail/finch/var/distfiles/finch/src.txz ]
+ unpack_distfiles
+ cd /mnt/jail/finch/var/distfiles/finch
+ tar xf /mnt/jail/finch/var/distfiles/finch/base.txz -C /mnt/jail/finch
+ tar xf /mnt/jail/finch/var/distfiles/finch/doc.txz -C /mnt/jail/finch
+ tar xf /mnt/jail/finch/var/distfiles/finch/games.txz -C /mnt/jail/finch
+ tar xf /mnt/jail/finch/var/distfiles/finch/kernel.txz -C /mnt/jail/finch
+ tar xf /mnt/jail/finch/var/distfiles/finch/lib32.txz -C /mnt/jail/finch
tar: Error opening archive: Failed to open '/mnt/jail/finch/var/distfiles/finch/lib32.txz'
+ return 1
+ install_failed 'couldn'\''t unpack distfiles from ftp.freebsd.org'
+ touch /mnt/jail/finch/var/db/finch/install_failed
+ cat /mnt/jail/finch/var/db/finch/installing...
+ start_time_secs=start_time_secs
+ [ 'couldn'\''t unpack distfiles from ftp.freebsd.org' ]
+ fail_reason='couldn'\''t unpack distfiles from ftp.freebsd.org'
+ echo 'finch: installation has failed.'
finch: installation has failed.
+ echo ' fail reason: couldn'\''t unpack distfiles from ftp.freebsd.org'
 fail reason: couldn't unpack distfiles from ftp.freebsd.org
+ date
+ _fail_date='Tue Sep  9 10:06:35 UTC 2014'
+ echo 'finch: installation failed on: Tue Sep  9 10:06:35 UTC 2014'
finch: installation failed on: Tue Sep  9 10:06:35 UTC 2014
+ date
+ date -j -f '%a %b %d %T %Z %Y' 'Tue Sep  9 10:06:35 UTC 2014' +%s
+ end_time_secs=1410257195
+ expr 1410257195 - start_time_secs
expr: not a decimal number: 'start_time_secs'
+ elapsed_time_secs=''
+ _s2hms ''
+ local S=
+ expr / 3600
expr: syntax error
+ local h=
+ expr % 3600 / 60
expr: syntax error
+ local m=
+ expr % 60
expr: syntax error
+ local s=
+ [ '' -gt 0 ]
[: : bad number
+ [ '' -gt 0 ]
[: : bad number
+ printf '%d seconds'
+ elapsed_h_m_s='0 seconds'
+ hr
+ echo '******************************************************************************'
******************************************************************************
+ cat_body_install_failed 'couldn'\''t unpack distfiles from ftp.freebsd.org'
+ [ '' = email ]
+ cat

Sorry, your Finch FreeBSD Installation has failed and is incomplete.

  * Fail reason: "couldn't unpack distfiles from ftp.freebsd.org"

  * Installation halted at first point of failure. Did not go all the way.

  * Failure took place 0 seconds into the installation.

  * Failure detected on: Tue Sep  9 10:06:35 UTC 2014

  * Attachment: "finch-install.log.gz".


******************************************************************************
What can I do?

* To investigate the cause of error, look in the  file "install.log"

  Full system path of this logfile:

      "/mnt/jail/finch/var/log/finch/install.log"

+ [ ! '' = email ]
+ cat
* To keep a safe record of the failure, backup the Finch logfiles:

    "cp -Ri /mnt/jail/finch/var/log/finch" "/mnt/jail/finch-logs-failed-1"

+ cat
* To completely delete this failed installation from your hard disk:

   "finch-bootstrap uninstall -d /mnt/jail/finch"

We apologise for any inconvenience caused.

  >>> http://dreamcat4.github.io/finch/support <<<


+ uname -iv
+ grep -i freenas
+ [ ! '' ]
+ uname -iv
+ grep -i nas4free
+ [ ! 'FreeBSD 9.2-RELEASE-p4 #0 r264986M: Sun Apr 27 13:37:21 CEST 2014     root@dev.nas4free.org:/usr/obj/nas4free/usr/src/sys/NAS4FREE-i386  NAS4FREE-x86' ]
+ hr
+ echo '******************************************************************************'
******************************************************************************
+ try_send_email install_failed 'couldn'\''t unpack distfiles from ftp.freebsd.org'
+ uname -iv
+ grep -i freenas
+ [ '' ]
+ uname -iv
+ grep -i nas4free
+ [ 'FreeBSD 9.2-RELEASE-p4 #0 r264986M: Sun Apr 27 13:37:21 CEST 2014     root@dev.nas4free.org:/usr/obj/nas4free/usr/src/sys/NAS4FREE-i386  NAS4FREE-x86' ]
+ _n4f_config=/conf/config.xml
+ command -v xml
+ [ /usr/local/bin/xml ]
+ [ -e /conf/config.xml ]
+ _msmtp_config=/var/etc/msmtp.conf
+ /usr/local/bin/xml sel -t -v //smartd/email/to /conf/config.xml
+ _smartd_email_to=''
+ /usr/local/bin/xml sel -t -v //email/from /conf/config.xml
+ _email_from=''
+ [ '' ]
+ uname -iv
+ grep -i pfsense
+ [ '' ]
+ [ '' ]
+ rm /mnt/jail/finch/var/db/finch/installing...
+ exit 1

Best regards,
Ganimed.

NAS4Free 9.2.0.1 (revision 972) x86-full
VBOX VBOXXSDT Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz 2048MiB RAM

OHCI (generic) USB controller Intel PIIX4 UDMA33 controller

dreamcat4
experienced User
experienced User
Posts: 111
Joined: 21 Mar 2014 21:59
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#47

Post by dreamcat4 » 09 Sep 2014 20:40

Ganimed wrote: The postinit script looks for lib32.txz which is only required on a 64-bit system. Since in the above url there is no lib32.txz, the installation process aborts.
Thanks for reporting this! I have made a fix now and you are welcome to try again. Hopefully there is no other problem in the Finch source code in regards to 32-bit... At least as far as FreeBSD itself continues to provide support for it.

Ganimed
Starter
Starter
Posts: 15
Joined: 24 Jun 2012 01:57
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#48

Post by Ganimed » 09 Sep 2014 22:37

Thank you!! :)
I tried out again to install Finch on the 32-bit VM.
Now Finch works on 32-bit! :D

fumantsu
experienced User
experienced User
Posts: 76
Joined: 04 Mar 2014 12:15
Location: Athens->Brno
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#49

Post by fumantsu » 12 Sep 2014 13:02

I have a question that very useful, at least for me in the future.

I want to install inside a jail pyload and later rtorrent. Pre-compile package for pyload doesn't exist. Can I update the /usr/ports so that I can first: a) git-clone a pyload port b) compile an dependencies that may need?



PS. I'm asking because I tried portsnap fetch extract inside an jail and I got /usr/port is read-only.
Fractal Node 304, Avoton C2550 Quad-Core Processor, 8GB RAM ECC, 4 x 4TB WD RED in mirrors , NAS4Free 9.2.0.1 build 972

dreamcat4
experienced User
experienced User
Posts: 111
Joined: 21 Mar 2014 21:59
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#50

Post by dreamcat4 » 12 Sep 2014 15:35

fumantsu wrote: I want to install inside a jail pyload and later rtorrent. Pre-compile package for pyload doesn't exist. Can I update the /usr/ports so that I can first: a) git-clone a pyload port b) compile an dependencies that may need?
Yeah good question.

The way that sharedfs directories are mounted it should be kept read-only from the jails. To prevent messing up this shared resource. What you can do very easily however is just git-clone such ports repos / directecories you need into any other location inside of your jail. I use /root/ports/<dir> or just /root/<portname>. Of course you will need to "pkg install git" or "pkg install subversion" first in your new test / development jail.

Then when you compile the port with "make fetch extract build" etc. it still sources the same bsd.ports.mk file from the read-only directory /usr/ports. And your ports are getting built in /var/ports/root/<portname> etc. Any missing ports dependancies for the port you are modifying will be automatically found and compiled from the official, read-only /usr/ports tree.

So if you also have some special (non-standard) port dependancies I recommmend you "make install" them first from whichever other special git / svn repo you have also downloaded... Else if they are just standard ports dependancies (and with the standard default options) then it is faster to just get them with "pkg install" instead. Since that is always faster than letting them be compiled as ports from scratch.

Of course, if you really wish to use "/usr/ports" you may sync it with svn or use github as the vcs to update /usr/ports tree from non-official source. But probably NOT use the chroot's main ports tree at "$(finch realpath)/usr/ports", but instead the qjail's seperate copy which is at "/usr/jails/sharedfs/usr/ports" (it is only mounted read-only inside of the jails themselves). Then modifying such ports tree in the ^> chroot folder in one window, but compiling and installing ports inside of a safe test jail.

Personally I don't do that though because it takes AGES to svn update the whole /usr/ports tree via subversion. It's always faster and safer to just to git clone or grab via svn only the ports you need and are specifically interested in modifying or updating.

When all finished and no longer any use, presumably once changes are commited to vcs or accepted into official /usr/ports tree. Then you can stop the dev jail, delete it. Everything will be all gone. No mess.

fumantsu
experienced User
experienced User
Posts: 76
Joined: 04 Mar 2014 12:15
Location: Athens->Brno
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#51

Post by fumantsu » 13 Sep 2014 11:17

Thank you for your small guide. But I saw something that may be an issue. I pkg install git and I had some warning about perl
[jail1] [1/17] Installing perl5-5.16.3_11: 100%
rm: /usr/bin/perl: Read-only file system
use.perl: Backing up /usr/bin/perl as /usr/bin/perl.freebsd
mv: rename /usr/bin/perl to /usr/bin/perl.freebsd: Read-only file system
use.perl: /usr/bin/perl is still there, which should not happen
ln: /usr/bin/perl5: Read-only file system
Fractal Node 304, Avoton C2550 Quad-Core Processor, 8GB RAM ECC, 4 x 4TB WD RED in mirrors , NAS4Free 9.2.0.1 build 972

dreamcat4
experienced User
experienced User
Posts: 111
Joined: 21 Mar 2014 21:59
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#52

Post by dreamcat4 » 13 Sep 2014 13:00

fumantsu wrote: use.perl: Backing up /usr/bin/perl as /usr/bin/perl.freebsd
mv: rename /usr/bin/perl to /usr/bin/perl.freebsd: Read-only file system
Normally "pkg install" will install all of that software program's files only into %%PREFIX%% directory = /usr/local. For example /usr/local/bin etc.

However it seems that for perl, an older verison of it already comes with base system. Qjail's sharedfs is readonly for /usr/bin folder because that is base. When the pkg version of perl tries to replace the base version it can't write to the shared folder.

So although it did install perl from pkgng, the binary is still obscured on the search path by the higher priority /usr/bin/perl from base system.

I don't know why git needs to be installing perl from pkgng if it's already in base. And I'm not sure of the implications of what that may be. I've a vague recollection that perl is not needed for most of the git commands, only certain specific ones. So if all you are doing is a 'git clone' and some basic stuff it may just work anyway any you may escape being affected by that.

To be safe, a good solution is to replace inside your jail the symlink itself with a copy of the contents folder or base's /usr/bin. E.g.

Code: Select all

cp -Rf /sharedfs/usr/bin /usr/bin-new # make a copy of the read-only folder
rm /usr/bin # remove the symlink to sharedfs
mv /usr/bin-new /usr/bin # replace with writable regular folder
pkg remove perl5; pkg install perl5 # try again
I tried those commands in a jail and am guessing it probably worked. Output:

Code: Select all

webcamd ~/ root~# cp -Rf /sharedfs/usr/bin /usr/bin-new # make a copy of the read-only folder
webcamd ~/ root~# rm /usr/bin # remove the symlink to sharedfs
webcamd ~/ root~# mv /usr/bin-new /usr/bin # replace with writable regular folder
webcamd ~/ root~# pkg remove perl5; pkg install perl5 # try again
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
	perl5-5.16.3_11

The operation will free 47 MB.

Proceed with deinstalling packages? [y/N]: y
[webcamd] [1/1] Deleting perl5-5.16.3_11: 100%
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking integrity... done (0 conflicting)
The following 1 packages will be affected (of 0 checked):

New packages to be INSTALLED:
	perl5: 5.16.3_11

The process will require 47 MB more space.

Proceed with this action? [y/N]: y
[webcamd] [1/1] Installing perl5-5.16.3_11: 100%
webcamd ~/ root~# echo $?
0
You can use this same technique to replace any of the individual sharedfs folders, they are each a symlink. It is useful to remember, for whenever other circumstances may require this.

Once you have finished with the jail, and delete it with 'qjail delete $jailname'. Then all the files you had to copy / mess around with shall also be deleted and removed along with the jail itself. Since those folders and files all remain inside subdirectories of that jail's root folder.

fumantsu
experienced User
experienced User
Posts: 76
Joined: 04 Mar 2014 12:15
Location: Athens->Brno
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#53

Post by fumantsu » 13 Sep 2014 16:37

That was very helpful and it works indeed. One more question regarding mounting filesystems. In the guide there are two sections, one for mounting one "folder" in one jail and the second for mounting one "folder" in all jails. What about 2 or more (but not all)?
Fractal Node 304, Avoton C2550 Quad-Core Processor, 8GB RAM ECC, 4 x 4TB WD RED in mirrors , NAS4Free 9.2.0.1 build 972

dreamcat4
experienced User
experienced User
Posts: 111
Joined: 21 Mar 2014 21:59
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#54

Post by dreamcat4 » 13 Sep 2014 17:44

fumantsu wrote:What about 2 or more (but not all)?
I think you just repeat the process of 1 jail. Edit the fstab file of each extra jail(s) you need that folder to appear in /usr/local/etc/qjail.fstab/${jailname}. A component of the fstab line you add must include that specific jail's hardcoded path so it would not be easy to make any kind of variable substitution (as far as I know, fstab files are not sourced like shell scripts, but parsed by a 'C' program so would not understand $variable substitutions).

Another thing to be aware of is that if you rename the jail it may make such custom paths in the fstab file invalid. I have not tested to check if qjail is smart enough to make string replacements in those custom lines automatically.

fumantsu
experienced User
experienced User
Posts: 76
Joined: 04 Mar 2014 12:15
Location: Athens->Brno
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#55

Post by fumantsu » 13 Sep 2014 22:21

Ok, last question for today. About the mount_nullfs, where do you suggest to put the commands in that way that they can really mount the datasets (after zfs has load/mount) on the boot?
Fractal Node 304, Avoton C2550 Quad-Core Processor, 8GB RAM ECC, 4 x 4TB WD RED in mirrors , NAS4Free 9.2.0.1 build 972

dreamcat4
experienced User
experienced User
Posts: 111
Joined: 21 Mar 2014 21:59
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#56

Post by dreamcat4 » 13 Sep 2014 22:46

I'm not sure i understand the question. But if I do then the answer is entirely platform specific. Because finch is made for 3 platforms. And each platform has different ways to do that. For nas4free you should try using the appropriate mechanism that is provided by nas4free.

fumantsu
experienced User
experienced User
Posts: 76
Joined: 04 Mar 2014 12:15
Location: Athens->Brno
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#57

Post by fumantsu » 14 Sep 2014 11:58

Basically my question was that based your suggestion about the way of mounting the filesystems, there has to be a mount_nullfs command to "return" the zfs dataset to the original place, if have to suggest any "proper" way.

PS. startup scripts for jails similar like "jail_{jail}_exec_start"?

PS2. New day, new questions :)
Fractal Node 304, Avoton C2550 Quad-Core Processor, 8GB RAM ECC, 4 x 4TB WD RED in mirrors , NAS4Free 9.2.0.1 build 972

dreamcat4
experienced User
experienced User
Posts: 111
Joined: 21 Mar 2014 21:59
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#58

Post by dreamcat4 » 14 Sep 2014 12:53

fumantsu wrote:Basically my question was that based your suggestion about the way of mounting the filesystems, there has to be a mount_nullfs command to "return" the zfs dataset to the original place, if have to suggest any "proper" way.
Right so I did understand the question and did answer it. You can instead use the fstab file in finch folder. But I am recommending that you use the native nas4free GUI page / screens. Sorry I don't run nas4free to advise you what buttons to click / how to do that. It's general nas4free help and you can find in the nas4free GUI how to add nullfs mounts yourself the tools provided in nas4free webGUI are pretty comprehensive and powerful.

I know on my system (freenas) I don't have that feature so have to use the finch fstab file and it works OK but for the fact that the fstab file isn't run until when finch is starting up. So the AFP service starts before finch and doesn't 'see' the mounted folder after a reboot. Then I have to manually restart AFP for the process after reboot to see the right inode directory.
fumantsu wrote: PS. startup scripts for jails
* inside the jail?
* enter the jail
* type 'man rc'
* setup whatever startup script in /etc/rc.d or /usr/local/etc/rc.d just like with any other freebsd system

* outside the jail?
* in finch chroot
* put pre-jail scripts in rc.d again, just like official FreeBSD. Then use "BEFORE: qjail" keyword instruction to run those script before qjail starts. You can 'man rcorder' for more help about changing the rc script ordering.

fumantsu
experienced User
experienced User
Posts: 76
Joined: 04 Mar 2014 12:15
Location: Athens->Brno
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#59

Post by fumantsu » 14 Sep 2014 13:27

Cool!!!. I think that we have cover any question that anybody may have!!! Excellent support :D
Fractal Node 304, Avoton C2550 Quad-Core Processor, 8GB RAM ECC, 4 x 4TB WD RED in mirrors , NAS4Free 9.2.0.1 build 972

mekonghigh
Starter
Starter
Posts: 39
Joined: 13 Oct 2013 18:03
Status: Offline

Re: [HOWTO] JAILS - FreeBSD in a chroot

#60

Post by mekonghigh » 14 Sep 2014 13:35

Don't know if this is the right way to mount a map, but it works for me.

I have a userlink.sh in /mnt/disk0

Code: Select all

#!/bin/sh
mount_nullfs /mnt/disk0/btsync/user1/files /mnt/disk0/finch/mnt/disk0/finch/mnt/disk0/finch/usr/jails/cloud/usr/local/www/owncloud/data/user1/files
In nas4free webgui System|Advanced|Command scripts
/mnt/disk0/userlink.sh [Postinit]

This way the extension BitTorrent Sync and Owncloud in jail work together.

Post Reply

Return to “Jails”