Category Archives: Hacks & Slacks

Import into Automatic Pool in VMware Horizon

Importantly there are two kinds of pools in Horizon: automatic and manual.  Automatic pools are pointed to a specific template and spawn new machines based on that template, and manual pools will accept the importation of, really, any viable virtual machine.

But what if you find that you need to move a machine from one location into an automatic pool.  There is no intended functionality for doing this.  However, we are humans and we are clever.

I will lay out for you the procedures I used.  We have a domain and our machines are all domain joined.  You may want to make adjustments for your specific situation, but the essentials here should guide you nicely.

Before you begin, let your user know that there machine will be unavailable for half an hour to an hour and that you will want them to test access once you have made the changes.

  1. Remove the entitlement for that user from the machine and the pool.
  2. Remove the machine from the domain and shut it down.
  3. Delete the machine object from Active Directory.
  4. Use the Clone to Template function in vSphere to clone the machine to a safe template location.
  5. (You may at this point delete the original VM.)
  6. In Horizon, point the destination pool at your newly cloned template.
  7. Add a new machine to the automatic pool from the template you just cloned.
  8. Point the destination pool back to its preferred template.
  9. (You may at this point delete the cloned intermediary template.)
  10. Power on the newly added virtual machine and add back to the domain.
  11. (Move it to the correct OU in AD.)
  12. Entitle the user for the destination pool and newly cloned machine.

It’s a bit of a hassle but it has worked dozens of times for me.

Have fun!

Share

USB Drives Mount as Read-Only

Today Nautilus decided it just didn’t like my mounted USB devices.  At first it was a brand new 64 GB FAT32 drive, and so I figured I would just reformat it.  This didn’t change anything; Nautilus (the file browser in Ubuntu 14.04) was insisting that I had read-only permissions on the drive and would not allow me to write to it.

Apparently there is a bug (not necessarily in Nautilus because I am told this will work with other file browsers) that is pretty easily fixed.

Open your terminal and run these two commands:

mv ~/.config/nautilus ~/.config/nautilus-bak
sudo killall nautilus

The first one moves the configuration file for Nautilus (modify if you are using a different file browser) to a backup copy.  The second kills (stops, terminates) the running Nautilus session.  You will need to launch a file browser window to get Nautilus (or other) running again, but that should return your USB drives to writable.

Share

YUMI and Clonezilla (and possibly others)

We use Clonezilla periodically.  I really like to use YUMI for creating a versatile thumbdrive capable of booting into several operating environments and various utilities (Clonezilla among them).

Recently I ran into troubles with my thumbdrive but only in relation to Clonezilla.  I do not know what caused the misalignment, but I was able to sort out the matter and I am placing a record of that here.

In short, I was getting a host of errors worded similar to this:

failed to load com32 file

It looks like a change was made at some point in the way syslinux functions, but I didn’t dig too deeply into that.  I have a friend who is using the same basic set up and his Clonezilla was working.  I checked his drive out and compared it to mine to see what I could see.

I didn’t see anything worth commenting but I did notice that these four files were in the root of the multiboot directory:

ldlinux.c32
libcom32.c32
libutil.c32
vesamenu.c32

These were also located in the syslinux folder in each of my Clonezilla folders (I have 32 and 64 bit versions installed).  I simply hid those files (in each Clonezilla’s syslinux folder) and it fixed the Clonezilla boot process.

ldlinux.c32.remove
libcom32.c32.remove
libutil.c32.remove
vesamenu.c32.remove

Hope that helps someone.

Share

Shortcut the Long Way ‘Round

Sometimes you want an application to start when you log into a machine.  In most new versions of Windows you can manage this within the Task Manager, there is a Startup tab.  However, in Windows 2012 R2 there is no such tab in the Task Manager.  Yet you may still wish for one.

Fear not; there is a solution.

If you want to add a startup item for the currently logged-on user only, use this command:

shell:Startup

If you’d like something to start for any user which logs in, then use this version instead:

shell:Common Startup

Now normally you can simply drag while holding the Alt key and when you drop you drop a shortcut in that location.  This is true even for the first version of this command above; if you drop into that folder while holding the Alt key, you drop a shortcut into that Startup folder.

However, the Common Startup folder is a dangerous and protected system folder.  You will not be able to create a shortcut in that folder.

And just where do you think you're going?
And just where do you think you’re going?

So I said Yes and then moved that into the Common Startup folder.  I had to confirm I wanted to do it, but it allowed the shortcut to be placed.

World’s smallest hack?  Go MS!

Share

Uninstall During Windows SafeBoot

Why this is even an issue is a little beyond me.  It must come up often enough to get others annoyed by it.  You have some piece of software that is crashing your system sufficiently that you are unable to remove it using a regular boot.  So, you boot into Safe Mode.  Only problem is, the installer service is disabled during Safe Mode.

Fuckety-fuck.

Well, let’s hack the registry a bit and sort that shit.

(Don’t be scared, but do proceed with caution and at your own risk.)

So log into your Windows 10 (or whichever, this ought to work even as far back as, ugh, XP) in Safe Mode (f8 is often useful to get there).  Once you get in you can open the Registry Editor from a command prompt.  Holding down the Windows key and pressing R (Win-R) will open the run dialog; then just type regedit and hit Enter.

Once in the Registry Editor navigate to HKEY_LOCAL_MACHINE—> SYSTEM—> CurrentControlSet—> Control—> SafeBoot—> Minimal and right-click on Minimal.  From the local menu which pops up, you’ll want to choose New —> Key.  Name this new key MSIService.

(I have seen one report where the name MSIService did not work and the user used MSIServer instead.  Try MSIService first and go from there.)

Within the new key, MSIService, right-click on the item called Default and choose Modify from the local menu which pops up; then in the Edit String dialog set “Value data:” to Service.  Click the OK button.

regedit MSIServer
regedit MSIServer

Ok, that gives the system what it needs to be able to run the Windows Installer service during Safe Mode.

(Note: if you are running Safe Mode with networking, you want will to do this same work also under HKEY_LOCAL_MACHINE —> SYSTEM —> CurrentControlSet —> Control —> SafeBoot —> Network, but I haven’t test that.)

Now let’s start that service so you can run your uninstaller (or installer for that matter).

In an Explorer (file browser) window, navigate to This PC (or Computer or My Computer) —> Local Disk (your disk, probably C:) —> Windows —> SysWOW64 (earlier systems it may be in System32) —> services.msc; then right-click on services.msc and choose “Run as administrator” from the local menu which pops up.

Lauch services.msc as an admin
Lauch services.msc as an admin

Now locate the Windows Installer service in Services, right-click on that, and choose Start from the local menu which pops up.

Start the Windows Installer service
Start the Windows Installer service

That’s it.  Go forth and uninstall.

Share

Invisible Titles in Evernote on Ubuntu 14.04 with Wine

I recently updated my version of Evernote on Ubuntu and noticed that the titles of the notes were now invisible in the title field of the reading pane.  This made it very difficult to type or especially to change a note title.  Even copying and pasting was a challenge since I couldn’t tell if I had any or all of the title selected.

I was eventually able to find a solution here.

Essentially there is a dll in Wine that was in need of some wrangling.  A dll or Dynamic Link Library is a Windows thing.  You probably don’t want to know much about them except to say they are sometimes required for applications to function as expected or perform certain tasks.

With one line of code in your terminal (don’t fear the terminal, ok?) you can fix this problem:

winetricks -q riched20

That’s it.  Run that command and when you again open Evernote you should be able to see the titles.  I mean, if it worked for me why wouldn’t it work for you?  Go for it!

What does it do?  It installs the dll (riched20.dll) into the Wine directories.  I guess Evernote needs that dll to display the titles in the title field in the reading pane.  (The -q just means don’t ask me any questions.)

Share

Download Evernote on Linux

If you run Evernote and you use Linux (I run Evernote on Ubuntu under Wine) you may find yourself in the situation where you are attempting to download the Evernote Windows installer to install Evernote into the Wine environment.

You will run into trouble.

The Evernote site does a browser/OS check and presents you not with any download options but instead informs you that they do not offer a version of Evernote for Linux.  Simply put, you cannot get to the installer by the usual means.

So what about unusual means?

Since I run Opera (you can read about how to install Opera here) I am able to mask my browser identity by right-clicking on the page in question, choosing Edit Site Preferences…, and then on the Network tab modifying the Browser identification.

If you set the browser identity to Mask as Internet Explorer (and reload the page) you will be presented with the download as expected.

Fuck browser checks (and OS checks) when the result is to limit user action and not merely inform or suggest.

Share

Encrypted Drive Recovery in Ubuntu 14.04

I found a very simple guide for recovering data from an encrypted drive in the scenario where they drive will not boot (but, obviously, where the drive is still functional).

Take a look:

How to Recover Data from an Encrypted Harddisk on Boot Failure with Ubuntu 14.04

This method may work with other related versions of Ubuntu (assuming they are using the same application for encryption).  I have not tested it, but it looks sound enough.

Let me know your experiences.  Hopefully this will help someone not lose data.

Share

Enable Hibernation in Ubuntu 14.04

If you are running Ubuntu post 10.04 (or post 11.04 if you use non-LTS releases) you may have noticed that hibernation is no longer an option.  You don’t get to choose it from your logout/shutdown options and you don’t get to choose it as an option if your battery is dying.

I’ve read some attempts at explanation, but as near as I can tell it has been disabled because they can’t get it to work consistently on every hardware.  Seems they’d rather have actions that can work on all hardware than to risk some users having unexpected crashes.

So before you attempt to enable hibernation, let’s test your hardware to see if hibernation is likely to work for you.

sudo pm-hibernate

If all goes well this terminal command should hibernate your machine and move all of your active session into a special location on your hard drive.  You will then need to power your machine on and it should come back to your hibernated session.  If that fails then your machine may not be a good candidate to enable hibernation.  If it works, give this a try.

Enabling hibernation for those machine capable of it is a simple matter of creating a configuration file with the relevant data included therein.  The file is called com.ubuntu.enable-hibernate.pkla and will live in the /var/lib/polkit-1/localauthority/50-local.d/ folder.

I used Gedit to create and save this file:

gksudo gedit /var/lib/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

This will open Gedit with elevated user permissions (so do be careful).  Simply add this code directly into the file, save it, and close Gedit.  (Mouse over to use the pointy-brackets button in the box for an easier copy and paste.)

[Re-enable hibernate by default in upower]
 Identity=unix-user:*
 Action=org.freedesktop.upower.hibernate
 ResultActive=yes

[Re-enable hibernate by default in logind]
 Identity=unix-user:*
 Action=org.freedesktop.login1.hibernate
 ResultActive=yes

That’s it.  You should (after a reboot) be able to use hibernation in the various circumstances where it might be appropriate.  For me that’s really just in the Power settings, but you may have additional uses for it.

Have fun.

Share

Two-Finger Scrolling Unavailable—Not

So I’m using a different laptop.  It has a touchpad for mousing around, and on the touchpad are arrows indicating you are able to use edge scrolling.  This laptop is new enough it presumably has two-finger touch sensitivity, yet for whatever reason Unity’s System Preferences showed “Two finger scrolling” as greyed.

I prefer two-finger scrolling and thus I poked around the Webz to see what I could see.

I found this question asked and answered which had a solution to enable two-finger scrolling.  Essentially the solution (work-around really) is a collection of three commands which enable two-finger scrolling (why it is greyed is another matter for another time).

I tested it and it worked on my machine (a Lenovo w500) as well.  Great.

As advised in the article one could add those three lines as part of one’s start-up scripts (.bashrc in most cases), but I was feeling differently.  First I consolidated those three lines into one line using double-ampersands.  Then I created an alias called touchpad which contained those three-now-one lines of code.

Confusedly, this work-around only remained effective until the machine went to sleep.  I would understand any logout, but you’ll see from the code that this effects X and X must relaunch after sleep (or at least changes state enough to reset this).

Checking the man page for alias (which I had to find on-line as my bash in Ubuntu 14.04 doesn’t have it) I found that I could make an alias persist (or at least make it get recreated) by adding it to my .bash_aliases file in my home directory.

Now it works great.  I have added that alias to each user account I use on this laptop so it is easy to call.  Perhaps one day I’ll add the work-around elsewhere so I won’t have to instantiate it, but for now I have this.

Below you will see the code I used.  I hope this helps you today.

##
#!/bin/bash
# by JamesIsIn from JamesIsIn.com
# Do something nice today.

# Here is my alias. The code between the single quotes is what you would need if your aim was merely to test-fix your touchpad.

alias touchpad='xinput --set-prop --type=int --format=32 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 4 && xinput --set-prop --type=int --format=32 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Width" 8 && xinput --set-prop --type=int --format=8 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Scrolling" 1 0'

# Here is my .bash_aliases file.

cat .bash_aliases
# command to enable two-finger scrolling

alias touchpad='xinput --set-prop --type=int --format=32 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 4 && xinput --set-prop --type=int --format=32 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Width" 8 && xinput --set-prop --type=int --format=8 "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Scrolling" 1 0'

##
Share