All posts by bsdman

Currently working as an IT Manager. Worked for an OIT company as a Network Engineer in 2011. Worked for a Medical IT company as the Network Administrator 2009-2011. Worked as the Senior Systems Administrator at a computer reseller from 2005-2009. Worked as a Computer Consultant for several small companies from 2007-2009. Worked as a Computer Technician at a computer reseller from 2002-2004.

Extend LUN iSCSI Citrix XenServer

I have a pair of xenservers connected via 10Gb Ethernet to a pair of Equalogics SAN devices (iscsi). Needed to expand or increase the size of the LUN that our VDI environment was connected through while maintaining the uptime of the VDI environment. I first extended the available space on the SAN side, so this document is only for the Citrix/XenServer configuration.

Connect to your XenServer
SSH to your master server (or primary if you only have one) as root
You can either list all of your available storage or, if you know what type, you can list only iscsi. In my case I’d list the iscsi, but both commands are listed below.

List all storage
xe sr-list

List only iscsi storage
xe sr-list type=lvmoiscsi

List only the SR you want
xe sr-list name-label=YOURSR

From here we’ll see something like:

uuid ( RO) : 6f16bb1c-1a3d-b9d3-98d4-7b57b30934c0
name-label ( RW): EXT_VDI
name-description ( RW): iSCSI SR [10.10.10.10 (iqn.2001-05.com.equallogic:0-1db196-0d76a8743-a05b26ff2g651be5-extvdi; LUN 0: 6019DA3174A8760DE51A652DEE265BA0: 1500 GB (EQLOGIC))]
host ( RO):
type ( RO): lvmoiscsi
content-type ( RO):

We want the UUID from this step – and notice the size (1500 GB). I wanted to make this 2500GB instead.

Now we need to find the device location for this LVM
pvscan | grep THEUUIDFROMABOVE
pvscan | grep 6f16bb1c-1a3d-b9d3-98d4-7b57b30934c0

PV /dev/sdj VG VG_XenStorage-6f16bb1c-1a3d-b9d3-98d4-7b57b30934c0 lvm2 [1.50 TB / 688.85 GB free]

Rescan the device – change “sdj” to your dev device name from the last step
echo 1 > /sys/block/sdj/device/rescan

Next we resize the device
pvresize /dev/sdj

And one last rescan
xe sr-scan uuid=THEUUIDOFYOURDEVICE

Raspberry Pi Disable Screensaver

Had a raspberry pi setup as a terminal to display statistics on a television – needed it to not go into sleep mode etc.

SSH or login to your RPi as root
I added the following script

# needs apt-get install x11-xserver-utils first
# if something errors, stop the script
set -e

# set the screensaver to off, no power savings, and no blank screen
xset s off
xset -dpms
xset s noblank

# exec the session manager so you have a toolbar still
exec /etc/alternatives/x-session-manager

I then added a path to rc.local
chmod +x YOURSCRIPTNAME.SH
chmod 777 YOURSCRIPTNAME.SH

nano /etc/rc.local
Add “/path/to/your/script.sh”

***EDIT***
Apparently that does not work – you end up getting a “cannot change display “”” type of argument.

So, change the LXDE autostart function script:
nano /etc/xdg/lxsession/LXDE/autostart

xset s off
xset -dpms
xset s noblank
reboot.

KMS Setup and Citrix XenDesktop

I might split this off since KMS doesn’t need Citrix and Citrix doesn’t need KMS. But for my environment I needed both.

Background
I had installed a KMS server (Key Management Services server) for a recently-deployed Citrix XenDesktop environment. XenDesktop does NOT support MAK keys for the shared desktops (although it technically works), and instead lets me know to use KMS. KMS is really nice now that it’s working.

I actually ended up installing KMS on the WSUS server. Things I found out (my notes, take with a grain of salt since I haven’t gone back over it nor verified anything):

Prerequisites

  • Server 2008R2 Installed and configured on an AD Domain (member server or domain controller OK)
  • Server 2008R2 KMS Key (VLSC site at Microsoft)
  • Client KMS Keys (see below)
  • Hypervisor (for XenDesktop VDI) – Hyper-V, VMWare ESXi, XenServer are all supported. I use XenServer 6.1 although 6.2 just came out.

Common Client KMS Setup Keys
Full List found here (http://technet.microsoft.com/en-us/library/jj612867.aspx and http://technet.microsoft.com/en-us/library/jj219430.aspx)

Windows 7 Professional
FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4
Windows 7 Enterprise
33PXH-7Y6KF-2VJC9-XBBR8-HVTHH
Windows 8 Professional
NG4HW-VH26C-733KW-K6F98-J8CK4
Windows 8.1 Professional
GCRJD-8NW9H-F2CDX-CCM8D-9D6T9
Windows 8 Enterprise
32JNW-9KQ84-P47T8-D8GGY-CWCK7
Windows 8.1 Enterprise
MHF9N-XY6XB-WVXMC-BTDCT-MKKG7
Windows Server 2008 R2 Standard
YC6KT-GKW9T-YTKYR-T4X34-R7VHC
Windows Server 2008 R2 Enterprise
489J6-VHDMP-X63PK-3K798-CPX3Y
Windows Server 2012 Standard
XC9B7-NBPP2-83J2H-RHMBY-92BT4
Windows Server 2012R2 Standard
D2N9P-3P6X9-2R39C-7RTCD-MDVJX
Windows Server 2012 Datacenter
48HP8-DN98B-MYWDG-T2DCC-8W83P
Windows Server 2012R2 Datacenter
W3GGN-FT8W3-Y4M27-J84CP-Q3VJ9
Office Professional Plus 2010
VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB
Office Professional Plus 2013
YC7DK-G2NP3-2QQC3-J6H88-GVGXT

Install And Activate Your KMS Server
Add the product key (your KMS key from the VLSC) on your server and activate with Microsoft. If you utilize the GUI you will receive an alert saying “Are you sure you want this to become a KMS Server in your environment?” I used the command line instead:
slmgr /ipk YOURPRODUCTKEYHERE
slmgr /ato
If you receive any errors, you will not be able to proceed much further.

You can also use the Volume Activation Management Tool (VAMT).

KMS For Office Products
Download the Office 2010 KMS Host License Pack
http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=97b7b710-6831-4ce5-9ff5-fdc21fe8d965
And install/run the executable
The wizard will ask for your KMS key for Office – enter that.
To install a new Office Key, simply type:
ospp /inpkey:YOURKMSKEY
ospp /act

Verify KMS Is Working
You must have 5 or more SERVER clients or 25 or more CLIENT clients trying to activate. Every 6 months. The KMS activation is good for 180 days before it needs to re-register with your KMS server.
Command line find out the number of activations
slmgr /dlv
Your pop up will display the following key information: The KMS channel your server belongs to (B channel for me), License status, Current KMS count, and number of requests received.
There is a KMS Emulator that can artificially inflate your numbers on the KMS server:
KMSClient.exe 1688 127.0.0.1 Windows
KMSClient.exe 1688 127.0.0.1 Office2010
KMSClient.exe 1688 127.0.0.1 Office2012


Citrix – Initial Setup

  1. Create a new virtual guest – I ended up using Windows 7 SP1 x64 Enterprise (Pro for proof of concept, Ent for production use)
  2. Install all updates and software required on the base image. I ended up with the OS, Antivirus, Java, Flash, and Reader installed by default.
  3. Join this guest to the domain if applicable.
  4. Install the Virtual Desktop Agent – I ended up “sharing” the XenDesktop Installer CD from the primary DDC XenDesktop system (\\xendesktopserver\sharename)
  5. Shut down the VM by using the Desktop Agent – in my case I had a virtual private disk as well, so this is very necessary with all changes
  6. Take a snapshot of the VM – name it “PREARM”
  7. Start the VM back up and rearm the Activation Key
    slmgr /rearm

  8. Shut down the VM by using the Desktop Agent
  9. Take a second snapshot of the VM – name it “ARMED”
  10. Use this second image (“ARMED”) as the base for your XenDesktop rollout

Updating the Master Image

  1. Roll back to the snapshot “PREARM”
  2. Startup the VM
  3. Make any changes/updates
  4. Shut down the VM by using the Desktop Agent
  5. Delete the current “PREARM” snapshot
  6. Take a snapshot of the VM – name it “PREARM”
  7. Start the VM back up and rearm the Activation Key
    slmgr /rearm

  8. Shut down the VM by using the Desktop Agent
  9. Delete the current “ARMED” snapshot
  10. Take a second snapshot of the VM – name it “ARMED”
  11. Use this second image (“ARMED”) as the base for your XenDesktop rollout

***EDIT***
I couldn’t get my office 2010 laptop to activate against the KMS host. I verified that the DNS entry was added:
nslookup -type=srv _vlmcs._tcp

Port 1688
Srv hostname MYSERVER.MYDOMAIN.TLD

The eventviewer showed “The client has sent an activation request to the key management service machine” along with “0xC0020017, 0X00000000, 127.0.0.1:1688”
That’s why! 127.0.0.1! Localhost my arse.

You can change this by setting the host:
Open a command prompt with admin privs
cd\program files\microsoft office\office14 (or 15)
cscript ospp.vbs /sethst:YOURSERVER_FQDN.domain.tld
Then activate
cscript ospp.vbs /act
Success!

To set this back to default:
cscript ospp.vbs /remhst

To change the key:
cscript ospp.vbs /inpkey:YOURKEYHERE

Remote key:
cscript ospp.vbs /inpkey:KEY COMPUTERNAME
cscript ospp.vbs /act COMPUTERNAME

http://technet.microsoft.com/en-us/library/ee624350.aspx

NON-Domain Systems KMS Activation
cscript \windows\system32\slmgr.vbs /skms FQDN_OF_KMS_SERVER:port
-or-
cscript \windows\system32\slmgr.vbs /skms IPADDRESS_OF_KMS:port

NRPE on XenServer

I wanted to install NRPE on XenServer (6.1)
Found http://www.linuxbrigade.com/install-nrpe-on-xenserver/, but I wanted to have my own copy of the procedure.

Add the Fedora repository
wget http://dl.fedoraproject.org/pub/epel/5/$(uname -i)/epel-release-5-4.noarch.rpm
rpm -Uvh epel-release-*.rpm
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/epel.repo

Install NRPE
yum install --enablerepo=epel nrpe

Set the auto start function
chkconfig nrpe on

Install the Nagios Plugins
yum install --enablerepo=epel nagios-plugins-users nagios-plugins-disk nagios-plugins-swap nagios-plugins-procs nagios-plugins-load

Edit the IPTables Firewall
nano /etc/sysconfig/iptables
Before the last REJECT line:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT

Restart the IPTables Firewall
service iptables restart

Edit your NRPE configuration
nano /etc/nagios/nrpe.cfg
Allow the IP address of your Nagios host!

Start the NRPE service
service nrpe start

Remove Storage Citrix Desktop Studio

In the Citrix Desktop Studio, under Configuration and then Hosts, I saw the following information:
citrix_storage

And I wanted to remove the NM_VDI from both the Personal vDisk and the Virtual machine storage areas.

Click on the Desktop Studio at the top left of the navigation window
Click on the Powershell tab
In the lower right, click on Launch PowerShell

In the powershell
cd XDHyp:
ls

Search for “HostingUnitName” and “Storage”/”PersonalvDiskStorage”. We’ll need both of these for the next command

Remove-HypHostingUnitStorage -LiteralPath 'XDHyp:\HostingUnits\YOURHOSTINGUNITNAMEHERE' -StoragePath 'XDHyp:\Connections\YOURPATH\TO\STORAGE.storage'
Add a storagetype if it’s the personal storage:
Remove-HypHostingUnitStorage -LiteralPath 'XDHyp:\HostingUnits\YOURHOSTINGUNITNAMEHERE' -StoragePath 'XDHyp:\Connections\YOURPATH\TO\STORAGE.storage' -StorageType PersonalvDiskStorage

HP Chromebook Install Ubuntu

I think it’s actually chrubuntu, but you get the general idea. I also copied the script to it.thelibrarie.com/utilities/chrubuntu-install.txt just in case the s9ryd link goes dark. So here is how to remove the google chromeOS and install a fork/flavor of ubuntu. Why install? Citrix receiver was version 1.x and runs as a Chrome browser wraparound; none of the full screen buttons work, sound didn’t work, video was choppy. The receiver for Windows/Mac/Linux is 2.x and has HDX and other supported features. And the laptop seems peppy-er now anyway. Battery life went from 4.5 hours to just under 4, so keep that in mind as well. I couldn’t get the bindkeys to work on my installation, so if someone has a workaround that would be awesome to provide to me.

Documentation is a work in progress.

Enable Developer Mode
HP’s chromebook is a giant pain in the *** to enable developer mode. You end up removing all 10 screws on the bottom, carefully removing the keyboard with fingernails and a flat head screwdriver, and then removing 9 more screws from under the keyboard. Pry up the top right corner (we want to end up with the right half accessible) so you can find the toggle switch. More information here.

Access Developer Mode on ChromeOS
Start with the Chromebook off
Press hold esc and F3, then press the power button
Control + D
Turn off OS verification by pressing enter
This will then reformat the drive for you

Format the internal storage – 9MB
Control + D
Connect via ethernet. Do not sign in.
Control + Alt + F2
“chronos” is the password
curl -L -O http://goo.gl/s9ryd; sudo bash s9ryd
9

Install Chrubuntu
Control + D
Connect via ethernet. Do not sign in.
Control + Alt + F2
“chronos” is the password
curl -L -O http://goo.gl/s9ryd; sudo bash s9ryd xubuntu-desktop
Wait for “Get1287, then installation” about 3/4 finished installing
Follow the wizard (enter, enter, enter)
Verify that the GUI comes up (user/user)
sudo cgpt add -i 6 -P 5 -S 1 /dev/sda
sudo reboot
to change back to chromeos – NOT A REQUIRED STEP!!
sudo cgpt add -i 6 -P 0 -S 1 /dev/sda

Install Citrix Receiver
sudo apt-get install libmotif4 nspluginwrapper ffmpeg flashplugin-nonfree cheese nano xosd-bin
open a browser to http://www.citrix.com/downloads and navigate to the linux .deb download file
Open the deb file and install using the software center
Close the browser
Open the browser
Navigate to http://v-xendesktop

Test Citrix
Open Start > Internet > Citrix Receiver
Tools > Settings
Click Allow Audio Input
Apply and close
Start > Internet > Firefox

To enable wireless on an WPA2-AES-Enterprise AP
Add your SSID with Enterprise, PEAP and NO CERTIFICATE AUTHORITY
When it fails to connect, disable wireless
sudo nano /etc/NetworkManager/system-connections/SSID
Find the line system-ca-certs=true and change this to =false
Control + X, Y
Turn on wireless. Profit

Get VPN to work (OPENCONNECT)
sudo apt-get install openconnect network-manager-openconnect
sudo reboot
Add VPN connection information via the Connections tab on the top in the network manager

Create shortcuts for Volume/Brightness – Only one example, you can figure it out from there
nano Desktop/Mon_Brighter.sh
xdotool key XF86MonBrightnessUp
Control + X, Y
chmod +x Mon_Brighter.sh

Others:
Brightness Up xdotool key XF86MonBrightnessUp
Brightness Down xdotool key XF86MonBrightnessDown
Audio Up xdotool key XF86AudioRaiseVolume
Audio Down xdotool key XF86AudioLowerVolume
Audio Mute xdotool key XF86AudioMute

Second monitor support:
sudo add-apt-repository ppa:xubuntu-dev/xfce-4.10
sudo add-apt-repository ppa:xubuntu-dev/xfce-4.12
sudo apt-get update
sudo apt-get upgrade
sudo reboot

xbindkeys – not working
sudo apt-get install xdotool xbindkeys
xbindkeys –defaults > $HOME/.xbindkeysrc

Install OpenManage on XenServer 6.x

I have a pair of R620’s with XenServer 6.1 installed – needed to enable some external monitoring for obvious reasons. Xen looks to be built upon a flavor of CentOS, so the update commands are “yum”.

Install SRVADMIN OMSA
SSH into your xenserver as the root user
wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash
nano /etc/yum.repos.d/CentOS-Base.repo
Find “[base]” and make sure to set it to enabled=1
Save and close nano
yum install srvadmin-all
y

Edit the firewall to allow incoming SNMP/OMSA connections
system-config-securitylevel-tui
Press Tab twice, navigate to “Customize”
Other Ports/Allow Incoming
Add the following after any other text (my system had “ha-cluster:udp”)
,1311:tcp,161:udp
This should now read “ha-cluster:udp,1311:tcp,161:udp”
Select OK and then OK again to close out of the system configuration

Edit SNMP to allow RO access from all
nano /etc/snmp/snmpd.conf
Find “view systemview included snmp”
After this line add a new line containing:
view systemview included .1
Save and close nano

Restart the SNMP daemon
service snmpd restart

Start Dell OMSA
/opt/dell/srvadmin/sbin/srvadmin-services.sh start

Start OMSA after a reboot
nano /etc/rc.local
Add this to the bottom
/opt/dell/srvadmin/sbin/srvadmin-services.sh start
Save and close nano

Verify this is working
https://nameofyourserver:1311
Login with your root credentials