SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a problem with selecting fastest mirror for slackpkg. It seems that nearest mirror is not always the best as Turkey and Greece mirrors doesn't provide good speed and also suffer from occasional disconnecting on my system.
I wonder is there a specific tool for selecting best mirror for slackpkg? something like netselect-apt for debian or mirrorselect for gentoo?
You could make a script to grep all the mirrors from the mirrors file and then ping each one of them in a loop while reporting back the results and then use something like sort to have the fastest at the top.
You can also try using mirrors.slackware.com as your mirror.
Thanks
I have to read some documents as I am not familiar with ping.
I didn't understand your point. Do you mean adding http://mirrors.slackware.com/ to /etc/slackpkg/mirrors or choosing one of the mirrors from available mirrors section?
Quote:
Originally Posted by orbea
You could make a script to grep all the mirrors from the mirrors file and then ping each one of them in a loop while reporting back the results and then use something like sort to have the fastest at the top.
Unfortunately I don't have enough time to learn bash scripting. It is in my long to do list though. Anyway, thanks for your instruction.
I have a problem with selecting fastest mirror for slackpkg. It seems that nearest mirror is not always the best as Turkey and Greece mirrors doesn't provide good speed and also suffer from occasional disconnecting on my system.
I wonder is there a specific tool for selecting best mirror for slackpkg?
Distributions like Arch or Gentoo - who depend heavily on mirror sites - have such a tool (respectively mirrorlist and mirrorselect). Maybe someone should port this to Slackware. Here, it's mainly trial and error. Though I live in South France, I never use the french mirrors because they're quite erratic. After trying out various countries like Austria, Germany and Switzerland, I settled with a mirror in Finland that always seems to work perfectly.
Distribution: Slint64-14.2.1.2 on Lenovo Thinkpad W520
Posts: 9,831
Rep:
My understanding is that mirrors.slackware.com is somehow a "meta-mirror" that redirects the download requests using mirrorbrain to handle the traffic and share it between mirrors.
I do not know how load balancing is configured in case of mirrors.slackware.com, but I assume that the mirrors' locations is one of the main parameters to be considered.
For that reason I am not sure that travis82's issue can be solved setting it in /etc/slackpkg/mirrors, But that's certainly worth trying.
@Hosein: could you please try it if not already done, see if that makes a difference and report here?
Also, if Robby Workman reads this thread, I hope he will shed some light.
Last edited by Didier Spaier; 12-27-2015 at 08:40 AM.
Reason: Typo fix.
Distributions like Arch or Gentoo - who depend heavily on mirror sites - have such a tool (respectively mirrorlist and mirrorselect). Maybe someone should port this to Slackware.
I did look at the code for mirrorselect after the post by Bertman123 in the MLED forum. The basic version does little else then feeding a mirrorlist to netselect, which is made overly complex by all the bells and wishles common to Gentoo.
So for Slackware it is probably a lot easier than it sounds with the mirrorlist being a plain text-file already, first step would be to get netselect working and then it is a matter of output parsing as the best server is the one on the last line of the netselect output.
I tested mirrors.slackware.com. According to slackpkg/mirror it finds a nearby mirror. The odd thing is that it selected http://hkg.mirror.rackspace.com/slackware/ in Hong Kong as nearest mirror (perhaps I am living in China, I don't know). Anyway, my experience with hk mirror is horrible.
I guess I have to check all available slackware mirrors by ping.
This will get you a list of mirrors and the speed it takes to wget their index.html which could narrow down a fast mirror, I haven't figured out how to sort the output well yet... Don't forget to pass SLVER=14.1 if you aren't using current or just edit the SLKVER line in the script.
Code:
#! /bin/sh
SLKVER=${SLKVER:-current}
TMP=${TMP:-/tmp}
FILE=$TMP/mirrorlist
SED=$TMP/$SLKVER-mirrors
SLKMIR=/etc/slackpkg/mirrors
if [ $SLKVER = "current" ]; then
sed -ne '/current/,$p' $SLKMIR > $SED
else
sed -e '/current/,$d' $SLKMIR > $SED
fi
trap 'rm -f $FILE $SED' EXIT
for i in $(cat $SED | grep '\<[a-z]*://[^/]*' | sed 's/# //;/cdrom/d;/Project/d;/file/d'); do
echo "$i"
wget -T 5 --tries=1 -O/dev/null "$i" 2>&1 | grep -o "[0-9.]\+ [KM]*B/s"
done > $FILE
cat $FILE
Distribution: Slint64-14.2.1.2 on Lenovo Thinkpad W520
Posts: 9,831
Rep:
Another solution with ping. This is a draft, of course.
Only mirrors with 0 packet loss are listed.
Results can vary upon time needed for name resolution. Use a good name server.
Sort criteria: minimum response time, fastest at the bottom to avoid scrolling.
Code:
#!/bin/sh
TMPFILE=$(mktemp) || exit 1
VERSION=${VERSION:-14.1}
for i in $(grep $VERSION /etc/slackpkg/mirrors |\
sed -n 's@\(# \)\{0,1\}[hf]t\{1,2\}ps\{0,1\}://\([^/]\{1,\}\).*@\2@p' |\
sort -u); do
printf "."
ping -c 4 -i 0.2 -q -W 1 $i >> $TMPFILE 2>/dev/null
done
echo
# Display a table:
# Field #1 Field #2
# hostname rtt min
# sorted by rtt min decreasing
< $TMPFILE \
sed -n '
/^---/{
N
# Next line, check that there be a percent sign after the zero
# This LQ editor still eat it every time I edit this post if not in advanced mode...
/ 0%/{
N
s/^--- //
s@\n@@g
s/ping [^=]\{1,\}//
s@/.*@@
s/ =//
s/\([[:graph:]]\{1,\}\) \([[:graph:]]\{1,\}\)/\2 \1/p
}
}' |\
sort -nr
rm -f $TMPFILE
EDIT. Sorry for the BREs harder to read, but the POSIX specification only mandates that a compliant sed supports this kind, although it could be hard to find an implementation that does not support EREs in addition.
Last edited by Didier Spaier; 12-28-2015 at 04:39 AM.
Reason: EDIT added and minor changes
Distribution: Slint64-14.2.1.2 on Lenovo Thinkpad W520
Posts: 9,831
Rep:
Quote:
Originally Posted by travis82
@Didier
What do you mean by "use a good name server"?
To ping or access a server (a mirror, in this case), we need to have its domain name translated to the corresponding IP address.
For that we query one of the name servers whose IP addresses are listed in /etc/resolv.conf.
But, if that name server is slow to respond for any reason, this will delay access to the mirror.
Even worse, if the name server is buggy or its cache not updated, this can make the mirror unreachable, unless you know its IP address and use it instead of the domain name.
I have sometimes used Google's public DNS addresses 8.8.8.8 and 4.4.4.4 as they are reliable.
For that you can just write your /etc/resolv.conf like this:
According to these output the best mirror for my connection is ftp.gwdg.de in Germany (correct me if I am wrong). I uncomment it in slackpkg mirrors file and it works fine (at least at the moment). I didn't touch /etc/resolve.conf though.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.