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

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). Thanks to Dantrell B.'s patchset (a variant of which is used by [www.funtoo.org Funtoo] in their mainline distribution), users can enjoy GNOME 3 under with all features intact.

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 prerequisites as required by Dantrell B.'s overlays;
 * 6) Installing GNOME 3 and key applications; then
 * 7) 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.

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, 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 two ( and ) are relevant;
 * The output shows that (e.g.) the item (which will appear in the  file as ) is to be found in the  submenu under 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, the and  items are currently deselected. Well then, let's recursively 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 "". Next, let's recurse into. Press to exit the current search, then  to search again, and type in  and press. Just one result this time, and again, all dependencies appear currently satisfied. Here, the location is "", and it will appear in the menu as "":

Now we know there are no further unsatisfied dependencies for, we can activate those we've discovered.

We'll start with. Press 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, select the "" item, and press to enter the submenu. Move down to the line starting "Intel 400LX/BX/GX", and press to enable it, as shown:

Now is set, we can proceed to enable 's other unmet dependency,. Press then  to come back out one menu level (back to ""), then select the line starting "" (remember, if you are unsure this is the item whose symbol is, you can always check it first, by pressing  when highlighted). Press to enable it. This unlocks a set of subitems, which now appear:

One of these is what we're after - move down until the line starting "" is highlighted (this is in fact our original target, the item, which you can verify using  if you like), then press  to enable it. Doing so causes yet more items to appear (feels rather like a 70's era adventure game!):

The first of these is, which is also necessary for X11 to start correctly. Move to it, and select it by pressing :

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 Prerequisites
Now we need to install some prerequisites for GNOME without. Two of these ( and ) will have already been installed as part of the earlier update under our custom profile. A third,, we have just installed. OpenRC, a fourth prerequisite, is obviously already installed. However, we still need and  to complete the set, so emerge these now. Issue (from the helper PC / terminal):

to get back to the user, then:

Make sure that these additional services will come up automatically on boot, and also start them now:

In brief, here's what those prerequisites get us:
 * ConsoleKit is a framework for tracking users, login sessions and 'seats'. It exists primarily to support multi-user setups.
 * D-Bus is an software component interprocess communication (IPC) system.
 * OpenRC is of course the dependency-based init system you are targeting with this install (in preference to ).
 * The Xorg Server provides an implementation of the X windowing system, relied on by GNOME.
 * ACPI, the advanced configuration and power management interface, is a BIOS power-management system. The daemon allows the system to react on special power-related events.
 * pm-utils is a suspend and powerstate setting framework.

Additionally, it is useful to set up the ALSA service to run on boot (this allows the audio mixer level to be preserved across reboots, something GNOME does not yet seem able to do reliably). To do so, issue:

then:

<span id="install_gnome3">Installing GNOME 3
Now that we have everything in place, and the X-server provisioned, 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:

Now for GNOME itself. One important decision here is which applications (web browser etc.) to build as part of the 'baseline' set.

Make your own choices, and then add any USE flag changes by adding overrides to the file. For example: To do so, issue:
 * Since it is generally useful to have a web browser available, per the above recommendations you could elect to add  to the default set; and
 * as there is (at the time of writing) an error in the Manifest, you could elect to remove   from the default set.

and then place the following text in the file:

Save, and exit.

Right: 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.

You should also ensure that the (which mimics certain D-Bus systemd services under OpenRC) is added to the default runlevel (and also, bring it up now, if it is not already running); issue:

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

If you wish your regular user to be able to play the GNOME games (assuming you installed them earlier), 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, 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 edit the  value in the  file, so that the GNOME Display Manager  is used. Issue:

and edit the  stanza, so that it reads:

Leave the rest of the file as is. Save, and exit.

Now we configure to run on boot, and also start up an instance now (the  invocation will also bring up ). 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 two additional tasks we need to carry out:
 * 1) ensuring that network settings are correct; and
 * 2) setting up keyboard settings are correct within GNOME (if required).

<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="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 under OpenRC".