Linux Tips and Tricks

A collection of tips, tricks and everything linux

Archive for the ‘Linux’ tag

Ubuntu 10.10 Maverick Meerkat USB install problems

without comments

I finished downloading ubuntu-10.10-desktop-i386.iso , and successfully created a USB startup disk using the utility in my 10.04 desktop. Now for some reason after trying to boot from it im faced with a boot error “Unknown keyword in configuration file” . After some googling I found a fix posted on Trent Scott’s Blog.

After creating your usb startup disk with the ubuntu 10.10 iso file, open the file syslinux.cfg in the syslinux folder.

look for the line “ui gfxboot bootlogo” and change it to “gfxboot bootlogo”.

save the file and you’re good to go.

Written by mnk0

October 13th, 2010 at 11:05 am

Posted in Linux, Ubuntu

Tagged with ,

Disk imaging with netcat and dd with ubuntu linux

with 3 comments

Want to create a disk image of a system but write it on another hard disk? This can easily be done with the help of netcat and dd.
For this example you will need two computers connected on the same network, and enough room on one machine to hold your disk image

Destination Machine

So we’ll start off this example by preparing our destination machine to listen on tcp port 4444 via netcat. The port is arbitrary so you can really pick any port that is not being used. Just have to make sure that its the same on both ends.

root@tree:~# netcat -l -p 4444 | dd of=remote-machine.img

Source Machine

Next we’ll start a dd on the source machine and pipe it to netcat on port 4444

root@leaf:~# dd if=/dev/sda1 | netcat destination-machine-ip 4444

Now sit back and wait for your image to be done, when it’s finished dd will print out its status something like

NOTE: you will have to push CTRL+C to cancel out after this is completed, as the netcat session will still be active.
root@leaf:~#
30820468+71926 records in
30867456+0 records out
15804137472 bytes (16 GB) copied, 739.395 s, 21.4 MB/s
^C

If you want to find out the status of dd during the copy theres a couple of ways to do this, open up the system monitor in Ubuntu Linux, and it should tell you the transfer rate. Launch iostat or ifstat through a terminal. Invoke a command from terminal to get dd to display the current progress .

Viola, we’ll now have a dd image of our disk or partition. I like to verify the exact size of the file matches the size output from fdisk.

Destination Machine

root@root:~# ls -la remote-machine.img
-rw-r--r-- 1 root root 15804137472 2010-02-04 10:53 remote-machine.img

Source Machine

root@leaf:~# fdisk -l /dev/sda
Disk /dev/sda: 15.8 GB, 15804137472 bytes
255 heads, 63 sectors/track, 1921 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Written by mnk0

February 4th, 2010 at 12:29 pm

Posted in Linux, Ubuntu, shell

Tagged with , , ,

Display dd progress during dd in ubuntu linux

with 2 comments

Started a dd but wondering what the progress is? I haven’t found a way to do a verbose mode for dd, but this command seems to do the trick.

Lets start off by creating a dd of /dev/sda1

mnk0@tree:~# dd if=/dev/sda1 of=my-dd.img

We’ll need to find the process number of our dd which can easily be done with the following command.

ps -ef | grep dd

we’ll get something like this

root 31733 31268 54 10:44 pts/0 00:01:55 dd of my-dd.img

Now we can run our command to find the status of this dd. Open another terminal session.

kill -SIGUSR1 31733

and looking back at our dd page we should see dd dump out a status of its current progress.

mnk0@tree:~# dd if=/dev/sda1 of=my-dd.img
12574781+40555 records in
12601304+0 records out
6451867648 bytes (6.5 GB) copied, 224.634 s, 28.7 MB/s

Written by mnk0

February 4th, 2010 at 11:45 am

Posted in Linux, Ubuntu, shell

Tagged with , ,

ubuntu 9.10 nvidia monitor settings dont save

with 3 comments

Was having the issue of not being able to save my dual monitor configuration with a default installation of 9.10. The xorg.conf seems to be unable to be parsed by nvidia-settings tool, so to get around this we can run nvidia-xconfig to reset the config file to something that it can work with.

sudo nvidia-xconfig

after that

gksudo nvidia-settings

and we can save to xorg.conf successfully.

Written by mnk0

November 5th, 2009 at 5:16 pm

Posted in Ubuntu

Tagged with ,

Using linux like a pro with mplayer, find & play mp3 files from command line in Ubuntu Linux 9.04 Jaunty

with 3 comments

Save precious CPU and memory by using mplayer to play mp3s, also keep your playlist file up to date with all your mp3 media files.

First and foremost we need to have mplayer installed, if your on a ubuntu-debian based system use the following command
to install mplayer, if not then you can download the appropriate packages and install them.

apt-get install mplayer

Lets make a home for our script file, and set the appropiate permissions

mkdir ~/scripts; touch ~/scripts/playme.sh; chmod +x ~/scripts/playme.sh; gedit ~/scripts/playme.sh

Paste the following code into your new script file, if you keep your Music files in a different location then change the variable musdir to match your setup.

#/bin/bash
# VARS ##########################################
tmpdir='/tmp'
musdir='/home/osamad/Music'
filename='playlist.m3u'
# CODE ##########################################
find $musdir -name '*.mp3' -o -name '*.ogg' 2>/dev/null >> $tmpdir/$filename
mplayer -playlist $tmpdir/$filename -shuffle -loop 0 -radio volume=80

playme

Using find we build a list of all our mp3s, in this case we have multiple types of media files we want to play so we can specify that by adding the -o -name flags and add them in.

  • -playlist ;flag we set the playlist file we just created
  • -shuffle ; enables shuffle mode
  • -loop 0 ; enables loop 0=forever
  • -radio volume=80 ; set the default volume to 80% (use * or / to adjust when playing)

RunTime

Push ALT+F2 or launch from a terminal

./scripts/playme.sh

playme-terminal

MORE

To find out more information, or to customize your mplayer settings

man mplayer

Create a custom launcher and run your script from the gnome-panel

Written by mnk0

May 1st, 2009 at 1:35 pm

Posted in Linux, Ubuntu, shell

Tagged with , , , ,

Gnome Do, with Docky in Ubuntu Ibex 8.10 setup guide

without comments

I recently found out about an amazingly slick desktop dock, called Gnome Do. Not only is it great looking, but its functionality is what sold me on this one. With the ability to launch any app, from the launcher simply by typing the name Gnome Do has totally converted me.

I set this up on my Ubuntu Ibex Desktop with a couple easy steps.

Adding repository to Apt

Open up a gnome-terminal window, and then lets open up the file /etc/apt/sources.list . Paste the following into your terminal.
gksudo /etc/apt/sources.list

Copy and paste the following repositories at the end of your file in gedit.
# GNOME DO ######################################################
deb http://ppa.launchpad.net/do-core/ppa/ubuntu intrepid main
deb-src http://ppa.launchpad.net/do-core/ppa/ubuntu intrepid main

Adding GPG Key to apt (Optional)

1. Open up gedit then copy and paste this PGP key to a text file, gnome-do.key and save it
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: SKS 1.0.10
mI0ESXUVdQEEAN8ALfH3wueKsSgDwA/HVEHdB7nlppqGKW/tubvGTy0ayf4M9ylX45szZK97
uL9/UHh5/B7eGMSB45EMJ0/qvTiflS6SwCxRCoKCW1PpYZlVcOLh5UUBkyREPJZcki1lK7pf
xvG9LkYKnvBP89s2PnO5LlDheEsVR4SqDGEtich/ABEBAAG0JExhdW5jaHBhZCBQUEEgZm9y
IEdOT01FIERvIENvcmUgVGVhbYi2BBMBAgAgBQJJdRV1AhsDBgsJCAcDAgQVAggDBBYCAwEC
HgECF4AACgkQKKggUHdVjdCVeAP+ONJtMFx9MGSJe33YiskagXEG5cQGYdDi5sWWUAP80bP1
Qe+Dsnjs3VKQ9ZZW3M8UNXsoFFN501hgJFBwUUCWIRSGZkzVgKoZZtZOe0Dws39xfV//8JFS
Te/r0oPzrr10iTFupTe/wBR0M9JbKGdY7SvooyqU+W2rf8/LldGx7KE=
=3C2V
-----END PGP PUBLIC KEY BLOCK-----

2. Open up the Software Sources Configuration Menu, and click on the Authentication tab. Then Import Key,

Installing Gnome Do

Open up a gnome-terminal window and type

sudo apt-get update
then type
sudo apt-get install gnome-do

Removing the default gnome panel

Dont worry, you can easily bring it back, we’re just gonna hide it, push ALT+F2 or from a gnome-terminal run
gconf-editor

Navigate to ‘ Apps > Panel > TopLevels > top_panel_screen0 ‘ These are the values I changed to make it dissappear
auto_hide = checked
auto_hide_size = 1
hide_delay = 1
unhide_delay = 10000
x = 0
y = 10000

Select Docky

Launch gnome-do from the terminal or from ALT-F2
gnome-do
Right click on the Gnome Do , launcher, then click on preferences, then click on the Appearence Tab, and select Docky. Now you have a desktop that looks almost as good as mine!! :)

Check out the website for most customization, and features. http://do.davebsd.com/

Written by mnk0

March 19th, 2009 at 4:18 pm

Posted in Desktop, Linux, Ubuntu

Tagged with , , , ,

keep broken files when trying to unrar a failed crc chek on a rar archive file

without comments

ok just a quick note ,, if you’re tryin to unrar an archive thats been corrupted or been split up into multiple parts, keep the broken parts using unrar.

more description

4 Rar files, part1-4, 3 fails becuase of a crc check issue, so you can recover part of the archive using the keep broken flag for unrar ‘-kb’

mnk0@tree:~/downloads$ unrar x -kb Bleach_Naruto Shippuuden 98 - 720p.rar
UNRAR 3.80 beta 2 freeware Copyright (c) 1993-2008 Alexander Roshal
Extracting from Bleach_Naruto Shippuuden 98 - 720p.rar
Extracting Bleach_Naruto Shippuuden 98 - 720p.rar 99%
Calculating control sums of all volumes.
Cannot find volume Bleach_Naruto Shippuuden 98 - 720p.rar
Bleach_Naruto Shippuuden 98 - 720p.mkv - CRC failed
Total errors: 1
mnk0@tree:~/downloads$ ls Bleach_Naruto Shippuuden 98 - 720p.mkv*
Bleach_Naruto Shippuuden 98 - 720p.mkv
mnk0@tree:~/downloads$

Written by mnk0

March 7th, 2009 at 9:55 pm

Posted in Linux, Ubuntu, shell

Tagged with , , ,

Using Cisco vpn client with Ubuntu Linux Desktop

with 6 comments

Configuration

Download and install the Cisco vpn Client. im using vpnclient-linux-x86_64-4.8.02.0030-k9 at the time of this article.
(if u need it send me an email). unpack, and install in my installation i opted out of the option for starting as a daemon so i start it manually everytime.

mnk0@tree:~$ sudo /etc/init.d/vpnclient_init start

Using my PROFILE.pcf file

Then we can copy our Cisco VPN Profile over to the profile directory.

mnk0@tree:~$ cp PROFILE.pcf /etc/opt/cisco-vpnclient/Profiles/

Now we are ready to connect to our connection. Note we dont add the .pcf extension to the profile we’re going to use

mnk0@tree:~$ /etc/opt/cisco-vpnclient connect PROFILE
Initializing the VPN connection.
Contacting the gateway at 4.23.45.21
Contacting the gateway at 4.23.45.21 (balancing)
User Authentication for PROFILE...
The server has requested the following information to complete the user authentication:
Username [mnk0]:
Passcode []:
Authenticating user.
Negotiating security policies.
Securing communication channel.
Your VPN connection is secure.
VPN tunnel information.
Client address: 10.10.10.46
Server address: 4.23.45.21
Encryption: 256-bit AES
Authentication: HMAC-SHA
IP Compression: None
NAT passthrough is active on port UDP 4500
Local LAN Access is disabled

Exiting

When we are ready to exit, just hit CTRL+C on your terminal session, and shutdown the daemon.

mnk0@tree:~$ sudo /etc/init.d/vpnclient_init stop
mnk0@tree:~$ Done

Written by mnk0

February 13th, 2009 at 8:02 pm

Posted in Linux, Ubuntu, networking, ssh

Tagged with , , ,

Using a swapfile to increase the swap space on your system

with one comment

This can be a very handy function if we want to use a file, instead of a partition, and with modern filesystems the performance is almost on par with using a dedicated partition for your swap area.

1. Using dd lets make a zero’d file for the swap

dd if=/dev/zero of=/swapfile bs=1048576 count=1000

This example would create a swapfile of 1 gig using a blocksize of a megabyte (1048576).

2. Make file as a swapfile

mkswp /swapfile

3. Activate swapfile

swapon /swapfile

4. Verify that our swapfile has been activated

swapon -s

We should see something like this in the list ..

Filename Type Size Used Priority
/swapfile file 9999992 0 -2

If you want to have this a permanent solution, then adding the entry to fstab would probally be a better idea,
open up /etc/fstab in your favourite editor and add the following line.

/swapfile swap swap defaults 0 0

Written by mnk0

January 22nd, 2009 at 11:49 pm

Access a microsoft windows share from the bash terminal in Ubuntu Linux Desktop

with 2 comments

Setup

Ever want to access a windows share from your terminal? Well using ‘ mount ‘ and cifs/samba this is a snap.

Make sure you have smbfs/cifs support, on ubuntu linux distributions you can simply type
apt-get install smbfs
Now we need to make a directory on our hard disk where we can mount our windows share.
mkdir /mnt/location

Mounting Windows Share

Now we\’re ready to mount the filesystem on our newly created directory (/mnt/location).

Mount with cifs
mount -t cifs //server-ip-or-name/share /mnt/location -o username=user,password=pass,domain=DOMAIN
Mount with smbfs
mount -t smbfs //server-ip-or-name/share /mnt/location -o username=user,password=pass,domain=DOMAIN

Clean Up

When finished with our windows mount, we should exit the directory, or close any windows that are accessing it, and then unmount the Microsoft Windows NTFS share by using the following series of commands.

cd /; umount /mnt/location

Written by mnk0

September 22nd, 2008 at 4:02 pm