Galat “Tidak dapat terhubung” dengan apt-get?

10

Saya baru-baru ini menginstal 12,04 tetapi saya tidak dapat menjalankan sudo apt-get updatedan akibatnya sudo apt-get install xxx. Ketika saya menjalankan perintah pertama saya mendapatkan beberapa

Ign http://extras.ubuntu.com precise InRelease

dan

Err http://extras.ubuntu.com precise release.gpg Unable to connect to extras.ubuntu.com

Ini berfungsi dengan baik untuk wget extras.ubuntu.com.

Saya /etc/apt/sources.listadalah file asli dengan cermin Swedia se.archive.ubuntu.com/ubuntu. Untuk apa nilainya, saya telah mencoba mirror lain dengan hasil yang sama. Source.list saya dapat ditemukan di sini .

Memperbarui

Saya sadar bahwa ada banyak pertanyaan seperti ini, tidak ada yang membantu saya. Saya melakukan perintah berikut tanpa perubahan hasil.

sudo mv /etc/apt/sources.list /etc/apt/sources.list.backup
sudo vi /etc/apt/sources.list

dan disisipkan

################### OFFICIAL UBUNTU REPOS ###################
###### Ubuntu Main Repos
deb http://se.archive.ubuntu.com/ubuntu/ precise main 
deb-src http://se.archive.ubuntu.com/ubuntu/ precise main

###### Ubuntu Update Repos
deb http://se.archive.ubuntu.com/ubuntu/ precise-security main 
deb http://se.archive.ubuntu.com/ubuntu/ precise-updates main 
deb http://se.archive.ubuntu.com/ubuntu/ precise-proposed main 
deb http://se.archive.ubuntu.com/ubuntu/ precise-backports main 
deb-src http://se.archive.ubuntu.com/ubuntu/ precise-security main 
deb-src http://se.archive.ubuntu.com/ubuntu/ precise-updates main 
deb-src http://se.archive.ubuntu.com/ubuntu/ precise-proposed main 
deb-src http://se.archive.ubuntu.com/ubuntu/ precise-backports main

Output dari wget -S --spider http://extras.ubuntu.com

Spider mode enabled. Check if remote file exists.
--2012-07-16 14:06:21--  http://extras.ubuntu.com/
Resolving ...
Connecting to ... connected.
Proxy request sent, awaiting response... 
  HTTP/1.1 200 OK
  Date: Mon, 16 Jul 2012 10:05:19 GMT
  Server: Apache/2.2.8 (Ubuntu)
  Content-Type: text/html;charset=UTF-8
  Connection: close
Length: unspecified [text/html]
Remote file exists and could contain further links,
but recursion is disabled -- not retrieving.

Output dari apt-config dump

APT "";
APT::Architecture "i386";
APT::Build-Essential "";
APT::Build-Essential:: "build-essential";
APT::Install-Recommends "1";
APT::Install-Suggests "0";
APT::Authentication "";
APT::Authentication::TrustCDROM "true";
APT::NeverAutoRemove "";
APT::NeverAutoRemove:: "^firmware-linux.*";
APT::NeverAutoRemove:: "^linux-firmware$";
APT::NeverAutoRemove:: "^linux-image.*";
APT::NeverAutoRemove:: "^kfreebsd-image.*";
APT::NeverAutoRemove:: "^linux-restricted-modules.*";
APT::NeverAutoRemove:: "^linux-ubuntu-modules-.*";
APT::NeverAutoRemove:: "^gnumach$";
APT::NeverAutoRemove:: "^gnumach-image.*";
APT::Never-MarkAuto-Sections "";
APT::Never-MarkAuto-Sections:: "metapackages";
APT::Never-MarkAuto-Sections:: "restricted/metapackages";
APT::Never-MarkAuto-Sections:: "universe/metapackages";
APT::Never-MarkAuto-Sections:: "multiverse/metapackages";
APT::Never-MarkAuto-Sections:: "oldlibs";
APT::Never-MarkAuto-Sections:: "restricted/oldlibs";
APT::Never-MarkAuto-Sections:: "universe/oldlibs";
APT::Never-MarkAuto-Sections:: "multiverse/oldlibs";
APT::Periodic "";
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "0";
APT::Periodic::AutocleanInterval "0";
APT::Update "";
APT::Update::Post-Invoke-Success "";
APT::Update::Post-Invoke-Success:: "touch /var/lib/apt/periodic/update-success-stamp 2>/dev/null || true";
APT::Update::Post-Invoke-Success:: "[ ! -f /var/run/dbus/system_bus_socket ] || /usr/bin/dbus-send --system --dest=org.debian.apt --type=signal /org/debian/apt org.debian.apt.CacheChanged || true";
APT::Archives "";
APT::Archives::MaxAge "30";
APT::Archives::MinAge "2";
APT::Archives::MaxSize "500";
APT::Changelogs "";
APT::Changelogs::Server "http://changelogs.ubuntu.com/changelogs";
APT::Architectures "";
APT::Architectures:: "i386";
APT::Compressor "";
APT::Compressor::. "";
APT::Compressor::.::Name ".";
APT::Compressor::.::Extension "";
APT::Compressor::.::Binary "";
APT::Compressor::.::Cost "1";
APT::Compressor::.::CompressArg "";
APT::Compressor::.::CompressArg:: "";
APT::Compressor::.::UncompressArg "";
APT::Compressor::.::UncompressArg:: "";
APT::Compressor::gzip "";
APT::Compressor::gzip::Name "gzip";
APT::Compressor::gzip::Extension ".gz";
APT::Compressor::gzip::Binary "gzip";
APT::Compressor::gzip::Cost "2";
APT::Compressor::gzip::CompressArg "";
APT::Compressor::gzip::CompressArg:: "-9n";
APT::Compressor::gzip::UncompressArg "";
APT::Compressor::gzip::UncompressArg:: "-d";
APT::Compressor::bzip2 "";
APT::Compressor::bzip2::Name "bzip2";
APT::Compressor::bzip2::Extension ".bz2";
APT::Compressor::bzip2::Binary "bzip2";
APT::Compressor::bzip2::Cost "3";
APT::Compressor::bzip2::CompressArg "";
APT::Compressor::bzip2::CompressArg:: "-9";
APT::Compressor::bzip2::UncompressArg "";
APT::Compressor::bzip2::UncompressArg:: "-d";
APT::Compressor::lzma "";
APT::Compressor::lzma::Name "lzma";
APT::Compressor::lzma::Extension ".lzma";
APT::Compressor::lzma::Binary "lzma";
APT::Compressor::lzma::Cost "4";
APT::Compressor::lzma::CompressArg "";
APT::Compressor::lzma::CompressArg:: "-9";
APT::Compressor::lzma::UncompressArg "";
APT::Compressor::lzma::UncompressArg:: "-d";
APT::Compressor::xz "";
APT::Compressor::xz::Name "xz";
APT::Compressor::xz::Extension ".xz";
APT::Compressor::xz::Binary "xz";
APT::Compressor::xz::Cost "5";
APT::Compressor::xz::CompressArg "";
APT::Compressor::xz::CompressArg:: "-6";
APT::Compressor::xz::UncompressArg "";
APT::Compressor::xz::UncompressArg:: "-d";
Dir "/";
Dir::State "var/lib/apt/";
Dir::State::lists "lists/";
Dir::State::cdroms "cdroms.list";
Dir::State::mirrors "mirrors/";
Dir::State::extended_states "extended_states";
Dir::State::status "/var/lib/dpkg/status";
Dir::Cache "var/cache/apt/";
Dir::Cache::archives "archives/";
Dir::Cache::srcpkgcache "srcpkgcache.bin";
Dir::Cache::pkgcache "pkgcache.bin";
Dir::Etc "etc/apt/";
Dir::Etc::sourcelist "sources.list";
Dir::Etc::sourceparts "sources.list.d";
Dir::Etc::vendorlist "vendors.list";
Dir::Etc::vendorparts "vendors.list.d";
Dir::Etc::main "apt.conf";
Dir::Etc::netrc "auth.conf";
Dir::Etc::parts "apt.conf.d";
Dir::Etc::preferences "preferences";
Dir::Etc::preferencesparts "preferences.d";
Dir::Etc::trusted "trusted.gpg";
Dir::Etc::trustedparts "trusted.gpg.d";
Dir::Bin "";
Dir::Bin::methods "/usr/lib/apt/methods";
Dir::Bin::solvers "";
Dir::Bin::solvers:: "/usr/lib/apt/solvers";
Dir::Bin::dpkg "/usr/bin/dpkg";
Dir::Bin::lzma "/usr/bin/lzma";
Dir::Bin::xz "/usr/bin/xz";
Dir::Bin::bzip2 "/bin/bzip2";
Dir::Media "";
Dir::Media::MountPath "/media/apt";
Dir::Log "var/log/apt";
Dir::Log::Terminal "term.log";
Dir::Log::History "history.log";
Dir::Ignore-Files-Silently "";
Dir::Ignore-Files-Silently:: "~$";
Dir::Ignore-Files-Silently:: "\.disabled$";
Dir::Ignore-Files-Silently:: "\.bak$";
Dir::Ignore-Files-Silently:: "\.dpkg-[a-z]+$";
Dir::Ignore-Files-Silently:: "\.save$";
Dir::Ignore-Files-Silently:: "\.orig$";
Dir::Ignore-Files-Silently:: "\.distUpgrade$";
Acquire "";
Acquire::cdrom "";
Acquire::cdrom::mount "/media/cdrom/";
Acquire::Languages "";
Acquire::Languages:: "en_US";
Acquire::Languages:: "en";
Acquire::Languages:: "none";
Aptitude "";
Aptitude::Get-Root-Command "sudo:/usr/bin/sudo";
Unattended-Upgrade "";
Unattended-Upgrade::Allowed-Origins "";
Unattended-Upgrade::Allowed-Origins:: "${distro_id}:${distro_codename}-security";
DPkg "";
DPkg::Pre-Install-Pkgs "";
DPkg::Pre-Install-Pkgs:: "/usr/sbin/dpkg-preconfigure --apt || true";
DPkg::Post-Invoke "";
DPkg::Post-Invoke:: "if [ -d /var/lib/update-notifier ]; then touch /var/lib/update-notifier/dpkg-run-stamp; fi; if [ -e /var/lib/update-notifier/updates-available ]; then echo > /var/lib/update-notifier/updates-available; fi ";
CommandLine "";
CommandLine::AsString "apt-config dump";
Geronimo
sumber
Silakan berbagi konten atau output dari berikut perintah / file untuk lebih membantu kami memecahkan masalah Anda ( petunjuk dalam jawaban ini ) : file (s): /etc/apt/sources.list, perintah (s): wget -S --spider http://extras.ubuntu.com,apt-config dump
ish
@izx Pertanyaan dijawab, silakan lihat sunting
Geronimo

Jawaban:

13

apt-get tidak mematuhi pengaturan proxy di seluruh sistem Anda.

  • Buat file bernama 95proxiesdalam /etc/apt/apt.conf.d/, dan termasuk berikut:

    Acquire :: http :: proxy "http://www-proxy.ericsson.se:8080/";
    Acquire :: ftp :: proxy "ftp://www-proxy.ericsson.se:8080/";
    Acquire :: https :: proxy "https://www-proxy.ericsson.se:8080/";
    

Terakhir, logout dan reboot untuk memastikan perubahannya berlaku.

Mudah-mudahan itu akan memperbaiki masalah apt-get Anda "tidak dapat terhubung".

ish
sumber
1
Astaga, ini berhasil. Anda tahu barang-barang Anda!
Geronimo
1
@ Geronimo: Senang telah membantu. Dengan izin Anda, bolehkah saya mengedit pertanyaan Anda nanti untuk membuatnya lebih umum "Saya punya proxy tetapi apt-get tidak berfungsi" - Saya telah melihat banyak orang di balik firewall perusahaan memiliki masalah ini?
ish
1
ya tentu, jadilah tamuku. Juga, mungkin Anda bisa menjelaskan file 95proxies ini, saya tidak ingat memiliki masalah dengan mesin Ubuntu 10.10 saya yang lama. Sekali lagi terima kasih atas kerja yang luar biasa!
Geronimo
1
Saya mendapatkan kesalahan berikut Could not resolve 'www-proxy.ericsson.se'ide apa pun?
RafaSashi
@RafaSashi haruslah proxy Anda. Jika Anda memiliki mesin lain yang berfungsi di belakang proxy yang dapat Anda gunakan echo $HTTP_PROXYuntuk menemukan nama dan menyalinnya ke dalam file menggunakan format di atas. Saya memiliki masalah yang sama dan itu menyelesaikannya untuk saya.
con--