Ubuntu 18.04.1 – Change hostname

While I’d normally use “hostnamectl set-hostname ” to modify the hostname of a Linux box, that doesn’t work for Ubuntu 18.04. The hostname will remain unchanged. Instead, modify as follows.

In /etc/cloud/cloud.cfg, modify “preserve_hostname” from “false” to “true”:

vi /etc/cloud/cloud.cfg

Modify hostname to the value you want in /etc/hostname:

vi /etc/hostname

Reboot

New iDRAC Ansible module: Version 1.1 released

The recently released version 1.1 adds streaming Server Configuration File (SCP) support, enhanced RAID creation and many other goodies! See the release notes here for details: Dell EMC Ansible modules version 1.1

Below are some installation instructions (in particular for those who have been using the original Ansible modules).

System used:
CentOS 7.5

Get the new Ansible modules for iDRAC off Github:

git clone https://github.com/dell/Dell-EMC-Ansible-Modules-for-iDRAC.git

Get the Dell EMC OpenManage Python SDK off Github:

git clone https://github.com/dell/omsdk.git

Remove some packages or we will run into errors during the SDK install:
NOTE: This will uninstall Ansible. Backup your /etc/ansible/hosts file prior to Ansible removal!

[jonas@centossysmgmt01 omsdk]$ sudo yum remove python2-enum34.noarch python-enum34.noarch PyYAM

Install the Dell EMC OpenManage Python SDK prerequisites:

[jonas@centossysmgmt01 Redfish]$ cd omsdk/
[jonas@centossysmgmt01 omsdk]$ sudo -H pip install -r requirements-python2x.txt

Reinstall Ansible:

 [jonas@centossysmgmt01 omsdk]$ sudo yum install ansible -y 

Install wheel:

 [jonas@centossysmgmt01 omsdk]$ sudo -H pip install wheel 

Build .whl file:

 [jonas@centossysmgmt01 omsdk]$ sh ./build.sh 1.2 345 

Install the newly built module:

[jonas@centossysmgmt01 omsdk]$ cd dist/
[jonas@centossysmgmt01 dist]$ sudo pip install omsdk-1.2.345_-py2.py3-none-any.whl

Install the new Dell EMC Ansible modules for iDRAC:

[jonas@centossysmgmt01 dist]$ cd ../../Dell-EMC-Ansible-Modules-for-iDRAC/
[jonas@centossysmgmt01 Dell-EMC-Ansible-Modules-for-iDRAC]$
[jonas@centossysmgmt01 Dell-EMC-Ansible-Modules-for-iDRAC]$ sudo python ./install.py
Dell EMC OpenManage Ansible Modules installation has started.
Checking prerequisites...

OpenManage Software Development Kit is installed.
Installing Dell EMC OpenManage Ansible Modules specific folders and files...
SUCCESS: Dell EMC OpenManage Ansible Modules is installed successfully.

All done! The new Ansible modules are installed.

Modifying /etc/ansible/hosts:
The previous version of the Dell EMC Ansible modules for iDRAC required the following format:

[myhosts]
# hostname OOB controller IP/NAME
r730xd baseuri=192.168.1.1
r620 baseuri=192.168.1.2

The new modules require some different variables:


[hosts]
# hostname     OOB controller IP/NAME
r730xd         idrac_ip=192.168.1.1 idrac_user=root idrac_pwd=calvin
r620           idrac_ip=192.168.1.2 idrac_user=root idrac_pwd=calvin
fm120_1a       idrac_ip=192.168.1.11 idrac_user=root idrac_pwd=calvin
fm120_1c       idrac_ip=192.168.1.13 idrac_user=root idrac_pwd=calvin
fm120_1d       idrac_ip=192.168.1.14 idrac_user=root idrac_pwd=calvin
#fm120_2b       idrac_ip=192.168.1.16 idrac_user=root idrac_pwd=calvin
fm120_2c       idrac_ip=192.168.1.17 idrac_user=root idrac_pwd=calvin
#fm120_2d       idrac_ip=192.168.1.18 idrac_user=root idrac_pwd=calvin
fc620           idrac_ip=192.168.1.19 idrac_user=root idrac_pwd=calvin

Trying it out:

Working perfectly 🙂

Arduino powered LED sign

Using an Arduino UNO and 8 strips of Neopixel ws2812 strips (60 LED/m) I was able to recreate the awesome LED sign created by Josh here: https://youtu.be/k-SYMPO8-f8

Needed some text to test it and picked the cf push haiku by Onsi Fakhouri:

cf push haiku here is my source code run it on the cloud for me i do not care how”

 

Expanded sources.list for Ubuntu server 18.04

By default, if the new installer is utilized when deploying Ubuntu server 18.04, the /etc/apt/sources.list will contain only two entries. This doesn’t cover much, so to expand it to be a bit more useful we replace it with:

deb http://jp.archive.ubuntu.com/ubuntu/ bionic main restricted
deb http://jp.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb http://jp.archive.ubuntu.com/ubuntu/ bionic universe
deb http://jp.archive.ubuntu.com/ubuntu/ bionic-updates universe
deb http://jp.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://jp.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
deb http://jp.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse

Note that this is for Japan (“jp”). Change this to “us” or similar to match your region if not in Japan.

Set network settings with netplan

If your system is using netplan for network configuration, change settings in “/etc/netplan/50-cloud-init.yaml”:

DHCP:

jonas@kube-c1-n3:~$ cat /etc/netplan/50-cloud-init.yaml
network:
    ethernets:
        enp0s3:
            addresses: []
            dhcp4: true
    version: 2
jonas@kube-c1-n3:~$ sudo netplan apply

Static IP:
jonas@kube-c1-n3:~$ cat /etc/netplan/50-cloud-init.yaml
network:
    ethernets:
        enp0s3:
            addresses: [192.168.10.103/24]
            gateway4: 192.168.10.1
            dhcp4: no
    version: 2
jonas@kube-c1-n3:~$ sudo netplan apply

Note that “gateway4” should only be set for the default route interface.

Atom editor window appearing outside of screen boundaries

If one disconnects an external monitor / projector the Atom editor window has a tendency to show up outside of the screen boundaries – just as if the external monitor was still attached. It took a while to figure out how to get it back again:

  1. Select the Atom window (using Alt-Tab or mouse)
  2. Open the context menu with Alt-Space
  3. Select move using “m”
  4. Press any of the arrow keys
  5. The Atom window will now be possible to drag back to the main monitor using the mouse

This was mentioned in a GitHub thread here: https://github.com/atom/atom/issues/6939

 

sudo without password

Add the following line at the end of /etc/sudoers (just after “#includedir /etc/sudoers.d”):

username ALL=(ALL) NOPASSWD: ALL

In my case:

#includedir /etc/sudoers.d
jonas ALL=(ALL) NOPASSWD: ALL

Check swap on Ubuntu

jonas@yggdrasil:~$ sudo swapon --show
NAME      TYPE       SIZE USED PRIO
/dev/dm-2 partition 11.9G   0B   -1
jonas@yggdrasil:~$

jonas@yggdrasil:~$ sudo free -m
              total        used        free      shared  buff/cache   available
Mem:          11925        9240         911         305        1773        2110
Swap:         12195           0       12195
jonas@yggdrasil:~$ 

Wipe USB drive in Linux by overwriting with random data

Handy way to wipe a USB drive in Linux using dd and /dev/urandom:

jonas@yggdrasil:~$ sudo dd if=/dev/urandom of=/dev/sdc bs=4k
dd: error writing '/dev/sdc': No space left on device
15163393+0 records in
15163392+0 records out
62109253632 bytes (62 GB, 58 GiB) copied, 2227.1 s, 27.9 MB/s

Of course, make sure /dev/sdX is the USB device you want to wipe. DD isn’t being referred to as the “Disk Destroyer” for nothing 🙂