Tag Archives: Linux

K9s: Adjust memory and cpu warning levels

Maybe you are like me and feel that the default memory warning level of 70% is a little off in the clusters you work.

Here is how to change them:
1. Open .config/k9s/config.yaml in your favorite editor (of course VIM 😉 )
2. Edit the section called “thresholds”

 thresholds:
    cpu:
      critical: 90
      warn: 70
    memory:
      critical: 90
      warn: 70

3. Save and restart k9s – done!

Apart from this, K9s is a wonderful tool that I don’t want to live a day without 🙂
You can find it here: https://k9scli.io/. Just download and enjoy!

Tested on K9s v.0.31.9 and Ubuntu 20.04.4 LTS (WSL2)

When you hit GRUB console on boot in an ASUS VivoMini UN45 with Ubuntu 18.04

I have an ASUS VivoMini that I run Ubuntu 18.04 on as a place for databases, Docker containers, and other stuff. Every now and then it boots me into GRUB console on reboots.

I’m here going to show how I use to solve is:

grub> set root=(hd0,2)
grub> linux /boot/vmlinuz-4.15.0-112-generic root=/dev/nvme0n1p2
grub> initrd /boot/initrd.img-4.15.0-112-generic
grub> boot

Explanation:
set root=(hd0,2) sets the disk an partition where the Linux installation is. Here is the first drive (hd0) and the second partition (2)
linux /boot/vmlinuz-4.15.0-112-generic root=/dev/nvme0n1p2 here I set the Linux kernel and the root path. It’s where I usually mess up. Most guides tell you to use /dev/sdaX (or sdbX or similar). The problem is that I use an internal Intel SSD witch identifies as nvme0 and not sda2, so when I try to use sda2 I get: “Gave up waiting for root file system /dev/sda2 does not exist. Dropping to shell”, but when I use nvme0n1p2 it works (nvme0n1p2 means first disk (n1) and second partition (p2))
initrd /boot/initrd.img-4.15.0-112-generic sets the initrd file. This has to be the same version as the vmlinux version
boot simply boots the system with the settings above. If all goes well we should reach the Ubuntu login screen (or console)

To make the changes permanent (until the next power outage or other misfortune) 

sudo update-grub

This will collect all data from the settings above and create a grub.cfg file. I needed sudo on my system, maybe you don’t. After we have created a new grub.cfg file we need to install it on the disk boot sector (not on a partition so no number for disk or partition here). For me, this was done by:

sudo grub-install /dev/nvme0

The system should now behave again 🙂

Tested on Ubuntu 18.04, GRUB 3.0, and Linux kernel 4.15.0-112

Run multiple Linux commands, one after the other

Run commands after another
Ex.

mkdir temp & cd temp & ls

Run commands after another if the previous command SUCCEEDS
Ex.

mkdir temp && cd temp && ls

Run commands after another if the previous command FAILS
Ex.

mkdir temp || echo 'mkdir failed'