Thursday, June 24, 2010

Opening Terminal with preset size / fixed geometry

There are many different terminal programs for Linux, and they all have some similar features.

I am familiar with Gnome terminal and Konsole, but choose Xfce terminal because I feel it is a closer match to my needs.


Opening Terminal with a fixed geometry:

--geometry=160x50

( Geometry in this context means the number of rows and columns )

The geometry I have given looks good on a 24" screen but smaller screen sizes might want to experiment with any of the following:

  • --geometry=80x24
  • --geometry=80x30
  • --geometry=80x40
In full you might enter something like the following in a panel item/command launcher:
'/usr/bin/xfce4-terminal' --geometry=80x24

Or for something that is more generic*, perhaps...
xfce4-terminal --geometry=80x24

*Depending on your Linux system, xfce4-terminal might alternatively be in /usr/local/bin/ or /opt/local/bin/

*The single quoting (') in command launchers, is something I see in Xfce, but do not recall seeing elsewhere.






Opening Terminal with fixed location:

For xfce4-terminal, I was able to set a default position by editing MiscDefaultGeometry in the file ~/.config/Terminal/terminalrc as shown in this diff:


To tell xfce4-terminal to have a default geometry of 160x50 and a default position of 150 pixels from the left, and 0 pixels from the top use:


MiscDefaultGeometry=160x50+150+0


Xfce Program Launchers:

In Xfce adding a 'New Item' to a panel brings up a selection list with 'Launcher' as the first entry.

Selecting 'Launcher' will bring up a screen like the following:



Here is one that my system has (and it uses exo-open):



The Command field contains:

exo-open --launch TerminalEmulator

...and there is no mention of xfce4-terminal (explanation later)

Here is the Launcher that I created for the Midori web browser:


Use startup notification (quoted directly from Xfce manual):
... means that the window manager can show an hourglass while the program is loading
( You might want to tick 'Use startup notification' on older systems with significant startup times )


What is this exo-open --launch about?:

Xfce has a 'preferred applications' system. It allows you to select your preferred application in 3 categories WebBrowser, MailReader, TerminalEmulator


I repeat again directly from the manpage for clarity:
--launch category parameters...
           Launch the preferred application for the given category with the optional parameters..., where category is either WebBrowser, MailReader or TerminalEmulator.

This preferred applications system is a bit like Debian update-alternatives but specifically for desktop preferences. Here is the control screen if you want to have a tinker with it:



...and the 'Utilities' tab now:


If you have not bothered setting your preferences, or want to bypass the preferences and simply call a particular browser, then there is no need then to bother with exo-open


Mnemonics - convenient or not - you decide:

If you find that commands/menu are being selected by mistake in your Terminal, it could be, that you have Mnemonics in GTK enabled and might prefer to switch them off.

ShortcutsNoMnemonics=TRUE

To read more about GTK and Mnemonics try this link.

The file ~/.config/Terminal/terminalrc is where you would set ShortcutsNoMnemonics

(This is an xfce4-terminal specific configuration option, I am sure there are ways of achieving the same in Gnome Terminal or similar )


Making changes to ~/.config/Terminal/terminalrc and future upgrades:

When upgrading your system to a new Linux release, it may be that a newer version of xfce4-terminal chokes on your terminalrc file ( It has happened to me in upgrading Ubuntu desktops )

Symptom: clicking xfce4-terminal launcher briefly flashes up the terminal but then it disappears

Solution: remove ~/.config/Terminal/terminalrc and retry


Gnome Terminal and Konsole:

Both of these terminal programs work well, and it may be that these are your favourite programs.

The great thing about weblogs is that anyone can write an article expounding their favourite Terminal program.

Rather than tell me how much better Gnome Terminal or Konsole are in your eyes, please instead write an article yourself and if you link to this article in it's comments, then I will happily reciprocate :)


Further reading and links:

Xfce4 manual section on Launchers (version 4.0 of Xfce)


Final tip for people who are wanting to remove Preferred Applications they may have set:


Setting a MailReader in Preferred Applications generates a file at...

~/.local/share/xfce4/helpers/custom-MailReader.desktop

If you no longer want any Preferred Application set for MailReader then perhaps...
...remove the custom-MailReader.desktop file.

Friday, June 4, 2010

When Raid mirroring just won't work - dd to the rescue

Having worked with many businesses on backup procedures, I try to adopt best practice on my own computers.

With this in mind, I have backup copies of entire hard drives which I refresh once or twice a year. This means that in the event of a critical failure, I can quickly grab the backup hard drive and put my main desktop pc back to the state it was in around 6 months ago.
     ( I back up business critical data using additional procedures than those discussed here )

Motherboards tend to have a raid controller, and raid mirroring procedure accessible in BIOS or startup screen.



With a similar sized disk I just select source and mirror and let the motherboard look after creating a backup (one time raid mirror). This always worked until recently* when I had to revert to using dd.


In defense of the 26 hours backup time, this is running dd via a system rescue usb stick on a 5 year old socket 754 motherboard, with SataI rather than SataII maximum throughput. Even so the 15.7 MB/s is shockingly slow, but for a one time job, then maybe that is not such a problem.

*Having bought two matching Samsung F2 1.5TB drives, I was surprised to find the Via onboard raid controller complaining that the drive sizes did not match. I can only assume that a 2005 raid controller, might not, in all cases, be good for properly recognising the huge terrabyte plus disks that we can buy today.



Using dd for Mirroring entire Partitions or Disks:

As demonstrated above, dd will do a job for you if your raid setup refuses to do a source -> mirror copy. Using modern hardware you should expect this to take a few hours.
[ using ancient hardware you will be there all day (literally) ]

If you prefer you can use dd for partition by partition mirroring, perhaps in my screenshot I might have used if=/dev/sda1 of=/dev/sdb1, so as to just copy the first partition.

Note: Doing things partition by partition, can be a bit more tricky, as you need to give thought to the partition structure on your output disk and if necessary create suitable partitions there prior to running dd.

Those who might prefer output to a file might like to consider of=/mnt/hugedisk/partition1.dd as a suitable parameter.

Documention for dd can be found in any of these places*:
  • For Debian and Ubuntu in /usr/share/doc/coreutils/
  • by typing in a terminal the command man dd
  • Manpage on the internet (gnu.org)
*Please make an effort to read the dd documentation above before making any comments on this article asking about how to use dd.

    Thursday, June 3, 2010

    Debian Squeeze - codependencies and circular dependencies

    Running Debian Squeeze on my desktop (before it is released), I find I am taking a closer look at the packages installed and their dependencies.

    It started as an effort to keep a minimal install, but as my desktop use has progressed, at 992 packages, my install is now hardly minimal.

    Package Codependencies:

    Perl (perl and perl-modules) gives a good example of a codependency.

    Here is a comment from a debian bug discussion which explains things somewhat

    The co-dependency between perl and perl-modules is required as these
    are fundamentally one package, split only into arch any/all parts.
    Modules within perl use modules within perl-modules and vice-versa.



    Python does not use this codependencies approach, but does have a package structure that also requires a bit of understanding when you first see it.



    Python (python and python-minimal), seem to be instead, set and subset, with the latter intended on being enough to support the initial install process, whilst not taking too much space on install media.

    These decisions are understandable when you remember that install media has a fixed size.

    ( This bartering, is perhaps similar to when you move house and have to discuss what goes where in the fixed size Ford Transit Luton/U-Haul )


    Python diagram (with a particular leaning towards my install packages):



    It is possible to install python 2.6 to python 3.1 in Squeeze, they are just not the default. There is not much relying on python 3.1 just now, except maybe if you wanted to beta test the latest Blender.

    (Aside: you will find libpython2.6 and libpython3.1 in Squeeze but there is no python 2.5 equivalent)

    Note: All version numbers checked in June 2010 which is likely 6 months or more ahead of Squeeze actual release. Version numbers are subject to change and may not be entirely accurate at and beyond Squeeze final release


    Package circular dependencies:

    libwrap0 and tcpd, on a server, are examples as illustrated by the diagram below:



    When I look at installed packages on servers, I see tcpd and think...how did that get there.

    The answer, of course, is that I have openssh-server installed, and, hopefully the diagram illustrates the rest.

    I use the term 'circular dependencies' very loosely in this posting, as the term 'circular dependency', it could be argued, more properly applies where both packages strictly depend on each other.

    Package confusing dependencies:

    In Squeeze gamin is supposed to be a drop in replacement for fam.

    I use the Thunar file browser and this diagram shows some interesting dependencies:


    seahorse-plugins is something I also use on the desktop and I found it useful to include it in the diagram.

    For libgamin0 to be a drop in replacement for libfam0, there would have to be changes to both of the vfs packages shown, so that either of libgamin0 or libfam0 could be used.

    I think gamin and libgamin0 are also codependencies (as it appears today in aptitude), but the thing that is confusing to me is how I could possibly install gamin.

    My thoughts are that if I try to install gamin or libgamin0 then it will break dependencies higher up :(



    There must be slightly more to it than I thought, because although I received a dpkg complaint, when replacing libfam0 with libgamin0, my system seems to be working without it wanting to remove thunar or seahorse-plugins :)