Discussion:
pkg-add for installing into a jail?
(too old to reply)
Alnis Morics
2016-07-31 09:38:49 UTC
Permalink
Hi,

I could successfully use "pkg -j 1 <packagename>" many times to install
packages onto a jail.

But now I had to change an option in a port, so I built a package myself:

portmaster -g www/apache22

The package and its dependency was stored to /usr/ports/packages/All (as
I set it in $PACKAGES):

apache22-2.2.31_1.txz apr-1.5.2.1.5.4.txz

I can now install these packages using pkg-add on the host, but not onto
the jail:

test:/usr/ports/packages/All# pkg -j 1 add apache22-2.2.31_1.txz
apr-1.5.2.1.5.4.txz
pkg: apache22-2.2.31_1.txz: No such file or directory
pkg: Was 'pkg install apache22-2.2.31_1.txz' meant?
pkg: apr-1.5.2.1.5.4.txz: No such file or directory
pkg: Was 'pkg install apr-1.5.2.1.5.4.txz' meant?

Failed to install the following 2 package(s): apache22-2.2.31_1.txz,
apr-1.5.2.1.5.4.txz

If there is "No such file or directory", where does pkg look for them?
(I also tried to use full path; the result is the same) Or is pkg-add an
exception which doesn't work with -j option?

-Alnis
doug
2016-07-31 21:08:14 UTC
Permalink
Post by Alnis Morics
Hi,
I could successfully use "pkg -j 1 <packagename>" many times to install
packages onto a jail.
portmaster -g www/apache22
The package and its dependency was stored to /usr/ports/packages/All (as I
apache22-2.2.31_1.txz apr-1.5.2.1.5.4.txz
I can now install these packages using pkg-add on the host, but not onto the
test:/usr/ports/packages/All# pkg -j 1 add apache22-2.2.31_1.txz
apr-1.5.2.1.5.4.txz
pkg: apache22-2.2.31_1.txz: No such file or directory
pkg: Was 'pkg install apache22-2.2.31_1.txz' meant?
pkg: apr-1.5.2.1.5.4.txz: No such file or directory
pkg: Was 'pkg install apr-1.5.2.1.5.4.txz' meant?
Failed to install the following 2 package(s): apache22-2.2.31_1.txz,
apr-1.5.2.1.5.4.txz
If there is "No such file or directory", where does pkg look for them? (I
also tried to use full path; the result is the same) Or is pkg-add an
exception which doesn't work with -j option?
-Alnis
The way you build a jail is to have /usr/ports and /usr/local be on the jail not
on the base. The later is by default. If you log into the base system and look
at the file tree you can see how you are set up. I use exjail that provides an
option for this and I look at this so rarely I 're-learn' what I need each time.
The jail an ezjail man pages are very well done.
Ben Woods
2016-07-31 22:40:58 UTC
Permalink
Post by Alnis Morics
Hi,
I could successfully use "pkg -j 1 <packagename>" many times to install
packages onto a jail.
portmaster -g www/apache22
The package and its dependency was stored to /usr/ports/packages/All (as I
apache22-2.2.31_1.txz apr-1.5.2.1.5.4.txz
I can now install these packages using pkg-add on the host, but not onto
test:/usr/ports/packages/All# pkg -j 1 add apache22-2.2.31_1.txz
apr-1.5.2.1.5.4.txz
pkg: apache22-2.2.31_1.txz: No such file or directory
pkg: Was 'pkg install apache22-2.2.31_1.txz' meant?
pkg: apr-1.5.2.1.5.4.txz: No such file or directory
pkg: Was 'pkg install apr-1.5.2.1.5.4.txz' meant?
Failed to install the following 2 package(s): apache22-2.2.31_1.txz,
apr-1.5.2.1.5.4.txz
If there is "No such file or directory", where does pkg look for them? (I
also tried to use full path; the result is the same) Or is pkg-add an
exception which doesn't work with -j option?
-Alnis
It looks like the package you are trying to install is not in the directory
that pkg is running from within the jail. Either they are on the host
filesystem but not passed through to the jail, or pkg runs from a different
directory within the jail.

If you have your host system ports directory nullfs mounted inside the jail
also, this might be fixed by specifying the absolute path of the package.

# pkg -j 1 add /usr/ports/packages/All/apache22-2.2.31_1.txz
/usr/ports/packages/All/apr-1.5.2.1.5.4.txz

Check if your ports tree has the same directory inside the jail, and
contains these files.

Good luck!
Ben
--
--
From: Benjamin Woods
***@gmail.com
Alnis Morics
2016-08-01 07:21:31 UTC
Permalink
Thanks, Doug and Ben.

Yes, null-mounting and using absolute path in the pkg add command
helped. I found out that the packages directory can be arbitrary but
their paths must be the same on the host and on the jail.

Btw, I also use ezjail but I don't use ezjail-admin for updating ports
because it uses portsnap which, on its turn, pulls in the head (no other
option AFAIK). I prefer using a quarterly branch which I synchronize
with svn. Hence this hassle :)


-Alnis
Post by Alnis Morics
Hi,
I could successfully use "pkg -j 1 <packagename>" many times to
install packages onto a jail.
But now I had to change an option in a port, so I built a package
portmaster -g www/apache22
The package and its dependency was stored to
apache22-2.2.31_1.txz apr-1.5.2.1.5.4.txz
I can now install these packages using pkg-add on the host, but
test:/usr/ports/packages/All# pkg -j 1 add apache22-2.2.31_1.txz
apr-1.5.2.1.5.4.txz
pkg: apache22-2.2.31_1.txz: No such file or directory
pkg: Was 'pkg install apache22-2.2.31_1.txz' meant?
pkg: apr-1.5.2.1.5.4.txz: No such file or directory
pkg: Was 'pkg install apr-1.5.2.1.5.4.txz' meant?
apache22-2.2.31_1.txz, apr-1.5.2.1.5.4.txz
If there is "No such file or directory", where does pkg look for
them? (I also tried to use full path; the result is the same) Or
is pkg-add an exception which doesn't work with -j option?
-Alnis
It looks like the package you are trying to install is not in the
directory that pkg is running from within the jail. Either they are on
the host filesystem but not passed through to the jail, or pkg runs
from a different directory within the jail.
If you have your host system ports directory nullfs mounted inside the
jail also, this might be fixed by specifying the absolute path of the
package.
# pkg -j 1 add /usr/ports/packages/All/apache22-2.2.31_1.txz
/usr/ports/packages/All/apr-1.5.2.1.5.4.txz
Check if your ports tree has the same directory inside the jail, and
contains these files.
Good luck!
Ben
--
--
From: Benjamin Woods
Matthew Seaman
2016-08-01 09:56:59 UTC
Permalink
Post by Alnis Morics
test:/usr/ports/packages/All# pkg -j 1 add apache22-2.2.31_1.txz
apr-1.5.2.1.5.4.txz
pkg: apache22-2.2.31_1.txz: No such file or directory
pkg: Was 'pkg install apache22-2.2.31_1.txz' meant?
pkg: apr-1.5.2.1.5.4.txz: No such file or directory
pkg: Was 'pkg install apr-1.5.2.1.5.4.txz' meant?
Failed to install the following 2 package(s): apache22-2.2.31_1.txz,
apr-1.5.2.1.5.4.txz
If there is "No such file or directory", where does pkg look for them?
(I also tried to use full path; the result is the same) Or is pkg-add an
exception which doesn't work with -j option?
pkg -j 1 something

works by jexec'ing itself in the indicated jail first of all, and only
then parsing the rest of the command line including opening any files
listed there. Unless you have the apache22-2.2.31_1.txz package already
available in the right location *inside* the jail you're going to get
'file not found'.

It's the same deal with 'pkg -d /somewhere' except that uses chroot(2)
rather than jail(2).

Cheers,

Matthew

Loading...