Unifi Controller on 16.04

Steps to install the UniFi controller on Ubuntu 16.04.  Note that the package depends on JRE7, so we must add the ppa repo to apt.

echo "deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti" > /etc/apt/sources.list.d/ubnt.list
apt-key adv --keyserver keyserver.ubuntu.com --recv C0A52C50

sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update

sudo apt-get install unifi

Expand Ubuntu LVM

Expand an existing Ubuntu LVM without creating additional partitions, or adding to LVM VGs:

  1. Expand the physical device (VMware, HyperV, DD to a new physical device,  etc)
  2. Use offline GParted cd to re size the extended partition on which LVM lives
  3. In live OS, use parted “resizepart” to extend the logical partition inside of the previously re sized extended partition
    (parted) resizepart
    Partition number? 5
    End? [268GB]? 1099GB
    
  4. reboot
  5. use LVM to resize the PV:
    pvresize /dev/sda5
  6. resize the filesystem in the LV:
    resize2fs

 

References:

Install QLC+ Ubuntu 16.04

Steps for installing Q Light Controller + on Ubuntu 16.04 x86_64

  1. Install Dependencies:
    sudo apt-get install libqtdbus4 qtcore4-l10n libqt4-xml libmng2 libqt4-declarative libqt4-sql libqt4-xmlpatterns libftdi1 libqt4-network libqt4-script libqtcore4 libqtgui4
  2. Download the DEB
    wget http://www.qlcplus.org/downloads/4.10.4/qlcplus_4.10.4_amd64.deb
  3. Install
    sudo dpkg -i qlcplus_4.10.4_amd64.deb

Windows 7 Update Pain!

For those unfortunate enough to still be deploying Windows 7, I implore you to ensure your workstations have at least one of  the following updates to save yourself much pain:

These updates address a situation where the Windows Update client causes the machine to grind to a halt. This can be especially troublesome if you’re beginning to manage your environment with SCCM (even if you’re only deploying SCEP updates) as SCCM’s updating mechanism relies upon the Windows Update client.

So, before you deploy any updates to Windows 7 clients, ensure the machines have the above KB’s installed!

For more information, follow this TechNet blog post: https://social.technet.microsoft.com/Forums/windows/en-US/4a782e40-bbd8-40b7-869d-68e3dfd1a5b4/windows-update-scan-high-memory-usage?forum=w7itproperf&prof=required

DNSMasq as a DHCP Relay Target

DNS Masq is a great little DNS and DHCP combo server built into most DDWRT images, and available in most Linux distributions.

With it you can define custom DNS A records:

address=/owncloud/owncloud.somedomain.org/192.168.10.12
address=/unifi/unifi.somedomain.org/192.168.10.12

You can also define multiple DHCP scopes. This comes in handy if you want to configure the DNSMasq server as the DHCP Helper (or DHCP Relay) on your switch:

dhcp-range=devices,192.168.10.100,192.168.10.200,255.255.255.0,1m
dhcp-range=guest,192.168.20.100,192.168.20.200,255.255.255.0,1m

If you specify multiple ranges, you’ll also need to configure the default gateway for each of these networks:

dhcp-option=devices,3,192.168.10.1
dhcp-option=guest,3,192.168.20.1

You can also create DHCP reservations for specific hosts by MAC address:

dhcp-host=00:1e:c9:4a:d7:fe,owncloud,192.168.10.12,1h
dhcp-host=04:18:d6:52:77:88,AP,192.168.1.4,1h
dhcp-host=70:77:81:B6:03:71,Printer,192.168.20.58,5m

Resources:

Schema Validation Errors While Setting an XML Node Value

When attempting to set the node value in an InfoPath form with code, “schema validation” errors may appear.   This is primarily caused by attempting to set the value of a field with one of the following data types:

  • Whole Number (integer)
  • Decimal (double)
  • Date (date)
  • Time (time)
  • Date and Time (dateTime)

The workaround is to remove the “nil” attribute from the element:

public void DeleteNil(XPathNavigator node)
{
if (node.MoveToAttribute(“nil”, “http://www.w3.org/2001/XMLSchema-instance”))
      node.DeleteSelf();
}

Additional Resources:

Managing ZFS Snapshots

ZFS is a great file system, providing much flexibility, and simple administration.   It was originally developed for Sun operating systems, but has been ported to Linux, and support is now baked in to Ubuntu Server 15.10.

ZFS natively supports snapshots, but there is a tool for automagically creating, and aging snapshots: https://github.com/zfsnap/zfsnap.  (Man page: http://www.zfsnap.org/zfsnap_manpage.html)

Installation is fairly straight forward:

  • clone the Git repo
  • copy the files to /usr/local/src
  • create a link to the binaries path:
    ln -s /usr/local/src/zfsnap/sbin/zfsnap.sh /usr/local/sbin/zfsnap

After that, set up a crontab for automatic snapshot creation:

crontab -e
26 * * * * /usr/local/sbin/zfsnap snapshot -a 5d -r tank

And finally, set up crontab for automatic snapshot deletion:

 0  1 * * * /usr/local/sbin/zfsnap destroy -r tank 

Let’s Encrypt Setup

The “Let’s Encrypt” setup process is very painless – Just clone a Git repo, run a comand, and edit some apache config files.

  1. sudo apt-get install git
  2.  sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
  3. cd /opt/letsencrypt
  4. ./letsencrypt-auto –apache -d ccrossan.com -d www.ccrossan.com
  5. edit the sites-enabled config files so that the appropriate virtual host uses the correct ssl certs.
  6. delete the newly generated ssl.conf file
  7. restart apache
  8. [Optional] Set up Cron for auto-renew
  9. sudo crontab -e
  10. 30 2 * * 1 /opt/letsencrypt/letsencrypt-auto renew >> /var/log/le-renew.log

 

These commands taken from the DigitalOcean Let’s Encrypt Setup Guide

SCCM 1511 Driver Migration Fails

While migrating drivers from SCCM 2012 to SCCM 1511, the migration can fail with the following error message:

Couldn't find the specified instance SMS_CategoryInstance.CategoryInstance_UniqueID='DriverCategories:

This occurs given the following scenario:

  1. A driver is added to SCCM
  2. A category is assigned to the driver
  3. The category is deleted from the driver
  4. The migration job attempts to migrate the driver to a new SCCM environment

Consider the following error message:

Couldn't find the specified instance SMS_CategoryInstance.CategoryInstance_UniqueID='DriverCategories:78266da1-ebac-4c12-b2c8-89451383b03e

An In-depth analysis shows that the driver category does not appear in the WMI Class SMS_CategoryInstance:

Get-WmiObject -Namespace $Namespace -Class SMS_CategoryInstance -Filter "CategoryInstance_UniqueID = 'DriverCategories:78266da1-ebac-4c12-b2c8-89451383b03e'"

Returns Null, but a SQL query indicates that the Category Instance still exists:
SELECT * FROM CI_CategoryInstances

WHERE CategoryInstance_UniqueID
LIKE ‘%78266da1-ebac-4c12-b2c8-89451383b03e%’

 

Returns the following:

CategoryInstanceID CategoryInstance_UniqueID CategoryTypeName DateLastModified SourceSite ParentCategoryInstanceID IsDeleted rowversion
16777602 DriverCategories:78266da1-ebac-4c12-b2c8-89451383b03e DriverCategories 2015-07-27 11:52:33.000 CM1 NULL 1 0x000000000A36B34D

Take note of the “IsDeleted” column – set to True

So, at this point, WMI reports that this category no longer exists; however the category is still in the SQL Database, though this is not the root of the problem.

Now consider the WMI Class SMS_CategoryInstanceMembership:
This class contains a correlation of Objects to CategoryIDs.  This is not limited to Driver <-> Driver Category correlation.

The true bug seems to be that when a driver category is removed, the entry for that driver category in the  SMS_CategoryInstanceMembership class is not removed.  In order to fix this, and have a successful migration, we need to manually remove the CategoryInstanceMembership object for any drivers that were assigned a now deleted category.

to Fix:

  1. Fire Up SQL Server Management Studio
  2. Create a New Query, and select your Site Database
  3. For each failing driver entry (as seen in “C:\Program Files\Microsoft Configuration Manager\Logs\migmctrl.log”),
    1. Run the following SQL Query:
      SELECT * FROM CI_CategoryInstances
      WHERE CategoryInstance_UniqueID
      LIKE '%c6e9d9e3-1371-46ba-b7f1-bb46c5b6bc06%'
    2. Note the CategoryInstanceID  (should be like 16777601)
    3. On your SCCM Server, from an administrative PowerShell run the following code to remove the association, substituting the CategoryInstanceID you discovered in step 3-2:
      Get-WmiObject -Namespace $Namespace -Class SMS_CategoryInstanceMembership -Filter "CategoryInstanceID = '16777601'" | Foreach-Object {
      Remove-WmiObject -InputObject $_
      }
  4. Repeat the above section for each unique CategoryInstance_UniqueID listed in the “C:\Program Files\Microsoft Configuration Manager\Logs\migmctrl.log” file.
  5. When complete, retry the migration, and examine for any additional missing CategoryInstance_UniqueID errors.

References (In order of usefulness):

  1. http://cm12sdk.net/?p=981
  2. https://www.reddit.com/r/SCCM/comments/34b18i/delete_multiple_driver_admin_categories/
  3. https://technet.microsoft.com/en-us/library/hh849820.aspx
  4. https://technet.microsoft.com/en-us/library/dn151092(v=sc.20).aspx