Saturday, October 8, 2016

Setup Raspberry Pi 3 with Raspbian with PIXEL, VNC

I'm a total noob on Raspberry Pi's. I was given one as a vExpert gift in VMworld 2016 by Datrium. This was the coolest and nicest gift in my opinion.

Rapsberry Pi 3 Model B is a very capable device - much more than I anticipated. I'm having a lot of fun with it!

Some tips (amazon links are my affiliate links):

You need a good power supply that can give 2.5A at 5V - otherwise you will start seeing problems. I chose this one by Canakit from amazon because it was cheap, on Prime shipping, and well rated, and reviews of a cheaper one said the power block was too big, and this one is a good size.

I installed it on a SD card that I had around, only to find what anyone that manages servers knows - storage speed maters. I just bought a new Samsung EVO+ that had good reviews and a good price. This one had better random write than the Pro series, which is what really should matter for most things. Note that the Raspberry Pi 3 can't take full advantage of UHS so no point in getting a UHS-3 card. This was a great table showing different cards.

I used Rufus with the Raspbian Jessie with PIXEL. PIXEL is a new window manager ( and real nice to be honest). I checked the downloaded file with the SHA-1 signature, unzipped with 7zip and then opened Rufus, browsed to the img file and let it do it's thing, no need to select anything special, it selected DD mode on it's own, etc.

Connected a HDMI monitor, mouse, keyboard, popped SD card in and connected power - it came up quickly and without issues, and immediately you were logged in to a nice GUI.

From the graphical interface I was able to join my WPA wifi network without problems. Of note, SSH is enabled by default. The user is pi with password raspberry

Once you have internet you should update your linux server. This is debian, so you must use sudo apt-get update && sudo apt-get dist-upgrade to maintain the software with the latest release.

I was able to connect an apple ethernet dongle and it recognized it immediately, and now I can use this device as a small networking router/firewall on two separate subnets (and use wireless as management). Sent the pictures out in a tweet:

https://twitter.com/arielsanchezmor/status/784246876736368640

I wanted to get console access to the Pi - not a separate session through X (MobaTerm did this easily) but the actual console that I would see if I connected the monitor again. There are lots of tutorials out there that recommend installing TightVNC, but RealVNC is now included with Raspbian. It just has to be enabled. I find the raspi-config command and its matching options in the GUI to be a pleasure to usei.

One thing I found where I don't agree with the official instructions is how to prevent the minimal resolution if no HDMI cable is attached. Instead of forcing the HDMI connection (which if at some point later, if you connect a monitor, will conflict) you can change the default console resolution and achieve a similar thing - you just need to un-comment the two lines in /boot/config.txt . In my case, since my smallest laptop is 1366x768, the defaults of 1280x720 work great in full screen mode, and is decent enough from other screens.





You can also install Xming and redirect X from PuTTY, and it may be I use that in the future to disable VNC and save on resources - but since it was included already in Raspbian, I decided to give it a go and it works very well.

As I play more with it, I'll put more articles, but for now, I can open Chromium and practice against an always on Debian like system - great for studying for LFCS (choosing the Ubuntu track).

The only other thing I want to do is install OpenBSD, but from what i've read, some of the  Pi3 components are closed source and thus will never make it into the OS. Shame as I was looking to use pf instead of iptables!

Saturday, October 1, 2016

Nested Nutanix CE on ESXi - create your own vmdk descriptor

Why they don't provide a bootable ISO that can install to a bare VM disk, like everyone else does, is beyond me.

Instead, you get a bootable disk image, which you are supposed to rename, upload and use as the boot disk. All the tutorials I found on the net provided a text file to use as the vmdk descriptor. The ones I found were the best were by Joep Piscaer and Michael Webster.

None of the few posts I read ( and I only read 3 or 4) explained how the descriptor file was created. In my case, because the Nutanix CE file has changed from when the blog posts where published, I couldn't use the text file (not sure if just the cylinders value had to be adjusted, or what). So I created my own. I thought I would share how I did it.

1) Create a VM (following the other post's instructions) but instead of following the text file advice, add a new disk that is the exact size as the img file (that you extracted from the .gz download). For "ce-2016.08.27-stable.img" it was exactly 7100 MB.

2) Upload the img file to the datastore in the same folder as where you created the disk, with any name. In the following SSH session output, orange is the new empty disk created, green is the uploaded extracted file. Notice they are the same size.

[root@arielitox:/vmfs/volumes/5557fee9-bd5cfd2a-29f6-5404a61bb2db/Nutanix CE v1] ls -al
total 14550032
drwxr-xr-x    1 root     root          2380 Oct  2 02:01 .
drwxr-xr-t    1 root     root          4200 Sep 30 19:07 ..
-rw-------    1 root     root          8684 Oct  1 21:33 Nutanix CE v1.nvram
-rw-r--r--    1 root     root             0 Sep 30 19:07 Nutanix CE v1.vmsd
-rwxr-xr-x    1 root     root          3111 Oct  2 02:01 Nutanix CE v1.vmx
-rw-------    1 root     root     536870912000 Oct  1 21:39 Nutanix CE v1_2-flat.vmdk
-rw-------    1 root     root           506 Oct  1 21:39 Nutanix CE v1_2.vmdk
-rw-------    1 root     root     7444889600 Oct  2 01:59 Nutanix CE v1_3-flat.vmdk
-rw-------    1 root     root           472 Oct  2 02:01 Nutanix CE v1_3.vmdk
-rw-------    1 root     root     7444889600 Sep 30 19:24 ce.vmdk
-rw-r--r--    1 root     root         55642 Oct  1 21:36 vmware-3.log
-rw-r--r--    1 root     root         57243 Oct  1 21:36 vmware-4.log
-rw-r--r--    1 root     root         58555 Oct  1 21:37 vmware-5.log
-rw-r--r--    1 root     root         58340 Oct  1 21:39 vmware-6.log
-rw-r--r--    1 root     root         57322 Oct  1 21:39 vmware-7.log
-rw-r--r--    1 root     root         58631 Oct  1 21:44 vmware-8.log

3) Use the move command to overwrite the empty file with the same name as the file you created (your name will vary). I do this so we don't need to change the small vmdk descriptor file using vi. After running the command, notice the uploaded image file name no longer exists; move overwrites without confirmation, and now the image file contents are in the vmdk that we had created.

[root@arielitox:/vmfs/volumes/5557fee9-bd5cfd2a-29f6-5404a61bb2db/Nutanix CE v1] mv ce.vmdk "Nutanix CE v1_3-flat.vmdk"
[root@arielitox:/vmfs/volumes/5557fee9-bd5cfd2a-29f6-5404a61bb2db/Nutanix CE v1] ls -al
total 7279632
drwxr-xr-x    1 root     root          2240 Oct  2 02:02 .
drwxr-xr-t    1 root     root          4200 Sep 30 19:07 ..
-rw-------    1 root     root          8684 Oct  1 21:33 Nutanix CE v1.nvram
-rw-r--r--    1 root     root             0 Sep 30 19:07 Nutanix CE v1.vmsd
-rwxr-xr-x    1 root     root          3111 Oct  2 02:01 Nutanix CE v1.vmx
-rw-------    1 root     root     536870912000 Oct  1 21:39 Nutanix CE v1_2-flat.vmdk
-rw-------    1 root     root           506 Oct  1 21:39 Nutanix CE v1_2.vmdk
-rw-------    1 root     root     7444889600 Sep 30 19:24 Nutanix CE v1_3-flat.vmdk
-rw-------    1 root     root           472 Oct  2 02:01 Nutanix CE v1_3.vmdk
-rw-r--r--    1 root     root         55642 Oct  1 21:36 vmware-3.log
-rw-r--r--    1 root     root         57243 Oct  1 21:36 vmware-4.log
-rw-r--r--    1 root     root         58555 Oct  1 21:37 vmware-5.log
-rw-r--r--    1 root     root         58340 Oct  1 21:39 vmware-6.log
-rw-r--r--    1 root     root         57322 Oct  1 21:39 vmware-7.log
-rw-r--r--    1 root     root         58631 Oct  1 21:44 vmware-8.log

Your VM should be able to boot. In my case, I did assign this disk a SATA controller, so I went in BIOS and set that one to be the first boot disk, and now I could see the Nutanix splash screen, and get the installer prompt a bit later.

This procedure should work for any other release of Nutanix CE (as long as this awkward img method is used). Feel free to use this text file for release 2016.08.27-stable, but at least you know how it was created in case it doesn't work for you:

[root@arielitox:/vmfs/volumes/5557fee9-bd5cfd2a-29f6-5404a61bb2db/Nutanix CE v1] vi "Nutanix CE v1_3.vmdk"

# Disk DescriptorFile
version=1
encoding="UTF-8"
CID=5c98c0d4
parentCID=ffffffff
isNativeSnapshot="no"
createType="vmfs"

# Extent description
RW 14540800 VMFS "Nutanix CE v1_3-flat.vmdk"

# The Disk Data Base
#DDB

ddb.adapterType = "ide"
ddb.geometry.cylinders = "14425"
ddb.geometry.heads = "16"
ddb.geometry.sectors = "63"
ddb.longContentID = "f93da8daf3cd8a949323e2d55c98c0d4"
ddb.uuid = "60 00 C2 90 85 79 c8 33-48 87 1c 59 12 32 c3 6a"
ddb.virtualHWVersion = "11"