Monday, May 14, 2012

Mounting a USB device

ASSUME:
Command line knowledge
How to get to be a root user

Despite all the promises, Linux often chokes when it comes to mounting a USB device such as a camera, phone, etc, it often chokes and its frustrating not knowing a way to get it to work.  Here it goes:

FIRST:
You need to be a root user to get this to work.  Often times that just means SUDO but you can also use SU as well.  If you type SUDO, type your username

(e.g. SUDO foo)...or whatever your name is.

Type in your normal password and you're a root user.  SU works the same way but you don't need to type a username...just SU (super user in other words) and you need to know the ROOT password to do it.  Most distros are going the SUDO route so chances are try that.

SECOND:
lsusb  (list USB devices...linux people hate to type)

This will just ensure you have a USB device in there. Look for the term 'usb in the list.

Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 004 Device 002: ID 045e:00dd Microsoft Corp. Comfort Curve Keyboard 2000 V1.0
Bus 004 Device 003: ID 045e:0040 Microsoft Corp. Wheel Mouse Optical
Bus 001 Device 006: ID 22b8:70c6 Motorola PCS

In this example, you'll see the USB-2.04-Port HUB.  Ya, that looks about right and this tells us that USB is working. 

You could also type:

lsusb | grep USB

This would filter out the list to only show anything with USB in the name.  Don't ya love greg!

THIRD
Now that we KNOW we have a USB device, let's see what the drive is that mounts it.  Fortunately, we have a miracle command called DMESG.  This lists all the messages recently printed.  Naturally we want the find any USB devices. 


dmesg (let it scroll past you.  We want the end of the list...NOT...anything else.


[ 2432.904237] sr 8:0:0:2: Attached scsi generic sg6 type 5
[ 2432.914538] sd 8:0:0:1: [sde] Attached SCSI removable disk
[ 2432.918523] sd 8:0:0:0: [sdd] Attached SCSI removable disk
[ 2435.563830] sd 8:0:0:1: [sde] 15572992 512-byte logical blocks: (7.97 GB/7.42 GiB)
[ 2435.565942] sd 8:0:0:1: [sde] No Caching mode page present
[ 2435.565950] sd 8:0:0:1: [sde] Assuming drive cache: write through
[ 2435.570814] sd 8:0:0:1: [sde] No Caching mode page present
[ 2435.570820] sd 8:0:0:1: [sde] Assuming drive cache: write through
[ 2435.573677]  sde: sde1
[ 2441.705601] sd 8:0:0:0: [sdd] 9050112 512-byte logical blocks: (4.63 GB/4.31 GiB)
[ 2441.707717] sd 8:0:0:0: [sdd] No Caching mode page present
[ 2441.707720] sd 8:0:0:0: [sdd] Assuming drive cache: write through
[ 2441.712716] sd 8:0:0:0: [sdd] No Caching mode page present
[ 2441.712718] sd 8:0:0:0: [sdd] Assuming drive cache: write throug




NOTICE: the 'removable disk.  Ya, that's what we want.  In this example we have sdd and sde telling us that there are two drives associated with the device.  We'll mount both.

Now, on some distro's they create a /media directory and you mount things there.  The default is always /mnt but honestly you can mount it anywhere.  I tend to use /mnt but its up to you.

mkdir /mnt/FRED
mkdir /mnt/FRED2

mount /dev/sdc /mnt/FRED
mount /dev/sde /mnt/FRED2

HU???

Well, easy.  mount is the command that tells us to mount the device.  It takes two parameters.  The first is the source and the second is where you want to mount it.

/dev/sdc comes from dmesg and /mnt/FRED is the directory (folder) I created to mount the device.  Ya, Fred isn't too original but you can come up with something more original.

That's it.  You should now see the data in /mnt/FRED and /mnt/FRED2

I tend to just cd into that directory (I'm not covering cd here) but you can use a file manager such as nautilus if you want.


Sunday, May 13, 2012

Kernel Parameters

ASSUME:
This is advanced so no beginners for this one.
How to edit grub to modify the kernel parameters
Know what a kernel parameter is:


Editing the kernel is one thing but modifying boot options is another.  In this entry, we're going to modify some kernel parameters that are really useful -- especially when headaches arrive. 
In Grub1, or Grub2 you are allowed to edit the Kernel parameters by simply modifying the line that launches the kernel.



(Yes I know it wraps to the next line...sorry
kernel        /vmlinuz-3.2.0-23-generic-pae root=UUID=65c84575-96be-4380-b4d8-1b1d6292816d ro

This is a typical line for a kernel in the grub menu.

kernel - saying we have a kernel
where to find the kernel - /vmlinuz-3.2.0-23-generic-pae root=UUID=65c84575-96be-4380-b4d8-1b1d6292816d

ro - make it read only...handy

Anyway, here are some items you can place to the right of that line to make it more functional.

quiet - 
I don't like this but its typically found to display displaying the bootup process.

splash -
 throw up a splash screen which I don't like either.

text - 
VERY handy.  Boot to text mode to avoid autoloading the graphic screen (GNU, XFCE, etc.)

nomodeset
Some distros (Ubuntu in particular) make the text screen a huge tiny size.  If you just want 80 * 25 for the size, make this option available.
NOTE: For Ubuntu, if you do that, you'll get one UGLY font.  Do this>

dpkg-reconfigure console-setup

check VGS not FIXED and you'll get a nice clean font.

noacpi, pci=noacpi
These are two separate options but essentially work on the same idea.  If you are having hang problems with an operating system, try this option(s).  It disables polling of the PCI bus for interrupts.  It can stabilize a system.  Treat this as a diagnostic.  If it works after this, chances are your BIOS is a problem.  Upgrade the bios.

That's it.

Wednesday, May 9, 2012

Smurf bug in Adobe

If you:

(a) Have the latest Adobe Flash player plugin
(b) Have the proprietary NVidia driver

You will see blue people due to a hue problem with the flash player. 


In short, try this:

sudo add-apt-repository ppa:tikhonov/misc
sudo apt-get update
sudo apt-get install libvdpau1
 
 
The patch is located here:
 
http://lists.freedesktop.org/archives/vdpau/2012-May/000022.html
 
This is a patch that works around the adobe flash problem. What is the problem????
 
Read this link in its entirety.
 
http://askubuntu.com/questions/117127/flash-video-appears-blue

Sorry this is so short but there are only so many hours in a day.

 
Try another link:
http://www.nvnews.net/vbulletin/showthread.php?t=177380

Monday, May 7, 2012

Install Grub2 from a LiveCD

KNOW:
Command line basics
chroot
grub

You would think that installing Grub...or GRUB2 from a LiveCD will be an easy task -- think again.  There is a lot to know so let's get to it.

1) Boot to a liveCD.  Most graphic LiveCD's take 20 years to bootup -- Ubuntu being a great one for that but you can get text only LiveCD's so look for em.

2) Run terminal.  You need to get to a terminal to make this work.

3) We're now going to make the installed version of linux work instead of the LiveCD. This is tricky so let's get to it.

(a) you MUST know the partitian for your boot (/boot) and your mnt (/) locations.
In this example, we're going to use /sdb6 for our root (/) and /sdb1 for our boot.  Most installations don't separate the two but I'm giving you the extreme example.

sudo /mnt/sdb6 /mnt

Here we mount the entire partitian to the /mnt directory.

sudo /mnt/sdb1 /mnt/boot

(IF your boot partitian is different, otherwise leave alone)

Now we're going to point three directories (/proc /dev /sys) to our new mount point.

mount -t proc none /mnt/proc
mount -o bind /sys /mnt/sys
mount -o bind /dev /mnt/dev  (the devices)
cp -L /etc/resolv.conf /mnt/etc/resolv.conf

The purpose of this is to simply avoid host name errors

chroot /mnt/ /bin/bash  (most critical)
env-update 
source /etc/profile 
export PS1="(chroot) $PS1"

NOTE:
cp /proc/mounts /etc/mtab

(use this if you plan to reinstall grub)

sudo grub-install /dev/sdb1

That should shove it on the boot of the drive.