Tips & Tricks for Ubuntu

Ubuntu 12.10: 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. Often it's enough to switch to a virtual terminal (VT) and give the LightDM display manager a nudge. Unfortunately, doing so clears the current desktop session of all open windows. To access 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 deinstall 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, for example. Then, you can use the xlock command to execute the program (Figure 1). This approach is not 100 percent guaranteed 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. A few methods exist to deal with this problem, and 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. However, because you need to repeat this method each time you switch to another program, you might want to check to see 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 office documents back if they enter another dimension.

Rotating PDFs

If you use Evince as your PDF viewer, you can easily rotate PDF documents if they arrive askew. Just, 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 and 12.10 happens for some users with the newer ATI graphics cards. This bug might extend to Ubuntu 13.04 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 not so bad, except the fan starts whirring at full speed, even if you're not doing anything. When you return to the desktop to check on 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 the 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. 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.

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

Figure 3: According to a workaround, the Catalyst Control Center can turn off the annoying fan noise, but during testing, the CompizConfig Settings Manager worked better.

Ubuntu 13.04: Managing the Graphics Card Driver

Previous management of the proprietary graphics card driver before version 12.10 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 and 13.04. Managing proprietary drivers was thus moved to another, somewhat less intuitive, location. In 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 13.04: 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. But, if the server is overloaded or otherwise unreachable, the update fails. However, you can still switch the server manually – that's where the Software Sources dialog comes in. The Ubuntu Software tab at the far left has a Download from drop-down 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 13.04: 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 – as well as 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 shut down 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 remove it as follows:

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

Be warned that this step affects the computer's indicator-datetime , and you will lose the panel clock. You can always install alternative clock indicators (e.g., 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 deinstall the unity-scope-video-remote package. While you're at it, you can get rid of Unity Lens Shopping as well:

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

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

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

Ubuntu 13.04: HUD Keyboard Access

Ubuntu provides a great innovation with its Head-Up Display (HUD) [3]. 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 (e.g., Alt+F4). In this case, you can simply delete the keyboard shortcut for HUD or apply a seldom-used key combination instead.

On the left, click the System Settings icon and go to Keyboard . A window opens in which you can click the Shortcuts tab and then click Launchers in the list on the left (Figure 7). Select the Key to show the HUD entry on the right and choose another key, such as F12. 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 13.04: 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 by pressing the mouse and dragging across the area of interest. Once you release the mouse, it saves the area – that's all there is to it.

Lubuntu 12.04: Problems with /home

Newly installed Lubuntu presents an interesting problem that could also affect other Ubuntu derivatives. After installation you have a system partition (called /dev/sda1 ) and a home partition (called /dev/sda2 ) containing personal user files – that is, files you would expect to be in the home directory.

This partitioning scheme 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 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) [4] 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 1. 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 my 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 restart, you'll successfully land on the Lubuntu desktop.