jump to navigation

Migrate a virtualbox VM to a bigger virtual disk March 18, 2012

Posted by claudio in Uncategorized.
Tags: , , , ,
3 comments

When a virtual machine has limited use, you don’t want to loose too much space. Sometimes, however, you get the size wrong.

In my case, I have a minimal Windows VM on my Ubuntu laptop. Once in a while I test an upcoming Padre (The Perl IDE) release or update a crappy usb device with Windows-only support. Win-modems may be gone, but we still have GPS devices that run GNU/Linux but can only be connected to Windows. (I guess seeing your market-share shrink because of smart-phones is what they call bad karma, TomTom.)

Windows being Windows, adding disks is a terrible experience (what’s up with the alphabet as a mounting point?) and moving a Windows installation to a second disk is a nightmare. Luckily, free software gets the job done:

1. Make sure your guest machine is halted properly. This is specially important for a NTFS (virtual) partition of a Windows VM.

2. Download Ubuntu (It does not matter if you use the 32- or the 64-bit version, other GNU/Linux distribution will work as well). The screenshots are from a Ubuntu 11.10 setup.

3. In the specific VM-settings, add a new disk (to the same disk controller) and a new cdrom. Load the Ubuntu iso in the virtual cdrom drive.

 

4. Make sure the VM boots from the cdrom.

 

5. “Try” Ubuntu. Once Ubuntu is loaded, launch “gparted”.

 

6. Select the old disk (normally the first one, check the size).

 

7. Right on the disk representation and “copy” it.

 

8. Select the new disk from the combo-box on the upper right (check the size).

9. Go to “Device”, choose “Create Partition Table…”. Click “Apply” in the pop-up window.

 

10. Right on the disk representation and “paste” the original disk. Click “Apply” in the pop-up window.

11. Click on the green “Apply tick” on the icon menu to apply the changes. This will take some time. Get some coffee.

 

12. Right on the disk representation and select “Manage Flags”. Enable “boot”.

13. Shut down the Ubuntu Live cd.

 

14. Remove the original disk from the VM configuration (back it up first).

 

That’s it!

Logitech Wireless Trackball M570 on Ubuntu March 1, 2012

Posted by claudio in Uncategorized.
Tags: , , , , ,
3 comments

A colleague working in our IT-helpdesk found an old Logitech TrackMan Wheel in his drawer. “Old” as in out-of-production model launched around 2002. The thing was good as new: the trackball was still in his original package and the documentation and CD package were sealed. The person that ordered the thing years ago didn’t get used to it after one try. Lucky me :).

So I gave it a try and wow… I have gone ergonomic! While it took some minutes to kill the reflex to move the mouse around, I got used to the trackball mechanism very fast. When I got home I ordered the heir of this model, the Wireless Trackball M570.

At its arrival, my Virtualbox Windows VM was ready to be booted in order to pair the mouse and the wireless adapter. Sadly, Logitech only provides a MS Windows and Mac OS X binary. Once paired, the interwebs agree on this, the combination works on whatever OS you connect it too.

Big was my surprise, when everything worked out of the box in Ubuntu (11.10). Logitech seem to do the right thing nowadays and the devices are already pre-paired. Letting the pairing to the customer seems medieval when you thing about it. Logitech++.

So, everything works fine. The trackball is fantastic. The only complain is that the scroll-wheel makes a cheap plasticky sound when clicked, and as a UNIX user, it’s something you do often. This new model has 2 additional buttons compared to the original TrackMan. Out of the box, they are configured as Back and Next (e.g. while browsing in Firefox).

I don’t care much about these buttons and not at al for the Back and Next function. They are out of the way, so if you don’t use them, they won’t drive you crazy. Anyway, while they are there, why not give them a shot and assign them a useful task: easystoke to the recue! (“sudo apt-get install easystroke” from the shell, or search for “easystroke” on the Ubuntu Software Center)

I configured the additional buttons as Page Up and Page Down, something I really do use often (I find it easier on the hand than using the scroll wheel). I followed the instructions from the Archlinux wiki. Being a wiki, I copy the short instructions in case it get removed or moved:

easystroke is a mouse gesture application, but it can be used to manage mouse buttons as well. It’s main advantage o-ver btnx is that it’s more versatile. On the other hand, it’s user-based, so any user has to configure it to reflect his own needs.

In order to set up easystroke to manage your extra mouse buttons, you’ll need to do this (example features Back/Forward mouse buttons) : run:

easystroke -g

Go to Preferences tab > Additional buttons > Add, and add any special button.

Go to Action tab > Add action, give the new action a name, as Type choose “Key”, as Details set “Alt+Left” for Back button, “Alt+Right” for Forward button, as Stroke click the proper mouse button (confirm if a warning is displayed), and voilà! Your mouse button is configured.

I add some screen-shots for your comfort that illustrate my specific configuration. Nota Bene: to get Shift+Page Up/Down working (e.g. scrolling in a terminal), you need to add the combo to easystroke.

Ubuntu 11.04 beta 2 test drive: first thing first (updated 11.10) April 20, 2011

Posted by claudio in Uncategorized.
Tags: , , ,
add a comment

EDIT: This howto also works on Ubuntu 11.10

A new workstation at work is a great opportunity for trying out the latest Ubuntu 11.04 beta (2). So far, so good. I had low expectations for Unity, but the shell does not feel buggy nor slow. Nice. The installation is *extremely* fast. Anyway, sadly like with every new Ubuntu release, there is still some cleaning up to do after an install…

$ sudo apt-get remove --purge $(dpkg -l | perl -lwn -e '/.+((lib)*mono-.+?)\s+.+/ and print $1') ; sudo rm -rf /usr/lib/mono

[sudo] password for claudio:
Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘libmono-addins-gui0.2-cil’ for regex ‘mono-addins-gui0.2-cil’
Note, selecting ‘libmono-addins0.2-cil’ for regex ‘mono-addins0.2-cil’
Note, selecting ‘libmono-cairo2.0-cil’ for regex ‘mono-cairo2.0-cil’
Note, selecting ‘libmono-corlib2.0-cil’ for regex ‘mono-corlib2.0-cil’
Note, selecting ‘libmono-i18n-west2.0-cil’ for regex ‘mono-i18n-west2.0-cil’
Note, selecting ‘libmono-management2.0-cil’ for regex ‘mono-management2.0-cil’
Note, selecting ‘libmono-posix2.0-cil’ for regex ‘mono-posix2.0-cil’
Note, selecting ‘libmono-security2.0-cil’ for regex ‘mono-security2.0-cil’
Note, selecting ‘libmono-sharpzip2.84-cil’ for regex ‘mono-sharpzip2.84-cil’
Note, selecting ‘libmono-system2.0-cil’ for regex ‘mono-system2.0-cil’
Note, selecting ‘libmono-zeroconf1.0-cil’ for regex ‘mono-zeroconf1.0-cil’
The following packages will be REMOVED:
banshee* banshee-extension-soundmenu* banshee-extension-ubuntuonemusicstore* gbrainy* libappindicator0.1-cil* libart2.0-cil* libgconf2.0-cil* libgdata1.7-cil* libgkeyfile1.0-cil* libglade2.0-cil*
libglib2.0-cil* libgmime2.4-cil* libgnome-vfs2.0-cil* libgnome2.24-cil* libgtk-sharp-beans-cil* libgtk2.0-cil* libgudev1.0-cil* liblaunchpad-integration1.0-cil* libmono-addins-gui0.2-cil*
libmono-addins0.2-cil* libmono-cairo2.0-cil* libmono-corlib2.0-cil* libmono-i18n-west2.0-cil* libmono-management2.0-cil* libmono-posix2.0-cil* libmono-security2.0-cil* libmono-sharpzip2.84-cil*
libmono-system2.0-cil* libmono-zeroconf1.0-cil* libndesk-dbus-glib1.0-cil* libndesk-dbus1.0-cil* libnotify0.4-cil* libtaglib2.0-cil* libubuntuone1.0-cil* mono-2.0-gac* mono-csharp-shell* mono-gac*
mono-gmcs* mono-runtime* tomboy*
0 upgraded, 0 newly installed, 40 to remove and 0 not upgraded.
After this operation, 34.3 MB disk space will be freed.
Do you want to continue [Y/n]? Y
[...]

This will remove applications and libraries I rather don’t have on my system. The rm removes auto-generated cached mono assemblies (not associated to packages).

I don’t longer use a note taking application, but when I did I liked zim:

$ sudo apt-get install zim

If you want a tomboy clone, install gnote instead:

$ sudo apt-get install gnote

I am pretty happy with rhythmbox as my music player:

$ sudo apt-get install rhythmbox

Sometimes devices are funny (Logitech Squeezebox Touch) December 11, 2010

Posted by claudio in Uncategorized.
Tags: , , , , ,
2 comments

Some time ago I bought a Logitech Squeezebox Touch for the living room. Attach a usb2 disk to it and say goodbye to your cds: it plays ogg, mp3, flac, etc.

While being a device geared toward the general public, the Logitech engineers didn’t forget that some people may want to have a look under the nice touch-screen interface:

$ ssh 10.0.0.100 -l root
root@10.0.0.100's password:


This network device is for authorized use only. Unauthorized or improper use of this system may result in you hearing very bad music. If you do not consent to these terms, LOG OFF IMMEDIATELY.
Ha, only joking. Now you have logged in feel free to change your root password using the 'passwd' command. You can safely modify any of the files on this system. A factory reset (press and hold add on power on) will remove all your modifications and revert to the installed firmware.
Enjoy!

With a little of humour in /etc/motd they welcome your changes and avoid at the same time a call to their support line :).

In case you are curious:
# uname -a
Linux SqueezeboxTouch 2.6.26.8-rt16-332-g5849bfa #1 PREEMPT RT Mon Nov 8 12:48:28 MST 2010 armv6l GNU/Linux

# perl -v
This is perl, v5.10.0 built for arm-linux-gnueabi
Copyright 1987-2007, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl".  If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.

# ps awx |grep perl
28641 ?        SN     0:42 /usr/bin/perl /usr/squeezecenter/slimserver.pl --charset utf8 --noweb --notranscoding --nosb1slimp3sync --nostatistics --noinfolog --nodebuglog --logfile syslog
28643 ?        SN     0:01 /usr/bin/perl /usr/squeezecenter/gdresized.pl
29210 pts/0    S+     0:00 grep perl

Perl and GNU/Linux for my flac files. You won’t hear me complaining… :)

Build Padre svn easily with perlbrew and cpanm December 10, 2010

Posted by claudio in Uncategorized.
Tags: , , , , , ,
2 comments

Update: January 7, 2014

Because of the fast pace of the development of Padre, the/a Perl IDE, it’s may be nice to run a bleeding edge version. Or even better, as Padre itself is written in Perl, you may like to have a look at the sources and maybe contribute some code or help with the translations.

Follow this howto to build the latest Padre from source with perlbrew and cpanm. This way, you’ll get started in no time and you won’t even touch your system Perl installation (cleanup is just a “rm -rf” away…).

1. Install perlbrew and cpanm. You can follow my howtos here: perlbrew (important: compile perl with thread support!), cpanm.

2. Install subversion (to check out the code), the compilations utils (gcc, g++, make) and the gtk2 header files. On Debian/Ubuntu:
$ sudo apt-get install subversion build-essential libgtk2.0-dev libghc-readline-dev

An interesting -but not required- shortcut is to install the Padre release in your distribution to get binary dependencies: $ sudo apt-get install padre

3. Checkout Padre from svn (I chose to install the sources under ~/Code/Padre, adapt accordingly to your standards):
$ mkdir -p ~/Code/Padre && cd ~/Code/Padre
$ svn co http://svn.perlide.org/padre/trunk

4. Install the modules that Padre needs before building the IDE.
$ cpanm Parse::Yapp Module::Install Locale::Msgfmt Alien::wxWidgets
[... lots of output ...]

$ cpanm Wx --force
[... lots of output ...]

(Wx seems to have a circular test. Force the install in the meantime.)

5. Build Padre.
$ cd ~/Code/Padre/trunk/Padre

Install the dependencies (thx to Perigrin for the simplified method):
$ cpanm --installdeps .
[... lots of output ...]

$ perl Makefile.PL
[... some output ...]

As said, development is happening fast on Padre and new releases of (external) CPAN modules are required often (some even updated by the authors in order to provide the functionality Padre needs). If a new version of a module is needed that is not yet on your cpan mirror, run cpanm (–mirror) again with a more up-to-date mirror. Run “perl Makefile.PL” again afterwards.
$ make
[... lots of output ...]

$ make test
[... lots of output ...]

6. Install padre (in the active perlbrew dependant directory) or just run the development version without installing it (including all changes to the code even after installation):
$ make install
[... lots of output ...]

or
$ ./dev.pl -a

Here it is:

EDIT: ZenoG’s article is a good followup post giving an step-by-step description of bug fixing is Padre.

App::cpanminus: zero-conf CPAN client December 10, 2010

Posted by claudio in Uncategorized.
Tags: , , , , , ,
2 comments

App::cpanminus (cpanm) is an other great example of programs inscribed in the Modern Perl philosophy. From the CPAN page of the program:

cpanminus is a script to get, unpack, build and install modules from CPAN.

Why? It’s dependency free, requires zero configuration, and stands alone. When running, it requires only 10MB of RAM.

Zero configuration sounds excellent considering the rather steep learning of the (great!) CPAN tools (the cpan command line utility CPAN.pm and CPANPLUS) for new Perl users.

How does it work? Let try a big module with a lot of dependencies and C++ compiling activity. Install the application through cpan if configured (or with one of the standalone installations options):

$ cpan App::cpanminus
[...]

$ cpanm Moose
--> Working on Moose
Fetching http://search.cpan.org/CPAN/authors/id/D/DR/DROLSKY/Moose-1.21.tar.gz ... OK
Configuring Moose-1.21 ... OK
==> Found dependencies: Try::Tiny, Package::DeprecationManager, Test::Requires, Class::MOP, Sub::Exporter, Test::Fatal, Sub::Name, Data::OptList, Params::Util, List::MoreUtils, Task::Weaken
--> Working on Try::Tiny
[...]
Building and testing Moose-1.21 ... OK
Successfully installed Moose-1.21

$ perl -MMoose -e1

No errors. The modules (and their dependencies) installed just fine. Wow.

Get the latest Perl release with perlbrew December 10, 2010

Posted by claudio in Uncategorized.
Tags: , , ,
8 comments

Updated: January 7, 2014.

Sometimes you want to leave your system Perl installation in peace and don’t really want to mix the system supplied Perl Modules and newer versions from CPAN. Or you want to use CPAN without sudo and without using PERL5LIB or local::lib. Or you may to test your code on older Perl releases. Or you simply can’t wait to use that shiny latest Perl release.

Good news. Perlbrew is a very nice addition to the “Modern Perlwave resulting in a language and community revival of Perl 5 (that seems to have revitalized Perl 6 at the same time).

From the perlbrew CPAN page:

perlbrew is a program to automate the building and installation of perl in the user’s HOME. At the moment, it installs everything to ~/perl5/perlbrew, and requires you to tweak your PATH by including a bashrc/cshrc file it provides. You then can benefit from not having to run ‘sudo’ commands to install cpan modules because those are installed inside your HOME too. It’s a completely separate perl environment.

Here you’ll find how to use and customize perlbrew on a Debian/Ubuntu or Solaris installation. You don’t need g++ for perlbrew, but some modules from CPAN may need it later:

$ sudo apt-get install g++ curl

In case you use Solaris, install the Sunstudio compiler and make sure make and ar are in your PATH:
$ export PATH=/usr/bin:/usr/sbin:/opt/SUNW/spro/bin:/usr/ccs/bin

$ mkdir ~/lib

$ curl -LO http://xrl.us/perlbrew
[...]

$ chmod +x perlbrew

The directory ~/perl5/perlbrew will contain all install perl executables, libraries, documentations, lib, site_libs. In case you don’t like the default, you can change it with the PERLBREW_ROOT shell variable. Change , and accordingly to your installation.

$ export PERLBREW_ROOT=~/lib/perlbrew

$ ./perlbrew install

The perlbrew is installed as:
/home/user/lib/perlbrew/bin/perlbrew
You may trash the downloaded /home/user/tmp/perlbrew from now on.
Next, if this is the first time you install perlbrew, run:
/home/user/lib/perlbrew/bin/perlbrew init
And follow the instruction on screen.

$ rm perlbrew

$ ~/lib/perlbrew/bin/perlbrew init

Perlbrew environment initiated, required directories are created under
/home/user/lib/perlbrew
Well-done! Congratulations! Please add the following line to the endof your ~/.bashrc.
After that, exit this shell, start a new one, and install some freshperls:
perlbrew install perl-5.12.1
perlbrew install perl-5.10.1

For further instructions, simply run:
perlbrew
The default help messages will popup and tell you what to do!
Enjoy perlbrew at $HOME!!

$ echo "source /home/$USER/lib/perlbrew/etc/bashrc" >> ~/.bashrc

$ source ~/.bashrc

You can install new perl releases by typing by example “perlbrew install perl-5.12.3″. However, it may be a good idea to enable some features on the new compiled perl (mostly taken from the Ubuntu/Debian compile), specially the enabling of threading needed by a lot of perl programs (e.g. Padre):

$ perlbrew install perl-5.12.3 -Dusethreads -Duselargefiles  -Dcf_by="Your_name_here" -Dcf_email="Your_email@here"

If you run a 64-bit OS:  -Duse64bitall

Handy on Debian/Ubuntu: -Dpager=/usr/bin/sensible-pager

Output:

[...]

Installed perl-5.12.3 as perl-5.12.3 successfully. Run the following command to switch to it: perlbrew switch perl-5.12.3

If you have several perl releases installed , you can choose the main perl by typing:

$ perlbrew switch perl-5.12.3

$ which perl

/home/claudio/lib/perlbrew/perls/perl-5.12.3/bin/perl

$ which cpan

/home/claudio/lib/perlbrew/perls/perl-5.12.3/bin/cpan

$ perl -v

This is perl 5, version 12, subversion 3 (v5.12.3) built for x86_64-linux-gnu-thread-multi
Copyright 1987-2010, Larry Wall
Perl may be copied only under the terms of either the Artistic License or theGNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found onthis system using “man perl” or “perldoc perl”.  If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.

A shiny new Perl to play work with…

Ubuntu 10.04 installed (aka get rid of unwanted stuff)… April 29, 2010

Posted by claudio in Uncategorized.
Tags: , , ,
3 comments

sudo apt-get remove --purge libmono-corlib2.0-cil

Fix for slow virtual desktop switching with Nvidia 96.* and Ubuntu 9.04 August 14, 2009

Posted by claudio in Uncategorized.
Tags: , , , ,
2 comments

nvidiaI have a dual-cpu Sun W2100z workstation I really like. It’s getting rather old, but it’s pretty fast for things like programming and Internet use. Until the release of Ubuntu 9.04, the machne was running fine. After installing the new release it was pretty obvious that the X performance was terrible. Things like glxgears ran fine on this dual screen setup, but things like switching virtual desktops (I use the shortcut ctrl+alt+arrows a lot) took a few seconds when windows were maximized. Sadly, the free driver didn’t work with the 3300 x 1050 resolution I use.

After playing around with the millions switch and config options of the nvidia driver, I found a working setting:

nvidia-settings -a InitialPixmapPlacement=2

To enable this permanently, you can add it to System – Preferences – Startup Applications:

nvidiasettings

(put “nvidia-settings -a InitialPixmapPlacement=2″ (without “”) in the command field).

Add rar extraction to Gnome’s Archive Manager (file-roller) May 11, 2009

Posted by claudio in Uncategorized.
Tags: , , , ,
2 comments

You may see this when trying to decompress a rar file:
ArchiveTypeNotSupported

Too bad that file-roller does not tell you what to do (in contrast to Rhythmbox when new codecs need to be installed).

The solution is very simple, just install unrar like this:

sudo apt-get install unrar

That’s it. The Archive Manager can uncompress rared files now.

Follow

Get every new post delivered to your Inbox.

Join 145 other followers