Monday, October 26, 2015

Updating crashplan on a linux system

This failed for me when trying to move from crashplan 4.3.3 to 4.4.1. It took me a while to figure out why. I should have looked in /usr/local/crashplan/logs and seen logs named along the lines of "upgrade.1435726800441.1445830017698.log". Looking in there shows:

Sun Oct 25 21:26:59 MDT 2015 : Stopping using /etc/init.d/crashplan...
Stopping CrashPlan Engine ... OK
Sun Oct 25 21:27:09 MDT 2015 : Ensuring the UpgradeUI is not running.
Sun Oct 25 21:27:09 MDT 2015 : UpgradeUI is shut down.
Sun Oct 25 21:27:09 MDT 2015 : JAVACOMMON is set: /usr/bin/java
Sun Oct 25 21:27:10 MDT 2015 : Current Java Version: 1.6
Sun Oct 25 21:27:10 MDT 2015 : This client requires one of these JREs: 1.7 1.8.  Exiting upgrade
Sun Oct 25 21:27:10 MDT 2015 : Starting using /etc/init.d/crashplan...
Starting CrashPlan Engine ... Using standard startup
OK

What I did was run "bash -x update.sh" in the most recent directory in /usr/local/crashplan/upgrade and saw the same error. So, time to upgrade my jre on this debian system. I issued the apt-get:

$ sudo apt-get remove openjdk-6-jre
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  gcj-4.7-base gcj-4.7-jre gcj-4.7-jre-headless gcj-4.7-jre-lib gcj-jre
  gcj-jre-headless libgcj13 libgcj13-awt openjdk-7-jre openjdk-7-jre-headless
Suggested packages:
  fastjar gcj-4.7-jdk gcj-jdk libgcj13-dbg icedtea-7-plugin
  icedtea-7-jre-jamvm sun-java6-fonts fonts-ipafont-gothic
  fonts-ipafont-mincho ttf-wqy-microhei ttf-wqy-zenhei ttf-indic-fonts
The following packages will be REMOVED:
  default-jre icedtea-netx openjdk-6-jdk openjdk-6-jre
The following NEW packages will be installed:
  gcj-4.7-base gcj-4.7-jre gcj-4.7-jre-headless gcj-4.7-jre-lib gcj-jre
  gcj-jre-headless libgcj13 libgcj13-awt openjdk-7-jre openjdk-7-jre-headless
0 upgraded, 10 newly installed, 4 to remove and 7 not upgraded.
Need to get 66.4 MB of archives.
After this operation, 105 MB of additional disk space will be used.

and low and behold, it knew enough to install openjdk-7-jre. Nice! But that wasn't enough, there were other Java 1.6 runtimes lurking:

dpkg -l | grep -i openjdk
ii  icedtea-6-jre-cacao:amd64             6b36-1.13.8-1~deb7u1               amd64        Alternative JVM for OpenJDK, using Cacao
ii  icedtea-6-jre-jamvm:amd64             6b36-1.13.8-1~deb7u1               amd64        Alternative JVM for OpenJDK, using JamVM
ii  openjdk-6-jre-headless:amd64          6b36-1.13.8-1~deb7u1               amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
ii  openjdk-6-jre-lib                     6b36-1.13.8-1~deb7u1               all          OpenJDK Java runtime (architecture independent libraries)
ii  openjdk-7-jre:amd64                   7u79-2.5.6-1~deb7u1                amd64        OpenJDK Java runtime, using Hotspot JIT
ii  openjdk-7-jre-headless:amd64          7u79-2.5.6-1~deb7u1                amd64        OpenJDK Java runtime, using Hotspot JIT (headless)

So, let's get to removing those.

$ sudo apt-get remove icedtea-6-jre-cacao
$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  icedtea-netx-common libice-dev libpthread-stubs0 libpthread-stubs0-dev
  libsm-dev libx11-dev libx11-doc libxau-dev libxcb1-dev libxdmcp-dev
  libxt-dev x11proto-core-dev x11proto-input-dev x11proto-kb-dev
  xorg-sgml-doctools xtrans-dev
0 upgraded, 0 newly installed, 16 to remove and 7 not upgraded.
After this operation, 20.2 MB disk space will be freed.
$ sudo apt-get remove icedtea-6-jre-jamvm
$ sudo apt-get remove openjdk-6-jre-headless
$ sudo apt-get purge openjdk-6-jre-headless

Now, we're somewhere. I was then able to complete an install via cd /usr/local/crashplan/upgrade/1435726800441.1445828290338" (your directory name will be different), and "bash -x upgrade.sh". Morals: look for log files, it might save you a little time.

Tuesday, October 20, 2015

RoR install on OS X without sudo

There is plenty of advice out there as to how to do this, most of it wrong or too complicated. The short story is one can install everything necessary without sudo, in your home directory. First, make sure your Xcode is ready to go:

xcode-select --install

Then install rails, but only after a successful nokogiri install:

gem install --user-install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2
gem install --user-install rails

You'll need to fix up your PATH variable to point to what you installed:

export PATH=/Users/beatys/.gem/ruby/2.0.0/bin:$PATH

Now you can create rails apps, again taking care to worry about nokogiri first:

rails new Demo --skip-bundle
cd Demo
bundle config build.nokogiri --use-system-libraries --with-xml2-include=/usr/include/libxml2
bundle install --path vendor/bundle

While it shouldn't be this complex, here we are.

Monday, October 19, 2015

List CAs on OS X from the command line

This turned out to be more difficult than it should have been. I can easily see the certs in the browser, but I wanted a list on the command line. Here's what it took.

# brew install nss
# /usr/local/Cellar/nss/3.20/bin/certutil -d ~/Library/Application\ Support/Firefox/Profiles/rnwwcxjq.default -L

Easy enough when you see it. Note: that's my profile path, not yours. The thing is, that only shows "Software Security Device" certs, not the "Builtin Object Token" certs. That took:

# mkdir /tmp/nss
# cd /tmp/nss
# /usr/local/Cellar/nss/3.20/bin/certutil -N -d .
# /usr/local/Cellar/nss/3.20/bin/modutil -add roots -libfile /usr/local/Cellar/nss/3.20/lib/libnssckbi.dylib -dbdir .
# /usr/local/Cellar/nss/3.20/bin/certutil -L -d . -h all

Kudos to http://mozilla.6506.n7.nabble.com/How-do-I-get-the-certificates-out-of-the-builtin-object-token-td198543.html

Sunday, August 16, 2015

XKCD-style password generator

There are a number of sites that generate XKCD-style passwords (see: https://xkcd.com/936/). Most generate the pass phrases on their server, meaning they have you IP address and the pass phrase they generated for you. Being the type that doesn't trust others to generate my passwords, I wrote some JavaScript to do the same in my browser. I took the 11029 5 - 8 character words from Google's 20000 most popular English words (git clone https://github.com/first20hours/google-10000-english). Here's the result, hit "Generate!" as many times as you'd like to get a memorable phrase. In general, you shouldn't need to use numbers, upper case characters, or symbols unless needed for a site's requirements, as long as the phrase is longer than 16 or so characters. You can view the source to this page to see how it works if you're curious.

Number of words
Include numbers
Include random upper case
Include symbols
Word separators

Result