# New User - Can't install package manager



## w3e4r7yu890 (Mar 30, 2017)

I just installed FreeBSD. I wanted to install Xfce so I needed to install the package manager. I typed "pkg" and was asked to install the package manager since I didn't have it. I typed "y" install it, I was instead presented with this error: https://www.dropbox.com/s/88l6en4dz2...G0152.jpg?dl=0


----------



## Phishfry (Mar 30, 2017)

Looks like you may not have working internet.
What happens when you ping google? 
`ping 8.8.8.8`


----------



## w3e4r7yu890 (Mar 30, 2017)

Phishfry said:


> Looks like you may not have working internet.
> What happens when you ping google?
> `ping 8.8.8.8`


I think the internet is working. It says ping 64bytes and the ms.


----------



## SirDice (Mar 30, 2017)

The error we need to know is just off of the left of the picture. If it says "No address record" you need to configure DNS properly. Are you using DHCP or static addresses? DHCP should provide the proper DNS servers, if you used static addresses you probably forgot resolv.conf(5).


----------



## w3e4r7yu890 (Mar 30, 2017)

SirDice said:


> The error we need to know is just off of the left of the picture. If it says "No address record" you need to configure DNS properly. Are you using DHCP or static addresses? DHCP should provide the proper DNS servers, if you used static addresses you probably forgot resolv.conf(5).


Well I've tried using DHCP whenever I was setting up FreeBSD, but there was an error with getting my DHCP address. I'll take a full screenshot once I get home. I'm really confused about this so I'm not sure at all. Sorry.


----------



## w3e4r7yu890 (Mar 30, 2017)

SirDice said:


> The error we need to know is just off of the left of the picture. If it says "No address record" you need to configure DNS properly. Are you using DHCP or static addresses? DHCP should provide the proper DNS servers, if you used static addresses you probably forgot resolv.conf(5).


Ok, here's a full picture of the problem: https://ibb.co/btB5ov


----------



## horseflesh (Mar 30, 2017)

How is this machine hooked up to your network? Is it connected directly to your modem, or is it just another machine on your LAN? It does look like the box lacks a working internet connection.


----------



## Phishfry (Mar 30, 2017)

Since you got feedback from using ip's then try: `ping google.com`

What is your internet connection? Wired or wireless?

You need to use something different for forum help. Us going to random sites to troubleshoot is not ideal.


----------



## w3e4r7yu890 (Mar 30, 2017)

horseflesh said:


> How is this machine hooked up to your network? Is it connected directly to your modem, or is it just another machine on your LAN? It does look like the box lacks a working internet connection.


Directly connected to the router with ethernet. I think it may lack an internet connection since I couldn't ping google.



Phishfry said:


> Since you got feedback from using ip's then try: `ping google.com`
> 
> What is your internet connection? Wired or wireless?
> 
> You need to use something different for forum help. Us going to random sites to troubleshoot is not ideal.


I just tried pinging www.google.com. Unresolved host name. I'm using a wired connection.

I don't know what else to use really, I'm just really confused and I'm not sure. I've already tried looking through the documentation, but haven't found anything to help.


----------



## horseflesh (Mar 30, 2017)

Can you show us your /etc/rc.conf ?


----------



## w3e4r7yu890 (Mar 30, 2017)

horseflesh said:


> Can you show us your /etc/rc.conf ?


I get a message telling me that it is not a directory.


----------



## horseflesh (Mar 31, 2017)

Sorry, /etc/ is just the path to the file rc.conf, I spelled it out since you said you were new. rc.conf is where you set up the network and lots of other things. 

Try this...


```
cd /etc
more rc.conf
```

`more` lets you page through a text file with the space bar. In rc.conf look for the network card setup. It will be a line starting with _ifconfig_ for example _ifconfig_igb2="DHCP"._

Then show us resolv.conf, for example with `cat /etc/resolv.conf`.


----------



## w3e4r7yu890 (Mar 31, 2017)

Alright, thanks. So I went into my rc.conf directory. The ifconfig line says _ifconfig_em0_ipv6="inet6 accept_rtadv"_.

I also looked at my resolv.conf directory, but it returns with just a blank line, so I think it's empty.


----------



## horseflesh (Mar 31, 2017)

Cool, progress. I don't know anything about the ipv6 flavored directives but presumably the install process knew what it was doing, and that is a legit setup. Since you can ping an IP address it's probably fine.

You're right, resolv.conf is empty. You need to edit it to add domain name servers. Use the provided easy text editor `ee`.

`ee /etc/resolv.conf`

Type in these lines, which are the Google public name servers:


```
nameserver 8.8.8.8
nameserver 8.8.4.4
```

Then hit Esc to leave the editor, saving changes. (After you choose _Leave editor_ it will offer to save changes or not.)

Now, see if you have good DNS, like with `ping yahoo.com`.


----------



## w3e4r7yu890 (Mar 31, 2017)

I added the domains to the .conf directory, but I get a host name lookup error when I try to ping yahoo.com. I also tried google.com and got the same message in return.


----------



## horseflesh (Mar 31, 2017)

_.conf_ isn't a directory, it's part of the filenames. rc.conf and resolv.conf are files that live inside the directory /etc .

Do `cat /etc/resolv.conf` and let's double check you got the file updated correctly. The trouble may be with that ipv6 directive though--I just don't know anything else about it. 

Assuming you have a DHCP server on your LAN, you should be able to change 

ifconfig_em0_ipv6="inet6 accept_rtadv"

to 

ifconfig_em0="DHCP"

But, one thing at a time I guess. Check resolv.conf and make sure it's got those lines in it. 

Someone smarter than me will come along sooner or later.


----------



## w3e4r7yu890 (Mar 31, 2017)

horseflesh said:


> _.conf_ isn't a directory, it's part of the filenames. rc.conf and resolv.conf are files that live inside the directory /etc .
> 
> Do `cat /etc/resolv.conf` and let's double check you got the file updated correctly. The trouble may be with that ipv6 directive though--I just don't know anything else about it.
> 
> ...


Just checked resolv.conf and saw those lines there, but still can't ping those sites. Well, thanks for helping me anyways.


----------



## horseflesh (Mar 31, 2017)

I would try changing the ifconfig directive. 

Use ee and edit rc.conf. Put a # before the existing ifconfig line, to turn it off. Just below the old line, add:

ifconfig_em0="DHCP"

Leave ee, save the file, and reboot the machine. Then see if anything is different.


----------



## w3e4r7yu890 (Mar 31, 2017)

horseflesh said:


> I would try changing the ifconfig directive.
> 
> Use ee and edit rc.conf. Put a # before the existing ifconfig line, to turn it off. Just below the old line, add:
> 
> ...


I'm not sure what you mean by adding # before the existing ifconfig line. When I go into rc.conf to edit, it's blank so there's nothing to put # before.


----------



## Deleted member 9563 (Mar 31, 2017)

w3e4r7yu890 said:


> When I go into rc.conf to edit, it's blank so there's nothing to put # before.



Sounds like you're opening a new file instead of /etc/rc.conf. Unless you're already in the /etc directory you're going to get an empty (new) file. You need to be in the right directory or else give the complete path like this:

```
ee /etc/rc.conf
```

PS: Reading through the above posts, I think it would be worth your while to read a little about "file", "directory", and "directory tree".  It is imperative that you understand those words completely if you wish to have any success with computers. It doesn't matter what operating system you apply the words to, so you can just as well be reading about Windows in this case. Whatever you find handy.


----------



## horseflesh (Mar 31, 2017)

Not sure at all but I think he meant there was a blank line before the existing ifconfig line, so my instruction to comment it out didn't make sense because it wasn't clear that the # goes at the beginning of the line...

On a mobile device, I will follow up later.


----------



## horseflesh (Mar 31, 2017)

OK w3e4r7yu890 -- 

Find this line in rc.conf:


```
ifconfig_em0_ipv6="inet6 accept_rtadv"
```

"Comment it out" it by putting a # in front, like this. This will turn that line off, but keep it visible for your reference.


```
#ifconfig_em0_ipv6="inet6 accept_rtadv"
```

Then, just under it, add this line, which will tell the machine to use ipv4 DHCP to pick up an IP address and DNS from whatever does that for your LAN now. 


```
ifconfig_em0="DHCP"
```

Then, reboot and see how it goes.


----------

