all repos — birabittoh.github.io @ 56641958e50713ed23779fb76308a53b097d5859

My current website, built with Zola.

blog/reflector/index.html (view raw)

 1<!doctype html><html lang=en><head><meta charset=UTF-8><meta content="IE=edge" http-equiv=X-UA-Compatible><meta content="text/html; charset=UTF-8" http-equiv=content-type><meta content="width=device-width,initial-scale=1,user-scalable=no" name=viewport><meta content="index, follow" name=robots><title>Update your mirrors!</title><meta content="Update your mirrors!" name=title><meta content="Tech and privacy ramblings from a random italian dude." name=description><meta content=website property=og:type><meta content=https://birabittoh.github.io/blog/reflector/ property=og:url><meta content=BiRabittoh property=og:site_name><meta content="Update your mirrors!" property=og:title><meta content="Tech and privacy ramblings from a random italian dude." property=og:description><meta content=summary_large_image property=twitter:card><meta content=https://birabittoh.github.io/blog/reflector/ property=twitter:url><meta content="Update your mirrors!" property=twitter:title><meta content="Tech and privacy ramblings from a random italian dude." property=twitter:description><link href=https://birabittoh.github.io/blog/reflector/ rel=canonical><link href=https://birabittoh.github.io/atom.xml rel=alternate title=RSS type=application/atom+xml><link href=https://birabittoh.github.io/css/style.css rel=stylesheet><body><div class=wrapper><header><nav class=navBar><a href=/>/home/</a><a href=/about>/about/</a><a href=/links>/links/</a><a href=/blog>/blog/</a><div class=themeSwitch><button class="themeButton light" onclick="setTheme('light')" title="Light mode">◐</button><button class="themeButton dark" onclick="setTheme('dark')" title="Dark mode">◑</button></div><script>const setTheme=a=>{document.documentElement.className=a;localStorage.setItem(`theme`,a)};const getTheme=()=>{const a=localStorage.getItem(`theme`);const b=a?a:`dark`;setTheme(b)};getTheme()</script></nav><div><a href=..>..</a>/<span class=metaData>reflector</span></div><time datetime=2023-01-29>Published on: <span class=metaData>2023-01-29</span></time><h1>Update your mirrors!</h1></header><main><p>Nah, I’m not talking about <a href=https://www.bathshack.com/blog/bluetooth-mirrors-everything-you-need-to-know-before-you-buy/ rel=noopener target=_blank>bluetooth mirrors</a>. Mirrors are what powers all distros: they’re a (de)centralized solution for downloading pre-compiled binaries and scripts for your operating system.<h2 id=suspicion>Suspicion</h2><p>I like always having the most current version of packages, so I usually update my system several times a day. When, after a day, I ran <code>sudo pacman -Syu</code> and it reported the system being up to date, I was pretty weirded out.<p>Another day passed, and the system was still up to date. It was not a connection problem, I was connecting to my mirrors and they were reporting absolutely zero updates for my system.<h2 id=problem>Problem</h2><p>At the third day of stagnation, I was sure something was up. I looked up the <a href=https://archlinux.org/mirrors/status/ rel=noopener target=_blank>Mirror Status</a> page on ArchLinux’s website and saw that loads of mirrors were out of sync.<p>I had never touched my mirrorlist before, it was just generated by the <a href=https://github.com/archlinux/archinstall rel=noopener target=_blank>archinstall</a> script a few months ago; a lot of Arch-based distros by default ship tools to update your mirrorlist, but I honestly thought I’d never need that.<p>Pacman’s mirrorlist is located in <code>/etc/pacman.d/mirrorlist</code>. You can filter out uncommented lines with this command:<pre><code>grep -v "^#" /etc/pacman.d/mirrorlist
 2</code></pre><p>And check the actual status of your mirror(s) on the Mirror Status page linked above.<h2 id=solution>Solution</h2><p>This will overwrite your mirrorlist, so you’re advised to make a backup before proceeding:<pre><code>sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
 3</code></pre><p>I decided to use <a href=https://xyne.dev/projects/reflector/ rel=noopener target=_blank>reflector</a> to fix this problem. I didn’t want to have to deal with this again, so I enabled the provided systemd timer.<p>First, install it.<pre><code>sudo pacman -S reflector
 4</code></pre><p>Then, edit <code>/etc/xdg/reflector/reflector.conf</code>. I only needed to edit the <code>--country</code> parameter and select countries next to the one where I reside; you can list available countries by running <code>reflector --list-countries</code>.<pre><code>--save /etc/pacman.d/mirrorlist
 5--protocol https
 6--country Italy,Switzerland,France,Germany,Austria
 7--latest 5
 8--sort age
 9</code></pre><p>Finally, start the service and check if it worked.<pre><code>sudo systemctl start reflector.service
10cat /etc/pacman.d/mirrorlist
11</code></pre><p>If everything went smoothly, enable reflector’s timer so it runs weekly.<pre><code>sudo systemctl enable reflector.timer
12</code></pre><p>Done!<p>Now, by default pacman <em>does</em> update its mirrorlist. It creates a file called <code>mirrorlist.pacnew</code> and it expects you to pick your favorite mirrors each time its generated. You can disable this (now unneeded) behavior by uncommenting and setting <code>NoExtract</code> in <code>/etc/pacman.conf</code>:<pre><code>...
13NoExtract = /etc/pacman.d/mirrorlist
14
15# Misc options
16Color
17ILoveCandy
18ParallelDownloads = 3
19...
20</code></pre></main><footer><p class=tagsData><a href=/tags/advice>#advice</a> <a href=/tags/foss>#foss</a><hr><div class=footContainer><div class=footLeft><p>Licensed under <a rel="noopener noreferrer" href=https://fr.wikipedia.org/wiki/Licence_MIT target=_blank>MIT</a><br> Built with <a rel="noopener noreferrer" href=https://www.getzola.org target=_blank>Zola</a> using <a rel="noopener noreferrer" href=https://github.com/BiRabittoh/anemone target=_blank>anemone</a> theme & <a rel="noopener noreferrer" href=https://github.com/Speyll/veqev target=_blank>veqev</a> colors.<br></div><div class=footRight><a href=https://wobble.town/visit/528 target=_blank><img class="footGif noStyle" alt=footGif loading=lazy src=https://wobble.town/visit/528/wobble.gif></a><a rel="noopener noreferrer" title="Subscribe via RSS for updates." class=metaData href=https://birabittoh.github.io/atom.xml target=_blank>RSS</a></div></div></footer></div>