Joshua Simon

How to install veeam agent on Ubuntu

You need to create an veeam account and login to access the .deb package.

Download the “Veeam Agent for Linux FREE” from here.

Access the download link in your browser and run


in your downloads folder on your Ubuntu.

Then install with:

sudo apt install /home/user/downloads/veeam-release-deb_*.*.*_amd**.deb/


sudo apt update & sudo apt install veeam
Posted by Joshua Simon in veeam

Move LXC container to new VM

Create snapshot on your current VM

lxc snapshot container_name snapshot_name

Validate created snapshot by checking the snapshots list displayed with:

lxc info container_name 

In case you have not named your snapshot, look for the most recent creation date. It might have a default name like snap1.

Create an image from the snapshot

lxc publish container_name/snapshot_name --alias="image_alias" description="image_description"

Verify your created image by checking the image list displayed with:

lxc image info image_alias

Export the created image to an archive in your current path

lxc image export image_alias image_archive_name

Send the file to your new VM

Make sure, that you can establish an SSH connection to your new VM from your old VM, e.g. by a VPN or Wireguard connection. Use scp to copy the image like so:

scp ./image_archive_name.tar.gz usera@host:/home/user

Import image and launch new container on your new VM

Make sure lxc and lxd are installed on your new VM and then import the image like so:

lxc image import image_archive_name.tar.gz --alias image_alias_on_new_vm

Make sure the imported image appears in the list on your new VM.

lxc image list

Then launch a new container from the image with:

lxc launch image_alias_on_new_vm container_name
Posted by Joshua Simon in Container, LXC

How to set zsh as standard shell in Ubuntu

Install zsh

sudo apt install zsh

Add zsh to list of valid shells

sudo vim /etc/shells

Add to the list


Set zsh as default shell

chsh -s /usr/bin/zsh

Double check

$ echo $SHELL

Now you might want to check out to install a nice theme.

Posted by Joshua Simon in Linux

SSH to LXC container with Pubkey

ssh [user]@[my-container-address]


[user]@[my-container-address] Permission denied (publickey). 


Change the sshd_config

vim /etc/ssh/sshd_config 

from this

# PubkeyAuthentication no

to this

PubkeyAuthentication yes

Do not forget to add your pubkey to your authorized keys.

mkdir /home/[myuser]/.ssh & vim /home/[myuser]/.ssh/authorized_keys
Posted by Joshua Simon in Allgemein

LXC container share host network


You want to share the host network with all your lxc containers.

Check network settings of your containers by typing:

lxc network list

If it displays something like that:

| docker0 | bridge   | NO      |             | 0       |
| eth0    | physical | NO      |             | 0       |


Set up your container with the default settings of LXD, creating a network for all containers attached to the newly created lxdbr0 adapter on the host system with

lxd init

and accept the defaults:

Would you like to create a new local network bridge? (yes/no) [default=yes]:
What should the new bridge be called? [default=lxdbr0]:                                                             

and have your containers already connected to the lxdbr0 bridge on your host.
You might now see something like this.

| docker0 | bridge   | NO      |             | 0       |
| eth0    | physical | NO      |             | 0       |
| lxdbr0  | bridge   | YES     |             | 5       |

Now try it

lxc exec [mycontainer] /bin/bash                                               
Posted by Joshua Simon in Allgemein

LXC delete image

1. List your lxc images

lxc image list

2. Delete image

lxc image delete [image alias]
Posted by Joshua Simon in Container, LXC

LXC create container from snapshot

1. Create a snapshot

lxc snapshot [mycontainer] [snapshot name]

2. Create local image from snapshot

lxc publish [mycontainer]/[snapshot name] --alias [image alias]

3. List your images

lxc image list

4. Create container from iamge

lxc launch [image alias] [mynewcontainer]
Posted by Joshua Simon in Container, LXC

How to copy an LXC container

You can copy a running lxc container like this

lxc copy [name of container to be copied] [new container]

for example

lxc copy mycontainer mycontainerCopy
Posted by Joshua Simon in LXC

pre and post script for veeam MongoDB backups

Create an and script to be run before and after a veeam backup of your ubuntu machine runs and will shutdown MongoDB and your webservice (myservice) using the MongoDB before the backup and start it again after the backup has finished. For example:

systemctl stop myservice
systemctl stop mongod
exit 0


systemctl start mongod
systemctl start myservice
exit 0

I highly recommend proper error handling – here handover error codes from systemctl commands.

Select the path to the shell scripts like this:
veeam job setup enable scripts

Posted by Joshua Simon in Linux, MongoDB, veeam

How to save systemd journalctl log to json file

Save your journalctl logs as pretty json to a file.

sudo journalctl -xu yourservice.service -o json-pretty  > ~/test_logs.json
Posted by Joshua Simon in Linux

How to search pubmed entrez API with Python and filter results by metadata

If you want to apply more filters to search results of Pubmed than given in their web interface, you might want to use the entrez API.

The following example shows how you can sort alphabetically by the journal the articles originally appeared in.

I would recommend processing the data in the .json format.

import requests
import json

db = 'pubmed'
domain = ''
nresults = 10
query = "depression"

# standard query
queryLinkSearch = f'{domain}/esearch.fcgi?db={db}&retmax={nresults}&retmode={retmode}&term={query}'
response = requests.get(queryLinkSearch)
pubmedJson = response.json()

results = []

for paperId in pubmedJson["esearchresult"]["idlist"]:
    # metadata query
    queryLinkSummary = f'{domain}/esummary.fcgi?db={db}&id={paperId}&retmode={retmode}'
    results.append({'paperId': paperId, 'metadata': requests.get(queryLinkSummary).json()})
    # check the journalnames 
    # print(results[-1]["metadata"]["result"][paperId]["fulljournalname"])

resultsSorted = sorted(results, key=lambda x: x["metadata"]["result"][x["paperId"]]["fulljournalname"])

with open('resultsSorted.json', 'w') as f:
    json.dump(resultsSorted, f)
Posted by Joshua Simon in APIs, Python

How to use screen sessions in linux?

Step 0: Check if screen is installed


If not run

sudo apt -y install screen

Step 1: Create a screen session with a meaningful session name

screen -S sessionname

Step 2: Check if you are in a screen session

$ echo $STY

If the result is something like this:


you are currently in a session.

Step 3: Exit and terminate screen session

$ exit

Step 4: Exit and keep screen session running (detach)

$ screen -d

Step 5: See existing screen sessions

$ screen -ls

Step 6: Reattach to existing screen sessions

$ screen -r sessionname
Posted by Joshua Simon in Linux