Author Topic: [wiki]Allservers script: Rank Mirrors, Upgrade System, Maintain Cache, rm db.lck  (Read 34501 times)

0 Members and 1 Guest are viewing this topic.

Offline handy

  • Global Moderator
  • *****
  • Posts: 5738
  • Desktop: Openbox 3.6.1-3 & Worker :)
  • GPU Card: intel...
  • GPU driver: open-source
  • Kernel: OpenBSD
  • Skill: Intermediate
No, it uses the mirrors that are in your /etc/pacman.d/mirrors/ directory. Or, if you have made the Custom file that has the half a dozen or so of your fastest mirrors listed in it, it will use that Custom file.

To make a Custom file all you need to do is use sudo to open your favourite editor with two files open: /etc/pacman.d/mirrorlist & the new file /etc/pacman.d/mirrors/Custom

Then highlight the top 6 or more servers in your mirrorlist (they are listed fastest at the top, slowest at the bottom) then copy those that you highlighted into your new /etc/pacman.d/mirrors/Custom file.

Above the first server listing in your new Custom file type this [Custom]

Save the /etc/pacman.d/mirrors/Custom file & close it.

Close the /etc/pacman.d/mirrorlist also.

Now (still need sudo - root access) in your editor open /etc/pacman-mirrors.conf & make it look like this with whatever branch - stable, testing, unstable that you currently use:

Code: [Select]
##
## /etc/pacman-mirrors.conf
##

## Branch Pacman should use (stable, testing, unstable)
Branch=stable
## Generation method
## 1) rank   - rank mirrors depending on their access time
## 2) random - randomly generate the output mirrorlist
Method=rank

## Specify to use only mirrors from a specific country
## Disabled by default
 OnlyCountry=Custom

## Input mirrorlist directory
MirrorlistsDir="/etc/pacman.d/mirrors"

## Output mirrorlist
OutputMirrorlist="/etc/pacman.d/mirrorlist"

That's it. After that when pacman-mirrors -g runs, it will be so much quicker as it has only your chosen half dozen or so mirrors to go through, instead of approaching 40 last time I counted.
« Last Edit: 01. July 2013, 18:30:24 by handy »
The ultimate tyranny in a society is not control
by martial law. It is control by the psychological
manipulation of consciousness, through which reality
is defined so that those who exist within do not even
realize that they are in prison.
  —  Barbara Marciniak

Offline moumin

  • Vollwertiges Mitglied
  • ***
  • Posts: 150
  • Branch: stable
  • Desktop: xfce 4.10
  • GPU Card: intel
  • GPU driver: free
  • Kernel: linux312-x64
  • Skill: Novice
I did the custom file as you said, and here is the result after sudo pacman-mirrors -g:

:: Querying servers, this may take some time...
:: Only country: Custom

:: No Servers found! Falling back to random generation method.
:: Only country: Custom
:: Generated and saved '/etc/pacman.d/mirrorlist' mirrorlist.

is this what should be?!

Offline moumin

  • Vollwertiges Mitglied
  • ***
  • Posts: 150
  • Branch: stable
  • Desktop: xfce 4.10
  • GPU Card: intel
  • GPU driver: free
  • Kernel: linux312-x64
  • Skill: Novice
sudo pacman -Syu
:: Synchronizing package databases...
error: failed to update core (no servers configured for repository)
error: failed to update extra (no servers configured for repository)
error: failed to update community (no servers configured for repository)
error: failed to update multilib (no servers configured for repository)
error: failed to synchronize any databases
error: failed to init transaction (no servers configured for repository)

Offline moumin

  • Vollwertiges Mitglied
  • ***
  • Posts: 150
  • Branch: stable
  • Desktop: xfce 4.10
  • GPU Card: intel
  • GPU driver: free
  • Kernel: linux312-x64
  • Skill: Novice
I wanted to tell you that each time i sudo pacman-mirrors -g, servers names change, looks like i really don't have top mirror servers as these keep  changing everytime i sudo pacman-mirrors -g.
Back to the original settings :(

Offline Culinax

  • Support Team
  • ****
  • Posts: 1146
  • Branch: Unstable
  • Desktop: Awesome 3.5
  • GPU Card: NVIDIA GeForce 710M - Intel (Optimus)
  • GPU driver: Free Driver
  • Kernel: Linux315-x64
  • Skill: Intermediate
Did you put mirrors in the /etc/pacman.d/mirrors/Custom file? Did you forget to place [Custom] on top of the file? Take a look at the example in this post: http://forum.manjaro.org/index.php?topic=5287.msg46192#msg46192
Manjaro Awesome WM Respin: Current version: 0.8.10
Belgian/Dutch Manjaro Linux users: unite! http://manjaro-nl.org/ | IRC: #manjaro-nl

Offline moumin

  • Vollwertiges Mitglied
  • ***
  • Posts: 150
  • Branch: stable
  • Desktop: xfce 4.10
  • GPU Card: intel
  • GPU driver: free
  • Kernel: linux312-x64
  • Skill: Novice
Did you put mirrors in the /etc/pacman.d/mirrors/Custom file? Did you forget to place [Custom] on top of the file? Take a look at the example in this post: http://forum.manjaro.org/index.php?topic=5287.msg46192#msg46192
I missed the right file path, yet after doing everythin right this time:
:: Querying servers, this may take some time...
:: Only country: Custom
 -> timeout http://manjaro.mirror.ac.za/stable/$repo/$arch
 -> timeout http://mirrors.ispros.com.bd/manjaro/stable/$repo/$arch
 -> timeout http://ftp.belnet.be/manjaro/stable/$repo/$arch
 -> timeout http://manjaro.fis.unb.br/stable/$repo/$arch
 -> timeout http://www.las.ic.unicamp.br/pub/manjarolinux/stable/$repo/$arch
 -> timeout http://mirror.bjtu.edu.cn/manjaro/stable/$repo/$arch
 -> timeout http://mirrors.ustc.edu.cn/manjaro/stable/$repo/$arch
 -> timeout http://ftp.belnet.be/manjaro/stable/$repo/$arch
 -> timeout http://manjaro.mirror.ac.za/stable/$repo/$arch
 -> timeout http://mirrors.ispros.com.bd/manjaro/stable/$repo/$arch
 -> timeout http://ftp.belnet.be/manjaro/stable/$repo/$arch
 -> timeout http://manjaro.fis.unb.br/stable/$repo/$arch
 -> timeout http://www.las.ic.unicamp.br/pub/manjarolinux/stable/$repo/$arch
 -> timeout http://mirror.bjtu.edu.cn/manjaro/stable/$repo/$arch
 -> timeout http://mirrors.ustc.edu.cn/manjaro/stable/$repo/$arch
 -> timeout http://mirrors.dotsrc.org/manjaro/stable/$repo/$arch

:: No Servers found! Falling back to random generation method.
:: Only country: Custom
 -> http://manjaro.mirror.ac.za/stable/$repo/$arch
 -> http://mirrors.ispros.com.bd/manjaro/stable/$repo/$arch
 -> http://ftp.belnet.be/manjaro/stable/$repo/$arch
 -> http://manjaro.fis.unb.br/stable/$repo/$arch
 -> http://www.las.ic.unicamp.br/pub/manjarolinux/stable/$repo/$arch
 -> http://mirror.bjtu.edu.cn/manjaro/stable/$repo/$arch
 -> http://mirrors.ustc.edu.cn/manjaro/stable/$repo/$arch
 -> http://ftp.belnet.be/manjaro/stable/$repo/$arch
 -> http://manjaro.mirror.ac.za/stable/$repo/$arch
 -> http://mirrors.ispros.com.bd/manjaro/stable/$repo/$arch
 -> http://ftp.belnet.be/manjaro/stable/$repo/$arch
 -> http://manjaro.fis.unb.br/stable/$repo/$arch
 -> http://www.las.ic.unicamp.br/pub/manjarolinux/stable/$repo/$arch
 -> http://mirror.bjtu.edu.cn/manjaro/stable/$repo/$arch
 -> http://mirrors.ustc.edu.cn/manjaro/stable/$repo/$arch
 -> http://mirrors.dotsrc.org/manjaro/stable/$repo/$arch
:: Generated and saved '/etc/pacman.d/mirrorlist' mirrorlist.
 It looks like my top mirrors in mirror list, keep changeing everytime I use pacman-mirrors -g, so i really don't have favorite mirrors to put in a custom file :(.
back to the normal way.
« Last Edit: 02. July 2013, 00:50:51 by moumin »

Offline handy

  • Global Moderator
  • *****
  • Posts: 5738
  • Desktop: Openbox 3.6.1-3 & Worker :)
  • GPU Card: intel...
  • GPU driver: open-source
  • Kernel: OpenBSD
  • Skill: Intermediate
The speed of the mirrors DO change. That is why we do a speed ranking of them to get the fastest one at the time.

The demand on servers varies a great deal, depending on the time of day that it is in different parts of the world. At certain times people are mostly asleep, at other times all of the kids have got out of school & hit the internet hard, or it is school holidays, apart from times of the day that are very busy & others that are slow.

So, you expect there to be changes, it is normal. I could do 3 pacman-mirrors -g one after the other & have different results.
The ultimate tyranny in a society is not control
by martial law. It is control by the psychological
manipulation of consciousness, through which reality
is defined so that those who exist within do not even
realize that they are in prison.
  —  Barbara Marciniak

Offline moumin

  • Vollwertiges Mitglied
  • ***
  • Posts: 150
  • Branch: stable
  • Desktop: xfce 4.10
  • GPU Card: intel
  • GPU driver: free
  • Kernel: linux312-x64
  • Skill: Novice
https://aur.archlinux.org/packages/?O=0&K=cacheclean

now this script is outdated as cacheclean is replaced with pkgcacheclean...  :P ;) :)

Offline handy

  • Global Moderator
  • *****
  • Posts: 5738
  • Desktop: Openbox 3.6.1-3 & Worker :)
  • GPU Card: intel...
  • GPU driver: open-source
  • Kernel: OpenBSD
  • Skill: Intermediate
« Last Edit: 17. November 2013, 05:07:16 by handy »
The ultimate tyranny in a society is not control
by martial law. It is control by the psychological
manipulation of consciousness, through which reality
is defined so that those who exist within do not even
realize that they are in prison.
  —  Barbara Marciniak

Offline FadeMind

  • Support Team
  • ****
  • Posts: 2331
    • gravatar
  • Branch: Arch x86_64
  • Desktop: Plasma 5
  • GPU Card: Intel + NVIDIA
  • GPU driver: Intel + NVIDIA
  • Kernel: linux
  • Skill: Intermediate
Re: [How-To] Script & system mod's to rank mirrors & upgrade system...
« Reply #39 on: 06. October 2013, 22:40:35 »
Guys  :)
In the initial command Allservers.sh script is a typo error.
Wiki website
Bad command in wiki looks like this:
Code: [Select]
if  `whoami` != "root" ;
then
  err "Must use 'sudo su' before you run this script."
  exit
fi
Correct command looks like this:
Code: [Select]
if [ "$(whoami)" != "root" ]; then
  err "Must use 'sudo su' before you run this script."
  exit
fi

Offline handy

  • Global Moderator
  • *****
  • Posts: 5738
  • Desktop: Openbox 3.6.1-3 & Worker :)
  • GPU Card: intel...
  • GPU driver: open-source
  • Kernel: OpenBSD
  • Skill: Intermediate
Re: [How-To] Script & system mod's to rank mirrors & upgrade system...
« Reply #40 on: 07. October 2013, 00:00:16 »
It works as it is, but I'll change it, as I'm certainly far from a script master. ;)
The ultimate tyranny in a society is not control
by martial law. It is control by the psychological
manipulation of consciousness, through which reality
is defined so that those who exist within do not even
realize that they are in prison.
  —  Barbara Marciniak

Offline Culinax

  • Support Team
  • ****
  • Posts: 1146
  • Branch: Unstable
  • Desktop: Awesome 3.5
  • GPU Card: NVIDIA GeForce 710M - Intel (Optimus)
  • GPU driver: Free Driver
  • Kernel: Linux315-x64
  • Skill: Intermediate
Re: [How-To] Script & system mod's to rank mirrors & upgrade system...
« Reply #41 on: 07. October 2013, 08:02:09 »
And if you really want to perfectionize it: It's better to use $EUID to check if the script is running as root, because whoami is another process that is launched and will add memory usage (although I doubt you'll notice that with this small difference ;)) At least that's what the bash guide always teached me; don't use unecessary applications if you can avoid them.

It's also a good idea to add an exit status (commonly used: 1) because otherwise you'll get a clean exit, while there actually is an error (the script isn't run as root).

Code: [Select]
if  [[ "$EUID" != 0 ]];
then
  err "Must use 'sudo su' before you run this script."
  exit 1
fi
Manjaro Awesome WM Respin: Current version: 0.8.10
Belgian/Dutch Manjaro Linux users: unite! http://manjaro-nl.org/ | IRC: #manjaro-nl

Offline handy

  • Global Moderator
  • *****
  • Posts: 5738
  • Desktop: Openbox 3.6.1-3 & Worker :)
  • GPU Card: intel...
  • GPU driver: open-source
  • Kernel: OpenBSD
  • Skill: Intermediate
Re: [How-To] Script & system mod's to rank mirrors & upgrade system...
« Reply #42 on: 07. October 2013, 08:52:25 »
Deleted my ungrateful post. Sorry Culinax.    I was obviously too tired to be nice that day...

I'll add your improvement to the script, thanks. :)
« Last Edit: 17. November 2013, 05:14:20 by handy »
The ultimate tyranny in a society is not control
by martial law. It is control by the psychological
manipulation of consciousness, through which reality
is defined so that those who exist within do not even
realize that they are in prison.
  —  Barbara Marciniak

Offline aaditya

  • OpenRC Team
  • ****
  • Posts: 2844
    • My Website
  • Branch: Testing
  • Desktop: Xfce, Openbox
  • GPU Card: Intel HD 4000
  • Kernel: Linux 4.4 x86_64
  • Skill: Intermediate
Re: [How-To] Script & system mod's to rank mirrors & upgrade system...
« Reply #43 on: 06. November 2013, 15:43:31 »
I modified line 46, which seems to have been changed from the script posted here in the forums, and the one posted in the wiki.

FadeMind is right, it does give an error when using it as sudo ./allservers.sh
Code: [Select]
./allservers.sh: line 46: root: command not found(this is not with sudo su -> ./allservers.sh)

Also going to incorporate Culinax's suggestion

Edit-
Its right when I am editing the script   
I guess its being recognised as the syntax of a page by the wiki 
So when I copied it, the brackets doesnt show.
Edited the line.
 
« Last Edit: 06. November 2013, 15:52:53 by aaditya »

Offline handy

  • Global Moderator
  • *****
  • Posts: 5738
  • Desktop: Openbox 3.6.1-3 & Worker :)
  • GPU Card: intel...
  • GPU driver: open-source
  • Kernel: OpenBSD
  • Skill: Intermediate
Re: [How-To] Script & system mod's to rank mirrors & upgrade system...
« Reply #44 on: 06. November 2013, 18:54:35 »
I've been using the allservers.sh script every day throughout its development & it has never given me any kind of problem. So I don't know what, whoever, has done to find a problem with it?

It was from the beginning setup to run from an alias that uses sudo su -c . If people use it differently than the way I describe (in great detail) in the wiki, & they have an error, who's fault is that?
The ultimate tyranny in a society is not control
by martial law. It is control by the psychological
manipulation of consciousness, through which reality
is defined so that those who exist within do not even
realize that they are in prison.
  —  Barbara Marciniak