Closed basbebe closed 8 years ago
No, it won't work in jail as you've seen by the tmpfs limitation. But why does it need to be executed in a jail? It's creating its only jail-like environment inside. maybe you just need to have the jails access the resultant repository? (In other words: build outside the jail, install the packages from inside the jail)
That sounds like a nice solution (something like poudriere would do?) – yet I'm not sure how I would make the repository that Synth creates available to the Jail from the host system.
null mount host directory to jail directory?
/var/synth/live_packages
?
sure. create /packages in jail area and null mount /var/syn/live_packages to it before starting jail.
There are other solutions but that should work I would think.
(and then create a pkg conf file to look there)
e.g.
ironwolf# cat /usr/local/etc/pkg/repos/00_synth.conf
# Automatically generated.
Synth: {
url : file:///packages,
priority : 0,
enabled : yes,
}
what would then be the correct command to build them without installing them on the base system?
I assume I could create a text file jail_ports.txt
:
www/nginx
mail/dovecot2
[…]
and do synth just-build jail_ports.txt
?
synth just-build for all and on the last package, "synth build" and answer "yes" to rebuild repository, "no" to install packages
in other words, never rebuild repository until the last package is built
in the case of "jail_ports.txt" then use "synth build" and answer the questions yes, no
But if I then did "upgrade-system" the next time, all the ports that I have configured for my jails would also be installed on the host, right?
no. Upgrade system checks what is installed. For example, you have 5000 packages built in local repository, and 20 packages installed on host. When you "upgrade system", it's only going to consider the 20 packages already installed, no matter how many are available in the repository. And it only installs if the repository versions are newer.
I'm getting more and more excited about this ;-)
Is there a way to create a cronjob to synth build jail_ports.txt – yes, no
?
And is this only going to rebuild those ports that have newer versions / dependencies available?
you could do some kind of kludge by making a script that rules "/usr/local/bin/synth just-build < file >" followed by "/usr/local/bin/synth install < some small port >". it would rebuild the repository and then do nothing because the small port would already be up to date.
Synth doesn't have a "build-then-repo" command at the moment and that's what you would really need. OTOH, you could just run "just-build" in cron and then manually run a "build" command later to force repo to build. it would only take a few minutes and I'm assuming you aren't installing packages via cron.
"And is this only going to rebuild those ports that have newer versions / dependencies available?"
yes, but one change (e.g. to perl) can cause hundreds of ports to rebuild.
Thank you! A lot.
no problem. feel free to reopen if you want to continue conversation.
could a list file also include comments?
no, it can't. it will choke on them.
I stumbled upon this:
synth build /usr/local/etc/jail_ports.txt
Stand by, updating external repository catalogs ... done.
Scanning existing packages.
After inspection, it has been determined that there are no packages that
require rebuilding; the task is therefore complete.
Would you like to rebuild the local repository (Y/N)? y
Scanning entire ports tree.
progress: 98.34%
raised ADA.IO_EXCEPTIONS.NAME_ERROR : unknown directory "All"
This is my /usr/local/etc/jail_ports.txt
devel/git
lang/php56
lang/php56-extensions
lang/python3
mail/dovecot2-pigeonhole
mail/dovecot2-antispam-plugin
mail/opendkim
mail/opendmarc
mail/postfix-current
mail/rmilter
mail/rspamd
mail/ssmtp
security/ca_root_nss
security/clamav
security/openssl
www/uwsgi
www/nginx
www/nginx-devel
After that, my repo must have gotten broken or something. Now Synth also wants to rebuild the ports that already were build before.
do you have an errant directory named /usr/ports/All ?
if not, use "find" command and figure out where "All" directory is.
This is my result:
several of these (symlinked to /var/synth/live_packages/All
):
/usr/jails/[JAILNAME]/var/synth/live_packages/All
and these:
/usr/obj/synth-live/SL01/packages/All
/var/synth/live_packages/All
unfortunately, that's not interesting. Can you paste the contents of /usr/local/etc/synth/synth.ini ?
; This Synth configuration file is automatically generated
; Take care when hand editing!
[Global Configuration]
profile_selected= LiveSystem
[LiveSystem]
Operating_system= FreeBSD
Directory_packages= /var/synth/live_packages
Directory_repository= /var/synth/live_packages/All
Directory_portsdir= /usr/ports
Directory_options= /var/db/ports
Directory_distfiles= /usr/ports/distfiles
Directory_buildbase= /usr/obj/synth-live
Directory_logs= /var/log/synth
Directory_ccache= /var/cache/ccache
Directory_system= /
Number_of_builders= 2
Max_jobs_per_builder= 2
Tmpfs_workdir= true
Tmpfs_localbase= true
Display_with_ncurses= true
leverage_prebuilt= true
"several of these (symlinked to /var/synth/live_packages/All):"
symlinked or null mounted?
what happens when you "ls" /var/synth/live_packages/All ?
sorry!
null mounted!
mount_nullfs -o r /var/synth/live_packages /usr/jails/[JAILNAME]/var/synth/live_packages
ls /var/synth/live_packages/All
gives me a long list of packages.
it seems to be that it completed the port tree scan It was probably starting the scan of /var/synth/live_packages/All for some reason it says that's a bad directory, but maybe it was a permissions problem because the directory obviously exists. But you run as root, so that's probably not it either. I'm a bit stumped.
The bit about "it wants to build all the packages again" might be related. Is "All" readable?
drwxr-xr-x 2 root wheel 192B 28 Jan 21:39 All
is it repeatable? try to build one port with "build" and answer "yes" to rebuild repository. It can be one that's already been rebuilt.
I did a rebuild-repository and then a just-build, The latter on the file. Both worked
so it's not repeatable?
in other words, it's not happening anymore?
No, it's not happening anymore.
Also a synth build /usr/local/etc/jails_ports.txt
ran fine.
Maybe this question is stupid and I misunderstood the purpose of Synth. I'm using Jails to separate my different services. Some of them have custom options, so I used to compile them using Postmaster (Dovecot, Postfix, NGINX, etc.). Synth seemed to be an amazing new tool to replace Portmaster. But as I learned, synth doesn't work inside Jails:
Is there a way to use Synth's capabilities with Jails? Or did I misunderstand something completely?