Suramya's Blog : Welcome to my crazy life…

February 13, 2012

Case of the missing translucent panels

Filed under: Knowledgebase,Linux/Unix Related — Suramya @ 11:39 PM

A couple of days ago I decided to try hooking up my LCD TV to my computer to see if I could use it as an extra monitor (that didn’t work that well because the TV was too big to be comfortable but that is a different story). So while I was connecting the TV over HDMI I also installed the proprietary drivers for my RADEON HD 4250 card (and promptly forgot about doing this).

Didn’t like working with the TV (too big, too close) so put it back and then noticed that my panel was no longer translucent and none of the desktop effects were working. Ignored it for a couple of days and then decided to fix the issue.

Tried disabling and enabling the Desktop effects from the Settings -> Desktop Effects but I kept getting and error stating that the effects could not be activated and that I should check my Xorg.conf for errors. Tried searching for the Xorg.conf file but that file doesn’t exist on my system so was stumped.

Ignored the issue for another day or so but then got irritated enough today to try and fix it again. Searched online for a fix and found some tips, some bug reports but nothing that worked. Then I found a page where this person was asking if the Opensource driver is better than the propitiatory one. This tickled my brain cells and I had a hazy memory of installing the other version, so decided to take a chance and uninstall the propitiatory version and re-install the Opensource version.

Used the following commands to do this:

  apt-get remove --purge fglrx*
  apt-get remove --purge xserver-xorg-video-ati xserver-xorg-video-radeon 
  apt-get install xserver-xorg-video-ati
  apt-get install --reinstall libgl1-mesa-glx libgl1-mesa-dri xserver-xorg-core
  dpkg-reconfigure xserver-xorg

After doing this I restarted my system (had to do it anyways) and got my desktop effects back. Yay me!

Thanks to wiki.Unbuntu.org for the steps to purge the propitiatory driver.

Hope someone else also finds this useful sometime.

-Suramya

January 28, 2012

Rooting the Samsung Galaxy Nexus

Filed under: Knowledgebase,Linux/Unix Related,Tech Related — Suramya @ 1:45 AM

A rooted android device gives you a lot of flexibility so one of the first things I did after I got back home was to root it using the following instructions (modified from Android Forums: [HOW TO] Root the GSM/HSPA+ Samsung Galaxy Nexus):

Note: I am assuming you are using Linux in the instructions below. If not then visit the link above for steps in Windows.

  • Download the Android SDK from here to a folder on your PC.
  • Power down your device
  • Connect the USB cable between the phone and your PC
  • Open a shell session
  • Switch to the directory where you downloaded the SDK (In my case it was Media/Downloads)
  • cd Media/Downloads
  • Extract the SDK Zip and switch to the new directory
  • unzip sdk-tools.zip
    cd sdk-tools
  • Make the applications executable
  • chmod a+x fastboot-linux adb-linux
  • Now, Boot your phone into fastboot mode by pressing and holding the volume-up AND volume-down AND the power buttons UNTIL you see the little green Android laying on his back with door on his chest open
  • Verify that fastboot can “see” your device
  • ./fastboot-linux devices

    You should see something similar to this:

    0146B5030B02100E        fastboot

    If you don’t see anything, try running the command as root.

  • Next we start the unlock process for the bootloader by issuing the following command. Keep in mind that this will completely wipe out all data from the phone so make sure you backup before running the command.
  • ./fastboot-linux oem unlock

    Confirm that you want the bootloader to be unlocked by acknowledging the warning message on the phone. (Please note that this will void your warranty). Use your volume rocker/keys to select the confirmation and press the power button to actually confirm.

At this point you have an unlocked bootloader and now we will start the rooting process.

  • Download the su.zip flashable root package
  • I had to manually copy the su.zip to the Phone because for some reason I kept getting an ‘error: insufficient permissions for device’ when I tried copying the file using adb. I used FTP (as I have SwiFTP on the phone, but you can use any method that you are comfortable with)

  • Download the Clockwork Recovery for Galaxy Nexus (GSM) to the same folder as fastboot and adb
  • Soft boot the ClockworkMod custom recovery by issuing the following command. This method will not replace the currently installed recovery partition on your phone, so you can still receive updates from Google.
  • ./fastboot-linux boot recovery-clockwork-5.5.0.2-maguro.img

    Your phone should now boot into ClockworkMod custom recovery. The next few steps are done on the phone. You shold use the volume key / rocker to navigate and the power button to select an entry.

  • From the main ClockworkMod Recovery screen / menu, select ‘install zip from sdcard
  • Select ‘choose zip from sdcard
  • Select ‘su.zip’
  • Confirm that you want do this.
  • Select ‘*****Go Back*****
  • Select the ‘reboot system now

That’s it. 🙂 Once your phone finishes rebooting, you should now have root. If you hit issues, try reaching out to the folks in the Android Forums for help.

Hope this helps.

Update (14th Feb 2012): As you all know links/stuff tends to disappear over time on the internet so I have updated the post with links to my mirror of the software required to root the Nexus. Original links are still listed below.

Original Download links:

– Suramya

September 5, 2011

Getting RTL8111/8168B PCI Express Gigabit Ethernet controller to work in Debian 6

Filed under: Knowledgebase,Linux/Unix Related,Tech Related,Tutorials — Suramya @ 11:28 PM

Once I got Debian 6 installed on my server I needed to connect it to the internet to download updates etc, however my network card wasn’t being detected correctly so I had to perform the following steps to get it to work correctly:

  • Download the latest Linux drivers for the RTL8111 Chipset from the Realtek site on a computer that can connect to the Internet.
  • Copy the file over to your new system via USB or smoke signals
  • Login as root to the server
  • Identify the kernel version that you are running, using the following command:
  • uname -a

    It will give you a result like the following:

    Linux StarKnight 2.6.30-2-686 #1 SMP Sat Aug 27 16:41:03 UTC 2011 i686 GNU/Linux

    Now you need to install the kernel source code for this version on the server. First we need to find the package name of the kernel source code, we do that by running the following command:

    apt-cache search linux |grep header |grep 2.6 

    If you have a 2.4.x kernel, replace grep 2.6 with grep 2.4. Once you have the package name install it using the following command as root:

    apt-get install linux-headers-2.6.30-2-686

    Make sure you replace linux-headers-2.6.30-2-686 with the package name you got.

    Once we have the kernel source installed we can go ahead and install the driver using the following commands:

    tar -jxvf r8168-8.025.00.tar.bz
    cd r8168-8.025.00
    ./autorun.sh 
    

    This will compile the drive and install it. I didn’t get any errors when I ran it, but if you do get errors try searching for the error message on Google, it usually provides a solution.

    After I installed the driver I tried initializing my network but kept getting the following error message:

    StarKnight:~# ifdown eth0
    ifdown: interface eth0 not configured
    StarKnight:~# ifup eth0
    Ignoring unknown interface eth0=eth0.
    

    Fixing it was fairly simple though, all I had to do was edit the /etc/network/interfaces file and add the following lines to it (This assumes you are using DHCP):

    auto eth0
    iface eth0 inet dhcp
    

    Once you add the lines, you can try starting the network again using the command:

    ifup eth0

    If all went well, you will be assigned an IP address and will now be able to successfully browse the net.

    Hope this helped.

    – Suramya

    April 4, 2010

    What to do if your printer suddenly stops working on Linux

    Filed under: Knowledgebase,Linux/Unix Related — Suramya @ 10:22 PM

    Its happened to me twice so far that when I try to print to my HP Deskjet F380 the job just sits in the print queue and is apparently on hold. Canceling the job and printing again doesn’t fix the problem and when I hook up the printer to another system it works fine.

    The problem is that the printer has been ‘disabled’ for some reason on the system. I think that this happens when you are printing something and you switch off the printer in the middle but haven’t confirmed that yet.

    To fix it you need to ‘Enable’ the printer. There are two ways you can do this:

    Using the Printer Configuration GUI

    1. Run the ‘system-config-printer’ GUI via Start -> system -> Printing or from the command prompt.
    2. Right click on the printer
    3. Click on ‘Enable’ in the drop down menu.

    That’s it. Now the queued print jobs should start processing again.

    The other method is using the CUPS Web interface

    1. Login to the CUPS interface at: http://localhost:631/
    2. Click on the ‘Printers’ tab
    3. Click on the Printer that is having issues from the list on the page
    4. Click on the ‘Maintainence’ Drop box
    5. Select ‘Resume Printer’

    You should get a message like: “Printer Deskjet_F300_series has been resumed. and you are done.

    Hope this helps someone.

    – Suramya

    February 27, 2010

    How to use UDP Tunneling to avoid hotspot or firewall restrictions

    Filed under: Computer Security,Knowledgebase,Tech Related — Suramya @ 11:59 PM

    A lot of times when you connect to a wireless hotspot or a network there are restrictions in place which prevent you from accessing the web without some sort of authentication or restrict the kind of connections allowed. Usually that’s not a problem but at times you need to be able to bypass the restrictions.

    In normal cases the firewalls in place usually allow outgoing connections to pass through but in some cases even outbound connections are blocked or you need to pay for access. In such cases you can use UDP Tunneling to bypass any restrictions.

    Keep in mind that using such methods on a network will not endear you to your network administrator and if caught might cause you trouble. You might even end up in Jail. So don’t try to use this for anything illegal or to browse porn at work.

    The way it works is that when you try to browse to a website your system sends a request to a name server on UDP Port 53. On a lot of hotspots/firewalls/proxies the system waits for the Name server to respond and when it gets a response it redirects you to a login page or redirects you to a web proxy. What allows us to do a UDP tunnel is the fact that all port 53 UDP traffic is allowed out to anywhere on the web, without any kind of authentication.

    So if you have a VPN configured to connect over UDP port 53 instead of the default port 1194 then you should be able to bypass the restrictions.

    Basically what you have to do is setup a OpenVPN server on a public server and then configure it to use port 53 instead of the default 1194. Once you do that you can configure your VPN client on a laptop to connect to the server on port 53. Once connected all new connections will go over the VPN connection and you should be able to browser the web without issues or blocks.

    Thanks to Adam Palmer for the tip.

    [Update 11/26/2014] Please use the updated link iodigitalsec.com as the original one is broken.

    I think I am going to set up a VPN server on my desktop so when I am away from home and need web access I can use this technique to get access.

    – Suramya

    February 24, 2010

    Getting Wireless on my HP Pavilion DV5000 to work on Linux

    Filed under: Computer Software,Knowledgebase,Linux/Unix Related,Tech Related — Suramya @ 10:46 PM

    I have heard that connecting to wireless networks can give a lot of trouble in Linux. I have even experienced the same when I tried out Debian and Red Hat Enterprise Linux (RHEL) 5 on my HP Pavilion DV5000 laptop. In Debian I managed to get the card working but on RHEL I couldn’t get it to work.

    Actually I could have gotten it to work but lacked the time to spend trying out various solutions. Plus the final solution wasn’t very elegant or portable. Basically what I ended up doing was hardcoding the config file to connect to a particular wireless network. Which obviously wasn’t a very portable solution.

    When I decided to try out Backtrack 4 which is a Linux-based penetration testing distribution that is based off Ubuntu I was worried that my wireless card (Broadcom BCM4318) would again cause issues. If you have been using Linux then you probably have heard of this-chip set as earlier versions of Linux had a lot of problems getting this card to work and so I was expecting a lot of work before I got the card to work.

    While the OS was installing I did a little search on google and that reminded me of a post on Tech Republic that talked about 10 tools to connect to wireless networks in Linux so I decided to try out each of them to see which one worked for me.

    Fortunately for me the first program I tried (wicd) solved my problem. All I had to do to get the network working was: log in as root and then run the following command:

    /etc/init.d/wicd start

    Once I ran the command all my network cards were automatically detected and I could configure them. However since its a pain to configure the cards manually, I ran the following command to start the GUI based client for wicd:

    wicd-client

    When you run wicd-client a new icon shows up in the system tray (next to the clock) and if you double click on the icon the Wicd manager starts and allows you to configure any wireless/wired network that the system detects.

    Over all, wicd is quite easy and a lot more intuitive than the default KDE Network manager, plus another advantage is that wicd supports WPA which the default KDE Network manager doesn’t.

    Now that I have gotten the card working on Ubuntu I am going to re-install RHEL on the laptop and see if wicd can get the card working over there also. But that’s work for another day.

    – Suramya

    February 13, 2010

    Determine If Shell Input is Coming From the Terminal or From a Pipe

    Filed under: Knowledgebase,Linux/Unix Related — Suramya @ 2:23 AM

    Figuring out if the input to a script is coming from the terminal or from a pipe is not something that I have ever had to use but I found the possibility very interesting so sharing it over here:

    #!/bin/bash
    
    stdin="$(ls -l /dev/fd/0)"
    stdin="${stdin/*-> /}"
    ftype="$(stat --printf=%F $stdin)"
    
    if   [[ "$ftype" == 'character special file' ]]; then 
    	echo Terminal
    elif [[ "$ftype" == 'regular file' ]]; then 
    	echo Pipe: $stdin
    else
    	echo Unknown: $stdin
    fi
    

    – Suramya

    Source: Linux Journal

    January 20, 2010

    List all machines connected to a LAN with additional details on each

    Filed under: Knowledgebase,Security Tools,Tech Related — Suramya @ 12:15 AM

    If you ever had to figure out how many systems are connected to a network and what IP’s they have then you will find this tip useful. It is also useful to identify any rouge machines on your network if you know how many systems are supposed to be there on that network. Like in case of my home network, where I know the exact no of machines.

    There are multiple software out that, that allow you to do this. Some are free, some are very expensive. In my opinion the best one is nmap. It is free, fast and can be scripted.

    To find all machines on my LAN (IP Range: 192.168.2.x) I just have to issue the following command:

    nmap -sP 192.168.2.0/24

    This gives an output like the following when I run it as a normal user:

    suramya@Wyrm:~$ nmap -sP 192.168.2.0/24

    Starting Nmap 5.00 ( http://nmap.org ) at 2010-01-20 00:01 IST
    Host 192.168.2.1 is up (0.0018s latency).
    Host 192.168.2.5 is up (0.00018s latency).
    Host 192.168.2.100 is up (0.00018s latency).
    Nmap done: 256 IP addresses (3 hosts up) scanned in 2.93 seconds

    When I run the same command as root, it gives me additional information that looks like:

    Wyrm:~# nmap -sP 192.168.2.0/24
    Starting Nmap 5.00 ( http://nmap.org ) at 2010-01-19 23:50 IST
    Host 192.168.2.1 is up (0.0015s latency).
    MAC Address: 00:XX:XX:XX:XX:XX (Cisco-Linksys)
    Host 192.168.2.5 is up.
    Host 192.168.2.100 is up (0.011s latency).
    MAC Address: 00:XX:XX:XX:XX:XX (Intel)
    Nmap done: 256 IP addresses (3 hosts up) scanned in 3.00 seconds

    In this case, as you can see nmap also gives me the MAC address of the machine. 192.168.2.5 is the machine I ran the scan from so I didn’t get any information on that one.

    If you want additional details on a system you can issue the following command to get the system to try and identify the OS and services running in detail.

    nmap -A 192.168.2.5

    It gives an output that looks something like:

    Wyrm:~# nmap -A 192.168.2.5
    Starting Nmap 5.00 ( http://nmap.org ) at 2010-01-19 23:52 IST
    Interesting ports on 192.168.2.5:
    Not shown: 995 closed ports
    PORT STATE SERVICE VERSION
    22/tcp open ssh OpenSSH 5.1p1 Debian 8 (protocol 2.0)
    | ssh-hostkey: 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx (DSA)
    |_ 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx (RSA)
    80/tcp open http Apache httpd 2.2.14 ((Debian))
    |_ html-title: Index of /
    139/tcp open netbios-ssn Samba smbd 3.X (workgroup: WORKGROUP)
    445/tcp open netbios-ssn Samba smbd 3.X (workgroup: WORKGROUP)
    631/tcp open ipp CUPS 1.4
    Device type: general purpose
    Running: Linux 2.6.X
    OS details: Linux 2.6.17 – 2.6.28
    Network Distance: 0 hops
    Service Info: OS: Linux

    Host script results:
    additional information on the server

    Hope you also find this useful.

    – Suramya

    January 5, 2010

    Having a Translucent cursor in KDE4 on Debian Testing (Squeeze)

    Filed under: Knowledgebase,Linux/Unix Related — Suramya @ 11:03 PM

    One of the things I liked about KDE3.5 and KDE4 on Ubuntu was that the mouse cursor was this translucent arrow which looked a lot better than the default one on Windows. When I switched to Debian for some reason I didn’t have that theme installed by default. So I tried searching for it but couldn’t find the theme as its kind of hard to search for translucent cursor in kde and get sensible results.

    Today I decided to search again and found this forum post about customizing Ubuntu. Over there he mentioned the names of the the cursor themes installed on Ubuntu. Using that as a base I did some more digging/searching and finally found the name of the package I had to install to get my translucent cursor back.

    The package you have to install is called ‘xcursor-themes’ and the theme I needed is called ‘whiteglass’. On Debian you can install it by issuing the following command: apt-get install xcursor-themes

    Hope this helps.

    – Suramya

    December 30, 2009

    Getting my HP-Deskjet F380 scanner/printer/copier working on Debian Squeeze

    Filed under: Knowledgebase,Linux/Unix Related — Suramya @ 11:20 PM

    I have a HP Deskjet F380 All-in-One scanner/printer/copier systems and it is a great machine. I plugged it into my system and started GIMP to scan an image from it. Within about 20 seconds of me powering on the printer I got a popup message in Gimp telling me that my HP printer is ready for use. I printed a test page and it came out fine.

    Then I tried to scan an image and I got a message back from SANE that it didn’t find any devices. Checked the system log in /var/log/system and noticed the following error message in the log:

    Dec 28 13:36:04 Wyrm python: io/hpmud/musb.c 136: unable get_string_descriptor -1: Operation not permitted
    Dec 28 13:36:04 Wyrm python: io/hpmud/musb.c 603: invalid product id string ret=-1

    Did a search on the net about the error message and in one of the forums it suggested that I run hp-check to see if I was missing any of the required files. The program gave me a list of missing dependencies that I installed. But the problem still wasn’t solved.

    While searching for a solution I found a post on a forum that stated that this person was able to scan an image when running as root but not as a regular user. So I decided to try running xsane as root. When I did that the program ran successfully and detected my scanner. I was also able to scan an image without any issues.

    However since its not a good idea to run programs as root, I needed a permanent fix. The same forum gave me a not so elegant but permanent solution to try.

    To fix the problem run lsusb and locate the line containing your printer information. On my system the output of the command is:

    Bus 002 Device 002: ID 046e:556a Behavior Tech. Computer Corp.
    Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 001 Device 009: ID 03f0:5511 Hewlett-Packard DeskJet F300 series
    Bus 001 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
    Bus 001 Device 003: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

    As you can see the third line gives the the information for my Printer. Now we need to get the vendor and product ID for the printer. The first set of alphanumeric after the ID is the Vendor ID and the numbers after the ‘:’ denote the Product ID. In my case the ‘Vendor ID’ = 03f0 and the ‘Product ID’ = 5511.

    Once we have that information we need to create a new file as root at ‘/etc/udev/rules.d/99-custom.rules‘ with the following content:

    ATTR{idVendor}==”VendorID”, ATTR{idProduct}==”ProductID”, MODE=”0666″, GROUP=”lp”

    where the ProductID and VendorID are the values we got earlier. Once you make the changes, save the file. Then you can disconnect the printer and reconnect it for the new changes to take effect and your scanner will be ready for use.

    Another approach which could have worked was to add the user scanning the image to the group ‘lp’ and ‘scanner’ to give them access to the printer. Keep in mind that I haven’t really tried this approach yet

    Thanks to Meson at LinuxQuestions.org for the steps to make the printer accessible to all users.

    Hope this helps.

    – Suramya

    « Newer PostsOlder Posts »

    Powered by WordPress