Category: HowTo

  • Ubuntu package commands

    Because Ubuntu has a mix of utilities to manage packages I constantly seem to be forgetting the options I need when I go to do basic package management. Mostly for my sake are the ones I use most regularly:

    List installed packages:

    List names of available packages (including those not installed):

    Tell what package owns what file:

    List files in a given package:

    Force a package reinstall:

    Show general package information:

    Show package dependency information:


  • Dell PERC 5i/R or H200 VMware Performance Fix

    I had an old Dell PERC 5i/R RAID card laying around and wanted to use it for a home lab ESXi box (note: also works on Dell PERC H200). The card isn’t amazingly high performance, but it it’s good enough for simple RAID. Well, that is, it’s good enough performance if you change the settings. By default “write caching” is disabled – that unfortunately includes even “write caching” on the drives themselves (5i/R doesn’t have cache so it’s always “Write Through”, the H200 has cache, but is disabled by default). Therefore by default write performance is downright painful.

    Fortunately it’s not too difficult to fix if you can pull together the right tools. I was lucky enough to find a post by “tonyd88” on this Dell support forum which explains the process. Below, I attempt to summarize the steps for posterity.

    WARNING: If you enable write caching on the 5i/R or H200, because of the lack of battery backup (BBU) there is a risk that if you lose power mid-write, you will corrupt your disk, OS, etc. Not only use at your own risk, but ideally at least have a UPS on your system.

    Steps:

    • Locate a copy of “LSIUtil.exe”. The Dell RAID 5i/R was made by LSI. LSI was sold to Avago Technologies and a copy of it appears to be here, but you may need to look around in Avago’s legacy driver downloads. The latest version I have found is 1.62.
    • You’ll need to create a DOS boot disk or thumb drive with the LSIUtil.exe on it. Unfortunately explaining how to do that is a bit beyond the scope of this article. Google is your friend.
    • It is likely you will need “DOS4GW.EXE” also on the boot disk. You’ll have to find a reputable download or buy it here. This may be a potential alternative.
    • Install the Dell 5i/R RAID card in the system and boot to your newly created DOS boot disk/drive.
    • Run the LSIUtil.exe binary.
    • Select your controller. Hopefully there will only be one, but otherwise you’ll have to figure it out. Choose the number that matches and hit <enter>.
    • Select option “21”, “RAID actions” (type 21 and <enter>).
    • Select option “32”, “Change Volume Setting” (type 32 and <enter>). This submenu’s first item is the critical change:
      • On the first prompt for “write caching” type “yes” and <enter>.
      • For “Offline on SMART Data” just hit <enter> for default or change to whatever you want.
      • For “Auto configuration” just hit <enter> for default or change to whatever you want.
      • For “Priority resynch” just hit <enter> for default or change to whatever you want.
      • For “Hot Spare Pools” just hit <enter> for default or change to whatever you want.
    • At the next prompt type 0 <enter> to quit. Just continue to hit <enter> until it drops all the way out to DOS.

    You’re done. Pull the boot drive and reboot to whatever OS you’re going to use on it. VMware happily uses the cards.


  • Fix VMware Web Client Integration Plugin for Chrome on Mac OS X El Capitan (10.11)

    The latest vCenter Server 6.0 VMware Web Client Integration Plugin does not work on OS X El Capitan. The installer finishes, but silently fails due to missing libraries, libraries that probably existed in earlier OS X versions.

    Because the libraries don’t exist, necessary certificates don’t get generated, and even re-running the installer from the application directory won’t solve it (including with the below hack). What you need to do is ensure the libraries will be there when the installer gets to the “Running package scripts…” section on initial install.

    There are a number of possible solutions, but the below seems the cleanest and doesn’t require multiple installs.

    Before installing the application, do the following:

    Then run the full installer.

    This will create a hack to allow the packaged libraries to be used when the package scripts get run. If it’s working correctly the “Running package scripts…” will take many minutes to run as it executes “openssl” to generate the following:

    /Applications/VMware Client Integration Plug-in.app/Contents/Library/data/ssl/dh512.pem

    If it instead installs very quickly, you can be fairly certain it didn’t install correctly and probably VMware has changed something yet again. If it works, you can both upload files and deploy OVF files.

    Hopefully VMware will create a permanent fix. More on why this plugin is required can be found here. How to install/upgrade the plugin itself can be found here.

    UPDATE:

    Jonathon McTaggart (thank you Jonathon!) gave the following update for the latest plugin:

    UPDATE 2:

    It appears VMware has essentially documented the same fix here, rather than fixing the installer:

    https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2144550

    The problem is, they are also suggesting you disable a fundamental OS protection temporarily as well. That is a major PIA and sadly doesn’t seem to work on macOS Sierra. I can use OVFs, but I can’t do file uploads. Apparently there is a integrated ESXi HTTP client that some are working on here (via here) that seems to offer some options. This has been a problem for over a year now…


  • Get RPM install date

    Sometimes you don’t know when an RPM was installed – maybe it was updated, maybe it came with the system. In any case, it can be handy when debugging or even for auditing purposes. This gives an example of getting the install time for the “filesystem” package:

    somehost%  rpm -q filesystem --queryformat '%{name} %{installtime:date}\n'
    filesystem Mon 18 May 2015 02:57:16 PM EDT

    Really all you need is the “%{installtime:date}\n”, but the name can be handy if you want to use it with “-qa” (query all). Also can be handy to put “%{installtime}” (gives seconds since epoch) on the front and run it through “sort -n” to find out order of install.


  • Dell Service Tag the easy way under Linux

    Sometimes you need the service tag or model off a Dell server that isn’t in your possession. You can either find some feet on the street to do it or as it turns out, with Linux, you can use “dmidecode”:

    Thanks to Brandon Checketts’ website for this tidbit.


  • Get rid of annoying “People Pane” in Outlook

    I wouldn’t mind the “People Pane”, except that in our organization is shows nothing useful. Moreover for a reason I cannot fathom, it always gets opened up, taking enormous reading real estate. So from this (Outlook 2010 at least):

    Click the “View” tab:

    Select “People Pane” and set it to “Off”:

    Voila!

    UPDATE:

    Same two steps work on Outlook 2013.


  • Using LDAP Paged Controls with Python

    Most LDAP servers can be set to return an unlimited number of entries on an LDAP search, however depending on the size of the LDAP database/directory this can possibly exceed your memory. Moreover if you want to write portable code, you probably should not depend on the LDAP server being able to return unlimited entries. For instance, AD’s LDAP generally defaults to 1,000 entries maximum.

    Because using LDAP paging isn’t very difficult there’s not a lot of reason to not use it. Adding paging only marginally reduces performance, while certainly putting less stress on the LDAP server(s). Personally I recommend you use it on a general basis, even where not strictly necessary.

    Python’s LDAP supports paging, though it isn’t well documented. I found two examples this one and this one. Both had their pluses, but neither explained what was going on too much. I melded them together, added comments, and streamlined a bit. Hopefully this will help you get the mojo…

    As a final note, one of the documents I found said the paged controls did not work with OpenLDAP. That’s not what I found – pretty much the exact code above worked without issue with OpenLDAP.

    UPDATE:

    A GitHub “Gist” for the above can be found here.

    UPDATE 2:

    For users of Python LDAP 2.4, you should check out of the comment by Ilya Rumyantsev which gives a forward/backward compatible set of code snippets since the API has changed a bit. Many thanks to Ilya for the update.

    UPDATE 3:

    Below I took Ilya’s updates and merged them in with some minor enhancements to compare the Python LDAP version on the fly. My next stop is to take this and convert it to a generator function, which would be more ideal than using a callback. The issue with going to a generator is handling the errors, which means throwing exceptions in some sane fashion…

    UPDATE 4:

    It turns out that the Python “ldap” module does not follow “StrictVersion” versioning in it’s “__version__” string. I have updated the “UPDATE 3” code to use “LooseVersion” comparisons.

    UPDATE 5:

    I updated the above code to default to “criticality=False” for the paging control. If the LDAP service doesn’t support paging, it will yield a potentially confusing “Critical extension is unavailable” error.

    Note I need to ultimately fix the exception handling as for whatever reason the exception object passed back doesn’t have a reasonable “__str__()” method and the message is left in the “desc” key.


  • How to dump the Firefox history (Linux)

    Not pretty, but gets you there:

    • Find and go to your Firefox profile (usually you can locate by going to “~/.mozilla/firefox/*.default”).
    • Run “sqlite3 places.sqlite .dump | grep moz_places”

    If Firefox is running you may have to copy the “places.sqlite” to a new file then run the “sqlite3” against it. You can’t dump it while Firefox is running because it locks the database.

    Since it’s SQL there are fancier ways of pulling the actual tables, but for a quick script, this will do.

    Note if you’re after the time that a URL was accessed (I was), it seems to be the last field in the “VALUES”. It is is in microseconds since 1970. In that case, this little Perl snippet should get you the actual time:

    where “HISTORYTIME” is replaced by the time printed in the SQL dump (eg: a big arse number like “1373383738987790”).


  • Testing “sendmail” with immediate delivery

    In the old days when using “sendmail” if you wanted to watch the SMTP conversation between the local host and the next mail relay all you’d have to do is either run “sendmail -v” or “mail -v” (or “mailx -v” depending on the OS). It would then output the entire SMTP conversation with the remote host, which is useful for diagnosing why a remote host may be refusing your mail.

    In more modern implementations “sendmail” actually uses two separate configurations, a “submit.cf” which is used for originating mail, and “sendmail.cf” which is used for delivery/forwarding. Subsequently when you use “sendmail -v” without any additional options it uses “submit.cf” by default, which actually delivers to “localhost” first. Eg:

    The solution is to add the “-Am” flag which tells it to bypass the “submit.cf” and use “sendmail.cf” directly:

    Note depending on your OS you may have to run “sendmail” with “sudo” to get enough permissions to access the queue entries. You also ideally should provide the “-t” options and put things in like “To:”, “From:”, and “Subject:” to be a good mail citizen, though for testing it isn’t terribly important.


  • Make Excel text fit row height

    As part of my job I for better or worse have to deal with Excel on a regular basis. One of the issues I have is the sizing of rows (the cell height) not properly expanding, or conversely shrinking, when I add or remove data in the cell.

    It turns out there is a very easy way to clean the row height spacing:

    First, select the rows you want to fix the spacing on. For most spreadsheets without fancy formatting, the simplest bet seems to be to select all cells by clicking the left corner of all the cells (examples here are from Excel 2013):

    Then assure you are on the home tab:

    Then select “Format / AutoFit Row Height”:

    Voila! Sane cell height spacing again.

    This is particularly useful with “Wrap text” set in cell “Alignment”. Note with wrapping you may have to expand the size of some columns to get Excel not to think there needs to be extra height underneath with text that is very close to the right edge of the cell.


  • Four keyboard shortcuts you should know…

    I’m writing this because I see so many people who use computers regularly who don’t know these basic keyboard shortcuts. They’re easy – learn them and your computer life will be much better. Most work on pretty much any GUI (Windows, Unix, even Mac substituting the CMD key for the CTRL key).

    So with no further ado (hold down the CTRL key while typing the key that follows it, kind of like the SHIFT key):

    • CTRL-C = copy the selected text
    • CTRL-V = paste the prior copied text
    • CTRL-X = copy the selected text and then delete it
    • CTRL-Z = undo the last change

    There are quite a few more worth learning, but some aren’t as guaranteed to work (for instance CTRL-SHIFT-Z which does a “redo” of the last “undo”). However, if you simply learn the 4 above your work will be remarkably improved in terms of streamlining.

    As a final note, these DO NOT work in Unix command line (shell) windows. In fact you’ll get completely different and potentially ugly behavior. They will however work in the Unix GUI (X Windows and/or browser windows etc.).


  • Forcing a Window Media Player library rescan

    If you’re using your Windows Media Player (WMP) as a Windows Media “server” to share your music library, yet don’t use WMP directly to manage your media (I use the much more rich MediaMonkey) then you may want to force a library rescan when you add new tracks to your file-store(s).

    This isn’t very hard, but it isn’t entirely intuitive either. However it’s simple enough. Select the WMP window, hit the “ALT” key and a menu will pop up. Select “Tools / Apply media information changes”, eg:

    Windows Media Player menu

    Should do the trick.


  • Useful Intel links…

    Two links from Intel are particularly useful for desktop/laptop users. First, this tool will find out if the Intel drivers you’re using are up-to-date:

    http://www.intel.com/p/en_US/support/detect

    since many if not most desktops/laptops include some Intel based chipset (even if it isn’t the main CPU), then this is a pretty useful site to use.

    If you’re interested to know what Intel chipsets your system uses without checking for updates, this downloadable tool is useful:

    http://www.intel.com/support/chipsets/inf/sb/cs-009266.htm

    When run it lets you know what at a minimum your mainboard chipset is (assuming it’s Intel).

    Of course AMD users mileage will undoubtedly vary. Note that both of these are Windows only apps (sorry).


  • Converting VMware virtual disk to “eagerzeroedthick”

    Pretty simple from the console really:

    vmkfstools -d eagerzeroedthick -i <virtual-disk-source>.vmdk <virtual-disk-target>.vmdk

    Note that this will completely expand the size of the filesystem (ie: it will no longer be “thin”).

    I needed this not to convert a “thin” filesystem to “thick” filesystem, but a “thick” filesystem to a clusterable “thick” filesystem. The default of “zereodthick” for thick filesystem does zeroing as needed on the fly, whereas “eagerzeroedthick” zeros out beforehand (which takes longer). The former, “zeroedthick” isn’t compatible with clustered filesystems, or more particularly, the required setting of “SCSI Bus Sharing” to “Virtual” while “eagerzeroedthick” is.

    “eagerzeroedthick” corresponds to the vSphere Client setting when creating a hard disk of “Support clustering features such as Fault Tolerance”. It is incompatible with “Allocate and commit space on demand (Thin Provisioning)”.

    More about clustering on the same VMware machine (though aimed at Microsoft unfortunately) can be found here:

    http://www.vmware.com/pdf/vi3_35/esx_3/r35u2/vi3_35_25_u2_mscs.pdf

    To note, renaming virtual disks is equally as simple via the CLI (which the vSphere Client will not allow):

    vmkfstools -E <original-virtual-disk>.vmdk <renamed-virtual-disk>.vmdk

    Note that in the case of any of the “thick” versions actually have two files which can be confusing, a file that doesn’t have “-flat” and one that does. In that case choose the one that lacks “-flat” for the operations and “vmkfstools” will automatically handle the “-flat” version as well.


  • How to deactivate Adobe Digital Editions

    As found on an Adobe Forum

    To deactivate a PC with Adobe Digital Editions 1.x:

    1. Launch Digital Editions 1.x
    2. Enter the key-combination of <CTRL><SHIFT>D (<CMD><SHIFT>D on Mac OS)
    3. At the dialog, confirm that you wish to de-activate the machine
    4. Quit Digital Editions

    To reactivate and authorize the machine using the same or a new Adobe ID, just re-launch Digital Editions. You will be prompted to activate.

    This can apparently solve a number of random issues with Adobe Digital Editions. In my case I needed it because I used the wrong Adobe ID to activate!


  • Unlocking a Cisco IP phone

    One of those things I can never remember! It’s:

    **#

    Lets you change the network configs among other things.

    Also can factory reset with:

    Settings> Phone settings> Press **2

    Works on older 7921 at least.


  • How to convert to/from DOS format in VIM…

    It’s very easy, but also easy to forget how to convert to or from a DOS format file in Unix using “vim” (Vi iMproved), the Open Source “vi”. If the file is in DOS format and you want to convert to Unix, use the command:

    :set ff=unix

    note that “ff” is an abreviation for “fileformat” which you can also use.

    If the file is Unix and you want to write DOS format, use the following command:

    :set ff=dos

    In both examples it is assuming you are ESCaped out of edit mode and the leading “:” is required.

    Note that the difference between the two formats is that:

    • DOS format ends each line with a CRLF (carriage-return line-feed) pair.
    • Unix format ends each line with a simple LF (line feed).

    Neither of these forms should be confused with the C language string delimiter ‘NUL’ which is an ASCII “zero”. That however is an entirely different subject.


  • How to “fix” a Mozilla plugin for a new Firefox

    Ok, lets you’re using a great Firefox plugin, like say “QuickProxy” and you go to upgrade Firefox and it doesn’t work because it says the plugin doesn’t support this version of the Firefox.

    Well, there’s an easy “hack” (kludge, whatever) around it:

    • Download the “.XPI” plugin file, rename it to a “.ZIP” extension.
    • Unzip it to a temp directory.
    • Edit the “install.rdf” file.
    • Search for the “install.rdf” file for the “MaxVersion” XML attribute and change the version to a version greater than or equal to the version of Firefox you’re running.
    • Save the “install.rdf”.
    • Zip all the files in the “.XPI” back together again including the “install.rdf” you just edited (will be a “.ZIP” file of course).
    • Rename the “.ZIP” file back to a “.XPI” file.
    • Open the Firefox and go to “Tools / Add-ons” and just “drag and drop” your new “.XPI” file on the window (note at least in Firefox 3 you can just drop it anywhere in the view pane even without going to “Tools / Add-ons”).

    That’s it. Note it may or may not work as there could really be an incompatibility. My guess is usually there isn’t (neither QuickProxy nor Exif Viewer had an issue when I fudged them).

    Note this was taken from Mr. Sandman’s review of QuickProxy here:

    https://addons.mozilla.org/en-US/firefox/reviews/display/1557

    and I assume it will probably work with all other Firefox plugins.