# Pool and Jail in Poudriere



## Sivan! (Apr 25, 2022)

While getting started with Poudriere I edited the poudriere.conf file to say zpool=mypool (dumb. It probably denotes a pool that I am supposed to have set up with my name) following instructions from https://github.com/freebsd/poudriere/wiki/pkg_repos and on the next terminal commands, I find the following errors.



```
poudriere ports -c
/usr/local/etc/poudriere.conf: NO: not found
=>> Error: No such zpool: mypool
poudriere version
poudriere-git-3.3.99.20211130
doas poudriere jail -c -j 91amd64 -v 9.1-RELEASE -a amd64
Password:
/usr/local/etc/poudriere.conf: NO: not found
=>> Error: No such zpool: mypool
$
```
Questions:
How do I create/ set up a pool?
Does the version 9.1 Release amd match freebsd 13 and Poudriere 3.3.99? Is this the right command to create a jail?

Thank you.


----------



## SirDice (Apr 25, 2022)

Sivasubramanian M said:


> How do I create/ set up a pool?


Chapter 20. The Z File System (ZFS)



Sivasubramanian M said:


> Does the version 9.1 Release amd match freebsd 13 and Poudriere 3.3.99?


You can run _lower_ versions jail compared to the host. A jail can only have the same or lower version as the host. A 11.4-RELEASE on 13.0 is fine, a 13.0-RELEASE jail on a 11.4-RELEASE host is not. 

Having said that, FreeBSD 9.1-RELEASE is EoL since December 2014 and is not supported any more.                  

Edit: Sorry for the typos, Ruby wants attention and is now sprawling all over my keyboard.


----------



## Sivan! (Apr 25, 2022)

SirDice said:


> Chapter 20. The Z File System (ZFS)



`egrep 'da[0-9]|cd[0-9]' /var/run/dmesg.boot`

#showed ada0 as the only device apart from usb and harddisk controller

After that I created zfs pool with the name pdpool, pdpool/compressed and pdpdata.

`doas zfs create storage/home`

cannot create 'storage/home': no such pool 'storage'

`doas zpool create storage raidz ada0 ada11 ada21`

cannot open 'ada11': no such device in /dev
must be a full path or shorthand device name

`doas zpool create storage raidz ada0 ada1 ada2`

cannot open 'ada1': no such device in /dev
must be a full path or shorthand device name

`doas zfs create storage/home`

cannot create 'storage/home': no such pool 'storage'

`doas zpool create storage /dev/ada0` #this was meant to be a command to create storage without raid#

invalid vdev specification
use '-f' to override the following errors:
/dev/ada0 is part of active pool 'pdpool'

`doas zpool create pdpool/storage` #wasn't certain that storage needed to be outside the zfs pool

missing vdev specification
usage:
    create [-fnd] [-o property=value] ...
        [-O file-system-property=value] ...
        [-m mountpoint] [-R root] <pool> <vdev> ...

`doas zpool create pdpool/storage /dev/ada0`

cannot create 'pdpool/storage': invalid character '/' in pool name
use 'zfs create' to create a dataset

*# the answer was right there in the terminal reply.  Modified the command as zfs create pdpool/storage and it worked. Sorry for the messages as above #*

After that I did this:

`doas nano /usr/local/etc/poudriere.conf`

Excerpts:

ZPOOL=pdpool
NO ZFS=yes  #this probably does not match. Should this be NO ZFS=no? #
# ZROOTFS=/poudriere
FREEBSD_HOST=ftp.freebsd.org
RESOLV_CONF=/etc/resolv.conf
BASEFS=/usr/local/poudriere
# ${BASEFS}/data   # uncomment this?#
#POUDRIERE_DATA=${BASEFS}/data  #uncomment this?#
USE_PORTLINT=no


`doas poudriere jail -c -j 91amd64 -v 13.0-RELEASE -a amd64`   #

Installed, patched, updated and ready to be used.

Now the questions are: Is it ok to have created storage _without raid_? . Is it ok to have created storage as a subdirectory of pdpool rather than outside the pdpool? Where do I go from here?


----------



## SirDice (Apr 25, 2022)

Is the host actually using ZFS? If you have that you can simply use the default zroot pool. If not you would have to add a disk, create a pool on that disk and use that. 

You can also use Poudriere _without_ ZFS but I don't really recommend that.


----------



## astyle (Apr 25, 2022)

SirDice said:


> Chapter 20. The Z File System (ZFS)
> 
> 
> You can run _lower_ versions jail compared to the host. A jail can only have the same or lower version as the host. A 11.4-RELEASE on 13.0 is fine, a 13.0-RELEASE jail on a 11.4-RELEASE host is not.
> ...




```
z = { 'cat' => 75, 'bowl' => 18, 'milk' => 32 }
z['joe'] = 44
print z['bowl'], " ", z['joe'], " ", z["keyboard"], "\n"
print z.has_key?('cat'), " ", z.has_key?("now"), "\n"
```


----------



## Sivan! (Apr 25, 2022)

SirDice said:


> Is the host actually using ZFS? If you have that you can simply use the default zroot pool. If not you would have to add a disk, create a pool on that disk and use that.
> 
> You can also use Poudriere _without_ ZFS but I don't really recommend that.





```
mount -v
zroot/ROOT/default on / (zfs, local, noatime, nfsv4acls)
devfs on /dev (devfs)
/dev/nvd0p1 on /boot/efi (msdosfs, local, writes: sync 1 async 0, reads: sync 10 async 0)
zroot/var/audit on /var/audit (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/tmp on /tmp (zfs, local, noatime, nosuid, nfsv4acls)
zroot/var/tmp on /var/tmp (zfs, local, noatime, nosuid, nfsv4acls)
zroot on /zroot (zfs, local, noatime, nfsv4acls)
zroot/var/mail on /var/mail (zfs, local, nfsv4acls)
zroot/var/crash on /var/crash (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/usr/home on /usr/home (zfs, local, noatime, nfsv4acls)
zroot/var/log on /var/log (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/usr/src on /usr/src (zfs, local, noatime, nfsv4acls)
zroot/usr/ports on /usr/ports (zfs, local, noatime, nosuid, nfsv4acls)
pdpool on /pdpool (zfs, local, nfsv4acls)
pdpool/compressed on /pdpool/compressed (zfs, local, nfsv4acls)
pdpool/data on /pdpool/data (zfs, local, nfsv4acls)
pdpool/storage on /pdpool/storage (zfs, local, nfsv4acls)
pdpool/poudriere on /usr/local/poudriere (zfs, local, noatime, nfsv4acls)
pdpool/poudriere/jails on /usr/local/poudriere/jails (zfs, local, noatime, nfsv4acls)
pdpool/poudriere/ports on /usr/local/poudriere/ports (zfs, local, noatime, nfsv4acls)
pdpool/poudriere/data on /usr/local/poudriere/data (zfs, local, noatime, nfsv4acls)
pdpool/poudriere/data/.m on /usr/local/poudriere/data/.m (zfs, local, noatime, nfsv4acls)
pdpool/poudriere/data/cache on /usr/local/poudriere/data/cache (zfs, local, noatime, nfsv4acls)
pdpool/poudriere/data/images on /usr/local/poudriere/data/images (zfs, local, noatime, nfsv4acls)
pdpool/poudriere/data/logs on /usr/local/poudriere/data/logs (zfs, local, noatime, nfsv4acls)
pdpool/poudriere/data/packages on /usr/local/poudriere/data/packages (zfs, local, noatime, nfsv4acls)
pdpool/poudriere/data/wrkdirs on /usr/local/poudriere/data/wrkdirs (zfs, local, noatime, nfsv4acls)
pdpool/poudriere/jails/91amd64 on /usr/local/poudriere/jails/91amd64 (zfs, local, noatime, nfsv4acls)
```


----------



## Sivan! (May 1, 2022)

SirDice said:


> Is the host actually using ZFS? If you have that you can simply use the default zroot pool..



`zpool list`

NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
*zroot*   230G  21.1G   209G        -         -     9%     9%  1.00x    ONLINE  -

*Before* xfce reinstall, `mount -v` showed



Sivan! said:


> ```
> pdpool on /pdpool (zfs, local, nfsv4acls)
> pdpool/compressed on /pdpool/compressed (zfs, local, nfsv4acls)
> pdpool/data on /pdpool/data (zfs, local, nfsv4acls)
> ...



_(Shown above was before the xfce and related issues. After that I deinstalled and reinstalled xfce, deleted the user and added the user again)

These are the errors after setting `ZPOOL=zroot` #errors because the steps are mixed up #
`/usr/ports/ports-mgmt/poudriere-devel]# poudriere jail -l`
JAILNAME VERSION          ARCH  METHOD TIMESTAMP           PATH
130amd64 13.0-RELEASE-p11 amd64 http   2022-04-27 08:29:03 /usr/local/poudriere/jails/130amd64

`# /usr/ports/ports-mgmt/poudriere-devel]# poudriere jail -u -j 130amd64`

[00:00:00] Upgrading using http
sed: /usr/local/poudriere/jails/130amd64/etc/login.conf: No such file or directory
cap_mkdb: /usr/local/poudriere/jails/130amd64/etc/login.conf.db: No such file or directory
File does not exist or is not readable: /usr/local/poudriere/jails/130amd64/etc/freebsd-update.conf
13.0-RELEASE-p11
cannot open 'zroot/poudriere': dataset does not exist
[00:00:00] Recording filesystem state for clean... done

Now `mount -v` shows only zroot, but I could find /pdpool #name of the pool set up before# and there is an empty poudriere directory under /usr/local. If I can use zroot as zpool (in the same disk where poudriere is port installed, not in a different drive) how would I delete pdpool ? Also, I don't understand why `mount -v` does not show output as before.


Thank you.


----------



## Sivan! (Jul 21, 2022)

I am not sure if Poudriere is working in the background, or if I am required to run certain commands regularly to keep the jail updated. I have noticed some inconsistencies:

`$  poudriere jail -l`


> JAILNAME VERSION          ARCH  METHOD TIMESTAMP           PATH
> bsd13    13.0-RELEASE-p11 amd64 http   2022-05-11 01:59:59 /usr/local/poudriere/jails/kde


`$ uname -a`
FreeBSD myFQDN 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64                                                                                  
`$ mount -v` 


> zroot/ROOT/default on / (zfs, local, noatime, nfsv4acls)
> devfs on /dev (devfs)
> /dev/nvd0p1 on /boot/efi (msdosfs, local, writes: sync 1 async 0, reads: sync 9 async 0)
> procfs on /proc (procfs, local)
> ...



`uname -a` shows 13.1 while there is 13.0 in the poudriere jail. What do I need to do to keep this synchronized?  Also, how do I instruct Poudriere to update the ports and install updates? 

Thank you.


----------



## SirDice (Jul 22, 2022)

Sivan! said:


> I am not sure if Poudriere is working in the background or if I am required to run certain commands regularly to keep the jail updated.


It's typically not configured to run that way. You have to start the various builds yourself. This is a small script I use to 'kick off' builds I want to have:

```
#!/bin/sh

SERVER_REPOS="131-release 13-stable"
DESKTOP_REPOS="131-release 13-stable"

POUDRIERE=/usr/local/bin/poudriere

BASEDIR=/usr/local/etc/poudriere.d

${POUDRIERE} ports -u -p desktop
${POUDRIERE} ports -u -p server

for j in ${SERVER_REPOS}; do
  ${POUDRIERE} bulk -j ${j} -p server -f ${BASEDIR}/${j}-server-package.lst
done

for j in ${DESKTOP_REPOS}; do
  ${POUDRIERE} bulk -j ${j} -p desktop -f ${BASEDIR}/${j}-desktop-package.lst
done

#poudriere logclean -y 14
```

Short explanation, I have two ports trees, server and desktop:

```
root@molly:~ # poudriere ports -l
PORTSTREE METHOD    TIMESTAMP           PATH
desktop   git+https 2022-07-16 18:15:05 /usr/local/poudriere/ports/desktop
server    git+https 2022-07-16 18:15:09 /usr/local/poudriere/ports/server
```
And 2 jails:

```
root@molly:~ # poudriere jails -l
JAILNAME    VERSION      ARCH  METHOD                                    TIMESTAMP           PATH
13-stable   13.1-STABLE  amd64 url=file:///storage/release/13-stable/ftp 2022-07-06 01:09:19 /usr/local/poudriere/jails/13-stable
131-release 13.1-RELEASE amd64 http                                      2022-07-06 01:10:14 /usr/local/poudriere/jails/131-release
```

The script just updates both ports trees, then run a total of 4 builds, i.e. each combination of jail and ports tree.



Sivan! said:


> What do I need to do to keep this synchronized?


For minor or major version upgrades I just create a new jail. I don't 'upgrade' the existing ones. For patch updates I regularly run `poudiere jail -u -j <jailname>`.


----------



## jbo (Jul 22, 2022)

Sivan! said:


> I have noticed some inconsistencies:
> [...]
> uname -a shows 13.1 while there is 13.0 in the poudriere jail.


The jail having/running/being a different FreeBSD version than the host is pretty much half the reason why you would go through all of this trouble in the first place.
Of course, you can also create a jail running the exact same version as the host if that is what you need/desire.


----------



## Sivan! (Jul 23, 2022)

Thank you jbodenmann Is there a configuration change that I can make to make my present poudriere jail change to 13.1 release (or to any other later version)?  What do I need to say, and in which file?

`poudriere jails -l`


> JAILNAME VERSION          ARCH  METHOD TIMESTAMP           PATH
> bsd13    13.0-RELEASE-p11 amd64 http   2022-05-11 01:59:59 /usr/local/poudriere/jails/kde



SirDice  Thank you for the script file. Are server packages more suitable for a 'desktop' running nginx, apache24, php, a db and bind916? And on what path and by what file name do I have to add the script? And do I also need to let Poudriere know in its config file that there is a script to follow?

My jail name is "kde" auto-created, because I didn't create it. Your jails have the names "13-stable" or "13-stable, do I have to create the jails for 13.1 release anew, or "kde" includes the base 13.1 components already?  Is it easier for a "desktop" to have one jail instead of two as you have chosen to create?

(too many questions, apologies)

Thank you.


----------



## jbo (Jul 23, 2022)

Sivan! said:


> Thank you _*jbodenmann*_ Is there a configuration change that I can make to make my present poudriere jail change to 13.1 release (or to any other later version)? What do I need to say, and in which file?


Usually you would just create a new jail. You can have pretty much as many jails as you want.
It's also not uncommon to have jails of the same version but for different architectures (eg. one for amd64, one for i386 and so on).

You can create a new jail with `poudriere jail -c`.
If you really don't want to have that 13.0-RELEASE jail anymore you can just delete it (again, via `poudriere-jail`).

Poudriere jails themselves don't "do" something. When you start building packages (or testing ports), you'll tell poudriere which jail(s) to use and then poudriere will spin up those jails. Otherwise, they stay dormant and just need a bit of disk space.


----------

