Search code examples
perlcpan

How do I stop CPAN from accessing an unresponsive package repository?


I tried to install a package. It's failing connecting to soft-download.org. I don't know why it's trying to connect to that host.

$ cpan install Config::IniFiles
Loading internal null logger. Install Log::Log4perl for logging messages
CPAN: Storable loaded ok (v2.53_01)
Reading '/home/Chloe/.cpan/Metadata'
  Database was generated on Sat, 24 Dec 2016 20:17:02 GMT
Running install for module 'Config::IniFiles'
CPAN: LWP::UserAgent loaded ok (v6.15)
CPAN: Time::HiRes loaded ok (v1.9732)
Fetching with LWP:
http://soft-download.org/authors/id/S/SH/SHLOMIF/Config-IniFiles-2.94.tar.gz
LWP failed with code[500] message[Can't connect to soft-download.org:80]

Trying with
    /usr/bin/wget -O "/home/Chloe/.cpan/sources/authors/id/S/SH/SHLOMIF/Config-IniFiles-2.94.tar.gz.tmp11320"
to get
    http://soft-download.org/authors/id/S/SH/SHLOMIF/Config-IniFiles-2.94.tar.gz
--2016-12-24 16:19:24--  http://soft-download.org/authors/id/S/SH/SHLOMIF/Config-IniFiles-2.94.tar.gz
Resolving soft-download.org (soft-download.org)... 204.45.81.83
Connecting to soft-download.org (soft-download.org)|204.45.81.83|:80... failed: Connection timed out.
Retrying.

--2016-12-24 16:19:46--  (try: 2)  http://soft-download.org/authors/id/S/SH/SHLOMIF/Config-IniFiles-2.94.tar.gz
Connecting to soft-download.org (soft-download.org)|204.45.81.83|:80... failed: Connection timed out.
Retrying.

--2016-12-24 16:20:09--  (try: 3)  http://soft-download.org/authors/id/S/SH/SHLOMIF/Config-IniFiles-2.94.tar.gz
Connecting to soft-download.org (soft-download.org)|204.45.81.83|:80... failed: Connection timed out.
Retrying.

I tried to reload the index, but it still tries to access soft-download.org.

cpan[2]> reload index
CPAN: Storable loaded ok (v2.53_01)
Reading '/home/Chloe/.cpan/Metadata'
  Database was generated on Sat, 24 Dec 2016 20:17:02 GMT
CPAN: LWP::UserAgent loaded ok (v6.15)
CPAN: Time::HiRes loaded ok (v1.9732)
Fetching with LWP:
http://soft-download.org/authors/01mailrc.txt.gz
LWP failed with code[500] message[Can't connect to soft-download.org:80]

Trying with
    /usr/bin/wget -O "/home/Chloe/.cpan/sources/authors/01mailrc.txt.gz.tmp14304"
to get
    http://soft-download.org/authors/01mailrc.txt.gz
--2016-12-24 16:27:15--  http://soft-download.org/authors/01mailrc.txt.gz
Resolving soft-download.org (soft-download.org)... 204.45.81.83
Connecting to soft-download.org (soft-download.org)|204.45.81.83|:80...

Solution

  • Solution 1: Remove the bad repository

    Run cpan with no arguments, then enter

    o conf urllist
    

    This is will lists the repositories to use.

    urllist
        0 [http://good1/]
        1 [http://good2/]
        2 [http://bad/]
    

    Re-enter the repositories without the bad one as follows:

    o conf urllist http://good1/ http://good2/
    

    Finally, save your changes as follows:

    o conf commit
    

    Solution 2: Find the repositories that are the fastest for you

    Run cpan with no arguments, then enter

    o conf init urllist
    

    When asked "Would you like me to automatically choose some CPAN mirror sites for you?", press Enter.

    Finally, save your changes as follows:

    o conf commit
    

    Solution 3: Find repositories by region

    Run cpan with no arguments, then enter

    o conf init urllist
    

    When asked "Would you like me to automatically choose some CPAN mirror sites for you?", enter no.

    When asked "Would you like to edit the urllist or pick new mirrors from a list?", press Enter.

    When asked "Shall I use the cached mirror list?", enter no.

    Select mirrors as directed by the prompt.

    Finally, save your changes as follows:

    o conf commit