Eu configurei apt-cacher-ng
no meu laptop
cat /etc/apt/apt.conf.d/02proxy
Acquire::http { Proxy "http://localhost:3142"; };
Eu posso instalar um pacote, desligar a internet, remover o pacote e instalá-lo novamente.
find /var/cache/apt-cacher-ng -name "*komp*"
/var/cache/apt-cacher-ng/uburep/pool/universe/k/komparator
/var/cache/apt-cacher-ng/uburep/pool/universe/k/komparator/komparator_1.0-3_amd64.deb.head
/var/cache/apt-cacher-ng/uburep/pool/universe/k/komparator/komparator_1.0-3_amd64.deb
No entanto, em um chroot, não consigo instalar o mesmo pacote quando a internet está desativada.
Eu crio o chroot assim:
mkdir work
cd work
#This is a backup of a previous bootstrapped using --foreign
cp ../deboot.tgz .
sudo tar -xf deboot.tgz
sudo DEBOOTSTRAP_DIR=deboot/debootstrap/ debootstrap --second-stage --second-stage-target $(readlink -f deboot)
#Set locale settings in chroot
sudo chroot deboot locale-gen "en_US.UTF-8"
sudo chroot deboot dpkg-reconfigure --frontend=noninteractive locales
#Set apt cache proxy in chroot
echo 'Acquire::http { Proxy "http://127.0.0.1:3142"; };' | sudo tee deboot/etc/apt/apt.conf.d/00aptproxy
# mount the /proc filesystem in the chroot (required for managing processes)
sudo mount -o bind /proc deboot/proc
sudo chroot deboot
Agora, no chroot que eu faço:
cat etc/apt/apt.conf.d/00aptproxy
Acquire::http { Proxy "http://127.0.0.1:3142"; };
root@myhostname:/# apt-get install komparator
Reading package lists... Done
Building dependency tree... Done
E: Unable to locate package komparator
Se eu fizer apt-get update
no chroot, recebo o seguinte:
root@myhostname:/# apt-get update
Ign:1 http://archive.ubuntu.com/ubuntu zesty InRelease
Err:2 http://archive.ubuntu.com/ubuntu zesty Release
500 Connection failure: Network is unreachable
Reading package lists... Done
E: The repository 'http://archive.ubuntu.com/ubuntu zesty Release' does no longer have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Como eu faço o chroot instalar pacotes usando o apt-cacher-ng no host?