LVM: Grow LVM and resize partition

Sometimes your install a distro and it refuses to take up all available space. 1. Find out how much space we got to play with. $ sudo vgdisplay --- Volume group --- VG Name fedora System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size <49.00 GiB PE Size 4.00 MiB Total PE 12543 Alloc PE / Size 4860 / 18.98 GiB Free PE / Size 7683 / 30.01 GiB VG UUID cCXkBg-Z8Or-jmmi-avaK-91VW-v3cF-CmhiKD 2. Resize your logical volume of choice to soak up the space $ sudo lvresize --size +30.01G /dev/fedora/root Rounding size to boundary between physical extents: 30.01 GiB. Size of logical volume fedora/root changed from 15.00 GiB (3840 extents) to 45.01 GiB (11523 extents). Logical volume fedora/root successfully resized. 3. Grow your partition XFS Example: ...

Installing a lightweight linux desktop environment with openbox and dwm

These are my installation notes for creating a lightweight linux desktop environment from scratch, which contains only the most necessary applications. I’ll probably update it slightly in the future, when I realize I have missed some application. It will contain both openbox and dwm, as I’m always torn between using a tiling versus a floating window manager. Mostly I prefer tiling ones, but with some applications, they simply don’t work well. ...

Test color support in bash

for i in {0..255} ; do printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i" if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then printf "\n"; fi done

November 18, 2017  |  🏷️Bash

Simple reverse proxy with socat

Open local port 5901 to be reached from anyone by connecting to localhost:8080 socat TCP4-LISTEN:8080,fork TCP4:localhost:5901

April 28, 2017  |  🏷️Socat

Debian: Unattended upgrades

Description: Install unattended-upgrades. The server should run unattended upgrades every night, and reboot at 4 am if required by any application. Implementation: Login as root Install packages unattended-upgrades and cron-apt Set the following values in /etc/apt/apt.conf.d/50unattended-upgrades Unattended-Upgrade::Origins-Pattern { "o=Debian,a=stable"; }; Unattended-Upgrade::MinimalSteps "true"; Unattended-Upgrade::InstallOnShutdown "true"; Unattended-Upgrade::Mail "root"; Unattended-Upgrade::MailOnlyOnError "true"; Unattended-Upgrade::Remove-Unused-Dependencies "false"; Unattended-Upgrade::Automatic-Reboot "true"; Unattended-Upgrade::Automatic-Reboot-Time "04:00"; Unattended-Upgrade::InstallOnShutdown "false"; Set the following values in /etc/apt/apt.conf.d/02periodic APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Unattended-Upgrade "1"; APT::Periodic::AutocleanInterval "30"; Verification: Run unattended-upgrade --dry-run --debug as root. If there are any application upgrades available, they should show up. Wait a few days and check /var/log/apt/history.log

Expect: Simulating ssh login

Clean #! /usr/bin/env expect set host [lindex $argv 0]; set user [lindex $argv 1]; set passwd [lindex $argv 2]; set timeout 5 spawn ssh $user@$host expect { "yes/no" { send "yes\r" exp_continue } "password:" { send "$passwd\r" exp_continue } "$user@$host:~? " { exit 0 } timeout { exit 2 } } exit 1 Wrapped inside bash #! /usr/bin/env bash assert_ssh_login() { local host="${1}" local user="${2}" local passwd="${3}" local details="$(echo -e "\ set timeout 5 \n\ spawn ssh ${user}@${host} \n\ expect { \n\ \"yes/no\" { \n\ send \"yes\r\" \n\ exp_continue \n\ } \n\ \n\ \"password:\" { \n\ send \"${passwd}\r\" \n\ exp_continue \n\ } \n\ \n\ \"${user}@${host}:~? \" {\n\ exit 0 \n\ } \n\ \n\ timeout { \n\ exit 2 \n\ } \n\ } \n\ \n\ exit 1 \n\ " | expect)" case "${?}" in "0") echo "Can login as ${user} on ${host}" ;; "1") echo "${user} can not login on ${host}. Details: ${details}" ;; "2") echo "${user} can not login on ${host} (Timeout). Details: ${details}" ;; * ) echo "${user} can not login on ${host} (Error ${?}): Details: ${details}" ;; esac }

October 20, 2015  | 

Configure static eth0 in /etc/network/interfaces

Description: The first step is to establish basic network connectivity for your router/gateway. This will allow you to connect to the installation server on the distribution network, from which you can install the routing software needed in later steps. Your router needs three network interfaces: the loopback interface (lo; which is used for network connections within the gateway) the interface connected to the distribution network (eth1) the interface connected to your network (eth0). Each interface needs an address, netmask and broadcast address. It is important that you specify the correct netmask and broadcast address! ...

Configure static wlan0 in /etc/network/interfaces

Get wpa-psk by running wpa_passphrase MyNetwork MyPassphrase. /etc/network/interfaces should be chmod 0600 if you put the wpa-psk there source /etc/network/interfaces.d/* # The loopback network interface auto lo wlan0 iface lo inet loopback iface wlan0 inet dhcp wpa-ssid MyNetwork wpa-psk a2d024861ef90117c47083c9252d1e9c107c7cc6ab938cd08349c9192d444d2f

Enabling read/write to USBHID

Add read/write for group plugdev echo 'KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", GROUP="plugdev"' | sudo tee /etc/udev/rules.d/99-hidraw-permissions.rules # Check that you have the group plugdev groups # If you cannot see plugdev there, type this: sudo usermod -aG plugdev $USER # Now it should work (otherwise reboot or replug usbhid device)

Archlinux: Installing from AUR

Links Official Guide Before you start Make sure you’ve configured /etc/makepkg.conf Download the package’s PKGBUILD-file from AUR (under View PKGBUILD under Package Actions on the right side) Making Put the PKGBUILD-file in a separate folder, maybe $HOME/tmp cd to the folder run makepkg -s a. Does it want you to install any application? Press yes b. Does it need some other package from AUR? Install that first You should now have a pkg.tar.xz-file. Run pacman -U that.file.name.pkg.tar.xz