SOLVED Installing packages in a jail with the "pkg" command

Status
Not open for further replies.
Joined
Feb 3, 2016
Messages
13
So I'm trying to follow the guide on installing OpenVPN in a FreeNAS jail here but when I try to run any pkg install such as "pkg install nano" it gives me this:
Code:
root@OpenVPN_1:/ # pkg install nano                                           
Updating FreeBSD repository catalogue...                                      
pkg: Repository FreeBSD has a wrong packagesite, need to re-create database   
pkg: http://pkg.FreeBSD.org/freebsd:9:x86:64/latest/meta.txz: No address record
pkg: repository FreeBSD has no meta file, using default settings              
pkg: http://pkg.FreeBSD.org/freebsd:9:x86:64/latest/packagesite.txz: No address
record                                                                        
pkg: Unable to update repository FreeBSD                                      
All repositories are up-to-date.                                              
pkg: Repository FreeBSD has a wrong packagesite, need to re-create database   
pkg: Repository FreeBSD cannot be opened. 'pkg update' required               
pkg: No packages available to install matching 'nano' have been found in the rep
ositories  

I've tried running "pkg upgrade" but it is still giving me this error. I tried the solution listed here but it is still giving me that error. Can anyone help me out? I'd really like to get this OpenVPN server running.

FreeNAS-9.3-STABLE-201512121950
 
Last edited:

DrKK

FreeNAS Generalissimo
Joined
Oct 15, 2013
Messages
3,630
In your jail, can you verify that your nameserver is resolving correctly? Drop to the shell OF THE JAIL (not of the FreeNAS), and try this:
Code:
dig google.com


If that is working, you should see an "ANSWER SECTION" (among other things), that contain several (probably around six?) addresses for google server.
 
Joined
Feb 3, 2016
Messages
13
In your jail, can you verify that your nameserver is resolving correctly? Drop to the shell OF THE JAIL (not of the FreeNAS), and try this:
Code:
dig google.com


If that is working, you should see an "ANSWER SECTION" (among other things), that contain several (probably around six?) addresses for google server.
So I tried that, and this is what it gave me:
Code:
root@OpenVPN_1:/ # dig google.com                                              
                                                                               
; <<>> DiG 9.9.5 <<>> google.com                                               
;; global options: +cmd                                                        
;; connection timed out; no servers could be reached 
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
Sounds like you need to fix your networking error. Either DNS or gateway isn't configured properly...
 

DrKK

FreeNAS Generalissimo
Joined
Oct 15, 2013
Messages
3,630
Yeah, so as @pirateghost says, your problem boils down to a network misconfig.

It's either the gateway, and/or, the DNS. To see if the gateway is working, try pinging by IP address---pinging the 8.8.8.8 Google nameserver:
Code:
ping 8.8.8.8
would test that.

If this ping returns, then the gateway is fine, and your DNS is screwed up. If the ping does not return, then the gateway is screwed up. Either way, I don't know what your level of skill is on this stuff, but if you need help fixing either/both of these, we'll be happy to help you right here.
 
Joined
Feb 3, 2016
Messages
13
Yeah, so as @pirateghost says, your problem boils down to a network misconfig.

It's either the gateway, and/or, the DNS. To see if the gateway is working, try pinging by IP address---pinging the 8.8.8.8 Google nameserver:
Code:
ping 8.8.8.8
would test that.

If this ping returns, then the gateway is fine, and your DNS is screwed up. If the ping does not return, then the gateway is screwed up. Either way, I don't know what your level of skill is on this stuff, but if you need help fixing either/both of these, we'll be happy to help you right here.
The ping is returning packets successfully, so it must be a problem with the DNS. If you could help me figure out how to fix it that would be great as I am not very good with Linux/Unix operating systems.
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
The ping is returning packets successfully, so it must be a problem with the DNS. If you could help me figure out how to fix it that would be great as I am not very good with Linux/Unix operating systems.
It all depends on how your jails are configured. Do you have them set to dhcp? Static IP?
 

DrKK

FreeNAS Generalissimo
Joined
Oct 15, 2013
Messages
3,630
It doesn't really matter, I don't think.

Go to network->global config, and set your "nameserver 1" to "8.8.8.8" and your nameserver 2 to 8.8.4.4.

I believe that carries over to the jails. Then, restart your jails.

Try the "dig" again.
 
Joined
Feb 3, 2016
Messages
13
It doesn't really matter, I don't think.

Go to network->global config, and set your "nameserver 1" to "8.8.8.8" and your nameserver 2 to 8.8.4.4.

I believe that carries over to the jails. Then, restart your jails.

Try the "dig" again.
The dig command is returning the same as before
Code:
root@OpenVPN_1:/ # dig google.com                                             
                                                                              
; <<>> DiG 9.9.5 <<>> google.com                                              
;; global options: +cmd                                                       
;; connection timed out; no servers could be reached      


Here is a screenshot of my network configuration: http://i.imgur.com/N9tit9H.png
I filled in the nameserver and all that but it's still returning with a network timeout. Everything else seems to be working fine, including my Plex server and Transmission.
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
You need to modify /etc/resolv.conf in the jail. Add your nameservers there.
 
Joined
Feb 3, 2016
Messages
13
You need to modify /etc/resolv.conf in the jail. Add your nameservers there.
That seems to have worked, dig now gives me this output:
Code:
root@OpenVPN_1:/ # dig google.com                                           
                                                                            
; <<>> DiG 9.9.5 <<>> google.com                                            
;; global options: +cmd                                                     
;; Got answer:                                                              
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7474                    
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1        
                                                                            
;; OPT PSEUDOSECTION:                                                       
; EDNS: version: 0, flags:; udp: 512                                        
;; QUESTION SECTION:                                                        
;google.com.                    IN      A                                   
                                                                            
;; ANSWER SECTION:                                                          
google.com.             92      IN      A       216.58.218.142              
                                                                            
;; Query time: 164 msec                                                     
;; SERVER: 8.8.4.4#53(8.8.4.4)                                              
;; WHEN: Tue Mar 01 18:29:19 PST 2016                                       
;; MSG SIZE  rcvd: 55     

Thanks for your help!

Edit: Just to clarify, for people that have this problem in the future, there should be a resolv.conf file in outside the jail, should vi into it to see the contents, and then copy the contents into the resolv.conf file that was created by vi. You may already have a resolv.conf file, but I did not, and that was the way that worked for me.
 
Last edited:
Status
Not open for further replies.
Top