Category Archives: OS

Operating Systems

PowerShelling Proper-like

We have started using some cool features in VMware’s Horizon infrastructure which enable us to remotely serve virtual applications.  These applications are being served from a Windows 2012 R2 server.  When install an application to participate in this infrastructure, you must use a special mode called (wait for it) /install, and when you are ready to serve those applications you switch back to the usual mode called (hold tight) /execute.  It’s a very simple PowerShell command.

change user /install

change user /execute

Problem was PowerShell informed me in no uncertain terms that I had to be an administrator to run them.

 

Who do you think you are?
Who do you think you are?

Only one issue: I am a member of the local Administrators group.

I pushed the turbo button on my brain and it thinked.  I right-clicked on the PowerShell icon and chose Run as Administrator.

Just a bad error message.  No worries here.

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

No Fucking with Sophos

We run Sophos on all of our machines at work.  I recently built a Windows 10 machine for one of our developers.  He ran into a problem, however, when he tried to debug the application he was writing.

Sophos was falsely blocking his application with the following error message:

File “C:\Users\[username]\Documents\Visual Studio 2015\Projects\KillerFuckingApp\KillerFuckingApp\obj\x86\Debug\intermediatexaml\KillerFuckingApp.exe” belongs to virus/spyware ‘Mal/DotNet-C’.

Ostensibly a false positive I went to discuss the matter.  It didn’t seem likely that his code shared any code with the known exploit so for shits and giggles I asked him to rename the application anything else to see if Sophos was merely objecting to the name.

Sure enough, once he removed “fucking” from the title, Sophos let things be.

At least Visual Studio wasn’t censoring our fucking developer.

Thanks, Sophos; but, you know, fuck off.

Share

Mac Disk Utility Image Issues

If you run into difficulties, for no apparent reason, while attempting to restore a drive from an image using Disk Utility, you may be able to get around this by using this method of selecting the source and destination.

I can’t say why this works, but normally I would simply drag-and-drop my source and destination into their respective fields.  However, if the imaging fails you can try selecting each by right-clicking on that item (in the left pane) and choosing either “Set as source” or “Set as destination” from the menu which appears.

(If you do not enable right-click, ctrl-click will produce the same menu.)

So far this has worked in every instance where the image should function but was not working using the other methods of selecting the source and destination.  As they say, your mileage may vary.

Go get ’em.

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

Delete Keychain Folder

We run the Casper Suite to control our Macs at work, and we are using folder re-direction for our conference room machines (for the users’ home directories).  Since all of these machines are Active Directory members and users do change their passwords (quite frequently per policy), we have issues when folks attempt to log into a conference room machine after they have changed their passwords.

The real trouble seems to be that Apple hasn’t quite readied the Mac OS for full enterprise AD integration.  Though the Macs are members and though a user is able to log in using network credentials, once those credentials are cached the OS doesn’t like to check with AD when the credentials offered by the user are not matched with those cached in the keychain.

I created a Self Service script which simply removes the entire keychain folder for the then logged-in user.  If there is a less heavy-handed solution to this matter I have not yet found it.  Here is that script for entertainment.

##
## Conference Room Keychain Fix
#!/bin/bash


## Delete user's Keychains folder (located in redirected home directory's Library folder)

username=$(stat -f %Su /dev/console)
rm -R /home/"$username"/Library/Keychains/


exit
##

I hope you find this useful and expedient.

Share

Fix for Firefox’s Profile Manager Error

There is a bug in Firefox (as near as I can tell) and it has been present for many versions (more than a dozen at least). It only effects users in a particular configuration on Macs, so it is not very likely to get any love any time soon. (I filed a bug report here ages ago.)

In short, Firefox is able to create it’s Profiles folder under /path/to/home/[username]/Library/Application Support/Firefox/ and it is able to create the associated profiles.ini file next to it.  However, Firefox is not able to add the information pointing the profiles.ini folder at the newly created profile folder.

If you try to launch Firefox you will only get the Profile Manager and it will not be able to see any profiles, nor will it be able to create one.  Instead it throws an error:

Profile Manager Error
Profile Manager Error

Anyway, perhaps one day Mozilla will fix it.  In the meantime I need to be able to fix this for users.  I know I can add a known-good profile and profiles.ini pair, so I figured I could just build my own profiles.ini file based on what I saw in the Profiles folder.  That worked so I just needed to create a way to use that information.

We use the Casper Suite to manage the Macs in our environment, so I was bent on doing something through Casper.  Additionally I wanted to user Casper’s Self Service application so I could just point a user to a single button to fix the problem.

Here is the script I added for users to evoke through Self Service.

## 
#! /usr/bin/env bash 
# Fix Firefox profile manager error on machines with re-directed home directories. 
# by JamesIsIn 
# Do something nice today. 
# https://github.com/jamesisin/slop-bucket/blob/master/popit/ConfRm_Replace_Firefox_profiles_ini.sh
## 


#Get current logged-in username. 
username=$( stat -f %Su /dev/console ) 


# Get first profile name in user's Library folder. 
profile="$( basename /home/"${username}"/Library/Application\ Support/Firefox/Profiles/* | head -1 )" 


# Empty and populate user's Firefox profiles file. 
printf "[General]\nStartWithLastProfile=1\n\n[Profile0]\nName=Default User\nIsRelative=1\n" 1>/home/"${username}"/Library/Application\ Support/Firefox/profiles.ini 
printf "Path=Profiles/""${profile}" 1>>/home/"${username}"/Library/Application\ Support/Firefox/profiles.ini 


exit 0 
## 

First I get the username of whomever happens to be logged in at the time Self Service is run on that machine and save that in a variable (called username).

Then I get the name of the first profile located in the user’s Firefox folder (under the user’s Library folder).  It doesn’t matter which one I use, I just arbitrarily chose the first one.  This way if there is only one I’ll be ok too.  I store that in a separate variable (called profile).

Finally I use those two variables to construct the appropriate profiles.ini file (using printf and standard output redirection).

Hope that helps you.

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