Least Action

Nontrivializing triviality..and vice versa.

Archive for June 2011

Customizing GNOME3

leave a comment »

The purpose of this post is to help you configure GNOME3 and make it look more ‘zazzy’ than it is. Most of these tweaks have been inspired by the archlinux forums and FP Murphy’s blog, which is the source for learning how to customize GNOME3. I thought it would be a good idea to put it all in one place, mostly for my own reference. Note that I have tested all this on Natty 64-bit. I also thank Charles Bowman for his help and inputs over the past few weeks.

The gnome-tweak-tool does not let you change much, unless you add extensions to the gnome-shell, which really open up the world for a tweaker. I won’t go into the anatomy of an extension, as FP Murphy does an excellent job in explaining it. I will just assume that you know enough about it. If you don’t, you will still be able to get all these tweaks to work, but you won’t understand how they work, and believe me, it won’t be quite as much fun!

Extensions are installed in

~/.local/share/gnome-shell/extensions

but if they are to be made accessible to all users, then they should go in

/usr/share/gnome-shell/extensions

You can pick either configuration. I will work with ~/.local/share/gnome-shell/extensions from now on, because I am running all this on a single user system. Remember that ~/ is a mnemonic for your home directory. Instead of using the long /home/user_id/, I will just refer to it as ~/ from now on.

One way to play with extensions is to get hold of Charles Bowman’s gnatty pack. It is available from http://cid-32ec6e89f4aa803b.office.live.com/self.aspx/Linux/gNatty%20Pack.tar.gz?wa=wsignin1.0&sa=92561471. Since several extensions seem to be around, with different names, I will just go over the ones I have gotten to work one by one.

Some words of caution before we begin the expedition: some extensions are not compatible with others, and if you install two mutually incompatible extensions, it is possible that the Gnome Shell will not load, and you will be asked to log out. This can be fixed by moving the bad extension out of ~/.local/share/gnome-shell/extensions or simply renaming it:

mv ~/.local/share/gnome-shell/extensions/bad_extension ~/.local/share/gnome-shell/extensions/bad_extension.old

It turns out that this works because each extension has a file inside called ‘metadata.json’ with a field called a unique id (uuid) which must match the name of the directory. Changing the directory name using the mv command above will create a disparity between uuid and the directory name, which will prevent the extension from loading.

If you install a whole bunch of extensions together, it will obviously be hard to debug any problem, because you don’t know which extension is the culprit. So it is best to install one extension at a time, and restart the GNOME Shell. This can be achieved either by logging out and logging back in, or pressing Alt + F2 and typing r and pressing Enter. This restarts the shell. Sometimes though, restarting the shell this way results in spurious errors which may suggest that the extension is messing up something. So, I do prefer to double-check by logging out and logging back in again, though this is relatively cumbersome as it will close all open applications.

With this preliminary knowledge, we are ready to embark on the first step. The basic algorithm is to create two files, extension.js and metadata.json, for every extension. Each extension resides in its unique directory (folder) in ~/.local/share/gnome-shell/extensions/.

Extension #1: Move Clock

The default position of the clock in Gnome is in the center of the top bar. This is irritating for those of us who are used to the old Gnome2 interface where the clock would appear on the right. This is easily fixed.

cd ~/.local/share/gnome-shell/extensions
mkdir Move_Clock@rmy.pobox.com
cd Move_Clock@rmy.pobox.com

Now create two files using your favorite editor, extension.js and metadata.json with the following contents:

extension.js

const St = imports.gi.St;

const Main = imports.ui.main;

function main() {
    Main.panel._centerBox.remove_actor(Main.panel._dateMenu.actor);
    let children = Main.panel._rightBox.get_children();
    Main.panel._rightBox.insert_actor(Main.panel._dateMenu.actor, children.length-1);

    Main._nWorkspacesChanged = function() {};
    Main._queueCheckWorkspaces = function() {};
    Main._checkWorkspaces = function() {};
}

metadata.json

{
"shell-version": ["3.0"],
"uuid": "Move_Clock@rmy.pobox.com",
"name": "Move Clock",
"description": "Move clock to left of status menu button"
}

Restart the shell. The clock should now be visible on the right hand side of the top bar. We can customize it further, to display the time and date in a detailed fashion.

First start gnome-tweak-tool, and click on Shell. You should see a window which looks like this:

gnome-tweak-tool shell tab

You can toggle the ON/OFF switches for ‘Show date in clock’ and ‘Show week date in the calendar’.

Some more date and time settings can be changed using gnome-control-center. Type

gnome-control-center

in a terminal window and click on Date and Time. Note that this tool does not allow you to show a seconds counter in the clock. If you wish to display seconds, fire up a gnome-terminal window and type

gsettings set org.gnome.shell.clock show-seconds true

This will display a live ticking seconds counter.

Note that the status of presently installed gnome-shell-extensions can be determined from and changed within gnome-tweak-tool. Every time you install an extension manually and restart the shell, by default it is enabled.

Under Construction

Written by Vivek

June 1, 2011 at 15:09

Posted in Linux, Programming

Ubuntu 11.04 Natty Narwhal 64-bit Guide Part 2 – Installing GNOME3

leave a comment »

In this post, we are going to install GNOME3.

Step 1: Make sure you got Unity to work. This is very important. We don’t want to install Gnome3 on an ailing system.

Step 2: Update everything, if not already one in Part 1.

sudo apt-get update
sudo apt-get upgrade
sudo reboot

Step 3: Install GNOME3

sudo add-apt-repository ppa:gnome3-team/gnome3
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install gnome-shell gnome-session
sudo apt-get -f install
sudo apt-get install gnome-shell
sudo apt-get install gnome-session
sudo apt-get remove gnome-accessibility-themes
sudo apt-get install gnome-themes-standard
sudo apt-get install -f

Step 4: Now, reboot your system.

sudo reboot

And then, log into the session named ‘GNOME’. If everything worked out alright, you should be in GNOME3.

The gnome-tweak-tool lets you make minor modifications to the way the Gnome Shell looks/interacts. In a subsequent post, we will look at various customizations that are possible.

References:

1. http://ubuntuforums.org/showpost.php?p=10734567&postcount=1. Read this for a detailed description of all the steps.

Written by Vivek

June 1, 2011 at 14:29

Posted in Linux, Technology

Ubuntu 11.04 Natty Narwhal 64-bit Guide Part 1

leave a comment »

This is meant to be a record of all that I did to customize Ubuntu 11.04 Natty Narwhal 64-bit on my self-assembled desktop (Core i7 920, 6 GB Corsair TR3X6G1600, Gigabyte EX58 Extreme, NVIDIA GTX295) and my laptop (Dell XPS 15 L501x: Core i7 740 QM, 6GB DDR3 RAM, NVIDIA GT435M, 1920×1080 dp HD screen). It is mostly unoriginal, and credits have been given where they are due to various sources on the internet.

First of all, I strongly recommend a fresh install. There are lots and lots of threads out there with people posting problems after problems with upgrades from Maverick Meerkat 10.10. Typically most of you will need to back up your home directory $HOME (or ~/). You can just create a tarball and save it to a USB drive or a CD. If you’re an expert/intermediate user who knows what the stuff in all those ‘hidden’ directories beginning with a . is, then you probably won’t need to do that either.

After a fresh install, the first thing to do is to get the latest updates

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo reboot

The first updates will take a long time. You can also use the update-manager. In this post, I will always provide command line interface (CLI) solutions, as I don’t care much for GUIs. But they have their advantages, and if you are more comfortable with GUIs use them instead. There will be some instances where you’ll need to be familiar with the CLI (e.g. if you’re installing accelerated NVIDIA drivers, or if X windows fails to load).

Installing proprietary accelerated NVIDIA Drivers

When you first boot into Natty, you will most likely get a message indicating that your hardware is not capable of running Unity, and that you will be taken to the classic GNOME interface. This is because by default, restricted drivers are not installed. To install restricted drivers, click on the System menu, and select ‘Additional Drivers’ under Administration (System -> Administration -> Additional Drivers). Your window will look a little like this:

Additional Drivers - NVIDIA

You will most likely see two entries – we’re interested in the first one. I have taken a screenshot after installing these drivers, and then switching to drivers downloaded directly from NVIDIA. Most people will not require this, unless they intend to program in CUDA. Anyway, activate the first entry on the list. This will download and install the restricted driver. Now, reboot your system. You should be able to boot into Unity. This will be our starting point.

Installing Sun Java

By default, Natty comes with Open JDK. I prefer Sun’s JDK/JRE. To install it, type

sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

To use Sun’s Java, you’ll probably have to change the default java version using

sudo update-alternatives --config java

There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                      Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      auto mode
  1            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      manual mode
* 2            /usr/lib/jvm/java-6-sun/jre/bin/java       63        manual mode

Press enter to keep the current choice[*], or type selection number:

Pick option 2 (or the one which does not correspond to OpenJDK). To confirm that the change occurred, type

java -version

You should see something like

 java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)</pre>

Install JDownloader (optional)

JDownloader is a Java-based download manager, which in my experience, is more reliable than many other download managers I’ve used. To download and install JDownloader, type

sudo add-apt-repository ppa:jd-team/jdownloader
sudo apt-get update
sudo apt-get install jdownloader

Installing proprietary NVIDIA drivers from http://www.nvidia.com

Power users, especially programmers, will find it necessary to have support for additional libraries such as CUDA. The drivers we just installed above do not provide CUDA support (at the time of writing). But NVIDIA provides Linux drivers, and they can be downloaded from http://www.nvidia.com/Download/index.aspx?lang=en-us.

To install this driver, log out of Gnome/Unity, and at the graphical log-in screen press Ctrl+Alt+F1 to switch to console mode. Then, type

sudo service gdm stop

Then, navigate to the directory containing the nvidia driver .sh file, and type

sudo sh ./filename.sh

Follow the on-screen instructions. Reboot the system. You should see an NVIDIA splash screen before the log-in screen. Note that you may have to do this a couple of times for it to work.

Installing CUDA

Download the CUDA toolkit and SDK from http://developer.nvidia.com/cuda-downloads or http://developer.nvidia.com/cuda-toolkit-40#Linux. Add the following lines to $HOME/.bashrc

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

Follow the installation instructions in the Getting Started guide: http://developer.download.nvidia.com/compute/DevZone/docs/html/C/doc/CUDA_C_Getting_Started_Linux.pdf

You will most likely face a bunch of errors, which can be resolved by reading an earlier post of mine: https://leastaction.wordpress.com/2011/01/25/cuda-on-ubuntu-maverick-meerkat-10-10/.

You will also have to update symbolic links:

sudo ln -s /usr/lib/libGL.so.xx.xx.xx /usr/lib/libGL.so

Note: Recent updates to xserver-org-core and xserver-common are likely to crash your Gnome3 and/or OpenGL configuration. To fix this problem, you have to also restore another symbolic link:

sudo mv /usr/lib/xorg/modules/extensions/libglx.so /usr/lib/xorg/modules/extensions/libglx.so.orig
sudo ln -s /usr/lib/xorg/modules/extensions/libglx.so.270.41.06 /usr/lib/xorg/modules/extensions/libglx.so

The version 270.41.06 may have to be replaced by the version of the driver you are presently using. This can be determined by typing

nvidia-settings -v

References:

1. http://www.multimediaboom.com/how-to-install-java-in-ubuntu-11-04-natty-narwhal-ppa/

2. http://www.webupd8.org/2010/04/install-jdownloader-via-ppa-repository.html

3. http://ubuntuforums.org/showpost.php?p=10883998&postcount=2

4. https://leastaction.wordpress.com/2011/01/25/cuda-on-ubuntu-maverick-meerkat-10-10

Written by Vivek

June 1, 2011 at 14:15

Posted in Linux, Technology