Difference between pages "Install/BootLoader" and "Install/Configuring"

(Difference between pages)
(New School (UEFI))
 
(/etc/fstab)
 
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
{{InstallPart|boot loader configuration}}
+
{{InstallPart|the process of configuring your Funtoo Linux system}}
 
</noinclude>
 
</noinclude>
=== Installing a Bootloader ===
+
=== Configuring your system ===
 +
As is expected from a Linux distribution, Funtoo Linux has its share of configuration files. The one file you are absolutely required to edit in order to ensure that Funtoo Linux boots successfully is <code>/etc/fstab</code>. The others are optional. Here are a list of files that you should consider editing:
 +
{{TableStart}}
 +
<tr class="active"><th>File</th>
 +
<th>Do I need to change it?</th>
 +
<th>Description</th>
 +
</tr><tr  class="danger">
 +
<td><code>/etc/fstab</code></td>
 +
<td>'''YES - required'''</td>
 +
<td>Mount points for all filesystems to be used at boot time. This file must reflect your disk partition setup. We'll guide you through modifying this file below.</td>
 +
</tr><tr>
 +
<td><code>/etc/localtime</code></td>
 +
<td>''Maybe - recommended''</td>
 +
<td>Your timezone, which will default to UTC if not set. This should be a symbolic link to something located under /usr/share/zoneinfo (e.g. /usr/share/zoneinfo/America/Montreal) </td>
 +
</tr><tr>
 +
<td><code>/etc/make.conf</code> (symlink) - also known as:<br/><code>/etc/portage/make.conf</code></td>
 +
<td>''Maybe - recommended''</td>
 +
<td>Parameters used by gcc (compiler), portage, and make. It's a good idea to set MAKEOPTS. This is covered later in this document.</td>
 +
</tr><tr>
 +
<td><code>/etc/conf.d/hostname</code></td>
 +
<td>''Maybe - recommended''</td>
 +
<td>Used to set system hostname. Set the <code>hostname</code> variable to the fully-qualified (with dots, ie. <code>foo.funtoo.org</code>) name if you have one. Otherwise, set to the local system hostname (without dots, ie. <code>foo</code>). Defaults to <code>localhost</code> if not set.</td>
 +
</tr><tr>
 +
<td><code>/etc/hosts</code></td>
 +
<td>''No''</td>
 +
<td> You no longer need to manually set the hostname in this file. This file is automatically generated by <code>/etc/init.d/hostname</code>.</td>
 +
</tr><tr>
 +
<td><code>/etc/conf.d/keymaps</code></td>
 +
<td>Optional</td>
 +
<td>Keyboard mapping configuration file (for console pseudo-terminals). Set if you have a non-US keyboard. See [[Funtoo Linux Localization]].</td>
 +
</tr><tr>
 +
<td><code>/etc/conf.d/hwclock</code></td>
 +
<td>Optional</td>
 +
<td>How the time of the battery-backed hardware clock of the system is interpreted (UTC or local time). Linux uses the battery-backed hardware clock to initialize the system clock when the system is booted.</td>
 +
</tr><tr>
 +
<td><code>/etc/conf.d/modules</code></td>
 +
<td>Optional</td>
 +
<td>Kernel modules to load automatically at system startup. Typically not required. See [[Additional Kernel Resources]] for more info.</td>
 +
</tr><tr>
 +
<td><code>/etc/conf.d/consolefont</code></td>
 +
<td>Optional</td>
 +
<td>Allows you to specify the default console font. To apply this font, enable the consolefont service by running rc-update add consolefont.</td>
 +
</tr><tr>
 +
<td><code>profiles</code></td>
 +
<td>Optional</td>
 +
<td>Some useful portage settings that may help speed up intial configuration.</td>
 +
</tr>
 +
{{TableEnd}}
  
These install instructions show you how to use GRUB to boot using BIOS (old-school) or UEFI (new-school).
+
If you're installing an English version of Funtoo Linux, you're in luck as most of the configuration files can be used as-is. If you're installing for another locale, don't worry. We will walk you through the necessary configuration steps on the [[Funtoo Linux Localization]] page, and if needed, there's always plenty of friendly, helpful support. (See [[#Community portal|Community]])
  
==== Old School (BIOS) ====
+
Let's go ahead and see what we have to do. Use <code>nano -w <name_of_file></code> to edit files -- the "<code>-w</code>" disables word-wrapping, which is handy when editing configuration files. You can copy and paste from the examples.
  
If you're using the BIOS to boot, setting up GRUB, the bootloader, is pretty easy.
+
{{fancywarning|It's important to edit your <code>/etc/fstab</code> file before you reboot! You will need to modify both the "fs" and "type" columns to match the settings for your partitions and filesystems that you created with <code>gdisk</code> or <code>fdisk</code>. Skipping this step may prevent Funtoo Linux from booting successfully.}}
  
To use this recommended boot method, first emerge <code>boot-update</code>. This will also cause <code>grub-2</code> to be merged, since it is a dependency of <code>boot-update</code>.
+
==== /etc/fstab ====
 +
 
 +
<code>/etc/fstab</code> is used by the <code>mount</code> command which is ran when your system boots. Statements of this file inform <code>mount</code> about partitions to be mounted and how they are mounted. In order for the system to boot properly, you must edit <code>/etc/fstab</code> and ensure that it reflects the partition configuration you used earlier:
  
 
<console>
 
<console>
(chroot) # ##i##emerge boot-update
+
(chroot) # ##i##nano -w /etc/fstab
 
</console>
 
</console>
  
Then, edit <code>/etc/boot.conf</code> and specify "<code>Funtoo Linux genkernel</code>" as the <code>default</code> setting at the top of the file, replacing <code>"Funtoo Linux"</code>.  
+
You can use arrow keys to move around and hit Control-X to exit. If you want to save your changes, type "<code>Y</code>" when asked if you want to save the modified buffer, or hit Control-O before closing <code>nano</code>. Otherwise your changes will be discarded.
 
+
<code>/etc/boot.conf</code> should now look like this:
+
  
 
<pre>
 
<pre>
boot {
+
# The root filesystem should have a pass number of either 0 or 1.
        generate grub
+
# All other filesystems should have a pass number of 0 or greater than 1.
        default "Funtoo Linux genkernel"
+
#
        timeout 3
+
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
}
+
#
 +
# See the manpage fstab(5) for more information.
 +
#
 +
# <fs>     <mountpoint>  <type>  <opts>        <dump/pass>
  
"Funtoo Linux" {
+
/dev/sda1    /boot         ext2    noauto,noatime 1 2
         kernel bzImage[-v]
+
/dev/sda2    none          swap    sw            0 0
        # params += nomodeset
+
/dev/sda3    /            ext4    noatime        0 1
}
+
#/dev/cdrom  /mnt/cdrom    auto    noauto,ro      0 0
 
</pre>
 
</pre>
  
Please read <code>man boot.conf</code> for further details.
+
{{Note|If you're using UEFI to boot, change the <code>/dev/sda1</code> line so it says <code>vfat</code> instead of <code>ext2</code>. Similarly, make sure that the <code>/dev/sda3</code> line specifies either <code>xfs</code> or <code>ext4</code>, depending on which filesystem you chose at filesystem-creation time.}}
  
===== Running grub-install and boot-update =====
+
==== /etc/localtime ====
  
Finally, we will need to actually install the GRUB boot loader to your disk, and also run <code>boot-update</code> which will generate your boot loader configuration file:
+
<code>/etc/localtime</code> is used to specify the timezone that your machine is in, and defaults to UTC. If you would like your Funtoo Linux system to use local time, you should replace <code>/etc/localtime</code> with a symbolic link to the timezone that you wish to use.
  
 
<console>
 
<console>
(chroot) # ##i##grub-install --no-floppy /dev/sda
+
(chroot) # ##i##ln -sf /usr/share/zoneinfo/MST7MDT /etc/localtime
(chroot) # ##i##boot-update
+
 
</console>
 
</console>
  
Now you need to update your boot loader configuration file:
+
The above sets the timezone to Mountain Standard Time (with daylight savings). Type <code>ls /usr/share/zoneinfo</code> to see what timezones are available. There are also sub-directories containing timezones described by location.
<console>
+
(chroot) # ##i##boot-update
+
</console>
+
You only need to run <code>grub-install</code> when you first install Funtoo Linux, but you need to re-run <code>boot-update</code> every time you modify your <code>/etc/boot.conf</code> file, so your changes are applied on next boot.
+
  
==== New School (UEFI) ====
+
==== /etc/make.conf ====
  
If you're using UEFI to boot, setting up the boot loader is a bit more complicated for now, but this process will be improving soon. Perform the following steps.
+
MAKEOPTS can be used to define how many parallel compilations should occur when you compile a package, which can speed up compilation significantly. A rule of thumb is the number of CPUs (or CPU threads) in your system plus one. If for example you have a dual core processor without [[wikipedia:Hyper-threading|hyper-threading]], then you would set MAKEOPTS to 3:
 
+
===== Unmask Grub 2.02_beta2 =====
+
 
+
Unmask the latest version of GRUB by placing this in your <code>/etc/portage/package.unmask</code>:
+
  
 
<pre>
 
<pre>
sys-boot/grub
+
MAKEOPTS="-j3"
 
</pre>
 
</pre>
  
The 2.00 version of GRUB has known issues with UEFI booting. Using 2.02 is essential for having this boot method work reliably.
+
If you are unsure about how many processors/threads you have then use nproc to help you.
 
+
<console>
===== Emerging GRUB =====
+
(chroot) # ##i##nproc
 +
16
 +
</console>
  
You will still use GRUB as a boot loader, but before emerging grub, you will need to enable EFI booting. To do this,
+
Set MAKEOPTS to this number plus one:
add the following line to <code>/etc/make.conf</code>:
+
  
 
<pre>
 
<pre>
GRUB_PLATFORMS="efi-64"
+
MAKEOPTS="-j17"
 
</pre>
 
</pre>
  
Then, <code>emerge boot-update</code>. You will notice <code>grub</code> and <code>efibootmgr</code> getting pulled in as dependencies. This is expected and good.
+
USE flags define what functionality is enabled when packages are built. It is not recommended to add a lot of them during installation; you should wait until you have a working, bootable system before changing your USE flags. A USE flag prefixed with a minus ("<code>-</code>") sign tells Portage not to use the flag when compiling. A Funtoo guide to USE flags will be available in the future. For now, you can find out more information about USE flags in the [http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=2&chap=2 Gentoo Handbook].
  
===== Installing GRUB =====
+
LINGUAS tells Portage which local language to compile the system and applications in (those who use LINGUAS variable like OpenOffice). It is not usually necessary to set this if you use English. If you want another language such as French (fr) or German (de), set LINGUAS appropriately:
  
Now, for the magic of getting everything in place for booting. You should copy your kernel and initramfs (if you have one -- you will if you are following the default install) to <tt>/boot</tt>. GRUB will boot those. But how do we get UEFI to boot GRUB? Well, we need to run the following command:
+
<pre>
 +
LINGUAS="fr"
 +
</pre>
  
 +
==== /etc/conf.d/hwclock ====
 +
If you dual-boot with Windows, you'll need to edit this file and change the value of '''clock''' from '''UTC''' to '''local''', because Windows will set your hardware clock to local time every time you boot Windows. Otherwise you normally wouldn't need to edit this file.
 
<console>
 
<console>
(chroot) # ##i##grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id="Funtoo Linux [GRUB]" --recheck /dev/sda
+
(chroot) # ##i##nano -w /etc/conf.d/hwclock
 
</console>
 
</console>
This command will simply install all the stuff to <tt>/boot/EFI</tt> and <tt>/boot/grub</tt> that your system needs to boot. In particular, the <tt>/boot/EFI/grub/grubx64.efi</tt> file will be created. This is the GRUB boot image that UEFI will load and start.
 
 
A more detailed explanation of the flags used in the above command:
 
* <code>--target=x86_64-efi</code>: Tells GRUB that we want to install it in a way that allows it to boot in UEFI
 
* <code>--efi-directory=/boot</code>: All GRUB UEFI files will be installed in ''/boot''
 
* <code>--bootloader-id="Funtoo Linux [GRUB]"</code>: This flag is not necessary for GRUB to boot. However, it allows you to change the text of the boot option in the UEFI BIOS. The stuff in the quotes can be set to anything that you would like.
 
* <code>--recheck</code>: If a device map already exists on the disk or partition that GRUB is being installed on, it will be removed.
 
* <code>/dev/sda</code>:The device that we are installing GRUB on.
 
 
===== Configuring GRUB =====
 
 
OK, now UEFI has the GRUB image it needs to boot. But we still need to configure GRUB itself so it finds and boots your kernel and initramfs. This is done by performing the following steps. Since boot-update doesn't yet support UEFI, we will use boot-update, but then edit our <code>/boot/grub/grub.cfg</code> to support UEFI booting.
 
 
First, you will need to edit <code>/etc/boot.conf</code>. Format this as you would if you were booting without UEFI. If you are not sure how this should look, below is an example of what it could look like if you are booting from an unencrypted ext4 partition:
 
 
{{file|name=/etc/boot.conf|desc=|body=
 
boot {
 
        generate grub
 
        default "Funtoo Linux"
 
        timeout 3
 
}
 
 
"Funtoo Linux" {
 
        kernel vmlinuz[-v]
 
        params += rootfstype=ext4 root=/dev/sda2
 
}
 
}}
 
 
After you have edited your <code>/etc/boot.conf</code> file, run <code>boot-update</code>. If you check your <code>/boot/grub/grub.cfg</code> now, you should see something like this:
 
 
{{file|name=/boot/grub/grub.cfg|desc=|body=
 
set timeout=3
 
 
  insmod part_gpt
 
  insmod fat
 
  set root=(hostdisk//dev/sda,gpt1)
 
  search --no-floppy --fs-uuid --set 3CFD-6884
 
if loadfont /grub/unifont.pf2; then
 
  set gfxmode=text
 
  insmod gfxterm
 
  insmod vbe
 
  terminal_output gfxterm
 
fi
 
 
set menu_color_normal=cyan/blue
 
set menu_color_highlight=blue/cyan
 
 
menuentry "Funtoo Linux - vmlinuz-3.16.3" {
 
  insmod part_gpt
 
  insmod fat
 
  set root=(hostdisk//dev/sda,gpt1)
 
  search --no-floppy --fs-uuid --set 3CFD-6884
 
  linux /vmlinuz-3.16.3 video=uvesafb:1920x1080-32,mtrr:3,ywrap rootfstype=ext4 root=/dev/sda2
 
  set gfxpayload=text
 
}
 
set default=0
 
}}
 
 
To get your <code>/boot/grub/grub.cfg</code> to support booting with UEFI, make your <code>/boot/grub/grub.cfg</code> look like this:
 
{{file|name=/boot/grub/grub.cfg|desc=|body=
 
set timeout=3
 
 
  insmod part_gpt
 
  insmod fat
 
  insmod efi_gop
 
  insmod efi_uga
 
  set root=(hostdisk//dev/sda,gpt1)
 
  search --no-floppy --fs-uuid --set 3CFD-6884
 
if loadfont /grub/unifont.pf2; then
 
  set gfxmode=auto
 
  insmod gfxterm
 
  insmod vbe
 
  terminal_output gfxterm
 
fi
 
 
set menu_color_normal=cyan/blue
 
set menu_color_highlight=blue/cyan
 
  
menuentry "Funtoo Linux - vmlinuz-3.16.3" {
+
==== Localization ====
  insmod part_gpt
+
  insmod fat
+
  set root=(hostdisk//dev/sda,gpt1)
+
  search --no-floppy --fs-uuid --set 3CFD-6884
+
  linux /vmlinuz-3.16.3 video=uvesafb:1920x1080-32,mtrr:3,ywrap rootfstype=ext4 root=/dev/sda2
+
  set gfxpayload=keep
+
}
+
set default=0
+
}}
+
  
The lines that we have added and altered do the following:
+
By default, Funtoo Linux is configured with Unicode (UTF-8) enabled, and for the US English locale and keyboard. If you would like to configure your system to use a non-English locale or keyboard, see [[Funtoo Linux Localization]].
* <code>insmod efi_gop</code> and <code>insmod efi_uga</code>: Both of these involve adding support for the UEFI framebuffer to GRUB.
+
* <code>set gfxmode=auto</code>: Instead of having the GRUB boot option screen being displayed at the smallest resolution possible, changing this to auto will make it fit the resolution of your display.
+

Revision as of 23:47, November 18, 2014


Note

This is a template that is used as part of the Installation instructions which covers: the process of configuring your Funtoo Linux system. Templates are being used to allow multiple variant install guides that use most of the same re-usable parts.


Configuring your system

As is expected from a Linux distribution, Funtoo Linux has its share of configuration files. The one file you are absolutely required to edit in order to ensure that Funtoo Linux boots successfully is /etc/fstab. The others are optional. Here are a list of files that you should consider editing:

File Do I need to change it? Description
/etc/fstab YES - required Mount points for all filesystems to be used at boot time. This file must reflect your disk partition setup. We'll guide you through modifying this file below.
/etc/localtime Maybe - recommended Your timezone, which will default to UTC if not set. This should be a symbolic link to something located under /usr/share/zoneinfo (e.g. /usr/share/zoneinfo/America/Montreal)
/etc/make.conf (symlink) - also known as:
/etc/portage/make.conf
Maybe - recommended Parameters used by gcc (compiler), portage, and make. It's a good idea to set MAKEOPTS. This is covered later in this document.
/etc/conf.d/hostname Maybe - recommended Used to set system hostname. Set the hostname variable to the fully-qualified (with dots, ie. foo.funtoo.org) name if you have one. Otherwise, set to the local system hostname (without dots, ie. foo). Defaults to localhost if not set.
/etc/hosts No You no longer need to manually set the hostname in this file. This file is automatically generated by /etc/init.d/hostname.
/etc/conf.d/keymaps Optional Keyboard mapping configuration file (for console pseudo-terminals). Set if you have a non-US keyboard. See Funtoo Linux Localization.
/etc/conf.d/hwclock Optional How the time of the battery-backed hardware clock of the system is interpreted (UTC or local time). Linux uses the battery-backed hardware clock to initialize the system clock when the system is booted.
/etc/conf.d/modules Optional Kernel modules to load automatically at system startup. Typically not required. See Additional Kernel Resources for more info.
/etc/conf.d/consolefont Optional Allows you to specify the default console font. To apply this font, enable the consolefont service by running rc-update add consolefont.
profiles Optional Some useful portage settings that may help speed up intial configuration.

If you're installing an English version of Funtoo Linux, you're in luck as most of the configuration files can be used as-is. If you're installing for another locale, don't worry. We will walk you through the necessary configuration steps on the Funtoo Linux Localization page, and if needed, there's always plenty of friendly, helpful support. (See Community)

Let's go ahead and see what we have to do. Use nano -w <name_of_file> to edit files -- the "-w" disables word-wrapping, which is handy when editing configuration files. You can copy and paste from the examples.

Warning

It's important to edit your /etc/fstab file before you reboot! You will need to modify both the "fs" and "type" columns to match the settings for your partitions and filesystems that you created with gdisk or fdisk. Skipping this step may prevent Funtoo Linux from booting successfully.

/etc/fstab

/etc/fstab is used by the mount command which is ran when your system boots. Statements of this file inform mount about partitions to be mounted and how they are mounted. In order for the system to boot properly, you must edit /etc/fstab and ensure that it reflects the partition configuration you used earlier:

(chroot) # nano -w /etc/fstab

You can use arrow keys to move around and hit Control-X to exit. If you want to save your changes, type "Y" when asked if you want to save the modified buffer, or hit Control-O before closing nano. Otherwise your changes will be discarded.

# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
#
# See the manpage fstab(5) for more information.
#
# <fs>	     <mountpoint>  <type>  <opts>         <dump/pass>

/dev/sda1    /boot         ext2    noauto,noatime 1 2
/dev/sda2    none          swap    sw             0 0
/dev/sda3    /             ext4    noatime        0 1
#/dev/cdrom  /mnt/cdrom    auto    noauto,ro      0 0

Note

If you're using UEFI to boot, change the /dev/sda1 line so it says vfat instead of ext2. Similarly, make sure that the /dev/sda3 line specifies either xfs or ext4, depending on which filesystem you chose at filesystem-creation time.

/etc/localtime

/etc/localtime is used to specify the timezone that your machine is in, and defaults to UTC. If you would like your Funtoo Linux system to use local time, you should replace /etc/localtime with a symbolic link to the timezone that you wish to use.

(chroot) # ln -sf /usr/share/zoneinfo/MST7MDT /etc/localtime

The above sets the timezone to Mountain Standard Time (with daylight savings). Type ls /usr/share/zoneinfo to see what timezones are available. There are also sub-directories containing timezones described by location.

/etc/make.conf

MAKEOPTS can be used to define how many parallel compilations should occur when you compile a package, which can speed up compilation significantly. A rule of thumb is the number of CPUs (or CPU threads) in your system plus one. If for example you have a dual core processor without hyper-threading, then you would set MAKEOPTS to 3:

MAKEOPTS="-j3" 

If you are unsure about how many processors/threads you have then use nproc to help you.

(chroot) # nproc
16

Set MAKEOPTS to this number plus one:

MAKEOPTS="-j17"

USE flags define what functionality is enabled when packages are built. It is not recommended to add a lot of them during installation; you should wait until you have a working, bootable system before changing your USE flags. A USE flag prefixed with a minus ("-") sign tells Portage not to use the flag when compiling. A Funtoo guide to USE flags will be available in the future. For now, you can find out more information about USE flags in the Gentoo Handbook.

LINGUAS tells Portage which local language to compile the system and applications in (those who use LINGUAS variable like OpenOffice). It is not usually necessary to set this if you use English. If you want another language such as French (fr) or German (de), set LINGUAS appropriately:

LINGUAS="fr"

/etc/conf.d/hwclock

If you dual-boot with Windows, you'll need to edit this file and change the value of clock from UTC to local, because Windows will set your hardware clock to local time every time you boot Windows. Otherwise you normally wouldn't need to edit this file.

(chroot) # nano -w /etc/conf.d/hwclock

Localization

By default, Funtoo Linux is configured with Unicode (UTF-8) enabled, and for the US English locale and keyboard. If you would like to configure your system to use a non-English locale or keyboard, see Funtoo Linux Localization.