Posts Tagged Linux

Correctly Recognize Alps Touchpad on Dell E6510 in Linux

Laptops which use newer Alps touchpad hardware may experience some lack of functionality as a result of a regression in the kernel psmouse driver — the touchpad is detected and works as a pointing device, but only functions with basic features. Scrolling, disabling tap-to-click, off when typing, and multi-touch (on supported devices) are some of the missing functionality. This appears to be the case with E5510, E6410, M6400, and other Dell (potentially all E2) and some non-Dell models.

From Simon Dierl:

Apparently, newer ALPS touchpads use a new, undocumented and unsupported protocol. The touchpad falls back to a legacy emulation mode, resulting in faulty detections. The kernel.org bug lists some efforts to reverse-engineer the protocol and has some patches based on DELL contributions that enable ImPS/2 emulation (scrolling works). This, however, still does not allow for synaptics support (turn off when typing, horizontal scroll, etc.). Additionally, some people report problems on suspend/resume. [sic]

The best way to notice if you have a machine which is affected by this bug, is to go to System > Preferences > Mouse and look for a Touchpad tab. If it’s absent, you are probably affected by this bug.

Another way to see if you are affected by this bug is to run lsinput and look for something like the following:

/dev/input/event9
bustype : BUS_I8042
vendor  : 0x2
product : 0x1
version : 0
name    : "PS/2 Generic Mouse"
phys    : "isa0060/serio1/input0"
bits ev : EV_SYN EV_KEY EV_REL

The above output shows the touchpad being identified and driven by the PS/2 driver.

This bug has been entered into Launchpad as bug #606238 and has its roots in Kernel bug #14660. Since it’s a mainline kernel bug, it’s likely to affect every Linux distribution. So far, it’s still a work-in-progress and there’s not been an accepted patch submitted to the Linux kernel team. There’s a discussion on ubuntuforums.org that this is a regression, and this was working in older kernel versions.

The below is based on a patch from cmg238 which, at the very least, causes the kernel to correctly recognize the device as a touchpad and enable some missing functionality. I have made adjustments to the instructions for clarity and explanation.

Download kernel source (to /usr/src):

sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)
apt-get source linux-image-$(uname -r)

(Note: in Ubuntu Precise 12.04, do the following instead, based on this LaunchPad comment)

sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)
sudo git clone git://github.com/bgamari/linux.git
cd linux
sudo git checkout origin/alps
sudo cp /boot/config-$(uname -r) .config

Also note that on Ubuntu Precise 12.04, you will be asked a bunch of additional questions at make-time. Accept the defaults, unless you have a reason to do otherwise.

Read about how to “undo” an apt-get build-dep and uninstall previously installed packages here.

Patch drivers/input/mouse/alps.c by locating alps_model_info and adding the additional line below, as follows:

static const struct alps_model_info alps_model_data[] = {
	{ { 0x73, 0x02, 0x64 }, 0xcf, 0xcf, ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Dell Latitude E6510 */

Compile psmouse.ko module

cd src/drivers/input/mouse
make -C /lib/modules/`uname -r`/build M=`pwd` psmouse.ko

(On Ubuntu Precise 12.04, use the following instead:)

cd /usr/src/linux/drivers/input/mouse
make -C /lib/modules/`uname -r`/build M=`pwd` psmouse.ko

The following steps will cause you to lose mouse functionality until the modprobe psmouse statement. Be prepared. Also, You may want to backup your existing /lib/modules/(kernel version)/kernel/drivers/input/mouse/psmouse.ko before doing this!

rmmod psmouse
cp psmouse.ko /lib/modules/`uname -r`/kernel/drivers/input/mouse/
modprobe psmouse

The last thing to mention is if you update your kernel you will receive the distributed psmouse.ko module. If the kernel does not include a fix for this bug you will need to follow the directions in this post again to recompile the above patch back into the kernel.

Since this is a mainline kernel issue, I would ask that any reader who is able to, please visit the links within this post and contribute where ever you can to help in getting this resolved. You are welcome and encouraged to share your thoughts and feedback in the comments below as well.

, , , , , , , , ,

Leave a comment

Windows, Linux dual-boot system time issues

Multiple Boot Systems Time Conflicts

From The Ubuntu Community:

Operating systems store and retrieve the time in the hardware clock located on your motherboard so that it can keep track of the time even when the system does not have power. Most operating systems (Linux/Unix/Mac) store the time on the hardware clock as UTC by default, though some systems (notably Microsoft Windows) store the time on the hardware clock as the ‘local’ time. This causes problems in a dual boot system if both systems view the hardware clock differently.

The advantage of having the hardware clock as UTC is that you don’t need to change the hardware clock when moving between timezones or when Daylight Savings Time (DST) begins or ends as UTC does not have DST or timezone offsets.

Changing Linux to use local time is easier and more reliable than changing Windows to use UTC, so dual-boot Linux/Windows systems tend to use local time.

Since Ubuntu Intrepid (8.10), the hardware clock is set to UTC by default.

Make Windows use UTC

Note: This method was not initially supported on Windows Vista and Server 2008, but came back with Vista SP2, Windows 7 and Server 2008 R2.

To make MS Windows calculate the time from the hardware clock as UTC.

Via regedit:

Run regedit and navigate to

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation

Right-click in the right-side panel and select New > DWORD Value. Create the key named RealTimeIsUniversal and give it a value of 1.

Using a registry file

Create a file named WindowsTimeFixUTC.reg with the following contents and then double click on it to merge the contents with the registry:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
"RealTimeIsUniversal"=dword:00000001

Make Linux use ‘Local’ time

To tell your Ubuntu system that the hardware clock is set to ‘local’ time:

1. edit /etc/default/rcS

2. Set UTC=yes if your hardware clock is set to UTC (GMT), or UTC=no to have the hardware clock set to local time.

It’s come to my attention that this issue also affects Macs which dual boot via bootcamp or other methods. 

Questions, comments, and feedback is welcome and appreciated.

, , , , , , ,

Leave a comment

Upgrading Ubuntu and closed-source VirtualBox editions

If you’re using the closed-source version (the non-OSE) of VirtualBox for virtualization, upgrading your Ubuntu version will likely break your VirtualBox installation. This is because VirtualBox uses dkms to automatically pull in and recompile the kernel modules during a kernel upgrade, but when you upgrade your Ubuntu version, the third-party repository is disabled for compatibility.

What you need to do is re-add the repository line for VirtualBox in Synaptic. This is very easy. It’s important to understand that none of the steps listed here will harm your existing VMs — those files are located in ~/.virtualbox for older installs, and “~/VirtualBox VMs” (and the equivalent on Windows machines) in newer installs. You may want to consider backing those files up somewhere else before starting.

Assuming that your Ubuntu upgrade is already complete, you need to know the nickname for your Ubuntu version. This is easily found at System > About Ubuntu.

Once you’ve found that, simply re-add the correct repository line using the following steps:

Step 1 – Find your version

Go to the VirtualBox download page and find the repository line for your version of Ubuntu.

Although VirtualBox development is kept close to the Ubuntu release schedule, new repository lines may not be immediately available after a new Ubuntu release is launched. Simply check back to that page until they have posted the new repository.

Step 2 – Install dkms

This may be required for other programs, but you will want to make sure dkms is installed to keep the VirtualBox modules up to date after installation. Install dkms using your favorite package manager or enter the following command at a terminal:

sudo apt-get install dkms

(I noticed that VirtualBox 4 installs dkms as a dependency — previous versions may as well. It’s always best to play it safe.)

Step 3 – Enter the repository information in Synaptic Package Manager

Open Synaptic and follow the following menu trees to add the new repository line.

system > administration > synaptic package manager

settings > repositories

Click other software tab

Click add button

Paste your repository line that matches your version, found at the VirtualBox website, here.

Close and click reload.

Step 4 – Install VirtualBox

Now, install the virtualbox-4.0 (or the current version) using your favorite package manager, or enter this at a terminal:

sudo apt-get install virtualbox-4.0

If you experience issues with message related to no key, no signature, or bad signature, refer to the VirtualBox Linux Downloads page for information on resolving that. The messages are generally safe to ignore, though more cautious users may want to install the signing key to make sure the downloads have the correct digital signature.

Questions, comments, and feedback are welcome and appreciated.

, , ,

Leave a comment

Backing up your server using JungleDisk Server Edition – part 2

In part 1, I told you how to set up JungleDisk backup for your Linux server. In this part 2, I’ll tell you how to automatically have it dump and backup your MySQL databases (correctly)!

There are security implications if this permissions are not set correctly on the files, as you’re storing your MySQL password in the script, and you’re going to have complete database dumps sitting on your hard drive. However, I will attempt to explain as clearly as possible my solution, and I’m not responsible if it doesn’t work for you.

So, start out by deciding where you want your database-dumping script to run from. A few good example spots are /root (root users home directory), and /etc/jungledisk (with the configuration files). I’ve called my backup script prebackup.sh. You’ll understand the name further below, but I’m going to use that name the rest of the way through.

So create your prebackup.sh script as root, and set it to mode 700.

touch prebackup.sh && chmod 0700 prebackup.sh

This makes sure that root is the only user who can read, write, or execute it.

Now, using your favorite text editor, you can use the following sample script:

#!/bin/bash
date=`date -I`
dir=/var/backups
file=sqlbackup-$date.sql
touch $dir/$file &&
chmod 600 $dir/$file &&
mysqldump --all-databases -p'__MySQLPassword__' >> $dir/$file
find $dir -ctime +7 -delete

Danny pointed out that creating gzipped MySQL dumps, as I had in my original script, is discouraged as it defeats the data de-dup feature of jungledisk. The above script has been changed from the original to make uncompressed dumps. Thanks, Danny!

The last line, with the find statement, is responsible for the cleanup of the directory. It will delete any file which is older than 7 days. If you want more or less time, simply change +7 to your desired number of days (keeping the + sign).

Warning: There’s very little (read: none) sanity-checking in this script. Replace __MySQLPassword__ with your root MySQL password.

Jay pointed out that there will likely be issues with handling special characters in the SQL password. If you have any suggestions, please feel free to post them in the comments below. 

After saving, you should have a 183-byte (give or take) file with 0700 mode:

root@ve:/etc/jungledisk# ls -l prebackup.sh
-rwx------ 1 root root 183 Mar 24 17:08 prebackup.sh

You should make sure that the directory in $dir is owned by user and group root and mode 0700. This will make sure that noone else has access to your dumped databases. Now that you have your script, it’s time to automate it. You could schedule a cron job to run the script, but it’s easier to have JungleDisk run it for you at the start of every backup job.

Start your management-side program, login, and go to your server’s backup configuration. Under Backup Options, check Enable Pre and Post Backup Scripts. Now, click Configure, and in the Pre-Backup Script, enter the full path and filename of your newly created script, i.e. /etc/jungledisk/prebackup.sh.

That’s it!

Now, on your assigned schedule, the server engine will run your database dumping script, and start your backup job. Of course, make sure whatever directory you’re dumping your databases to is included in your backup set.

The last thing to note is this script is amazingly light; it doesn’t delete any old databases and it doesn’t do much else. You’re free to modify it, and I would greatly appreciate any feedback on your modifications.

Comments are welcome, as always.

, , , , ,

Leave a comment

Ubuntu CUPS Brother Print Self-Test Page Error

If you followed my previous article about setting up the Brother HL-2170W under Linux, and attempted to print a self-test page, you may hav e gotten the following less-than-helpful error message:

Print Self-Test Page Brother Error

Unable to send command to printer driver!

Unsupported format ‘application/vnd.cups-command’!

Two bugs have been reported against this in Launchpad (36532 and 510781) and one in Debian (381743), but the end result is that there are two options, “Print Test Page” and “Print Self Test Page.” The “Self-Test” is what generates the error. If you use the “Test Page”, it seems to work without error. The Launchpad pages show fixes/workarounds, but if printing works fine for you, it may be easier to simply let it be until it’s fixed upstream.

Questions, comments, and feedback are welcome in the comments.

, , ,

Leave a comment

Installing Skype on Ubuntu (or Debian) with updates for Skype URLs

This how to will show you how to install a Skype client in Ubuntu & Debian base operating system.

1. First of all you need to start up Synaptic Package manager. Go to System->Administration->Synaptic Package Manager

2. From Synaptic, go to Settings->Repositories. Click on Other  Software Tab. Check the box next to Canonical Partners.

3. Click Close, and Click ‘Reload’ at the top of Synaptic. Now you can locate Skype and install it from Synaptic or Ubuntu Software Center.

Now to install skype-action-handler to handle skype: URLs:

Download and install the Skype Action Handler
http://search.cpan.org/~ecarroll/Net-DBus-Skype-0.02/script/skype-action-handler (direct download link) and extract.

In a console, navigate to extracted files directory and run these as root:

perl Makefile.PL
make
make test
make install

For Mozilla (Firefox)
* Open Mozilla (Firefox)
* Type about:config in the address-bar to open the configuration editor.
* Use the scroll bar to navigate to the network.protocol… section.
* Check if the network protocol section includes a network.protocol-handler.app.skype key.
* If a key exists, edit it. If no key exists, create a key by right-clicking on any key and selecting New -> String from the pull-down menu.
* Enter network.protocol-handler.app.skype as the key name.
* Enter /usr/local/bin/skype-action-handler as the key value.

### For GNOME-aware browsers (Epiphany, Firefox 1.5)
Run the following two commands:

/usr/bin/gconftool-2 -s -t string /desktop/gnome/url-handlers/skype/command '/usr/local/bin/skype-action-handler "%s"'
/usr/bin/gconftool-2 -s -t bool /desktop/gnome/url-handlers/skype/enabled true

Thats it – Test Call should work in Firefox. UPDATE: Except, it doesn’t work here. I can’t give you a valid link because WordPress keeps eating it. :\ But, try this yourself in an html file:

skype:echo123?call

To undo the above gconftool key changes, you may run the following:

gconftool-2 --recursive-unset /desktop/gnome/url-handlers/skype

Original post by thestudio53 at http://blogs.skype.com/linux/2006/08/making_skype_links_work.html. Rewritten with updates for Ubuntu 10.04 and information from http://ubuntuforums.org/showthread.php?t=449543

Questions, comments, and feedback are welcome. Please share your experience with this so I can improve the guide. Thank you.

, , , , ,

Leave a comment

Backing up your server using JungleDisk Server Edition – part 1

 

This guide assumes you’re using a Debian-based (Ubuntu, Debian) build of Linux, and we’ll be using the 64-bit download from JungleDisk. The instructions don’t really change for the 32-bit version, except for the installer file name.

The first steps:

Go over to the JungleDisk Business page and sign up for, and download, the server edition. Now, this edition comes in two very important parts: The server-side program, and the management-side program.

The server-side program is what runs on your server. That’s the “backup engine” if you will. You will download the program appropriate for your server environment.

The management-side program is the program that you remotely connect to the “server” to configure it. You will download the program appropriate for running on your desktop computer.

It is fine to download the server-side version for Linux and the management-side version for Windows, if that is your configuration. In this case, I’m downloading the Linux .deb server-side installer for 64-bit linux, and the Windows management-side program. I can’t give you the actual download links; you’ll find them in your account page.

Now, on the server, I’m going to install the server-side engine as root. Navigate to the directory where you placed the downloaded file, and run:

sudo dpkg -i junglediskserver_315-0_amd64.deb

That will install the server. Follow the directions. Now, since it’s the deb package, it will automatically set up init scripts to make sure the jungledisk engine runs on startup. However, you will notice that at the end of the setup you were prompted to copy and edit an xml file. Copy /usr/local/share/jungledisk/junglediskserver-license-EXAMPLE.xml to /etc/jungledisk/junglediskserver-settings.xml

cp /usr/local/share/jungledisk/junglediskserver-license-EXAMPLE.xml /etc/jungledisk/junglediskserver-settings.xml

Now use your favorite editor to make a few changes to /etc/jungledisk/junglediskserver-settings.xml:

between and , enter your license key (found in your JungleDisk account).

Now, restart the jungledisk service.

/etc/init.d/junglediskserver restart

Myself, I also added my login user name and password between and respectively, but I don’t think it’s necessary. Worth keeping in mind if something doesn’t work right.

That’s all for the server-side configuration.

Now, on your management-side program, simply run the program and log into your JungleDisk account and your server should appear in the list. Double-click on it and the configuration screen will appear, where you can create backup sets and schedule them as you wish.

Want to correctly backup your MySQL databases in your backup set? See part 2 of this article, coming soon!

Comments are welcome, as always!

, , , , , ,

Leave a comment

How to get your Dell Service Tag from the command line in Windows and Linux

There’s plenty of times you can need the serial number (aka Service Tag) from a Dell machine, but not be able to physically look at the label. It’s a server in a datacenter, it’s your laptop and it’s on a dock, etc, etc. Fortunately, there are easy commands to get the serial number right from the command line in both Windows and Linux.

Windows:

From a command prompt, type:

wmic bios get serialnumber

Linux (Ubuntu and others):

From a terminal, type:

sudo dmidecode -s system-serial-number

Comments are welcome, as always.

, , ,

Leave a comment

WordPress, suPHP, and Ubuntu Server 10.04

If you have WordPress running under an unprivileged user account, you may have noticed that when trying to install or delete a plugin that it prompts you for FTP information. This is due to a rather unintuitive way that WordPress checks for file access:

The following code is from the get_filesystem_method() method in the wp-admin/includes/file.php file:

if( function_exists('getmyuid') && function_exists('fileowner') ){
    $temp_file = wp_tempnam();
    if ( getmyuid() == fileowner($temp_file) )
        $method = 'direct';
    unlink($temp_file);
}

This code creates a temporary file and confirms that the file just created is owned by the same user that owns the script currently being run. In the case of installing plugins, the script being run is wp-admin/plugin-install.php.

This may seem a little counter-intuitive, since the only thing WordPress really needs to be able to do is write to the wp-content/plugins directory.

If you’re on your own server (i.e. your own box or a VPS) and not worried about security implications, you can simply make the files owned by your web server process (usually www-data or nobody). This will have WordPress’ check succeed and no longer ask for your information.

If you’re on your own server and running a shared hosting environment, or just care about the security implications, you should install suPHP.

What are the security implications? If all web files are owned by the web server process, it’s extremely easy for someone to introduce malicious php code which can affect other sites on the server. Since the web server process has access to all of the web server files across the server, malicious code would have no problem gaining access to other files and directories on the server.

suPHP, configured correctly, causes all php scripts under a defined directory (usually /home) to run as the user account they are owned by. It also enforces other security measures, such as requiring that directories and files do not have write permissions for anyone other than the user.

I could go on and on about what it does, but my biggest struggle has been getting it to work. Installation is easy, but it’s painfully clear it does not work out of the box. After dozens of searches I found varying different ways of making it work, but sometimes drastic and not clean nor easy, few didn’t require recompiling something (which I wasn’t going to do), and none of them seemed to work.

After more than a day of searching and testing, I finally came up with a simple, elegant, working solution. Note that this was written and based on Ubuntu Server 10.04 64-bit, and libapache2-mod-suphp 0.7.1-1 and may or may not work for other platforms.

Install suPHP:

apt-get install suphp-common libapache2-mod-suphp

Edit the sites-enabled/xxxx.conf file for your VirtualHost

Inside your directive, add:

php_admin_flag engine off
AddHandler application/x-httpd-php .php .php3 .php4 .php5 .phtml
suPHP_AddHandler application/x-httpd-php
suPHP_Engine on

Lastly, edit /etc/suphp/suphp.conf and under ;Handler for php-scripts (at the bottom) change:

application/x-httpd-suphp="php:/usr/bin/php-cgi"

to

application/x-httpd-php="php:/usr/bin/php-cgi"

Restart apache and all should be well.

/etc/init.d/apache2 restart

Note: You might get an error message like the following:

Syntax error on line 7 of /etc/apache2/sites-enabled/example.com.conf:
Invalid command 'php_admin_flag', perhaps misspelled or defined by a module not included in the server configuration

In this case, check that you actually have the Apache PHP mod installed and enabled. In can get uninstalled or disabled on occasion when upgrading Apache. Here’s how to reinstall/reenable:

sudo apt-get install libapache2-mod-php5
sudo a2enmod php5

Checking that it’s working

Create a phpinfo.php file with the follow contents:

<?php phpinfo(); ?>

Call it via your browser and check the Server API line near the top: CGI / FastCGI means suphp is working. Anything else means it’s not.

Suphp is slow!

Yes, unfortunately suphp is slow. Suphp runs PHP scripts in CGI mode, which reportedly causes them to run slower. I would argue that the security advantages outweigh the need for fast scripts, but each situation is unique. You have to decide for yourself.

500 Internal Server Error

If you’re getting the 500 Internal Server Error, it means that suphp is probably working, but for some reason it won’t allow the script to run.

Check that you don’t have any PHP opcode caching (APC, etc) running. If you are running any type of PHP opcode cache suphp will never work. You must disable your opcode caching. If you’re using APC, you can disable it system-wide by simply editing /etc/php5/conf.d/apc.ini and commenting the line out with a semicolon as follows:

;extension=apc.so

Another element of importance is file permissions. SuPHP will fail (with a 500 Internal Server Error) any file that has permissions which are not allowed, as defined in /etc/suphp/suphp.conf. For example:

; Security options
allow_file_group_writeable=false
allow_file_others_writeable=false
allow_directory_group_writeable=false
allow_directory_others_writeable=false

Any file or directory with the attributes defined as allow=false will fail. Based on the configuration above, any file that is group- or world-writable will automatically fail. Same with directories. It’s best to leave these options alone (instead of changing them), and change the permissions on your scripts instead.

However, it is supposedly possible to disable it on a per-VirtualHost basis. I haven’t tested this.

Also check that your /var/log/suphp/suphp.log file isn’t over 2GB. If it is, rotate it or delete it.

If all else fails, check /var/log/suphp/suphp.log and /var/log/apache2/error.log for hints.

Many thanks to all of the blogs and articles that each held a piece of this puzzle. :)

, , , , , , , , ,

Leave a comment

Dell Latitude D630 touchpad “jumping” mouse cursor

A friend and I have been discussing an issue we’ve both been seeing on our laptops: The mouse cursor “jumps” when using the touchpad. It’s intermittent, unpredictable, and seemingly random, but it seems to jump about 3 inches straight up on the screen. It seems to happen only on Windows-based OSes; We both installed Ubuntu Linux at a point and didn’t notice it at all.

He pointed me to the R165805 Dell Touchpad / Pointing Stick driver from the Dell website.

I am using it on a D630 with Windows 7… it works, and solves the problem.

The listed compatibility is:

Systems Latitude D530
Latitude D630c
Dell Precision Mobile WorkStation M2300
Operating systems Microsoft Windows Vista 64-bit

Update 2/10/2013: gund brought to my attention that the download link is no longer active. Here is a direct link to the R165805.EXE file on Dell’s FTP site. If that ever becomes unavailable, you can try this driver, but I haven’t tested it myself: R165804 Dell Touchpad / Pointing Stick.

 

I’ll welcome any comments on this.

,

Leave a comment