Pages

Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Friday, October 28, 2011

WIFI not working in Ubuntu, what to do??

If you have freshly installed Ubuntu and your WIFI is not working. Then you should follow the following steps to hopefully resolve the issue.

Goto System/Administration/Hardware drivers
See if any drivers are listed as to be installed or in-active.
In this case install the driver and enable it.
Restart the machine

Still not fixed
If you are using a Compaq machine in particular and also in general, sometimes the drivers are installed properly but the wireless button does not work. In that case, first check to see if it is disabled. If it is, then enable it
rfkill list all
# if blocked =yes then try next command
rfkill unblock all

If you still have problems then may be you have the BCM4312 802.11 b/g rev(01) card
Check to see if this is the case

lspci | grep 802

If in the output you see BCM4312 802.11 b/g rev(01)
then you should do the following

sudo su
apt-get update
apt-get install bcmwl-kernel-source
shutdown -r now
You would need to restart for the changes to be effective
If in case it still does not work, check in system/administration/hardware drivers. A LINUX STA driver will be listed. Click on install and then enable it in the same menu. After this reboot.
Everything should be working now! :)

Thursday, October 27, 2011

Setting up network proxy in Ubuntu

Method 1: (Graphical)
Note: You probably need this method in order for the synaptics packet manager or the updates to work.
If you are using the Internet behind a proxy, then in order for apt and other Internet related services to work you need to configure an Internet proxy. You can do this using System/Preferences/Network Proxy. After setting the IP and port click on Apply system wide. It will ask for your password twice. You are done.
A note on the above method: This method works but when un-setting the proxy you may run into bugs, so this method is not recommended.

Manual Method (recommended)
You can set the proxy manually in the terminal (note: This method only works for applications that run in the terminal).

export http_proxy=http://192.168.1.1:8080
ftp_proxy=ftp://192.168.1.1:8080

Replace the IP and port in example with your proxy's IP and port.
Then you can test the connection using

wget www.yahoo.com
rm index.html

If wget is able to download the page it means your proxy has been configured correctly, the rm in the above command has been used to delete the test page downloaded using wget.
To unset the proxy

unset http_proxy
unset ftp_proxy

A known bug:
apt-get does not work when used with sudo, if you see that the downloading is getting stuck and not proceeding at all. You should probably use the following method


sudo su
export http_proxy=http://192.168.1.1:8080
apt-get install 

Additional notes:
If you have opened up multiple tabs of terminal,you would have to set proxy in each tab independently. This proxy setting does not hold once you close terminal.

Permanent method:
If you wish to setup proxy permanently, i.e. whenever you open up terminal the proxy is already set; then you need to make changes to your ~/.bashrc file as super user.

sudo gedit ~/.bashrc

When a window pops up enter the following lines at the very end of the file

export http_proxy=http://192.168.1.1:8080
export ftp_proxy=ftp://192.168.1.1:8080

Now you can either restart the terminal or

source ~/.bashrc

In order to remove the proxy in the future just simply comment/remove the lines you added

Special case: If you want to set proxy for all users, not just your own user, then you need to make changes mentioned above in the /etc/bash.bashrc

Installing Qt4 on Ubuntu and integrating with Eclipse

First install qt4 on Ubuntu

sudo su
apt-get update
apt-get install qt4-designer qt4-demos qt4-doc qt4-dev-tools libqt4-dev
Then you need to install the pde environment for eclipse.
Refer to my older post on seeing how to do this.
go to help->install new software -> select your package-> general tools -> plugin development environment

Then download the integration files from http://qt.nokia.com/products/eclipse-integration/
Then you need to extract the tar file and place the extracted files in the eclipse folder, if you did a standard installation using apt or synaptics package manager you will find it in /usr/lib
cd /usr/lib
tar -xvzf /qt-eclipse-integration-linux.x86-1.6.1.tar.gz
Now you need to re-start eclipse with a clean configuration
eclipse -clean

Now go to new..Project..qt

You will get an error when it starts
Click on open preferences and setup the paths as follows
After this it will ask you that a rebuild is necessary, you should say yes to this. It will also ask for changing perspective, say yes if you please :) You're done enjoy!

Monday, October 24, 2011

Fixing corrupted partition tables under LINUX

Recently while triple booting my system i ended up with a corrupted partition table and my windows drive refused to get mounted. After much search on the internet i found a very helpful utility known as "testdisk". It worked like a charm and fixed the errors in no time :) Unfortunately i installed it in a live system so now i can not find the tutorial that i followed.

Default web browser for Ubuntu 10.04 LTS

I had been working on some security projects when it just occurred to me that i should check my own firefox browser version. Although i update my distro on a regular basis. I was surprised to see that the firefox version of my browser was 3.1 whereas 7.0.1 is out now!! It came as a shock, but the moral of the story is always update your web browser manually :)

As it turns out the mozilla ppa's are not available by default for ubuntu 10.04. But you can add the ppa manually and then upgrade your firefox version.


sudo add-apt-repository ppa:mozillateam/firefox-stable
sudo apt-get update
sudo apt-get install firefox



Or you can always choose to do it manually, in that case you can download the latest version from the Firefox website and simply run it. But i had some issues with flash plug-ins in this case, a guide is given here https://help.ubuntu.com/community/FirefoxNewVersion/MozillaBuilds. I have not tried it out, but you can try it out if you need. In that case do update me of your findings :)

Hiding drive/volume icons from desktop

I prefer to have a clean desktop with no icons but ubuntu seems to like putting volume/drive icons on the desktop when they are mounted. If you want to hide the icons.
type in the terminal

gconf-editor

Now navigate to apps/nautilus/desktop. Over here un-check the volumes_visible option. There you go, its done :)

Note: you can always access your drives from places/computer :)

Sunday, October 23, 2011

Ubuntu network manager and disappering nm-applet icon

I had this strange issue with my Ubuntu install when the nm-applet icon a.k.a. network icon disappeared from the task bar. After much effort i found out a work around that was to stop network-manager application and then launch nm-applet and then restart the network-manager application.

But the solution to this is a very simple one, and as it turned out was not a bug.
If you are faced with such a situation do make sure to checkout your /etc/network/interfaces file to see that the interface is not listed. If the interface is listed in that file remove it else the network-manager wont take over that interface by default.

sudo service network-manager stop
nm-applet &
sudo service network-manager stop

Sample lines in /etc/network/interfaces
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet static
address 192.168.244.2
netmask 255.255.255.0
gateway 192.168.244.244
 

Comment out the interface you want network manager to take over, in this case eth0
#auto eth0
#iface eth0 inet dhcp

auto eth1
iface eth1 inet static
address 192.168.244.2
netmask 255.255.255.0
gateway 192.168.244.244
 

Then you may simply restart your pc or you can simply restart the networking using
sudo /etc/init.d/networking restart 

Tuesday, December 14, 2010

Installing Eclipse with C++ in Ubuntu

use synaptics to install eclipse

sudo su
apt-get update
apt-get upgrade
apt-get install g++
apt-get install eclipse

then follow these steps to install c++ support
If you want to add CDT (and other components) to the version of Eclipse in Ubuntu 10.04, ( which is Galileo )...

- select the "Install New Software" option of the help menu.
- click the "Add" button next to the "Work with" drop-down
- Put "Galileo" into the "Name" field - see below
- Put the Galileo release URL = "http://download.eclipse.org/releases/galileo" into the "Location" field
- Press the "OK" button to add this repository location
- Select "Galileo ... " in the "Work with" field
- Press the twisty to the left of the "Programming Languages" category
- Tick the "Eclipse C/C++ Development Tools" check-box ( should be Version 6.0.0 )
- Press the "Next" button and then "Finish" Button to install.

Galileo release URL: The Eclipse framework is released annually as a collected
and tested repository. Each release has a different name relating to celestial objects, so far moons of planets in the solar system. You should use the repository URL for the release you are using. The name is made up of "download.eclipse.org" and "/releases/galileo" in this case, but would obviously change if you used a different version of eclipse.

Friday, August 20, 2010

Ubuntu Installation - Tips and tricks

There will be a session tomorrow on Saturday 21st of August 2010 at 11 am in the auditorium. You are all invited to attend. The session will focus on various methods of installing Ubuntu on your computers and related issues. Other issues related to installation of softwares, missing drivers or issues related to networking etc. will also be discussed.

Monday, August 16, 2010

Quote of the day

"Muft ke cheez mein makhi zaroor hoti hai", Shoaib Bhatti.

So true for Ubuntu :p :D

Sunday, August 15, 2010

Ubuntu suxs when you get to know it well! Its a nightmare

Make sure you do this

sudo dpkg-reconfigure adduser

Give "no" for an answer

Also don't forget to add this line to ~/.profile

umask 077

Then you may also want to do this

cp ~/.profile /etc/skel

this will change the default (pathetic) rights on files created by a user form 755 to 700. Note: this change will only be for users that are added after you made this change.

Or instead of changing and copying the ~./profile into etc/skel you may just simply change /etc/profile. At the end of this file you would find umask 022 change it to 077. Enjoy :)
Reference:
http://ubuntuforums.org/showpost.php?p=4461165&postcount=4

Friday, August 6, 2010

Recovering lost Ubuntu installation after installing windows

You can  try installing and using Boot-repair, for instructions on installing and using it refer to the following link. (Note: i have not personally tried it but seems user friendly)
https://help.ubuntu.com/community/Boot-Repair

Or alternately you can choose to do it manually

Boot from a live cd of Ubuntu 10.04.
First, find out about your drives.
sudo fdisk -l
Then check to see if the drive is already mounted or not
df
If it is not mounted then mount it first. This is the drive in which Ubuntu is installed. In this example i will be mounting /dev/sda2 on to the folder /home/mtf
mkdir /home/mtf
sudo mount /dev/sda2 /home/mtf
In case you are not sure which drive has Ubuntu installed, you would like to look for a drive with System field as "Linux" in the output of sudo fdisk -l
If you have multiple such drives and are confused, then you can check the drives by mounting each of them and looking at the contents to see which is which. You can mount multiple drives on different folders using the steps mentioned above. You may also mount to the same folder (not consecutively) by unmounting the former drive.In this example /dev/sda2 is unmounted and /dev/sda3 is mounted in its stead
sudo umount /home/mtf
sudo mount /dev/sd3 /home/mtf
Once the drive is mounted
sudo grub-install --root-directory=/path-of-mounted-drive-with-ubuntu-install /dev/sdx
Replace x with the letter for your hard disk.

In my example, /dev/sda3 is the drive with Ubuntu installation, mounted on /home/mtf so the command would be
sudo grub-install --root-directory=/home/mtf /dev/sda
Note that in the above case it is /dev/sda and NOT /dev/sda2

Additionally to ensure everything is in order boot into your Ubuntu and then do the following to fix any missing or malfunctioning entries in grub
sudo update-grub

https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows

Tuesday, July 27, 2010

Hiberrnate, resume and restart issues in Ubuntu 10.04 : dell inspiron 1545

For those of you who are having problems with suspend and resume with your laptops using Ubuntu 10.04 here is a quick fix:

download and install uswsusp
Code:
sudo apt-get install uswsusp
Now you can try suspend and hibernate by giving the following commands
Code:
sudo s2disk
sudo s2ram --force
These will hopefully work. If they do not, you need to back up the following two files
Code:
sudo cp /usr/lib/hal/scripts/linux/hal-system-power-hibernate-linux /usr/lib/hal/scripts/linux/hal-system-power-hibernate-linux.bak
sudo cp /usr/lib/hal/scripts/linux/hal-system-power-suspend-linux /usr/lib/hal/scripts/linux/hal-system-power-suspend-linux.bak

Now replace the code in the following file
Code:
sudo gedit /usr/lib/hal/scripts/linux/hal-system-power-hibernate-linux
with:
#!/bin/bash
/usr/sbin/s2disk
And the code in
sudo gedit /usr/lib/hal/scripts/linux/hal-system-power-suspend-linux
with:
#!/bin/bash
/usr/sbin/s2ram --force

To fix the restart problem:
sudo apt-get install kexec-tools

Now
sudo gedit /etc/default/kexec
and make sure that load kexec is set to true.


Now restart your PC and enjoy :)

After following the above steps you will find that you can hibernate the PC when you click the hibernate button, but it will not hibernate once the battery runs low. For this you need to do a little bit of tweaking to make things right, first launch the global configuration editor
gconf-editor
Now navigate to apps/gnome-power-manager/general and uncheck use_time_for_policy.




Now you may wish to manually adjust the critical battery levels. For me the defaults were a bit too low :) To do so navigate to apps/gnome-power-manager/thresholds and adjust the percentages to your liking. I have set the percentage_action to 7, percentage_critical 10 and percentage_low at 20. Now when you have tweaked to your hearts content, click on close. Enjoy :) Happy hibernating!

Thursday, July 22, 2010

Dell 1545 wireless and Ubuntu

As it turns out wireless network does not work on Dell 1545 in Ubuntu. Here is a simple solution

Ubuntu:
------
Go to System->Administration->Hardware Drivers
Choose the Broadcom STA wireless driver
Activate

Sometimes the driver does not show up in the Hardware Drivers choices. In
this case, try reinstalling the driver from the GUI or shell like this:

From the GUI:
Package Manager (System>Administration>Synaptic Package Manager). Click the
Reload button in the upper left corner of Synaptic to refresh your index then
search for and reinstall the package named bcmwl-kernel-source.

Code:
sudo apt-get update
sudo apt-get --reinstall install bcmwl-kernel-source

in case the package was not already installed try
Code:
sudo apt-get install bcmwl-kernel-source


In either GUI or text case, after reinstalling, reboot your machine.

Or you may wish to download and manually install the driver from this link http://www.broadcom.com/support/802.11/linux_sta.php


Ndiswrapper method

If you don not have luck with the above method or you have a different device then you can try the Ndiswrapper technique. A detailed walk-through is given here https://help.ubuntu.com/community/WifiDocs/Driver/Ndiswrapper. For the curious, basically Ndiswrapper allows you to install and use windows drivers on Ubuntu. Good ain't it :D

Tuesday, July 20, 2010

Network bridging in VirtualBox

For those of you working on the ARP project you need to send and receive packets form your Ubuntu VM to the actual physical network. In order to do this you would need to setup network adapter to Bridged networking. In this mode you can sniff traffic on the actual physical network from within your VM and also inject packets into it.

Note: You should turn of Vbox DHCP server before you proceed. In order to do so follow my older post http://zaidmunir.blogspot.com/2010/07/how-to-enabledisable-virtualboxs-dhcp.html

Follow these steps for a hassle free setup.
1. Shut down VM.
2. Open its settings in VBox and goto settings->network
3. Over here click on all the adapter tabs and make sure that enable adapter is unchecked. You should only check this for the adapter you wish to use. In our case adapter 1.
4. In the 'Attached to' field select 'Bridged adapter' and in the 'name' field select the name of the adapter you want to make the bridge with.
5. Now run your VM and find out the name for your interface using the command ifconfig. In this example it is assumed to be eth1.
6. In case the DHCP server on your local LAN physical LAN is working follow step 7 or jump to step 8.
7. Now open and edit the /etc/network/interfaces file. It should look something like this

Preview:

auto lo
iface lo inet loopback

auto eth1
iface eth1 inet dynamic

And now you can try pinging the host machine and machines on the physical network and all should be well :)

8. See the network settings for your host machine. Now we wish to assign the guest machine an IP which is on the same network as that of the host machine. In my case the host machine has the following configuration

Preview:

IP 172.16.1.10
subnet 255.255.0.0
default gateway 172.16.1.1
DNS 172.16.1.1

So my /etc/network/interfaces file looks something like this

Preview:

auto lo
iface lo inet loopback

auto eth1
iface eth1 inet static
address 172.16.1.103
netmask 255.255.0.0
gateway 172.16.1.1

9. You will now be able to ping the host machine and others machines on the physical network. But you will still not be able to browse through the web. For this you need to make an entry for the DNS server in /etc/resolv.conf

Make the following entries in the file

Preview:

search com
nameserver 172.16.1.1


Note: the entries in your case should correspond to your particular network settings.

Saturday, July 17, 2010

Configuring network interfaces in Ubuntu

As a first step you should know which interfaces are configured in your machine. You can start by listing all the interfaces using the command: ifconfig

eth1 Link encap:Ethernet HWaddr 08:00:27:31:34:d7
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe31:34d7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1100 errors:0 dropped:0 overruns:0 frame:0
TX packets:1089 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:970170 (970.1 KB) TX bytes:181886 (181.8 KB)

eth2 Link encap:Ethernet HWaddr 08:00:27:96:82:41
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

eth2:avahi Link encap:Ethernet HWaddr 08:00:27:96:82:41
inet addr:169.254.6.94 Bcast:169.254.255.255 Mask:255.255.0.0
UP BROADCAST MULTICAST MTU:1500 Metric:1

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:240 (240.0 B) TX bytes:240 (240.0 B)

In the output observe the first column it contains the interface name. You need to know which interface you wish to configure. I would be configuring eth2 in the rest that follows, you can replace eth2 by an interface of your choice.

In Ubuntu the main file in which all the network configuration is /etc/network/interfaces.

Before you start editing system files its a good practice to take back up, in case you screw something up, you can restore the file using the backed up file. You can back up the file by using the following command:

sudo cp interfaces interfaces.bak

First, what if you want to make an interface acquire a dynamic configuration using DHCP. in that case open the /etc/network/interfaces using your favorite editor. Note: In order to make changes to this file you need to be an administrator. To do this you need to use the sudo prefix:

sudo gedit /etc/network/interfaces

Look for an entry for the interface on which you wish to use DHCP. If there is one remove it and then add the following:

auto eth2
iface eth2 inet dhcp

Now you need to restart the network. Use the following command:

sudo /etc/init.d/networking restart


Part 2: What if you wish to assign a static configuration to the interface.

Once again open the file /etc/network/interfaces and search for the interface of your choice. Remove all the entries for it below the line auto eth2 (be careful not to remove the configuration for other interfaces). In my case I wish to have the following configuration

Desired new sample settings:
=> Host IP address 192.168.1.100
=> Netmask: 255.255.255.0
=> Network ID: 192.168.1.0
=> Broadcast IP: 192.168.1.255
=> Gateway/Router IP: 192.168.1.254
=> DNS Server: 192.168.1.254

Add the following lines to the file

auto eth2
iface eth2 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254


Once more, now you need to restart networking. For this use the same command as above: sudo /etc/init.d/networking restart

If you want a more advanced tutorial you can follow http://www.cyberciti.biz/tips/howto-ubuntu-linux-convert-dhcp-network-configuration-to-static-ip-configuration.html

Libpcap in Ubuntu

You can begin by downloading and installing a new Ubuntu VM. Follow my older post for instructions regarding the installation http://zaidmunir.blogspot.com/2010/06/ubuntu-installation-on-virtual-box.html.
Once you are done installing you will need to download and install the libpcap development libraries. In case you need to find them your self, you can use the command to list possible matches:

aptitude search libpcap

You need to install the libpcap-dev package, for this use the command:

sudo apt-get install libpcap-dev

Thursday, July 15, 2010

Creating multiple virtual disk images for virtual box

If for some reason you want to run multiple instances of the same OS in virtual box, you need not install it multiple times on new virtual hard disks. Rather, you can create images of the VHD (virtual hard disk) which you can use for you new VM's. This article is primarily for windows, i have added notes for Linux users where appropriate.
1. In order to do this navigate to the folder where you have installed virtual box through command line. In windows you can launch command prompt by typing cmd in run and pressing enter. (In Linux VBoxManage command is in bin folder and hence its path is set, it can be launched directly from terminal by typing VBoxManage)
1.5. Before you proceed launch VBox. Goto File -> Virtual media manager.
       release the image you wish to clone. then also remove it. Make sure you do not delete the image when asked.

2. Next in this folder you will find the file VBoxManage.exe, you need to execute it with the following parameters.
3. VBoxManage clonehd [path of VhD to clone] [path + name of new clone VHD]
4. After this you should have a new VHD in the folder you specified. You can create a new VM in Virtual Box and use this clone hard disk in it. Enjoy :)