Monthly Archives: March 2013

Bluetooth file transfer in Ubuntu or obexftp return code 96

Nautilus in recent Ubuntu 12.10 Quantal Quetzal fails to browse the files on my Nokia Asha 206 over a bluetooth connection:

gvfsd-obexftp crashed with SIGSEGV in _wordcopy_fwd_dest_aligned()

gvfsd-obexftp crashes reliably, and taking the many bug reports on launchpad into account, it does so since years. Having used good old obexftp years before I was amazed to see the project still alive, with a change in maintainership and an updating release in the beginning of March 2013.

Browsing files

Browsing the files on your phone is a simple as

obexftp -b bluetooth_device -l folder_to_list

where bluetooth_device is the device ID of your bluetooth device (e.g. your mobile phone). Get the device ID for example from your Bluetooh Settings (Click the Bluetooth symbol in the top right corner of your desktop).

Putting files

However, when trying to copy files to the phone, my endless trials ended always in

The operation failed with return code 96

errors. It took me a while to figure out that the order of command-line arguments to obexftp matters. For putting files, you need to specify the phone’s current directory with the -c option and this one must preceed the -p argument. So while

obexftp -b AA:BB:CC:DD:EE:FF -p local_file -c remote_folder

gives you above error,

obexftp -b AA:BB:CC:DD:EE:FF -c remote_folder -p local_file

will work fine.

Advertisements

sftp support for curl in Ubuntu 12.10 (Quantal Quetzal) and later

The Problem

Recently, downloading a file with curl via sftp failed with the error message

Protocol sftp not supported or disabled in libcurl

Indeed, as a curl -V revealed,

curl 7.27.0 (x86_64-pc-linux-gnu) libcurl/7.27.0 OpenSSL/1.0.1c zlib/1.2.7 libidn/1.25 librtmp/2.3 
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp

sftp support is lacking in Ubuntu 12.10 (Quantal Quetzal).

Searching the web indicates that this problem has been bugging Ubuntu users for several years now. The reason is that package libssh2-1 (sftp is ftp tunneled over SSH) is in universe and not in main (cf. debian/changelog). With curl being in main, it must not depend on libssh2-1.

The Solution

Nevertheless, it is possible to let curl support sftp by compiling it yourself from Ubuntu’s source package. We will describe the necessary steps shortly.

Make sure you have the appropriate deb-src entries in /etc/apt/sources.list

deb-src http://archive.ubuntu.com/ubuntu/ oneiric main restricted universe

Then, setup the build environment with

mkdir /tmp/curl
cd /tmp/curl
sudo apt-get update
sudo apt-get install build-essential debhelper libssh2-1-dev
apt-get source curl
sudo apt-get build-dep curl

Having libssh2-1-dev installed, sftp support will automatically be compiled in. You will find older tutorials that require editing debian/rules. I found this not to be necessary with recent source packages. In fact it seems the explicit disabling of libssh support by configuring with –without-libssh2 has been dropped from the rules file.

cd curl-*
dpkg-buildpackage

will build the binary packages. This will take some time, in particular the tests require you to be patient. Finally, update all curl and libcurl packages on your system (there is no need to uninstall existing packages first).

cd ..
dpkg -l | grep curl
dpkg -i curl_7.27.0-1ubuntu1.1_amd64.deb 
dpkg -i libcurl3_7.27.0-1ubuntu1.1_amd64.deb
(...)

Please keep in mind that the so installed packages will not be updated automatically. You need to go through above workflow everytime you want to update curl (and have sftp support enabled).

Further note that sftp support is a feature of libcurl and not of the command-line tool curl. So if you just update curl but not the libcurl package, you will still end up with the command-line tool lacking sftp support.

Update: It is actually the tests that take up so much time. Setting

DO_TEST=no

in debian/rules before SHLIBS_VERSION= skips any tests. In order to further speed up the build process, make use of dpkg-buildpackage’s -jNUM_PROC option. It works just as for make.