Upgrade WSL (Windows Subsystem for Linux) on Windows 10

I had installed WSL (Windows Subsystem for Linux) a long time ago to gain access to Ubuntu 14.04 LTS directly from my Windows 10 Desktop. However, as time passes, Software grows old. Upgrading the Ubuntu Subsystem via apt-get update / do-release-upgrade should work, but that could have some nasty sideeffects, considering that the 14.04 LTS WSL release had been a beta test - so, a reinstall should be better.

Luckily, TechRepublic got this covered. Just open a CMD and run:

lxrun /uninstall /full /y

to uninstall the current WSL version.

Afterwards, try

lxrun /install

to reinstall it. With this "reinstall", Ubuntu 16.04 LTS will be installed.

Nonetheless, I recommend a nice

sudo apt-get update
sudo apt-get dist-upgrade

afterwards in your BASH session to get the WSL to the latest version ;).

 

[Ubuntu] PERC6/i on Ubuntu 16.04 LTS

To use the PERC6/i i.e. the

03:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 1078 (rev 04)

on Ubuntu, megacli is the best tool - but rarely available due to the demise of LSI Logic. Good thing that the guys from https://hwraid.le-vert.net put together a nice repo to host the latest RAID files. And yes, for everyone that does not like the idea of including a foreign repo - sorry to disappoint here :/.

# Add GPG signatures
wget -O - https://hwraid.le-vert.net/debian/hwraid.le-vert.net.gpg.key | sudo apt-key add -

# Add Package Repo
echo "deb http://hwraid.le-vert.net/ubuntu xenial main" | sudo tee -a /etc/apt/sources.list.d/hwraid.list

# Upgrade and Install
sudo apt-get update
sudo apt-get install megacli

After that, megacli is installed and can be used:

# Basic Commands
# Info Controller
sudo megacli -AdpAllInfo -aAll
sudo megacli -CfgDsply -aALL

# Info Virtuelles Laufwerk
sudo megacli -LDInfo -Lall -aALL

# Info Battery
sudo megacli -AdpBbuCmd -aALL

I picked out the most important infos for me and wrote this little script

#!/bin/bash

echo "Some Infos are commeted out in this script to not overwhel the user ;)"

#echo "----------------------- RAID Controller"
#sudo megacli -AdpAllInfo -aAll

#echo "----------------------- RAID Controller Config"
#sudo megacli -CfgDsply -aALL

echo "----------------------- RAID Battery"
#sudo megacli -AdpBbuCmd -aALL
sudo megacli -AdpBbuCmd -aALL | grep "Battery State:"
sudo megacli -AdpBbuCmd -aALL | grep "Charger Status:"
sudo megacli -AdpBbuCmd -aALL | grep "Relative State of Charge:"
sudo megacli -AdpBbuCmd -aALL | grep "Next Learn time:"

echo "----------------------- RAID Virtual Drive"
#sudo megacli -LDInfo -Lall -aALL
sudo megacli -LDInfo -Lall -aALL | grep "State"

echo "----------------------- RAID Harddrive Status"
sudo megacli -CfgDsply -aAll | grep "Drive has flagged a S.M.A.R.T alert"

 

Additional infos can be found on:

http://erikimh.com/megacli-cheatsheet/

https://www.thomas-krenn.com/de/wiki/MegaRAID_Controller_mit_MegaCLI_verwalten

[FreeBSD] Some personal notes for emergencies

Mounting zfs on FreeBSD 9.3 LiveFS for recovery

# List zfs pools
zpool import
-> i.e. syspool
# mount zfs pool syspool
zpool import -f -R /mnt syspool
# create mnt folder for new folder
mkdir /tmp/home
# mount data from zfs pool syspool
mount -t zfs syspool/DATA/home /tmp/home
# work on stuff and umount /tmp/home
# then umount zfspool
zfs umount -a

Format a harddrive on FreeBSD 9.3 and mount it as folder

# format drive with ufs
newfs /dev/da1
# create tmp folder
mkdir /tmp/mnt
# mount new drive
mount -t ufs /dev/da1 /tmp/mnt
# copy files
cp -R /tmp/home/* /tmp/mnt/

ezjail stuff

# show jails
ezjail-admin list
# Get to console
ezjail-admin console JAILNAME
# Start / Stop
ezjail-admin start JAILNAME
ezjail-admin stop JAILNAME
# No Autorun
ezjail-admin config -r norun JAILNAME
# Autorun
ezjail-admin config -r run JAILNAME

Jail Folder on FreeBSD: /usr/jails/JAILNAME
Internal Jail Folder on FreeBSD: /usr/jails/JAILNAME/*/var/HEREISHOME

Reboot Ubuntu if init daemon fails / systemd died

I got following error on an really badly "injured" Ubuntu machine:

Failed to start reboot.target: Failed to activate service 'org.freedesktop.systemd1': timed out
See system logs and 'systemctl status reboot.target' for details.
Failed to talk to init daemon.

Rebooting was not possible anymore, due to the beauty of 2933 zombie processes - slowing down the machine to a crawl.

However, this neat issue provided the answer to STILL get it to reboot:

# Reboot
sudo systemctl --force --force reboot
# Shutdown
sudo systemctl --force --force poweroff

"Cool", as Gregory House would say 😉

[Windows/Ubuntu] ADB and Fastboot - useful stuff for your Android

1.) Setup on Linux (Ubuntu)

sudo apt-get update 
sudo apt-get install -y android-tools-adb android-tools-fastboot

1b.) Setup on Windows

I recommend the Minimal ADB and fastboot Package by shimp208, which you can get from: https://forum.xda-developers.com/showthread.php?t=2317790.

After you've installed it, you should add the folder of the installation to your PATH Variable: Press WIN+X Key, choose System, Advanced Systemsettings, Advanced, Path Variables - or just press WIN+R and enter "C:\Windows\system32\rundll32.exe" sysdm.cpl,EditEnvironmentVariables- you will need to click on the entry Path in the User Variables, edit and then create a new entry by clicking on new. There, you'll need to enter the path to Minimal ADB and Fastboot, i.e. C:\Program Files (x86)\Minimal ADB and Fastboot, click ok and close everything. Now you can use adb and fastboot from CMD in every folder.

 

2) Using it!

ADB can be used to do almost anything with Android Devices - as long as Android Debugging is activated. Developer Mode is activated via Settings -> Status and clicking 7 times on "Build number". After that, the Developer Options are available in the Settingsmenu. In this menu, you need to activate Android Debugging and connect your Phone via USB to your PC. You can start i.e. the Android Shell by accessing your Terminal and starting adb shell

In the Android Shell, you can navigate the file system of your phone or change different settings, i.e. you can change the brightness of your screen via:

settings put system screen_brightness 200

There are a lot of settings you can change, some are listed here:

Settings System: https://developer.android.com/reference/android/provider/Settings.System.html

Settings Global: https://developer.android.com/reference/android/provider/Settings.Global.html

Settings Secure: https://developer.android.com/reference/android/provider/Settings.Secure.html

You can also get a list of your current settings with settings list [namespace], i.e.

settings list system

You can also reboot your phone if it is rooted, move files, edit them, delete them - everything you can do on a normal linux system.

Another useful adb commands are pull and push. With adb pull  you can pull a file from your phone to your pc. And with adb push you can upload a file to your phone.

Also, you can adb install  install apk files / apps or adb uninstall  uninstall them.

Important for debugging is the access to the logcat daemon via adb logcat so you can see what happens on your phone. You can even filter for different apps, i.e. chromium: adb logcat -s chromium

There is a bunch of other goodies like forwarding socket connections or reverse sockets and backup / restore of apps - which you can find out by looking at the useful adb help output.

Fastboot is the last command I want to describe here. You can use adb to reboot your phone to bootloader (adb reboot bootloader) or recovery (adb reboot recovery). If your phone is rooted and you get it into the bootloader, you can access it via fastboot. This tool is vital to flashing new kernels, images, recoverys and other stuff if everything else fails. Knowing that it exists should be enough for the "normal status of operation" - but if something breaks - use it ;)!

Configure Git Line Endings

I tend to work crossplatform on different systems, mostly switching between different kinds of Ubuntu/Debian and Windows machines - always checking out and commiting git files on those machines. And I always forget to get the Git Line Endings right, as soon as I add a new machine to that list... So to do that, just a quick one liner:

git config --global core.autocrlf input
# Configure Git on Linux to properly handle line endings

 

Gitkraken - your next Git Client

If you're in the NetOps/DevOps Teams, chances are high you need to develop code and use git. Well, on Windows Clients, I tended to use Atlassians Source Tree - however, that client became more and more buggy and unstable - unusable to say. Especially if I had to do an really big merge of my main to my deploy tag - it tended to crash most of the time.

So, without further ado: Enter Gitkraken. A nice, free, good looking and fast git client. Without dependencies.

Only downsides: It uses Electron - so it is basically a packaged Node JS server. It is - quite fast, however - and it does not need to install any other dependencies. The other "downside" is, if you want to use more than one GitHub Account, you need to pay for these kind of features.

However, as long as there is no "real" alternative to this product, I will remain using it :).

Raspberry Pi Remote Desktop

To use the RPi via Remote Desktop, different protocols and programs exist, i.e. VNC. Due to simplicity of use, however, I mostly chose XRDP, which works with the Microsoft Remote Desktop Tools. However, you must not install it via sudo apt-get install xrdp - as this will install it with realvnc and break xrdp (Package error which has not been fixed yet in the recent "Pixel" Release of Raspbian...).

Instead, use:
sudo apt-get install tightvncserver xrdp

As it will install tightvnc first and xrdp will use it after that as source. You can then use mstsc on your Windows Machine or any other RDP Viewer to access your RPis Desktop.

PS: Yes, the new Pixel Version of Raspbian does contain an VNC Server which can be enabled very easily via the GUI "Raspberry Pi Configuration" Tool, if you want to use VNC directly without RDP. However, I did chose this way, as the old VNC server installations never worked for me and I got used to this kind of "workaround" (more or less a "works-for-me"(tm) solution)

[Ubuntu / Proxmox] Hosting NFSv3 Server on Ubuntu for Proxmox Server

So, yesterday evening y0sh came to me with following problem: "I got an real nice proxmox server with loads of CPU and RAM - and nearly no storage left. And I got an small little Atom Server with loads of Storage - but not very useful as VM Host - and yes, they are within the same network". Ok, so: Lets create an NFSv3 Server on the Atom system and mount it as disk storage within Proxmox 🙂

# Atom Server (Ubuntu)
# Install NFS v3 Server
sudo apt-get install nfs-kernel-server rpcbind
# Create Shared Directories
sudo mkdir -p /var/nfsshare
sudo chmod -R 777 /var/nfsshare
# Configure Server
sudo vi /etc/exports
# Insert the line into exports, with the IP Address of your NFS Client / Proxmox Server
/var/nfsshare 192.168.1.111(rw,sync,no_root_squash)
# save and exit, fine tuning:
sudo vi /etc/default/nfs-kernel-server
# change the line RPCMOUNTDOPTS to
RPCMOUNTDOPTS="--manage-gids --no-nfs-version 4"
# to use nfs v3 ...
# reload the nfs exports...
sudo exportfs -r
# ...or restart the server
sudo /etc/init.d/nfs-kernel-server restart
# show all share directorys
sudo exportfs -v

# Mount NFS in Proxmox
Go to Datacenter, Storage, Add, NFS
IP: