# Pkg vs Ports



## happy-yoga (Nov 19, 2020)

I am a beginner with FreeBSD. I just installed it on a virtual machine on my laptop. I want to set up a desktop for daily use. I tried installing packages but got a message that said I needed to Consider changing PACKAGESITE. I instead used the ports method to install xorg. Since I installed the xorg with ports does that mean I am now stuck with using ports for everything? And how to I solve the problem with changing the PACKAGESITE?


----------



## SirDice (Nov 19, 2020)

Please don't necropost old threads with unrelated issues. Question split off to its own thread.



happy-yoga said:


> I tried installing packages but got a message that said I needed to Consider changing PACKAGESITE. I instead used the ports method to install xorg.





happy-yoga said:


> And how to I solve the problem with changing the PACKAGESITE?



What is the _exact_ message you're getting?


----------



## a6h (Nov 19, 2020)

`pkg-static install -f pkg`
`pkg upgrade -f`


----------



## happy-yoga (Nov 19, 2020)

SirDice said:


> Please don't necropost old threads with unrelated issues. Question split off to its own thread.
> 
> 
> 
> ...


I can't figure out how to copy and paste the message from the virtual machine terminal, so I will type a part of the message here....

"Address resolution failed for http://pkg.FreeBSD........:amd64/quarterly" Consider changing PACKAGESITE.


----------



## Zvoni (Nov 20, 2020)

Sounds more like there is something wrong with the Networking in your VM (VirtualBox?).
If it's VirtualBox, what settings do you use for the NIC's? (NAT, Bridge, HostOnly....)


----------



## chrbr (Nov 20, 2020)

happy-yoga said:


> I can't figure out how to copy and paste the message from the virtual machine terminal,


Please try script(1) for that. Start `script logfile`. Then run things you want to log. After `exit` the messages which have been printed on the screen should appear in logfile.


----------



## SirDice (Nov 20, 2020)

happy-yoga said:


> "Address resolution failed


This is an indication that your DNS isn't working. You either have no or the wrong DNS settings in /etc/resolv.conf or you don't have a network connection at all.


----------



## T-Daemon (Nov 20, 2020)

happy-yoga said:


> I can't figure out how to copy and paste the message from the virtual machine terminal, ...


Take a screenshot of the VM from the virtualization software (VirtualBox, VMWare, etc.). In case the VM software doesn't provide such a function use the host system. E.g. VirtualBox:


 

To the problem, if installing ports does work, meaning fetching the distfiles, then the network is functional. Maybe the package repositories server is temporarily unreachable.  Try installing a small package, e.g: `pkg install sl`

Or changing the name server might help. What does `drill pkg.freebsd.org` return?



happy-yoga said:


> Since I installed the xorg with ports does that mean I am now stuck with using ports for everything?


You can force a reinstall of all installed software using packages after the address resolution failure is resolved: `pkg upgrade -f`


----------



## happy-yoga (Nov 20, 2020)

SirDice said:


> This is an indication that your DNS isn't working. You either have no or the wrong DNS settings in /etc/resolv.conf or you don't have a network connection at all.


Does it matter whether I use a VPN? I am in China and need to use a VPN most of the time and I change VPN locations frequently.


----------



## happy-yoga (Nov 20, 2020)

T-Daemon said:


> Take a screenshot of the VM from the virtualization software (VirtualBox, VMWare, etc.). In case the VM software doesn't provide such a function use the host system. E.g. VirtualBox:
> 
> View attachment 8768 View attachment 8770
> 
> ...


See attached screenshot. I am using a VPN. I don't know if this could be the reason. When I turned the VPN off I still had the same problem. How do I change the nameserver?


----------



## happy-yoga (Nov 20, 2020)

I turned off the VPN, now I get this message. See attached



happy-yoga said:


> See attached screenshot. I am using a VPN. I don't know if this could be the reason. When I turned the VPN off I still had the same problem. How do I change the nameserver? It looks like if I turn off the VPN I can install packages. I successfully executed pkg install sl.



I found the DNS server address in my VPN settings: So how do I add that so I can use the VPN?


----------



## Zvoni (Nov 20, 2020)

After installing FreeBSD in a VM, i'd rather just fire off a "freebsd-update fetch install"
If it already fails there, it's 99% a problem with the Network of the VM


----------



## SirDice (Nov 20, 2020)

happy-yoga said:


> Does it matter whether I use a VPN?


I assume that VPN is running on the host? Then no, it shouldn't matter.

How is the VM configured? Did you use bridged, NAT or host-only? In your case NAT is probably the easiest to use.


----------



## happy-yoga (Nov 20, 2020)

I am using NAT virtio. The VPN is running on the host. When I turn off the VPN I can install packages. When I turn on the VPN I can't. 


SirDice said:


> I assume that VPN is running on the host? Then no, it shouldn't matter.
> 
> How is the VM configured? Did you use bridged, NAT or host-only? In your case NAT is probably the easiest to use.


----------



## T-Daemon (Nov 20, 2020)

If you are using Virtualbox see the following article, if you are not using VB please tell us which virtualization software you are using:









						FIX: VPN not working on VirtualBox [4 easy solutions]
					

If your VPN isn't working on VirtualBox, discover four solutions like enabling Paravirtualization in the NAT adapter or using DNS proxy.




					windowsreport.com


----------



## happy-yoga (Nov 20, 2020)

T-Daemon said:


> if you are not using VB please tell us which virtualization software you are using:


I am using KVM -QEMU (virtual machine manager) on Fedora 33.


----------



## T-Daemon (Nov 22, 2020)

happy-yoga said:


> I am using KVM -QEMU (virtual machine manager) on Fedora 33.



Maybe the linked article is of some help, the routed setup diagram and setting examples might be helpful to resolve the problem. 



			Qemu and openvpn: Secure and convenient remote access to virtual servers «  sassan's random nonsense
		


If it's not, the Qemu user mailing list may a better place to ask:






						Contribute/MailingLists - QEMU
					






					wiki.qemu.org


----------



## happy-yoga (Nov 23, 2020)

I need to investigate whether this problem is due to the virtual machine set up or something else. When I set up FreeBSD on a different machine directly without a virtual machine I also had the same problem. I guess I need to create a new thread on the forum for this problem?


----------



## happy-yoga (Nov 24, 2020)

I use a vpn called VPN.ac. With the VPN on I can't download anything from the FreeBSD website, including the ISOs and handbook, etc. I also can't install packages. I want to use a VPN to maintain privacy as I am located outside the US. How can I use a VPN with FreeBSD?


----------



## SirDice (Nov 24, 2020)

Don't open new threads with exactly the same questions.


----------



## SirDice (Nov 24, 2020)

happy-yoga said:


> I use a vpn called VPN.ac. With the VPN on I can't download anything from the FreeBSD website, including the ISOs and handbook, etc. I also can't install packages. I want to use a VPN to maintain privacy as I am located outside the US. How can I use a VPN with FreeBSD?


You have a VPN already running on the host. You just need to configure your virtualization software to bind the NAT network to that interface. You never mentioned what virtualization software you're using and what the host OS is, so we don't know how to help you.


----------



## happy-yoga (Nov 25, 2020)

SirDice said:


> You have a VPN already running on the host. You just need to configure your virtualization software to bind the NAT network to that interface. You never mentioned what virtualization software you're using and what the host OS is, so we don't know how to help you.


I am using KVM -QEMU (virtual machine manager) on Fedora 33.

But I have problems when using the VPN on the host without a VPN. I also installed FreeBSD on a different laptop and I am not using a virtual machine. 

Regarding the virtual machine, I will research how to configure the virtualization software to bind the NAT network. However, why do I also have problems downloading anything from the FreeBSD website if I am using a VPN on the host and without using a virtual machine?


----------



## T-Daemon (Nov 25, 2020)

As I understood the situation is as follows, the system has access to the internet through VPN, but it can't reach some sites like https://pkg.freebsd.org to download packages or https://ftp.freebsd.org to download documentation files (handbook)/ installations ISO's, on the other hand it can fetch distfiles to install ports (xorg, post #1).

It could be a DNS matter as SirDice in post #7 commented. Seeing at https://vpn.ac/faq:


```
What DNS servers do you use? Do you protect my DNS queries?

We protect DNS queries against MitM hijacking and snooping, wiretapping. We have our own,
private DNS resolvers outside of US and UK. All DNS queries sent by VPN users are forwarded
by our VPN servers to the private resolvers, through encrypted tunnels. As long as you don't
manually change your DNS servers while being connected to our VPN, and you use the one we
assign, no DNS queries will leak out of our VPN servers through our hosting partners and IP carriers.
```

Try changing the name server (temporarily). On Fedora 33 or laptop FreeBSD set in /etc/resolv.conf `nameserver 1.1.1.1` on top of the other entries. I don't know about Fedora, but on FreeBSD that entry won't persist a reboot, however first let's see if changing the name server helps.


----------



## happy-yoga (Nov 25, 2020)

T-Daemon said:


> As I understood the situation is as follows, the system has access to the internet through VPN, but it can't reach some sites like https://pkg.freebsd.org to download packages or https://ftp.freebsd.org to download documentation files (handbook)/ installations ISO's, on the other hand it can fetch distfiles to install ports (xorg, post #1).
> 
> It could be a DNS matter as SirDice in post #7 commented. Seeing at https://vpn.ac/faq:
> 
> ...


I do not know how to add the nameserver 1.1.1.1 on top of the other entry. I am new to this. Do I just add it in front of the first one and add a comma between them?


----------



## T-Daemon (Nov 25, 2020)

happy-yoga said:


> I do not know how to add the nameserver 1.1.1.1 on top of the other entry. ...... Do I just add it in front of the first one and add a comma between them?


No, from resolv.conf(5), nearly at the bottom of the manual:


```
...
The keyword and value must    appear on a single line, and the keyword (for
     example, nameserver) must start the line....
```
On laptop FreeBSD's /etc/resolv.conf:

```
# Generated by resolvconf

nameserver    1.1.1.1        # this entry won't persist a reboot, it will be overwritten by resolvconf(8)
nameserver    192.168.122.1
```

On Fedora:

```
nameserver    1.1.1.1
nameserver    192.168.122.1
```



happy-yoga said:


> I am new to this.


Then manuals/handbooks/wiki's are your source of information, eg:


```
man apropos
apropos resolv.conf
man resolv.conf
```

In almost every man page is a "`SEE ALSO`" section, with further manuals related to the current man page.

Bookmark in your browser https://www.freebsd.org/docs/books.html, or have it all installed locally on your system:
`pkg install en-freebsd-doc`, then point your browser (and bookmark them in a FreeBSD Doc folder of the browser).

For the handbook to
/usr/local/share/doc/freebsd/en_US.ISO8859-1/books/handbook/index.html

For the FAQ
/usr/local/share/doc/freebsd/en_US.ISO8859-1/books/faq/index.html

All others:
/usr/local/share/doc/freebsd/en_US.ISO8859-1/books
/usr/local/share/doc/freebsd/en_US.ISO8859-1/articles

FreeBSD wikis: https://wiki.freebsd.org


----------



## happy-yoga (Nov 27, 2020)

I made the modifications on Fedora 33 KVM-QEMU with FreeBSD 12.2. I still can't install packages. What else can I do to solve this problem?

Also, when I go to the Freebsd.org website and try to download FreeBSD 12.2 my browser says "the server's certificate is not trusted."


----------



## SirDice (Nov 27, 2020)

happy-yoga said:


> I still can't install packages.


What is the error you're getting? "It doesn't work" doesn't tell us anything. Different problems will give you different error messages. Based on those messages we can tell what is going wrong. 



happy-yoga said:


> Also, when I go to the Freebsd.org website and try to download FreeBSD 12.2 my browser says "the server's certificate is not trusted."


Where's that browser running? On FreeBSD? Then you're probably missing security/ca_root_nss.


----------

