# Installation

Pemmican should be installed by default on all Ubuntu for Raspberry Pi images from the 24.04 release (“Noble Numbat”) onwards. However, should you wish to install it manually for whatever reason, there are two primary packages which provide different configurations of the application:

- `pemmican-server` installs the MOTD (“Message of the Day”) plugins only, which check for brownout and power supply negotiation states. As the name suggests, this is intended for usage on server installations which lack any kind of desktop notification service.

- `pemmican-desktop` installs two globally enabled user services which attempt to communicate with an implementation of the freedesktop notification service. One service warns about brownout and power supply negotiation issues (the same as the MOTD service), the other is runtime monitor for overcurrent and undervolt issues.

These both rely on the `pemmican-common` package (which is the actual code for both implementations).

## From PyPI

You may also choose to install Pemmican from PyPI:

    $ pip install "pemmican[gui]"

The `[gui]` option should be included only if you want to include the dependencies for the graphical pemmican-reset and pemmican-mon applications.

Please note that, in this case, you will need to add service definitions to launch the applications yourself. For the graphical applications, the following two service definitions are recommended:

/usr/lib/systemd/user/pemmican-reset.service

    [Unit]
    Description=Check the Raspberry Pi PMIC for reset notifications
    ConditionPathExists=/proc/device-tree/chosen/power
    ConditionPathExists=|!%E/pemmican/brownout.inhibit
    ConditionPathExists=|!%E/pemmican/max_current.inhibit
    Requires=dbus.socket
    After=dbus.socket

    [Service]
    Slice=session.slice
    Type=oneshot
    ExecStart=pemmican-reset
    Restart=on-failure
    RestartSec=1s

    [Install]
    WantedBy=graphical-session.target

/usr/lib/systemd/user/pemmican-monitor.service

    [Unit]
    Description=Check the Raspberry Pi PMIC for power supply issues
    ConditionPathExists=/proc/device-tree/chosen/power
    ConditionPathExists=|!%E/pemmican/overcurrent.inhibit
    ConditionPathExists=|!%E/pemmican/undervolt.inhibit
    Requires=dbus.socket
    After=dbus.socket

    [Service]
    Slice=session.slice
    Type=simple
    ExecStart=pemmican-mon
    Restart=on-failure
    RestartSec=1s

    [Install]
    WantedBy=graphical-session.target

As these are user services, they will either need to be enabled on a per-user basis, or globally like so:

    $ sudo systemctl --global enable pemmican-reset.service
    $ sudo systemctl --global enable pemmican-monitor.service

For the console application (pemmican-cli) the following update-motd(5) script is recommended:

/etc/update-motd.d/90-pemmican

    #!/bin/sh

    if [ -x /usr/bin/pemmican-cli ]; then
        exec /usr/bin/pemmican-cli
    elif [ -x /usr/local/bin/pemmican-cli ]; then
        exec /usr/local/bin/pemmican-cli
    fi