Solved Can't upgrade jail packages with pkg -j

I created a simple jail. It uses an lo1 interface - no access to public internet. I want to upgrade the packages using pkg -j but get a "No address record" when pkg tries to download meta.txz and packagesite.txz. Since I run pkg outside of the jail, I expect pkg to use the host interface to download packages.

Do I need to configure network access in the jail for this to work?

pkg update works fine for the host.
 
"No address record" is typically an indication you haven't set up DNS correctly.
 
You will likely make changes to your firewall rules -pf.conf for it to allow traffic via lo1.

You didn't inform us if you can access other websites or the Internet in the jail. A firewall config might be required.

You may also need set the pkg repo - FREEBSD.conf inside /usr/local/etc/pkg/repo if I am correct. Since the host repo conf works fine, you may copy and overwrite the jail's with it. No address record is likely caused by the conf wrongly set.
 
Side note - treating the jail folder as a chroot works.

eg. pkg -c /path/to/jail upgrade

I am not understanding why -j does not work. The whole point is to run pkg outside of the jail. If the effect of "-j" is the same as running pkg inside a jail - then this makes sense. Not quite what I expected.

Running the jail on lo1 - without external access is intentional so I need this to work without jail access to the network.
 
I'll mark this as resolved. I need to read up on pkg.conf to see what extras pkg does that I don't need for a jail. Thanks all.
 
Back
Top