Configuring pacsrv and powerpill on Arch Linux

Albert De La Fuente Vigliotti

On this post I will show how to configure and use Pacserve and Powerpill on Arch Linux. On a network of several Arch Linux boxes, it is possible to configure a Master server which will hold a copy of all the installed packages within that host and keep it up to date frequently. The other hosts on the network can be configured as Slaves and they will download the packages from the Master whenever possible instead of the Internet directly. The objective is to save bandwidth and time when using the package manager.

Configuring Pacserve and Powerpill on Arch Linux #

The documentation of Pacserve explains how it works. This image summarizes well the behavior.

Pacserve by itself seems very interesting however I could not make it work properly. I think it has something to do my router UDP multicast forwarding support (see openwrt-multicast). Nevertheless, I could use it within Powerpill which is a pacman wrapper to allow parallel and segmented downloads through Aria2 and Reflector. This combo sounds even better, so I will focus on how to install and use the tree tools together.

Installation #

# Just in case the testdb does not exists
gpg --list-key

# Receive xyne gpg key
gpg --recv-keys 1D1F0DC78F173680

# Install the packages
yaourt -Sy --noconfirm reflector pacserve powerpill

Starting the services (both the Master and Slave(s) host(s)) #

After everything is installed:

# Enable opening the ports
sudo systemctl enable pacserve-ports.service

# Enable pacserve
sudo systemctl enable pacserve.service

# Start pacserve
sudo systemctl start pacserve.service

For troubleshooting purposes the services can be started manually. See the Troubleshooting section if you have problems.

Configuring Powerpill to use the Master server (Slave(s) hosts only) #

Edit the file /etc/powerpill/powerpill.json to include the `pacserve`.`serve` attribute:

{
  "aria2": {
    "args": [
      "--allow-overwrite=true",
      "--always-resume=false",
      "--auto-file-renaming=false",
      "--check-integrity=true",
      "--conditional-get=true",
      "--continue=true",
      "--file-allocation=none",
      "--log-level=error",
      "--max-concurrent-downloads=100",
      "--max-connection-per-server=5",
      "--min-split-size=5M",
      "--remote-time=true",
      "--show-console-readout=true"
    ],
    "path": "/usr/bin/aria2c"
  },
  "pacman": {
    "config": "/etc/pacman.conf",
    "path": "/usr/bin/pacman"
  },
  "pacserve": {
    "server": "http://192.168.56.6:15678"
  },
  "powerpill": {
    "ask": true,
    "reflect databases": false
  },
  "reflector": {
    "args.unused": [
      "--protocol",
      "http",
      "--latest",
      "50"
    ]
  },
  "rsync": {
    "args": [
      "--no-motd",
      "--progress"
    ],
    "db only": true,
    "path": "/usr/bin/rsync",
    "servers": []
  }
}

In this example I configured two VMs using Vagrant with an internal network. The server runs on 192.168.56.6 on port `15678` (default port).

After this we can use Powerpill as a replacement of Pacman as follows

# System upgrade
sudo powerpill -Syu

# Install a package
sudo powerpill -S wget

Conclusions #

When powerpill is used..

TODOs #

  • Check how to have only one Master DB and all the Slaves also sync the DB from the master
  • Use reflector commands within Powerpill
  • What happens if different architectures are on the same network and UDP multicast works?

Troubleshooting Pacserve (without Powerpill) #

As I said before I could not make it working using multicast, so I had to manually start the Pacserve Master host as:

Input:

pacserve --multicast

Output:

PacserveServer
  PID                  1048
  Addresses
    lo:     127.0.0.1
    eth0:   10.0.2.15
    enp0s9: 192.168.56.6
  Port                 15678
  Multicast Address    all interfaces
  Multicast Port       15679
  Multicast Group      224.3.45.67
  Multicast Interval   5m
  Multicast Interfaces all
  Filelist             None
  Filterlist           None
  MOTD                 None
  Upload Directory     None
  Paths                None
  Static Peers         None

Press ctrl+C to exit.
[2015-10-23 05:54:54 AEDT] INFO: announcing presence by multicast (group: 224.3.45.67)
[2015-10-23 05:54:54 AEDT] INFO: announcement sent via all interfaces

Assuming the server is running with the IP 192.168.56.6, you can manually start Pacserve on the Slave(s) hosts as:

Input:

pacserve --multicast --peer "http://192.168.56.6:15678"

Output:

PacserveServer
  PID                  1102
  Addresses
    lo:     127.0.0.1
    eth0:   10.0.2.15
    enp0s9: 192.168.56.7
  Port                 15678
  Multicast Address    all interfaces
  Multicast Port       15679
  Multicast Group      224.3.45.67
  Multicast Interval   5m
  Multicast Interfaces all
  Filelist             None
  Filterlist           None
  MOTD                 None
  Upload Directory     None
  Paths                None
  Static Peers         http://192.168.56.6:15678

Press ctrl+C to exit.
[2015-10-23 05:56:00 AEDT] INFO: announcing presence via POST to http://192.168.56.6:15678
[2015-10-23 05:56:00 AEDT] INFO: POSTing to http://192.168.56.6:15678/ [type: nudge]
[2015-10-23 05:56:01 AEDT] INFO: announcing presence by multicast (group: 224.3.45.67)
[2015-10-23 05:56:01 AEDT] INFO: announcement sent via all interfaces

After starting the Slave host you should get the following message on the Master console:

[2015-10-23 05:56:00 AEDT] INFO: added http://192.168.56.7:15678/ (POST)
[2015-10-23 05:56:00 AEDT] INFO: 192.168.56.7 "POST / HTTP/1.1" 200 -