Tips & tricks for Ubuntu

Intel: Dealing with the Suspend Bug

Intel users often run into an annoying bug: When you shut the laptop cover, the machine falls into a light sleep, from which it should theoretically awaken as soon as you open the cover again; however, some computers, especially those with Intel graphics, will hiccup, resulting in a black or frozen screen. This problem is well known to developers [1].

You don't necessarily need to restart the computer to fix the problem. Switching to a virtual terminal (VT) and giving the LightDM display manager a nudge is often enough. Unfortunately, doing so clears the current desktop session of all the open windows.

To access the VT, press Ctrl+Alt+F1, which takes you to a black-and-white screen with a login prompt. On some keyboards, you also need to press the Fn function key to get to the F1 key. Next, you can log in with your user credentials and enter the following to reanimate the display manager:

$ sudo service lightdm restart

If all goes according to plan, you'll end up on the graphical login screen to the desktop. If you get an error message, you might still be using the old gdm display manager. In this case, replace lightdm with gdm in the sudo service command to get the desired result.

In some cases, the problem seems to go away if you uninstall the gnome-screensaver package, but, then screen locking goes away. You can compensate for that by installing the OpenGL xlockmore-gl screen lock with screensaver package. Then you can use the xlock command to execute the program (Figure 1). This approach is not a guarantee for perpetual peace, but it should help until developers solve the suspend riddle.

Figure 1: The "xlockmore-gl" package conjures up OpenGL images on the screen and blocks with a password. Thus, it can be used as a substitute for Gnome's screensaver.

Unity: Revealing Hidden Applications

Some Unity applications are like scared rabbits that occasionally disappear entirely from the radar screen and can't be reached via Alt+Tab; among these is LibreOffice. Sometimes the LibreOffice start icon disappears from the launcher, leaving an empty space. Although a few methods deal with this problem, I'll look at two of them.

The first approach is to press Super+W to display all the open windows (Figure 2) so that you can access and use the LibreOffice window as usual. Because you need to repeat this method each time you switch to another program, you might want to check whether the following method will work better for you. Minimize the LibreOffice window and right-click the window panel to select Move to Workspace Right to move LibreOffice to the new workspace. As a shortcut, you can press Alt+Ctrl+Right arrow. To return the application to the original desktop, press Alt+Ctrl+Left arrow.

Figure 2: With a trick, you can get your office documents back if they take off into another dimension.

Rotating PDFs

If you use Evince as your PDF viewer, you can easily rotate PDF documents if they arrive askew. Press Ctrl+Right arrow to rotate the document to the right by 90-degree increments or press Ctrl+Left arrow to rotate them in the opposite direction.

ATI Graphics: Turning Off Fan Noise

A rather irritating bug in Ubuntu 12.04 happens for some users with the newer ATI graphics cards. This bug may extend to Ubuntu 12.10 as well; at press time, no solution was found, but a bug report exists [2]. If you're using the fglrx proprietary ATI graphics driver, then, along with great graphics performance, you also get an annoying bug: When you aren't using the desktop for a while, the screen goes dark with an accompanying screen lock. That's OK, except that the fan starts whirring at full speed even if you're not doing anything. When you return to the desktop to check the problem, it stops. So, what's happening? An SSH connection shows where the problem lies: Compiz uses all the CPU, which sets off the fan.

The problem can be resolved, but the bug report suggests two competing workarounds. For the first, go to Dash and enter AMD to start the AMD Catalyst Control Center. Click 3D | More Settings and move the Wait for vertical refresh slider until the text On, unless application specifies appears under it (Figure 3). Then click Apply and OK to change the setting. Give the computer a bit of rest and wait for the back screensaver to appear. If the fan noise doesn't return after a few minutes, you're good to go.

Figure 3: According to a workaround, using the Catalyst Control Center can turn off the annoying fan noise. During testing, however, the second approach worked better.

If the problem persists, you can try the second workaround: Install the compizconfig-settings-manager package and invoke the Compiz Configuration Settings Manager by entering CC in Dash. Navigate to the OpenGL entry and remove the checkmark from the Sync to VBlank option. Close the Settings Manager and, in a few minutes, see whether the problem has been fixed. During testing, this second workaround let us rest easy.

Ubuntu 12.10: Managing the Graphics Card Driver

Previous management of the proprietary graphics card driver worked pretty well. Once Ubuntu found a proprietary driver after installation for the built-in graphics card, the Additional Drivers message prompted for installation of an ATI or NVidia driver. Sometimes importing software for certain wireless cards was available.

According to developers, the Jockey tool was originally designed with a different concept in mind and was much too complex and error-prone for this task. That's why Jockey is missing in Ubuntu 12.10. Managing proprietary drivers was thus moved to another, somewhat less intuitive, location. In the beta version of Ubuntu 12.10, you can invoke the Dash, enter soft, and click Software Sources. On the Additional Drivers tab, you can restart, revert, or apply changes (Figure 4).

Figure 4: Since Jockey disappeared from Ubuntu, you can manage proprietary drivers in a new window, if you use such cards on your system.

Ubuntu 12.10: Switching Package Sources

While you're still in the Software Sources window, something else might interest you. Occasionally, software updates can fail because Updates doesn't recognize the server for downloading the patches. But when you check the Internet connection, you find no problem. What's up?

Ubuntu usually locates the closest download server. If the server is overloaded or otherwise unreachable, the update fails; however, you can still switch the server manually, which is where the Software Sources window comes in. The Ubuntu Software tab at the far left has a drop-down in Download from that usually has an entry based on your location, such as Server for United States. Instead, select the Main server entry to get to the official Ubuntu server for updates. You can also click the Other entry for an overview of other download sites (Figure 5), where you can also choose an alternative server and restart the update.

Figure 5: If your Ubuntu download server is unavailable, select another one from among the global sites.

Ubuntu 12.10: No Calling Home

If you enter the sudo lsof -i command, you will see, among other things, which servers your computer is currently communicating with. What's noteworthy here is that Ubuntu is quite often in contact with Canonical servers. Unity, for example, provides libraries that query servers for information.

What exactly are these services doing? For one thing, there's a service called ubuntu-geoip-provider that belongs to the libgeoclue library. This service provides applications that need to retrieve geolocation data over the D-Bus API. Desktop computers generally provide this via the IP address. Among the service users are the system clock and the new shopping filter that the localized version of Amazon provides.

For privacy concerns or other reasons (e.g., bandwidth) for which you might want to disallow unnecessary Internet connections, you can also disable the servers, with some resulting functionality losses.

If you don't need the GeoClue library, for example, you can get rid of it with remove, as follows:

$ sudo apt-get remove geoclue geoclue-ubuntu-geoip geoip-database

Be warned, however, that this step affects the computer's indicator-datetime, and you will lose the panel clock. You can always install alternative clock indicators (such as MacSlow's Cairo Clock), but these indicate the system time only and can't make any timeserver requests.

Even the video filter goes to the Internet to grab desired videos. To avoid this, you can uninstall the unity-scope-video-remote package. And, while you're at it, you can get rid of Unity Lens Shopping as follows:

$ sudo apt-get remove --purge unity-scope-video-remoteunity-lens-shopping

There you have the essential services that Ubuntu connects with. Once you restart, you'll still have the default ones (e.g., CUPS, dnsmasq, dhclient, and Avahi) running when you enter sudo lsof -i on the command line (Figure 6).

Figure 6: Undesirable services that connect to external servers can easily be deactivated.

Ubuntu 12.10: HUD Keyboard Access

Ubuntu provides a great innovation with its Head-Up Display (HUD). Using the command line, you get significantly faster access to nested menu items such as those in LibreOffice; however, if you seldom or never use this feature, you might be annoyed that it comes up automatically if you press key combinations that include Alt (for example, Alt+F4).

In this case, you can simply delete the keyboard shortcut for HUD or apply a seldom-used key combination instead.

On the right, click the System Settings and go to the Keyboard. A window opens in which you can click the Shortcuts tab and then click Launchers in the list on the left. Select the Key to display HUD entry on the right and choose another key, such as F12 (Figure 7). If you press Backspace on a shortcut entry, you can remove it entirely.

Figure 7: HUD is a great idea, if you use it. In some cases, however, the keyboard shortcut to invoke it might get in your way.

Ubuntu 12.10: Screenshots of Your Choice

Kurt Weirich, one of our readers, has provided a great screenshot tip. He pointed out that Shift+Print can capture a specific area of the screen only. The cursor changes to crosshairs, and you can mark the desired area with a pressed mouse. Drag across the area and, once you release the mouse, it saves the area – that's all there is to it.

Lubuntu 12.04: Problems with /home

Our newly installed Lubuntu presented an interesting problem that could also affect other Ubuntu derivatives. There's a system partition called (/dev/sda1) and a home partition containing personal user files, that is, files you would expect to be in the home directory.

This partitioning is good in theory because you can install a favorite Ubuntu in the system partition and then simply mount the home partition at each restart with /home/{USER}. This setup allows you to install a new system without having to secure and back up personal files (even though you still should do so!).

Suppose, for example, that you install Lubuntu 12.04 on the system partition and then create a user who can access the desktop without logging in. You should name the user as on the previous system and, for simplicity's sake, use the same password. If you want to mount the home partition (/dev/sda2) after installing and starting up the new system, you can enter the following command to modify the fstab file:

$ gksu gedit /etc/fstab

In the file, you can determine which partitions Lubuntu automatically mounts on startup and where they should go.

The mount entry might look as follows with the home directory files on the /dev/sda2 partition:

UUID=ae17035d-758f-4106-bef5-284d8683634c /home/{USER}ext4 defaults 0 2

Instead of using the UUID (Universally Unique Identifier) here, you could have specified /dev/sda2; however, because the UUID is unique, whereas partition numbers might change, using the UUID is recommended.

Every Linux partition has a UUID that makes addressing the partition more reliable. You can easily find out what it is with the following command (Figure 8):

Figure 8: A simple command reveals the UUID that the partition or hard drive uses. Simply use the UUID in the mount request.
$ sudo blkid /dev/sda2

Copy the UUID and paste it, as previously shown, in the /etc/fstab file, then save it and restart the computer.

The problem arises when logging in that, despite entering the correct login credentials and automatic registration, you don't end up on the Lubuntu desktop. The reason involves the file privileges for the mounted home directory.

Use Ctrl+Alt+F1 to switch to virtual terminal (VT) number one. Then, in text mode, log in and enter the following:

$ id

You'll now see the uid and gid of the current user and the username in brackets after it. The ls -la /home/{USER} command shows whether the mounted files belong to that user. In our example, most files had the id 1004:1004. To make the file permissions recursive, you can use the following two commands:

$ cd /home/{USER}
$ sudo $ chown -R {USER}:{USER} .*

After a computer restart, you'll successfully land on the Lubuntu desktop.