Tag Archives: ubuntu

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.

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.

Dual-head Monitor Setup on Ubuntu Linux with Xorg and radeon

Let me briefly summarize two methods to configure a dual-head setup with an external monitor connected to a laptop’s HDMI port on Ubuntu Linux 12.10 Natty. My setup includes a Lenovo Z565 laptop with an AMD/ATI Mobility Radeon HD 5470 graphics card and a Samsung S24A650D monitor. We assume that we rely Xorg’s open-source radeon driver throughout the tutorial.

Dynamic Configuration

We will use xrandr to configure a temporary dual-head setup during runtime. After connecting the monitor to the laptop, obtain the labels the system assigned to the monitors by a

xrandr -q

In my case, the output read

Screen 0: minimum 320 x 200, current 1920 x 1848, maximum 8192 x 8192
LVDS connected 1366x768+0+1080 (normal left inverted right x axis y axis) 0mm x 0mm
   1366x768       60.0*+
   1280x720       59.9  
   1152x768       59.8  
 (...) 
HDMI-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 531mm x 299mm
   1920x1080      60.0*+   50.0  
   1600x1200      60.0  
   1680x1050      59.9  
 (...)
VGA-0 disconnected (normal left inverted right x axis y axis)

The laptop’s internal monitor is called LVDS and the external monitor HDMI-0. By another call to xrandr, we activate the dual-head setup:

xrandr --output HDMI-0 --primary --left-of LVDS

The command line is to be understood literally: The HDMI monitor shall be the primary screen (e.g. displaying gnome’s titlebar) and shall be positioned left of the laptop’s internal monitor. For other placements, see xrandr’s –left-of, –right-of, –above and –below options or the very general –pos argument.

Permanent Configuration

For a permanent static configuration of a dual-head setup, we create a configuration file for the X server with an editor of your choice,

/etc/X11/xorg.conf

You will need root privileges for this. The contents of xorg.conf is as follows:

Section "Device"
        Identifier      "Mobility Radeon HD 5400 Series"
        Driver          "radeon"
        Option          "monitor-LVDS" "monitor_internal"
        Option          "monitor-HDMI-0" "monitor_external"
EndSection

Section "Monitor"
        Identifier      "monitor_internal"
        Option          "RightOf" "monitor_external"
EndSection

Section "Monitor"
        Identifier      "monitor_external"
        Option          "Primary" "true"
EndSection

In the device section, we specify to use Xorgs’s open source radeon driver and setup two aliases for the monitors. Please note that the monitor ID is composed of the static prefix monitor- and the monitor label as returned by xrandr -q (see above). The remaining configuration places the laptop’s internal monitor right of the external monitor. The latter is configured to be the primary screen.

Further Information

For more information, have a look at

  • Xorg’s documentation of the radeon driver
  • An article at Intel about configuring dual-head setups
  • and the man pages for the radeon driver (man radeon) and xrandr (man xrandr)

Ubuntu 12.04 Precise Pangolin – sudo and the PATH variable

Recently I noticed that a modified $PATH variable – even system-wide by scripts like

export PATH=add_to_path:$PATH

in /etc/profile.d – is not preserved when doing sudo, giving a familiar

sudo: (...) command not found

error message. As discussed here, the reasoning behind this are security measures. A convenient temporary work-around is to set the PATH variable when calling sudo

sudo env PATH=$PATH YOUR_COMMAND

This will give sudo the same PATH environment variable as the calling user.

SVN over SSH with multiple svn users and a single unix account without shell access (Unix / Linux client configuration)

Our goal in this three part tutorial is to provide multiple users access to a SVN server running a recent version of Ubuntu Linux through the SSH protocol. In SVN language, this combination of protocols is called svn+ssh. The straight forward way would be to create a unix user account for every SVN user and let them tunnel to the SVN server. However, giving all these users shell access to the server is a potential security issue and goes far beyond the initial purpose of just giving access to the SVN server. As a solution, we will create a single unix user account, that is not allowed to have any shell access, and let the SVN users connect through this user account to the SVN server.

This second part of the tutorial focusses on the configuration of a Unix / Linux client. It is fairly distribution independant and will work on all of Ubuntu, Fedora, Suse, Debian, Mint and beyond. The first part of the tutorial managed the server-side configuration whereas the last and thrid part illustrates the client-side configuration on Windows platforms.

Client-side configuration on Unix / Linux systems

As stated in the server-side configuration, the private key file id_rsa needs to be distributed to the user on the client side. He or she will use the private key to connect to the SVN server. As the private key is enough to establish the connection, it needs to be stored in a safe place on the computer (and may be additionally secured by a password, see ssh-keygen above).

In general, the server’s URL in the svn command configures the protocol to be used. So

svn list svn+ssh://sshsvn@SERVER_ADDRESS/@

will establish a connection to the SVN server at SERVER_ADDRESS via the combination of SSH and SVN protocols for SSH user sshsvn (remember that we connect to the server as user sshsvn and distinguish different SVN users by the used private key). Please note the trailing @ that is necessary to access the SVN server’s root level. If you get

svn: Syntax error parsing revision 'SERVER_ADDRESS'

errors, you forget the trailing @.

But how to tell the svn command to use the provided private key? There are two solutions for this. First, we may add the private key to the SSH authentication agent,

ssh-add /path/to/id_rsa

Please note that this adds the private key only temporarily. For permanant solutions, see here for example.

The second and preferred way for me is to set the SSH command to be used by SVN with the SVN_SSH environment variable,

SVN_SSH="ssh -i /path/to/id_rsa" svn list svn+ssh://sshsvn@SERVER_ADDRESS/@

Summary

We have seen how to connect from a Unix / Linux system to a SSH/SVN server with a private key for the SSH connection. The server will decide upon the matching public key which SVN user account is used for the SVN connection.

Further Reading

Apart from the man pages of the referenced commands, the main sources for this tutorial have been

This is part two in a series of three tutorials:

Ubuntu 12.04 LTS Precise Pangolin – gnome-shell does not start

After activating the Screen Keyboard in the Typing tab of the Universal Access dialog in System Settings, my Gnome Shell display freezed. After restarting the X server and logging into my account, the Gnome Shell refused to load. I ended up staring at the default background image and after a while, apport proposed to submit a bug report about a crash in gnome-shell (due to XML input).

In .xsession-errors, I found another hint, that gnome-shell crashed (mind the last line!)

gnome-session[2146]: WARNING: Application 'gnome-shell.desktop' killed by signal
gnome-session[2146]: WARNING: Application 'gnome-shell.desktop' killed by signal
gnome-session[2146]: WARNING: App 'gnome-shell.desktop' respawning too quickly
gnome-session[2146]: CRITICAL: We failed, but the fail whale is dead. Sorry....

and dmesg hinted at a problem in XML input just as apport suggested,

gnome-shell: segfault at 0 ip 00007f5aefcda85e sp 00007fff17afac60 error 4 in libxml2.so.2.7.8[7f5aefc8d000+151000]
gnome-shell: segfault at 1f730a0 ip 0000000001f730a0 sp 00007fffce54ffc8 error 15

Suspecting that the activated screen keyboard is the problem, start a Gnome Classic (No Effects) session. For this, click on the small wheel icon in the top right corner of your login box. In Gnome Classic, revert your screen keyboard settings in the system settings dialog and deactivate the screen keyboard.

This will let you login to the Gnome Shell again.

drwright – A typing break application for Gnome and Unity on Ubuntu 12.04

Having worked on computers for years, I learned to appreciate typing break applications that remind me regularly of focussing my eyes on something else than the screen in front of me. Moreover, giving the hands a break from typing is a recommended prevention from Repetitive strain injuries (RSI). As break remainders popping up dialogs turned out to be ineffective for me, I soon started to use applications blocking the entire screen for a certain amount of time. This post shortly describes how to install such a typing break application for Gnome 3 and Unity on Ubuntu 12.04.

On Gnome 2, a native typing break plugin included in gnome’s core did a wonderful job. This plugin did not make it into gnome 3, and I have used good old xwrits as a replacement for nearly a year now. With Ubuntu 12.04, I was having another look around: I have used workrave  before on Windows, and as it still does not support locking the entire screen, workrave is not an option. The more I was excited to learn about drwright. This is the original Gnome 2 typing break plugin that is now continued as actively developed and separate component for Gnome 3 and Unity.

Drwright is not included in the main Ubuntu distribution but is availble through a PPA.
I shortly repeat the installation steps here to install and configure drwright.

Add the PPA’s package source to your sources list:

sudo add-apt-repository ppa:drwright/stable

(This step requires root privileges, so enter your superuser password when asked to do so)

Update your system’s list of available packages:

sudo aptitude update

Install drwright

sudo aptitude install drwright

Log out and log back into gnome to finally find a new icon in the Personal section of your gnome system settings (Applications -> System Settings) called Typing Break.

And in case you ever need back screen access during a typing break, change to the console (ctrl alt F1), login and kill the drwright process,

sudo killall /usr/lib/drwright/drwright/gnome-typing-monitor.