Linux Mint 19 Cinnamon post installation tasks on my Lenovo X1 Carbon 6th gen.

Configure Hot Corners

Left Upper Corner
-> Lock Screen by turning on the screensaver
-> command: cinnamon-screensaver-command -l

Right Upper Corner
-> Show the desktop

Right Bottom Corner
-> Show all windows

Enpass

Install Enpass as per instructions on their site
https://www.enpass.io/support/how-to-install-enpass-on-linux/

sudo -i
echo "deb https://apt.enpass.io/ stable main" > /etc/apt/sources.list.d/enpass.list
wget -O - https://apt.enpass.io/keys/enpass-linux.key | apt-key add -
apt-get update
apt-get install enpass
exit

Open Enpass and configure syncing, then install the firefox extention
https://www.enpass.io/downloads/#extensions

TransIP Stack client

Again they provide great info on their site
https://mirror.transip.net/stack/linux/

sudo -i
echo 'deb http://mirror.transip.net/stack/software/deb/Ubuntu_18.04/ ./' > /etc/apt/sources.list.d/stack-client.list
wget -O - https://mirror.transip.net/stack/release.key | apt-key add - 
apt-get update
apt-get install stack-client
exit

Install other software via the ‘Software Manager

  • IDE: Visual Studio Code – OSS
  • Music: Spotify
  • RDP Client: Remmina-plugin-rdp
Posted in OS

Create a single node ceph server

Firt make sure your system is up to date and has ntp configured.

systemctl stop firewalld
systemctl disable firewalld
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config && setenforce 0

hostnamectl set-hostname ceph-node.lab.lcl

yum install -y epel-release
yum install -y python-pip
pip install --upgrade pip
pip install ceph-deploy

mkdir ceph
cd ceph

ceph-deploy new ceph-node

vi ceph.conf (and add)
osd pool default size = 1
osd crush chooseleaf type = 0

ceph-deploy install ceph-node
ceph-deploy mon create-initial

lsblk

ceph-deploy disk zap ceph-node /dev/sdb
ceph-deploy osd create --data /dev/sdb ceph-node

ceph-deploy admin ceph-node
chmod 644 /etc/ceph/ceph.client.admin.keyring

ceph-deploy mgr create ceph-node

ceph -s
  cluster:
    id:     9aee9084-801b-4094-85da-d5785fe4918f
    health: HEALTH_OK
 
  services:
    mon: 1 daemons, quorum ceph-node
    mgr: ceph-node(active)
    osd: 1 osds: 1 up, 1 in
 
  data:
    pools:   0 pools, 0 pgs
    objects: 0  objects, 0 B
    usage:   1.0 GiB used, 599 GiB / 600 GiB avail
    pgs:   

Fedora 29 on my Lenovo 6th gen X1 (X1C6)

Pro’s:

  • Very Powerful
  • Ultra Light
  • Small form factor
  • Good build quality
  • Looks nice
  • Almost* everything works out of the box

Con’s:

  • CPU Throttling (which we can fix)
  • only one USB-C port which you must use for charging…
  • A Vendor Specific Dongle port where you could have an extra USB-C port.
  • Fingerprint magnet
  • Fingerprint Sensor does not work

Let’s fix the CPU Throttling issue

Explanation:

CPU Throttling on Linux kicks in way to early and impacts performance. There is a (dirty) workaround that resets the throttling settings every 5 seconds. You can also tune CPU voltage settings if you want.

How to install:

dnf install python3-cairo-devel cairo-gobject-devel gobject-introspection-devel dbus-glib-devel python3-devel make
git clone https://github.com/erpalma/lenovo-throttling-fix.git
sudo ./lenovo-throttling-fix/install.sh

For more info see:

https://github.com/erpalma/throttled

Install Telegram

Add the RPMforge repo and intall

sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install telegram-desktop

Install Adobe Flash

sudo dnf install http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm
sudo dnf install libcurl flash-plugin alsa-plugins-pulseaudio

Install Spotify

sudo dnf install snapd
snap install spotify

Install VirtualBox

cd /etc/yum.repos.d/
sudo wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
sudo dnf update     #if there was a kernel update -> reboot
sudo dnf install VirtualBox-6.0
Posted in OS

“GPT PMBR size mismatch” when growing LogicalDrive

What I did..

I sequentally hot-swapped two drives that are in a mirror on my HP P420 raid controller. Now to actually use that space you need to grow the logicaldrive.

# ssacli ctrl slot=1 ld 1 modify size=max
Warning: Extension may not be supported on certain operating systems. 
Performing extension on these operating systems can cause data to become 
inaccessible. See SSA documentation for details. 
Continue? (y/n) y

I typed “y” because this was going trough my mind:

I’m on Linux.. this will just work, right….

Wrong.. Even after rescanning nothing made my drive appear bigger.. I even did a reboot.

Ok, let’s check fdisk:

# fdisk /dev/sda

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

GPT PMBR size mismatch (286677119 != 2344160431) will be corrected by w(rite).
GPT PMBR size mismatch (286677119 != 2344160431) will be corrected by w(rite).

Command (m for help): p

Disk /dev/sda: 1.1 TiB, 1200210141184 bytes, 2344160432 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disklabel type: gpt
Disk identifier: B0426352-B2AA-4C55-A328-F6C29271B05F

Device      Start       End   Sectors   Size Type
/dev/sda1    2048      4095      2048     1M BIOS boot
/dev/sda2    4096    528383    524288   256M EFI System
/dev/sda3  528384 286677086 286148703 136.5G Linux LVM

Command (m for help):

Yup something is wrong.. I was like.. ok, fdisk knows whats wrong… the GPT label and the Protective MBR don’t match… lets just punch ‘w’.. and reboot (because this is the bootdisk.. partprobe won’t help you here…) right?

nope, that doesn’t work either (can’t seem to find that output..). fdisk isn’t able to write anything…

Ok, I can go on with other things that failed but that would make the story to long. So what did help?
=> parted

# parted
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an
extra 2057483312 blocks) or continue with the current setting? 
Fix/Ignore? Fix                                                           
Model: HP LOGICAL VOLUME (scsi)
Disk /dev/sda: 1200GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  271MB   268MB   fat32              boot, esp
 3      271MB   147GB   147GB                      lvm

(parted) q

And now I could use my extra diskspace! Hooray!

Enable watchdog on Raspberry PI

I’m using Raspbian Linux on 2 Pi’s and I was successful in enabling the hardware watchdog after a lot of failed attempts because of wrong manuals on the net.

Edit the Raspbian boot config file to enable the watchdog

root@raspbianpi:~# vi /boot/config.txt

Add the following somewhere at the end:

dtparam=watchdog=on

Reboot your Pi

root@raspbianpi:~# reboot

After the reboot install the watchdog software

root@raspbianpi:~# apt install watchdog

Edit the watchdog configuration file

root@raspbianpi:~# vi /etc/watchdog.conf

and add:

watchdog-device = /dev/watchdog
watchdog-timeout = 15

Start and make sure the watchdog daemon starts at boot

root@raspbianpi:~# systemctl start watchdog
root@raspbianpi:~# systemctl enable watchdog

udev rules for ASM disks

Make sure you have sg3 utils installed.

# yum install -y sg3_utils

After the LUNs were added to the server run:

# rescan-scsi-bus.sh

This will generate a lot of output and will tell you if it found new disks.
If you’ve received the wwid’s from you SAN administrator you can skip this next stept, if not we’ll have to figure out what disks were added using:

# dmesg

Record most (if you asked for 2 LUNs with different sizes, you can note 2 disks with both sizes) disks for further reference. I’m noting:

[1808189.173460] sd 0:0:0:9: [sdak] 209715200 512-byte logical blocks: (107 GB/100 GiB)
[1808189.213339] sd 0:0:0:10: [sdal] 104857600 512-byte logical blocks: (53.6 GB/50.0 GiB)

I will assume you have multipath, if you are blacklisting all luns by default you will also need to modify your multipath configuration. I will not cover this here.

now run

# multipath -ll
...
mpathk (36006016056a04000e9113c6d9189e811) dm-21 DGC     ,VRAID
size=50G features='2 queue_if_no_path retain_attached_hw_handler' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| |- 0:0:0:10 sdal 66:80  active ready running
| `- 1:0:0:10 sdap 66:144 active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 0:0:1:10 sdan 66:112 active ready running
  `- 1:0:1:10 sdar 66:176 active ready running
mpathj (36006016056a04000ea81ef4f9189e811) dm-20 DGC     ,VRAID
size=100G features='2 queue_if_no_path retain_attached_hw_handler' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| |- 0:0:1:9  sdam 66:96  active ready running
| `- 1:0:1:9  sdaq 66:160 active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 0:0:0:9  sdak 66:64  active ready running
  `- 1:0:0:9  sdao 66:128 active ready running
...

I’m only showing the mpath devices I need. What is now important is the wwid’s

  • 36006016056a04000e9113c6d9189e811
  • 36006016056a04000ea81ef4f9189e811

Now we’ll edit /etc/udev/rules.d/99-oracle-asmdevices.rules

# vi /etc/udev/rules.d/99-oracle-asmdevices.rules

and add

#100G mpathj asm-data-example
KERNEL=="dm-*", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $tempnode", RESULT=="36006016056a04000ea81ef4f9189e811", SYMLINK+="asm-data-example", OWNER="oracle", GROUP="dba", MODE="0660"
 
#50G mpathk asm-fra-example
KERNEL=="dm-*", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $tempnode", RESULT=="36006016056a04000e9113c6d9189e811", SYMLINK+="asm-fra-example", OWNER="oracle", GROUP="dba", MODE="0660"

Now, very important, you won’t succeed without this:

# partprobe /dev/mapper/mpathk
# partprobe /dev/mapper/mpathj

Last step is to reload the udev config and activate it

# udevadm control --reload-rules
# udevadm trigger --type=devices --action=change

Verify our new devices are created:

# ls -lrt /dev/asm*example

lrwxrwxrwx. 1 root root 5 Jul 17 10:38 /dev/asm-fra-example -> dm-21
lrwxrwxrwx. 1 root root 5 Jul 17 10:38 /dev/asm-data-example -> dm-20

Syncing a RPM repo for offline use

For example we want to sync the epel repo for offline use

If you are on CENTOS 7 you can just type:

# yum install epel-release

If you are on Red Hat Enterprise Linux 7 add the EPEL repo this way:

# wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# rpm -ivh epel-release-latest-7.noarch.rpm

Install the reposync utility which is included in ‘yum-utils’:

# yum install yum-utils createrepo

Create an offline copy with the latest files only (‘-n’ option):

# reposync -n --repoid=epel --download_path=/data

Create repomd (xml-rpm-metadata) repository

# createrepo /data/epel

When you later want to update the repo then just resync it:

# reposync -n --repoid=epel --download_path=/data

Remove older rpm’s from the updated repo:

# repomanage -k1 -c -o /data/epel/ |xargs rm

Run createrepo with the –update flag to speed things up

# createrepo --update /var/www/html/repo

Split large file in smaller files

Split

# split -b300M bigfile.zip bigfile.zip.
# ls -al
total 3110156
drwxr-xr-x  2 root root       4096 Sep  6 21:02 .
drwx------ 19 root root       4096 Sep  6 21:01 ..
-rw-r--r--  1 root root 1592381288 Sep  6 21:01 bigfile.zip
-rw-r--r--  1 root root  314572800 Sep  6 21:01 bigfile.zip.aa
-rw-r--r--  1 root root  314572800 Sep  6 21:01 bigfile.zip.ab
-rw-r--r--  1 root root  314572800 Sep  6 21:01 bigfile.zip.ac
-rw-r--r--  1 root root  314572800 Sep  6 21:01 bigfile.zip.ad
-rw-r--r--  1 root root  314572800 Sep  6 21:01 bigfile.zip.ae
-rw-r--r--  1 root root   19517288 Sep  6 21:02 bigfile.zip.af

combine

# cat bigfile.zip.aa bigfile.zip.ab bigfile.zip.ac bigfile.zip.ad 
bigfile.zip.ae bigfile.zip.af > bigfile.zip

Encrypt or Decrypt files

encrypt.sh

#!/bin/bash

infile=$1
outfile=${infile}.enc

if [ -f ${infile} ]; then
    if [ -f ${outfile} ]; then
        echo "target file ${outfile} already exists"
        exit 1
    fi

    printf "Enter encryption password: "
    read pass

    if [ -z ${pass} ]; then
        echo "No password provided, using default: biscuit"
        pass=biscuit
    fi

    cat ${infile} |openssl enc -base64 -e -aes-256-cbc -nosalt -pass pass:${pass} > ${outfile}

fi

decrypt.sh

#!/bin/bash

infile=$1
outfile=`echo ${infile} |sed 's/.enc//'`

if [ -f ${infile} ]; then
    if [ -f ${outfile} ]; then
        echo "target file ${outfile} already exists"
        exit 1
    fi

    printf "Enter decryption password: "
    read pass

    if [ -z ${pass} ]; then
        echo "No password provided, using default: biscuit"
        pass=biscuit
    fi

    cat ${infile} |openssl enc -base64 -d -aes-256-cbc -nosalt -pass pass:${pass} > ${outfile}

fi