Tag Z10

SSH from Linux to BlackBerry Z10

You can SSH into a BlackBerry Z10 device even on Linux. I'm using Red Hat Enterprise Linux 6 and here is how to establish the connection.

1) Enable USB networking between your Linux desktop and the Z10;

2) Install the Momentics IDE. You need it to create debug tokens and to start the SSH daemon on the device;

3) Obtain signing keys and create a debug token by following the wizard in the IDE. I just started a new project and followed the instructions;

4) Install debug token on device using the IDE. From Window -> Preferences select Blackberry -> Signing. Just create and deploy the debug token on the device. Mine was automatically discovered so I just had to follow the prompts;

5) Reboot and re-enable development mode (I'm not sure if this was necessary);

6) Generate a 4096 bit key for SSH. Smaller keys won't work. You can use your current key if it is 4096 bit;

$ ssh-keygen -t rsa -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key (/home/atodorov/.ssh/id_rsa): /home/atodorov/.rim/testKey_4096_rsa
/home/atodorov/.rim/testKey_4096_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/atodorov/.rim/testKey_4096_rsa.
Your public key has been saved in /home/atodorov/.rim/testKey_4096_rsa.pub.
The key fingerprint is:
77:73:55:03:e1:fc:5b:df:a6:e9:2c:b4:d4:1e:0c:b2 atodorov@redbull.mini
The key's randomart image is:
+--[ RSA 4096]----+
|             oo..|
|            o   o|
|             o  .|
|          . . .. |
|        S .oo+...|
|         .E.oo+ =|
|           o o o+|
|            o..+ |
|             o=  |
+-----------------+

7) Update key permissions, since ssh complains:

    $ chmod 600 ~/.rim/testKey_4096_rsa.pub

8) By default SSH is not listening on your BlackBerry. Use the blackberry-connect command to start the SSH daemon on the device. It will upload your public SSH key to the device and start the SSH daemon on the other side. password is your device password;

$ pwd
/home/atodorov/bbndk/host_10_1_0_231/linux/x86/usr/bin

$ ./blackberry-connect 169.254.0.1 -password 123456 -sshPublicKey ~/.rim/testKey_4096_rsa.pub
Info: Connecting to target 169.254.0.1:4455
Info: Authenticating with target 169.254.0.1:4455
Info: Encryption parameters verified
Info: Authenticating with target credentials.
Info: Successfully authenticated with target credentials.
Info: Sending ssh key to target 169.254.0.1:4455
Info: ssh key successfully transferred.
Info: Successfully connected. This application must remain running in order to use debug tools. Exiting the application will terminate this connection.

9) Check if SSH is running on the device

$ nmap 169.254.0.1

Starting Nmap 5.51 ( http://nmap.org ) at 2013-07-18 10:19 EEST
Stats: 0:00:01 elapsed; 0 hosts completed (1 up), 1 undergoing Connect Scan
Connect Scan Timing: About 14.30% done; ETC: 10:20 (0:00:06 remaining)
Nmap scan report for 169.254.0.1
Host is up (0.00097s latency).
Not shown: 991 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
139/tcp  open  netbios-ssn
443/tcp  open  https
445/tcp  open  microsoft-ds
1111/tcp open  lmsocialserver
5555/tcp open  freeciv
8000/tcp open  http-alt
8443/tcp open  https-alt

Nmap done: 1 IP address (1 host up) scanned in 12.47 seconds

10) Use SSH with the specified key to connect to the Z10. Username is devuser. Here's a simple session:

$ ssh -i ~/.rim/testKey_4096_rsa devuser@169.254.0.1
$ 
$ pwd
/accounts/devuser
$ uname -a 
QNX atodorovZ10 8.0.0 2013/05/02-08:42:48EDT OMAP4470_ES1.0_HS_London_Rev:08 armle
$ date
Fri Jul 19 23:39:19 EEST 2013
$ ifconfig 
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33192
    inet 127.0.0.1 netmask 0xff000000
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
tiw_drv0: flags=8c02<BROADCAST,OACTIVE,SIMPLEX,MULTICAST> mtu 1500
    address: 1c:69:a5:d0:10:cd
tiw_sta0: flags=40008c43<UP,BROADCAST,RUNNING,OACTIVE,SIMPLEX,MULTICAST,ACCEPTRTADV> mtu 1500
    address: 1c:69:a5:d0:10:cd
    inet 192.168.0.100 netmask 0xffffff00 broadcast 192.168.0.255
    inet6 fe80::1e69:a5ff:fed0:10cd%tiw_sta0 prefixlen 64 scopeid 0x12
tiw_p2pdev0: flags=8c02<BROADCAST,OACTIVE,SIMPLEX,MULTICAST> mtu 1500
    address: 1c:69:a5:d0:10:cd
tiw_p2pgrp0: flags=8c02<BROADCAST,OACTIVE,SIMPLEX,MULTICAST> mtu 1500
    address: 1c:69:a5:d0:10:cd
tiw_ibss0: flags=8c02<BROADCAST,OACTIVE,SIMPLEX,MULTICAST> mtu 1500
    address: 1c:69:a5:d0:10:cd
pflog0: flags=0 mtu 33192
lo2: flags=8048<LOOPBACK,RUNNING,MULTICAST> mtu 33192
cellular0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> mtu 1500
cellular1: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> mtu 1500
cellular2: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> mtu 1500
cellular3: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> mtu 1500
cellular4: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> mtu 1500
bptp0: flags=8043<UP,BROADCAST,RUNNING,MULTICAST> mtu 1356
    inet6 fe80::1e69:a5ff:fed0:10cd%bptp0 prefixlen 64 scopeid 0x2d
    inet6 fd02:42ac:77b2:d543:c158:fabb:6276:80e6 prefixlen 8
ecm0: flags=8a43<UP,BROADCAST,RUNNING,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
    address: 1e:69:a5:d0:10:cd
    inet 169.254.0.1 netmask 0xfffffffc broadcast 169.254.0.3
    inet6 fe80::1c69:a5ff:fed0:10cd%ecm0 prefixlen 64 scopeid 0x2e

IMPORTANT: you can also use the WiFi address of the device to pass to backberry-connect and ssh. It works for me.

I'm starting to explore the dark world of QNX in the next couple of days and will keep you posted! Until then - happy hacking.

There are comments.

Exploring BlackBerry 10 - nmap

This is the first post in upcoming series while I explore my BlackBerry Z10 device and figure out what's on it.

First configure Z10 for USB networking. Then from Settings - Security and Privacey - Development Mode turn Use Development Mode to On. From my Linux box I run nmap against the usb (169.254.0.1) and wi-fi (192.168.0.100) addresses of Z10:

$ nmap 169.254.0.1

Starting Nmap 5.51 ( http://nmap.org ) at 2013-07-17 23:03 EEST
Nmap scan report for 169.254.0.1
Host is up (0.00087s latency).
Not shown: 994 closed ports
PORT     STATE    SERVICE
80/tcp   open     http
139/tcp  open     netbios-ssn
443/tcp  open     https
445/tcp  open     microsoft-ds
1111/tcp filtered lmsocialserver
8443/tcp open     https-alt

Nmap done: 1 IP address (1 host up) scanned in 21.41 seconds


$ nmap 192.168.0.100

Starting Nmap 5.51 ( http://nmap.org ) at 2013-07-17 23:04 EEST
Nmap scan report for 192.168.0.100
Host is up (0.0035s latency).
Not shown: 998 closed ports
PORT     STATE    SERVICE
443/tcp  open     https
1111/tcp filtered lmsocialserver

Nmap done: 1 IP address (1 host up) scanned in 15.64 seconds

Firefox says the certificate used for https is invalid:

    The certificate is not trusted because it is self-signed.
    The certificate is only valid for PlayBook: 1c:69:a5:d0:10:cd

1c:69:a5:d0:10:cd is the wi-fi interface MAC address. All the http ports produce a 404 with index.html not found!

Trying some UDP scan:

# nmap -sU 169.254.0.1

Starting Nmap 5.51 ( http://nmap.org ) at 2013-07-17 23:32 EEST
Nmap scan report for 169.254.0.1
Host is up (0.00075s latency).
Not shown: 995 closed ports
PORT     STATE         SERVICE
67/udp   open|filtered dhcps
68/udp   open|filtered dhcpc
137/udp  open          netbios-ns
138/udp  open|filtered netbios-dgm
5353/udp open          zeroconf
MAC Address: 1E:69:A5:D0:10:CD (Unknown)

# nmap -sU 192.168.0.100

Starting Nmap 5.51 ( http://nmap.org ) at 2013-07-17 23:33 EEST
Nmap scan report for 192.168.0.100
Host is up (0.065s latency).
Not shown: 995 closed ports
PORT     STATE         SERVICE
67/udp   open|filtered dhcps
68/udp   open|filtered dhcpc
137/udp  open|filtered netbios-ns
138/udp  open|filtered netbios-dgm
5353/udp open|filtered zeroconf
MAC Address: 1C:69:A5:D0:10:CD (Unknown)

Nmap done: 1 IP address (1 host up) scanned in 143.65 seconds

There are comments.

Tip: How To Enable USB Networking Between BlackBerry Z10 and Red Hat Enterprise Linux 6

On Linux there is a feature called USB networking which provides you with a TCP/IP connection to another device connected via USB cable. Here is how to connect your BlackBerry Z10 to your Linux laptop over USB. I use Red Hat Enterprise Linux but should work out of the box for other distros too.

Connect the Z10 to your laptop:

    $ lsusb
    Bus 001 Device 005: ID 0fca:8020 Research In Motion, Ltd. Blackberry Playbook (CD-Rom mode)

By default many USB devices will present a virtual CD-ROM with drivers for Windows. This is the case here too. To change it go to Settings - Storage and Access and set USB Connection to Connect to Mac!

If necessary plug out and back in the Z10.

    $ lsusb
    Bus 001 Device 007: ID 0fca:8013 Research In Motion, Ltd.

    $ ifconfig
    usb0      Link encap:Ethernet  HWaddr 1E:69:A5:D0:11:0A  
              inet addr:169.254.0.2  Bcast:169.254.0.3  Mask:255.255.255.252
              inet6 addr: fe80::1c69:a5ff:fed0:110a/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:49 errors:0 dropped:0 overruns:0 frame:0
              TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:16002 (15.6 KiB)  TX bytes:1152 (1.1 KiB)

IMPORTANT: In the same Storage and Access screen scroll down to USB Mass Storage and turn it Off. If you don't do this your Z10 will appear as USB flash drive and no USB networking will be available. This is how it looks:

    $ lsusb
    Bus 001 Device 008: ID 0fca:8014 Research In Motion, Ltd.

IMPORTANT: If you need your Z10 storage accessible together with USB networking you can try accessing the device over Wi-Fi. Configure it from the same Storage and Access screen. Then your device will be available through Samba on its wireless IP address. I've tried it, works for me!

You don't need anything else to get this working. All set!

My intention is to use either USB networking or Wi-Fi to connect to the Z10 shell and explore it in more details.

There are comments.

Importing vCard Contacts To BlackBerry Z10 Sucks

I can honestly state that BlackBerry Z10 sucks big time when it comes to importing your contacts from another non-BlackBerry device. I've been struggling to transfer my contacts from Nokia 6303 to the Z10 for one day.

I tried a simple sync of the contacts from Nokia to Z10 over Bluetooth but that failed miserably, telling me the Z10 doesn't support this functionality. This is what to do:

  • On Nokia - Settings - Sync and backup - Create backup;
  • Then navigate to Apps - Extras - Memory card - Backup files;
  • Select the most recent backup file, e.g. Backup000.NBF and transfer it via Bluetooth (or USB cable) to my laptop;

For the record: this is a ZIP file with different extension. I've tried also to transfer it to the Z10 and open from File manager but to no avail.

  • Just unzip the file on the computer;
  • When extracted it will create multiple directories with meaningless names. Just find whatever you need - in my case this was the contacts/ directory containing hundreds of .vcf files;
  • Combine all the .vcf files into one. On Linux this is done with
    cat *.vcf > ../all.vcf
    

For the record: I've tried also sending all of these files to Z10. Via the File manager individual vCards open just fine but you need to Save them one by one. The combined vCard file didn't display correctly at all. Showed only one contact.

  • Then go to Gmail (or any other CardDAV service) and import all your vCards. Go to Contacts - More - Import - and select the combined vCard file since Gmail doesn't support multi-file uploads;

  • On your BlackBerry go to Settings - Accounts and add your Gmail account. By default this will create profiles for mail, calendar and contacts which will be synchronized with the device.

WARNING I had my Gmail previously configured on the Z10. Despite the account was configured to re-sync every 15 minutes it took around 2 hours for phone numbers to sync. And to make it worse there is no button for manual re-sync.

All of this done I have thousands of contacts on my Z10 spread across phone numbers, emails, vCards and contacts from social networks. I've noticed some of them (my guess those that had the same email or name) combined auto-magically. The rest can easily be linked together using the Contacts app Link functionality.

For the record: It is also possible to send vCards one by one directly from Nokia to Z10 via Bluetooth. The trouble is that for every entry you need to go through several layers of menu options and confirmations. This makes it impractical.

Summary

  • Importing hundreds of contacts from Nokia to BlackBerry Z10 is MIA;
  • BB Contacts app (and BB Hub) is cool but has some bugs;
  • Needs manual contact re-sync button;
  • Gmail re-sync took longer than expected;
  • Contacts Link feature can be improved and made more easy to use, e.g.

    • grid style display
    • multiple select and link
    • swipe and link, etc;
  • The current Link interface is sub-optimal

    • select a contact
    • tap Links
    • tap Add Link
    • tap Search
    • type and find the entries you'd like to link;
  • The current Link interface is buggy - when searching contacts to add as links it shows the currently opened contact too. Luckily it doesn't crash when the same entry is selected :). I've tried.

This is with OS Version 10.0.10.261.

There are comments.

How to Get a Free BlackBerry Z10

Do you want to have the latest and greatest devices on the market? For free? No problem if you are a software developer! Over the years I've got several devices for free and I will tell you how I did it.

Find a hardware vendor that has launched new products, is behind competitors in terms of software eco-system and present them with a great application which you will code on their device.

BlackBerry Z10 T-Shirt

This week I've been at the BlackBerry 10 Mini Jam in Sofia and I got a BlackBerry Z10 Dev Alpha B smart-phone.

BlackBerry 10 OS is different from previous versions. It has a QNX kernel and is largely incompatible with previous software. This means all apps need to be rewritten.

Another thing to note is that BlackBerry is behind Android, iPhone and probably Windows Phone in terms of applications. It is in their interest to lower the barrier to entry for developers and boost their software eco-system. Which in turn makes customers happy because they can find all sorts of applications. It's that simple.

Being a Linux guy my idea is to trade my Lenovo X220 for a smart-phone. The only thing(s) I need is all the command line tools which I use: bash, vim, coreutils and most notably Python. So I've decided to try and port all of these to the BlackBerry 10 OS. It should be doable because QNX is POSIX compliant and the OS itself comes with C/C++ and Qt/QML native development stack.

I have a few other ideas which are still taking shape in my head and are mostly towards mobile development.

I've heard BlackBerry Developer Group Balkan may have some devices to give away to developers so I simply asked. They liked my ideas and agreed to give me a developer device.

In addition they've given away the real product (not dev alpha devices) for free at Twitter contests held during couple of events so far. Several guys I know were lucky enough to win the prizes.

The OLPC XO laptop

OLPC XO laptop

In the past I've taken part in testing Fedora onto the XO laptop produced by the One Laptop Per Child project.

It is cool and innovative device with its software especially adapted to child education. The general public wanted to have a standard Linux distro running on the same hardware. Fedora being the original foundation on which the XO Linux distro was built was a good choice (among others).

I have received for free the XO laptop shown here and mainly tested networking related stuff. After the test initiative was completed (and also the upstream OLPC project ceased to exist closely after that) I got to keep the device for myself.

Which device to get ?

I'll keep my eyes open for a Firefox OS or Ubuntu Phone devices. As they come into stores they will have to compete with already established vendors.

Let me and everyone else know if you got a device for free being a developer! Share your story and tips into the comments below.

There are comments.


Page 1 / 1