thorko.deLinux / Unix systems administrator

GitHub Projects

buildserver Build Status Coverage Status

Latest SysadminDB entries

search


Debian - Downgrade package

Make sure your /etc/apt/sources.list contains different releases

deb http://ftp.de.debian.org/debian/ unstable main contrib non-free
deb-src http://ftp.de.debian.org/debian/ unstable main contrib non-free
deb http://ftp.de.debian.org/debian/ buster main contrib non-free
deb-src http://ftp.de.debian.org/debian/ buster main contrib non-free

Create a file called /etc/apt/apt.conf.d/80targetrelease

APT::Default-Release "sid";

This is your default release, which apt tries to install the package available on that mirror

If you want to install an old version you have to run

~$ apt-get -t buster install perl-base=5.24.1-7

This installs the perl-base package version 5.24.1-7 if it is available in buster release




Cgroups on Debian

~$ apt-get install cgroup-bin cgroup-tools

Create systemd unit files

/etc/systemd/system/cgred.service

# This is a mostly empty service, but allows commands like stop, start, reload
# to propagate to all tinc@ service instances.
[Unit]
Description=Cgroup Rules Engine
After=network.target cgconfig.service
[Service]
Type=forking
EnvironmentFile=-/etc/default/cgred.conf
ExecStart=/usr/sbin/cgrulesengd -f $LOG_FILE $LOG
ExecStop=/bin/kill -TERM ${MAINPID}
ExecReload=/bin/kill -12 ${MAINPID}
[Install]
WantedBy=multi-user.target

/etc/systemd/system/cgconfig.service

[Unit]
Description=Cgroup Config Parser
After=network.target
[Service]
Type=oneshot
RemainAfterExit=true
EnvironmentFile=-/etc/default/cgconfig.conf
ExecStart=/usr/sbin/cgconfigparser -l $CONFIG_FILE
#ExecStop=/usr/sbin/cgclear -e -l $CONFIG_FILE
[Install]
WantedBy=multi-user.target

/etc/default/cgred.conf

LOG_FILE="/var/log/cgrulesengd.log"
LOG="-v"

/etc/default/cgconfig.conf

CONFIG_FILE="/etc/cgconfig.conf"

Create your config files

The following example will limit your email client thunderbird in cpu and memory

/etc/cgconfig.conf

group Email { 
perm {
task {
uid = <your username>;
gid = <your username>;
fperm = 774;
dperm = 775;
}
admin {
uid = <your username>;
gid = <your username>;
fperm = 774;
dperm = 775;
}
}
cpu {
cpu.cfs_quota_us="60000";
cpu.cfs_period_us="100000";
}
memory {
memory.limit_in_bytes="350M";
}
}

/etc/cgrules.conf

*:thunderbird cpu,memory /Email



KDE Plasma - Autstart applications

In KDE Plasma you need to place a .desktop file in ~/.config/autostart

The specs for that can be found here

 

If that doesn't work place a script in ~/.config/plasma-workspace/env and make it executable




GPG cheatsheet

Sign and encrypt file with specific key

gpg -e -r <recipient> -u <id of signing key> --sign -o <output file> <file>
gpg -e -r info@thorko.de -u 4A9C0FC09269797E706BB5A6D53E9087CA40E908 --sign -o test.gpg test

Export public key

gpg --armor --output <YOUR-KEY>.asc --export <YOUR-KEY-ID>
gpg --armor --output test.asc --export 4A9C0FC09269797E706BB5A6D53E9087CA40E908

Export secret key

gpg --armor --output <YOUR-SECRET>.asc --export-secret-keys <YOUR-KEY-ID>
gpg --armor --output test-sec.asc --export-secret-keys 4A9C0FC09269797E706BB5A6D53E9087CA40E908



Set special character on keys

First you need to figure out which keycode the key uses when you press it. To do so you start xev and type the key

KeyPress event, serial 40, synthetic NO, window 0x5c00001,
root 0xe7, subw 0x0, time 42471470, (1095,-519), root:(1095,250),
state 0x10, keycode 49 (keysym 0x5e, asciicircum), same_screen YES,
XLookupString gives 1 bytes: (5e) "^"
XmbLookupString gives 1 bytes: (5e) "^"
XFilterEvent returns: False

now create a file calles ~/.Xmodmap

keycode 49 = asciicircum



(c) 2014 by thorko.de