Archive

Archive for the ‘Linux’ Category

Skype on Ubuntu Linux 10.04

May 16th, 2010 1 comment

There are some issues with version 2.1.0.81 of Skype on Ubuntu Linux (possibly other distributions as well).

The first issue is the default theme on Skype versus the one for Ubuntu. The default theme on Skype configured menu text with dark colors and the default Ubuntu theme configures menus with dark background. This makes the menu text mostly invisible.

Luckily by moving the mouse pointer over the menu the background highlight makes the text visible.

To change this permanently select “Options” from the Skype menu on the bottom left corner of the Skype window or press CTRL+O.

On the “General” section change the style from “Cleanlooks” to “Desktop Settings”. Close and restart Skype. Now you should see the menu text clearly.

The second issue is a problem with the video camera. This might or might not happen to you. It is a known problem with a workaround on the Skype release notes:

Skype does not work well with newer version of GSPCA Webcams driver (Linux Kernel >=2.6.27), possible workaround:

  • Ubuntu 32 bit: install “libv4l-0″ package and launch Skype with: LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype
  • Ubuntu 64 bit: install “lib32v4l-0″ package and launch Skype with: LD_PRELOAD=/usr/lib32/libv4l/v4l1compat.so skype
  • Other distributions might have the same library, but may have a different path.
  • In my case I already had the package ??libv4l-0 installed. If that’s not your case, or if you’re not sure, run on a terminal window:

    sudo aptitude install libv4l-0

    With the library installed you cannot simply start Skype from the start menu because the variable LD_PRELOAD needs to be customized for Skype.

    So you have to start it from a terminal window or change Ubuntu menu. To change Ubuntu menu do the following:

    • Open the System > Preferences menu and select “Main Menu”
    • On the left select the “Internet” menu and on the right select “Skype”.
    • Click “Properties”.
    • On “Command:” replace the default command with: bash -c “LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype”

    Now every time you start Skype your video should work.

    Categories: Linux

    Move grub from internal disk to external storage

    January 27th, 2010 2 comments

    When I installed Ubuntu Linux on my USB 8GB stick I didn’t noticed where grub was being installed. After a while I noticed that I could only boot my Windows installation (on the internal hard drive) via the USB 8GB stick.

    What happened was that Ubuntu install changed the master boot record (MBR) of my internal drive and set it up to load the remaining of Grub (it is split in 2 because otherwise it wouldn’t fit on the MBR) from the USB storage.

    To fix this I could use the Windows tools (fixmbr) but that requires me to boot using the recovery console and login as system administrator. Although using fixmbr would restore the Windows boot loader it would erase grub and make the USB storage  not bootable.

    What worked for me was MbrFix from sysint (www.sysint.no). REMARK: following the instructions below might make your computer unusable and eventually make you lose data.

    First I got the list of partitions on my internal disk:

    C:\>MbrFix.exe /drive 0 listpartitions
    # Boot Size (MB) Type
    1 Yes     76316    7  NTFS or HPFS
    2             0    0  None
    3             0    0  None
    4             0    0  None

    Next I saved my internal disk mbr to a file:

    C:\>MbrFix.exe /drive 0 savembr Backup_MBR_0.bin

    Next I listed my partitions on my USB disk drive:

    C:\>MbrFix.exe /drive 1 listpartitions
    # Boot Size (MB) Type
    1          6440  131  Linux native (usually ext2fs)
    2          1223  130  Prime
    3             0    0  None
    4             0    0  None

    Now I want to put grub on my USB disk:

    C:\>MbrFix.exe /drive 1 restorembr Backup_MBR_0.bin
    You are about to Restore MBR,
    are you sure (Y/N)? Y

    Now let’s see how the partition looks like:

    C:\>MbrFix.exe /drive 1 listpartitions
    # Boot Size (MB) Type
    1 Yes     76316    7  NTFS or HPFS
    2             0    0  None
    3             0    0  None
    4             0    0  None

    Ups! what happened there? My Linux partitions are gone… Let me try and fix this…

    C:\>MbrFix.exe /drive 1 /partition 1 setpartitiontype 131
    You are about to Set partition type,
    are you sure (Y/N)? Y
    Partition 1, type before: 7 NTFS or HPFS
    Partition 1, type after: 131 Linux native (usually ext2fs)
    
    C:\>MbrFix.exe /drive 1 /partition 2 setpartitiontype 130
    You are about to Set partition type,
    are you sure (Y/N)? Y
    Partition 2, type before: 0 None
    Partition 2, type after: 130 Prime
    
    C:\>MbrFix.exe /drive 1 listpartitions
    # Boot Size (MB) Type
    1 Yes     76316  131  Linux native (usually ext2fs)
    2             0  130  Prime
    3             0    0  None
    4             0    0  None

    Looks like by setting the partition types back to their original values solved the problem.. yes it did.. ufff…

    Now let’s restore the original Windows boot loader on the internal disk:

    C:\Documents and Settings\machados\My Documents\Downloads>MbrFix.exe /drive 0 fixmbr
    You are about to Fix MBR,
    are you sure (Y/N)? Y

    Now I could boot the system without the USB disk connected to my laptop.

    I could also boot my Linux system by connected the USB disk and selecting “boot from usb storage” from my bios boot menu.

    Categories: Linux, Windows

    Installing VirtualBox additional tools on Ubuntu 9.10 Karmic Koala

    November 24th, 2009 No comments

    This procedure was tested on VirtualBox 3.0.12 for Windows and Ubuntu 9.10 Server 32 bit as Guest.

    To be able to enjoy seamless integration between the host operating system and the VirtualBox guest you have to install VirtualBox Additional Tools on the guest operating system.

    To do so, follow the steps:

    Ensure you have a working Internet connection.

    Step 1:

    Install requirements for the Additional Tools:

    sudo apt-get install gcc linux-source-virtual linux-headers-virtual dkms

    Reboot after installation.

    Step 2:

    After logging in again find the Install Additional Tools option on the Devices menu.

    Then on your guest mount the cdrom:

    sudo mount /media/cdrom

    Step 3:

    Now install the tools:

    cd /media/cdrom

    ./VBoxLinuxAdditions-x86.run

    This will install the additional tools for virtual box.

    Reboot your system and you’re all set.

    Categories: Linux, Virtualization

    Linux: mirroring my usb installation for more space

    October 27th, 2009 No comments

    I recently installed Ubuntu 9.10 Beta on a 4GB USB drive and was running my laptop from it. Although the Ubuntu default installation from the Live CD took less than the same installation from Fedora 12 I quickly found that I needed more space for the system (/home included). So I needed to move the system to a larger USB drive. This article explains how I moved my system from a 4GB USB drive to a 8GB USB drive including partition resizing.

    My laptop has 2 limitations. One, it doesn’t have a CD-ROM drive. Second, it only has 3 USB ports. I got a Pioneer DVR-XD09 external hard drive. This drive takes 2 USB ports because of power requirements and that means that if I boot from the live CD I only have 2 remaining port for other external drive.

    So I did the following:

    Step 1:

    Boot from the 4GB USB installation. Install gparted using Ubuntu Software Center from Applications menu.

    Delete any partition  existing on the 8GB USB drive using gparted. Make sure you select the correct drive.

    Step 2:

    Boot Ubuntu Live CD 9.10.

    Step 3:

    Mount the internal hard drive. It has enough space for an image of the USB installation.

    Step 4:

    Plug in the USB where the system is installed (4GB) . Unmount it.

    Step 5:

    Make an image to the internal harddrive with the dd command:

    dd if=/dev/sdc/ of=/media/internal_drive/ubuntu-image

    Step 6:

    Unplug the 4GB USB drive. Plug in the 8GB USB drive. Unmount it.

    Step 7:

    Copy the Ubuntu image to the 8GB USB drive using dd:

    dd if=/media/internal_drive/ubuntu-image of=/dev/sdc

    Step 8:

    Boot the system from the 4GB USB drive.

    Plug the 8GB drive. Using gpartd remove the swap drive on the 8GB drive.

    Use uuidgen and tune2fs to change the uuid of the root partition on the 8GB drive:

    $ sudo -i

    # uuidgen
    0b2eaab8-fddb-41fc-85f9-12ff421ce984

    # tune2fs -U 0b2eaab8-fddb-41fc-85f9-12ff421ce984 /dev/sdc1

    Step 9:

    Open gparted (or click Refresh Devices from GParted menu if you didn’t close GParted on last step).

    Select the 8GB device. Select partition 1 (/dev/sdc1 in my ca.se). Press the mouse right button and select resize/move.

    Drag the right edge of the partition until your happy with the free space for the swap partition. I left 1.20 GiB for the swap partition.

    Right-click the unallocated space and select New.

    On File System select linux-swap and press Add.

    Back to GParted main window Apply the changes.

    Close GParted.

    Step 10:

    Mount the new root partition using the Ubuntu Places menu.

    On a terminal window change to the etc folder on that partition:

    $ sudo -i

    # cd /media/0b2eaab8-fddb-41fc-85f9-12ff421ce984/etc/

    Check the previous UUID values on fstab:

    # cat fstab | grep UUID=
    # for a device; this may be used with UUID= as a more robust way to name
    UUID=4c557514-3b1e-47b2-ad53-475e26f0e520 / ext4 errors=remount-ro 0 1
    UUID=1042ef8e-bcf0-4890-a5b0-fe24a1aec625 none swap sw 0 0

    Backup your fstab:

    # cp fstab fstab.old

    Get the new values:

    # blkid /dev/sdc1
    /dev/sdc1: UUID=”0b2eaab8-fddb-41fc-85f9-12ff421ce984″ TYPE=”ext4″
    # blkid /dev/sdc2
    /dev/sdc2: UUID=”d8989008-f39c-42f4-81ad-5c1a70c8b3c9″ TYPE=”swap”

    Replace the old values for the new ones:

    # sed ’s/4c557514-3b1e-47b2-ad53-475e26f0e520/0b2eaab8-fddb-41fc-85f9-12ff421ce984/’ fstab.old > fstab

    # sed ’s/1042ef8e-bcf0-4890-a5b0-fe24a1aec625/d8989008-f39c-42f4-81ad-5c1a70c8b3c9/’ fstab > fstab.new

    Now your fstab should have the new values:

    # cat fstab | grep UUID=
    # for a device; this may be used with UUID= as a more robust way to name
    UUID=0b2eaab8-fddb-41fc-85f9-12ff421ce984 / ext4 errors=remount-ro 0 1
    UUID=d8989008-f39c-42f4-81ad-5c1a70c8b3c9 none swap sw 0 0

    Step 11:

    Now you need to install GRUB on the 8GB USB drive.

    First, the UUID of the root partition needs to be corrected also:

    # cd ../boot/grub

    # cp grub.cfg grub.cfg.old

    # sed ’s/4c557514-3b1e-47b2-ad53-475e26f0e520/0b2eaab8-fddb-41fc-85f9-12ff421ce984/’ grub.cfg.old > grub.cfg

    Install grub on 8GB USB device:

    First check if sdc is on device.map:

    # cat device.map
    (hd0) /dev/sda
    (hd1) /dev/sdb

    Add the missing device:

    # echo “(hd2) /dev/sdc” >> device.map

    # grub-setup -d ./ -r ‘(hd1,1)’ -m ./device.map ‘(hd2)’

    # grub-install –root-directory=/media/0b2eaab8-fddb-41fc-85f9-12ff421ce984/ /dev/sdc

    Step 12:

    Shutdown the system. Remove the 4GB drive and plugin the 8GB drive.

    Turn on the system.

    Now I have 50% of free space instead of the 5% I had before migrating my system from an 4GB USB drive to an 8GB  USB drive.

    # tune2fs -U 0b2eaab8-fddb-41fc-85f9-12ff421ce984 /dev/sdc1
    Categories: Linux

    Bash: window size is too short, how do I change it?

    August 26th, 2009 No comments

    So I’m logged on to a Linux server using Bash shell over an ssh connection using Poderosa client.

    When I time a long command for some reason the cursor at some point moves over to the beginning of the same line overwriting the command and everything becomes a mess. This is specially annoying while typing something you would like to cut and paste on an email for example.

    So, what’s going on?

    Bash has a variable that reports the number of columns setup:

    $ echo $COLUMNS
    80

    Interesting, it is configured for 80 columns but my terminal window has 137 columns. Why is that?

    There’s a Bash setting that will adapt the window size after each command:

    checkwinsize
    If set, Bash checks the window size after each command and, if necessary, updates the values of LINES and COLUMNS.

    Let’s see what is it’s current value:

    $ shopt -p | grep checkwinsize
    shopt -u checkwinsize

    That means it is disabled… Let’s enable it:

    $ shopt -s checkwinsize

    Now it is enable. Let’s check the COLUMNS value now:

    $ echo $COLUMNS
    137

    Great!

    Categories: Linux, Shell

    Changing the configuration of Redhat Cluster Manager

    August 20th, 2009 No comments

    The Redhat cluster manager uses a cluster configuration system (man ccs) which can be managed by the ccs_tool tool.

    To change the configuration file /etc/cluster/cluster.conf you have to follow the steps outlined below on the first node of your cluster:

    1. backup current cluster.conf
    2. copy /etc/cluster/cluster.conf to say /tmp/cluster.conf
    3. make the necessary changes to /tmp/cluster.conf
      1. Change also the config_version attribute of the cluster tag at line 2 increasing the value by 1.
    4. run ccs_tool with the update option:  ccs_tool update /tmp/cluster.conf
    5. if you’re using cman then run: cman_tool version -r <new config version>

    If you don’t do item 5. and you’re using cman then your nodes will not be able to rejoin the cluster. To recover do the following:

    1. On the first node run cman_tool version -r <new config version>.
    2. On the other nodes restart the cman service.
    3. Restart ccsd
    4. Start rgmanager
    Categories: Linux

    Postfix Quick Reference

    June 3rd, 2009 No comments

    These are the most usefull commands for Postfix queue management:

    Print a queue: postqueue -p

    Delete a message: postsuper -d <Queue ID>

    Delete all messages: postsuper -d ALL

    Display a message: postcat -q <Queue ID>

    Categories: Linux

    Cisco VPN Client: Remote peer is no longer responding.

    February 27th, 2009 5 comments

    If you have a profile that used to work and is no longer working for you this might help… or not… The message “Remote peer is no longer responding” is used on more than one failure scenario.

    Increase the log level on /etc/opt/cisco-vpnclient/vpnclient.ini:

    [main]
    BinDirPath=/usr/local/bin
    EnableLog=1
    [LOG.IKE]
    LogLevel=15
    [LOG.CM]
    LogLevel=3
    [LOG.CVPND]
    LogLevel=3
    [LOG.XAUTH]
    LogLevel=3
    [LOG.CERT]
    LogLevel=3
    [LOG.IPSEC]
    LogLevel=15
    [LOG.CLI]
    LogLevel=3
    [LOG.FIREWALL]
    LogLevel=15
    [LOG.PPP]
    LogLevel=1
    [LOG.DIALER]
    LogLevel=1
    [LOG.GUI]
    LogLevel=1

    Now Run:

    # ipseclog ipseclog.txt &
    Cisco Systems VPN Client Version 4.8.02 (0030)
    Copyright (C) 1998-2007 Cisco Systems, Inc. All Rights Reserved.
    Client Type(s): Linux
    Running on: Linux i686 #1 SMP Wed Feb 11 23:58:12 EST 2009 i686
    Config file directory: /etc/opt/cisco-vpnclient

    [1] 5143
    #

    And now try connecting again.

    After it fails check /var/log/ipseclog.txt and try finding DEL_REASON_PEER_NOT_RESPONDING.

    Then if the profile you’re using has EnableNAT=1 try changing to EnableNAT=0 and try connecting again.

    This solved the problem for me.

    If you still have the problem try also restarting your Internet connection or the network service (Fedora):

    # /etc/init.d/network restart

    Categories: Cisco, Linux

    Bash: send a running process to background

    February 27th, 2009 No comments

    Say you start a process and you forget to add the & character at the end of the line to send it to the background. You don’t need to restart the process if you’re using bash (and probably other shells – check the documentation of the one you’re using).

    To send the running process to the background so that you get the shell prompt back to enter more commands you have to press CTRL+Z while the process is running. The process will be temporarily suspended until you send it to the foreground with the bg [jobspec] command.

    Let’s see an example:

    [root@localhost log]# tail -f cron
    Feb 26 11:01:01 localhost CROND[5731]: (root) CMD (run-parts /etc/cron.hourly)
    Feb 26 12:01:01 localhost CROND[5743]: (root) CMD (run-parts /etc/cron.hourly)
    Feb 26 13:01:01 localhost CROND[5836]: (root) CMD (run-parts /etc/cron.hourly)
    Feb 26 14:01:01 localhost CROND[6097]: (root) CMD (run-parts /etc/cron.hourly)
    Feb 26 15:01:01 localhost CROND[6132]: (root) CMD (run-parts /etc/cron.hourly)
    Feb 27 04:26:15 localhost crond[2844]: (CRON) STARTUP (1.2)
    Feb 27 04:26:16 localhost crond[2844]: (CRON) INFO (running with inotify support)
    Feb 27 04:26:20 localhost anacron[2912]: Anacron 2.3 started on 2009-02-27
    Feb 27 04:26:20 localhost anacron[2912]: Will run job `cron.daily’ in 65 min.
    Feb 27 04:26:20 localhost anacron[2912]: Jobs will be executed sequentially
    ^Z
    [1]+  Stopped                 tail -f cron
    [root@localhost log]# jobs -l
    [1]+  4107 Stopped                 tail -f cron
    [root@localhost log]# bg 1
    [1]+ tail -f cron &
    [root@localhost log]# jobs -l
    [1]+  4107 Running                 tail -f cron &
    [root@localhost log]# fg 1
    tail -f cron
    ^C
    [root@localhost log]# jobs -l
    [root@localhost log]#

    As you see when you press CTRL+Z (or ^Z) the process is suspended (stopped). You can see the list of jobs and their state by running jobs -l. This job was given the number 1. We can then send it to the background with bg 1 or bring it back to the foreground with fg 1. At the end I kill the process by pressing CTRL+C (^C).

    You can stop the job with ^Z and then send it to the background using bg with no additional arguments. Actually you can use the character % as a job name. Let’s see the following example:

    # tail -f test1
    line 1
    line 2
    ^Z
    [1]+  Stopped                 tail -f test1
    # %1 &
    [1]+ tail -f test1 &
    # jobs -l
    [1]+  3855 Running                 tail -f test1 &
    # tail -f test2
    file 2 line 1
    file 2 line 2
    ^Z
    [2]+  Stopped                 tail -f test2
    # %% &
    [2]+ tail -f test2 &
    #
    # jobs -l
    [1]-  3855 Running                 tail -f test1 &
    [2]+  3857 Running                 tail -f test2 &
    # %-
    tail -f test1
    ^Z
    [1]+  Stopped                 tail -f test1
    # jobs -l
    [1]+  3855 Stopped                 tail -f test1
    [2]-  3857 Running                 tail -f test2 &
    # kill %1

    [1]+  Stopped                 tail -f test1
    # kill %2
    [1]+  Terminated              tail -f test1
    # jobs -l
    [2]+  3857 Terminated              tail -f test2
    # jobs -l

    The + flag on the output of jobs -l indicates the current job and the – flag indicates the previous job. The %% and %+ names refer to the current job while %- refers to the previous job. So instead of fg 1 you can use %1. And instead of bg 1 you can use %1 &. And so on…

    Categories: Linux, Shell

    CentOS 4.2 and nforce drivers (forcedeth issue)

    December 27th, 2008 No comments

    Today I had to install CentOS 64 bit on a desktop built on an ASUS P5N32-E SLI motherboard. This motherboard features a nForce 680i SLI chipset and other fancy stuff that are likely to cause trouble to Linux distributions, specially old versions.

    I decided to go for CentOS 4.2 just because I had it available on a DVD from a magazine, it was 64-bit and as an entreprise distribution it should be stable.

    Installation was straightforward although I had to specify the drivers to use for hard disk (sata_nv) just before it started.

    Upon login into my new installation I noticed I didn’t had any ethernet interfaces configured. This motherboard has two gigabit ethernet interfaces. They should use forcedeth driver from nvidia but they’re not working. Loading forcedeth manually didn’t do it . Also using options msi=0 msix=0 also didn’t do it.

    So I decided to download the most recent kernel package for CentOS 4 which is kernel-smp-2.6.9-78.0.8.EL.x86_64.rpm. I downloaded from another computer to an usb stick and copied over to my CentOS 4 host. Then as root I executed the command: rpm -i kernel-smp-2.6.9-78.0.8.EL.x86_64.rpm and rebooted.

    After booting using the new kernel the system was able to find my ethernet devices. Aditionally it also found my onboard sound card.

    After configuring them I was able to get network on my new system.

    Categories: Hardware, Linux