CyanogenMod 13 Nightly: SetupWizard has stopped working.

I have a OnePlus One and recently upgraded to CM 13 Nightly. After flashing the full version of the 6.0 Gapps listed on the CM wiki, an error that read “SetupWizard has stopped working” occurred in an infinite loop and prevented me from doing anything on the phone.

logcat reports this error:

12–01 15:51:06.145 7860 7860 E AndroidRuntime: FATAL EXCEPTION: main
12–01 15:51:06.145 7860 7860 E AndroidRuntime: Process: com.google.android.setupwizard, PID: 7860
12–01 15:51:06.145 7860 7860 E AndroidRuntime: java.lang.RuntimeException: Unable to create application com.google.android.setupwizard.SetupWizardApplication: java.lang.SecurityException: addOnSubscriptionsChangedListener: Neither user 10002 nor current process has android.permission.READ_PHONE_STATE.

To fix this, run adb shell and enter:

pm grant com.google.android.setupwizard android.permission.READ_PHONE_STATE

The process will stop crashing and you’ll be able to use your phone again. This is most likely a bug in the GApps package being distributed, since it’s supposed to flip the necessary permissions bits after installation.

Ubuntu 14.04+ can’t connect to some servers

Some servers have trouble talking to Ubuntu 14.04+. This is because OpenSSL 1.0.1g, which included a patch to use a different TLS padding value, was not packaged for Ubuntu; OpenSSL security fixes have been backported to Ubuntu’s 1.0.1f since then. The patch in question bears this commit manifest:

commit 6411b83e52fdfd0d3563d50a4dc00838b142fb2c
Author: Dr. Stephen Henson <steve@openssl.org>
Date:   Sat Apr 5 20:43:54 2014 +0100

Set TLS padding extension value.

Enable TLS padding extension using official value from:

http://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml
(cherry picked from commit cd6bd5ffda616822b52104fee0c4c7d623fd4f53)

Conflicts:

CHANGES

It seems that some MS IIS servers are configured to reject TLS connections that advertise a particular version and do not use this new padding spec, probably in an attempt to mitigate the POODLE attack. Interestingly, OpenSSL 1.0.1a still seems to work.

This problem will often manifest as a hung connection on SSL protocol negotiation, or an error stating that there was an unknown SSL protocol error. It can be worked around without patches by manually specifying the cipher on the commandline.

Rails inserts BLOB data into field with expected TEXT type

Encountering this on Rails 4.0.1 on Ruby 1.9.3. This replica cartier happens because ActiveRecord sees the data you’re inserting as binary. It’s a string encoding issue.

In my particular case, the problem arose from cartier love bracelet
sending the output of Digest::MD5.hexdigest() (disclaimer: do not use MD5 in security-sensitive applications) directly to the ORM for handling. There cartier love bracelet is a bug in Rubies < 2.0.0 that renders the output of hexdigest as ASCII-8BIT instead of US-ASCII. ASCII-8BIT is interpreted by many gems, including ActiveRecord, as binary data.

Thankfully, the workaround is quite simple. Just tack on a force_encoding call after your hexdigest and you should be good, like so:

Digest::MD5.hexdigest("data").force_encoding(Encoding::US_ASCII)

This will return the hexdigest string in a format widely interpreted as text data, and ActiveRecord, YAML, and other gems will begin handling the string as expected.

Once again, this workaround is not necessary on Ruby >= 2.0.0, which already contains a patch for the Digest gems that specifies the correct encoding. Therefore, an alternate solution is to upgrade to Ruby >= 2.0.0, or compile a Ruby that contains the resolving patch.

PulseAudio: combine sinks for simultaneous output

Most stuff on this is dated and/or speculative, so here’s a quick and easy howto on combining sinks in PulseAudio for simultaneous output.

If you’d like to include a Bluetooth headset or similar transient output device in your combined sink, please ensure it is correctly connected and visible in your preferred PulseAudio volume manager before proceeding.

The module-combine-sink module (previously simply “module-combine“) provides the functionality we need.

pacmd is [usually] distributed with PulseAudio and allows the user to send commands to the running PA server. Start pacmd and send list-sinks to the server. You’ll get output like:

x sink(s) available.
index: 0
name:
driver:
flags: HARDWARE DECIBEL_VOLUME LATENCY FLAT_VOLUME DYNAMIC_LATENCY
[...]
index: 1
name:
driver:
flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY FLAT_VOLUME DYNAMIC_LATENCY
[...]

Read this list and copy the names of the sinks (without the enclosing brackets) that you would like to combine; they should be fairly self-explanatory.

Then, create a combined sink containing all sinks on which you’d like simultaneous output by sending this command to the pacmd:

load-module module-combine-sink sink_name=combined slaves=alsa_output.pci-0000_09_04.0.analog-stereo,alsa_output.pci-0000_01_00.1.hdmi-stereo-extra3

sink_name is the name by which the sink will be identified and slaves is a comma-delimited list of all sinks upon which simultaneous output of the desired stream should occur.

This new sink should be immediately visible in your volume manager, from which you can switch individual streams to the combined sink or set the new sink as the default output.

Note that on transient devices like Bluetooth headsets, it may be necessary to recreate this sink each time the device is reconnected. In my experience, it’s just simpler to restart PulseAudio before connecting your new transient device, or else the old sink may linger and create issues. This can be done simply by issuing pulseaudio --kill; pulseaudio --start at your user’s shell.

Hosting shared folder from IIS 7 and VirtualBox

I have a Win7 guest running in VirtualBox. I’m working on a .NET project and got really sick of rebooting for Windows, so after some failed attempts to forward the ports for MSSQL and connect remotely, I have configured the guest to host my whole application while I develop and build in MonoDevelop.

I didn’t want to have to make a commit and push/pull every time I wanted to test, so I configured IIS 7 to use a shared folder from my host. However, conventional \\vboxsvr and VirtualBox shared folders do NOT work; IIS refuses to read the files, even after trying everything in the relevant Microsoft KB articles.

There is probably something wrong or incomplete in the VirtualBox implementation, because if you share the folder via Samba everything works swimmingly. I am using VirtualBox 3.2.8; if you are trying to use VBox’s shared folders to host a folder for IIS, stop now and set it up via Samba. This should solve any lingering difficulty unresolved by the Microsoft articles.

Once you have your share configured via Samba, just make sure that you configure IIS to “Connect as…” the user you’ve configured for Samba with smbpasswd and that you are using a UNC compatible path name (\\server\folder (in case of VirtualBox, this will usually be \\10.0.2.2\folder)), not mapped drive letters like X: because mapped drive letters only exist for the users that mount them (i.e. your main user, not your IIS user).

You may get another security related error, which can be resolved by entering the .NET Framework Configuration Manager and enabling FullTrust for the correct Code Group (I just enabled it for LocalIntranet due to the inherently local nature of the VirtualBox setup on my development box).

This article may help if you are receiving the following errors:

  • “The requested page cannot be accessed because the related configuration data for the page is invalid”: 0x80070003, 0x80070005, etc.
  • Exception Details: System.Security.SecurityException: Security error. PublicKeyToken=b77a5c561934e089

Windows 7 font fix

While using Windows 7 one day, I uninstalled a Google program (Google Earth, I think), and then all of my fonts were permanently italic, everywhere. I worked around this by following a tip from another user on a Google help site and installing arial32.exe every time I booted into Windows, which apparently reset something that got removed, but it would only last until the next reboot. That got tiring and didn’t work on everything, so I tried to make the fonts normal again.

I found a font fix for Windows Vista that looked plausible and applied it. Well, that didn’t go over well. All of my fonts were now broken, and I just got little squares and weird things. After trying to trawl through the registry and undo the fix I’d applied, I settled that I would need to do a repair installation.

So I put in the install disc, rebooted, and found out that at least on my disc, you can’t really do a repair installation. That was a waste of time and really lame. Do other Win 7 discs lack a repair install?

I tried to install PowerPoint Viewer because someone said that it contained all default Windows fonts. I’d hoped it would restore the registry keys. It didn’t. If you have deleted your actual fonts, this still might help, but it won’t fix registry problems.

Then the idea came to me that I had a Win 7 install in a virtual machine, and that I could grab the font keys from there and hopefully that would undo the big evil Vista fix as well as the italics problem. I exported the keys from the VM and applied on the native install, and it worked! 😀

I’m attaching the registry fixes to this. If any of you have these problems with a Windows 7 install, remove:

  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontMapper\FamilyDefaults
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes

and then apply win7_font_fix, which will restore Windows’s default font settings and fix things like permanent italics.

Of course, you should make always make a backup before you change the registry and I claim no responsibility for damage this fix may cause. This fix is not supported. Use it at your own risk. I hope it helps some people.

Once again, the link for that is win7_font_fix.

Add player stats to scoreboard in sauerbraten/cube2

We all like sauerbraten, but I wanted a persistent look at my stats as I played. As such, I have written the following patch to display relevant info. Thanks to #sauerbraten for help.

This works against stable, “Trooper Edition”. There is a patch for SVN floating around out there somewhere, which includes flags captured as SVN has that variable implemented and I didn’t feel like backporting it. Hopefully there will be a release soon and it will be moot.

So, just apply this from sauerbraten/, not sauerbraten/src.

Patch redacted Sept. 2010; please see http://github.com/sjuxax/cube2-stable

Removing Adobe Drive CS4 in Windows

So, after sitting around for more than an hour waiting for Adobe’s indecently bloated CS4 installer to finish installing Photoshop and Flash, I right-click on a file, and am rewarded with a lovely little “Adobe Drive CS4” context option. I definitely didn’t want this, and I’m upset that when all I asked for was Flash and Photoshop two new Adobe submenus appear on my Start list, one containing only “Adobe Media Player” and another containing nine items, only two of which I asked for, plus another top-level icon for “Acrobat.com”, so Adobe sucks.

Anyway, it seems that the recommended method to remove Adobe Drive CS4 from the context menu is to open the installer and uninstall it (funny that I wasn’t asked about this the first time), but if you’re running Windows in a virtualized guest like me and don’t want to wait the ten minutes it takes Adobe to “[check your system profile]” and “[Load] Setup”, remove these two registry keys:

HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers\{C95FFEAE-A32E-4122-A5C4-49B5BFB69795}
HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\{C95FFEAE-A32E-4122-A5C4-49B5BFB69795}

and you should be freed from offending entry.

Alas, Adobe Drive CS4 is still sitting around somewhere sucking up space uselessly, but we’ll leave well enough alone for now.