Wednesday, March 21, 2012

Installing the latest Google Picasa in Ubuntu over wine

Google Picasa is not really created for linux, but can be installed via Wine in Ubuntu.

These are the steps:

Get the Google signing key
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -

Add the repo for picasa
sudo sh -c 'echo "deb http://dl.google.com/linux/deb/ testing non-free" >> /etc/apt/sources.list.d/google.list'

Update apt and installing picasa
sudo apt-get update && sudo apt-get install picasa

Run Picasa once and close it
picasa &

Download the latest version of Google Picasa into your home folder
cd ~ && wget http://dl.google.com/picasa/picasa39-setup.exe

Run the Picasa installer with wine
sudo WINEPREFIX=/tmp/.wine_picasa /opt/google/picasa/3.0/wine/bin/wine ~/picasa39-setup.exe

After installation completes, close all the open Picasa windows.
Then copy the installation over package files
sudo cp -r /tmp/.wine_picasa/drive_c/Program\ Files/Google/Picasa3/* /opt/google/picasa/3.0/wine/drive_c/Program\ Files/Google/Picasa3/

Clean up your home folder
rm -rf ~/.google/picasa/
rm ~/picasa39-setup.exe

Suggested installing IE6 to overcome picasa authentication errors
env WINEARCH=win32 WINEPREFIX=~/.google/picasa/3.0/ winetricks ie6

Wednesday, September 29, 2010

Ubuntu running in low-graphic mode

Solution 1:
Reconfigure xserver xorg, with the command
sudo dpkg-reconfigure xserver-xorg
Solution 2: (Try only if you know what you are doing)

  • Take a backup of xorg.conf file:
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf_bkp
  • Open the xorg.conf file for editing:
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf_bkp
  • Delete this Section Device:
Section “Device”
Identifier     “Device0″
Driver         “nvidia”
VendorName     “NVIDIA Corporation”
BoardName      “GeForce 8400M GS”
EndSection
  • Edit the Section Screen as:
Section “Screen”
Identifier     “Screen0″
Device         “Device0″
Monitor        “Monitor0″
DefaultDepth    24
SubSection     “Display”
Depth       24
Modes “1440×990″
EndSubSection
EndSection

Sunday, September 19, 2010

Installing hamachi VPN in Ubuntu as a service

Hamachi is a free vpn service, useful to create a private LAN over the internet. For more details of hamachi, go to www.hamachi.cc

The following covers installing hamachi in Ubuntu as a service.

  • We start with installing the 'tun' module to enable IP tunneling in linux
sudo modprob tun
(If that gives an error tun module failed try installing faketun as given in the blog post Installing faketun)
  • Open the modules file and add ‘tun’ to the list
sudo nano /etc/modules
Your file should look similar to the example below.
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
lp
rtc
tun
(Incase 'tun' is not on that file, write 'tun' in a new line)
  • Save the file and exit out of nano (Ctrl-O to save & Ctrl-X to exit), lets move on and verify that a tunneling node has been created. (*If you have compiled your own kernel you likely need to recompile it with IP Tunneling support if you receive an error with modprobe. This is not covered in this guide. And if you are unsure, you most likely did not compile yourself and you would definitely remember doing so.)
ls /dev/net/tun
You should recieve a response like the example below
/dev/net/tun
  • If you received something along the lines of “No Such File or Directory” you may need to manually create the node (run the commands below).  If you received the response (/dev/net/tun), jump to the next step.
sudo mkdir /dev/net
sudo mknod /dev/net/tun c 10 200
Run ls /dev/net/tun again and you should now receive the correct response.
  • With our IP Tunnel node created, it is time to install Hamachi itself.  First download the latest version.  As of writing this guide, the latest version is 0.9.9.9-20
wget http://files.hamachi.cc/linux/hamachi-0.9.9.9-20-lnx.tar.gz
Expected output below
--2010-09-19 18:40:55--  http://files.hamachi.cc/linux/hamachi-0.9.9.9-20-lnx.tar.gz
Resolving files.hamachi.cc... 74.201.74.16
Connecting to files.hamachi.cc|74.201.74.16|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 344866 (337K) [text/plain]
Saving to: `hamachi-0.9.9.9-20-lnx.tar.gz'
100%[======================================>] 3,44,866    --.-K/s   in 0.002s  
2010-09-19 18:41:19 (149 MB/s) - `hamachi-0.9.9.9-20-lnx.tar.gz' saved [344866/344866]
  • Extract our newly downloaded archive
tar zxvf hamachi-0.9.9.9-20-lnx.tar.gz
Expected output below
hamachi-0.9.9.9-20-lnx/
hamachi-0.9.9.9-20-lnx/Makefile
hamachi-0.9.9.9-20-lnx/LICENSE
hamachi-0.9.9.9-20-lnx/README
hamachi-0.9.9.9-20-lnx/LICENSE.tuncfg
hamachi-0.9.9.9-20-lnx/LICENSE.openssh
hamachi-0.9.9.9-20-lnx/LICENSE.openssl
hamachi-0.9.9.9-20-lnx/hamachi
hamachi-0.9.9.9-20-lnx/tuncfg/
hamachi-0.9.9.9-20-lnx/tuncfg/Makefile
hamachi-0.9.9.9-20-lnx/tuncfg/tuncfg.c
hamachi-0.9.9.9-20-lnx/tuncfg/tuncfg
hamachi-0.9.9.9-20-lnx/CHANGES
  • Navigate into the extracted directory
cd hamachi-0.9.9.9-20-lnx/
  • Start the installation
sudo make install
Expected output below
Copying hamachi into /usr/bin ..
Creating hamachi-init symlink ..
Compiling tuncfg ..
Copying tuncfg into /sbin ..
Hamachi is installed. See README for what to do next.
  • Run the tunnel
sudo tuncfg
This should complete the install, we will now configure the user permission in order for it to run correctly.  Create a ‘hamachi’ user group
sudo groupadd hamachi
Add youself as a user to the ‘hamachi’ group.  Be sure to replace your user name where appropriate.
sudo gpasswd -a YOURUSERNAME hamachi
Add the root user to the ‘hamachi’ group
sudo gpasswd -a root hamachi
Set the correct permissions for the tuncfg socket
sudo chmod 760 /var/run/tuncfg.sock
Change the ownership of the socket file
sudo chgrp hamachi /var/run/tuncfg.sock
That should do it for the permissions, Now onto setting Hamachi up & configuring it to start as a system service.
sudo hamachi-init -c /etc/hamachi
Expected output
Initializing Hamachi configuration (/etc/hamachi). Please wait ..
   generating 2048-bit RSA keypair .. ok
   making /etc/hamachi directory .. ok
   saving /etc/hamachi/client.pub .. ok
   saving /etc/hamachi/client.pri .. ok
   saving /etc/hamachi/state .. ok
 Authentication information has been created. Hamachi can now be started with
'hamachi start' command and then brought online with 'hamachi login'.
Start hamachi
sudo hamachi -c /etc/hamachi start
Expected output
Starting Hamachi hamachi-lnx-0.9.9.9-20 .. ok
Set your computer’s nickname
sudo hamachi -c /etc/hamachi set-nick "COMPUTERNICKNAME"
Login to the Hamachi network
sudo hamachi -c /etc/hamachi login
To join an existing network (optional)  “NETWORKNAME” and “PASSKEY” should be replaced with your network name and network password
sudo hamachi -c /etc/hamachi join NETWORKNAME PASSKEY
To create a new network (optional) “NETWORKNAME” and “PASSKEY” should be replaced with your network name and network password
sudo hamachi -c /etc/hamachi create NETWORKNAME PASSKEY
If you joined an existing network you must tell hamachi to then “go-online”. Be sure to replace NETWORKNAME with your relevant network name.
sudo hamachi -c /etc/hamachi go-online NETWORKNAME
Check your hamachi status to verify everything is as it should be
sudo hamachi -c /etc/hamachi
Expected output

Hamachi, a zero-config virtual private networking utility, ver 0.9.9.9-20

  version  : hamachi-lnx-0.9.9.9-20
  pid      : 5754
  status   : logged in
  nickname : NICKNAME(assigned nickname)

  • Now to configure to startup and login automatically when the computer starts:
  • Create the startup script file:
sudo touch /etc/init.d/hamachi
(Else you can download the file directly from here. Place it in the /etc/init.d folder.)

  • Open the startup script file for editing (Incase you have downloaded the file and placed in the /etc/init.d folder, you need not do this step)
sudo nano /etc/init.d/hamachi
Paste the following contents in the file:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          hamachi
# Required-Start:    $remote_fs $syslog $network
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start hamachi at boot time
# Description:       Starts up hamachi daemon. Networking is required.
### END INIT INFO

hamachi_start() {
  echo "Starting hamachi..."
  /sbin/tuncfg
  /usr/bin/hamachi -c /etc/hamachi start
  /bin/chmod 760 /var/run/tuncfg.sock
  /bin/chgrp hamachi /var/run/tuncfg.sock
}

hamachi_stop() {
  echo "Stopping hamachi..."
  killall tuncfg
  /usr/bin/hamachi -c /etc/hamachi stop
}

hamachi_restart() {
  hamachi_stop
  sleep 1
  hamachi_start
}

case "$1" in
'start')
  hamachi_start
  ;;
'stop')
  hamachi_stop
  ;;
'restart')
  hamachi_restart
  ;;
*)
  hamachi_start
esac
Save the file Ctrl+O and exit nano Ctrl+X

  • Make the file executable and configure it to run it at startup:
sudo chmod +x /etc/init.d/hamachi
sudo update-rc.d hamachi defaults
 Expected output
 Adding system startup for /etc/init.d/hamachi ...
   /etc/rc0.d/K20hamachi -> ../init.d/hamachi
   /etc/rc1.d/K20hamachi -> ../init.d/hamachi
   /etc/rc6.d/K20hamachi -> ../init.d/hamachi
   /etc/rc2.d/S20hamachi -> ../init.d/hamachi
   /etc/rc3.d/S20hamachi -> ../init.d/hamachi
   /etc/rc4.d/S20hamachi -> ../init.d/hamachi
   /etc/rc5.d/S20hamachi -> ../init.d/hamachi

Tuesday, September 14, 2010

Tweaking the Login Screen in Ubuntu

Ever thought of making the default Ubuntu login screen behave the way you want?


  • Probably you are the only user (and you do not fear someone else prying in your PC/laptop) and you feel entering the password everytime a nuisance! You would want Ubuntu to log in automatically for you.
  • Or there might be other users (like an admin and a standard user), and you may want the login screen to be visible for 10 seconds (in case you want to login as admin user) and on no response for 10 seconds (or any time you choose) log in to the standard user automatically.
  • Else, you like the old secure linux way to ask you to choose the user and enter password everytime.


There may be other things you like;
  • Like playing a sound when you log in.
  • Select the session (Gnome/Kde/xfce etc) as default
Either ways, you have your pick.
Simply go to System>Administration>Login Screen and you would find all the options to tweak the login the way you like.

Note: You will need to be logged in as admin user and enter the admin password again to Unlock the Login Screen menu.

Saturday, September 4, 2010

initramfs update error

Duringa ubuntu linux system update an initramfs error sometimes come up:


update-initramfs: Generating /boot/initrd.img-x.x.x.x-generic
.: 4: Can't open /scripts/functions

Often this results in broken update, and many other issues.
If the system is unable to boot to the new updated kernel, select the older version from the boot menu and try updating initramfs again.

Then try the following:

1, Delete only broken files in /var/lib/initramfs-tools/. (Be careful, delete onlt if you are sure of what you are doing, else you may try the other steps skipping this.)
2, sudo dpkg --configure -a
3, sudo dpkg --configure initramfs-tools (make sure no errors, otherwise repeat step 1 & 2).
4, sudo update-initramfs -u (Maybe not neccessary).

Thursday, August 5, 2010

tun module fails in Ubuntu 10, install fake tun

Problem: In Ubuntu 10.04, tun fails. while running the command
$ sudo modprobe tun
results into
tun module failed

The tun module is used in several VPN softwares like hamachi

Resolution:

Install fake tun in Ubuntu. Then run the command 'sudo modprobe tun'
Note: You need to be one of the admins (in sudo group).

To install fake tun, copy/paste and then run each command (below) separately. Make sure there is no line-breaks within a command

$ sudo apt-get install build-essential linux-headers-`uname -r`
$ mkdir faketun
$ cd faketun
$ echo -e "#include \nstatic int start__module(void) {return 0;}\nstatic void end__module(void){return;}\nmodule_init(start__module);\nmodule_exit(end__module);">tun.c
$ echo -e "obj-m += tun.o\nall:\n\tmake -C /lib/modules/\$(shell uname -r)/build/ M=\$(PWD) modules\nclean:\n\tmake -C /lib/modules/\$(shell uname -r)/build/ M=\$(PWD) clean\nclean-files := Module.symvers">Makefile
$ make
$ sudo install tun.ko /lib/modules/`uname -r`/kernel/net/tun.ko
$ sudo depmod -a
$ sudo modprobe tun
Incase, you get an  error, check tun.c and Makefile files (in the faketun folder) are created correctly. You may download the files from the address below, into the faketun folder, and then start from the 'make' command again:

File: tun.c download link


File: Makefile download link

Installing Guest Additions in VirtualBox

VirtualBox has made it pretty easy to install the Guest Additions for improved integration between guest and host. Some of these benefits are mouse-capture improvements and improved video resolution. The mouse capture improvements now allow you to control your virtual machine when the mouse is over the window, and seamlessly return to your host when it is not. Improved video resolution should allow you to customize a better resolution for your guests.

What we need to do to install the Guest Additions is select the option from the VirtualBox menu. You’ll want to do this after your guest is running (the guest-additions are installed to the guest, not the host). Select:
Devices > Install Guest Additions...

This sometimes takes a minute so don’t worry if you don’t see anything right away. This should then prompt you and say something along the lines of:
The Guest Additions image is not found on your host. Would you like to download this image now?

We’ll select YES and let it download the image. The image is downloaded to the host machine and then mounted within the guest. This way it can be shared with future guests without needing to download multiple times. It should also prompt you whether or not you’d like to mount the image. Again, select YES.

At this point you should see a disk image mounted on your desktop. What we’ll do here is run a script that will generate the proper modules to allow for guest additions. In my preferred method we’ll do this:
  1. Open a terminal by pressing ALT-F2 and enter “gnome-terminal” on gnome or “konsole” on KDE.
  2. cd /media/cdrom
    The Guest Addition iso file do not mount automatically sometimes. In the case if you do not see a cdrom, run sudo mount /dev/scd0 /media/cdrom
  3. sudo bash ./VBoxLinux*
    OR
    sudo sh ./VBoxLinuxAdditions-x86.run
    OR
    sudo sh ./VBoxLinuxAdditions-amd64.run

This will grind away at generating the proper modules and then prompt you to restart your guest machine. Once this has finished and you’ve rebooted your guest operating system you should have the guest improvements ready to go. No additional configuration for the mouse integration should be needed, but you may have to manually update to a better resolution as wanted.

Hopefully I’ll have the tutorial for building proper network bridging soon as well. Until then, enjoy your virtualization with VirtualBox!

_____________________________________

This article is taken from http://ubuntu-tutorials.com