¿Cómo consigo que apt-get update funcione en una máquina sin acceso a internet y con una dirección IP asignada manualmente?


19

He configurado apt-mirrory descargado los últimos paquetes de ubuntu con éxito en una máquina que puede acceder a internet. El objetivo es utilizar esta máquina como repositorio cuando se realiza apt-get updateen la máquina de destino que no puede acceder a Internet. Ambas máquinas se han configurado con direcciones IP manuales, y ambas máquinas se ejecutan con Ubuntu 16.04 como sistema operativo. El etc/apt/sources.listen la máquina de destino tiene solo 1 línea:

deb http://<local_repo_IP>/ubuntu/ xenial main restricted multiverse universe

Pero cuando lo hago sudo apt-get updateen la máquina de destino, aparece el siguiente error:

Ign:1 http://<local_repo_IP>/ubuntu/dists/xenial main InRelease
Ign:2 http://<local_repo_IP>/ubuntu/dists/xenial main Release
Ign:3 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted amd64 Packages
Ign:4 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted i386 Packages
Ign:5 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted all Packages
Ign:6 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en_HK
Ign:7 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en
Ign:8 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse amd64 Packages
Ign:9 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse i386 Packages
Ign:10 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse all Packages
Ign:11 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en_HK
Ign:12 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en
Ign:13 http://<local_repo_IP>/ubuntu/dists/xenial main/universe amd64 Packages
Ign:14 http://<local_repo_IP>/ubuntu/dists/xenial main/universe i386 Packages
Ign:15 http://<local_repo_IP>/ubuntu/dists/xenial main/universe all Packages
Ign:16 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en_HK
Ign:17 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en
Ign:3 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted amd64 Packages
Ign:4 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted i386 Packages
Ign:5 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted all Packages
Ign:6 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en_HK
Ign:7 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en
Ign:8 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse amd64 Packages
Ign:9 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse i386 Packages
Ign:10 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse all Packages
Ign:11 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en_HK
Ign:12 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en
Ign:13 http://<local_repo_IP>/ubuntu/dists/xenial main/universe amd64 Packages
Ign:14 http://<local_repo_IP>/ubuntu/dists/xenial main/universe i386 Packages
Ign:15 http://<local_repo_IP>/ubuntu/dists/xenial main/universe all Packages
Ign:16 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en_HK
Ign:17 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en
Ign:3 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted amd64 Packages
Ign:4 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted i386 Packages
Ign:5 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted all Packages
Ign:6 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en_HK
Ign:7 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en
Ign:8 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse amd64 Packages
Ign:9 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse i386 Packages
Ign:10 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse all Packages
Ign:11 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en_HK
Ign:12 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en
Ign:13 http://<local_repo_IP>/ubuntu/dists/xenial main/universe amd64 Packages
Ign:14 http://<local_repo_IP>/ubuntu/dists/xenial main/universe i386 Packages
Ign:15 http://<local_repo_IP>/ubuntu/dists/xenial main/universe all Packages
Ign:16 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en_HK
Ign:17 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en
Ign:3 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted amd64 Packages
Ign:4 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted i386 Packages
Ign:5 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted all Packages
Ign:6 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en_HK
Ign:7 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en
Ign:8 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse amd64 Packages
Ign:9 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse i386 Packages
Ign:10 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse all Packages
Ign:11 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en_HK
Ign:12 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en
Ign:13 http://<local_repo_IP>/ubuntu/dists/xenial main/universe amd64 Packages
Ign:14 http://<local_repo_IP>/ubuntu/dists/xenial main/universe i386 Packages
Ign:15 http://<local_repo_IP>/ubuntu/dists/xenial main/universe all Packages
Ign:16 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en_HK
Ign:17 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en
Ign:3 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted amd64 Packages
Ign:4 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted i386 Packages
Ign:5 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted all Packages
Ign:6 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en_HK
Ign:7 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en
Ign:8 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse amd64 Packages
Ign:9 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse i386 Packages
Ign:10 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse all Packages
Ign:11 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en_HK
Ign:12 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en
Ign:13 http://<local_repo_IP>/ubuntu/dists/xenial main/universe amd64 Packages
Ign:14 http://<local_repo_IP>/ubuntu/dists/xenial main/universe i386 Packages
Ign:15 http://<local_repo_IP>/ubuntu/dists/xenial main/universe all Packages
Ign:16 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en_HK
Ign:17 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en
Err:3 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted amd64 Packages
  404  Not Found
Ign:4 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted i386 Packages
Ign:5 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted all Packages
Ign:6 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en_HK
Ign:7 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en
Ign:8 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse amd64 Packages
Ign:9 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse i386 Packages
Ign:10 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse all Packages
Ign:11 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en_HK
Ign:12 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en
Ign:13 http://<local_repo_IP>/ubuntu/dists/xenial main/universe amd64 Packages
Reading package lists... Done
W: The repository 'http://<local_repo_IP>/ubuntu/dists/xenial main Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://<local_repo_IP>/ubuntu/dists/xenial/dists/main/restricted/binary-amd64/Packages  404  Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.

En la máquina de destino:

  1. El /etc/resolve.confarchivo contiene lo siguiente:

    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
    #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
    nameserver 127.0.1.1
    
  2. El /etc/network/interfacescontiene lo siguiente:

    # interfaces(5) file used by ifup(8) and ifdown(8)
    auto lo
    iface lo inet loopback
    

Además, dado que la única línea en la salida apt-get updateque dice explícitamente error es Err:3 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted amd64 Packages, verifiqué si el archivo existe haciendo lo siguiente en la máquina de destino

wget http://<local_repo_IP>/ubuntu/dists/xenial/restricted/binary-amd64/Packages

Y veo que el archivo está allí, ya que obtengo el siguiente resultado:

--2017-12-21 17:23:24--  http://<local_repo_IP>/ubuntu/dists/xenial/restricted/binary-amd64/Packages
Connecting to <local_repo_IP>:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 127112 (124K)
Saving to: ‘Packages’

Packages                100%[============================>] 124.13K  --.-KB/s    in 0s      

2017-12-21 17:23:24 (469 MB/s) - ‘Packages’ saved [127112/127112]

También verifiqué si puedo hacer ping con éxito desde la máquina de destino a la máquina de repositorio. Eso también funciona.

PING <local_repo_IP> (<local_repo_IP>) 56(84) bytes of data.
64 bytes from <local_repo_IP>: icmp_seq=1 ttl=64 time=0.169 ms
64 bytes from <local_repo_IP>: icmp_seq=2 ttl=64 time=0.671 ms
64 bytes from <local_repo_IP>: icmp_seq=3 ttl=64 time=0.186 ms
64 bytes from <local_repo_IP>: icmp_seq=4 ttl=64 time=0.190 ms
64 bytes from <local_repo_IP>: icmp_seq=5 ttl=64 time=0.315 ms
^C
--- <local_repo_IP> ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4047ms
rtt min/avg/max/mdev = 0.169/0.306/0.671/0.190 ms

Entonces, ¿qué tiene de malo apt-get update? ¿Cómo puedo solucionarlo y hacer que funcione?

PD : acabo de notar que el error dice http://<local_repo_IP>/ubuntu/dists/xenial/dists/main/restricted/binary-amd64/Packages. ¿Por qué intenta buscar restrictedpaquetes dentro de main? ¿No debería estar mirando http://<local_repo_IP>/ubuntu/dists/xenial/restricted/binary-amd64/Packages? De hecho, cuando lo hago wget http://<local_repo_IP>/ubuntu/dists/xenial/dists/main/restricted/binary-amd64/Packages, da el siguiente error:

--2017-12-21 17:26:06--  http://<local_repo_IP>/ubuntu/dists/xenial/dists/main/restricted/binary-amd64/Packages
Connecting to <local_repo_IP>:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-12-21 17:26:06 ERROR 404: Not Found.

¿Que está pasando aqui? ¿Por qué trata de buscar un directorio no existente? ¿Y cómo hago apt-get updatepara señalar el camino correcto?

Respuestas:


21

Encontré que la solución era editar el etc/apt/sources.listarchivo para incluir archivos de solo la arquitectura del sistema:

deb [arch=amd64] http://192.168.12.61/ubuntu/ xenial main restricted multiverse universe

Ahora cuando hago la actualización, no está dando ningún error:

$ sudo apt update
Hit:1 http://192.168.12.61/ubuntu xenial InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.

Solo pensé en publicar esto como una posible solución para cualquiera que pudiera tener el mismo problema.


77
Publicar una respuesta a su propia pregunta es absolutamente la forma correcta de hacerlo. En nombre de las personas que encontrarán esto en el futuro, ¡gracias!
Alex

1
También puede marcar esto como la solución.
topher

44
No creo que esto es lo que realmente resuelve su problema, teniendo en cuenta que lo que era un error para era un amd64archivo, y la restricción aamd64 casi no se puede hacer que desaparezca. ¿Es este el único cambio que realizó sources.listen otra configuración relacionada? ¿Vuelva a sincronizar su espejo antes de realizar este cambio?
muru

Estoy de acuerdo con @topher. Deberías marcar esto como una solución.
rockower

@muru Sí, este es el único cambio que hice, y no da ningún error después de eso. Y sí, estoy de acuerdo con usted en que no debería resolver el problema. Entonces, ¿alguna idea de por qué funcionó? Además, noté que la ruta en la que intentaba buscar (en el error) es incorrecta: debería buscar http://192.168.12.61/ubuntu/dists/xenial/restricted/binary-amd64/Packages, pero estaba buscando http://192.168.12.61/ubuntu/dists/xenial/dists/main/restricted/binary-amd64/Packages. ¿Por qué sería eso? ¿Y cómo la especificación de la arquitectura resolvió ese problema también?
Kristada673

0

mi opinión sobre el [amd-64] ... Si, por ejemplo, en su /etc/apt/sources.list ha habilitado las actualizaciones de google chrome deb [arch = amd64] http://dl.google. com / linux / chrome / deb / stable main

puedes ver que es la única entrada que tiene el [amd-64], y es de una fuente de google.

En su primera mención inicial de "deb http: // 192 ...", tal vez sus actualizaciones se estancaron cuando llegó a la mención sources.list de la actualización de Chrome, ya que no se mencionó específicamente como tal.

O mira la política sudo apt-cache , sources.list y sources.list.d

Eventualmente, puedo aventurarme y replicar esto en mi propio laboratorio, antes de responder más.

Al usar nuestro sitio, usted reconoce que ha leído y comprende nuestra Política de Cookies y Política de Privacidad.
Licensed under cc by-sa 3.0 with attribution required.