Ubuntu Notes and How-Tos

Sunday, August 21, 2005

Moving my Ubuntu Hoary to another partition without reinstalling


/dev/hda1 was where My Windows XP Home resided. After weeks of waiting for that one reason why I shouldn't wipe it out and go Ubuntu all the way, I didn't find any. So tonight I made that final decision --no more Windows (dual-booting).


/dev/hda3 was where my Ubuntu was temporarily and happily serving. Now is the time for it to be moved to its rightful place.


As usual, I googled first and took me to linuxquestions.org. One thread looked promising. It was a question about how to move his Mandriva to another drive. After reading the whole posting, I decided to try the solution given by kilgoretrout; it worked without a hitch. Thanks dude, you da man!


So here's a play-by-play account of how I did it.But first, a backgrounder. I had a bunch of Live CDs in my arsenal including Knoppix but I opted for sysrescd. Remember, I wanted to move my Ubuntu which was in /dev/hda3 to /dev/hda1 (which was then occupied by WIndows XP Home); but the rest of the partitions are left intact such as the swap, the /home, etc. So now I proceed to where just after sysrescd gave me the root prompt (after I booted my laptop using CD-ROM, of course):



  1. # mkdir /mnt/x

  2. # mkdir /mnt/x/{orig,new}

  3. # mount -t ext3 /dev/hda3 /mnt/x/orig

  4. # mount -t ext3 /dev/hda1 /mnt/x/new

  5. # cd /mnt/x/orig

  6. # tar -cf - . | (cd /mnt/x/new; tar -xvf -)

  7. Waited for a few minutes, and then...

  8. I edited /mnt/x/new/etc/fstab to reflect the new reality --really minor changes

  9. And then I edited /mnt/x/new/boot/grub/menu.lst --again, to reflect the new reality

  10. # reboot



I crossed my fingers, expecting for the worst. First came the Debian3 splash screen (from Splashy), then the gdm, and after logging in, came the familiar login sound, and finally my desktop. Mission accomplished. Bye bye Windows.

Wednesday, August 17, 2005

Constraining the stylus to a specific monitor in a dual-headed setup

The setup:
- Notebook (1280x768 res)
- 20" CRT monitor (1024x768 res)
- Xinerama enabled

Xinerama allows you to have an uncluttered view of the second monitor (uncluttered being that there's no top and bottom panels). Therefore, it is extremely convenient to use the extended monitor exclusively for GIMP or Inkscape occupying the whole screen.

Now my problem was that since Xinerama stretches/extends the desktop all the way to the next monitor, my tablet's (a Wacom Graphire) resolution becomes very skewed. In this setup, I'd be editing graphics using only 1/3 of the tablet! Now, wouldn't it be nice if I could have the whole tablet space exclusively for the entire single screen/monitor. I'm much faster anyway using the shortcut keys for the tools and such --especially with Inkscape.

So it turns out (after a couple of hours or so of Googling) that it is indeed possible. In fact, it only needed a single line of code. Here's the whole config file:

/etc/X11/xorg.conf:

Section "Files"
FontPath "unix/:7100" # local font server
# if the local font server has problems, we can fall back on these
FontPath "/usr/lib/X11/fonts/misc"
FontPath "/usr/lib/X11/fonts/cyrillic"
FontPath "/usr/lib/X11/fonts/100dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/75dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/Type1"
FontPath "/usr/lib/X11/fonts/CID"
FontPath "/usr/lib/X11/fonts/100dpi"
FontPath "/usr/lib/X11/fonts/75dpi"
# paths to defoma fonts
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/CID"
EndSection
Section "Module"
Load "bitmap"
Load "dbe"
Load "ddc"
Load "dri"
Load "extmod"
Load "freetype"
Load "glx"
Load "int10"
Load "record"
Load "type1"
Load "vbe"
EndSection
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "keyboard"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "fi"
EndSection
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "Emulate3Buttons" "true"
Option "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizScrollDelta" "0"
Option "SHMConfig" "true"
Option "MaxTapTime" "0"
EndSection
# WACOM GRAPHIRE
Section "InputDevice"
Driver "wacom"
Identifier "cursor"
Option "Device" "/dev/input/event2"
Option "Type" "cursor"
Option "Mode" "Relative"
Option "USB" "on"
EndSection
Section "InputDevice"
Driver "wacom"
Identifier "stylus"
Option "Device" "/dev/input/event2"
Option "Type" "stylus"
Option "USB" "on"
Option "Mode" "Absolute"
Option "ScreenNo" "1"
EndSection
Section "InputDevice"
Driver "wacom"
Identifier "eraser"
Option "Device" "/dev/input/event2"
Option "Type" "eraser"
Option "USB" "on"
Option "Mode" "Absolute"
EndSection
#
# VGA PORTS
#
Section "Device"
Identifier "Intel Head 1"
Driver "i810"
BusID "PCI:0:2:0"
Option "XaaNoOffscreenPixmaps"
Option "MonitorLayout" "CRT,LFP"
Screen 0
EndSection
Section "Device"
Identifier "ExternalPort"
Driver "i810"
BusID "PCI:0:2:0"
Option "XaaNoOffscreenPixmaps"
Screen 1
EndSection
Section "Monitor"
Identifier "LCD"
Option "DPMS"
HorizSync 28-49
VertRefresh 43-72
Modeline "1280x768" 80.14 1280 1344 1480 1680 768 769 772 795
EndSection
Section "Monitor"
Identifier "CRT"
Option "DPMS"
HorizSync 27-79
VertRefresh 55-90
Modeline "1280x1024" 110 1280 1328 1512 1712 1024 1025 1028 1054
EndSection

Section "Screen"
Identifier "Default Screen"
Device "Intel Head 1"
Monitor "LCD"
DefaultDepth 16
SubSection "Display"
Depth 16
Modes "1280x768"
EndSubSection
EndSection
Section "Screen"
Identifier "Second Screen"
Device "ExternalPort"
Monitor "CRT"
DefaultDepth 16

SubSection "Display"
Depth 16
Modes "1024x768"
EndSubSection
EndSection
Section "ServerLayout"
Identifier "DefLayout"
Screen "Default Screen"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
InputDevice "Synaptics Touchpad"
EndSection

Section "ServerLayout"
Identifier "DualHead"
Screen 0 "Default Screen" LeftOf "Second Screen"
Screen 1 "Second Screen" 0 0
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
InputDevice "Synaptics Touchpad"
Option "Xinerama" "false"
EndSection

Section "ServerLayout"
Identifier "DualHeadTablet"
Screen 0 "Default Screen" LeftOf "Second Screen"
Screen 1 "Second Screen" 0 0
InputDevice "Generic Keyboard"
InputDevice "Synaptics Touchpad"
InputDevice "Configured Mouse"
InputDevice "cursor" "SendCoreEvents"
InputDevice "stylus" "SendCoreEvents"
InputDevice "eraser" "SendCoreEvents"
Option "Xinerama" "On"
EndSection

Section "DRI"
Mode 0666
EndSection


I didn't want to include the eraser though coz it's fast and convenient to point and click using a big point so I didn't include it in the config.

Notice that I got three different ServerLayouts. My default is mobile mode (which is the main reason I bought this notebook so that I could take it with me to school, library, or wherever). When I'm at home, I use the DualHead mode so that I could use the extra monitor. But I purposefully disabled the Xinerama because I like to have two distinct desktops (with their own panels, etc) each running different tasks --say browsing in monitor 1 and terminals, IDE's, etc, in monitor 2. In that way, the cognitive demarcation is clear.

For those not so frequent times where I use the graphics softwares, then I use the DualHeadTablet mode. I just 1) 'sudo killall gdm', 2) relogin, then 3) 'startx -- -layout DualHeadTablet'. That's all there is to it. This whole FOSS/GNU/Linux thing rocks!

Tuesday, August 16, 2005

Dual-headed Laptop


/etc/X11/xorg.conf



Section "Files"
FontPath "unix/:7100" # local font server
# if the local font server has problems, we can fall back on these
FontPath "/usr/lib/X11/fonts/misc"
FontPath "/usr/lib/X11/fonts/cyrillic"
FontPath "/usr/lib/X11/fonts/100dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/75dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/Type1"
FontPath "/usr/lib/X11/fonts/CID"
FontPath "/usr/lib/X11/fonts/100dpi"
FontPath "/usr/lib/X11/fonts/75dpi"
# paths to defoma fonts
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/CID"
EndSection

Section "Module"
Load "bitmap"
Load "dbe"
Load "ddc"
Load "dri"
Load "extmod"
Load "freetype"
Load "glx"
Load "int10"
Load "record"
Load "type1"
Load "vbe"
EndSection

Section "InputDevice"
Identifier "Generic Keyboard"
Driver "keyboard"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "fi"
EndSection

Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "Emulate3Buttons" "true"
Option "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizScrollDelta" "0"
Option "SHMConfig" "on"
EndSection

#
# THIS SECTION IS THE MEAT OF THE MATTER
#

# VGA PORTS
#

Section "Device"
Identifier "Intel Head 1"
Driver "i810"
BusID "PCI:0:2:0"
#PREVENTS DVD PLAYER FROM CRASHING (I'M USING gxine):
Option "XaaNoOffscreenPixmaps"
#THIS WAS MY HOLY GRAIL. COUNTLESS PERMUTATIONS UNTIL I FINALLY NAILED IT
Option "MonitorLayout" "CRT,LFP"
Screen 0
EndSection
Section "Device"
Identifier "ExternalPort"
Driver "i810"
BusID "PCI:0:2:0"
Screen 1
EndSection

Section "Monitor"
Identifier "LCD"
Option "DPMS"
HorizSync 28-49
VertRefresh 43-72
Modeline "1280x768" 80.14 1280 1344 1480 1680 768 769 772 795
EndSection
Section "Monitor"
#A ONE HUMONGOUS OF A MONITOR - "NEC MultiSync 6FG"
Identifier "CRT"
Option "DPMS"
HorizSync 27-79
VertRefresh 55-90
Modeline "1280x1024" 110 1280 1328 1512 1712 1024 1025 1028 1054
EndSection


Section "Screen"
Identifier "Default Screen"
Device "Intel Head 1"
Monitor "LCD"
DefaultDepth 16

SubSection "Display"
Depth 16
Modes "1280x768"
EndSubSection
EndSection
Section "Screen"
Identifier "Second Screen"
Device "ExternalPort"
Monitor "CRT"
DefaultDepth 16

SubSection "Display"
Depth 16
Modes "1280x768"
EndSubSection
EndSection

Section "ServerLayout"
Identifier "DualHead"

Screen 0 "Default Screen" LeftOf "Second Screen"
Screen 1 "Second Screen" 0 0

InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
InputDevice "Synaptics Touchpad"

Option "Xinerama" "true"
EndSection


Section "DRI"
Mode 0666
EndSection


Configuring MPD - Music Player Daemon

1) Create our 'mpd' user:





2) Then: $ sudo vim /etc/mpd.conf



3) Then create the database:




4) And then finally:

$ sudo /etc/init.d/mpd start

Saturday, August 13, 2005

gxine crashes when playing DVD movies

This happens when playing encrypted DVDs as the unencrypted ones just run fine. As it turns out, you need to put the following entries in your xorg.conf file (the one delimited with hashes).



So assuming all the codecs are in place, add these entries to /etc/X11/xorg.conf:




	Section "Device"
Identifier "Intel Corporation 82852/855GM Integrated Graphics Device"
Driver "i810"
BusID "PCI:0:2:0"
#################################
Option "XaaNoOffscreenPixmaps"
#################################
EndSection

Section "Screen"
Identifier "Default Screen"
Device "Intel Corporation 82852/855GM Integrated Graphics Device"
Monitor "Generic Monitor"
###################
DefaultDepth 16
###################

SubSection "Display"
Depth 1
Modes "1280x768"
EndSubSection

...

EndSection