VM apt-get install - network is unreachable

5,488

Solution 1

Vagrant uses VirtualBox. So go to your instance and check if your network card is correctly bridged. You can configure that in your Vagrantfile. For example my line for my Macbook to bridge the network to my WLAN card.

server.vm.network "public_network", bridge:'en0: WLAN (AirPort)'

perhaps that help for your problem.

http://docs.vagrantup.com/v2/networking/public_network.html

Check your VBox settings. If there is a correct network bridge. enter image description here

Have you set another gateway? Perhaps make a new instance and check if that is working. Perhaps you have a misconfiguration anything in your package manager.

Solution 2

The strange thigs is that apt-get is connecting 192.168.0.0:59875.

Are you using any proxy for apt-get?

Check this with:

$ apt-config dump Acquire::http::Proxy
$ echo $http_proxy
Share:
5,488

Related videos on Youtube

timothyclifford
Author by

timothyclifford

Updated on September 18, 2022

Comments

  • timothyclifford
    timothyclifford almost 2 years

    I have a Vagrant backed Ubuntu VM which I'm trying to do some performance testing on. In order to do so I'm trying to install gdb

    When I run apt-get install I see the following:

    vagrant@ubuntu-1204:~$ sudo apt-get install gdb
    sudo: /etc/sudoers.d/vagrant is mode 0644, should be 0440
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following extra packages will be installed:
      libpython2.7 python2.7 python2.7-minimal
    Suggested packages:
      gdb-doc gdbserver python2.7-doc binfmt-support
    The following NEW packages will be installed:
      gdb libpython2.7
    The following packages will be upgraded:
      python2.7 python2.7-minimal
    2 upgraded, 2 newly installed, 0 to remove and 74 not upgraded.
    Need to get 7,915 kB of archives.
    After this operation, 9,836 kB of additional disk space will be used.
    Do you want to continue [Y/n]? y
    WARNING: The following packages cannot be authenticated!
      python2.7 python2.7-minimal libpython2.7 gdb
    Install these packages without verification [y/N]? y
    Err http://us.archive.ubuntu.com/ubuntu/ precise-updates/main python2.7 amd64 2.7.3-0ubuntu3.8
      Could not connect to 192.168.0.0:59875 (192.168.0.0). - connect (101: Network is unreachable)
    Err http://us.archive.ubuntu.com/ubuntu/ precise-updates/main gdb amd64 7.4-2012.04-0ubuntu2.1
      Unable to connect to 192.168.0.0:59875:
    Err http://security.ubuntu.com/ubuntu/ precise-security/main python2.7 amd64 2.7.3-0ubuntu3.8
      Could not connect to 192.168.0.0:59875 (192.168.0.0). - connect (101: Network is unreachable)
    Err http://security.ubuntu.com/ubuntu/ precise-security/main python2.7-minimal amd64 2.7.3-0ubuntu3.8
      Unable to connect to 192.168.0.0:59875:
    Err http://security.ubuntu.com/ubuntu/ precise-security/main libpython2.7 amd64 2.7.3-0ubuntu3.8
      Unable to connect to 192.168.0.0:59875:
    Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python2.7/python2.7_2.7.3-0ubuntu3.8_amd64.deb  Could not connect to 192.168.0.0:59875 (192.168.0.0). - connect (101: Network is unreachable)
    Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python2.7/python2.7-minimal_2.7.3-0ubuntu3.8_amd64.deb  Unable to connect to 192.168.0.0:59875:
    Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python2.7/libpython2.7_2.7.3-0ubuntu3.8_amd64.deb  Unable to connect to 192.168.0.0:59875:
    Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/g/gdb/gdb_7.4-2012.04-0ubuntu2.1_amd64.deb  Unable to connect to 192.168.0.0:59875:
    E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
    

    Far as I can tell, there's some network configuration missing but I'm at a bit of a loss where. I can ping google.com and get a successful response so I'm a bit puzzled why security.ubuntu.com appears to be going out on 192.168.0.0

    This is what I see for ifconfig

    eth0      Link encap:Ethernet  HWaddr 08:00:27:0a:49:50  
              inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
              inet6 addr: fe80::a00:27ff:fe0a:4950/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:1134 errors:0 dropped:0 overruns:0 frame:0
              TX packets:914 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:147105 (147.1 KB)  TX bytes:523962 (523.9 KB)
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:208 errors:0 dropped:0 overruns:0 frame:0
              TX packets:208 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:10871 (10.8 KB)  TX bytes:10871 (10.8 KB)
    

    Any help would be much appreciated!

    UPDATE

    Tried adding

    config.vm.network "public_network", bridge: [
        "en0: Wi-Fi",
        "en3: Thunderbolt"
    ]
    

    But the issue persists.

    Here is routing table:

    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    default         10.0.2.2        0.0.0.0         UG    100    0        0 eth0
    10.0.2.0        *               255.255.255.0   U     0      0        0 eth0
    10.9.100.0      *               255.255.255.0   U     0      0        0 eth1
    

    I've also tried ping-ing the Ubuntu servers which looks fine:

    PING us.archive.ubuntu.com (91.189.91.24) 56(84) bytes of data.
    64 bytes from economy.canonical.com (91.189.91.24): icmp_req=1 ttl=63 time=84.5 ms
    64 bytes from economy.canonical.com (91.189.91.24): icmp_req=2 ttl=63 time=84.8 ms
    64 bytes from economy.canonical.com (91.189.91.24): icmp_req=3 ttl=63 time=84.5 ms
    64 bytes from economy.canonical.com (91.189.91.24): icmp_req=4 ttl=63 time=85.1 ms
    64 bytes from economy.canonical.com (91.189.91.24): icmp_req=5 ttl=63 time=83.9 ms
    64 bytes from economy.canonical.com (91.189.91.24): icmp_req=6 ttl=63 time=84.3 ms
    64 bytes from economy.canonical.com (91.189.91.24): icmp_req=7 ttl=63 time=84.3 ms
    64 bytes from economy.canonical.com (91.189.91.24): icmp_req=8 ttl=63 time=84.4 ms
    64 bytes from economy.canonical.com (91.189.91.24): icmp_req=9 ttl=63 time=84.5 ms
    64 bytes from economy.canonical.com (91.189.91.24): icmp_req=10 ttl=63 time=84.5 ms
    64 bytes from economy.canonical.com (91.189.91.24): icmp_req=11 ttl=63 time=83.9 ms
    64 bytes from economy.canonical.com (91.189.91.24): icmp_req=12 ttl=63 time=84.7 ms
    64 bytes from economy.canonical.com (91.189.91.24): icmp_req=13 ttl=63 time=84.8 ms
    64 bytes from economy.canonical.com (91.189.91.24): icmp_req=14 ttl=63 time=83.8 ms
    ^C
    --- us.archive.ubuntu.com ping statistics ---
    15 packets transmitted, 14 received, 6% packet loss, time 14024ms
    rtt min/avg/max/mdev = 83.827/84.460/85.102/0.499 ms
    
  • timothyclifford
    timothyclifford almost 9 years
    Still no luck, added to my question.
  • timothyclifford
    timothyclifford almost 9 years
    Yes it looks like I am, possibly setup by person who created the VM I suppose? Should I try without it?
  • timothyclifford
    timothyclifford almost 9 years
    Think I found it, in /etc/apt/apt.conf.d/01proxy I can see Acquire::https::Proxy "http://192.168.0.0:59875/
  • timothyclifford
    timothyclifford almost 9 years
    I tried removing this line but the proxy is still being used. Do I need to refresh apt configuration somehow? (sorry I'm still a bit new to *nix world)
  • timothyclifford
    timothyclifford almost 9 years
    Found it (not sure if best fix) but export http_proxy= seems to clear it out. Is there a better way?