Forward ROOT mail to a user

To forward all root emails to a user you can add an entry in the aliases file, like:

root: sam

After updating the aliases run the command below.

newaliases /etc/aliases

Restart your mail server and you should see all root emails being sent to the user specified in the aliases file. A different process can be used to achieve the same behavior by making an entry in the .forward file of the root but I haven’t tried that as I prefer to have it done with aliases.

Setup Couchpotato with virtualenv

I run Couchpotato on my media server and since the project isn’t actively maintained it doesn’t run on python3. My linux os dropped having pip2.7 available by default likely to encourage people to migrate to python3, I decided to run it in a python virtual environment to break the apps dependency on the system python support. Below are the steps I took to get it running.

Setup virtualenv

Python3 comes with venv or creating virtual enviroments but venv doesn’t support creating environments with python2.7. Current versions of virtualenv also don’t support python2.7 so we have to install a version that has this support we will go with version 20.21.1

pip install virtualenv==20.21.1

Create your virtual environment directory I created this inside the couchpotato project but you can also place it outside if you intend to use it with more than one project.

mkdir couchpotatoserver/.venv/

Point the virtualenvironment to the actual path of your python2.7 binary

virtualenv --python=/usr/bin/python2.7 /<path>/couchpotatoserver/.venv/

This will install python2.7 and a compatible pip version in the virtual environment.

Use virtualenv

You should be able to install all your needed dependencies from the couchpotato requirements file with the pip cmd. Use the path to the pip binary to make sure the dependencies get installed in your virtual environment and not the OS.

.venv/bin/pip install -r requirements-dev.txt

Just as we had to install a specific version of virtualenv which supports Python2.7 we will need to install specific versions of 2 other libraries needed by couchpotato in our virtual environment.

.venv/bin/pip install cryptography==2.2.2
.venv/bin/pip install PyOpenSSL==17.5.0

Update whichever script you are using to startup couch potato to use the Python installed in the virtual environment, it is very important to reference the actual path otherwise by omitting the path you will be using the system level Python version which will cause startup to fail.

/<root-path>/couchpotatoserver.venv/bin/python /apps/couchpotatoserver/CouchPotato.py

You should now be able to startup your couchpotato service using your virtual environment and should be safe from future OS updates breaking your setup. This documentation assumes you already have an existing couchpotato setup already, the setup of couchpotato is outside scope of this notes.