ERROR Guest name ‘img-build-centos7-amd64’ is already in use.

For whatever reason, the maas-image-builder script for CentOS 7 does not like our local mirror.  We’ll investigate further.  But the problem is that it leaves the qemu vm in a bit of a half baked state.  The process fails, but it doesn’t clean up after itself.  No matter, as we can just as easily do that ourselves.

root@tnewman3:~/maas-image-builder# ./bin/build centos amd64 –centos-edition 7
Formatting ‘/tmp/img-builder-3Eef5T/disk.img’, fmt=raw size=5368709120
WARNING  KVM acceleration not available, using ‘qemu’
ERROR    Guest name ‘img-build-centos7-amd64’ is already in use.
Traceback (most recent call last):
  File “./bin/build”, line 45, in
    sys.exit(main(args))
  File “/root/maas-image-builder/builder/main.py”, line 108, in main
    osystem.build_image(args)
  File “/root/maas-image-builder/builder/osystems/centos.py”, line 101, in build_image
    super(CentOS, self).build_image(params)
  File “/root/maas-image-builder/builder/osystems/__init__.py”, line 158, in build_image
    extra_args=extra_arguments)
  File “/root/maas-image-builder/builder/virt.py”, line 76, in install_location
    subprocess.check_call(args)
  File “/usr/lib/python2.7/subprocess.py”, line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[u’virt-install’, u’–name’, u’img-build-centos7-amd64′, u’–ram’, u’2048′, u’–arch’, u’x86_64′, u’–vcpus’, u’1′, u’–os-type’, u’linux’, u’–os-variant’, u’rhel5′, u’–disk’, u’path=/tmp/img-builder-3Eef5T/disk.img,format=raw’, u’–network’, u’bridge=virbr0,model=virtio’, u’–location’, u’http://yum.tamu.edu/centos/7/os/x86_64′, u’–initrd-inject=/root/maas-image-builder/contrib/centos/centos7/centos7-amd64.ks’, u’–extra-args=console=ttyS0 inst.ks=file:/centos7-amd64.ks text inst.cmdline inst.headless’, u’–noreboot’, u’–nographics’, u’–force’]’ returned non-zero exit status 1
root@tnewman3:~/maas-image-builder# virsh list –all
 Id    Name                           State
—————————————————-
 4     img-build-centos7-amd64        running

root@tnewman3:~/maas-image-builder# virsh undefine  img-build-centos7-amd64
Domain img-build-centos7-amd64 has been undefined

root@tnewman3:~/maas-image-builder# virsh list –all
 Id    Name                           State
—————————————————-
 4     img-build-centos7-amd64        running

root@tnewman3:~/maas-image-builder# virsh destroy  img-build-centos7-amd64
Domain img-build-centos7-amd64 destroyed

root@tnewman3:~/maas-image-builder# virsh list –all
 Id    Name                           State
—————————————————-

root@tnewman3:~/maas-image-builder#
Now we can set about the task of building the image once more.

Ubuntu MaaS + maas-image-builder + CentOS 6

Ubuntu recently announced support for other operating systems to be deployed with their Metal as a Service provisioning utility.  The hosting company that I work for is primarily a CentOS and Windows shop, so I was curious to experiment with this utility.  While it is still in a testing phase for us, this shows great promise as a replacement for our existing PXE server.

I just used MaaS to successfully install CentOS on one of the nodes in my test network about 30 minutes ago, so bear with me.  This will likely be a working document.

My test setup consists of:

  • A Dell 1950 server performing NAT duties connected to one of our access switches.
  • The other port on the NAT box is connected to my test Cisco switch (not the access switch).  NOTE:  Something that gave me a bit of headache in the beginning was link negotiation between the switch and the interfaces on my servers.  Spanning-tree portfast is your friend.  Initially, I suspected that it was a firmware issue (BMC firmware), but really it was the interfaces not coming up in a timely manner.  I was able to successfully install Ubuntu on other servers that did not have up-to-date BMC firmware.
  • Connected to to the test switch is an Ubuntu server with MaaS installed.
  • Multiple “node” servers (Dell 1950’s of varying specs) are also connected to the test switch.

Installing and getting MaaS up and running is straightforward enough, and Ubuntu’s documentation is sufficient.  Initially, I tried to model my setup after their topology diagram on their site, with a ‘Region Controller’ manipulating satellite ‘Cluster Controllers’.  I may come to back to that (my setup was torn down and rebuilt a few times during this whole process), but for our testing purposes, one MaaS server to start.

I did a couple of Ubuntu installs just to make sure all the vanilla MaaS functionality was working as it should.  Again, for our purposes, an Ubuntu-only provisioning system would not be practical.  The focus then shifted to how to use MaaS to provision CentOS.

I suspect that because this feature is relatively new, there is not a lot of documentation on this subject.

The kind folks over at #maas on freenode directed me to a script on Github.  I was unable to use the script directly, but after close examination discovered something interesting.

command sudo ./bin/build centos amd64 –centos-edition 7

HMMMM.  So I got to googling..  and found this:  maas-image-builder  So, I downloaded it, and poked around a bit.  From the readme:

root@tnewman3:~/maas-image-builder# cat README

Automated building system for tarball images used by the curtin installer.

Supported Operating Systems:
 – CentOS 6 (i386, amd64)
 – CentOS 7 (amd64)
 – RHEL 7 (amd64)

Well that seems really flipping promising.  So, using that previously mentioned script as a template, I issued the following command to install the necessary dependencies:

./bin/build –install-deps

I let that complete, then for the magical part:

./bin/build centos amd64 –centos-edition 6

I should note that we doctored /maas-image-builder/builder/osystems/centos.py to use our own mirrors at  http://dist1.800hosting.com/centos/  This sped up the process considerably.

Basically, an image gets installed into a QEMU VM, a snapshot is taken, and that is the image that MaaS pushes to provision servers.

In the script the author jjasghar suggests grabbing a coffee.  On the hardware that I was using, it took a VERY VERY long time.  Though I can’t say exactly how long it took, because I left the image to bake over night.  It was on 2 hours when I left for the day.

When I came back in the morning, I checked to see if the process had completed, and sure enough:

root@tnewman3:~/maas-image-builder# ls -al build-output/
total 540132
drwxr-xr-x 2 root root      4096 Feb 20 10:17 .
drwxr-xr-x 7 root root      4096 Feb 19 22:02 ..
-rw-r–r– 1 root root 276538776 Feb 19 22:02 centos6-amd64-root-tgz
-rw-r–r– 1 root root 276538776 Feb 20 10:17 centos6-amd64-root-tgz.bak

 (I immediately made a backup of the image just to be safe)

Wonder of wonders, the process completed!

Referring back to centos.rb, the next step is to add the newly created image to the MaaS service itself.  This was achieved by:

root@tnewman3:~# maas root boot-resources create name=centos/centos6 architecture=amd64/generic content@=/root/maas-image-builder/build-output/centos6-amd64-root-tgz

Again, slightly modified from the version in the centos.rb script to use the MaaS user (‘root’) that I had created and to reflect our choice of CentOS 6 and not CentOS 7.

From there, I went into the MaaS options in the web interface, specified ‘CentOS’ as the ‘Default operating system used for deployment’ and CentOS 6.0 the Default OS release used for deployment and went about commissioning and provisioning a server as usual!

I logged in with

root@tnewman3:~# ssh cloud-user@192.168.0.4

No password is required, as it uses the SSH key that it would normally use for any other provision.

I hope that this write-up of my MaaS CentOS experience is helpful to others and I welcome feedback!  I will update this post with tweaks and modifications as we tailor MaaS to fit into our existing workflow.

TL;DR – It is quite possible to provision CentOS with Ubuntu’s MaaS service.

Non-update Update 4-2-15:
When I was working on this I got kind of consumed by it.  Very intense work on it..  and then..  nuthin.  I am sure we will come back to this at some point.  Thank you very much for all the interest in my post, but at least as of today, this post is not being maintained.  I do hope that Ubuntu/Canonical adds some serious documentation as the MaaS feature matures.

My New Old Dell Latitude D620

Out of the kindness of his heart, my good buddy, Andrew, has donated a gently used Dell D620 laptop to my collection. 

Not a super beast of a machine, but that’s not what I need it for.  As you can see, I currently have CentOS 6.5 installed.  I initially started with CentOS 7, but I couldn’t find wireless drivers anywhere for it, so I downgraded to 6.5 on a whim.  As you can see in that first picture, wireless works… out of the box.  Suspend works too!  So if you had any questions regarding the maturity of CentOS 6..  Here’s your sign.  As much as I might like the slickness of CentOS 7, functional hardware is more important.

Btw, output from LSPCI regarding the internal wireless:
Broadcom Corporation BCM4311 802.11b/g WLAN (rev 01)

Also, I just can’t say no to GNOME 2.  I’ve really missed it.  Its simple, functional, responsive, customizable..  Not that GNOME 3 is bad, but there’s a certain quaintness to GNOME 2.  This was the desktop environment that I used with Ubuntu when I first started using Linux, so there’s a bit of nostalgia, too.

No official Chromium (or Google Chrome) support at this point, but Firefox works well enough.  Besides, other than the Google sign-in feature, I wasn’t really using any Chrome-specific features anyway (built-in Flash was nice though..)

So, new possibilities!  With a mobile Linux rig, I can hop on my bike and Linux at the library, or the coffee shop, or wherever.  Not to mention lugging the old Dell desktop that mom gave me to and from Andrew’s place was getting kind of old.

So that’s the good, the bad: needs a new battery, currently has a DVD-ROM/CD-RW drive.

New batteries replacements aren’t so bad, ~$20.  DVD-RW drives for less than that.  What’s more intriguing, is that there’s another battery that I can buy that goes where the optical drive goes.  With a fresh new replacement battery and a beefy internal battery to go with it..  plenty of juice for the road.  The hard drive is a little on the small side..  Ultimate replacement would be an SSD.. and I’m sure it would make a huge difference in responsiveness..  But that’s pricey and can wait.

So if this sounds like something that might appeal to you, I highly recommend it!  If you’re looking for a budget (sub-$200) Linux lappy, the Dell D620 is pretty good!

Wireless Success on CentOS 7 with ath5k

[travnewmatic@localhost ~]$ sudo lspci | grep Wireless
05:00.0 Ethernet controller: Qualcomm Atheros AR2413/AR2414 Wireless Network Adapter [AR5005G(S) 802.11bg] (rev 01)

…was no work out of the box.  Ethernet was sufficient since my computer is located near the router.  My D-Link DWA-1320 wireless PCI card has been a champ ever since I’ve owned it.  Its handled everything from XP, to Win7, to OS X SL, multiple versions of Ubuntu and Debian..  but oddly enough was not ready out of the box with CentOS.  I was determined, did a bit of Googling and viola!  Found the driver in a package in the ELRepo.org repository.  Installed the ‘kmod-ath5k’ package, restarted, and wireless worked!

Thanks ELRepo.org!

Updated repolist:

[travnewmatic@localhost ~]$ sudo yum repolist
[sudo] password for travnewmatic: 
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror-centos.hostingswift.com
 * elrepo: ftp.utexas.edu
 * elrepo-extras: ftp.utexas.edu
 * elrepo-kernel: ftp.utexas.edu
 * epel: mirrors.tummy.com
 * extras: centos.mirror.lstn.net
 * nux-dextop: mirror.li.nux.ro
 * rpmforge: mirror.nexcess.net
 * rpmforge-extras: mirror.nexcess.net
 * updates: dallas.tx.mirror.xygenhosting.com
repo id                   repo name                                       status
base/7/x86_64             CentOS-7 – Base                                 8,465
elrepo                    ELRepo.org Community Enterprise Linux Repositor    53
elrepo-extras             ELRepo.org Community Enterprise Linux Extras Re     3
elrepo-kernel             ELRepo.org Community Enterprise Linux Kernel Re    21
epel/x86_64               Extra Packages for Enterprise Linux 7 – x86_64  5,610
extras/7/x86_64           CentOS-7 – Extras                                  30
google-chrome             google-chrome                                       3
google-talkplugin         google-talkplugin                                   1
nux-dextop/x86_64         Nux.Ro RPMs for general desktop use             1,301
nux-dextop-testing/x86_64 Nux.Ro RPMs for general desktop use – testing       5
rpmforge                  RHEL 7 – RPMforge.net – dag                       245
rpmforge-extras           RHEL 7 – RPMforge.net – extras                     10
updates/7/x86_64          CentOS-7 – Updates                                736
virtualbox/7/x86_64       Oracle Linux / RHEL / CentOS-7 / x86_64 – Virtu     1
repolist: 16,484

I heart CentOS 7

So I’ve been using CentOS 7 as my desktop OS for a few days now.  Made significant headway in the edX Linux intro course, and things are going very very well.  Since the course uses CentOS 6.5, I’ve created a virtual machine (in virtual box) to fiddle with and to do the activities in.  However, CentOS 7 is current and of course I couldn’t see any reason not to use the latest and greatest for my own self.

Why do I like it?

No stability issues like I was having under Debian.  Granted, I’m not using the Nvidia drivers I was using on the Debian install so that may have something to do with it.  Zero freezes, can’t complain.

Opportunity to learn something new, its an industry standard.  Good prep for the RHEL cert maybe?

Great additional repos!  Skype in a repo?  I’ll take it!

[travnewmatic@localhost ~]$ yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.centarra.com
 * epel: mirrors.tummy.com
 * extras: mirror-centos.hostingswift.com
 * nux-dextop: mirror.li.nux.ro
 * rpmforge: mirror.us.leaseweb.net
 * updates: centosc5.centos.org
repo id                          repo name                                                         status
base/7/x86_64                    CentOS-7 – Base                                                   8,465
epel/x86_64                      Extra Packages for Enterprise Linux 7 – x86_64                    5,740
extras/7/x86_64                  CentOS-7 – Extras                                                    30
google-chrome                    google-chrome                                                         3
google-talkplugin                google-talkplugin                                                     1
nux-dextop/x86_64                Nux.Ro RPMs for general desktop use                               1,276
rpmforge                         RHEL 7 – RPMforge.net – dag                                         245
updates/7/x86_64                 CentOS-7 – Updates                                                  726
virtualbox/7/x86_64              Oracle Linux / RHEL / CentOS-7 / x86_64 – VirtualBox                  1
repolist: 16,487