Category Archives: Technology

ChromeOS SSH with Public / Private Keypairs

Samsung’s ARM-based Chromebook is still the #1 Best Seller in Laptop Computers on Amazon, and rightly so! Unfortunately for many of us, the Secure Shell chrome app doesn’t work properly on ARM yet. That could be a deal breaker, right? Not so! Chrome may not have a built-in terminal, but ChromeOS does, even (with some restrictions) when not in Developer Mode, and it has an SSH client.

I don’t allow passwords to connect to my servers, only keypairs. To use an ssh private key you have to jump through some extra hoops.

  • Download your key to the Downloads directory. I keep an encrypted copy of my key in Google Drive.
  • Press Ctrl-Alt-T to open a terminal tab.
  • At the crosh> prompt, type the following:
    • ssh
    • user <your-user-name>
    • host <your-host-name>
    • key <your-key-filename> (no need for a full path, it searches for it in Downloads)
    • connect
Welcome to crosh, type 'help' for a list of commands.
crosh> ssh
ssh> user newbie
ssh> host server.domain.com
ssh> key id_rsa
ssh> connect
Enter passphrase for key '/home/chronos/user/.ssh/key-d0395ccd-28c4-4460-8d71-39c797bfb0ee': 
Last login: Tue Jan 15 21:48:48 2013 from some-ip.isp.net
newbie@server:~$

Samsung Galaxy Nexus Vehicle Dock Review

DO NOT BUY! There’s a reason there are no reviews or ratings on devices on the Google Play.

Update: 3 months later; Yes, THREE months later I finally have a refund for this horrible product.

Remember the HTC Nexus One Car Dock? It cost $55, plus free shipping, but, hey, it had a Bluetooth audio device and some speakers on it. It was attractive and well designed. Mine broke after nearly a year, but HTC replaced it.

And the Samsung Nexus S Navigation Mount? That sold for around $40, plus $4 shipping. Kinda steep considering it didn’t have any electronics in it at all. A little hard to get your phone out of, but it felt secure in the durable but flexible hard rubber frame. If you were in a hurry you could leave it in the frame and pop it off the mount. It was thin and light enough you could almost imagine they meant for you to leave it on all the time. I’m sure some people do.

But the Samsung Galaxy Nexus Vehicle Dock, for $54, plus $10.50 shipping! is probably the worst piece of equipment I have ever had the misfortune to purchase. If you ordered one please do yourself a favor and cancel. If the UPS guy rings your doorbell tell him you’re refusing shipment. The product description says, “The custom fitted cradle holds the handset securely during long rides.” What it means is, “If you can get your phone into it, don’t plan on getting it out. It’s in there for the long haul.”

There’s about a half inch of hard, inflexible plastic in every direction. If you press hard enough you’ll feel lucky if don’t break off your volume buttons, power button, and the pogo pins inside the dock. When you hop out of the car to catch the express bus into town just insert your crow bar in the back and have your catcher’s mitt ready for when your beloved Galaxy Nexus flies out the window onto the hard, unforgiving pavement. The brainless middle-manager who personally designed this abomination “design can’t be that hard, right?” should be sent back to middle-school with a sign on his back that says “kick me!” “c’mon, real funny, guys. ha ha.”

It has pogo pins, button extenders, a 3.5mm audio jack, and a micro-USB plug. Jail cells have a toilet. Good thing, right?

Don’t believe me? Here’s a link to the similar product (without the electronics) on Samsung’s own website. Be sure to sort by “most helpful first”.

What’s that you say? A re-stocking fee? No, I don’t think that’s going to happen. A 15% re-stocking fee for this monstrosity? That’s $8.10 for the privilege of opening this enormous box and fathoming the depths of my disappointment. Can I at least pay the return shipping cost?

Shame on you, Samsung. Shame on you, Google.

Surcharging

Square charges a flat 2.75% as of this post, so let’s say someone wants to pay you $100 but you don’t want to be the one to take the hit for using a credit card. How do you arrive at the correct value for the surcharge?

You could add 2.75% to arrive at $102.75, but then when Square takes their cut you only get $99.92. You lost 8¢! That’s because 2.75% of $102.75 is more than $2.75. So let’s get our maths in a row and fix it!

We’re looking for the value x such that x-x*2.75%=y where y is the amount you want to end up with. Simplify that using algebra and you get x*97.25%=y or rather x=y*1/97.25% or x=y*102.8277635%. For you folks without a % on your calculator that’s x=y*1.028277635.

The generalized solution for finding what you should surcharge, compared to what you are being surcharged is x=1/(1-y)-1.

In the $100 range we can drop some of those extra digits to arrive at a surcharge of 2.83%. Since we rounded up this keeps you safe in the $1,000 range too.

Of cource it’s easier to calculate a surcharge of 3%, but that makes you a bit of a jerk. On the other hand you could take the 8¢ hit and call it even, or go down to 2% and share the cost more evenly.

Backing up your Nexus One without root

Rooting your phone is a pain, especially if you have all the latest updates installed so that the known exploits don’t work. But the only reason I wanted to root my Nexus One was to make a full backup so that I could restore it after giving CyanogenMod a try. You can create a full backup without root privileges. Note that this very likely requires an unlocked bootloader (I can’t verify as mine is already unlocked). This is a quick howto and as such will presume you have a level of expertise.

If you haven’t already done so…

Download fastboot for your platform from HTC.

Shut down your device and hold the trackball button down while you boot up again. This will put the device in fastboot mode (the one with three skateboarding androids). Plug in via USB.

This will delete your data! Do some other kinds of backups and sync your data w/ Google first!

fastboot oem unlock

Follow the prompts on screen to unlock your bootloader and technically void your warranty.

Now on to making a full backup…

Ensure you have enough space on your microSD card (my backup took around 300MB).

Download a recovery image that does backups. Make sure you get one that’s correct for your device (one with passion in the name for the Nexus One). Checksum it to make sure it downloaded correctly. Get into the bootloader again.

fastboot boot recovery.img

This boots the custom recovery without flashing it. When it’s done booting use the menu it shows you to do a full Nandroid backup and then reboot. It will take a couple minutes.

When you want to restore your backup repeat this procedure but select restore instead of backup in the recovery menu. Restore takes longer than backup, be patient.

Using osc build to make a jail on openSUSE

Before I start let me say that there may be easier or more direct ways to do this.  This has the advantage of being pretty easy for me to do.  I’m not going to discuss why you might want to do this, or what a jail is, etc..

You can get the most recent osc and build tools from the openSUSE:Tools repository.  You will also need an account on the build service.

Create an empty directory
mkdir jail/

Go into that directory and create a dummy RPM .spec file
cd jail/
vim jail.spec

Name:           jail
Version:        0
Release:        0
Summary:        Jail
License:        Jail
Group:          Jail
BuildRequires:  vim gdb glib2-devel zypper
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description

%prep

%build

%install

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)

%changelog

The BuildRequires: tag is where you specify which packages you want installed in your jail, what I have listed there is just an example.

Also create an empty .osc directory (this prevents an ugly bug where the jail tries to delete itself)
mkdir .osc/

You’ll need to be logged in to OBS if you aren’t already
osc ls
Enter your credentials at the prompts

If for some reason that didn’t work you may need to put your password into your .oscrc file
vim ~/.oscrc
Toward the bottom…

[https://api.opensuse.org]
user=<YOUR USERNAME>
pass=<YOUR PASSWORD>

If your password changed you may need to delete any lines that say passx=<GARBAGE>, or manipulate your GNOME Keyring.

Now you should be ready to build a jail

osc build --local-package --root=</path/to/new/jail> --alternative-project=openSUSE:<VERSION> <ARCH>

<VERSION> is, for example, 11.2
<ARCH> is only needed if you want a different arch (i586 on an x86_64 machine)
</path/to/new/jail> is where you want the tool to put your jail (not the directory you’re in!), I use /var/tmp/jail
You may be prompted for your root password
When the jail is built (assuming it worked) it will fail complaining about an empty package, ignore that and get on with your life: you only wanted a jail, not a package.

At this point you can chroot into your jail
sudo chroot /path/to/new/jail
or if you are changing architectures…
sudo linux32 chroot /path/to/new/jail

Yay, you’re done!

Mono Appliance for VirtualPC

With the release of Mono 2.4.2 we are introducing an appliance image for Virtual PC. This makes a lot of sense for Mono as one of our favorite target user groups is .NET developers looking to get an application running on Linux. Many of these developers use Virtual PC.

All three of our appliance images (LiveCD, VMware, and now VirtualPC) contain exactly the same packages, etc. In fact our .vhd is actually just the .vmdk from the VMware appliance built in SUSE Studio and converted using qemu-img (requires a recent version, possibly unreleased). And actually the .vmdk we provide boots just fine under other VMs such as QEMU and VirtualBox. Linux can be nice that way.

We hope this will make Mono even easier for .NET developers to use but you may want to use VMware anyway.  The VirtualPC appliance has some problems:

  • There are no “VM Additions”.  They exist but they are not open source and IIRC the ones that exist don’t work on a recent Linux. So no handy stuff like drag-and-drop or mouse-in-mouse-out.
  • Things can be a bit slow / choppy at times.  This clears up after a while or maybe after a reboot.  Not sure what’s going on there.
  • We added some kernel parameters to make things run a little better: noreplace-paravirt i8042.noloop clock=pit. Joseph Hill dug these up on the Internet somewhere.
  • On the new Windows Virtual PC (the one for Windows 7) you don’t get a network device by default.  As far as I can tell we’re the only project shipping a .vmc configuration file with our .vhd anyway so the expectation seems to be that you will configure your own VM.

Find this and other fine Mono products at http://go-mono.com/mono-downloads/.

Grandstream HandyTone 503

My current SIP ATA is the HT503 from GrandStream. I bought it because if I’m going to use VoIP at all at home I need to have a reliable fallback, at least until all my ducks (ISP, router, QoS, ATA, etc.) are in a row. And realistically I’m probably going to be paying huge monthly fees to Qwest for nothing but local phone service for the rest of my life. There are many independent VoIP providers like Axvoice who let you BYOD (Bring Your Own Device). Their Unlimited calling plans are under 10 bucks a month which may be the break you are looking for.

ht503

The HT503 has an FXS and an FXO so that it sits between our phones and our land-line. This means I can pick up the phone and place a call on the public switched telephone network (PSTN) or on the Internet depending on how I dial. It also means that calls coming in from the Internet or the PSTN all ring the same phones. Thus I can try VoIP (and get my wife to try it) without disrupting our lives. (It can also do fun things like let me call in from the Internet and place a local call on my land-line but I don’t use those features.)

The dark side to this story is that my first HT503 completely failed it’s firmware upgrade and would not boot at all. Two more shipping charges later I had another HT503 which I upgraded far more carefully. Why would any embedded device not have some fail-safe recovery method? Dunno.

To add insult to injury when I finally got the new device configured I found that it would not dial on the PSTN reliably. I tried to tweak settings to get it working but I failed and had to pull the plug. Months later I saw that there had been many firmware revisions since my last try so with renewed confidence I upgraded and tried again. Sadly I got the same result: when I’d dial a ten-digit phone number I would get a message from Qwest that I had dialed wrong.

It turns out this was actually my fault (sort of). Recently central Utah was moved to ten-digit dialing to accommodate a new area code they decided to overlay on the same region. I decided it would be nice to have the device do the right thing when a seven-digit number was dialed, so I programmed the dial-plan to add 801 to the front of any seven-digit number. It turns out, though, that GrandStream dial-plans are not interpreted the way I thought they were. For some reason when I dialed a ten-digit number the device would truncate the number and slap 801 on the front resulting in a new, wrong, ten-digit number (801-801-5550 if I dialed 801-555-0123). I still don’t know how to write the correct dial-plan for this. After dropping the seven-digit rule everything works.

Actually there was one more brief problem where an incoming PSTN call would ring but when the person answering the call picked up they would hear a busy tone and the caller would continue to hear ringing. That problem went away. I’m not sure if I did something to fix it. When the HT503 makes a connection between it’s FXO and it’s FXS it does so by having the one port call the other on the local loopback interface. The answer to this mystery may be in that architecture somewhere. One thing it means is that if you select a lossy codec for both interfaces it seems to actually encode and decode the audio even though it’s on the same device.

Overall I’m actually going to hazard recommending this device. It’s compact, affordable, full of great features, and so far (apart from my own mistakes) has been very reliable.