2019-10-26

Boot a linux live ISO image from grub

Trying out a particular flavor using its live-CD distribution is a good idea before going ahead with a full installation in our machine.

We used to have to burn a live system ISO image onto a CD or DVD, and then it became far more convenient to burn it onto a USB thumb drive.

However, another option to boot the live image is possible:  if we have a Linux system already, and the ISO file is in our filesystem, it is possible to boot into the ISO directly from the grub boot menu, avoiding the process of burning the file into any type of media.

Every once in a while I want to do this and I always forget from one time to the next, so I am documenting it here.

The key is to create a grub.cfg menu entry with the right info.   Searching through the net I found there are different parameters required, depending on the type of Linux distribution.   I have not been able to find proper documentation on the boot parameters that may be passed to the kernel (I could find several examples, but no "formal" documentation).

My guess is that different distributions may use different parameters, but here are a couple of examples:

menuentry 'Kali Linux 2019.3 Live' {
       set isofile="/iso/kali-linux-2019.3-amd64.iso"
       insmod ext2
       insmod loopback
       insmod iso9660
       loopback loop (hd3,gpt2)$isofile
       linux (loop)/live/vmlinuz boot=live fromiso=/dev/sda2/$isofile
       initrd (loop)/live/initrd.img
       }

menuentry 'Ubuntu 19.10 Live' {
       set gfxpayload=keep
       set isofile="/iso/ubuntu-19.10-desktop-amd64.iso"
       insmod ext2
       insmod loopback
       insmod iso9660
       loopback loop (hd3,gpt2)$isofile
       linux (loop)/casper/vmlinuz iso-scan/filename=$isofile noprompt noeject
       initrd (loop)/casper/initrd
       }

I found these two distros require a different way to specify the location of the live image after the kernel has booted.    Kali requires the "fromiso" parameter while Ubuntu (and its derivatives) require "iso-scan/filename".  See above for examples.

In the above example, the location of the ISO file is in the third harddrive, and second GPT partition. 

During my trial and error to get this right I found that the specification of harddisk and partition required in these menu entries may be different than what you'd expect.  

For instante, you may have saved the ISO file into:
             /home/username/iso/image.iso

In this example, the /home partition is in /dev/sda.    This would usually be hd0 to grub, but during boot time I found that in some hardware configurations, grub would identify the disk normally found in /dev/sda as hd3, not hd0

A little playing around may be necessary to find the correct pair (hdX,partitionY) specification.   Boot into grub, and while the menu is showing, press "c" for a command interface.   From there use the "ls" command to get a list of harddisks and partitions available.   The list shown ought to help identify which disk is the one with the /home partition.  
If the disk is partitioned with an MSDOS table, your partition would be referred to as (hd3,msdos1),  while in a GPT table, it would be (hd3,gpt2),  for the second partition in the 3rd disk.



2018-12-17

Ubuntu: force reinstallation of package in ubuntu

This post describes how to reinstall a package in Ubuntu (or Linut Mint, or other Ubuntu derivatives, and possibly on Debian, but I did not test it).

I needed to remove a package that was installed in the system which came from a non-standard repository.   However there were many others that depended on it, so I could not simply remove it.

It wasn't practical to remove them all, but I needed to replace the package with a version from the official Ubuntu repository.

This is the way I found to do it.    I found the answer in this post:

First, check available versions to be able to force a particular one:

apt-cache madison libbrotli1

This provides a list of available packages similar to this:

libbrotli1 | 1.0.3-1ubuntu1.2 | http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
libbrotli1 | 1.0.3-1ubuntu1.2 | http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
libbrotli1 | 1.0.3-1ubuntu1 | http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages


Then, to reinstall indicating a particular version, issue the following command:

apt-get install --reinstall libbrotli1=1.0.3-1ubuntu1.2

This will reinstall libbrotli1 without having to remove and reinstall all packages that depend on it.

2013-05-26

gthumb not playing videos (lubuntu)

In multiple versions of lubuntu (since a couple of years ago, up to and including lubuntu 13.04) I have noticed that gthumb does not play videos.  

The problem is fixed by installing package gstreamer0.10-x

A little more detail:   The videos that are not working are from a Canon camera.   I am not sure if other videos work or not in gthumb.

gthumb uses gstreamer to play videos.   The abovementioned package is described as "GStreamer plugins for X11 and Pango".    So the lack of video in gthumb in my system is either:

  1. due to my hardware (and thus the additional plugin solves my problem)
  2. hardware independent (and then all lubuntu installations should have this problem).

2013-04-10

Poor bass-less sound on HP EliteBook 2560p

Every once in a while the audio in my EliteBook 2560p (Windows 7) does not work properly:    Music on the headphones sounds as if it was being played through a high-pass filter, and at a low volume.    

I thought it was an issue with the fact that the audio jack is prepared for a headset (with microphone) and not really for regular headphones.  

But it turns out that the audio problem goes away some times, and music sounds just fine.

I rarely reboot this machine:  I either suspend it, or hibernate it.    It seems something goes wrong with the audio sometimes when sleeping/hibernating, but I never knew what it is.

Today I finally found a solution:   There is a Windows 7 service called "STacSV" ("Audio Service", described as "Manages audio jack configurations").    The service was stopped;   all I had to do is hit "Start", and the music on the headphones instantly began to sound correctly in full frequency range, with proper bass and volume.


2012-07-23

HP EliteBook 2560p missing Page Up/Down keys

My work machine is an HP EliteBook 2560p.    When it was given to me, I was shocked to see that a professional machine had no page-up / page-down keys.      Instead one has to press FN+arrow up / FN+arrow down to get the page-up/down functionality.     So.... what about when I have to press CTRL+PGUP (for instance, to switch worksheets in Excel)?    I would have to press CTRL+FN+UP....    three keys!!!

That was too much for me.     This madness had to stop.    

The simplest solution was to remap other keys to pure PGUP/PGDOWN functionality to get around the poor design in this HP laptop.  

So I used "KeyTweak" (http://webpages.charter.net/krumsick/) to remap the right Windows-meny key and the right CTRL key into PGUP and PGDOWN respectively.     It works.

2012-06-16

Windows 7 and old 3com OfficeConnect wifi AP

Windows 7 came finally into my life when I got a new work PC.   No chance of getting XP... sadly.
One of the first problems I ran into appeared when trying to connect this Windows 7 machine to a (somewhat old) 3com OfficeConnect WiFi access point.    This is an AP that has properly established WiFi connections with all sorts of old and new equipment (iPhones, Android smart phones, very old Nokia N95 phones, XP PCs, Macs, .... anything).    But now this Windows 7 machine would have lots of trouble connecting to the AP.     Sometimes it would establish the connection after 5 minutes trying, but mostly it just didn't connect.    The Windows 7 system does connect to other APs, though.

The Windows 7 network troubleshooter was of no help at all. 

In trying to solve my problem, I installed Intel's ProSet Wireless utility (the machine has an Intel Centrino Advanced-N 6205 networking chip) with the hopes that it would manage the connection to the AP better than Windows 7 did.    No luck.... but at least this nice tool does provide quite some technical details about the connection it is trying to establish.      So I saw that Windows 7 was trying to assign an IPv6 address to the network connection with the AP.   This AP does not have IPv6 support, so I don't understand why Windows 7 is so keen in using IPv6 with it.

Nevertheless, I thought this might be the issue.... so I disabled the IPv6 stack in the Windows 7 wireless network adapter configuration (see screenshot below),  and that did it:     Now Windows 7 connects to this AP normally in a few seconds, and a proper IPv4 connection gets established.



2011-12-18

Google chrome install problem on Windows XP

I ran into a problem installing Google Chrome on Windows XP (Professional).
When running the installer (the small file that you can obtain from the Google Chrome webpage), the install process would end very very quickly. In theory it should download the full Google Chrome software from the internet, and then the install process would begin.
For some reason, the process was too quick on my machine. In fact, after installing, it appeared as if it had not been installed really. There was no Start menu entry for Chrome, nor could it be executed.
I suspected it had to do with an old installation of Google Chrome (from months ago) that for some reason did not work either.
The solution was to remove all old Chrome Files (basically removing the folder C:\Documents and Settings\\Local Settings\Application Data\Google\Chrome), and do a new install from the Google Chrome webpage.

Great file search tool for Windows (NTFS)

A couple of weeks ago I came across this great tool for Windows (I am using XP), for searching for files by their filename. It works only with NTFS volumes (because it makes use of NTFS features), but it is simply amazing. You can type any part of a filename, and it is located instantly. There is no waiting to do.

Highly recommended: Everything search engine, by David Carpenter (http://www.voidtools.com)

2010-12-18

Mount removable drives from command line

This is too simple, but it took me a while to find this type of solution, so I want to post it here to keep track of it, next time I need it:

I have an Ubuntu (10.x) with a couple of users. Some need to use the GUI (Gnome or XFCE) to work, including accessing removable media. Other users need (or rather, wish) to use the CLI to access removable media. This means /etc/fstab may not have specific entries for removable media (say, /dev/sdg1) with the "user" option, because this would block Nautilus (Gnome) or Thunar (XFCE) from automatically mounting the removable media for the GUI users.

So I just found that there exists a mount wrapper called pmount. (to install in an Ubuntu system, simply sudo apt-get install pmount). The CLI user now has a few aliases in his .csh file to easily mount and umount several types of removable media:

alias flash 'pmount /dev/sdf1 photo_sd' (for SD cards)
alias cflash 'pmount /dev/sdc1 photo_cf' (for Compact Flash cards)
alias pen 'pmount /dev/sdg pen' (for flashdrives)
alias pen1 'pmount /dev/sdg1 pen1' (for the 1st partition in a flashdrive)

All of the above create mount points ( /media/photo_sd, /media/photo_cf, etc...).
To unmount each of them, I've set up aliases too:

alias flash-u 'pumount photo_sd'
alias cflash-u 'pumount photo_cf'
alias pen-u 'pumount pen'
alias pen1-u 'pumount pen1'

2010-03-31

Bluetooth crashes randomly in Ubuntu 9.10

I installed Linux Ubuntu 9.10 (Karmic Koala) in my Dell Mini 9 (Inspiron 910). Everything works fine, except for the bluetooth support. Occasionally, the bluetooth service apparently dies, and I don't know exactly why. When this happens, I cannot restart the bluetooth service simply with "service bluetooth restart"; even after doing that, the report resulting from "service bluetooth status" is "Bluetooth is *not* running". There are no logs that could give a clue as to what's going on. Since the bluetooth service is down, the bluetooth application (blueman) does not work either.

The bluetooth device in this Dell mini is a USB device identified as:
Bus 005 Device 004: ID 413c:02b0 Dell Computer Corp.
You can check your machine with this command: "lsusb -v |grep Bluetooth"

I figured that the hardware bluetooth device must be switched off (again, for some odd reason), and sure enough, that seemed to be the problem. So the solution I found is:

  1. Turn the hardware bluetooth device on
  2. Restart the bluetooth service
  3. Run my bluetooth application (blueman)
Step by step, this means:

1) Turn the hardware bluetooth device back on. The best way I found to do this is by using the "aircraft manager" application. You can install this with this set of commands:
sudo add-apt-repository ppa:opensource-subakutty/ppa
sudo apt-get update
sudo apt-get install aircraft-manager
Now you will have a nice command-line tool, /usr/bin/aircraft-manager-util
To use it:
/usr/bin/aircraft-manager-util BT on (to turn bluetooth on)
/usr/bin/aircraft-manager-util BT status (to check the status of the bluetooth hardware)

2) Once the device is turned on, restart the bluetooth service in Linux:
sudo service bluetooth restart

You can check that the service is indeed running:
sudo service bluetooth status

3) Restart your blueman applet:
killall blueman-applet
blueman-applet &

At this point, the bluetooth application should be fully operational again.

References:
http://www.ubuntumini.com/2009/12/aircraft-manager-turn-wifi-bluetooth.html
http://blueman-project.org/

2009-12-09

Sound settings in Ubuntu

After a fresh install of Ubuntu (9.04 and 9.10 at least), the sound in my system would be muted as soon as the user logs in. I don't know whether this has to do specifically with the type of sound card (HDA Intel - SigmaTel STAC9227), or something else in my system. I couldn't figure out how to save the volume settings across machine reboots so that sound would be unmuted when the user logs in.

In the end I set up a script to set volume values with Alsa's amixer, and I have this script executed in the ~/.config/openbox/autostart.sh file. I assume the script can be included in ~/.xinitrc as well.

Sample script:

amixer set 'Master',0 100% unmute
amixer set 'PCM',0 100% unmute
amixer set 'Front',0 100% unmute
amixer set 'Surround',0 100% unmute
amixer set 'Center',0 100% unmute
amixer set 'LFE',0 100% unmute
amixer set 'Side',0 100% unmute

2009-06-12

Custom desktop menu on xfce 4.6

Here's a few things I had to do to get a custom right-click desktop menu on XFCE 4.6:

1) Disable desktop icons: You have to use XFCE in "classical" Unix desktop... i.e., no icons on the desktop itself. You can still drag and drop between Thunar windows, but not between Thunar and desktop. To do this, run (from a terminal):

xfconf-query -c xfce4-desktop -p /desktop-icons/style -s 0

2) Next, make sure the desktop menu is enabled:
xfconf-query -c xfce4-desktop -p /desktop-menu/show-icons -s true
xfconf-query -c xfce4-desktop -p /desktop-menu/show -s true

3) Finally, edit your desktop menu as you like. The per-user desktop menu is typically in this file:
~/.config/menus/xfce-applications.menu

As an example, here is my menu file. The "Include" section contains the menu items that will be used in the "Layout" section. Menu items are described by ".desktop" files found in /usr/share/applications/. You can also define your own ".desktop" files, and place them under ~/.local/share/applications/

In the example xfce-applications.menu file shown below, I created a "virtualbox.desktop" file under my local applications directory, because I didn't find one under the system directory /usr/share/applications.

Content of ~/.config/menus/xfce-applications.menu :


<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">


<Menu>
<Name>My_desktop_menu</Name>

<DefaultAppDirs/>
<DefaultDirectoryDirs/>

<Include>
<Filename>xfce4-logout.desktop</Filename>
<Filename>gnome-terminal.desktop</Filename>
<Filename>xterm.desktop</Filename>
<Filename>gnucash.desktop</Filename>
<Filename>keepassx.desktop</Filename>
<Filename>rhythmbox.desktop</Filename>
<Filename>pidgin.desktop</Filename>
<Filename>virtualbox.desktop</Filename>
</Include>

<Layout>
<Filename>xterm.desktop</Filename>
<Separator/>
<Filename>gnucash.desktop</Filename>
<Separator/>
<Filename>pidgin.desktop</Filename>
<Filename>keepassx.desktop</Filename>
<Filename>rhythmbox.desktop</Filename>
<Filename>virtualbox.desktop</Filename>
<Menuname>Applications</Menuname>
<Menuname>Settings</Menuname>
<Filename>xfce4-logout.desktop</Filename>
</Layout>



<Menu>
<Name>Settings</Name>
<Directory>xfce-settings.directory</Directory>
<Include>
<Category>Settings</Category>
</Include>
<Exclude>
<Category>System</Category>
</Exclude>

<Layout>
<Filename>xfce-settings-manager.desktop</Filename>
<Separator/>
<Merge type="all"/>
</Layout>

<Menu>
<Name>Screensavers</Name>
<Directory>xfce-screensavers.directory</Directory>
<Include>
<Category>Screensaver</Category>
</Include>
</Menu>
</Menu>


<Menu>
<Name>Applications</Name>

<Menu>
<Name>Accessories</Name>
<Directory>xfce-accessories.directory</Directory>
<Include>
<Or>
<Category>Accessibility</Category>
<Category>Core</Category>
<Category>Legacy</Category>
<Category>Utility</Category>
</Or>
</Include>
</Menu>

<Menu>
<Name>Development</Name>
<Directory>xfce-development.directory</Directory>
<Include>
<Category>Development</Category>
</Include>
</Menu>

<Menu>
<Name>Education</Name>
<Directory>xfce-education.directory</Directory>
<Include>
<Category>Education</Category>
</Include>
</Menu>

<Menu>
<Name>Games</Name>
<Directory>xfce-games.directory</Directory>
<Include>
<Category>Game</Category>
</Include>
</Menu>

<Menu>
<Name>Graphics</Name>
<Directory>xfce-graphics.directory</Directory>
<Include>
<Category>Graphics</Category>
</Include>
</Menu>

<Menu>
<Name>Multimedia</Name>
<Directory>xfce-multimedia.directory</Directory>
<Include>
<Category>Audio</Category>
<Category>Video</Category>
<Category>AudioVideo</Category>
</Include>
</Menu>

<Menu>
<Name>Network</Name>
<Directory>xfce-network.directory</Directory>
<Include>
<Category>Network</Category>
</Include>
</Menu>

<Menu>
<Name>Office</Name>
<Directory>xfce-office.directory</Directory>
<Include>
<Category>Office</Category>
</Include>
</Menu>

<Menu>
<Name>System</Name>
<Directory>xfce-system.directory</Directory>
<Include>
<Category>System</Category>
</Include>
<Exclude>
<Filename>gnome-app-install-xfce.desktop</Filename>
</Exclude>
</Menu>

<Menu>
<Name>Other</Name>
<Directory>xfce-other.directory</Directory>
<OnlyUnallocated/>
<Include>
<All/>
</Include>
<Exclude>
<Category>X-Xfce-Toplevel</Category>
</Exclude>
</Menu>
</Menu>

</Menu>

2009-05-23

Verify DNIe Linux software's signature

The spanish electronic national identity card, known as DNIe (Documento Nacional de Identidad Electrónico) contains user certificates for authentication and for signature.

It can be used on Linux, Windows, and MacOSX systems, and the Spanish Ministry of Interior distributes software for each platform to enable the use of the DNIe. The official webpage is http://www.dnielectronico.es/. Software packages and related documents are distributed along with a signature file to verify their authenticity and integrity, before you use them on your computer.

The DNIe website states that OpenSSL is used to verify the signature, but they don't provide step-by-step instructions to make it easy for users to verify signatures (in fact they claim that the signature "will be useful for users with advanced computer knowledge who wish to verify the integrity of the software packages", which I think is not very nice on the part of the Ministry, as they should promote signature verification by making it easy for people who don't know how to do it, not only experts). Even after searching on the Internet, I found no quick guide to help the novice user verify those signatures.

It turns out they do use OpenSSL to sign their files, but they omit some details, which I wish to document in this post: They distribute a certificate file, of which one needs to extract the key first, and they used SHA1 for the digest for the signature.

They provide a certificate to verify signatures, found here: http://www.dnielectronico.es/seccion_integradores/cert_fir_cod_des.html

When using OpenSSL to verify a signature, one must provide the public key, but OpenSSL doesn't take the certificate file directly. Therefore, the following steps are needed to extract the public key from the DNIe software signature certificate:

> unzip CertCodeSigning.zip (will output "CertCodeSigning.pem")
> openssl x509 -inform pem -in CertCodeSigning.pem -pubkey -noout > DNIeCodeSigningKey.pem

Now we have the public key in file "DNIeCodeSigningKey.pem".

Finally, we can run the OpenSSL command to verify a signature.
For instance, let's say you have downloaded the following two files: DNIe_v4_0_0.zip and DNIe_v4_0_0.zip.sign (DNIe CSP drivers for Windows).
In order to verify the signature, run the following command:
> openssl dgst -sha1 -verify DNIeCodeSigningKey.pem -signature DNIe_v4_0_0.zip.sign DNIe_v4_0_0.zip

The equivalent command to verify the signature of DNIe software packages for linux would be:
> openssl dgst -sha1 -verify DNIeSoftSigningKey.pem -signature opensc-dnie_1.4.5-1_i386_Ubuntu_Intrepid_Ibex.deb.tar.sign opensc-dnie_1.4.5-1_i386_Ubuntu_Intrepid_Ibex.deb.tar

The result of both commands should be a message "Verified OK". If you get something different, double check the steps above, or make sure you are downloading the right DNIe software.

2009-04-01

Excel 2007 crash on exit

Excel 2007 was crashing on my Windows XP SP3 system almost every time I closed the application.

The solution to this problem turned out to be quite easy... just remove the "send to Bluetooth" add-in that was added to Excel 2007 by the Bluetooth application on my system.

Credits for this solution go to Rasum, found on this page: Excel 2007 crash on exit - solution

2009-03-28

Make Office 2007 look like Office 2003 or XP (Tahoma on Office 2007)

I began using MS-Office 2007 just yesterday, after my work machine was upgraded from Office 2003. (still running Windows XP, thankfully). I couldn't stand the look of Office 2007 for two seconds. I think antialiased fonts are very hard to read on LCD screens, so I always run to disable antialiasing on any machine I need to work with for more than 1 hour straight.

Unfortunatelly, MS-Office 2007 only has a setting to disable the use of "ClearType", but nothing more. After disabling it you do get a cleaner interface, without antialiased fonts, but you are left with an ugly font. After some snorkeling around the 'net, I learned that the font used in MS-Office 2007 is called "Segoe UI", but there is no switch to select a different font, as you can do with the rest of the Windows XP user interface.

The goal: To have Office 2007 use non-antialiased Tahoma 8pt in its user interface, like the rest of the standard Windows XP interface (with "ClearType" disabled).

The solution: This solution could be labeled as "brute force", but I couldn't find another one (if someone knows a better way, please leave a comment on this post). It basically consists of replacing Segoe UI font files with another copy of the Tahoma file, and this requires some tweaking on the font files:

1) Disable "ClearType" in Office 2007 applications. Open Word 2007, and click on the "Office button" and then on "Word options". Under the "Popular" section, disable "Always use ClearType", and hit OK.
2) Close Word 2007.
3) Make a new folder on your Desktop, called "segoe_fonts", and two subfolders: "segoe_real" and "segoe_fake"
4) Make a back-up copy of these two Segoe UI font files: SEGOEUI.TTF and SEGOEUIB.TTF (copy them from C:\windows\Fonts to ...\Desktop\segoe_fonts\segoe_real
5) Copy tahoma.ttf and tahomab.ttf from C:\windows\Fonts to ...\Desktop\segoe_fonts\segoe_fake
6) Under "segoe_fake", rename tahoma.ttf and tahomab.ttf to SEGOEUI.TTF and SEGOEUIB.TTF respectively.
7) Use a font editing utility (for instance, FontCreator by High Logic). Open the font files using "Open"->"Font File", and select the files under "segoe_fake". The fileds should be changed on those fonts as follows (under "Format", "Naming" in the FontCreator tool):





8) Save the two font files after the changes.
9) Copy the two font files from "segoe_fake" to C:\windows\Fonts (first you will have to delete the original SEGOEUI.TTF and SEGOEUIB.TTF files in there)
10) Open MS-Word 2007 or other Office 2007 application to enjoy the same Tahoma 8pt font used by Windows XP in general, on the Office 2007 interface. It probably does not make a big difference on Word or Excel, but it does make a very big difference in Outlook, where the list of messages is shown using the interface font (Segoe UI vs. Tahoma).

Here are some screenshots of Office 2007 before and after this "brute-force" change:

The regular look of Office 2007 on Windows XP:



Office 2007 with the fake Segoe UI font file installed on Windows XP, with Tahoma on the interface:


Conclusion
Is there another way to do this? I would prefer not to fiddle with font files, but my attempts at changing the Office 2007 user interface font using the Windows XP registry were unsuccessful. There is a key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes that contains some mappings from one font to another. I tried entering "Segoe UI"="Tahoma" in there, but that did not work. If anyone reading this post knows how to do it differently than my brute force method, I'd love to hear about it.

2008-12-29

Setting the default profile in Firefox and Thundebird

Firefox and Thunderbird (fine browser and email client products from Mozilla) allow you to have different profiles, such that Firefox or Thunderbird may be started up with different settings, different email account settings, different bookmarks, etc...

You'll normally have one profile only, and unless you renamed it, it is called "default".
In order to create additional profiles, run the software from the command line:

firefox.exe -P
or
thunderbird.exe -P
A window pops up to create new profiles, or you can choose which profile to start the application with:
Once several profiles exist, simply running "firefox.exe" or "thunderbird.exe" will make use of the default profile (whichever that is; this is the problem). It is possible to start with a specific profile, by running one of the following:
firefox.exe -P "UserA"
firefox.exe -P "UserB"
where UserA and UserB are the names of your profiles in Firefox (it's the same for Thunderbird).

I ran into a problem which I did not find documentation for, and this is why I write this. Which of those is the default profile? The profile selection dialog window shown above does not make it possible to set the default profile among the list of available ones.

While it is possible to use the profile selection window to choose a profile every time you run Firefox/Thunderbird, there are some problems if the default profile is not the one you expect. For example, in Windows XP/Vista, a context menu item named "Sent to mail recipient" will open a Thunderbird window to write an e-mail, but it will use the default Thunderbird profile. Clicking on "mailto:" links on webpages will also prompt Windows Vista/XP to execute Thunderbird, using its default profile. For these reasons, you may want to choose which is your default Thunderbird profile.

Setting the default profile
It turns out it is very easy:
  1. Make sure all Thunderbird windows are closed
  2. Locate the profiles.ini file for your user (in Vista this is normally "C:\Users\UserName\AppData\Roaming\Thunderbird", and in XP "C:\Documents and Settings\UserName\Application Data\Thunderbird", or similar. More info on this: http://kb.mozillazine.org/Profile_folder_-_Thunderbird
  3. Edit the file profiles.ini, and add the line "Default=1" only to the profile you want to make your default.
Here's an example profiles.ini file indicating the default profile:
[General]
StartWithLastProfile=1

[Profile0]
Name=default
IsRelative=1
Path=Profiles/6y2nagku.default

[Profile1]
Name=John
IsRelative=1
Path=Profiles/8dje3h37.John
Default=1

References:
http://kb.mozillazine.org/Profile_folder_-_Thunderbird
https://developer.mozilla.org/En/Command_Line_Options

2008-12-27

Move the "Users" folder (user profiles) to a different location in Vista

In Windows Vista you've got the possibility to specify, right from the Vista interface, the location of each folder in a user profile. For example, it's easy to indicate that you want to have "Downloads" in a different drive (for detailed instructions on how to do this you can follow the official MS advice).

However, if what you want to do is move the entire C:\Users folder structure and have the OS recognize that change without going nuts, there's an elegant solution that we found after googling for a while. While you can read about it in the original articles (here and here), it all boils down to this (but please, do have a look at the original articles since the explanations of what is going on are really helpful) (and please, please, please: if you want to be sure that you don't loose anything... backup first!):

  1. Create the new "Users" folder wherever you want it to be (e.g., E:\Users)
  2. Boot off the Vista install DVD and choose to Repair from the introductory window. Choose the target Vista installation and then bring up a command prompt (note: in some computers you don't need the Vista DVD, there's an option to boot the computer into some System Recovery options and from there you have access to a console).
  3. Once you are in a command prompt, copy all the data from your original C:\Users to the target E:\Users. To do this, you must use a command that copies all the data, links, folders, etc. I have used Robocopy and it works very well. The command that I used is:
    robocopy C:\Users E:\Users /E /COPYALL /XJ
  4. Now that you have all your data copied... delete the original C:\Users folder! Yes! Have no fear! But please, make sure first that your data is now safely copied in E:\Users. Please note that after deleting C:\Users you can still go back by copying the data to C:\Users from E:\Users... but that's not what you want to do, is it? In any case, use the following command to delete C:\Users:
    rmdir /S /Q C:\Users

  5. After deleting C:\Users, delete also C:\Documents and Settings (it's just a link to C:\Users):
    rmdir "C:\Documents and Settings"
  6. Now we have to create the link that will tell Vista that when it looks for C:\Users, it has to go to E:\Users. Use this command:
    mklink /J C:\Users E:\Users
  7. We recreate as well the link from Documents and Settings:
    mklink /J "C:\Documents and Settings" E:\Users
  8. Restart! Everything should be in place, we should be able to log on with our user accounts, etc.
I have followed this procedure already twice and have had no problems at all. Everything's working fine, Vista puts all the data in E:\Users and all is well. Note that if you go in Windows Explorer to C:\Users, you will see it there, and you can navigate its contents, but remember that the data is physically stored in the E:\ partition, not in C:\Users.

I recommend you reading the articles that I found originally, since there is some discussion in them that might be helpful to you.

You can use this same procedure to modify the location of C:\Program Files, for example. I have not tried to do this, but I guess it should be problem-free. Still, as with changing the Users folder, proceed at your own risk!

Have a nice day!
Marcelo

2008-09-07

Default tcsh behaviour in XUbuntu

I'm a newcomer to Ubuntu (Xubuntu, really). For the past few years my Linux distro of choice was Redhat and then Fedora. I became used to how things work on Fedora, like the behaviour or my favourite shell, tcsh.

The default filename completion behaviour of tcsh in Fedora (and in Ultrix and Digital Unix, as far as I can remember from my university days) is the following: the first press of [TAB] completes the filename up to the last common character in a set of files. The second press of [TAB] provides a list of possible choices, and reprints the command line to continue typing.

In Xubuntu, however, the default tcsh behaviour is that the first press of [TAB] provides already the list of possible choices. I wanted to change this, and I found the solution in the tcsh man page. At the tcsh prompt, type the following:

  • "unset autolist" to do without listing of filenames
  • "set autolist = ambiguous" to use the first [TAB] to complete filenames up to the common set of characters, and a second press of [TAB] to obtain a list of suggestions
  • "set autolist" to get the default behaviour in Xubuntu: The first [TAB] gives you the list of suggestions.

2008-08-17

Nice non-antialiased fonts in Linux

Ever since Linux distributions decided to go with antialiased fonts in qt and gtk based applications, I have been looking for a way to go back to the way it used to be (I am talking 1998...). Merely disabling the "antialiased" setting on moden distros produced ugly fonts, unlike the simple, nice Helvetica fonts that 1998-era Linux systems used to have.

However, today I found a site that offers exactly what I wanted: http://www.sharpfonts.com
It describes very easily how to use non-antialiased truetype fonts on a modern Linux distributions.

I ran the described process on a Xubuntu 8.04.1 system. After going through the process described in that site, simply select the Tahoma 8 font with "slight" hinting (for instance) for the desktop font. Works perfectly.

2008-08-02

Nokia 5310 and Linux

In trying to connect a Nokia 5310 to my Linux system (Fedora 9), I encountered some problems which turned out to be non-issues after all. Here's a short report in case it helps anyone:

I don't know if things simply work right "out of the box" when you use Gnome or KDE. I don't use those desktop environments. I work with IceWM for a simple windowing interface, and I like to work from the command line. The following instructions detail what I had to do to access the phone's memory card from the Linux command line.

When I plugged in the Nokia 5310 through its USB port to the computer, the Linux kernel reported the following messages in /var/log/messsages:

kernel: usb 4-2: new full speed USB device using uhci_hcd and address 17
kernel: usb 4-2: configuration #1 chosen from 1 choice
kernel: drivers/usb/class/cdc-acm.c: Ignoring extra header, type -3, length 4
kernel: cdc_acm 4-2:1.1: ttyACM0: USB ACM device
kernel: usb 4-2: bad CDC descriptors
kernel: usb 4-2: bad CDC descriptors
kernel: usb 4-2: New USB device found, idVendor=0421, idProduct=006b
kernel: usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
kernel: usb 4-2: Product: Nokia 5310 XpressMusic
kernel: usb 4-2: Manufacturer: Nokia
kernel: usb 4-2: USB disconnect, address 17
kernel: hub 1-0:1.0: unable to enumerate USB device on port 6
kernel: usb 4-2: new full speed USB device using uhci_hcd and address 18
kernel: usb 4-2: configuration #1 chosen from 1 choice
kernel: scsi8 : SCSI emulation for USB Mass Storage devices
kernel: usb 4-2: New USB device found, idVendor=0421, idProduct=006a
kernel: usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
kernel: usb 4-2: Product: Nokia 5310 XpressMusic
kernel: usb 4-2: Manufacturer: Nokia
kernel: usb 4-2: SerialNumber: xxxxxxxxxxxxxxx
kernel: scsi 8:0:0:0: Direct-Access Nokia Nokia 5310 Xpres 0000 PQ: 0 ANSI: 4
kernel: sd 8:0:0:0: [sdc] 3932161 512-byte hardware sectors (2013 MB)
kernel: sd 8:0:0:0: [sdc] Write Protect is off
kernel: sd 8:0:0:0: [sdc] Assuming drive cache: write through
kernel: sd 8:0:0:0: [sdc] 3932161 512-byte hardware sectors (2013 MB)
kernel: sd 8:0:0:0: [sdc] Write Protect is off
kernel: sd 8:0:0:0: [sdc] Assuming drive cache: write through
kernel: sdc:
kernel: sd 8:0:0:0: [sdc] Attached SCSI removable disk
kernel: sd 8:0:0:0: Attached scsi generic sg3 type 0
kernel: sd 8:0:0:0: [sdc] Sense Key : No Sense [current]
kernel: sd 8:0:0:0: [sdc] Add. Sense: No additional sense information
kernel: sd 8:0:0:0: [sdc] Sense Key : No Sense [current]
kernel: sd 8:0:0:0: [sdc] Add. Sense: No additional sense information
kernel: sd 8:0:0:0: [sdc] Sense Key : No Sense [current]
kernel: sd 8:0:0:0: [sdc] Add. Sense: No additional sense information
kernel: sd 8:0:0:0: [sdc] Sense Key : No Sense [current]
kernel: sd 8:0:0:0: [sdc] Add. Sense: No additional sense information

I was expecting to see an "sdc1" partition, but no partitions were reported either with "fdisk -l /dev/sdc". I thought there was a problem with my set-up, but there isn't any.
It turns out that the /dev/sdc itself contains the filesystem on the Nokia 5310 internal SD flash card.

Therefore, a simple "mount -t vfat /dev/sdc /mnt/disk" will make the Nokia 5310's memory card contents available on /mnt/disk.

To make things easier, I created an entry in autofs' auto.misc config file. My /etc/auto.master file relates the directory /misc with the /etc/auto.misc file. This is the content of my /etc/auto.misc file:

# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# Details may be found in the autofs(5) manpage
cd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
dvd -fstype=iso9660,ro,nosuid,nodev :/dev/dvd
pen -fstype=vfat,rw,user,umask=000 :/dev/sdc1
nokia -fstype=vfat,rw,user,umask=000 :/dev/sdc

Now all I need to do is plug the Nokia into the USB port, and then, from the command line and as a regular user (not root), you can simply:

1) cd /misc
2) cd nokia
3) ls -la

...and you get a list of the files and folders in the phone's memory card.

After copying files from the phone to the PC and viceversa, remember to issue the command "umount /misc/nokia" to make sure all files get actually transferred before you unplug the USB cable.