User:Sakaki/Sakaki's EFI Install Guide/Setting up the GNOME 3 Desktop

In this section, we'll be setting up GNOME 3 on your machine.

GNOME 3 is a feature-rich desktop environment provided by the Gnome Project. It is one of the most widely-used Linux desktops. Version 3 has now been stabilized on Gentoo, and the older version 2 is no longer supported (reflecting an upstream decision).

GNOME's user interface is known as the "GNOME Shell". It provides core user functions, such as: and uses accelerated, modern-looking graphics:
 * launching applications,
 * switching windows and desktops,
 * searching for programs and files,
 * notification management, etc.



For more information about GNOME, see its official site and Wikipedia page. A list of GNOME releases may be found here.

As of the time of writing, the X Window System ("X11") is still the most usual platform on which to deploy the GNOME 3 environment (although it is slowly being transitioned to use the more lightweight Wayland compositor).

Accordingly, the process we'll be following in this section is:
 * 1) Adding a regular (non-root) user;
 * 2) Installing X11;
 * 3) Temporarily installing a simple X11 window manager, and a few applications, for test purposes;
 * 4) Reconfiguring the kernel if necessary (to include missing graphic drivers etc.) and recompiling using ;
 * 5) Installing GNOME 3 and key applications; then
 * 6) Testing GNOME 3, and refining settings.

This section has no direct equivalent in the Gentoo Handbook (although the part about adding a user reflects the "User Administration" section from Chapter 11, and the X11 troubleshooting section has elements of the "Default: Manual (Kernel) Configuration" section from Chapter 7).

Right, let's get started!

Adding a User for Daily Use
Per the Gentoo Handbook, it is strongly recommended to set up a user for day-to-day use on your machine. Let's do that now. Issue (via the connection from the helper PC) :

The meaning of those options is as follows:

Installing X11
As we'll be using X11 as the underlying graphical platform for GNOME, we'll install it next.

We need to set a few USE flags for (an OpenGL-like library which X pulls in as a dependency), and while we're at it, set a few others that we'll need shortly for GNOME, so issue:

Here are what those flags do (you may also find this Linux from Scratch page useful):

As before, since some of the next steps will involve lengthy emerges, we'll use, and setup a second virtual console , which will be let us monitor progress using. Issue:

to start. Then, press then  to start a new virtual console, and in that new console enter:

Now hit then  to get back to the original console.

Now, since you have already set up the necessary ../Installing_the_Gentoo_Stage_3_Files and ../Installing_the_Gentoo_Stage_3_Files variables in earlier, we can now proceed to install the X-server itself. Issue:

and the X11 server will be downloaded and installed. Note that we use here to avoid adding it to your @world set (this is slightly cleaner, as it will become a dependency of GNOME, once it is installed later).

Temporarily Installing an X11 Window Manager and Applications
To be able to test out X11, we'll need to install a window manager, and a few X11 applications.

To keep things simple here, we'll use the (minimalist) Tab Window Manager (TWM), and the following apps:
 * : a background ('root') window parameter setting utility for X;
 * : a simple clock display for X; and
 * : the standard terminal emulator for X.

Issue:

These are small programs, and shouldn't take long to download, compile or install.

Next, reload your environment to avoid issues when starting the X server. Issue:

Press then  to switch to the second virtual console, and do the same there:

Then press then  to revert to the first virtual console again.

Next, we need to tell X11 what window manager and apps to use whenever it starts up. The file is used for this purpose. Also, as it's generally not a great idea to run an X server as root, we'll invoke it as the regular user we've just created. Still via / console, issue:

Next, edit the file in the regular user's home directory. Issue:

Put the following text in the :

Save and exit.

The above shell script simply instructs X to:
 * start the Tab Window Manager as a background process;
 * set the background colour to "CornflowerBlue" (also backgrounded, but will exit quickly);
 * show an analogue clock, of size 100x100 pixels, offset 1 pixel from the right side of the screen and 1 pixel from the top (as a background process);
 * show a terminal, of size 80x50 characters, offset 494 pixels from the left side of the screen and 51 pixels from the top (as a background process);
 * show a second terminal, of size 80x20 characters, offset 494 pixels from the left side of the screen and 0 pixels from the bottom; and
 * then execute a third terminal, of size 80x66 characters, offset 0 pixels from the left, top corner of the screen (replacing the calling process). This terminal has name 'login' and, when terminated, the X session will close.

Now we are ready to try it out!

Still on the / console, issue:

If all goes well, the screen of your target PC should now be displaying something like the below: (If you get an error instead, see the following section "Troubleshooting a Failed X11 Startup". Any problems are most likely due to a missing kernel graphics driver, which is easy to fix, so don't panic!)

Check that you can move the cursor around (using the target machine's mouse or touchpad), and try typing some simple commands (e.g. "") into any of the three terminal windows. When done, move your cursor into the longest (leftmost) terminal, so that it receives the focus (its cursor will switch to a filled rectangle), and type (directly at the target machine's keyboard):

On the / console (at your helper PC), you should now see that the program has exited (and a lot of status output will have been written to the console too).

If you were able to carry out this test, then congratulations, GNOME 3 should be able to work fine on your system. Jump over the troubleshooting section and install it.

If, however, X failed to start up properly, continue reading.

Troubleshooting a Failed X11 Startup
By far the most likely problem you will encounter with X is a missing graphics driver. Actually, if you've been following this tutorial, and have a reasonably modern machine, then it'll likely have happened to you. That's because the Gentoo minimal install image kernel (on which your current kernel's configuration has been based) does not have many graphics device drivers configured (either built into the kernel, or as modules) - in order to keep the size of the image small.

Two drivers that are conspicuous by their absence from the minimal install kernel configuration are:
 * the driver; this is needed for the integrated "HD Graphics" on many Ultrabooks (such as the Panasonic CF-AX3);
 * the driver; this is an open-source driver that supports many nVidea graphics cards (which are popular on desktop machines).

The easiest way to see if you have had a problem like this is to look at the output from your attempt to run (the output in the / virtual terminal, that is, not on your target machine's display).

If you see output such as:

then you know that you have a driver problem. In this case, it is complaining about the driver module (dynamic library).

To rectify this, we need to turn on the appropriate drivers and rebuild our kernel. Ensure that the USB boot key is inserted into the target machine, and issue (from the / virtual terminal):

to drop back to the user.

Then:

to start the kernel rebuild process going. Because you have not specified here, but you have specified, the process will run through by itself (assuming no errors) to the point where you can modify the kernel configuration using the standard -based editor GUI.

The configuration changes you need to make will vary depending on the driver(s) you need to enable. The following is a step-by-step guide for modern laptops (and other PCs) with Intel integrated HD graphics (following this wiki page). If you require a different driver, modify these instructions accordingly.

The system is a simple tool used to modify Linux kernel configurations (aka "" files) in a coherent manner. The tool will not let you make inconsistent choices, and has a useful search facility.

When starts up, it will present you with a display similar to the below (your version may vary depending on currently selected options and kernel version):

You can navigate the interface as follows:
 * Use the up and down arrow keys to move your selection (highlighted in blue) in the top pane;
 * Use the left and right arrow keys to traverse the bottom (horizontal) menu, which defines what happens when you press, viz.:
 *  enters a sub-menu, for items (in the top pane) ending with, or brings up a text entry box for items which start with round brackets "";
 *  exits a sub-menu; if at the top level already, asks you whether to save changes (if you have made any) and exits the program; you can also press then  to perform this action;
 *  shows a help screen that is relevant to the (top pane) selection; you can also press for this;
 *  saves the current configuration; and
 *  allows you to load a new configuration.

Items starting with non-round brackets represent features which can be enabled, as follows:
 * , : Square brackets indicate features that are deactivated (blank) or activated (asterisk). Press  to toggle status, or  to activate,  to deactivate. Activated items are built directly into the kernel; deactivated items are omitted from it entirely.
 * ,, : Angle bracketed items can similarly be deactivated (blank) or activated (asterisk), but can additionally be built as modules (""). In addition to ,  and , you can use  with such items to specify that they should be modularized.
 * , : Curly brackets indicate items which cannot be deactivated (due to another item's dependency). However, they may be activated or modularized (using,  or , as before).
 * , : Similarly, hyphens indicate items whose status cannot be changed (their selection having been forced as the result of another item choice).

To search, press and then type your search term. This is a very useful facility when looking for missing drivers etc. For example, since we are here looking for the missing module, press  then type in, then press  to see the search results:

You can scroll through the results using the arrow keys. Doing so in this case, we discover that (inter alia):
 * Four items are returned, of which the first and third (, and ) are relevant;
 * The output shows that (e.g.) the item (which will appear in the  file as ) is to be found under the  menu, by following down into the  submenu. We also see that its prompt in the upper-pane menu will (as is common with this software!) will be distinct from the  name (it will actually appear as "").
 * The dependencies of this driver are also shown (you can drag the terminal window on your helper machine wider to see any that may have been clipped off). Generally, for an item to be available for selection or modularization, all its dependencies must be satisfied: either selected (, the same as an asterisk) or modularized . In some cases, items whose dependencies are unsatisfied will not be visible other than through a search like this.

This last point bears repeating, since it confuses many first-time users: an item will often not even appear in 's top pane until its dependencies have been satisfied. It would be nice if would allow us to activate/modularize "an item and all its dependencies, transitively" from the search results screen, but it currently cannot, so we must perform this depth-first recursion manually.

OK, so let's work through the case as a concrete example. From the search just performed we can see that, of the requirements for, only the item is currently deselected. Well then, let's investigate : we hit to exit current search, then  to search again, and type in  and press. The item we want here is the first result term. All its dependencies appear satisfied in the current configuration, and we note also that it appears under "", and that its prompt is "":



Now we know there are no further unsatisfied dependencies for, we can activate , and then itself.

Begin by pressing to exit the current search, then use the arrow keys to navigate to the "" item (if not visible to begin with, the top pane will scroll as you arrow down), then press  to enter the submenu. Next, repeat the process to select the "" item, and press :

Now, move to the "" item. This is the symbol we want (as just mentioned, you can verify using  if you like). Press to enable it (this causes a number of subitems to appear, and also enables this entry itself as a submenu heading (not obvious unless you drag your window wider than the default 80 columns, so you can see the  suffix that appears post-selection):



So, now that we have set, we can proceed to enable itself. Navigate down the menu, through the new items that appeared when you selected, until you reach the  item (if you think this feels rather like a 70's era adventure game, you're not alone!):

You can verify that this is indeed the item, by using using  if you like; then, press  to enable it:

And that's it, you're done. Hit then  to come back out to the "" menu. Hit then  again to come back out to the top-level menu. Finally, hit then  again, to exit the program. When prompted, ensure is selected, and press  to save the new configuration and quit :

Once you have exited, will automatically create a kernel with the newly created configuration, sign it, and copy it over to the boot USB key. Wait for the process to complete (you get the message ""). Then issue:

which will close the first terminal, then:

to close the second one. Then, ensure the boot USB key is still inserted in the target machine and restart it, by issuing:

When the machine restarts, as before, you will need to enter your LUKS keyfile passphrase (the one you created earlier), directly at the target machine keyboard.

Once this has been completed successfully, and the target machine is restarted, from the helper PC, log back in again via :

Then, re-establish (enter all commands via the  console from the helper PC, unless otherwise stated). Issue:

to start. Then, press then  to start a new virtual console, and in that new console enter:

Now hit then  to get back to the original console. Log back in as your regular user:

And now rejoin the tutorial from the point where you attempted to run, above. Hopefully, all should be well this time. Good luck!

Installing GNOME 3
Now that we know X works, we can install GNOME! Let's begin by removing the temporary X window manager and applications (which we installed, for testing purposes only, earlier).

Issue (from the helper PC / terminal):

to get back to the user, then:

Now for GNOME itself. There are some additional USE flags we'll need here: to turn on UPnP audio/video streaming support for the package, to ensure that the  web server works in a non-threaded fashion, to enable the Samba client, and to turn on Python messages for certain applications. To enable these, issue:

Now we are ready to install GNOME! Issue:

The will take quite some time to complete! Note that the option instructs  to build as much as possible, even if some errors are encountered. This is useful here because, due to the size of the build, it is possible that you may come across one or two failed packages.

Most often, any failures will be caused by the high level of paralleism we are using. Accordingly, if, at the conclusion of the above, near the end of the output you see a message that:

then issue the following command, to re-attempt to build the failed packages, this time without parallelism:

(Of course, if the original completed successfully, there is no need to issue the above, but, as  is a meta-package, it is still safe to do so, and won't cause all the dependencies to be rebuilt.) You may need to repeat this step multiple times to get GNOME emerged successfully (I have found three or four iterations may be necessary). As long as the 'packages to be installed' count keeps falling, keep trying ^-^

Once the process has completed, ensure you are back in the virtual terminal from where you issued the command (i.e., not the  terminal), and then issue the following to ensure your environment is up-to-date post-install:

Hit then  to go to the second  console, and do the same there. Issue:

Then press then  to switch back to the original console again.

Make sure any regular users are members of the group (if it exists on your target machine). Issue:

If you wish your regular user to be able to play the GNOME games (assuming you have chosen to install them), then issue (this is optional):

Next, we need to log back in as our regular user, and try out our new desktop! Issue:

Next, edit the file in the regular user's home directory. Issue:

Delete the current contents of (you can use  inside  to delete a line at a time), and replace with the following text:

Save and exit.

OK, time to try it out! Issue:

And hopefully you should be greeted with a (rather startlingly empty!) GNOME 3 desktop, somewhat similar to the below, on the target machine:

You can try playing around with it briefly if you like (some simple instructions may be found here - or just get started by moving your mouse pointer up to the top left corner of the screen (and optionally, clicking on 'Activities'), or by pressing ), using the target machine keyboard and mouse / touchpad directly. Note, however, that this isn't a properly logged-in instance, so certain of the standard features will not function as you expect. You should be able to start a terminal etc. however. When you're done, kill the test instance, by issuing at the helper PC / terminal (the one where you just issued ).

<span id="testing_gnome3">Testing GNOME 3 (and Refining Settings)
Congratulations, GNOME 3 is now basically functional; we only need a few more steps to get it fully operational on your machine! So, let's continue. Come back out to be again:

Next, we must enable the Wikipedia:NetworkManager service (which will handle all network interaction under GNOME), and disable the service, which we started earlier (and whose functionality  supplants). First, issue:

Next, if you are using WiFi for the install, you'll also have explicitly set up a configuration file earlier in the tutorial, and so you need to remove this again now (however, skip this step if installing over a wired Ethernet connection):

<span id="start_nm">Now we can ensure comes up on boot (however, do not start it yet, since you may lose network connectivity when you do). Issue:

That having being done, we need to make sure that the GNOME Display Manager is configured to run on boot (and also, we'll start up an instance now, together with ). Issue:

Assuming that worked, <span id="login_to_gnome">you should now be able to see a GNOME login screen on the target machine, similar to the below:

Directly at the target machine, click on the (regular) user name then, when prompted, type in the (regular user) password you set up earlier.

You should arrive back at the GNOME desktop (only this time, with a little more functionality, since this is a normal login session).

Before our final reboot (at which point, we will no longer require the helper PC, but will be using the target machine natively), there are three additional tasks we need to carry out:
 * 1) ensuring that network settings are correct;
 * 2) setting up keyboard settings are correct within GNOME (if required); and
 * 3) ensuring that our the system remembers our volume preferences between reboots.

<span id="gnome_network_settings">GNOME Network Settings
You should now make sure that your network settings are correct under GNOME. Any wired connection should have been picked up fine, but if you have been installing using WiFi, you'll need to select an access point, and enter your wireless passphrase, to regain network connectivity.

To do that, simply click on the 'downwards pointing triangle' in very top right of the screen. This will show a drop-down menu, from which you can turn on WiFi, and select an access point (you'll be prompted for the passphrase). (Alternatively, you can press the, then type "" (and press ), then click on the item titled 'Network' in the panel that appears.) It's a fairly self-explanatory interface, but if you need assistance, simply press.

Once you have the network set up, you should be able to browse the web etc. Try this now: directly at the target machine's keyboard, press the and type 'Web', then press  to start the first item shown. GNOME's default web browser will start up, initially full-screen. You can drag it down by the top bar to make it a normal-sized window, type in a URL etc.:

<span id="gnome_keyboard_settings">GNOME Keyboard Settings
If you have a non-US keyboard (as in the case of the Panasonic CF-AX3), you will need to set this in GNOME. Press the, then type "" (and press ) and click on the item in the list. This opens a control panel. Make sure the 'Language' and 'Formats' in the top pane are correct for your locale. Then, add the appropriate 'input source' in the bottom pane. Click on the 'plus' sign icon, and an "Add an Input Source" panel will appear. Click on the tile showing three stacked dots, and drag the panel slightly larger vertically (as otherwise the output will be hidden). You should now be able to click on the 'Other' tile that appears, and then select the required source from the full list, and then click on 'Add' (in my case, I actually added three: "English (UK)" (for my plug-in keyboard), "Japanese" for the machine's built-in keyboard, and "Japanese (Anthy)" for kanji and kana input - obviously, your requirements will probably differ). When done, close out the "" dialog.

Once an item <span id="input_source_menu">has been added, it can be activated via a drop down in the top bar of the screen. In the case of the CF-AX3, you'd want to select 'Japanese' from this list, so that the keyboard mapping is correct (even if you are typing everything in English!) Be sure to check this, if you have problems having your password accepted at the GNOME login screen.

<span id="gnome_volume_control">GNOME Volume Control
You may find that although you can set sound levels using the 'speaker icon' menu in the GNOME top bar, these settings are lost on a reboot (and sound is muted each time). If this occurs on your system (it affects the CF-AX3), take the following steps. First, emerge (you can do this via the / terminal on the helper PC):

Once that completes, set the volume levels as you like them, then issue:

The settings should now be preserved across a reboot.

<span id="restart_to_gnome">Restarting into GNOME!
We are now ready to bid farewell to the services of the helper PC, as all further steps can now be done on the target machine directly. Close out the / terminal. Issue:

which will close the first terminal, then:

to close the second one, then:

which will close out the session itself.

Now, ensure that the USB boot key is inserted in the target PC, and reboot it, by clicking on the 'power' icon (in the top right of the screen), clicking on the 'power' button in the dropdown menu that then appears, and then clicking on the 'Restart' button in the dialog.

The machine should then power cycle (you will be cleanly logged out of GNOME first). When the machine restarts, as before, you will need to enter your LUKS keyfile passphrase (the one you created earlier), directly at the target machine keyboard to unlock the LUKS partition. You should then be presented directly with a GNOME login page (as above). Directly at the target machine, click on your (regular) user name then, when prompted, type in the (regular user) password you set up earlier (ensure you have the correct keyboard settings, if relevant, as discussed above).

Once logged in to GNOME, bring up a web browser: directly at the target machine's keyboard, press the and type 'Web', then press  to start the first item shown. GNOME's default web browser will start up, initially full-screen. You can drag it down by the top bar to make it a normal-sized window. Do so, and type in the URL for this tutorial, so that you can continue to follow it there.

Now, <span id="open_gnome_terminal">bring up a terminal window in GNOME. Press the again, and type 'terminal', then press. A standard-issue terminal window should open. As we have some final installation work to do, become root:

The password required here is the one you set up earlier in the tutorial (and have used when -ing in).

<span id="next_steps">Next Steps
Congratulations - if you have followed through to this stage, you have a basically functioning system! There is some final driver configuration left still to do, so let's address that now. Click here to go to the next chapter, "Final Configuration Steps".