Difference between pages "Funtoo Linux Installation" and "Installation (Tutorial)"

From Funtoo
(Difference between pages)
Jump to navigation Jump to search
 
m (fix a delete template & fancy note to note ;-))
 
Line 1: Line 1:
<div class="container"><div class="row"><div class="col-sm-12 col-md-9">
{{delete}}
== Introduction ==
{{note|If you want to do a standard Funtoo Linux installation, I recommend you use the shorter, official [[Funtoo Linux Installation]] Instructions instead. -Daniel}}


This document was written to help you install Funtoo Linux as concisely as possible, with a minimum number of distracting options regarding system configuration.  
__TOC__
 
== Introduction ==
 
This HowTo aims to give the experienced GNU/Linux User a quick way to install Funtoo Linux in a nice and fast way. Also we will give you all the necessary steps for installing Funtoo GNU/Linux in this guide, but we won't go deeper into the details of them as need
 
There are two ways of installing Funtoo GNU/Linux on your PC:
 
# using an already installed GNU/Linux System or
# using a LiveCD
 
If you plan to use a LiveCD, we recommend you to use [http://www.sysresccd.org/ SystemRescueCd].
 
All the commands in this guide are performed as "root", unless we indicate it otherwise.
 
This HowTo will cover the following four setups:
 
# a standard Installation (MBR, HDD not encrypted),
# a standard secure Installation (MBR, HDD encrypted),
# a modern Installation (GPT/GUID partition table, HDD not encrypted) and
# a modern secure Installation (GPT/GUID partition table, HDD encrypted).
 
These four approaches have the following Pros and Cons:
 
 
{| border="1" cellpadding="4"
|-
! Setup !! Pro !! Contra
|-
| 1
|
* Easy method mostly used by all distributions
* Well documented everywhere
* Time saving method
* No special EFI-partition needed
* Dualbootable with Microsoft® Windows™
|
*Partition table limited 4 primary ones only
* Needs special 4th partition for more than 4 partitions
* HDD not encrypted, can easily be cloned
|-
| 2
|
* Easy method mostly used by all distributions
* Well documented everywhere
* No special EFI-partition needed
* HDD encrypted
* Dualbootable with Microsoft® Windows™
* Logical volume groups for GNU/Linux
|
*Partition table limited 4 primary ones only
* Need special 4th partition for more than 4 partitions
* Needs lot of time for preparing the HDD to be encrypted
|-
| 3
|
* Easy method but nearly not used by other distributions
* No special partiton needed for more than 4 partitions
* Time saving method
|
* Need special EFI-partition for boot-manager
* Special kernel attributes are needed
* Not compatible with Microsoft® Windows™
* Not supported on all platforms especially for the system volume
* HDD not encrypted, can easily be cloned from other linux systems
|-
| 4
|
* Easy method but nearly not used by other distributions
* No special partition needed for more than 4 partitions
* HDD encrypted
* Logical volume groups
|
* Need special EFI-partition for boot-manager
* Special kernel attributes are needed
* Not compatible with Microsoft® Windows™
* Not supported on all platforms especially for the system volume
* Needs lot of time for preparing the HDD to be encrypted
|}
 
With the help of the the above table you should be able to select your future Hard Disk (HDD) partitioning scheme. In the further guide we will go through every single step for all four schemes.
 
For booting your old/other GNU/Linux System we won't give you a special detailed howto guide, as you should know how to do so, as concerning the booting with [http://www.sysresccd.org SystemRescueCd], we will give you a short step-by-step guide on how to boot up the system.
 
This guide will only be split into subparts for the installation process if concerning the four above mentioned steps, here the split points will be MBR vs. GPT/GUID-partitioning and encrypted vs. unencrypted HDD. So be aware of these parts if you want to use them.
 
== Booting the Installation System ==
 
=== Booting old/other GNU/Linux ===
 
This step is really simple, as you know your old GNU/Linux System and you need simply start your Computer, select in the boot-loader your GNU/Linux System, let it start up, log in as always and start a root-terminal.
 
=== Booting with SystemRescueCd ===
 
First step is to download [http://www.sysresccd.org SystemRescueCd], an overview of the actual version can be found at [http://www.sysresccd.org/Download http://www.sysresccd.org/Download], just follow there the link to the Sourceforge Download, you will download then about 300 MB to your HDD. If finished burn this ISO-image with your favorite burning tool like ''burn-cd, bashburn, K3B, GNOMEbaker'' on a GNU/Linux Box or ''NERO Burning ROM, CDBurnerXP Pro, and many more'' on a Microsoft® Windows™ box.
[[Image:fqi-001.png|center]]
 
Next insert this CD into your CD-ROM-Drive and boot up the PC with it where you want to install Funtoo GNU/Linux. Make sure you boot from the CD when booting. The Booting process with [http://www.sysresccd.org SystemRescueCd] will follow the next steps:
 
# Selecting your Kernel to boot [http://www.sysresccd.org/ SystemRescueCd] with:
[[Image:fqi-002.png|center]]
In that screen you will be greeted with all the power of [http://www.sysresccd.org/ SystemRescueCd], depending on your CPU we use the boot option 1) for a 32-bit CPU or a 64-bit CPU that should run in 32-bit mode and 6) for a 64-bit CPU in 64-bit mode. If this boot option fails, use the boot option A) or B), will will lead to the following screen:
[[Image:fqi-003.png|center]]
That menu will give you more boot options. If you select 1. here, it would be the same kernel option like in the previous screen 1) and 6). The next step is to select your keyboard layout for installation.
# Selecting your Installation Keyboard Layout
[[Image:fqi-004.png|center]]
That step requires a bit of your atention, as it only gives you 20 seconds time to choose your keyboard layout, if you are OK with the US keymap, just press Enter to accept the default setting.
# Being ready
Seconds later [http://www.sysresccd.org/ SystemRescueCd] welcomes you wit a short message and is ready fo you to be used to perform your installation.
[[Image:fqi-005.png|center]]
 
= HDD Preparation =
As mentioned earlier in this guide we cover four different installation variations, the could be displayed in an installation matrix as below:
 
{| cellpadding="4"
|-
!  !! '''MBR''' !! '''GPT'''
|-
| '''unencrypted''' || See [[#MBR|MBR]] || See [[#GPT/GUID partition table|GPT/GUID partition table]]
|-
| '''encrypted''' || See [[#MBR|MBR]] || See [[#GPT/GUID partition table|GPT/GUID partition table]]
|}
 
If you are going to plan to install Funtoo GNU/Linux on a machine where another O/S is already installed, you have to make some free space available on your HDD in order to do so. A resize of most existing filesystems can be done with [http://www.sysresccd.org/ SystemRescueCd] too. You just need to enter the graphical environment and use gparted. We will give you a short example on how to do so with a sample HDD that might hold windows, so you get a feeling what to do, but be aware that a resize can be a dangerous part, so please keep a backup of your data, as Funtoo Technologies wouldn't take any responsibility for a loss of data that could happen by the process of shrinking a partition.
 
Starting the graphical environment in [http://www.sysresccd.org/ SystemRescueCd] is really simple, just execute the following command:
 
<pre>
root@sysresccd /root % wizard
</pre>
 
and it will start a dialog for the graphical environment setup, for most users the default options should be OK. Both the dialog and the graphical environment (Xfce) are shown in the next two images.
 
[[Image:fqi-006.png|center]]
[[Image:fqi-007.png|center]]
 
=== Resize of HDD partitions ===
 
The above screen shows us that there is the tool called GParted right on the frontpanel. That tool will be used to resize our HDD partitions. The following screen shows us an example of how the tool looks if you start it.
[[Image:fqi-008.png|center]]
By clicking on the partion you want to resize you make it active right-click on it and use the point resize and you will see the Resize/Move dialog, here you can edit the resize options for that partiton.
[[Image:fqi-009.png|center]]
When you finished setting the resize options, you will see that the grey-green hook in the menu got green, that means you have jobs added to the working list. If you have all actions done on the partition, click on the green hook and your resize action will run by giving you the following feedback window:
[[Image:fqi-010.png|center]]
when that has finished you will see the resized result and it should look like that:
[[Image:fqi-011.png|center]]
we are finished with resizing the dis partitions, exit the Tool and close Xfce by clicking the running exit man in the down right. We are back on the command line and are ready to partitions our disk. to our needs, for a unified way we will show it with an empty partition table, so if you have resized some partitions, they will be listed in the MBR menu, as if you want to use an GPT/GUID partition table we will start from a clean table anyway.
 
=== Partitioning scheme ===
 
{{fancywarning|If you are partitioning the hard drive of a SPARC machine, please see [[Funtoo Linux Installation on SPARC]]. Also, note that '''OpenBoot has no support for GPT volumes and you won't be able to boot on the system volume if that later has been partitioned with GPT.''' }}
 
For partitioning we suggest the following schemes:
* MBR unencrypted
 
{| cellpadding="4"
|-
! Partition !! Size !! fdisk option !! Filesystem (FS)
|-
| /boot || 200 MB || 83 || ext2
|-
| swap || 2x RAM if 1024 MB or less, otherwise 2 GB || 82 || sw (default)
|-
| / || 20-50 GB || 83 || ext4
|-
| /usr/portage || ~10 GB || 83 || ext4
|-
| /home || As much as possible. || 83 || xfs
|}
 
* MBR encrypted
 
{| cellpadding="4"
|-
! Partition !! Size !! fdisk option !! FS
|-
| /boot || 200 MB || 83 || ext2
|-
| cryptoroot || Rest of the Disc || 83 || none
|}
 
* GPT unencrypted
 
{| cellpadding="4"
|-
! Partition !! Size !! gdisk option !! FS
|-
| /boot || 200 MB || 0700 || ext2
|-
| EFI-Boot || 512 kB || EF02 || none
|-
| swap || 2x RAM if 1024 MB or less, otherwise 2 GB || 8200 || swap (default)
|-
| / || 20 - 50 GB || 0700 || ext4
|-
| /usr/portage || ~10 GB || 0700 || ext4
|-
| /home || Rest of the Disc || 0700 || xfs
|}
 
* GPT encrypted
 
{| cellpadding="4"
|-
! Partition !! Size !! gdisk option !! FS
|-
| /boot || 200 MB || 0700 || ext2
|-
| EFI-Boot || 512 kB || EF02 || none
|-
| cryptoroot || Rest of the Disc || 0700 || none
|}
 
=== MBR ===
 
Now we will partition the HDD using the above scheme with a disk partitioning tool named "fdisk". So just invoke it with the following command:
 
<pre>
# fdisk /dev/sda
</pre>
 
it will greet you like this
[[Image:fqi-012.png|center]]
by pressing <tt>`m`</tt> you will get a help context menu that will give you the following options:
 
<pre>
  a  toggle a bootable flag
  b  edit bsd disklabel
  c  toggle the dos compatibility flag
  d  delete a partition
  l  list known partition types
  m  print this menu
  n  add a new partion
  o  create a new empty DOS partition table
  p  print the partition table
  q  quit without saving changes
  s  create a new empty Sun disklabel <--- SPARC specific, see Funtoo installation notes for SPARC
  t  change a partition's system id
  u  change display/entry units
  v  verify the partition table
  w  write table to disk and exit
  x  extra functionality (experts only)
</pre>
 
The partitioning scheme is created with the following commands inside of fdisk:
 
==== unencrypted ====
 
<pre>
Command (m for help): n
</pre>
 
it will ask you now if you want to add a primary or extended partition, we choose primary by pressing
 
<pre>
Command action
  e  extended
  p  primary partition (1-4)
p
</pre>
 
and use for the next 2 steps the default options and add as the Last Sector for the first partition the following:
 
<pre>
Partition number (1-4, default 1): (default)
Using default value 1
First sector: (Use default)
Using default value
Last sector, ...: +200M
</pre>
 
your input should look like that right now:
[[Image:fqi-013.png|center]]
next we need to make the partition bootable and add then the rest of the partitions:
 
<pre>
Command (m for help): a
Partition number (1-4): 1
 
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 83
 
Command (m for help): n
Command action
  e  extended
  p  primary partition (1-4)
p
Partition number (1-4, default 2): (default)
Using default value 2
First sector: (Use default)
Using default value
Last sector, ...: +2G
 
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 82
Changed system type of partition 2 to 82 (Linux swap / Solaris)
 
Command (m for help): n
Command action
  e  extended
  p  primary partition (1-4)
p
Partition number (1-4, default 3): (default)
Using default value 3
First sector: (Use default)
Using default value
Last sector, ...: +20G
 
Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 83
 
Command (m for help): n
Command action
  e  extended
  p  primary partition (1-4)
e
Selected partition 4
First sector: (Use default)
Using default value
Last sector, ...: (Use default)
Using default value


These docs assume you have a "PC compatible" computer system with a standard PC BIOS. Many new computers support UEFI for booting, which is a new firmware interface that frequently replaces the older MBR-based BIOS. If you have a system with UEFI, you will want to use this documentation along with the [[UEFI Install Guide]], which will augment these instructions and explain how to get your system to boot. You may need to change your PC BIOS settings to enable or disable UEFI booting. The [[UEFI Install Guide]] has more information on this, and steps on how to determine if your system supports UEFI.
Command (m for help): n
First sector: (Use default)
Using default value
Last sector, ...: +10G


We also offer a [[ZFS Install Guide]], which augment the instructions on this page for those who want to install Funtoo Linux on ZFS.  If you are installing Funtoo Linux on [[Funtoo Linux Installation on ARM|ARM]] architecture, please see [[Funtoo Linux Installation on ARM]] for notable differences regarding ARM support. An experimental Funtoo Linux build also exists for [[Funtoo Linux Installation on SPARC|SPARC]] platforms. See [[Funtoo Linux Installation on SPARC]].
Command (m for help): t
Partition number (1-5): 5
Hex code (type L to list codes): 83


If you've had previous experience installing Gentoo Linux then a lot of steps will be familiar, but you should still read through as there are a few differences.
Command (m for help): n
First sector: (Use default)
Using default value
Last sector, ...: (Use default)


== Installation Overview ==
Command (m for help): t
Partition number (1-6): 6
Hex code (type L to list codes): 83


This is a basic overview of the Funtoo installation process:
Command (m for help): p
</pre>


# [[#Live CD|Download and boot the live CD of your choice]].
this will result in the following output
# [[#Prepare Hard Disk|Prepare your disk]].
[[Image:fqi-014.png|center]]
# [[#Creating filesystems|Create]] and [[#Mounting filesystems|mount]] filesystems.
now just write the partition table to your disk by using <tt>`w`</tt>, this will result in the following output:
# [[#Installing the Stage 3 tarball|Install the Funtoo stage tarball]] of your choice.
# [[#Chroot into Funtoo|Chroot into your new system]].
# [[#Downloading the Portage tree|Download the Portage tree]].
# [[#Configuring your system|Configure your system]] and [[#Configuring your network|network]].
# [[#Configuring and installing the Linux kernel|Install a kernel]].
# [[#Installing a Bootloader|Install a bootloader]].
# [[#Finishing Steps|Complete final steps]].
# [[#Restart your system|Reboot and enjoy]].


=== Live CD ===
<pre>
Command (m for help): w
The partition table has been altered!


Funtoo doesn't provide an "official" Funtoo Live CD, but there are plenty of good ones out there to choose from. A great choice is the Gentoo-based [http://www.sysresccd.org/ System Rescue CD] as it contains lots of tools and utilities and supports both 32-bit and 64-bit systems.
Calling ioctl() to re-read partition table.
Syncing disks.
</pre>


It is also possible to install Funtoo Linux using many other Linux-based live CDs. Generally, any modern bootable Linux live CD or live USB media will work. See [[Requirements|requirements]] for an overview of what the Live Media must provide to allow a problem-free install of Funtoo Linux.
If that was your scheme, you are now so far to get to the partition formatting section.


To begin a Funtoo Linux installation, download System Rescue CD from:
==== encrypted ====


{{MirrorList}}
<pre>
Command (m for help): n
</pre>


Or, use your preferred live media. Insert it into your disc drive, and boot from it. If using an older version of System Rescue CD, '''be sure to select the <code>rescue64</code> kernel at the boot menu if you are installing a 64-bit system'''. By default, System Rescue CD used to boot in 32-bit mode though the latest version attempts to automatically detect 64-bit processors.
it will ask you now if you want to add a primary or extended partition, we choose primary by pressing


=== Prepare Hard Disk ===
<pre>
==== Partitions ====
Command action
  e  extended
  p  primary partition (1-4)
p
</pre>


Funtoo Linux fully supports traditional MBR partitions, as well as newer GPT/GUID partition formats. See below to determine which partitioning scheme to use:
and use for the next 2 steps the default options and add as the Last Sector for the first partition the following:


===== MBR Partitions =====
<pre>
Partition number (1-4, default 2): (default)
Using default value 1
First sector: (Use default)
Using default value
Last sector, ...: +200M
</pre>


* '''Recommended if your system disk is <=2TB in size'''
Next we need to make the partition bootable and add then the rest of the partition:
* Legacy, DOS partitioning scheme
* Only 4 primary partitions per disk; after that, you must use "logical" partitions
* Does not support 2 TB+ disks for booting
* Compatible with certain problematic systems (such as the HP ProBook 4520)
* Dual-boot with Windows for BIOS systems (Windows handle GPT only on true EFI systems, whatever version it is)
* Multiple boot loader options, e.g. GRUB 2, GRUB Legacy, lilo


{{fancynote|Due to the fact that it is more widely supported on PC hardware, it is best to use MBR partitions if possible.}}
<pre>
Command (m for help): a
Partition number (1-4): 1


===== GPT Partitions =====
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 83


* '''Recommended if your disk is >2TB in size'''
Command (m for help): n
* Newer format for Linux systems
Command action
* Supports 2 TB+ hard drives for booting
  e  extended
* Supports hundreds of partitions per disk of any size
  p  primary partition (1-4)
* Requires legacy BIOS boot partition (~32 MB) to be created if system does not use EFI
p
* Requires bootloader with support for GPT such as GRUB 2, EXTLINUX, or a patched version of GRUB Legacy
Partition number (1-4, default 2): (default)
Using default value 2
First sector: (Use default)
Using default value
Last sector, ...: (use default)


{{fancyimportant|If you have a system disk that is 2TB or greater and want to use the space beyond 2TB, you ''must'' partition using the GPT/GUID format. Otherwise, MBR is recommended as the most reliable boot method.}}
Command (m for help): p
</pre>


===== Filesystem Resources =====
this will result in the following output
[[Image:fqi-015.png|center]]
now just write the partition table to your disk by using <tt>w</tt>, this will result in the following output:


Advanced users may be interested in the following topics:
<pre>
Command (m for help): w
The partition table has been altered!


* [[GUID Booting Guide]]
Calling ioctl() to re-read partition table.
* [[LVM Install Guide]]
Syncing disks.
* [[Rootfs over encrypted lvm]]
</pre>
* [[Rootfs over encrypted lvm over raid-1 on GPT]]
* '''NEW!''' '''[[ZFS Install Guide]] (Also contains instructions for Rootfs over Encrypted ZFS!)'''


===== Partitioning Recommendations =====
next we need to prepare our cryto-container that will keep all the encrypted stuff in it. For that, go to the [[#Cryptocontainer|Cryptocontainer]] section.


Below are our partitioning recommendations in table form. For MBR-based partitions, use the MBR Block Device and MBR code columns with <code>fdisk</code>. For GPT-based partitions, use the GPT Block Device and GPT Code columns with <code>gdisk</code>:
=== GPT/GUID partition table ===


{{TableStart}}
This setup is for most users more intuitive,  since we don't need to care about extended partitions. We only need to setup an extra partition for our bootloader. So let us do it for unencrypted and encrypted partitions.
<tr class="active"><th>Partition</th>
<th>Size</th>
<th>MBR Block Device (<code>fdisk</code>)</th>
<th>GPT Block Device (<code>gdisk</code>)</th>
<th>Filesystem</th>
<th>MBR Code</th>
<th>GPT Code</th>
</tr><tr>
<td><code>/boot</code></td>
<td>512 MB</td>
<td><code>/dev/sda1</code></td>
<td><code>/dev/sda1</code></td>
<td>ext2</td>
<td>83</td>
<td>8300</td>
</tr><tr>
<td>GRUB boot loader partition</td>
<td>1 MB</td>
<td>''not required for MBR''</td>
<td><code>/dev/sda2</code></td>
<td>For GPT/GUID only, skip for MBR - no filesystem.</td>
<td>''N/A''</td>
<td>EF02</td>
</tr><tr>
<td>swap</td>
<td>2x RAM for low-memory systems and production servers; otherwise 2GB.</td>
<td><code>/dev/sda2</code></td>
<td><code>/dev/sda3</code></td>
<td>swap (default)</td>
<td>82</td>
<td>8200</td>
</tr><tr>
<td><code>/</code> (root)</td>
<td>Rest of the disk, minimum of 10GB.  Note: to compile the <code>debian-sources</code> kernel, as described later on this page, requires a minimum of 14GB free space in <code>/tmp</code>; consider a minimum of 20GB in this case.</td>
<td><code>/dev/sda3</code></td>
<td><code>/dev/sda4</code></td>
<td>XFS recommended, alternatively ext4</td>
<td>83</td>
<td>8300</td>
</tr><tr>
<td><code>/home</code> (optional) </td>
<td>User storage and media. Typically most of the disk.</td>
<td><code>/dev/sda4</code> (if created)</td>
<td><code>/dev/sda5</code> (if created)</td>
<td>XFS recommended, alternatively ext4</td>
<td>83</td>
<td>8300</td>
</tr><tr>
<td>LVM (optional)</td>
<td>If you want to create an LVM volume.</td>
<td><code>/dev/sda4</code> (PV, if created)</td>
<td><code>/dev/sda5</code> (PV, if created)</td>
<td>LVM PV</td>
<td>8E</td>
<td>8E00</td>
</tr>{{TableEnd}}


===== Partitioning Using fdisk (MBR) =====
For setting up the GPT partition table we use the tool "gdisk", that is the GPT equivalent of fdisk.


{{fancyimportant|If you need to create a GPT partition table, see [[Partitioning using gdisk]].}}
Just start it with the following command:


{{fancynote|These install instructions assume you are installing Funtoo Linux to an hard disk using Master Boot Record partition tables (MBR). If you are installing Funtoo Linux on a machine where another OS is installed, there is an existing Linux distribution on your system that you want to keep or any other scenario (such as differing swap size requirements), then you will need to adapt these instructions to suit your needs.}}
<pre>
gdisk /dev/sda
</pre>


<code>fdisk</code> is the tool used to create an MBR partition table. MBR is well-supported on PCs and is recommended if your system disk is 2TB or smaller.
it will greet you with the following screen
[[Image:fqi-016.png|center]]


====== Preparation ======
==== unencrypted ====


First, it's a good idea to make sure that you've found the correct hard disk to partition. Try this command and verify that <code>/dev/sda</code> is the disk that you want to partition:
Next we will create the partitions for our unencrypted setup:


<console>
<pre>
# ##i##fdisk -l /dev/sda
Command (? for help): n
Partition number (1-128, default 1): (Use default)
First sector (34-..., default = 34) or ...: (Use default)
Information: Moved requested sector from 34 to 2048 in
order to align on 2048-sector boundaries.
Use 'l' on the experts' menu to adjust alignment
Last sector (2048-..., default = ...) or ...: +200M
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): (ENTER)
Changed type of partition to 'Linux/Windows data'
 
Command (? for help): n
Partion number (2-128, default 2): (Use default)
First sector (...) or ...: (Use default)
Last sector (...) or (...): +512K
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): ef02
Changed type of partition to 'BIOS boot partition'


Disk /dev/sda: 640.1 GB, 640135028736 bytes, 1250263728 sectors
Command (? for help): n
Units = sectors of 1 * 512 = 512 bytes
Partition number (3-128, default 3): (Use default)
Sector size (logical/physical): 512 bytes / 512 bytes
First sector (...) or ...: (Use default)
I/O size (minimum/optimal): 512 bytes / 512 bytes
Last sector (...) or (...): +2G
Disk label type: gpt
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): 8200
Changed type of partition to 'Linux swap'


Command (? for help): n
Partition number 4-128, default 4): (Use default)
First sector (...) or ...: (Use default)
Last sector (...) or (...): +20G
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): (ENTER)
Changed type of partition to 'Linux/Windows data'


#        Start          End    Size  Type            Name
Command (? for help): n
1        2048  1250263694  596.2G  Linux filesyste Linux filesystem
Partition number 5-128, default 5): (Use default)
</console>
First sector (...) or ...: (Use default)
Last sector (...) or (...): +10G
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): (ENTER)
Changed type of partition to 'Linux/Windows data'


Now, it's recommended that you erase any existing MBR or GPT partition tables on the disk, which could confuse the system's BIOS at boot time. We do this using <code>sgdisk</code>:
Command (? for help): n
{{fancywarning|This will make any existing partitions inaccessible! You are '''strongly''' cautioned and advised to backup any critical data before proceeding.}}
Partition number 6-128, default 6): (Use default)
First sector (...) or ...: (Use default)
Last sector (...) or (...): (Use default)
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): (ENTER)
Changed type of partition to 'Linux/Windows data'


<console>
Command (? for help): p
# ##i##sgdisk --zap-all /dev/sda
</pre>


Creating new GPT entries.
will now show you a disk partitioning like that one:
GPT data structures destroyed! You may now partition the disk using fdisk or
[[Image:fqi-017.png|center]]
other utilities.
now write the table to your disk with <tt>w</tt>;
</console>


This output is also nothing to worry about, as the command still succeded:
<pre>
Command (? for help): w
 
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!
 
Do you want to proceed, possibly destroying your data? (Y/N): Y
OK; writing new GUID partition table (GPT).
The operation has completed successfully.
</pre>
 
Now go the section about creating the filesystem on MBR.
 
==== encrypted ====
 
Next we will create the partitions for our encrypted setup:
 
<pre>
Command (? for help): n
Partition number (1-128, default 1): (Use default)
First sector (34-..., default = 34) or ...: (Use default)
Information: Moved requested sector from 34 to 2048 in
order to align on 2048-sector boundaries.
Use 'l' on the experts' menu to adjust alignment
Last sector (2048-..., default = ...) or ...: +200M
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): (ENTER)
Changed type of partition to 'Linux/Windows data'
 
Command (? for help): n
Partion number (2-128, default 2): (Use default)
First sector (...) or ...: (Use default)
Last sector (...) or (...): +512K
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): ef02
Changed type of partition to 'BIOS boot partition'
 
Command (? for help): n
Partition number (3-128, default 3): (Use default)
First sector (...) or ...: (Use default)
Last sector (...) or (...): (Use default
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): (ENTER)
Changed type of partition to 'Linux/Windows data'
 
Command (? for help): p
</pre>
 
will now show you a disk partitioning like that one:
[[Image:fqi-018.png|center]]
now write the table to your disk with <tt>w</tt>;
 
<pre>
Command (? for help): w
 
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!
 
Do you want to proceed, possibly destroying your data? (Y/N): Y
OK; writing new GUID partition table (GPT).
The operation has completed successfully.
</pre>


<console>
Now go to the Cryptocontainer setup.
***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory.  
***************************************************************
</console>


====== Partitioning ======
=== Cryptocontainer ===


Now we will use <code>fdisk</code> to create the MBR partition table and partitions:
Setting up the cryptocontainer for our encrypted system is in both cases nearly identically, but for the easier showing effect we will give both examples in a seperate subsection.


<console>
==== MBR ====
# ##i##fdisk /dev/sda
</console>


Within <code>fdisk</code>, follow these steps:
First we will prepare the HDD for being encrypted, if you use [http://www.sysresccd.org/ SystemRescueCd] in version 2.0.1 or higher just execute the following commands:


'''Empty the partition table''':
{{fancynote|If you want to see progress of dd than you have to open another terminal and execute: <tt>kill -s USR1 `pidof dd`</tt>}}


<console>
<pre>
Command (m for help): ##i##o ↵
# dd if=/dev/zero of=/dev/sda2 bs=100M
</console>
# dd if=/dev/urandom of=/dev/sda2 bs=100M
</pre>


'''Create Partition 1''' (boot):
This part is optional but for security reason we advise you to do so if you like to have a secure encrypted disk. This part takes a lot of time, let your Computer run and get out to sleep and work, as it might take a day or two depending on your HDD size. :)


<console>
You should also be aware that you will get a hint about reaching the end of your HDD. That's intended and desired in this case so that the command can work without knowing your disk-size.
Command (m for help): ##i##n ↵
Partition type (default p): ##i##↵
Partition number (1-4, default 1): ##i##↵
First sector: ##i##↵
Last sector: ##i##+128M ↵
</console>


'''Create Partition 2''' (swap):
If you ran the above commands you should see an output similar to the one shown in the screenshot:
[[Image:fqi-019.png|center]]


<console>
Next we need to encrypt our HDD, that will be done with the following commands:
Command (m for help): ##i##n ↵
Partition type (default p): ##i##↵
Partition number (2-4, default 2): ##i##↵
First sector: ##i##↵
Last sector: ##i##+2G ↵
Command (m for help): ##i##t ↵
Partition number (1,2, default 2): ##i## ↵
Hex code (type L to list all codes): ##i##82 ↵
</console>


'''Create the root partition:'''
<pre>
# cryptsetup -c aes-xts-plain luksFormat /dev/sda2


<console>
WARNING!
Command (m for help): ##i##n ↵
========
Partition type (default p): ##i##↵
This will overwrite data on /dev/sda2 irrevocably.
Partition number (3,4, default 3): ##i##↵
First sector: ##i##↵
Last sector: ##i##↵
</console>


'''Verify the partition table:'''
Are you sure (Type uppercase yes): YES
Enter LUKS passphrase: (Your paranoid passphrase)
Verify passphrase: (Your paranoid passphrase again)
</pre>
Then we need to mount our HDD:
<pre>
# cryptsetup luksOpen /dev/sda2 dmcrypt_root
Enter passphrase for /dev/sda2: (your paranoid passphrase)
</pre>


<console>
Next we will creat the logical volumes for our setup, so have a look at the subsection about logical volumes.
Command (m for help): ##i##p


Disk /dev/sda: 298.1 GiB, 320072933376 bytes, 625142448 sectors
==== GPT/GUID ====
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x82abc9a6


Device    Boot    Start      End    Blocks  Id System
This section is nearly the same as above, so if you read the text in one you will reread the MBR section again only with the GPT enabled stuff.
/dev/sda1          2048    264191    131072  83 Linux
/dev/sda2        264192  4458495  2097152  82 Linux swap / Solaris
/dev/sda3        4458496 625142447 310341976  83 Linux
</console>


'''Write the parition table to disk:'''
{{fancynote|If you want to see progress of dd than you have to open another terminal and execute: <tt>kill -s USR1 `pidof dd`</tt>}}


<console>
First we will prepare the HDD for being encrypted, if you use [http://www.sysresccd.org/ SystemRescueCd] in version 2.0.1 or higher just execute the following commands:
Command (m for help): ##i##w
</console>


Your new MBR partition table will now be written to your system disk.
<pre>
# dd if=/dev/zero of=/dev/sda3 bs=100M
# dd if=/dev/urandom of=/dev/sda3 bs=100M
</pre>


==== Creating filesystems ====
This part is optional but for security reason we advise you to do so if you like to have a secure encrypted disk. This part takes a lot of time, let your Computer run and get out to sleep and work, as it might take a day or two depending on your HDD size. :)


Before your newly-created partitions can be used, the block devices need to be initialized with filesystem ''metadata''. This process is known as ''creating a filesystem'' on the block devices. After filesystems are created on the block devices, they can be mounted and used to store files.
You should also be aware that you will get a hint about reaching the end of your HDD. That's intended and desired in this case so that the command can work without knowing your disk-size.


You will not create a filesystem on your swap partition, but will initialize it using the <code>mkswap</code> command so that it can be used as disk-based virtual memory. Then we'll run the <code>swapon</code> command to make your newly-initialized swap space active within the live CD environment, in case it is needed during the rest of the install process.
If you ran the above commands you should see an output similiar to the one shown in the screenshot:
[[Image:fqi-020.png|center]]


Note that we will not create a filesystem on the GRUB boot loader partition, as GRUB writes binary data directly to that partition when the boot loader is installed, which we'll do later.
Next we need to encrypt our HDD, that will be done with the following commands:


You can see the commands you will need to type below. Like the rest of this document, it assumes that you are using a GPT partitioning scheme. If you are using MBR, your root filesystem will likely be created on <code>/dev/sda3</code> instead and you will need to adjust the target block devices. If you are following our recommendations, then simply do this:
<pre>
# cryptsetup -c aes-xts-plain luksFormat /dev/sda3


'''We generally recommend XFS for root filesystems, although ext4 is also a good choice.''' This tutorial assumes the use of XFS. If you want to use ext4, then be sure that your <code>/etc/fstab</code> file reflects this.
WARNING!
========
This will overwrite data on /dev/sda3 irrevocably.


{{fancywarning|1=
Are you sure? (Type uppercase yes): YES
When deploying an OpenVZ host, please use ext4 exclusively. The Parallels development team tests extensively with ext4, and modern versions of <code>openvz-rhel6-stable</code> are '''not''' compatible with XFS, and you may experience kernel bugs.
Enter LUKS passphrase: (your paranoid passphrase)
}}
Verify passphrase: (your paranoid passphrase again)
</pre>
Then we need to mount our HDD:
<pre>
# cryptsetup luksOpen /dev/sda3 dmcrypt_root
Enter passphrase for /dev/sda3: (your paranoid passphrase)
</pre>


'''To use ext4 as your root filesystem:'''
next we will creat the logical volumes for our setup, so have a look at the following subsection.


<console>
==== logical volumes ====
# ##i##mke2fs -t ext2 /dev/sda1
# ##i##mkfs.ext4 /dev/sda3
# ##i##mkswap /dev/sda2
# ##i##swapon /dev/sda2
</console>


'''To use XFS as your root filesystem:'''
Feel free to adjust your sizes here, we will follow our given advices above for that. First we need to creat the the physical volume, then the volume group and at last the logical volumes. doing so is really easy, just do the following for if you want to follow our advices above:


<console>
<pre>
# ##i##mke2fs -t ext2 /dev/sda1
# pvcreate /dev/mapper/dmcrypt_root
# ##i##mkfs.xfs /dev/sda3
Physical volume "/dev/mapper/dmcrypt_root" successfully created
# ##i##mkswap /dev/sda2
# vgcreate vg /dev/mapper/dmcrypt_root
# ##i##swapon /dev/sda2
Volume group "vg" successfully created
</console>
# lvcreate -L20G -nroot vg
Logical volume "root" created
# lvcreate -L2G -nswap vg
Logical volume "swap" created
# lvcreate -L10G -n portage vg
Logical volume "portage" created
# lvcreate -l 100%FREE -nhome vg
Logical volume "home" created
</pre>


==== Mounting filesystems ====
=== filesystem creation ===


Mount the newly-created filesystems as follows, creating <code>/mnt/funtoo</code> as the installation mount point:
Now that we have created our partitioning scheme, we can go on to create the filesystems needed for our partitions. Here differences only occur between the unencrypted setups. Encrypted volumes are handled the same way, no matter whether MBR and GPT, so there is no need to split them up in two seperate parts:


<console>
==== MBR unencrypted ====
# ##i##mkdir /mnt/funtoo
# ##i##mount /dev/sda3 /mnt/funtoo
# ##i##mkdir /mnt/funtoo/boot
# ##i##mount /dev/sda1 /mnt/funtoo/boot
</console>


Optionally, if you have a separate filesystem for <code>/home</code> or anything else:
For the unencrypted partions in the MBR setup just use the following regarding to our above given adives, you may feel free to change some parts of it if you like:


<console>
<pre>
# ##i##mkdir /mnt/funtoo/home
# mkfs.ext2 /dev/sda1
# ##i##mount /dev/sda4 /mnt/funtoo/home
# mkswap /dev/sda2
</console>
# mkfs.ext4 /dev/sda3
# mkfs.ext4 /dev/sda5
# mkfs.xfs /dev/sda6


If you have <code>/tmp</code> or <code>/var/tmp</code> on a separate filesystem, be sure to change the permissions of the mount point to be globally-writeable after mounting, as follows:
</pre>


<console>
That was all for having your filesystem created. now go to the System Setup.
# ##i##chmod 1777 /mnt/funtoo/tmp
</console>


=== Installing the Stage 3 tarball ===
==== GPT unencrypted ====
After creating filesystems, the next step is downloading the initial Stage 3 tarball. The Stage 3 is a pre-compiled system used as a starting point to install Funtoo Linux. Load one of the following URLs in another browser window:


{{MirrorList}}
Now let us create the filesystem for our GUID partition table. It is as easy as above, just see the difference in the jump of partition name:


Now, let's navigate the directories on the mirrors to find the appropriate build of Funtoo Linux for you.
<pre>
# mkfs.ext2 /dev/sda1
# mkswap /dev/sda3
# mkfs.ext4 /dev/sda4
# mkfs.ext4 /dev/sda5
# mkfs.xfs /dev/sda6
</pre>


==== Stable or Current? ====
Next step is to mount our partitons, for that go to the System Setup.
Funtoo Linux has a "stable" build and a "current" build. Most people use the "current" build of Funtoo Linux, and it's generally recommended that you do too. You will find "current' builds in the main <code>/funtoo-current</code> directory on our mirrors, and "stable" builds in <code>/funtoo-stable</code>.
<br />If you want to read more about this, have a look at [[Funtoo_Linux#What_are_the_differences_between_.27stable.27.2C_.27current.27_and_.27experimental.27_.3F|Differences between stable, current and experimental]].


==== 32 or 64-bit? ====
==== MBR/GPT encrypted ====
There are three different types of Funtoo Linux that you can install. If you are installing on an older 32-bit system (if you don't know, then you probably are not) then you want to grab a stage3 tarball from the <code>x86-32bit</code> sub-directory. Most likely, you'll want to grab a 64-bit build from the <code>x86-64bit</code> sub-directory.


==== Your SubArch ====
If you choose to encrypt your HDD, you will in both cases follow the next steps to setup your filesystems:
Inside <code>/funtoo-current/x86-64bit/</code> on one of our mirrors, you'll see a bunch of directories for various ''subarches'' of Funtoo Linux.


Subarches are builds of Funtoo Linux that are designed to run on a particular type of CPU, to offer the best possible performance. They take advantage of the instruction sets available for each CPU.  
<pre>
# mkfs.ext2 /dev/sda1
# mkswap /dev/mapper/vg-swap
# mkfs.ext4 /dev/mapper/vg-root
# mkfs.ext4 /dev/mapper/vg-portage
# mkfs.xfs /dev/mapper/vg-home
</pre>


For example, the <code>corei7</code> and <code>corei7-pure64</code> sub-arches require an Intel Core i7 processor to run (this includes Xeon x3400+ series, or other Nehalem-based CPUs such as Xeon x5500/x5600 series.)
So far we prepared the disk and will now mount our partitions.


If you are using an AMD-based CPU, download a stage3 from <code>generic_64</code>, <code>amd64-k8</code> or <code>amd64-k10</code>.
== System Setup ==


If you are using an Intel-based CPU, download a stage3 from <code>generic_64</code>, <code>atom_64</code>, <code>core2_64</code> or <code>corei7</code>.
=== Mounting filesystem ===


===== Pure64 Builds =====
As we need to have a mountpoint for our system, we now create it with
Inside <code>x86-64bit</code>, you may notice a sub-directory named <code>pure64</code>. These builds are recommended for server systems, and they do not offer any 32-bit compatibility, which is generally not needed on server systems. If you are setting up a desktop or workstation system, it's recommended that you avoid these builds as you will need 32-bit compatibility to run several binary desktop-oriented applications such as Skype. But for servers, pure64 is recommended.
<pre>
# install -d /mnt/funtoo
</pre>


==== Setting the Date ====
{{fancynote|The in the following used <tt>install -d</tt> command just creats all the needed folders for later mountpoints for us. If you like you can control it by using <tt>ls /mnt/funtoo</tt> after the <tt>install -d</tt> part. Now you are ready to install your base system, read on in Downloading the System.}}


{{fancyimportant|If your system's date and time are too far off (typically by months or years,) then it may prevent Portage from properly downloading source tarballs. This is because some of our sources are downloaded via HTTPS, which use SSL certificates and are marked with an activation and expiration date.}}
==== MBR unencrypted ====


Now is a good time to verify the date and time are correctly set to UTC. Use the <code>date</code> command to verify the date and time:
Now mount your system partitions like that if you used our above advice:


<console>
<pre>
# ##i##date
# swapon /dev/sda2
Fri Jul 15 19:47:18 UTC 2011
# mount /dev/sda3 /mnt/funtoo
</console>
# install -d /mnt/funtoo/{boot,usr/portage,home}
# mount /dev/sda1 /mnt/funtoo/boot
# mount /dev/sda5 /mnt/funtoo/usr/portage
# mount /dev/sda6 /mnt/funtoo/home
</pre>


If the date and/or time need to be corrected, do so using <code>date MMDDhhmmYYYY</code>, keeping in mind <code>hhmm</code> are in 24-hour format. The example below changes the date and time to "July 16th, 2011 @ 8:00PM" UTC:
{{fancynote|The <tt>install -d</tt> command just creats all the needed folders for later mountpoints for us. If you like you can control it by using <tt>ls /mnt/funtoo</tt> after the <tt>install -d</tt> part. Now you are ready to install your base system, read on in Downloading the System.}}


<console>
==== GPT unencrypted ====
# ##i##date 071620002011
Fri Jul 16 20:00:00 UTC 2011
</console>


==== Download the Stage3 ====
That part is really similiar to the unencrypted MBR, but see for yourself:
Once you are in your Funtoo Linux root filesystem, use <code>wget</code> to download the Stage 3 tarball you have chosen to use as the basis for your new Funtoo Linux system. It should be saved to the <code>/mnt/funtoo</code> directory as follows:


<console># ##i##cd /mnt/funtoo
<pre>
# ##i##wget http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-64bit/generic_64/stage3-latest.tar.xz
# swapon /dev/sda3
</console>
# mount /dev/sda4 /mnt/funtoo
# install -d /mnt/funtoo/{boot,usr/portage,home}
# mount /dev/sda1 /mnt/funtoo/boot
# mount /dev/sda5 /mnt/funtoo/usr/portage
# mount /dev/sda6 /mnt/funtoo/home
</pre>


==== MBR/GPT encrypted ====


Note that 64-bit systems can run 32-bit or 64-bit stages, but 32-bit systems can only run 32-bit stages. Make sure that you select a Stage 3 build that is appropriate for your CPU. If you are not certain, it is a safe bet to choose the <code>generic_64</code> or <code>generic_32</code> stage. Consult the [[Download]] page for more information.
Now mount the system so we can setup the system in the next step.


Once the stage is downloaded, extract the contents with the following command, substituting in the actual name of your stage 3 tarball:
<pre>
<console>
# swapon /dev/mapper/vg-swap
# ##i##tar xpf stage3-latest.tar.xz
# mount /dev/mapper/vg-root /mnt/funtoo
</console>
# install -d /mnt/funtoo/{boot,usr/portage,home}
# mount /dev/sda1 /mnt/funtoo/boot
# mount /dev/mapper/vg-portage /mnt/funtoo/usr/portage
# mount /dev/mapper/vg-home /mnt/funtoo/home
</pre>


{{fancyimportant|It is very important to use <code>tar's</code> "<code>'''p'''</code>" option when extracting the Stage 3 tarball - it tells <code>tar</code> to ''preserve'' any permissions and ownership that exist within the archive. Without this option, your Funtoo Linux filesystem permissions will be incorrect.}}
=== Downloading the System ===


=== Chroot into Funtoo ===
The next step is to download the base system and portage tree and set up both. Here a list of packages we have:
Before chrooting into your new system, there's a few things that need to be done first. You will need to mount /proc and /dev inside your new system. Use the following commands:
<console>
# ##i##cd /mnt/funtoo
# ##i##mount -t proc none proc
# ##i##mount --rbind /sys sys
# ##i##mount --rbind /dev dev
</console>


You'll also want to copy over <code>resolv.conf</code> in order to have proper DNS name resolution from inside the chroot:
{| cellpadding="4"
<console>
|-
# ##i##cp /etc/resolv.conf etc
! Arch (32/64 bit) !! Processors !! Stable Release !! Current Release
</console>
|-
| 64-bit Install Images for PC-compatible processors
|-
| 64 || Generic Intel and Amd 64-bit Processors || [http://ftp.osuosl.org/pub/funtoo/funtoo-stable/x86-64bit/generic_64/ generic_64] || [http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-64bit/generic_64/ generic_64]
|-
| 64 || Intel Core2 Series and most Atom Processors || [http://ftp.osuosl.org/pub/funtoo/funtoo-stable/x86-64bit/core2_64/ core2_64] || [http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-64bit/core2_64/ core2_64]
|-
| 64 || Intel Core i3, i5, i7 || N/A || [http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-64bit/corei7/ corei7]
|-
| 64 || AMD Athlon 64 and Opteron Processors (K8 Family or higher) || [http://ftp.osuosl.org/pub/funtoo/funtoo-stable/x86-64bit/amd64-k8/ amd64-k8] || [http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-64bit/amd64-k8/ amd64-k8]
|-
| 32-bit Install Images for PC-compatible processors
|-
| 32 || Intel Core2 Series, i3, i5, i7 and Atom Processors || N/A || [http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-32bit/core2_32/ core2_32]
|-
| 32 || AMD Athlon64 and Opteron Processors (K8 Family or higher)| N/A || [http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-32bit/amd64-k8_32/ amd64-k8_32]
|-
| 32 || Generic x86 processors (intel80486+) || [http://ftp.osuosl.org/pub/funtoo/funtoo-stable/x86-32bit/i486/ i486] || [http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-32bit/i486/ i486]
|-
| 32 || Generic P6-class (Pentium Pro/Pentium II compatible) || [http://ftp.osuosl.org/pub/funtoo/funtoo-stable/x86-32bit/i686/ i686] || [http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-32bit/i686/ i686]
|-
| 32 || Athlon XP and Athlon 64-based CPU (32-bit mode) || N/A || [http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-32bit/athlon-xp/ athlon-xp]
|-
| 32 || Intel Pentium 4 Processors || N/A || [http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-32bit/pentium4/ pentium4]
|-
| OpenVZ Templates for PC-Compatible Systems
|-
| 32 || 32-bit OpenVZ Images || [http://ftp.osuosl.org/pub/funtoo/funtoo-stable/openvz/x86-32bit OpenVZ x86-32bit] || [http://ftp.osuosl.org/pub/funtoo/funtoo-current/openvz/x86-32bit OpenVZ x86-64bit]
|-
| 64 || 64-bit OpenVZ Images || [http://ftp.osuosl.org/pub/funtoo/funtoo-stable/openvz/x86-64bit OpenVZ x86-64bit] || [http://ftp.osuosl.org/pub/funtoo/funtoo-current/openvz/x86-64bit OpenVZ x86-64bit]
|-
| SPARC processor Images
|-
| 32/64 || Generic SPARC v9 processors (use this one if the ultrasparc I/II stages are inadequate for you) || N/A || [http://ftp.osuosl.org/pub/funtoo/funtoo-current/sparc-64bit/sparc_v9/ sparc_v9]
|-
| 32/64 || UltraSPARC I & UltraSPARC II series (choose this one in doubt) || N/A || [http://ftp.osuosl.org/pub/funtoo/funtoo-current/sparc-64bit/ultrasparc/ ultrasparc]
|-
| 32/64 || UltraSPARC III and UltraSPARC IV series || N/A || [http://ftp.osuosl.org/pub/funtoo/funtoo-current/sparc-64bit/ultrasparc3/ ultrasparc3]
|-
| 32/64 || Niagara (UltraSPARC T1) || N/A || [http://ftp.osuosl.org/pub/funtoo/funtoo-current/sparc-64bit/niagara/ niagara]
|-
| 32/64 || Niagara 2 (UltraSPARC T2/ UltraSPARC T2+) || N/A || [http://ftp.osuosl.org/pub/funtoo/funtoo-current/sparc-64bit/niagara2/ niagara2]
|}


Now you can chroot into your new system. Use <code>env</code> before <code>chroot</code> to ensure that no environment variables from the installation media are used by your new system:
If you found your desired image above, just change to <tt>/mnt/funtoo</tt> and download the stage3 and portage-tree images.


<console>
<pre>
# ##i##env -i HOME=/root TERM=$TERM chroot . bash -l
# cd /mnt/funtoo
</console>
# elinks http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-64bit/generic_64/
</pre>


{{fancynote|Users of live CDs with 64-bit kernels: Some software may use <code>uname -r</code> to check whether the system is 32 or 64-bit. You may want append linux32 to the chroot command as a workaround, but it's generally not needed.}}
[[Image:fqi-021.png|center]]
{{fancyimportant|If you receive the error "<code>chroot: failed to run command `/bin/bash': Exec format error</code>", it is probably because you are running a 32-bit kernel and trying to execute 64-bit code. SystemRescueCd boots with a 32-bit kernel by default.}}
this shows you the site presented and by going down with the arrow keys to stage3-latest.tar.xz until it is highlighted you can download it by pressing <tt>D</tt>. Then move up in the directory structure (<tt>..</tt>-link) and go to the snapshot directory or quit elinks after downloading finished and start it again with like that


It's also a good idea to change the default command prompt while inside the chroot. This will avoid confusion if you have to change terminals. Use this command:
<pre>
<console>
# elinks http://ftp.osuosl.org/pub/funtoo/funtoo-current/snapshots/
# ##i##export PS1="(chroot) $PS1"
</pre>
</console>


Congratulations! You are now chrooted inside a Funtoo Linux system. Now it's time to get Funtoo Linux properly configured so that Funtoo Linux will boot successfully when your system is restarted.
here you will now download the portage tree (portage-latest.tar.xz). The Download dialog will look in both cases like that:(Note outdated image, 'stage3-current.tar.xz' is now 'stage3-latest.tar.xz')
[[Image:fqi-022.png|center]]


=== Downloading the Portage tree ===
When both downloads have finished quit elinks by typing <tt>q</tt>. The downloaded files should be located in <tt>/mnt/funtoo</tt>. Now that this is done, let us move on to installing your base system.


{{fancynote|For an alternative way to do this, see [[Installing Portage From Snapshot]].}}
=== Installing the base system ===
Now it's time to install a copy of the Portage repository, which contains package scripts (ebuilds) that tell portage how to build and install thousands of different software packages. To create the Portage repository, simply run <code>emerge --sync</code> from within the chroot. This will automatically clone the portage tree from [https://github.com/funtoo/ports-2012 GitHub]:


<console>
Now that we have the base system and the portage tree downloaded, we will install it. First install the stage3. it is really easy.
(chroot) # ##i##emerge --sync
</console>


{{fancyimportant|1=
If you receive the error with initial <code>emerge --sync</code> due to git protocol restrictions, change <code>SYNC</code> variable in <code>/etc/make.conf</code>:
<pre>
<pre>
SYNC="https://github.com/funtoo/ports-2012.git"
# tar xfvpJ stage3-latest.tar.xz
</pre>
</pre>
}}


=== Configuring your system ===
That will output many lines, and return a command-prompt line when finished.
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}}


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]])
Next we need to extract the funtoo-portage-tree. For that we need to change to the future <tt>/usr</tt> dir, and extract there the portage.


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.
<pre>
# cd /mnt/funtoo/usr
# tar xfvpJ ../portage-latest.tar.xz
</pre>
 
This time there will be no output, but when the unpacking has finished, the result will be an empty command prompt. We still need to checkout the tree, but this can only be done from inside the chroot environment.


{{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.}}
At this state of the setup we have setup most of our system. If you choose to use the fast genkernel method later on, the hardest part is already done. If you choose to manually configure the kernel, you still have quite a bit work ahead of you.


==== /etc/fstab ====
=== Chrooting ===


<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:
Before we can finally chroot into your system, there are a couple of things that need to be done before, like mounting the proc and dev filesystem.


<console>
<pre>
(chroot) # ##i##nano -w /etc/fstab
# mount -t proc none /mnt/funtoo/proc
</console>
# mount --bind /dev /mnt/funtoo/dev
</pre>


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.
to have a working network inside of your chrooted system later you need to copy the <tt>resolv.conf</tt> file too:
 
<pre>
# cp -L /etc/resolv.conf /mnt/funtoo/etc
</pre>
 
Now we can chroot into your Funtoo system
 
<pre>
# env -i HOME=/root TERM=$TERM SHELL=/bin/bash
# chroot /mnt/funtoo /bin/bash
</pre>
 
Now that we are inside your new system, you'll need to update your environment, use the following commands to do so:
 
<pre>
# source /etc/profile
# env-update
</pre>
 
We also recommend you to change the default command prompt while you are inside the chroot, as it will avoid confusions if you have to change terminals for anything. To do so use the following command:
 
<pre>
# export PS1="(chroot) $PS1"
</pre>
 
Congratulations! You are now inside your new Funtoo Linux operating system.
 
==== Updating the Portage tree ====
 
As we have installed the Portage snapshot during the installation, we now need to "activate" the Portage tree by selecting the <tt>funtoo.org</tt> branch.
 
By default, the master branch is enabled, which saves space when storing the tree inside a tarball, but that branch only contains a README with the same instructions as the ones given here.
 
To activate the funtoo.org branch, do the following:
 
<pre>
# cd /usr/portage/
# git checkout funtoo.org
 
  Checking out files: 100% (85007/85007), done.
  Switched to branch "funtoo.org"
</pre>
 
You'll now be able to see thousands of glorious ebuilds inside your Portage tree :)
 
After activating the funtoo.org branch you need to sync your tree to the newest glorious funtoo ebuilds. Run:
 
<pre>
# emerge --sync
</pre>
 
This will now update the tree to the current state, which normally changes twice a day.
 
==== Setting the default options ====
 
Like any other Linux Distribution, Funtoo Linux has it's share of configuration files, that need to be edited by you. The following table gives you an overview of these files and for what they are there:
 
{| cellpadding="4"
|-
! File !! Description
|-
| /etc/make.conf || Parameters used by <tt>gcc</tt> compiler
|-
| /etc/fstab || Device to mountpoint definitions
|-
| /etc/conf.d/hostname || Setting your hostname
|-
| /etc/rc.conf || OpenRC configuration file.
|-
| /etc/conf.d/keymaps || Keyboard configuration file.
|-
| /etc/conf.d/hwclock || System clock to use.
|-
| /etc/conf.d/consolefont || Fonts to be used in console display. This doesn't affect GUI terminal emulators.
|-
| /etc/env.d/99editor || Default editor.
|-
| /etc/localtime || Your timezone.
|-
| /etc/make.profile || Type of installation (desktop, server...).
|-
| /etc/conf.d/modules || Kernel modules to load
|-
| /etc/locale.gen || Localization.
|-
| /etc/env.d/02locales || Localization for old programs.
|}
 
If you are installing an english Funtoo, you are lucky, as you won't need to edit many of the files above, if not, don't be afraid, we will walk through the configuration of these files in the following together.
 
First we will get a mighty editor with great syntax highlighting as it is not provided in our main system we will merge it, if you don't like to please replace in the following edit sections the part <tt>vim <path/filename></tt> with your <tt>editor <path/filename></tt> where editor is replaced by <tt>vi</tt> or <tt>nano -w</tt>.
 
First let us get <tt>vim</tt> so we have the perfect highlighting from it for our personal help.
 
<pre>
# emerge -avt vim
</pre>
 
that will result in an output like that
[[Image:fqi-023.png|center]]
just accept the output with <tt>Enter</tt> and it will install vim for you, while you wait for vim to get emerged, here are the some basic usage instructions for ViM. ViM has a multimode interface, if you start it, it is in <tt>Command mode</tt>, the second mode is the <tt>Edit mode</tt> which you will enter from the <tt>Command mode</tt> by pressing <tt>i</tt>, to go back into the <tt>Command mode</tt> press <tt>ESC</tt>. After you have edited a config file, you want to save it, for that you have to be in <tt>Command mode</tt> and then simple press <tt>:w<ENTER></tt>, it will save the file, a closing is done with <tt>:q<ENTER></tt>, if you changed content in the file that shouldn't be saved use <tt>:q!</tt> and for saving and closing the file <tt>:wq</tt>, thats all, the visual mode is in that context not very useful, so we leave it out. Now that you know the basic usage of ViM and it has emerged we will now start configuring the config files.
 
===== /etc/make.conf =====
 
First open that file
 
<pre>
# vim /etc/make.conf
</pre>
 
This file contains something similar to the following. You may or may not have a CFLAGS variable set already depending on what stage 3 tarball you used:
 
<pre>
ACCEPT_KEYWORDS="~amd64"
SYNC="git://github.com/funtoo/portage-mini-2010.git"
CHOST="x86_64-pc-linux-gnu"
</pre>
 
{{fancynote|In ACCEPT_KEYWORDS, ~amd64 is used for current 64-bit builds; There is no tilde for the stable build. The default value is (~)x86 for 32 bit. The ACCEPT_KEYWORDS line should not be altered. Keep it as supplied in the default file. It is also important to not change the CHOST line.}}
 
====== CFLAGS ======
 
If you're only building packages for your host processor and not any others then the recommended CFLAGS setting is:
 
<pre>
CFLAGS="-march=native -O2 -pipe"
</pre>
 
Since [http://gcc.gnu.org/gcc-4.2/changes.html gcc-4.2], -mtune=native and -march=native will produce code optimized for the host processor. -mtune=native has no effect if GCC does not recognize the processor. More information can be found in the [http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options GCC online docs].
 
{{fancynote|The value <tt>native</tt> selects the best architecture option for the host processor, so this should not be used if you intend to compile packages for a different CPU.}}
 
====== CXXFLAGS ======
 
Normally, this flag is set to the same values as CFLAGS:
 
<pre>
CXXFLAGS="${CFLAGS}"
</pre>
 
====== MAKEOPTS ======
 
With <tt>MAKEOPTS</tt> you define how many parallel compilations should occur when you compile a package. A good choice is the number of CPUs (or CPU threads) in your system plus one (Note: this guideline isn't always perfect). If for example you have a dual core processor without hyperthreading, then you would set MAKEOPTS to 3:
 
<pre>
MAKEOPTS="-j3"
</pre>
 
If you're unsure of how many processors/threads you have, then use /proc/cpuinfo to help you.
 
<pre>
# cat /proc/cpuinfo  | grep "model name" | wc -l
16
</pre>
 
Set MAKEOPTS to this number plus one:
 
<pre>
MAKEOPTS="-j17"
</pre>
 
====== USE ======
 
<tt>USE</tt> flags define what functionality is enabled when ebuilds are built. It is not recommended to add a lot of them during installation. You should wait until you have a working, bootable system to do so. The following USE flags are a recommended starting point for new systems:
 
<pre>
USE="-gnome -gtk -kde -kdeenablefinal -ldap nls -qt3 -qt3support -qt4 userlocales"
</pre>
 
The minus(-) sign tells gcc not to use the flag when compiling. <tt>USE</tt> flags <tt>gnome</tt>, <tt>gtk</tt>, <tt>kde</tt>, <tt>qt3</tt>, <tt>qt3support</tt>, and <tt>qt4</tt> will be set later if you install a desktop envrionment.
 
A Funtoo guide to <tt>USE</tt> 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].
 
====== GENTOO_MIRRORS ======
 
This is the mirror from which emerge gets a lot of the source files. It is usually not necessary to set this flag. In the following ewxample, the Waterloo University is used (a fast and reliable Canadian mirror). Please set this variable to a mirror local to your country.
 
<pre>
GENTOO_MIRRORS="ftp://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ http://distfiles.gentoo.org"
</pre>
 
====== LINGUAS ======
 
<tt>LINGUAS</tt> 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. Otherwise, if you want another language, replace fr (French) for the code of your mother language, e.g. de for German.
 
<pre>
LINGUAS="fr"
</pre>
 
or for multiple language support you might also use:
 
<pre>
LINGUAS="en de fr"
</pre>
 
====== /etc/make.conf example ======
 
An example of a <tt>/etc/make.conf</tt> file could look like that:
 
<pre>
# These settings were set by the metro build script that automatically built this stage.
# Please consult /etc/make.conf.example for a more detailed example.
 
ACCEPT_KEYWORDS="x86"
FEATURES="mini-manifest"
SYNC="git://github.com/funtoo/portage-mini-2010.git"
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=i686 -O2 -pipe"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j2"
USE="-gnome -gtk -kde -kdeenablefinal -ldap nls -qt3 -qt3support -qt4 userlocales"
GENTOO_MIRRORS="ftp://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ http://distfiles.gentoo.org"
LINGUAS="fr"
INPUT_DEVICES="evdev synaptics"
VIDEO_CARDS="vesa radeon"
PORT_LOGDIR="/var/log/portage"
PORTAGE_ELOG_CLASSES="log warn error info"
PORTAGE_ELOG_SYSTEM="echo:log,warn save:log,warn,error,info syslog:error"
</pre>
 
===== /etc/fstab =====
 
This file is used for the configuration of the mountpoints for the system. As we have two different setups described above, here are the two examples for these.
 
<pre>
# vim /etc/fstab
</pre>
 
====== unencrypted MBR ======
 
<pre>
# 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/sda5      /usr/portage    ext4    noatime            0 1
/dev/sda6      /home          xfs    defaults,noatime    0 1
#/dev/cdrom    /mnt/cdrom      auto    noauto,ro          0 0
none            /dev/shm        tmpfs  nodev,nosuid,noexec 0 0
</pre>
 
====== unencrypted GPT ======
 
<pre>
# 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/sda3      none            swap    sw                  0 0
/dev/sda4      /              ext4    noatime            0 1
/dev/sda5      /usr/portage    ext4    noatime            0 1
/dev/sda6      /home          xfs    defaults,noatime    0 1
#/dev/cdrom    /mnt/cdrom      auto    noauto,ro          0 0
none            /dev/shm        tmpfs  nodev,nosuid,noexec 0 0
</pre>
 
====== encrypted ======
 
That time the setup is the same for both MBR and GPT partition layout:


<pre>
<pre>
Line 499: Line 1,151:
# See the manpage fstab(5) for more information.
# See the manpage fstab(5) for more information.
#
#
# <fs>     <mountpoint> <type>  <opts>         <dump/pass>
# <fs>                 <mountpoint>   <type>  <opts>             <dump/pass>


/dev/sda1   /boot         ext2    noauto,noatime 1 2
/dev/sda1               /boot           ext2    noauto,noatime     1 2
/dev/sda2    none         swap    sw             0 0
/dev/mapper/vg-swap    none           swap    sw                 0 0
/dev/sda3   /             ext4    noatime       0 1
/dev/mapper/vg-root    /              ext4   noatime            0 1
#/dev/cdrom /mnt/cdrom   auto    noauto,ro     0 0
/dev/mapper/vg-portage  /usr/portage    ext4    noatime             0 1
/dev/mapper/vg-home    /home          xfs    defaults,noatime    0 1
#/dev/cdrom             /mnt/cdrom     auto    noauto,ro           0 0
none                    /dev/shm        tmpfs  nodev,nosuid,noexec 0 0
</pre>
</pre>


==== /etc/localtime ====
===== /etc/conf.d/hostname =====


<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.
Here you will set up your hostname for the PC. So choose a name for your PC and set it up in that file:


<console>
<pre>
(chroot) # ##i##ln -sf /usr/share/zoneinfo/MST7MDT /etc/localtime
# vim /etc/conf.d/hostname
</console>


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.
# Set to the hostname of this machine
hostname="<your-hostname>"
</pre>


==== /etc/make.conf ====
===== /etc/rc.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 [[wikipedia:Hyper-threading|hyper-threading]], then you would set MAKEOPTS to 3:
You may use this file as-is. However, it is a good idea to set <tt>rc_logger</tt> to yes. That will create a log file which is handy when problems are encountered with OpenRC scripts. Very helpful for fixing things.
 
Another good option here is the <tt>rc_interactive</tt> flag, if you are playing around with a new graphical display manager or aren't that used with the upgrade procedure of the graphical environement. if <tt>rc_interactive</tt> is set to yes, you will be able to interactively manipulate the boot process, what means you can decide what you want to start or not, like the graphical environment for example.
 
Other options have really good explainations inside of the <tt>/etc/rc.conf</tt> file.
 
===== /etc/conf.d/keymaps =====
 
You do not have to alter that file if you have a US English keyboard. Otherwise, edit file and set <tt>keymap</tt> to your keyboard model. For example, cf for French Canadian keyboard, fr for French Azerty and de for German Qwertz.
 
===== /etc/conf.d/hwclock =====
 
If you dual boot with Windows, you'll need to edit this file and change clock to local. Otherwise you should not normally need to edit this file.
 
You should define your timezone in <tt>/etc/timezone</tt>:


<pre>
<pre>
MAKEOPTS="-j3"  
# vim /etc/timezone
Europe/Berlin
</pre>
 
anoteher value might be
 
<pre>
America/Denver
</pre>
 
so you might get an idea how it should look like, if not have a look at <tt>/usr/share/zoneinfo</tt> it will give you the entry after the path like <tt>/usr/share/zoneinfo/<Content of /etc/timezone></tt> like for Germany you will find a path in there that looks like <tt>/usr/share/zoneinfo/Europe/Berlin</tt>.
 
===== /etc/conf.d/consolefont =====
 
There is nothing to edit in that file.
 
===== /etc/env.d/99editor =====
 
Create and edit that file to instruct your system about the default editor it should use.
 
<pre>
vim /etc/env.d/99editor
</pre>
 
Type in :
 
<pre>
EDITOR="/usr/bin/vim"
</pre>
 
Replace the above line with the editor of your choice, if you had been happy so far with ViM just paste it in as is, if not use <tt>nano</tt>, <tt>vi</tt> or what else you like.
 
===== /etc/localtime =====
 
If you came here from Gentoo, it was advised to copy the file from the zoneinfo dir to here. We advise you to create a symbolic link from the zoneinfo dir to <tt>/etc/localtime</tt>. As in the hwclock section above, we need your timezone parted in LAND/TOWN like for Germany Europe/Berlin. Now, create the symbolic link. More info about it can be found in the <tt>/usr/share/zoneinfo</tt> dir.
 
<pre>
ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
</pre>
 
That command sets the timezone to Central European Time.
 
===== /etc/make.profile =====
 
Here you select which type of environment you want the gcc-compiler to take into account. That will dress up an environment with a list of pre-defined USE flags.
 
To list all available profiles run:
 
<pre>
eselect profile list
</pre>
 
The output will look like that:
 
<pre>
[1]  default/linux/x86/2008.0 *
[2]  default/linux/x86/2008.0/desktop
[3]  default/linux/x86/2008.0/developer
[4]  default/linux/x86/2008.0/server
</pre>
 
Profile defaults to 2008.0 (See the star). To create a profile for DE (Desktop Environment) run:
 
<pre>
eselect profile set 2
</pre>
 
{{fancywarning|Funtoo only supports the 2008.0 profile and the 2008.0 profile children. Use one of these profiles until 'funtoo-1.0' is ready.}}
 
===== /etc/conf.d/modules =====
 
With Funtoo, OpenRC loads modules from <tt>/etc/conf.d/modules</tt> using the line:
 
<pre>
modules_2_6="list of modules"
</pre>
 
With Funtoo, define module arguments as follows:
 
<pre>
module_module-name_args_2_6="module arg=value"
</pre>
 
===== Localization =====
 
<tt>/etc/locale.gen</tt> and <tt>/etc/env.d/02locales</tt> are used to support your local language. The last one is required just in case there still are old programs installed.
 
You do not need to amend anything if your locales are US English. The following are examples for German. You can look in /usr/share/i18n/SUPPORTED for the default list of supported combinations or look in /usr/share/i18n/locales to determine values to use.
 
<pre>
# vim /etc/locale.gen
</pre>
 
Put this value into the file for German support:
 
<pre>
de_DE.UTF-8 UTF-8
</pre>
 
for a multiple language support it might look like that:
 
<pre>
de_DE.UTF-8 UTF-8
fr_CA.UTF-8 UTF-8
en_US.UTF-8 UTF-8
</pre>
 
Edit <tt>/etc/env.d/02locales</tt> according to that layout:
 
<pre>
# vim /etc/env.d/02locales
</pre>
 
and put in these lines:
 
<pre>
LANG="de_DE.UTF-8"
LANGUAGE="de_DE.UTF-8"
</pre>
 
Finally after we editet all the localization files generate the localized environment:
 
<pre>
locale-gen && source /etc/profile
</pre>
 
==== Kernel ====
 
Now that you have the base system running, you need to install a kernel. If you decided to use a standard setup with an unencrypted GPT disc layout or the old unencrypted MBR disc layout, a fast solution would be to use the [[Funtoo Quick Install#genkernel|genkernel]] solution. If you used the standard setup with an encrypted GPT disc layout or the old encrypted MBR disc layout, you have to use the [[Funtoo Quick Install#manual kernel|manual kernel]] steps.
 
===== choosing a kernel =====
 
First, you need to choose a kernel version you would like to install on your system. The following table will give you an overview of which kernels are available and who should use them.
 
{| border="0" cellpadding="4"
|-
! Kernel ebuild !! Description !! masked !! Prefered Users !! eselect kernel set
|-
! sys-kernel/*
!
!
! generates symlink
|-
| cell-sources
| Full sources including the cell/ps3 patchset for the 2.6 kernel tree
| <span style="color:red">[ Masked ]</span>
|
| <span style="color:orange">unsure</span>
|-
| ck-sources
| Con Kolivas' high performance patchset + Gentoo patchset sources
|
|
| <span style="color:orange">unsure</span>
|-
| debian-sources
| Debian Sources - with optional OpenVZ support
|
|
| <span style="color:red">NO</span>
|-
| gentoo-sources
| Full sources including the Gentoo patchset for the 2.6 kernel tree
|
| <span style="color:green">default for most users</span>
| <span style="color:green">YES</span>
|-
| git-sources
| The very latest -git version of the Linux kernel
|
| for the versed user
| <span style="color:green">YES</span>
|-
| hardened-sources
| Hardened kernel sources (kernel series 2.6)
|
| <span style="color:red">not supported atm</span>
| <span style="color:green">YES</span>
|-
| mips-sources
| Linux-Mips GIT sources for MIPS-based machines, dated 20110207
| <span style="color:red">[ Masked ]</span>
|
| <span style="color:orange">unsure</span>
|-
| mm-sources
| Andrew Morton's kernel, mostly fixes for 2.6 vanilla, some vm stuff too
|
|
| <span style="color:orange">unsure</span>
|-
| openvz-sources
| Full sources including OpenVZ patchset for the 2.6.18 kernel tree
|
| For users that want to build a OpenVZ server
| <span style="color:orange">unsure</span>
|-
| pf-sources
| Linux kernel fork with new features, including the -ck patchset (BFS), BFQ, TuxOnIce and LinuxIMQ
|
|
| <span style="color:orange">unsure</span>
|-
| rhel5-openvz-binaries
| RHEL5 kernel with OpenVZ patchset - initrd and bzImage
|
|
| <span style="color:green">YES</span>
|-
| rhel5-openvz-sources
| Full Linux kernel sources - RHEL5 kernel with OpenVZ patchset
|
|
| <span style="color:orange">unsure</span>
|-
| rhel6-openvz-binaries
| RHEL6 kernel with OpenVZ patchset - initrd and bzImage
|
|
| <span style="color:orange">unsure</span>
|-
| rhel6-openvz-sources
| Full Linux kernel sources - RHEL5 kernel with OpenVZ patchset
|
|
| <span style="color:orange">unsure</span>
|-
| sparc-sources
| Full sources for the Gentoo Sparc Linux kernel
| <span style="color:red">[ Masked ]</span>
|
| <span style="color:green">YES</span>
|-
| sysrescue-std-binaries
| System Rescue CD Full sources for the Linux kernel, including gentoo and sysresccd patches - initrd and bzImage
| <span style="color:red">[ Masked ]</span>
|
| <span style="color:orange">unsure</span>
|-
| sysrescue-std-sources
| System Rescue CD Full sources for the Linux kernel, including gentoo and sysresccd patches.
|
|
| <span style="color:orange">unsure</span>
|-
| tuxonice-sources
| TuxOnIce + Gentoo patchset sources
|
|
| <span style="color:orange">unsure</span>
|-
| usermode-sources
| Full sources for the User Mode Linux kernel
| <span style="color:red">[ Masked ]</span>
|
| <span style="color:orange">unsure</span>
|-
| vanilla-sources
| Full sources for the Linux kernel
|
|
| <span style="color:green">YES</span>
|-
| vserver-sources
| Full sources including Gentoo and Linux-VServer patchsets for the 2.6 kernel tree.
|
|
| <span style="color:orange">unsure</span>
|-
| xbox-sources
| Full sources for the Xbox Linux kernel
| <span style="color:red">[ Masked ]</span>
|
| <span style="color:orange">unsure</span>
|-
| xen-sources
| Full sources for a dom0/domU Linux kernel to run under Xen
|
|
| <span style="color:orange">unsure</span>
|-
| zen-sources
| The Zen Kernel Sources v2.6
|
|
| <span style="color:orange">unsure</span>
|}
 
For the next section, we will assume that you selected gentoo-sources for your kernel setup. If not, please replace gentoo-sources in the next section with your selection. If you are unsure, please follow our suggestion to use the gentoo-sources.
 
===== genkernel =====
 
That part would be fast done in general, we will now guide you through that process. First, we need to install the needed tools for it. So, let's do it!
 
<pre>
# emerge -avt genkernel gentoo-sources
Calculating dependencies... done!
 
These are the packages that would be merged, in reverse order:
 
[ebuild  N    ] sys-kernel/gentoo-sources-2.6.38-r4  USE="-build -deblob -symlink" 134 kB
[ebuild  N    ] sys-kernel/genkernel-3.4.12.6-r2  USE="-bash-completion (-ibm) (-selinux)" 11,556 kB
 
Total: 2 packages (2 new), Size of downloads: 11,690 kB
 
Would you like to merge these packages? [Yes/No]
</pre>
</pre>


If you are unsure about how many processors/threads you have then use /proc/cpuinfo to help you.
After answering the above question with "Yes", it will download and install the packages for you. Next, you need to set the symlink from /usr/src/linux to the /usr/src/linux-version directory. There are two ways to do so. If you have selected a version that is supported by eselect, it would be really simple for you, just do:
<console>
 
(chroot) # ##i##grep "processor" /proc/cpuinfo | wc -l
<pre>
16
# eselect kernel list
</console>
# eselect kernel set 1
</pre>


Set MAKEOPTS to this number plus one:
The first command should list the kernel you have selected. If that isn't the case, the second command to set this kernel version isn't needed, else the second one sets the symlink automatically for you. As <tt>eselect kernel command</tt> will scan your <tt>/usr/src</tt> directory, it should list every kernel-sources listed above, if that isn't the case, please report the failing to the [http://groups.google.com/group/funtoo-dev funtoo-dev mailing list], [http://forums.funtoo.org  Funtoo Forums] or contact us directly in IRC at [irc://irc.freenode.net/funtoo #funtoo]. As a workaround you could use the following steps to make your kernel-sources usable:


<pre>
<pre>
MAKEOPTS="-j17"
# cd /usr/src
# rm linux
# ls
linux-sources
# ln -s linux-sources linux
</pre>
</pre>


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].
where linux-sources is the directory that the <tt>ls</tt> command above showed you.


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:
When you finished the selection of your kernel you will now bake your first kernel, using the genkernel or fast way. Execute for that the following command:


<pre>
<pre>
LINGUAS="fr"
# genkernel --menuconfig all
</pre>
 
if you have a special config predefined use
 
<pre>
# genkernel --kernel-config=config-name --menuconfig all
</pre>
</pre>


==== /etc/conf.d/hwclock ====
else if you have choosen an encrypted setup, use the following command to include all the tools you need for bootup:
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.
<pre>
<console>
# genkernel --lvm --luks --menuconfig all
(chroot) # ##i##nano -w /etc/conf.d/hwclock
</pre>
</console>
the above used options are doing the following:


==== Localization ====
* --kernel-config: use the given name located in the kernel source tree (/usr/src/linux by default is taken unless overridden by --kerndir)
* all: rebuild the kernel image and the initramfs ramdisk image (aside of kernel modules, the ramdisk image contains tools such as BusyBox and some generic startup scripts, depending on options you use on the command line several additional tools like lvm or raid volume management can be incorporated as well).
* --lvm: Includes support for storage using via Logical Volume Management (LVM2) from static binaries, if available to the system. Relevant (static) LVM2 binaries are compiled if they are unavailable. Be sure to install the lvm2 package on your system with emerge lvm2 before enabling this flag.
* --luks: Includes support for Linux Unified Key Setup or LUKS. This will allow you to use a device encrypted by LUKS which contains the root filesystem. On the bootloader, you then set that encrypted device as the value of crypt_root (and real_root shall be the unencrypted device LUKS creates).
* --menuconfig: lets you set options for kernel compile manual


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]].
The --menuoption will present you the following screen:
[[Image:fqi-024.png|center]]


=== Introducing Portage ===
====== default options for unencrypted/encrypted setup ======


Portage, the Funtoo Linux package manager has a command called <code>emerge</code> which is used to build and install packages from source. It also takes care of installing all of the package's dependencies. You call emerge like this:
We advised you above to use a partitioning scheme based on the following file system types:


<console>
* ext2
(chroot) # ##i##emerge packagename
* swap
</console>
* ext4
* xfs


When you install a package by specifying its name in the command-line, Portage records its name in the <code>/var/lib/portage/world</code> file. It does so because it assumes that, since you have installed it by name, you want to consider it part of your system and want to keep the package updated in the future. This is a handy feature, since when packages are being added to the <code>world</code> set, we can update our entire system by typing:
You now need to activate all of them so you can boot your system later, these options can be found at:


<console>
{{kernelop|title=File systems|desc=
(chroot) # ##i##emerge --sync
<*>  Second extended fs support
(chroot) # ##i##emerge -auDN @world
<*>   The Extended 4 (ext4) filesystem
</console>
[*]      Ext4 extended attributes (NEW)
[ ]        Ext4 POSIX Access Control Lists (NEW)
[ ]        Ext4 Security Labels (NEW)
[ ]        EXT4 debugging support (NEW)
<*>   XFS filesystem support
[ ]        XFS Quota support (NEW)
[ ]        XFS POSIX ACL support (NEW)
[*]        XFS Realtime subvolume support
[ ]        XFS Debugging support (EXPERIMENTAL) (NEW)}}


This is the "official" way to update your Funtoo Linux system. Above, we first update our Portage tree using git to grab the latest ebuilds (scripts), and then run an emerge command to update the <code>world</code> set of packages. The options specified tell <code>emerge</code> to:
If you furthermore decided to follow our advice and to use a GPT-Partitioning scheme, which will be your default, you will need to activate it in your kernel by using the following options:


* '''<code>a</code>''' - show us what will be emerged, and '''ask''' us if we want to proceed
{{kernelop|title=File systems,Partition Types|desc=
* '''<code>u</code>''' - ''update'' the packages we specify -- don't emerge them again if they are already emerged.
[*]  Advanced Partition Selection (PARTITION_ADVANCED)
* '''<code>D</code>''' - Consider the entire dependency tree of packages when looking for updates. In other words, do a '''deep''' update.
[*]  EFI GUID Partition Support (EFI_PARTITION)}}
* '''<code>N</code>''' - Update any packages that have changed ('''new''') USE settings.


You should also consider passing <code>--with-bdeps=y</code> when emerging @world, at least once in a while. This will update build dependencies as well.
====== additional encrypted options ======


Of course, sometimes we want to install a package but not add it to the <code>world</code> file. This is often done because you only want the package installed temproarily or because you know the package in question is a dependnecy of another package. If this behavior is desired, you call emerge like this:
It is very important to add the following parts in your kernel setup, when you used the above GPT or MBR encrypted setup. Under
{{kernelop|title=General setup|desc=
[*]  Initial RAM filesystem and RAM disk (initramfs/initrd) support}}


<console>
and {{kernelop|title=Device Drivers|desc=
(chroot) # ##i##emerge -1 packagename
[*] Multiple devices driver support
</console>
<*>   Device Mapper Support
<*>     Crypt target support}}


Advanced users may be interested in the [[Emerge]] wiki page.
and finally {{kernelop|title=Cryptographic API|desc=
<*>  XTS support (EXPERIMENTAL)


==== Updating World ====
-*-  AES cipher algorithms}}


Now is actually a very good time to update the entire system and it can be a good idea to do so prior to first boot.
Finally exit the menuconfig for your kernel and get a coffee.  You have done a good bit of work so far... :)


<console>
===== manual kernel =====
(chroot) # ##i##emerge --sync
(chroot) # ##i##emerge -auDN @world
</console>


{{fancyimportant|1=
You can use genkernel to automatically compile your kernel,  but this tends to create a bloated kernel,  compatible with just about any computer, anyplace, any time.
Make sure you read any post emerge messages and follow their instructions. This is especially true if you have upgraded perl or python.}}
On the other hand,  you can manually configure and compile your kernel,  to give you complete control,  for the smallest and fastest kernel(s) that you can build for your specific computer.
However,  manual kernel configuration is often called by many users, the hardest step in installing Funtoo.  But it is also very worth learning how to do it.
Be warned that it make take several reconfigurations, compiles and reboots, until you have a working system.  Plus, for the encrypted hdd version,  you will have to do a bit more work than above, but if you have gotten this far,  you should be able to handle it.


=== Configuring and installing the Linux kernel ===
====== install and config ======


Now it's time to build and install a Linux kernel, which is the heart of any Funtoo Linux system. The kernel is loaded by the boot loader, and interfaces directly with your system's hardware, and allows regular (userspace) programs to run.
First you will have to install the kernel image you selected above. In the following we again use the kernel we think might be the default choice of you, gentoo-sources, but you can feel free to replace it with any of the above ones. So now install your kernel-sources:


A kernel must be configured properly for your system's hardware, so that it supports your hard drives, file systems, network cards, and so on. More experienced Linux users can choose to install kernel sources and configure and install their own kernel. If you don't know how to do this, we provide ebuilds that will automatically build a "univeral" kernel, modules and initramfs for booting your system that supports all hardware. This is an extremely simple way of building a kernel that will get your system booted.
<pre>
# emerge -avt gentoo-sources
</pre>


What is our goal? To build a kernel that will recognize all the hardware in your system necessary for booting, so that you will be greeted by a friendly login prompt after installation is complete. These instructions will guide you through the process of installing a kernel the "easy" way -- without requiring user configuration, by using a "universal" kernel.
After answering the above question with Yes,  emerge will download and install the kernel-sources for you. Next you need to set the symlink from /usr/src/linux to the /usr/src/linux-version directory. There are two ways to do so, the default way would be to use the following command sequence:


==== Package Sets ====
<pre>
# eselect kernel list
# eselect kernel set 1
</pre>


Before we install a kernel, we're going to cover a feature of Portage called package sets. Portage, the package manager/ports system for Funtoo Linux, will keep track of system packages as well as packages you have installed by calling <code>emerge</code> directly. These packages that are part of the base system are considered part of the "system" package set, while packages that you have installed by typing them on the command line (such as "gnome" in <code>emerge gnome</code>) will be added to the "world" package set. This provides an easy way to update your entire system.
The first command will list the kernel or kernels for which you have used emerge to install the corresponding source code packages.  The character * is used to indicate the currently selected default kernel package. In other words, the command  <tt> eselect kernel list </tt> will scan and list directories in your <tt> /usr/src directory </tt>,  each named after a different kernel source code. It will then show with a * the directory currently pointed to by the <tt> /usr/src/linux </tt> link.
The second command is not needed,  as long as the correct kernel source has been selected. Otherwise, use this command and the number of the corresponding kernel directory, to set your <tt> /usr/src/linux </tt> link.


However, sometimes it's nice to be able to update the kernel all by itself, or leave a kernel update out of your regular whole system update. To do this, we will create a new package set called "kernel".
If the  <tt> eselect kernel  </tt> command does not work correctly, please report the failing to the [http://groups.google.com/group/funtoo-dev funtoo-dev mailing list], [http://forums.funtoo.org  Funtoo Forums] or contact us directly in IRC at [irc://irc.freenode.net/funtoo #funtoo].  


==== Kernel Package Set ====
As a workaround or for educational purposes,  you could use the following equivalent commands.  For example,  to make gentoo-sources available for compiling your kernel,  enter:


To create the kernel package set, perform the following steps:
<pre>
# cd /usr/src
# rm linux
# ls
gentoo-sources-3.5.4
# ln -s gentoo-sources-3.5.4 linux
</pre>


<console>
where gentoo-sources is the directory that the <tt>ls</tt> command above showed you.
(chroot) # ##i##mkdir /etc/portage/sets
(chroot) # ##i##echo sys-kernel/debian-sources > /etc/portage/sets/kernel
</console>


Now, we'll want to set a USE variable to tell <code>debian-sources</code> to build a "universal" kernel and initramfs for us, to take the guess-work out of getting Funtoo Linux booted. To do this, we're going to set the <code>binary</code> USE variable for <code>debian-sources</code>, as follows:
Now you are nearly ready to configure your kernel.  First switch to a second terminal with <tt>Alt+F2</tt> and execute <tt>lspci</tt> and copy the output, most importantly the names of the VGA, Ethernet and Network devices currently in your system. Knowing these device names will be needed if you need help for default options at the [http://kmuto.jp/debian/hcl/ Debian GNU/Linux device driver check page]. Some options there aren't in your kernel or may have other names but it is a good source for getting default options help for devices.
[[Image:fqi-025.png|center]]
Now move back to your chrooted system (<tt>Alt+F1</tt>) and start the configure process with


<console>
<pre>
(chroot) # ##i##echo "sys-kernel/debian-sources binary" >> /etc/portage/package.use
# cd /usr/src/linux
</console>
# make menuconfig
</pre>


If USE variables are new to you, you'll be getting a lot more familiar with them as you use Funtoo Linux. At their essence, they are "switches" that you can set to configure options that can be built in to various packages. They're used to customize your Funtoo Linux system to meet your exact needs. We added support for a <code>binary</code> USE flag to the <code>debian-sources</code> ebuilds, as well as a few other of our kernel ebuilds, to make it easier for new users to get Funtoo Linux up and running.
This will present you a screen similar to the following:
[[Image:fqi-024.png|center]]
start setting the options you know about or the ones the page above gave you. You need to at least set the following options:


Now, when we just want to update our system's packages, we'll type <code>emerge -auDN @world</code>, and it will update our world set, leaving out the kernel. Likewise, when we just want to update our kernel, we'll type <code>emerge -au @kernel</code>, and it will update our kernel, leaving out the world set.
Here are some more sources you may like to read for configuring your kernel the old fashioned manual way:


==== Building the Kernel ====
* [http://kernel-seeds.org/ http://kernel-seeds.org]
* [http://swift.siphos.be/linux_sea/ch07.html http://swift.siphos.be/linux_sea/ch07.html]
* [http://www.gentoo.org/doc/en/kernel-config.xml http://www.gentoo.org/doc/en/kernel-config.xml]


{{Fancynote|1=
====== default options for unencrypted/encrypted setup ======
See [[Funtoo Linux Kernels]] for a full list of kernels supported in Funtoo Linux. We recommend <code>debian-sources</code> for new users.}}


{{fancyimportant|1=
We advised above to use a partitioning scheme based on the following filesystemtypes:
<code>debian-sources</code> with <code>binary</code> USE flag requires at least 14GB free in <code>/var/tmp</code> and takes around 1 hour to build on a Intel Core i7 Processor.}}


Let's emerge our kernel:
* ext2
* swap
* ext4
* xfs


<console>
You now need to activate all of them so you can boot your system later, these options can be fount at:
(chroot) # ##i##emerge @kernel
</console>


Note that while use of the <code>binary</code> USE flag makes installing a working kernel extremely simple, it is one part of Funtoo Linux that takes a ''very'' long time to build from source, because it is building a kernel that supports ''all'' hardware that Linux supports! So, get the build started, and then let your machine compile. Slower machines can take up to several hours to build the kernel, and you'll want to make sure that you've set <code>MAKEOPTS</code> in <code>/etc/make.conf</code> to the number of processing cores/threads (plus one) in your system before starting to build it as quickly as possible -- see the [[#/etc/make.conf|/etc/make.conf section]] if you forgot to do this.
{{kernelop|File Systems --->|<*>&nbsp;&nbsp;&nbsp;Second extended fs support<br><*>&nbsp;&nbsp;&nbsp;The Extended 4 (ext4) filesystem<br>[*]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ext4 extended attributes (NEW)<br>[&nbsp;&nbsp;&nbsp;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ext4 POSIX Access Control Lists (NEW)<br>[&nbsp;&nbsp;&nbsp;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ext4 Security Labels (NEW)<br>[&nbsp;&nbsp;&nbsp;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EXT4 debugging support (NEW)<br><*>&nbsp;&nbsp;&nbsp;XFS filesystem support<br>[&nbsp;&nbsp;&nbsp;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;XFS Quota support (NEW)<br>[&nbsp;&nbsp;&nbsp;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;XFS POSIX ACL support (NEW)<br>[*]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;XFS Realtime subvolume support<br>[&nbsp;&nbsp;&nbsp;]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;XFS Debugging support (EXPERIMENTAL) (NEW)}}


{{fancynote|NVIDIA card users: the <code>binary</code> USE flag installs the Nouveau drivers which cannot be loaded at the same time as the proprietary drivers, and cannot be unloaded at runtime because of KMS. You need to blacklist it under <code>/etc/modprobe.d/</code>.}}
If you furthermore decided to follow our advice and use a GPT-Partitioning scheme, what will be our default, you need to activate it in your kernel by using the following options:


{{fancynote|For an overview of other kernel options for Funtoo Linux, see [[Funtoo Linux Kernels]]. There may be modules that the Debian kernel doesn't include, a situation where [http://www.funtoo.org/wiki/Funtoo_Linux_Kernels#Using_Debian-Sources_with_Genkernel genkernel] would be useful. Also be sure to see [[:Category:Hardware Compatibility|hardware compatibility]] information.}}
{{kernelop|File Systems ---> (or Enable the block layer --->)<br>&nbsp;&nbsp;&nbsp;Partition Types --->|[*]&nbsp;&nbsp;&nbsp;Advanced Partition Selection (PARTITION_ADVANCED)<br>[*]&nbsp;&nbsp;&nbsp;EFI GUID Partition Support (EFI_PARTITION)}}


Once <code>emerge</code> completes, you'll have a brand new kernel and initramfs installed to <code>/boot</code>, plus kernel headers installed in <code>/usr/src/linux</code>, and you'll be ready to configure the boot loader to load these to boot your Funtoo Linux system.
====== additional encrypted options ======


=== Installing a Bootloader ===
It is very important to add the following parts in your kernel setup, when you used the above GPT or MBR encrypted setup. Under
{{kernelop|General setup --->|[*]&nbsp;&nbsp;&nbsp;Initial RAM filesystem and RAM disk (initramfs/initrd) support}}


{{fancynote|An alternate boot loader called extlinux can be used instead of GRUB if you desire. See the [[Extlinux|extlinux Guide]] for information on how to do this.}}
and under
{{kernelop
|Device Drivers ---><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[*] Multiple devices driver support
|<*>&nbsp;&nbsp;&nbsp;Device Mapper Support<br><*>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Crypt target support}}


==== Installing Grub ====
and finaly under
{{kernelop|-*-&nbsp;&nbsp;&nbsp;Cryptographic API --->|<*>&nbsp;&nbsp;&nbsp;XTS support (EXPERIMENTAL)<br><br>-*-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AES cipher algorithms}}


The boot loader is responsible for loading the kernel from disk when your computer boots. For new installations, GRUB 2 and Funtoo's boot-update tool should be used as a boot loader. GRUB supports both GPT/GUID and legacy MBR partitioning schemes.
====== building the kernel the manual way ======


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>. (You may need to adjust <code>GRUB_PLATFORMS</code> if you are on a UEFI system. See [[UEFI Install Guide]]).
Now that all the options are set exit <tt>menuconfig</tt> and answer the question about saving your config with <tt>YES</tt>. That already was the hardest part, now bake your kernel.


<console>
<pre>
(chroot) # ##i##emerge boot-update
# make
</console>
# make modules_install
# cp arch/<architecture>/boot/bzImage /boot/bzImage-<versionnumber>
</pre>


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>.  
This code-sequence will need to be explained, the first command <tt>make</tt> will bake your kernel, it will take some time, so feel free to get a coffee. :) if you don't have one available here is one from us |_|). <tt>make modules_install</tt> generates the modules for the kernel and builds them, the third command in the sequence needs to be adjusted by you, if you use a 32bit system replace <architecture> with x86 and for 64bit systems with x86_64, finally replace the <versionnumber>-string with a for you readable and unique versionnumber like <tt>2.6.38-rc7-mykernel-v1</tt> or something like that, then the command copies over your baked kernel to /boot and you are ready to get to the next step....


<code>/etc/boot.conf</code> should now look like this:
==== Bootloader ====
===== boot-update =====
 
<tt>boot-update</tt> is the default boot-loader configuration tool in funtoo.  You need to install it with
 
<pre>
# emerge -avt boot-update
</pre>
 
This will install boot-update and grub2 for you.  Next you need to configure it.  That is done in <tt>/etc/boot.conf</tt>:
 
<pre>
# vim /etc/boot.conf
</pre>
 
/etc/boot.conf will look somewhat like the following:


<pre>
<pre>
boot {
boot {
        generate grub
generate grub
        default "Funtoo Linux genkernel"
default "Funtoo Linux 64-bit"  
        timeout 3
timeout 10
}
 
display {
gfxmode 1440x900
#background /boot/
}
 
color {
normal cyan/black
highlight black/cyan
}
 
default {
scan /boot
kernel bzImage[-v] kernel[-v] vmlinuz[-v]
initrd initramfs[-v]
 
# root=auto will cause the parameter
# from your /etc/fstab. rootfstype=
 
params video=vesafb root=auto rootfstype=auto
 
# an alternate graphics mode can be set
# default is inherited from display:
 
# gfxmode 1024x768
}
}


"Funtoo Linux" {
"altboot" {
params += init=/bin/bash
}
 
"Funtoo Linux 64-bit gpt" {
         kernel bzImage[-v]
         kernel bzImage[-v]
        # params += nomodeset
}
}


"Funtoo Linux genkernel" {
"Funtoo Linux genkernel" {
# if you use bliss-kernel package
# you should change string
# kernel kernel[-v]
# to
# kernel kernel/[-v]/kernel[-v]
         kernel kernel[-v]
         kernel kernel[-v]
         initrd initramfs[-v]
         initrd initramfs[-v]
         params += real_root=auto  
         params += real_root=auto
        # params += nomodeset
}
}  
 
"Funtoo Linux 64-bit encrypted gpt/mbr manual kernel" {
kernel bzImage[-v]
initrd /initramfs.cpio.gz
params += enc_root=/dev/sda3 lvm luks root=/dev/mapper/vg-root rootfstype=ext4 resume=swap:/dev/mapper/vg-swap quiet
}
</pre>
 
If you decided to do a manual kernel,  with an encrypted HDD,  you will need to read the next section after you made the changes to your config. If you decided to use genkernel or a manual kernel with unencrypted HDD, all is OK and it is now safe for you to go to the [[Funtoo Quick Install#setting up grub2|Grub2 setup]].
 
====== encrypted disk with manual kernel ======
 
As you decided to make an encrypted disk setup with a manual kernel,  you need to instal slashbeast's [http://github.com/slashbeast/better-initramfs better-initrmafs]. It is very simple to do.  First clone the git-repository.  If you aren't confident with git,  feel free to have a look at our [[Git Guide]].
 
<pre>
# install -d /root/.git
# cd /root/.git
# git clone git://github.com/slashbeast/better-initramfs.git
# cd better-initramfs
# git checkout v0.3
# less README.rst
# echo "sys-apps/busybox static" >> /etc/portage/package.use/busybox && echo "sys-fs/cryptsetup static" >> /etc/portage/package.use/cryptsetup && echo "sys-fs/lvm2 static" >> /etc/portage/package.use/lvm2
# emerge -avt busybox cryptsetup lvm2
# make
>>> New better-initramfs is not backward compatible, read ChangeLog file.
 
>>> Preparing binary files...
>>> Adding /bin/busybox...
>>> Adding /sbin/cryptsetup...
>>> Adding /sbin/lvm.static...
>>> Building image...
>>> initramfs.cpio.gz is ready.
# cp initramfs.cpio.gz /boot
</pre>
 
Now you are ready to setup grub2.  Just go to the next section.
 
======= Updating better-initramfs =======
 
As the [http://github.com/slashbeast/better-initramfs better-initrmafs] project isn't controlled at the moment by an ebuild, you will need to take care of updating it by yourself, but it is very easy to do so:
 
<pre>
# git checkout master
# git pull
# less ChangeLog
# git checkout vx.x
# make
</pre>
where x.x is a version announced in the ChangeLog. At the moment the stable is 0.3.
 
====== setting up grub2 ======
 
This step is easy.  It is done with two commands;
 
<pre>
# grub-install --no-floppy /dev/sda
# boot-update
</pre>
 
A successful run of boot-update might will look like this:
 
<pre>
boot-update 1.5.2 / Copyright 2009-2011 Funtoo Technologies
 
[use option "-l" for license info, "-h" for help]
 
* Generating config for grub...
 
DEFAULT > Funtoo Linux 64-bit - bzImage-2.6.39-rc7-git-a2b9c1f
          Funtoo Linux 64-bit - bzImage-2.6.39-rc7-git-446cc63
          Funtoo Linux 64-bit - bzImage-2.6.39-rc7-git-df8d06a
 
* WARN : multiple matches found for default "Funtoo Linux 64-bit" - most recent used.
* Completed successfully with warnings.
</pre>
 
===== Extlinux =====
 
For Extlinux you will find a guide for setup at [[Extlinux]].
 
== finalize Setup ==
 
=== Necessary System Tools ===
 
As some tools are providing the same functionality, it is up to you to choose which ones you like to use. The next sections are giving you an overview of tools you might like to use and install, but all are optional.
 
==== System Logger ====
 
Linux and Unix have an excellent history of logging capabilities, if you want you can log from only special stuff up to everything that happens on your system in logfiles, for that behavior is a system logger the reason.
 
There are several in our repository from which you can choose:
* sysklogd, which is a traditional set of system logging daemons,
* syslog-ng, which is an advanced system logger and
* metalog, which is a highly-configurable system logger,
* rsyslog, seems to be a popular choice, default syslog of Fedora, RHEL, openSUSE, Debian and Ubuntu
* there might be others available too, but at the moment we aren't aware of them.
 
We advice you to install next to sysklogd or syslog-ng the logrotate tool, as those system loggers don't provide a rotation machanism for the log files.
 
Just install the desired one like the example shows:
 
<pre>
# emerge syslog-ng
# rc-update add syslog-ng default
</pre>
 
==== Optional: Cron Daemon ====
 
Although this is optional it is in our opinion very handy and wise to install one. But you might ask yourself now "What the hell is a cron daemon?" A cron daemon just executes scheduled commands, so you see it can be very handy if you need to execute commands regularly.
 
In our tree there are three possible cron daemons; dcron, fcron and vixie-cron. We would like to advise you to use fcron, but it depends on what you like. also vixie-cron might be easier, as you don't need to execute <tt>crontab /etc/crontab</tt>, fcron might be more powerful.
 
<pre>
# emerge fcron
# rc-update add fcron default
# crontab /etc/crontab
</pre>
 
==== Optional: File Indexing ====
 
If you like to index your files for a fast search, you need to install mlocate so you can use the locate command to quickly search for them:
 
<pre>
# emerge mlocate
# updatedb
</pre>
</pre>


If you use bliss-kernel, your <code>/etc/boot.conf</code> should look like:
==== File System Tools ======
 
As we used some special filesystems above you need to at least install xfsprogs, but there might be some others too, the following table gives you an overview:
{| border="0" cellpadding="4"
|-
! File System !! Tool !! install command !! needed
|-
| XFS
| xfsprogs
| emerge xfsprogs
| X
|-
| JFS
| jfsprogs
| emerge jfsprogs
|
|-
| reiserfs
| reiserfsprogs
| emerge reiserfsprogs
|
|-
| btrfs
| btrfs-progs
| emerge btrfs-progs
|
|-
|}
 
=== Networkconfig ===
 
==== The Easy (Dynamic) Way ====
 
When configuring your network, one option is to skip traditional network configuration and simply rely on DHCP. This is by far the simplest method of configuring your network. If you are on a wired network, no other steps are typically required beyond enabling a DHCP client, and Funtoo Linux includes dhcpcd 5.x by default. To enable DHCP at system startup, you would add dhcpcd to your default runlevel as follows:


<pre>
<pre>
boot {
# rc-update add dhcpcd default
        generate grub
</pre>
        default "Funtoo Linux genkernel"
 
        timeout 3  
{{note|If your going to use a third party package such as Network Manager or Wicd to manage your network then do not add dhcpcd to any runlevel. These packages handle DHCP for you.}}
}
 
==== The Modular Way ====
 
DHCP isn't always an option, and for these situations, Funtoo Linux offers its own modular, template-based network configuration system. This system offers a lot of flexibility for configuring network interfaces, essentially serving as a "network interface construction kit." This system can be used by itself, or even combined with dhcpcd -- if you limit dhcpcd to only manage certain network interfaces.
 
Here are the key components of the template-based network configuration system:
<ol style="list-style-type: decimal;">
<li><p><tt>/etc/init.d/netif.lo</tt> -- An init script that configures the localhost interface.</p></li>
<li><p><tt>/etc/netif.d</tt> -- This is a directory that contains various network configuration templates. Each of these templates is focused on configuring a particular type of network interface, such as a general static IP-based interface, a bridge interface, a bond interface, etc.</p></li>
<li><p><tt>/etc/init.d/netif.tmpl</tt> -- This is the master init script for the template-based network configuration system. New interfaces are added to your system by creating symbolic links to this file in /etc/init.d.</p></li></ol>
 
So, if you wanted to use this system to configure eth0 with a static IP address, you would create a netif.eth0 symlink to netif.tmpl as follows:
<pre>
# cd /etc/init.d
# ln -s netif.tmpl netif.eth0
</pre>
 
Then, you would create an /etc/conf.d/netif.eth0 configuration file that would specify which template to use from the /etc/netif.d directory:
<pre>
template="interface"
ipaddr="10.0.1.200/24"
gateway="10.0.1.1"
nameservers="10.0.1.1 10.0.1.2"
domain="funtoo.org"
</pre>
 
To complete our static IP network configuration we would need to:
<pre>
# rc-update add netif.eth0 default
</pre>
 
When configuring your own static network interface, one of ipaddr or ipaddrs is required and should specify the IP address(es) to configure for this interface, in "a.b.c.d/netmask" format. Optional parameters include gateway, which defines a default gateway for your entire network, and if set should specify the gateway's IP address. In addition, domain and nameservers (space-separated if more than one) can be used to specify DNS information for this interface.
 
===== Configuration Variables =====
 
====== Interface Variables ======
 
The following variables are supported by the interface and bridge templates:
 
* ipaddr or ipaddrs: specify IPv4 or IPv6 address(es) for the interface. IP addresses should be specified in "IP/netmask" format, such as "10.0.0.1/24". Multiple IP addresses can be specified like this:
<pre>
ipaddrs="10.0.0.1/24 10.0.0.2/24"
</pre>
 
Note that in some cases, you may choose to not specify ipaddr or ipaddrs for a bridge template. That is allowed. If you don't want to specify an IP address for a regular interface, you can choose to use the interface template without an IP address specified in the config, or use the interface-noip template instead, for the sake of clarity.
 
Also note that if you specify multiple IP addresses, ifconfig will only show the first IP address. To view all IP addresses associated with the interface, use the ip addr show command.
 
===== General Variables =====
 
The following variables are enabled by default for all network scripts, and if specified will trigger a corresponding configuration action:
nameservers: Set DNS nameservers using OpenResolv. Specify multiple nameservers like this: "1.2.3.4 1.2.3.5 1.2.3.6"
* domain: Set DNS domain using OpenResolv.
* gateway: Define a default IP gateway.
* route: Specify a semi-colon delimited list of routes to apply when this interface is brought up. Will be appended to ip route add.
* mtu: Set Maximum Transmit Unit for the interface
* slaves: Set slave interfaces of this interface (for bridges, etc.) All slaves will automatically be depended upon, and will also automatically have their mtu set to that of the current interface, if an mtu is specified for the current interface. This setting is required for the bond template and optional for the bridge template.
 
==== VLAN Variables ====
 
VLAN support is enabled by default for all network configuration scripts. If a network script has a name in the format netif.ethX.Y, then it is assumed to be a VLAN interface referencing trunk ethX and VLAN ID Y. If you desire a custom name for your VLAN interface, you can name your interface whatever you'd like and specify the following variables in your interface config [file: file:]
* trunk: VLAN trunk interface, e.g. "eth0"
* vlan: VLAN id, e.g. "32"
 
==== OpenResolv and resolv.conf ====
 
For the network configuration above, OpenResolv will be used to set DNS information when the netif.eth0 is brought up. The OpenResolv framework will add entries to /etc/resolv.conf, and will also handle removing these entries when the interface is brought down. This way, /etc/resolv.conf should always contain current information and should not need to be manually edited by the system administrator. dhcpcd will use OpenResolv for updating system DNS information as well.


"Funtoo Linux" {
==== Network-Dependent Services ====
        kernel bzImage[-v]
        # params += nomodeset
}


"Funtoo Linux genkernel" {
One important difference between Gentoo Linux and Funtoo Linux is that, in Funtoo Linux, network-dependent services only strictly depend on netif.lo. This means that if another network service requires an interface to be up, such as samba requiring eth0, then the system administrator must specify this relationship by adding the following line to /etc/conf.d/samba:
        kernel kernels/[-v]/kernel[-v]
<pre>
        initrd initramfs[-v]
rc_need="netif.eth0"
        params += real_root=auto
        # params += nomodeset
}
</pre>
</pre>


Please read <code>man boot.conf</code> for further details.
This will have the effect of ensuring that netif.eth0 is started prior to samba and that samba is stopped prior to stopping netif.eth0.  


===== Running grub-install and boot-update =====
Many network services, especially those that listen on all network intefaces, don't need an rc_need line in order to function properly. Avoiding the use of rc_need when required will optimize boot times and allow more network services to remain available when network interfaces are brought up and down by the system administrator.


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:


<console>
==== Multiple Network Configurations ====
(chroot) # ##i##grub-install --no-floppy /dev/sda
(chroot) # ##i##boot-update
</console>


Now you need to update your boot loader configuration file:
For information on how to have multiple, independent network configurations, please see Stacked Runlevels.  
<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.


=== Configuring your network ===
===== Alternate Configs =====


It's important to ensure that you will be able to connect to your local-area network after you reboot into Funtoo Linux. There are three approaches you can use for configuring your network: NetworkManager, dhcpcd, and the [[Funtoo Linux Networking]] scripts. Here's how to choose which one to use based on the type of network you want to set up.
If you need to run the same service with different configuration parameters depending upon runlevel, then you'll be happy to know that you can specify runlevel-specific conf.d files by appending a . <runlevel> suffix. In this particular example, we could imagine a situation where we had two child runlevels named home and work:
<pre>
/etc/conf.d/netif.eth0.home
/etc/conf.d/netif.eth0.work
</pre>
Note that this feature works for all init scripts, not just network configuration scripts.  


==== Wi-Fi ====
===== Interface Renaming =====
===== Using NetworkManager =====
For laptop/mobile systems where you will be using Wi-Fi and connecting to various networks, NetworkManager is strongly recommended. The Funtoo version of NetworkManager is fully functional even from the command-line, so you can use it even without X or without the Network Manager applet. Here are the steps involved in setting up NetworkManager:


<console>
Funtoo network scripts now support interface renaming, so you can create an interface called lan if you would like. To so this, simply specify the MAC address of the interface you would like to rename using the macaddr variable:
(chroot) # ##i##emerge linux-firmware
macaddr="00:15:17:19:b6:a3"
(chroot) # ##i##emerge networkmanager
If this MAC address is part of the netif.lan configuration file, then when this interface starts, whatever interface currently has the MAC address of 00:15:17:19:b6:a3 (i.e. eth5) will be renamed to lan prior to the interface being brought up, and will show up in ifconfig and ip commands as being an interface named lan.
(chroot) # ##i##rc-update add NetworkManager default
</console>


Above, we installed linux-firmware which contains a complete collection of available firmware for many hardware devices including Wi-Fi adapters, plus NetworkManager to manage our network connection. Then we added NetworkManager to the <code>default</code> runlevel so it will start when Funtoo Linux boots.
===== Basic VLAN Configuration =====


After you reboot into Funtoo Linux, you will be able to add a Wi-Fi connection this way:
The standard interface template supports VLANs. To use VLAN support, first configure the trunk interface using the interface-noip template. Assuming eth1 is trunked, you would create the file /etc/conf.d/netif.eth1 with the following contents:
<pre>
template="interface-noip"
</pre>


<console>
Then, create a network interface symlink for the trunk and add it to your default runlevel:
# ##i##addwifi -S wpa -K 'wifipassword' mywifinetwork
<pre>
</console>
# cd /etc/init.d
# ln -s netif.tmpl netif.eth1
# rc-update add netif.eth1 default
</pre>


The <code>addwifi</code> command is used to configure and connect to a WPA/WPA2 Wi-Fi network named <code>mywifinetwork</code> with the password <code>wifipassword</code>. This network configuration entry is stored in <code>/etc/NetworkManager/system-connections</code> so that it will be remembered in the future. You should only need to enter this command once for each Wi-Fi network you connect to.
Now, assuming you wanted to configure a VLAN of 32, you would create a config file named /etc/conf.d/netif.eth1.32 that looks something like this:
<pre>
template="interface"
ipaddr="1.2.3.4/24"
gateway="1.2.3.1"# etc...
</pre>


===== Using wpa_supplicant =====
Then, create a VLAN network interface symlink and add it to your default runlevel:
If for some reason you don't want to use a tool such as NetworkManager or <code>wicd</code>, you can use wpa_supplicant for wireless network connections.
<pre>
# cd /etc/init.d
# ln -s netif.tmpl netif.eth1.32# rc-update add netif.eth1.32 default
</pre>


First, emerge wpa_supplicant:
The Funtoo network configuration scripts will automatically recognize the filename netif.eth1.32 as being VLAN 32 of trunk interface netif.eth1.


<console>
When the VLAN interface is brought up, it will be named eth1.32.
(chroot) ###i## emerge -a wpa_supplicant
</console>


Now, edit the wpa_supplicant configuration file, located at /etc/wpa_supplicant.conf.
===== Custom VLAN Names =====
The syntax is very easy:
 
However, sometimes you may want to turn off automatic file-based VLAN naming and give your VLAN interface a custom name, such as mgmt. To do this, you would set up the trunk interface in the exact same way as described above, but instead of creating a netif.eth1.32 interface, you would create a netif.mgmt interface, and specify vlan and trunk in the /etc/conf.d/netif.mgmt config file, as follows:  
<pre>
<pre>
network={
template="interface"
ssid="MyWifiName"
vlan="32"
psk="lol42-wifi"
trunk="eth1"
}
ipaddr="1.2.3.4/24"
gateway="1.2.3.1"
# etc...
</pre>
 
When you specify trunk and vlan in the interface config file, filename-based auto-detecting of VLAN ID and trunk is disabled. Both trunk and vlan must be specified -- you can't specify just one.
 
Then you would simply create a VLAN network interface symlink for netif.mgmt:
<pre>
# cd /etc/init.d
# ln -s netif.tmpl netif.mgmt
# rc-update add netif.mgmt default
</pre>
 
When the VLAN interface is brought up, it will be named mgmt.
 
==== More Complex Network Configuration ====
 
If the standard templates don't work for your needs, simply create a new template -- I recommend starting from the interface template for most things:
<pre>
# cd /etc/netif.d
# cp interface custom
</pre>
 
You can now call whatever commands you need to /etc/netif.d/custom. The following shell functions can be defined in a network script:
 
==== netif_create ====
 
In netif_create, you should call any commands to create the interface if it does not yet exist.
 
==== netif_depend ====
 
In netif_depend, you can define dependencies, using the functions need and use.
 
==== netif_pre_up ====
 
In netif_pre_up, you can define network configuration actions to perform prior to bringing the interface up. You can also ensure certain variables are specified by calling require var1 [var2...] here.
 
==== netif_post_up ====
 
In netif_post_up, you can define network configuration actions to perform after bringing the interface up.
 
==== netif_pre_down ====
 
In netif_pre_down, you can define network configuration actions to perform prior to bringing the interface down.
 
==== netif_post_down ====
 
In netif_post_down, you can define network configuration actions to perform after bringing the interface down.
 
==== netif_destroy ====
 
In netif_destroy, you can call any commands necessary to destroy/delete the interface if it is dynamic in nature (tun/tap, etc.)
 
==== How It Works ====
 
You do not specify a function for actually bringing up the interface, because the template-based system does this for you. The template-based system also performs all normal actions for required for bringing an interface down, so only need to specify atypical actions that must be performed - such as removing child interfaces or destroying a bridge using brctl.
 
When you create your own network configuration template, the following capabilities are available for use automatically, as long as the appropriate variables are set in the /etc/conf.d/netif.<ifname> file,, without requiring any explicit steps on your part:
* DNS configuration using domain and nameservers config settings. OpenResolv is used automatically.
* VLAN configuration using auto-naming (netif.ethX.Y) or via custom naming with trunk and vlan config settings.
* Default gateway and route configuration using the gateway and route settings.
* MTU configuration using the mtu setting.
* Auto-depend (and auto-MTU configuration) of slave interfaces specified using slaves setting.
* Renaming of existing network interface (specify MAC address using macaddr setting).
 
To take advantage of this functionality, simply enable the appropriate variables.
 
All other necessary network configuration and dependency behavior should be defined using the netif_-prefix functions described above.
 
==== Wireless Configuration ====
 
Wireless network configuration requires additional steps to the ones outlined above.


network={
For wireless networks, you will need to enable wireless extensions in your kernel, the appropriate wireless modules, and emerge wireless-tools:
ssid="Other Network"
<pre>
psk="6d96270004515a0486bb7f76196a72b40c55a47f"
# emerge wireless-tools
}
</pre>
</pre>


You will need to add both <code>wpa_supplicant</code> and <code>dhcpcd</code> to the default runlevel. <code>wpa_supplicant</code> will connect to your access point, and <code>dhcpcd</code> will acquire an IP address via DHCP:
I also recommend you emerge wpa_supplicant. wpa_supplicant implements modern WPA/WPA2 wireless link-layer encryption, which is necessary for connecting to most modern password-protected wireless networks:  


<console>
<pre>
(chroot) # ##i##rc-update add dhcpcd default
# emerge wpa_supplicant
(chroot) # ##i##rc-update add wpa_supplicant default
</pre>
</console>


==== Desktop (Wired Ethernet) ====
After emerging, add to your default runlevel as follows:
<pre>
# rc-update add wpa_supplicant default
</pre>


For a home desktop or workstation with wired Ethernet that will use DHCP, the simplest and most effective option to enable network connectivity is to simply add <code>dhcpcd</code> to the default runlevel:
==== 802.11 Passphrases ====


<console>
The only remaining step is to use the wpa_passphrase utility to store hashed keys (passwords) that wpa_supplicant can use to connect to your favorite wireless networks. This is done as follows:
(chroot) # ##i##rc-update add dhcpcd default
<pre>
</console>
# wpa_passphrase jims-netgear >> /etc/wpa_supplicant/wpa_supplicant.conf
<enter your passphrase>
</pre>


When you reboot, <code>dhcpcd</code> will run in the background and manage all network interfaces and use DHCP to acquire network addresses from a DHCP server.
Now, when wpa_supplicant encounters an SSID of jims-netgear, it will use the password you entered to authenticate with this access point.  


==== Server (Static IP) ====
At this point, ensure that dhcpcd has been enabled in your current runlevel and type rc to start everything up. wpa_supplicant should be able to automatically associate with SSIDs in its config file, at which point dhcpcd will take over and acquire an IP address from a DHCP server. This should all happen seamlessly. Use the iwconfig command to see if you have successfully associated with an access point.


For servers, the [[Funtoo Linux Networking]] scripts are recommended. They are optimized for static configurations and things like virtual ethernet bridging for virtualization setups. See [[Funtoo Linux Networking]] for information on how to use Funtoo Linux's template-based network configuration system.


=== Finishing Steps ===


==== Set your root password ====
==== Wireless Firmware ====
It's imperative that you set your root password before rebooting so that you can log in.
<console>
(chroot) # ##i##passwd
</console>


===Restart your system ===
Many wireless adapters will now have everything they need to work. However, if you have an Intel wireless adapter, then you may need to install the proper microcode for your device in addition to ensuring that the proper Intel Wireless kernel drivers are available. For my Intel Corporation PRO/Wireless AGN [Shiloh] Network Connection, I need to do the following:
<pre>
# emerge net-wireless/iwl5000-ucode
</pre>


Now is the time to leave chroot, to unmount Funtoo Linux partitions and files and to restart your computer. When you restart, the GRUB boot loader will start, load the Linux kernel and initramfs, and your system will begin booting.
udev (running by default) and the Linux kernel firmware loader support (CONFIG_FW_LOADER) will automatically load the microcode when needed.  


Leave the chroot, change directory to /mnt, unmount your Funtoo partitions, and reboot.
Note that Gentoo and Funtoo provide different versions of the Intel microcode because the version you need will depend on the kernel you are using. For my RHEL5-based kernel, I had emerge an older version of the microcode to match what my kernel wireless driver was expecting by typing:
<console>
# emerge =net-wireless/iwl5000-ucode-5.4.0.11
(chroot) # ##i##exit
# ##i##cd /mnt
# ##i##umount -l funtoo
# ##i##reboot
</console>


{{fancynote|System Rescue CD will gracefully unmount your new Funtoo filesystems as part of its normal shutdown sequence.}}
This installed this file iwlwifi-5000-1.ucode which was required by my RHEL5-based kernel. Just typing emerge net-wireless-iwl5000-ucode installed iwlwifi-500-2.ucode, which my kernel could not use. Before I had the right version of the microcode, I saw an error like this when I viewed the kernel messages by typing dmesg:
iwl5000: iwlwifi-5000-1.ucode firmware file req failed: Reason -2


You should now see your system reboot, the GRUB boot loader appear for a few seconds, and then see the Linux kernel and initramfs loading. After this, you should see Funtoo Linux itself start to boot, and you should be greeted with a <code>login:</code> prompt. Funtoo Linux has been successfully installed!
This error message generally means "I can't find this file iwlwifi-5000-1.ucode that I'm looking for in /lib/firmware." With the proper firmware in place, then the wireless driver will be happy and wpa-supplicant can then bring the wireless interface up.
=== Profiles ===


Once you have rebooted into Funtoo Linux, you can further customize your system to your needs by using Funtoo Profiles.
=== Set your root password ===


[[Funtoo 1.0 Profile|Funtoo profiles]] are used to define defaults for Portage specific to your needs. There are 4 basic profile types: arch, build, [[Flavors and Mix-ins|flavor, and mix-ins]]:
It's imperative that you set your root password before rebooting:  
<pre>
# passwd
</pre>


;arch: typically <code>x86-32bit</code> or <code>x86-64bit</code>, this defines the processor type and support of your system. This is defined when your stage was built and should not be changed.
=== Create a user account ===
;build: defines whether your system is a <code>current</code>, <code>stable</code> or <code>experimental</code> build. <code>current</code> systems will have newer packages unmasked than <code>stable</code> systems.
;flavor: defines the general type of system, such as <code>server</code> or <code>desktop</code>, and will set default USE flags appropriate for your needs.
;mix-ins: define various optional settings that you may be interested in enabling.


One arch, build and flavor must be set for each Funtoo Linux system, while mix-ins are optional and you can enable more than one if desired.
Logging in as root is a bad idea on a Linux system. Before rebooting, create a user account for everyday use. Adjust the groups in the example below to match your needs. Some of them may not exist yet on your system. Replace '<user_name>' with the name your going to use for your everyday user. The '-m' option instructs useradd to create a home directory for your user. See the useradd manpage for more info.  
<pre>
useradd -m -G audio,cdrom,cdrw,floppy,usb,users,video,wheel -s /bin/bash <user_name>
</pre>


Remember that profiles can often be inherited. For example, the <code>desktop</code> flavor inherits the <code>workstation</code> flavor settings, which in turn inherits the <code>X</code> and <code>audio</code> mix-ins. You can view this by using eselect:
Don't forget to set a password for your new user:
<pre>
passwd <user_name>
</pre>


<console>
=== Verify boot time services ===
(chroot) # ##i##eselect profile show
Currently set profiles:
    arch: gentoo:funtoo/1.0/linux-gnu/arch/x86-64bit
  build: gentoo:funtoo/1.0/linux-gnu/build/current
  flavor: gentoo:funtoo/1.0/linux-gnu/flavor/desktop
mix-ins: gentoo:funtoo/1.0/linux-gnu/mix-ins/kde


Automatically enabled profiles:
You should verify that all of your needed services have been added to the appropriate runlevel.  
mix-ins: gentoo:funtoo/1.0/linux-gnu/mix-ins/print
<pre>
mix-ins: gentoo:funtoo/1.0/linux-gnu/mix-ins/X
eselect rc list | less
mix-ins: gentoo:funtoo/1.0/linux-gnu/mix-ins/audio
</pre>
mix-ins: gentoo:funtoo/1.0/linux-gnu/mix-ins/dvd
mix-ins: gentoo:funtoo/1.0/linux-gnu/mix-ins/media
mix-ins: gentoo:funtoo/1.0/linux-gnu/mix-ins/console-extras
</console>


To view installed profiles:
Scroll though the list and check. Example of things you might need to add:
<console>
* lvm if you use logical volumes
(chroot) # ##i##eselect profile list
* Your system logger if you installed one
</console>
* hibernate-cleanup if you use tuxonice
* iptables
* dbus


To change the profile flavor:
Add anything you need with the following command:  
<console>
<pre>
(chroot) # ##i##eselect profile set-flavor 7
eselect rc add <script> <runlevel>
</console>
</pre>


To add a mix-in:
=== First boot ===


<console>
Now is the time to leave chroot, to unmount Funtoo Linux partitions and files and to restart your PC. If you installed GRUB, you will get an option to launch Funtoo Linux. Otherwise you will get to your already installed Linux and you will have to update your GRUB menu.
(chroot) # ##i##eselect profile add 10
</console>


===Next Steps===
Leave the chroot, change directory to /, and unmount your funtoo partitions. Adjust the unmount command to match your setup
<pre>
exit
cd /
umount /mnt/funtoo/home /mnt/funtoo/boot /mnt/funtoo/dev /mnt/funtoo/proc /mnt/funtoo/usr/portage /mnt/funtoo
</pre>


If you are brand new to Funtoo Linux and Gentoo Linux, please check out [[Funtoo Linux First Steps]], which will help get you acquainted with your new system. We also have a category for our [[:Category:Official Documentation|official documentation]], which includes all docs that we officially maintain for installation and operation of Funtoo Linux.
{{fancynote|In case of LVM2 also: <tt>swapoff /dev/mapper/vg-swap</tt>, <tt>vgchange -a n</tt> , if not You will see: Device dmcrypt_root is busy. In case of luks: <tt>cryptsetup luksClose dmcrypt_root</tt> to close the container.}}


We also have a number of pages dedicated to setting up your system, which you can find below. If you are interested in adding a page to this list, add it to the "First Steps" MediaWiki category.


{{#ask: [[Category:First Steps]] | format=ul }}
Restart
<pre>
shutdown -r now
</pre>


If your system did not boot correctly, see [[Installation Troubleshooting]] for steps you can take to resolve the problem.
== What's next ==
* [[Funtoo Linux First Steps]]


[[Category:HOWTO]]
[[Category:HOWTO]]
[[Category:Install]]
[[Category:Install]]
[[Category:Official Documentation]]
[[Category:Tutorial]]
</div><div class="col-md-3 col-hidden-sm col-hidden-xs"><div id="tocwrap" >
__TOC__
</div></div></div>

Revision as of 22:45, October 24, 2014

   Warning

This page has been proposed for deletion because it does not meet the Editing Guidelines.
If you disagree, please discuss it here.

   Note

If you want to do a standard Funtoo Linux installation, I recommend you use the shorter, official Funtoo Linux Installation Instructions instead. -Daniel


Introduction

This HowTo aims to give the experienced GNU/Linux User a quick way to install Funtoo Linux in a nice and fast way. Also we will give you all the necessary steps for installing Funtoo GNU/Linux in this guide, but we won't go deeper into the details of them as need

There are two ways of installing Funtoo GNU/Linux on your PC:

  1. using an already installed GNU/Linux System or
  2. using a LiveCD

If you plan to use a LiveCD, we recommend you to use SystemRescueCd.

All the commands in this guide are performed as "root", unless we indicate it otherwise.

This HowTo will cover the following four setups:

  1. a standard Installation (MBR, HDD not encrypted),
  2. a standard secure Installation (MBR, HDD encrypted),
  3. a modern Installation (GPT/GUID partition table, HDD not encrypted) and
  4. a modern secure Installation (GPT/GUID partition table, HDD encrypted).

These four approaches have the following Pros and Cons:


Setup Pro Contra
1
  • Easy method mostly used by all distributions
  • Well documented everywhere
  • Time saving method
  • No special EFI-partition needed
  • Dualbootable with Microsoft® Windows™
  • Partition table limited 4 primary ones only
  • Needs special 4th partition for more than 4 partitions
  • HDD not encrypted, can easily be cloned
2
  • Easy method mostly used by all distributions
  • Well documented everywhere
  • No special EFI-partition needed
  • HDD encrypted
  • Dualbootable with Microsoft® Windows™
  • Logical volume groups for GNU/Linux
  • Partition table limited 4 primary ones only
  • Need special 4th partition for more than 4 partitions
  • Needs lot of time for preparing the HDD to be encrypted
3
  • Easy method but nearly not used by other distributions
  • No special partiton needed for more than 4 partitions
  • Time saving method
  • Need special EFI-partition for boot-manager
  • Special kernel attributes are needed
  • Not compatible with Microsoft® Windows™
  • Not supported on all platforms especially for the system volume
  • HDD not encrypted, can easily be cloned from other linux systems
4
  • Easy method but nearly not used by other distributions
  • No special partition needed for more than 4 partitions
  • HDD encrypted
  • Logical volume groups
  • Need special EFI-partition for boot-manager
  • Special kernel attributes are needed
  • Not compatible with Microsoft® Windows™
  • Not supported on all platforms especially for the system volume
  • Needs lot of time for preparing the HDD to be encrypted

With the help of the the above table you should be able to select your future Hard Disk (HDD) partitioning scheme. In the further guide we will go through every single step for all four schemes.

For booting your old/other GNU/Linux System we won't give you a special detailed howto guide, as you should know how to do so, as concerning the booting with SystemRescueCd, we will give you a short step-by-step guide on how to boot up the system.

This guide will only be split into subparts for the installation process if concerning the four above mentioned steps, here the split points will be MBR vs. GPT/GUID-partitioning and encrypted vs. unencrypted HDD. So be aware of these parts if you want to use them.

Booting the Installation System

Booting old/other GNU/Linux

This step is really simple, as you know your old GNU/Linux System and you need simply start your Computer, select in the boot-loader your GNU/Linux System, let it start up, log in as always and start a root-terminal.

Booting with SystemRescueCd

First step is to download SystemRescueCd, an overview of the actual version can be found at http://www.sysresccd.org/Download, just follow there the link to the Sourceforge Download, you will download then about 300 MB to your HDD. If finished burn this ISO-image with your favorite burning tool like burn-cd, bashburn, K3B, GNOMEbaker on a GNU/Linux Box or NERO Burning ROM, CDBurnerXP Pro, and many more on a Microsoft® Windows™ box.

Fqi-001.png

Next insert this CD into your CD-ROM-Drive and boot up the PC with it where you want to install Funtoo GNU/Linux. Make sure you boot from the CD when booting. The Booting process with SystemRescueCd will follow the next steps:

  1. Selecting your Kernel to boot SystemRescueCd with:
Fqi-002.png

In that screen you will be greeted with all the power of SystemRescueCd, depending on your CPU we use the boot option 1) for a 32-bit CPU or a 64-bit CPU that should run in 32-bit mode and 6) for a 64-bit CPU in 64-bit mode. If this boot option fails, use the boot option A) or B), will will lead to the following screen:

Fqi-003.png

That menu will give you more boot options. If you select 1. here, it would be the same kernel option like in the previous screen 1) and 6). The next step is to select your keyboard layout for installation.

  1. Selecting your Installation Keyboard Layout
Fqi-004.png

That step requires a bit of your atention, as it only gives you 20 seconds time to choose your keyboard layout, if you are OK with the US keymap, just press Enter to accept the default setting.

  1. Being ready

Seconds later SystemRescueCd welcomes you wit a short message and is ready fo you to be used to perform your installation.

Fqi-005.png

HDD Preparation

As mentioned earlier in this guide we cover four different installation variations, the could be displayed in an installation matrix as below:

MBR GPT
unencrypted See MBR See GPT/GUID partition table
encrypted See MBR See GPT/GUID partition table

If you are going to plan to install Funtoo GNU/Linux on a machine where another O/S is already installed, you have to make some free space available on your HDD in order to do so. A resize of most existing filesystems can be done with SystemRescueCd too. You just need to enter the graphical environment and use gparted. We will give you a short example on how to do so with a sample HDD that might hold windows, so you get a feeling what to do, but be aware that a resize can be a dangerous part, so please keep a backup of your data, as Funtoo Technologies wouldn't take any responsibility for a loss of data that could happen by the process of shrinking a partition.

Starting the graphical environment in SystemRescueCd is really simple, just execute the following command:

root@sysresccd /root % wizard

and it will start a dialog for the graphical environment setup, for most users the default options should be OK. Both the dialog and the graphical environment (Xfce) are shown in the next two images.

Fqi-006.png
Fqi-007.png

Resize of HDD partitions

The above screen shows us that there is the tool called GParted right on the frontpanel. That tool will be used to resize our HDD partitions. The following screen shows us an example of how the tool looks if you start it.

Fqi-008.png

By clicking on the partion you want to resize you make it active right-click on it and use the point resize and you will see the Resize/Move dialog, here you can edit the resize options for that partiton.

Fqi-009.png

When you finished setting the resize options, you will see that the grey-green hook in the menu got green, that means you have jobs added to the working list. If you have all actions done on the partition, click on the green hook and your resize action will run by giving you the following feedback window:

Fqi-010.png

when that has finished you will see the resized result and it should look like that:

Fqi-011.png

we are finished with resizing the dis partitions, exit the Tool and close Xfce by clicking the running exit man in the down right. We are back on the command line and are ready to partitions our disk. to our needs, for a unified way we will show it with an empty partition table, so if you have resized some partitions, they will be listed in the MBR menu, as if you want to use an GPT/GUID partition table we will start from a clean table anyway.

Partitioning scheme

   Warning

If you are partitioning the hard drive of a SPARC machine, please see Funtoo Linux Installation on SPARC. Also, note that OpenBoot has no support for GPT volumes and you won't be able to boot on the system volume if that later has been partitioned with GPT.

For partitioning we suggest the following schemes:

  • MBR unencrypted
Partition Size fdisk option Filesystem (FS)
/boot 200 MB 83 ext2
swap 2x RAM if 1024 MB or less, otherwise 2 GB 82 sw (default)
/ 20-50 GB 83 ext4
/usr/portage ~10 GB 83 ext4
/home As much as possible. 83 xfs
  • MBR encrypted
Partition Size fdisk option FS
/boot 200 MB 83 ext2
cryptoroot Rest of the Disc 83 none
  • GPT unencrypted
Partition Size gdisk option FS
/boot 200 MB 0700 ext2
EFI-Boot 512 kB EF02 none
swap 2x RAM if 1024 MB or less, otherwise 2 GB 8200 swap (default)
/ 20 - 50 GB 0700 ext4
/usr/portage ~10 GB 0700 ext4
/home Rest of the Disc 0700 xfs
  • GPT encrypted
Partition Size gdisk option FS
/boot 200 MB 0700 ext2
EFI-Boot 512 kB EF02 none
cryptoroot Rest of the Disc 0700 none

MBR

Now we will partition the HDD using the above scheme with a disk partitioning tool named "fdisk". So just invoke it with the following command:

# fdisk /dev/sda 

it will greet you like this

Fqi-012.png

by pressing `m` you will get a help context menu that will give you the following options:

   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partion
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel <--- SPARC specific, see Funtoo installation notes for SPARC
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

The partitioning scheme is created with the following commands inside of fdisk:

unencrypted

Command (m for help): n

it will ask you now if you want to add a primary or extended partition, we choose primary by pressing

Command action
   e   extended
   p   primary partition (1-4)
p

and use for the next 2 steps the default options and add as the Last Sector for the first partition the following:

Partition number (1-4, default 1): (default)
Using default value 1
First sector: (Use default)
Using default value
Last sector, ...: +200M

your input should look like that right now:

Fqi-013.png

next we need to make the partition bootable and add then the rest of the partitions:

Command (m for help): a
Partition number (1-4): 1

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 83

Command (m for help): n
Command action 
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4, default 2): (default)
Using default value 2
First sector: (Use default)
Using default value
Last sector, ...: +2G

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 82
Changed system type of partition 2 to 82 (Linux swap / Solaris)

Command (m for help): n
Command action 
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4, default 3): (default)
Using default value 3
First sector: (Use default)
Using default value
Last sector, ...: +20G

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 83

Command (m for help): n
Command action 
   e   extended
   p   primary partition (1-4)
e
Selected partition 4
First sector: (Use default)
Using default value
Last sector, ...: (Use default)
Using default value

Command (m for help): n
First sector: (Use default)
Using default value
Last sector, ...: +10G

Command (m for help): t
Partition number (1-5): 5
Hex code (type L to list codes): 83

Command (m for help): n
First sector: (Use default)
Using default value
Last sector, ...: (Use default)

Command (m for help): t
Partition number (1-6): 6
Hex code (type L to list codes): 83

Command (m for help): p

this will result in the following output

Fqi-014.png

now just write the partition table to your disk by using `w`, this will result in the following output:

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

If that was your scheme, you are now so far to get to the partition formatting section.

encrypted

Command (m for help): n

it will ask you now if you want to add a primary or extended partition, we choose primary by pressing

Command action
   e   extended
   p   primary partition (1-4)
p

and use for the next 2 steps the default options and add as the Last Sector for the first partition the following:

Partition number (1-4, default 2): (default)
Using default value 1
First sector: (Use default)
Using default value
Last sector, ...: +200M

Next we need to make the partition bootable and add then the rest of the partition:

Command (m for help): a
Partition number (1-4): 1

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 83

Command (m for help): n
Command action 
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4, default 2): (default)
Using default value 2
First sector: (Use default)
Using default value
Last sector, ...: (use default)

Command (m for help): p

this will result in the following output

Fqi-015.png

now just write the partition table to your disk by using w, this will result in the following output:

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

next we need to prepare our cryto-container that will keep all the encrypted stuff in it. For that, go to the Cryptocontainer section.

GPT/GUID partition table

This setup is for most users more intuitive, since we don't need to care about extended partitions. We only need to setup an extra partition for our bootloader. So let us do it for unencrypted and encrypted partitions.

For setting up the GPT partition table we use the tool "gdisk", that is the GPT equivalent of fdisk.

Just start it with the following command:

gdisk /dev/sda 

it will greet you with the following screen

Fqi-016.png

unencrypted

Next we will create the partitions for our unencrypted setup:

Command (? for help): n
Partition number (1-128, default 1): (Use default)
First sector (34-..., default = 34) or ...: (Use default)
Information: Moved requested sector from 34 to 2048 in
order to align on 2048-sector boundaries.
Use 'l' on the experts' menu to adjust alignment
Last sector (2048-..., default = ...) or ...: +200M
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): (ENTER)
Changed type of partition to 'Linux/Windows data'

Command (? for help): n
Partion number (2-128, default 2): (Use default)
First sector (...) or ...: (Use default)
Last sector (...) or (...): +512K
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): ef02
Changed type of partition to 'BIOS boot partition'

Command (? for help): n
Partition number (3-128, default 3): (Use default)
First sector (...) or ...: (Use default)
Last sector (...) or (...): +2G
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): 8200
Changed type of partition to 'Linux swap'

Command (? for help): n
Partition number 4-128, default 4): (Use default)
First sector (...) or ...: (Use default)
Last sector (...) or (...): +20G
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): (ENTER)
Changed type of partition to 'Linux/Windows data'

Command (? for help): n
Partition number 5-128, default 5): (Use default)
First sector (...) or ...: (Use default)
Last sector (...) or (...): +10G
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): (ENTER)
Changed type of partition to 'Linux/Windows data'

Command (? for help): n
Partition number 6-128, default 6): (Use default)
First sector (...) or ...: (Use default)
Last sector (...) or (...): (Use default)
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): (ENTER)
Changed type of partition to 'Linux/Windows data'

Command (? for help): p

will now show you a disk partitioning like that one:

Fqi-017.png

now write the table to your disk with w;

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!

Do you want to proceed, possibly destroying your data? (Y/N): Y
OK; writing new GUID partition table (GPT).
The operation has completed successfully.

Now go the section about creating the filesystem on MBR.

encrypted

Next we will create the partitions for our encrypted setup:

Command (? for help): n
Partition number (1-128, default 1): (Use default)
First sector (34-..., default = 34) or ...: (Use default)
Information: Moved requested sector from 34 to 2048 in
order to align on 2048-sector boundaries.
Use 'l' on the experts' menu to adjust alignment
Last sector (2048-..., default = ...) or ...: +200M
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): (ENTER)
Changed type of partition to 'Linux/Windows data'

Command (? for help): n
Partion number (2-128, default 2): (Use default)
First sector (...) or ...: (Use default)
Last sector (...) or (...): +512K
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): ef02
Changed type of partition to 'BIOS boot partition'

Command (? for help): n
Partition number (3-128, default 3): (Use default)
First sector (...) or ...: (Use default)
Last sector (...) or (...): (Use default
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): (ENTER)
Changed type of partition to 'Linux/Windows data'

Command (? for help): p

will now show you a disk partitioning like that one:

Fqi-018.png

now write the table to your disk with w;

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!

Do you want to proceed, possibly destroying your data? (Y/N): Y
OK; writing new GUID partition table (GPT).
The operation has completed successfully.

Now go to the Cryptocontainer setup.

Cryptocontainer

Setting up the cryptocontainer for our encrypted system is in both cases nearly identically, but for the easier showing effect we will give both examples in a seperate subsection.

MBR

First we will prepare the HDD for being encrypted, if you use SystemRescueCd in version 2.0.1 or higher just execute the following commands:

   Note

If you want to see progress of dd than you have to open another terminal and execute: kill -s USR1 `pidof dd`

# dd if=/dev/zero of=/dev/sda2 bs=100M
# dd if=/dev/urandom of=/dev/sda2 bs=100M

This part is optional but for security reason we advise you to do so if you like to have a secure encrypted disk. This part takes a lot of time, let your Computer run and get out to sleep and work, as it might take a day or two depending on your HDD size. :)

You should also be aware that you will get a hint about reaching the end of your HDD. That's intended and desired in this case so that the command can work without knowing your disk-size.

If you ran the above commands you should see an output similar to the one shown in the screenshot:

Fqi-019.png

Next we need to encrypt our HDD, that will be done with the following commands:

# cryptsetup -c aes-xts-plain luksFormat /dev/sda2

WARNING!
========
This will overwrite data on /dev/sda2 irrevocably.

Are you sure (Type uppercase yes): YES
Enter LUKS passphrase: (Your paranoid passphrase)
Verify passphrase: (Your paranoid passphrase again)

Then we need to mount our HDD:

# cryptsetup luksOpen /dev/sda2 dmcrypt_root
Enter passphrase for /dev/sda2: (your paranoid passphrase)

Next we will creat the logical volumes for our setup, so have a look at the subsection about logical volumes.

GPT/GUID

This section is nearly the same as above, so if you read the text in one you will reread the MBR section again only with the GPT enabled stuff.

   Note

If you want to see progress of dd than you have to open another terminal and execute: kill -s USR1 `pidof dd`

First we will prepare the HDD for being encrypted, if you use SystemRescueCd in version 2.0.1 or higher just execute the following commands:

# dd if=/dev/zero of=/dev/sda3 bs=100M
# dd if=/dev/urandom of=/dev/sda3 bs=100M

This part is optional but for security reason we advise you to do so if you like to have a secure encrypted disk. This part takes a lot of time, let your Computer run and get out to sleep and work, as it might take a day or two depending on your HDD size. :)

You should also be aware that you will get a hint about reaching the end of your HDD. That's intended and desired in this case so that the command can work without knowing your disk-size.

If you ran the above commands you should see an output similiar to the one shown in the screenshot:

Fqi-020.png

Next we need to encrypt our HDD, that will be done with the following commands:

# cryptsetup -c aes-xts-plain luksFormat /dev/sda3

WARNING!
========
This will overwrite data on /dev/sda3 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase: (your paranoid passphrase)
Verify passphrase: (your paranoid passphrase again)

Then we need to mount our HDD:

# cryptsetup luksOpen /dev/sda3 dmcrypt_root
Enter passphrase for /dev/sda3: (your paranoid passphrase)

next we will creat the logical volumes for our setup, so have a look at the following subsection.

logical volumes

Feel free to adjust your sizes here, we will follow our given advices above for that. First we need to creat the the physical volume, then the volume group and at last the logical volumes. doing so is really easy, just do the following for if you want to follow our advices above:

# pvcreate /dev/mapper/dmcrypt_root
Physical volume "/dev/mapper/dmcrypt_root" successfully created
# vgcreate vg /dev/mapper/dmcrypt_root
Volume group "vg" successfully created
# lvcreate -L20G -nroot vg
Logical volume "root" created
# lvcreate -L2G -nswap vg
Logical volume "swap" created
# lvcreate -L10G -n portage vg
Logical volume "portage" created
# lvcreate -l 100%FREE -nhome vg
Logical volume "home" created

filesystem creation

Now that we have created our partitioning scheme, we can go on to create the filesystems needed for our partitions. Here differences only occur between the unencrypted setups. Encrypted volumes are handled the same way, no matter whether MBR and GPT, so there is no need to split them up in two seperate parts:

MBR unencrypted

For the unencrypted partions in the MBR setup just use the following regarding to our above given adives, you may feel free to change some parts of it if you like:

# mkfs.ext2 /dev/sda1
# mkswap /dev/sda2
# mkfs.ext4 /dev/sda3
# mkfs.ext4 /dev/sda5
# mkfs.xfs /dev/sda6

That was all for having your filesystem created. now go to the System Setup.

GPT unencrypted

Now let us create the filesystem for our GUID partition table. It is as easy as above, just see the difference in the jump of partition name:

# mkfs.ext2 /dev/sda1
# mkswap /dev/sda3
# mkfs.ext4 /dev/sda4
# mkfs.ext4 /dev/sda5
# mkfs.xfs /dev/sda6

Next step is to mount our partitons, for that go to the System Setup.

MBR/GPT encrypted

If you choose to encrypt your HDD, you will in both cases follow the next steps to setup your filesystems:

# mkfs.ext2 /dev/sda1
# mkswap /dev/mapper/vg-swap
# mkfs.ext4 /dev/mapper/vg-root
# mkfs.ext4 /dev/mapper/vg-portage
# mkfs.xfs /dev/mapper/vg-home

So far we prepared the disk and will now mount our partitions.

System Setup

Mounting filesystem

As we need to have a mountpoint for our system, we now create it with

# install -d /mnt/funtoo
   Note

The in the following used install -d command just creats all the needed folders for later mountpoints for us. If you like you can control it by using ls /mnt/funtoo after the install -d part. Now you are ready to install your base system, read on in Downloading the System.

MBR unencrypted

Now mount your system partitions like that if you used our above advice:

# swapon /dev/sda2
# mount /dev/sda3 /mnt/funtoo
# install -d /mnt/funtoo/{boot,usr/portage,home}
# mount /dev/sda1 /mnt/funtoo/boot
# mount /dev/sda5 /mnt/funtoo/usr/portage
# mount /dev/sda6 /mnt/funtoo/home
   Note

The install -d command just creats all the needed folders for later mountpoints for us. If you like you can control it by using ls /mnt/funtoo after the install -d part. Now you are ready to install your base system, read on in Downloading the System.

GPT unencrypted

That part is really similiar to the unencrypted MBR, but see for yourself:

# swapon /dev/sda3
# mount /dev/sda4 /mnt/funtoo
# install -d /mnt/funtoo/{boot,usr/portage,home}
# mount /dev/sda1 /mnt/funtoo/boot
# mount /dev/sda5 /mnt/funtoo/usr/portage
# mount /dev/sda6 /mnt/funtoo/home

MBR/GPT encrypted

Now mount the system so we can setup the system in the next step.

# swapon /dev/mapper/vg-swap
# mount /dev/mapper/vg-root /mnt/funtoo
# install -d /mnt/funtoo/{boot,usr/portage,home}
# mount /dev/sda1 /mnt/funtoo/boot
# mount /dev/mapper/vg-portage /mnt/funtoo/usr/portage
# mount /dev/mapper/vg-home /mnt/funtoo/home

Downloading the System

The next step is to download the base system and portage tree and set up both. Here a list of packages we have:

Arch (32/64 bit) Processors Stable Release Current Release
64-bit Install Images for PC-compatible processors
64 Generic Intel and Amd 64-bit Processors generic_64 generic_64
64 Intel Core2 Series and most Atom Processors core2_64 core2_64
64 Intel Core i3, i5, i7 N/A corei7
64 AMD Athlon 64 and Opteron Processors (K8 Family or higher) amd64-k8 amd64-k8
32-bit Install Images for PC-compatible processors
32 Intel Core2 Series, i3, i5, i7 and Atom Processors N/A core2_32
32 N/A amd64-k8_32
32 Generic x86 processors (intel80486+) i486 i486
32 Generic P6-class (Pentium Pro/Pentium II compatible) i686 i686
32 Athlon XP and Athlon 64-based CPU (32-bit mode) N/A athlon-xp
32 Intel Pentium 4 Processors N/A pentium4
OpenVZ Templates for PC-Compatible Systems
32 32-bit OpenVZ Images OpenVZ x86-32bit OpenVZ x86-64bit
64 64-bit OpenVZ Images OpenVZ x86-64bit OpenVZ x86-64bit
SPARC processor Images
32/64 Generic SPARC v9 processors (use this one if the ultrasparc I/II stages are inadequate for you) N/A sparc_v9
32/64 UltraSPARC I & UltraSPARC II series (choose this one in doubt) N/A ultrasparc
32/64 UltraSPARC III and UltraSPARC IV series N/A ultrasparc3
32/64 Niagara (UltraSPARC T1) N/A niagara
32/64 Niagara 2 (UltraSPARC T2/ UltraSPARC T2+) N/A niagara2

If you found your desired image above, just change to /mnt/funtoo and download the stage3 and portage-tree images.

# cd /mnt/funtoo
# elinks http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-64bit/generic_64/
Fqi-021.png

this shows you the site presented and by going down with the arrow keys to stage3-latest.tar.xz until it is highlighted you can download it by pressing D. Then move up in the directory structure (..-link) and go to the snapshot directory or quit elinks after downloading finished and start it again with like that

# elinks http://ftp.osuosl.org/pub/funtoo/funtoo-current/snapshots/

here you will now download the portage tree (portage-latest.tar.xz). The Download dialog will look in both cases like that:(Note outdated image, 'stage3-current.tar.xz' is now 'stage3-latest.tar.xz')

Fqi-022.png

When both downloads have finished quit elinks by typing q. The downloaded files should be located in /mnt/funtoo. Now that this is done, let us move on to installing your base system.

Installing the base system

Now that we have the base system and the portage tree downloaded, we will install it. First install the stage3. it is really easy.

# tar xfvpJ stage3-latest.tar.xz

That will output many lines, and return a command-prompt line when finished.

Next we need to extract the funtoo-portage-tree. For that we need to change to the future /usr dir, and extract there the portage.

# cd /mnt/funtoo/usr
# tar xfvpJ ../portage-latest.tar.xz

This time there will be no output, but when the unpacking has finished, the result will be an empty command prompt. We still need to checkout the tree, but this can only be done from inside the chroot environment.

At this state of the setup we have setup most of our system. If you choose to use the fast genkernel method later on, the hardest part is already done. If you choose to manually configure the kernel, you still have quite a bit work ahead of you.

Chrooting

Before we can finally chroot into your system, there are a couple of things that need to be done before, like mounting the proc and dev filesystem.

# mount -t proc none /mnt/funtoo/proc
# mount --bind /dev /mnt/funtoo/dev

to have a working network inside of your chrooted system later you need to copy the resolv.conf file too:

# cp -L /etc/resolv.conf /mnt/funtoo/etc

Now we can chroot into your Funtoo system

# env -i HOME=/root TERM=$TERM SHELL=/bin/bash 
# chroot /mnt/funtoo /bin/bash

Now that we are inside your new system, you'll need to update your environment, use the following commands to do so:

# source /etc/profile
# env-update

We also recommend you to change the default command prompt while you are inside the chroot, as it will avoid confusions if you have to change terminals for anything. To do so use the following command:

# export PS1="(chroot) $PS1"

Congratulations! You are now inside your new Funtoo Linux operating system.

Updating the Portage tree

As we have installed the Portage snapshot during the installation, we now need to "activate" the Portage tree by selecting the funtoo.org branch.

By default, the master branch is enabled, which saves space when storing the tree inside a tarball, but that branch only contains a README with the same instructions as the ones given here.

To activate the funtoo.org branch, do the following:

# cd /usr/portage/
# git checkout funtoo.org

  Checking out files: 100% (85007/85007), done.
  Switched to branch "funtoo.org"

You'll now be able to see thousands of glorious ebuilds inside your Portage tree :)

After activating the funtoo.org branch you need to sync your tree to the newest glorious funtoo ebuilds. Run:

# emerge --sync

This will now update the tree to the current state, which normally changes twice a day.

Setting the default options

Like any other Linux Distribution, Funtoo Linux has it's share of configuration files, that need to be edited by you. The following table gives you an overview of these files and for what they are there:

File Description
/etc/make.conf Parameters used by gcc compiler
/etc/fstab Device to mountpoint definitions
/etc/conf.d/hostname Setting your hostname
/etc/rc.conf OpenRC configuration file.
/etc/conf.d/keymaps Keyboard configuration file.
/etc/conf.d/hwclock System clock to use.
/etc/conf.d/consolefont Fonts to be used in console display. This doesn't affect GUI terminal emulators.
/etc/env.d/99editor Default editor.
/etc/localtime Your timezone.
/etc/make.profile Type of installation (desktop, server...).
/etc/conf.d/modules Kernel modules to load
/etc/locale.gen Localization.
/etc/env.d/02locales Localization for old programs.

If you are installing an english Funtoo, you are lucky, as you won't need to edit many of the files above, if not, don't be afraid, we will walk through the configuration of these files in the following together.

First we will get a mighty editor with great syntax highlighting as it is not provided in our main system we will merge it, if you don't like to please replace in the following edit sections the part vim <path/filename> with your editor <path/filename> where editor is replaced by vi or nano -w.

First let us get vim so we have the perfect highlighting from it for our personal help.

# emerge -avt vim

that will result in an output like that

Fqi-023.png

just accept the output with Enter and it will install vim for you, while you wait for vim to get emerged, here are the some basic usage instructions for ViM. ViM has a multimode interface, if you start it, it is in Command mode, the second mode is the Edit mode which you will enter from the Command mode by pressing i, to go back into the Command mode press ESC. After you have edited a config file, you want to save it, for that you have to be in Command mode and then simple press :w<ENTER>, it will save the file, a closing is done with :q<ENTER>, if you changed content in the file that shouldn't be saved use :q! and for saving and closing the file :wq, thats all, the visual mode is in that context not very useful, so we leave it out. Now that you know the basic usage of ViM and it has emerged we will now start configuring the config files.

/etc/make.conf

First open that file

# vim /etc/make.conf 

This file contains something similar to the following. You may or may not have a CFLAGS variable set already depending on what stage 3 tarball you used:

ACCEPT_KEYWORDS="~amd64"
SYNC="git://github.com/funtoo/portage-mini-2010.git"
CHOST="x86_64-pc-linux-gnu"
   Note

In ACCEPT_KEYWORDS, ~amd64 is used for current 64-bit builds; There is no tilde for the stable build. The default value is (~)x86 for 32 bit. The ACCEPT_KEYWORDS line should not be altered. Keep it as supplied in the default file. It is also important to not change the CHOST line.

CFLAGS

If you're only building packages for your host processor and not any others then the recommended CFLAGS setting is:

CFLAGS="-march=native -O2 -pipe"

Since gcc-4.2, -mtune=native and -march=native will produce code optimized for the host processor. -mtune=native has no effect if GCC does not recognize the processor. More information can be found in the GCC online docs.

   Note

The value native selects the best architecture option for the host processor, so this should not be used if you intend to compile packages for a different CPU.

CXXFLAGS

Normally, this flag is set to the same values as CFLAGS:

CXXFLAGS="${CFLAGS}"
MAKEOPTS

With MAKEOPTS you define how many parallel compilations should occur when you compile a package. A good choice is the number of CPUs (or CPU threads) in your system plus one (Note: this guideline isn't always perfect). If for example you have a dual core processor without hyperthreading, then you would set MAKEOPTS to 3:

MAKEOPTS="-j3" 

If you're unsure of how many processors/threads you have, then use /proc/cpuinfo to help you.

# cat /proc/cpuinfo  | grep "model name" | wc -l
16

Set MAKEOPTS to this number plus one:

MAKEOPTS="-j17"
USE

USE flags define what functionality is enabled when ebuilds are built. It is not recommended to add a lot of them during installation. You should wait until you have a working, bootable system to do so. The following USE flags are a recommended starting point for new systems:

USE="-gnome -gtk -kde -kdeenablefinal -ldap nls -qt3 -qt3support -qt4 userlocales"

The minus(-) sign tells gcc not to use the flag when compiling. USE flags gnome, gtk, kde, qt3, qt3support, and qt4 will be set later if you install a desktop envrionment.

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.

GENTOO_MIRRORS

This is the mirror from which emerge gets a lot of the source files. It is usually not necessary to set this flag. In the following ewxample, the Waterloo University is used (a fast and reliable Canadian mirror). Please set this variable to a mirror local to your country.

GENTOO_MIRRORS="ftp://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ http://distfiles.gentoo.org"
LINGUAS

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. Otherwise, if you want another language, replace fr (French) for the code of your mother language, e.g. de for German.

LINGUAS="fr"

or for multiple language support you might also use:

LINGUAS="en de fr"
/etc/make.conf example

An example of a /etc/make.conf file could look like that:

# These settings were set by the metro build script that automatically built this stage.
# Please consult /etc/make.conf.example for a more detailed example.

ACCEPT_KEYWORDS="x86"
FEATURES="mini-manifest"
SYNC="git://github.com/funtoo/portage-mini-2010.git"
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=i686 -O2 -pipe"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j2"
USE="-gnome -gtk -kde -kdeenablefinal -ldap nls -qt3 -qt3support -qt4 userlocales"
GENTOO_MIRRORS="ftp://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ http://distfiles.gentoo.org"
LINGUAS="fr"
INPUT_DEVICES="evdev synaptics"
VIDEO_CARDS="vesa radeon"
PORT_LOGDIR="/var/log/portage"
PORTAGE_ELOG_CLASSES="log warn error info"
PORTAGE_ELOG_SYSTEM="echo:log,warn save:log,warn,error,info syslog:error"
/etc/fstab

This file is used for the configuration of the mountpoints for the system. As we have two different setups described above, here are the two examples for these.

# vim /etc/fstab
unencrypted MBR
# 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/sda5       /usr/portage    ext4    noatime             0 1
/dev/sda6       /home           xfs     defaults,noatime    0 1
#/dev/cdrom     /mnt/cdrom      auto    noauto,ro           0 0
none            /dev/shm        tmpfs   nodev,nosuid,noexec 0 0
unencrypted GPT
# 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/sda3       none            swap    sw                  0 0
/dev/sda4       /               ext4    noatime             0 1
/dev/sda5       /usr/portage    ext4    noatime             0 1
/dev/sda6       /home           xfs     defaults,noatime    0 1
#/dev/cdrom     /mnt/cdrom      auto    noauto,ro           0 0
none            /dev/shm        tmpfs   nodev,nosuid,noexec 0 0
encrypted

That time the setup is the same for both MBR and GPT partition layout:

# 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/mapper/vg-swap     none            swap    sw                  0 0
/dev/mapper/vg-root     /               ext4    noatime             0 1
/dev/mapper/vg-portage  /usr/portage    ext4    noatime             0 1
/dev/mapper/vg-home     /home           xfs     defaults,noatime    0 1
#/dev/cdrom             /mnt/cdrom      auto    noauto,ro           0 0
none                    /dev/shm        tmpfs   nodev,nosuid,noexec 0 0
/etc/conf.d/hostname

Here you will set up your hostname for the PC. So choose a name for your PC and set it up in that file:

# vim /etc/conf.d/hostname

# Set to the hostname of this machine
hostname="<your-hostname>"
/etc/rc.conf

You may use this file as-is. However, it is a good idea to set rc_logger to yes. That will create a log file which is handy when problems are encountered with OpenRC scripts. Very helpful for fixing things.

Another good option here is the rc_interactive flag, if you are playing around with a new graphical display manager or aren't that used with the upgrade procedure of the graphical environement. if rc_interactive is set to yes, you will be able to interactively manipulate the boot process, what means you can decide what you want to start or not, like the graphical environment for example.

Other options have really good explainations inside of the /etc/rc.conf file.

/etc/conf.d/keymaps

You do not have to alter that file if you have a US English keyboard. Otherwise, edit file and set keymap to your keyboard model. For example, cf for French Canadian keyboard, fr for French Azerty and de for German Qwertz.

/etc/conf.d/hwclock

If you dual boot with Windows, you'll need to edit this file and change clock to local. Otherwise you should not normally need to edit this file.

You should define your timezone in /etc/timezone:

# vim /etc/timezone
Europe/Berlin

anoteher value might be

America/Denver

so you might get an idea how it should look like, if not have a look at /usr/share/zoneinfo it will give you the entry after the path like /usr/share/zoneinfo/<Content of /etc/timezone> like for Germany you will find a path in there that looks like /usr/share/zoneinfo/Europe/Berlin.

/etc/conf.d/consolefont

There is nothing to edit in that file.

/etc/env.d/99editor

Create and edit that file to instruct your system about the default editor it should use.

vim /etc/env.d/99editor

Type in :

EDITOR="/usr/bin/vim"

Replace the above line with the editor of your choice, if you had been happy so far with ViM just paste it in as is, if not use nano, vi or what else you like.

/etc/localtime

If you came here from Gentoo, it was advised to copy the file from the zoneinfo dir to here. We advise you to create a symbolic link from the zoneinfo dir to /etc/localtime. As in the hwclock section above, we need your timezone parted in LAND/TOWN like for Germany Europe/Berlin. Now, create the symbolic link. More info about it can be found in the /usr/share/zoneinfo dir.

ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime

That command sets the timezone to Central European Time.

/etc/make.profile

Here you select which type of environment you want the gcc-compiler to take into account. That will dress up an environment with a list of pre-defined USE flags.

To list all available profiles run:

eselect profile list

The output will look like that:

[1]   default/linux/x86/2008.0 *
[2]   default/linux/x86/2008.0/desktop
[3]   default/linux/x86/2008.0/developer
[4]   default/linux/x86/2008.0/server

Profile defaults to 2008.0 (See the star). To create a profile for DE (Desktop Environment) run:

eselect profile set 2
   Warning

Funtoo only supports the 2008.0 profile and the 2008.0 profile children. Use one of these profiles until 'funtoo-1.0' is ready.

/etc/conf.d/modules

With Funtoo, OpenRC loads modules from /etc/conf.d/modules using the line:

modules_2_6="list of modules"

With Funtoo, define module arguments as follows:

module_module-name_args_2_6="module arg=value"
Localization

/etc/locale.gen and /etc/env.d/02locales are used to support your local language. The last one is required just in case there still are old programs installed.

You do not need to amend anything if your locales are US English. The following are examples for German. You can look in /usr/share/i18n/SUPPORTED for the default list of supported combinations or look in /usr/share/i18n/locales to determine values to use.

# vim /etc/locale.gen 

Put this value into the file for German support:

de_DE.UTF-8 UTF-8

for a multiple language support it might look like that:

de_DE.UTF-8 UTF-8
fr_CA.UTF-8 UTF-8
en_US.UTF-8 UTF-8

Edit /etc/env.d/02locales according to that layout:

# vim /etc/env.d/02locales

and put in these lines:

LANG="de_DE.UTF-8"
LANGUAGE="de_DE.UTF-8"

Finally after we editet all the localization files generate the localized environment:

locale-gen && source /etc/profile 

Kernel

Now that you have the base system running, you need to install a kernel. If you decided to use a standard setup with an unencrypted GPT disc layout or the old unencrypted MBR disc layout, a fast solution would be to use the genkernel solution. If you used the standard setup with an encrypted GPT disc layout or the old encrypted MBR disc layout, you have to use the manual kernel steps.

choosing a kernel

First, you need to choose a kernel version you would like to install on your system. The following table will give you an overview of which kernels are available and who should use them.

Kernel ebuild Description masked Prefered Users eselect kernel set
sys-kernel/* generates symlink
cell-sources Full sources including the cell/ps3 patchset for the 2.6 kernel tree [ Masked ] unsure
ck-sources Con Kolivas' high performance patchset + Gentoo patchset sources unsure
debian-sources Debian Sources - with optional OpenVZ support NO
gentoo-sources Full sources including the Gentoo patchset for the 2.6 kernel tree default for most users YES
git-sources The very latest -git version of the Linux kernel for the versed user YES
hardened-sources Hardened kernel sources (kernel series 2.6) not supported atm YES
mips-sources Linux-Mips GIT sources for MIPS-based machines, dated 20110207 [ Masked ] unsure
mm-sources Andrew Morton's kernel, mostly fixes for 2.6 vanilla, some vm stuff too unsure
openvz-sources Full sources including OpenVZ patchset for the 2.6.18 kernel tree For users that want to build a OpenVZ server unsure
pf-sources Linux kernel fork with new features, including the -ck patchset (BFS), BFQ, TuxOnIce and LinuxIMQ unsure
rhel5-openvz-binaries RHEL5 kernel with OpenVZ patchset - initrd and bzImage YES
rhel5-openvz-sources Full Linux kernel sources - RHEL5 kernel with OpenVZ patchset unsure
rhel6-openvz-binaries RHEL6 kernel with OpenVZ patchset - initrd and bzImage unsure
rhel6-openvz-sources Full Linux kernel sources - RHEL5 kernel with OpenVZ patchset unsure
sparc-sources Full sources for the Gentoo Sparc Linux kernel [ Masked ] YES
sysrescue-std-binaries System Rescue CD Full sources for the Linux kernel, including gentoo and sysresccd patches - initrd and bzImage [ Masked ] unsure
sysrescue-std-sources System Rescue CD Full sources for the Linux kernel, including gentoo and sysresccd patches. unsure
tuxonice-sources TuxOnIce + Gentoo patchset sources unsure
usermode-sources Full sources for the User Mode Linux kernel [ Masked ] unsure
vanilla-sources Full sources for the Linux kernel YES
vserver-sources Full sources including Gentoo and Linux-VServer patchsets for the 2.6 kernel tree. unsure
xbox-sources Full sources for the Xbox Linux kernel [ Masked ] unsure
xen-sources Full sources for a dom0/domU Linux kernel to run under Xen unsure
zen-sources The Zen Kernel Sources v2.6 unsure

For the next section, we will assume that you selected gentoo-sources for your kernel setup. If not, please replace gentoo-sources in the next section with your selection. If you are unsure, please follow our suggestion to use the gentoo-sources.

genkernel

That part would be fast done in general, we will now guide you through that process. First, we need to install the needed tools for it. So, let's do it!

# emerge -avt genkernel gentoo-sources
Calculating dependencies... done!

These are the packages that would be merged, in reverse order:

[ebuild  N    ] sys-kernel/gentoo-sources-2.6.38-r4  USE="-build -deblob -symlink" 134 kB
[ebuild  N    ] sys-kernel/genkernel-3.4.12.6-r2  USE="-bash-completion (-ibm) (-selinux)" 11,556 kB

Total: 2 packages (2 new), Size of downloads: 11,690 kB

Would you like to merge these packages? [Yes/No] 

After answering the above question with "Yes", it will download and install the packages for you. Next, you need to set the symlink from /usr/src/linux to the /usr/src/linux-version directory. There are two ways to do so. If you have selected a version that is supported by eselect, it would be really simple for you, just do:

# eselect kernel list
# eselect kernel set 1

The first command should list the kernel you have selected. If that isn't the case, the second command to set this kernel version isn't needed, else the second one sets the symlink automatically for you. As eselect kernel command will scan your /usr/src directory, it should list every kernel-sources listed above, if that isn't the case, please report the failing to the funtoo-dev mailing list, Funtoo Forums or contact us directly in IRC at #funtoo. As a workaround you could use the following steps to make your kernel-sources usable:

# cd /usr/src
# rm linux
# ls
linux-sources
# ln -s linux-sources linux

where linux-sources is the directory that the ls command above showed you.

When you finished the selection of your kernel you will now bake your first kernel, using the genkernel or fast way. Execute for that the following command:

# genkernel --menuconfig all

if you have a special config predefined use

# genkernel --kernel-config=config-name --menuconfig all

else if you have choosen an encrypted setup, use the following command to include all the tools you need for bootup:

# genkernel --lvm --luks --menuconfig all

the above used options are doing the following:

  • --kernel-config: use the given name located in the kernel source tree (/usr/src/linux by default is taken unless overridden by --kerndir)
  • all: rebuild the kernel image and the initramfs ramdisk image (aside of kernel modules, the ramdisk image contains tools such as BusyBox and some generic startup scripts, depending on options you use on the command line several additional tools like lvm or raid volume management can be incorporated as well).
  • --lvm: Includes support for storage using via Logical Volume Management (LVM2) from static binaries, if available to the system. Relevant (static) LVM2 binaries are compiled if they are unavailable. Be sure to install the lvm2 package on your system with emerge lvm2 before enabling this flag.
  • --luks: Includes support for Linux Unified Key Setup or LUKS. This will allow you to use a device encrypted by LUKS which contains the root filesystem. On the bootloader, you then set that encrypted device as the value of crypt_root (and real_root shall be the unencrypted device LUKS creates).
  • --menuconfig: lets you set options for kernel compile manual

The --menuoption will present you the following screen:

Fqi-024.png
default options for unencrypted/encrypted setup

We advised you above to use a partitioning scheme based on the following file system types:

  • ext2
  • swap
  • ext4
  • xfs

You now need to activate all of them so you can boot your system later, these options can be found at:

Under File systems:

<*>   Second extended fs support
<*>   The Extended 4 (ext4) filesystem
[*]      Ext4 extended attributes (NEW)
[ ]         Ext4 POSIX Access Control Lists (NEW)
[ ]         Ext4 Security Labels (NEW)
[ ]         EXT4 debugging support (NEW)
<*>   XFS filesystem support
[ ]         XFS Quota support (NEW)
[ ]         XFS POSIX ACL support (NEW)
[*]         XFS Realtime subvolume support
[ ]         XFS Debugging support (EXPERIMENTAL) (NEW)

If you furthermore decided to follow our advice and to use a GPT-Partitioning scheme, which will be your default, you will need to activate it in your kernel by using the following options:

Under File systems-->Partition Types:

[*]   Advanced Partition Selection (PARTITION_ADVANCED)
[*]   EFI GUID Partition Support (EFI_PARTITION)
additional encrypted options

It is very important to add the following parts in your kernel setup, when you used the above GPT or MBR encrypted setup. Under Under General setup:

[*]   Initial RAM filesystem and RAM disk (initramfs/initrd) support

and Under Device Drivers:

[*] Multiple devices driver support
<*>   Device Mapper Support
<*>      Crypt target support

and finally Under Cryptographic API:

<*>   XTS support (EXPERIMENTAL)

-*-   AES cipher algorithms

Finally exit the menuconfig for your kernel and get a coffee. You have done a good bit of work so far... :)

manual kernel

You can use genkernel to automatically compile your kernel, but this tends to create a bloated kernel, compatible with just about any computer, anyplace, any time. On the other hand, you can manually configure and compile your kernel, to give you complete control, for the smallest and fastest kernel(s) that you can build for your specific computer. However, manual kernel configuration is often called by many users, the hardest step in installing Funtoo. But it is also very worth learning how to do it. Be warned that it make take several reconfigurations, compiles and reboots, until you have a working system. Plus, for the encrypted hdd version, you will have to do a bit more work than above, but if you have gotten this far, you should be able to handle it.

install and config

First you will have to install the kernel image you selected above. In the following we again use the kernel we think might be the default choice of you, gentoo-sources, but you can feel free to replace it with any of the above ones. So now install your kernel-sources:

# emerge -avt gentoo-sources

After answering the above question with Yes, emerge will download and install the kernel-sources for you. Next you need to set the symlink from /usr/src/linux to the /usr/src/linux-version directory. There are two ways to do so, the default way would be to use the following command sequence:

# eselect kernel list
# eselect kernel set 1

The first command will list the kernel or kernels for which you have used emerge to install the corresponding source code packages. The character * is used to indicate the currently selected default kernel package. In other words, the command eselect kernel list will scan and list directories in your /usr/src directory , each named after a different kernel source code. It will then show with a * the directory currently pointed to by the /usr/src/linux link. The second command is not needed, as long as the correct kernel source has been selected. Otherwise, use this command and the number of the corresponding kernel directory, to set your /usr/src/linux link.

If the eselect kernel command does not work correctly, please report the failing to the funtoo-dev mailing list, Funtoo Forums or contact us directly in IRC at #funtoo.

As a workaround or for educational purposes, you could use the following equivalent commands. For example, to make gentoo-sources available for compiling your kernel, enter:

# cd /usr/src
# rm linux
# ls
gentoo-sources-3.5.4
# ln -s gentoo-sources-3.5.4 linux

where gentoo-sources is the directory that the ls command above showed you.

Now you are nearly ready to configure your kernel. First switch to a second terminal with Alt+F2 and execute lspci and copy the output, most importantly the names of the VGA, Ethernet and Network devices currently in your system. Knowing these device names will be needed if you need help for default options at the Debian GNU/Linux device driver check page. Some options there aren't in your kernel or may have other names but it is a good source for getting default options help for devices.

Fqi-025.png

Now move back to your chrooted system (Alt+F1) and start the configure process with

# cd /usr/src/linux
# make menuconfig

This will present you a screen similar to the following:

Fqi-024.png

start setting the options you know about or the ones the page above gave you. You need to at least set the following options:

Here are some more sources you may like to read for configuring your kernel the old fashioned manual way:

default options for unencrypted/encrypted setup

We advised above to use a partitioning scheme based on the following filesystemtypes:

  • ext2
  • swap
  • ext4
  • xfs

You now need to activate all of them so you can boot your system later, these options can be fount at:



If you furthermore decided to follow our advice and use a GPT-Partitioning scheme, what will be our default, you need to activate it in your kernel by using the following options:



additional encrypted options

It is very important to add the following parts in your kernel setup, when you used the above GPT or MBR encrypted setup. Under


and under


and finaly under


building the kernel the manual way

Now that all the options are set exit menuconfig and answer the question about saving your config with YES. That already was the hardest part, now bake your kernel.

# make
# make modules_install
# cp arch/<architecture>/boot/bzImage /boot/bzImage-<versionnumber>

This code-sequence will need to be explained, the first command make will bake your kernel, it will take some time, so feel free to get a coffee. :) if you don't have one available here is one from us |_|). make modules_install generates the modules for the kernel and builds them, the third command in the sequence needs to be adjusted by you, if you use a 32bit system replace <architecture> with x86 and for 64bit systems with x86_64, finally replace the <versionnumber>-string with a for you readable and unique versionnumber like 2.6.38-rc7-mykernel-v1 or something like that, then the command copies over your baked kernel to /boot and you are ready to get to the next step....

Bootloader

boot-update

boot-update is the default boot-loader configuration tool in funtoo. You need to install it with

# emerge -avt boot-update

This will install boot-update and grub2 for you. Next you need to configure it. That is done in /etc/boot.conf:

# vim /etc/boot.conf

/etc/boot.conf will look somewhat like the following:

boot {
	generate grub
	default "Funtoo Linux 64-bit" 
	timeout 10 
}

display {
	gfxmode 1440x900
	#background /boot/
}

color {
	normal cyan/black
	highlight black/cyan
}

default {
	scan /boot
	kernel bzImage[-v] kernel[-v] vmlinuz[-v]
	initrd initramfs[-v]

	# root=auto will cause the parameter 
	# from your /etc/fstab. rootfstype=

	params video=vesafb root=auto rootfstype=auto

	# an alternate graphics mode can be set
	# default is inherited from display:

	# gfxmode 1024x768
}

"altboot" {
	params += init=/bin/bash
}

"Funtoo Linux 64-bit gpt" {
        kernel bzImage[-v]
}

"Funtoo Linux genkernel" {
        kernel kernel[-v]
        initrd initramfs[-v]
        params += real_root=auto
}

"Funtoo Linux 64-bit encrypted gpt/mbr manual kernel" {
	kernel bzImage[-v]
	initrd /initramfs.cpio.gz
	params += enc_root=/dev/sda3 lvm luks root=/dev/mapper/vg-root rootfstype=ext4 resume=swap:/dev/mapper/vg-swap quiet
}

If you decided to do a manual kernel, with an encrypted HDD, you will need to read the next section after you made the changes to your config. If you decided to use genkernel or a manual kernel with unencrypted HDD, all is OK and it is now safe for you to go to the Grub2 setup.

encrypted disk with manual kernel

As you decided to make an encrypted disk setup with a manual kernel, you need to instal slashbeast's better-initrmafs. It is very simple to do. First clone the git-repository. If you aren't confident with git, feel free to have a look at our Git Guide.

# install -d /root/.git
# cd /root/.git
# git clone git://github.com/slashbeast/better-initramfs.git
# cd better-initramfs
# git checkout v0.3
# less README.rst
# echo "sys-apps/busybox static" >> /etc/portage/package.use/busybox && echo "sys-fs/cryptsetup static" >> /etc/portage/package.use/cryptsetup && echo "sys-fs/lvm2 static" >> /etc/portage/package.use/lvm2
# emerge -avt busybox cryptsetup lvm2
# make
>>> New better-initramfs is not backward compatible, read ChangeLog file.

>>> Preparing binary files...
>>> Adding /bin/busybox...
>>> Adding /sbin/cryptsetup...
>>> Adding /sbin/lvm.static...
>>> Building image...
>>> initramfs.cpio.gz is ready.
# cp initramfs.cpio.gz /boot

Now you are ready to setup grub2. Just go to the next section.

= Updating better-initramfs =

As the better-initrmafs project isn't controlled at the moment by an ebuild, you will need to take care of updating it by yourself, but it is very easy to do so:

# git checkout master
# git pull
# less ChangeLog
# git checkout vx.x
# make

where x.x is a version announced in the ChangeLog. At the moment the stable is 0.3.

setting up grub2

This step is easy. It is done with two commands;

# grub-install --no-floppy /dev/sda
# boot-update

A successful run of boot-update might will look like this:

 boot-update 1.5.2 / Copyright 2009-2011 Funtoo Technologies

 [use option "-l" for license info, "-h" for help]

 * Generating config for grub...

 DEFAULT > Funtoo Linux 64-bit - bzImage-2.6.39-rc7-git-a2b9c1f
           Funtoo Linux 64-bit - bzImage-2.6.39-rc7-git-446cc63
           Funtoo Linux 64-bit - bzImage-2.6.39-rc7-git-df8d06a

 * WARN : multiple matches found for default "Funtoo Linux 64-bit" - most recent used.
 * Completed successfully with warnings.
Extlinux

For Extlinux you will find a guide for setup at Extlinux.

finalize Setup

Necessary System Tools

As some tools are providing the same functionality, it is up to you to choose which ones you like to use. The next sections are giving you an overview of tools you might like to use and install, but all are optional.

System Logger

Linux and Unix have an excellent history of logging capabilities, if you want you can log from only special stuff up to everything that happens on your system in logfiles, for that behavior is a system logger the reason.

There are several in our repository from which you can choose:

  • sysklogd, which is a traditional set of system logging daemons,
  • syslog-ng, which is an advanced system logger and
  • metalog, which is a highly-configurable system logger,
  • rsyslog, seems to be a popular choice, default syslog of Fedora, RHEL, openSUSE, Debian and Ubuntu
  • there might be others available too, but at the moment we aren't aware of them.

We advice you to install next to sysklogd or syslog-ng the logrotate tool, as those system loggers don't provide a rotation machanism for the log files.

Just install the desired one like the example shows:

# emerge syslog-ng
# rc-update add syslog-ng default

Optional: Cron Daemon

Although this is optional it is in our opinion very handy and wise to install one. But you might ask yourself now "What the hell is a cron daemon?" A cron daemon just executes scheduled commands, so you see it can be very handy if you need to execute commands regularly.

In our tree there are three possible cron daemons; dcron, fcron and vixie-cron. We would like to advise you to use fcron, but it depends on what you like. also vixie-cron might be easier, as you don't need to execute crontab /etc/crontab, fcron might be more powerful.

# emerge fcron
# rc-update add fcron default
# crontab /etc/crontab

Optional: File Indexing

If you like to index your files for a fast search, you need to install mlocate so you can use the locate command to quickly search for them:

# emerge mlocate
# updatedb

File System Tools ==

As we used some special filesystems above you need to at least install xfsprogs, but there might be some others too, the following table gives you an overview:

File System Tool install command needed
XFS xfsprogs emerge xfsprogs X
JFS jfsprogs emerge jfsprogs
reiserfs reiserfsprogs emerge reiserfsprogs
btrfs btrfs-progs emerge btrfs-progs

Networkconfig

The Easy (Dynamic) Way

When configuring your network, one option is to skip traditional network configuration and simply rely on DHCP. This is by far the simplest method of configuring your network. If you are on a wired network, no other steps are typically required beyond enabling a DHCP client, and Funtoo Linux includes dhcpcd 5.x by default. To enable DHCP at system startup, you would add dhcpcd to your default runlevel as follows:

# rc-update add dhcpcd default
   Note

If your going to use a third party package such as Network Manager or Wicd to manage your network then do not add dhcpcd to any runlevel. These packages handle DHCP for you.

The Modular Way

DHCP isn't always an option, and for these situations, Funtoo Linux offers its own modular, template-based network configuration system. This system offers a lot of flexibility for configuring network interfaces, essentially serving as a "network interface construction kit." This system can be used by itself, or even combined with dhcpcd -- if you limit dhcpcd to only manage certain network interfaces.

Here are the key components of the template-based network configuration system:

  1. /etc/init.d/netif.lo -- An init script that configures the localhost interface.

  2. /etc/netif.d -- This is a directory that contains various network configuration templates. Each of these templates is focused on configuring a particular type of network interface, such as a general static IP-based interface, a bridge interface, a bond interface, etc.

  3. /etc/init.d/netif.tmpl -- This is the master init script for the template-based network configuration system. New interfaces are added to your system by creating symbolic links to this file in /etc/init.d.

So, if you wanted to use this system to configure eth0 with a static IP address, you would create a netif.eth0 symlink to netif.tmpl as follows:

# cd /etc/init.d
# ln -s netif.tmpl netif.eth0

Then, you would create an /etc/conf.d/netif.eth0 configuration file that would specify which template to use from the /etc/netif.d directory:

template="interface"
ipaddr="10.0.1.200/24"
gateway="10.0.1.1"
nameservers="10.0.1.1 10.0.1.2"
domain="funtoo.org"

To complete our static IP network configuration we would need to:

# rc-update add netif.eth0 default

When configuring your own static network interface, one of ipaddr or ipaddrs is required and should specify the IP address(es) to configure for this interface, in "a.b.c.d/netmask" format. Optional parameters include gateway, which defines a default gateway for your entire network, and if set should specify the gateway's IP address. In addition, domain and nameservers (space-separated if more than one) can be used to specify DNS information for this interface.

Configuration Variables
Interface Variables

The following variables are supported by the interface and bridge templates:

  • ipaddr or ipaddrs: specify IPv4 or IPv6 address(es) for the interface. IP addresses should be specified in "IP/netmask" format, such as "10.0.0.1/24". Multiple IP addresses can be specified like this:
ipaddrs="10.0.0.1/24 10.0.0.2/24"

Note that in some cases, you may choose to not specify ipaddr or ipaddrs for a bridge template. That is allowed. If you don't want to specify an IP address for a regular interface, you can choose to use the interface template without an IP address specified in the config, or use the interface-noip template instead, for the sake of clarity.

Also note that if you specify multiple IP addresses, ifconfig will only show the first IP address. To view all IP addresses associated with the interface, use the ip addr show command.

General Variables

The following variables are enabled by default for all network scripts, and if specified will trigger a corresponding configuration action: nameservers: Set DNS nameservers using OpenResolv. Specify multiple nameservers like this: "1.2.3.4 1.2.3.5 1.2.3.6"

  • domain: Set DNS domain using OpenResolv.
  • gateway: Define a default IP gateway.
  • route: Specify a semi-colon delimited list of routes to apply when this interface is brought up. Will be appended to ip route add.
  • mtu: Set Maximum Transmit Unit for the interface
  • slaves: Set slave interfaces of this interface (for bridges, etc.) All slaves will automatically be depended upon, and will also automatically have their mtu set to that of the current interface, if an mtu is specified for the current interface. This setting is required for the bond template and optional for the bridge template.

VLAN Variables

VLAN support is enabled by default for all network configuration scripts. If a network script has a name in the format netif.ethX.Y, then it is assumed to be a VLAN interface referencing trunk ethX and VLAN ID Y. If you desire a custom name for your VLAN interface, you can name your interface whatever you'd like and specify the following variables in your interface config [file: file:]

  • trunk: VLAN trunk interface, e.g. "eth0"
  • vlan: VLAN id, e.g. "32"

OpenResolv and resolv.conf

For the network configuration above, OpenResolv will be used to set DNS information when the netif.eth0 is brought up. The OpenResolv framework will add entries to /etc/resolv.conf, and will also handle removing these entries when the interface is brought down. This way, /etc/resolv.conf should always contain current information and should not need to be manually edited by the system administrator. dhcpcd will use OpenResolv for updating system DNS information as well.

Network-Dependent Services

One important difference between Gentoo Linux and Funtoo Linux is that, in Funtoo Linux, network-dependent services only strictly depend on netif.lo. This means that if another network service requires an interface to be up, such as samba requiring eth0, then the system administrator must specify this relationship by adding the following line to /etc/conf.d/samba:

rc_need="netif.eth0"

This will have the effect of ensuring that netif.eth0 is started prior to samba and that samba is stopped prior to stopping netif.eth0.

Many network services, especially those that listen on all network intefaces, don't need an rc_need line in order to function properly. Avoiding the use of rc_need when required will optimize boot times and allow more network services to remain available when network interfaces are brought up and down by the system administrator.


Multiple Network Configurations

For information on how to have multiple, independent network configurations, please see Stacked Runlevels.

Alternate Configs

If you need to run the same service with different configuration parameters depending upon runlevel, then you'll be happy to know that you can specify runlevel-specific conf.d files by appending a . <runlevel> suffix. In this particular example, we could imagine a situation where we had two child runlevels named home and work:

/etc/conf.d/netif.eth0.home
/etc/conf.d/netif.eth0.work

Note that this feature works for all init scripts, not just network configuration scripts.

Interface Renaming

Funtoo network scripts now support interface renaming, so you can create an interface called lan if you would like. To so this, simply specify the MAC address of the interface you would like to rename using the macaddr variable: macaddr="00:15:17:19:b6:a3" If this MAC address is part of the netif.lan configuration file, then when this interface starts, whatever interface currently has the MAC address of 00:15:17:19:b6:a3 (i.e. eth5) will be renamed to lan prior to the interface being brought up, and will show up in ifconfig and ip commands as being an interface named lan.

Basic VLAN Configuration

The standard interface template supports VLANs. To use VLAN support, first configure the trunk interface using the interface-noip template. Assuming eth1 is trunked, you would create the file /etc/conf.d/netif.eth1 with the following contents:

template="interface-noip"

Then, create a network interface symlink for the trunk and add it to your default runlevel:

# cd /etc/init.d
# ln -s netif.tmpl netif.eth1
# rc-update add netif.eth1 default

Now, assuming you wanted to configure a VLAN of 32, you would create a config file named /etc/conf.d/netif.eth1.32 that looks something like this:

template="interface"
ipaddr="1.2.3.4/24"
gateway="1.2.3.1"# etc...

Then, create a VLAN network interface symlink and add it to your default runlevel:

# cd /etc/init.d
# ln -s netif.tmpl netif.eth1.32# rc-update add netif.eth1.32 default

The Funtoo network configuration scripts will automatically recognize the filename netif.eth1.32 as being VLAN 32 of trunk interface netif.eth1.

When the VLAN interface is brought up, it will be named eth1.32.

Custom VLAN Names

However, sometimes you may want to turn off automatic file-based VLAN naming and give your VLAN interface a custom name, such as mgmt. To do this, you would set up the trunk interface in the exact same way as described above, but instead of creating a netif.eth1.32 interface, you would create a netif.mgmt interface, and specify vlan and trunk in the /etc/conf.d/netif.mgmt config file, as follows:

template="interface"
vlan="32"
trunk="eth1"
ipaddr="1.2.3.4/24"
gateway="1.2.3.1"
# etc...

When you specify trunk and vlan in the interface config file, filename-based auto-detecting of VLAN ID and trunk is disabled. Both trunk and vlan must be specified -- you can't specify just one.

Then you would simply create a VLAN network interface symlink for netif.mgmt:

# cd /etc/init.d
# ln -s netif.tmpl netif.mgmt
# rc-update add netif.mgmt default

When the VLAN interface is brought up, it will be named mgmt.

More Complex Network Configuration

If the standard templates don't work for your needs, simply create a new template -- I recommend starting from the interface template for most things:

# cd /etc/netif.d
# cp interface custom

You can now call whatever commands you need to /etc/netif.d/custom. The following shell functions can be defined in a network script:

netif_create

In netif_create, you should call any commands to create the interface if it does not yet exist.

netif_depend

In netif_depend, you can define dependencies, using the functions need and use.

netif_pre_up

In netif_pre_up, you can define network configuration actions to perform prior to bringing the interface up. You can also ensure certain variables are specified by calling require var1 [var2...] here.

netif_post_up

In netif_post_up, you can define network configuration actions to perform after bringing the interface up.

netif_pre_down

In netif_pre_down, you can define network configuration actions to perform prior to bringing the interface down.

netif_post_down

In netif_post_down, you can define network configuration actions to perform after bringing the interface down.

netif_destroy

In netif_destroy, you can call any commands necessary to destroy/delete the interface if it is dynamic in nature (tun/tap, etc.)

How It Works

You do not specify a function for actually bringing up the interface, because the template-based system does this for you. The template-based system also performs all normal actions for required for bringing an interface down, so only need to specify atypical actions that must be performed - such as removing child interfaces or destroying a bridge using brctl.

When you create your own network configuration template, the following capabilities are available for use automatically, as long as the appropriate variables are set in the /etc/conf.d/netif.<ifname> file,, without requiring any explicit steps on your part:

  • DNS configuration using domain and nameservers config settings. OpenResolv is used automatically.
  • VLAN configuration using auto-naming (netif.ethX.Y) or via custom naming with trunk and vlan config settings.
  • Default gateway and route configuration using the gateway and route settings.
  • MTU configuration using the mtu setting.
  • Auto-depend (and auto-MTU configuration) of slave interfaces specified using slaves setting.
  • Renaming of existing network interface (specify MAC address using macaddr setting).

To take advantage of this functionality, simply enable the appropriate variables.

All other necessary network configuration and dependency behavior should be defined using the netif_-prefix functions described above.

Wireless Configuration

Wireless network configuration requires additional steps to the ones outlined above.

For wireless networks, you will need to enable wireless extensions in your kernel, the appropriate wireless modules, and emerge wireless-tools:

# emerge wireless-tools

I also recommend you emerge wpa_supplicant. wpa_supplicant implements modern WPA/WPA2 wireless link-layer encryption, which is necessary for connecting to most modern password-protected wireless networks:

# emerge wpa_supplicant

After emerging, add to your default runlevel as follows:

# rc-update add wpa_supplicant default

802.11 Passphrases

The only remaining step is to use the wpa_passphrase utility to store hashed keys (passwords) that wpa_supplicant can use to connect to your favorite wireless networks. This is done as follows:

# wpa_passphrase jims-netgear >> /etc/wpa_supplicant/wpa_supplicant.conf
<enter your passphrase>

Now, when wpa_supplicant encounters an SSID of jims-netgear, it will use the password you entered to authenticate with this access point.

At this point, ensure that dhcpcd has been enabled in your current runlevel and type rc to start everything up. wpa_supplicant should be able to automatically associate with SSIDs in its config file, at which point dhcpcd will take over and acquire an IP address from a DHCP server. This should all happen seamlessly. Use the iwconfig command to see if you have successfully associated with an access point.


Wireless Firmware

Many wireless adapters will now have everything they need to work. However, if you have an Intel wireless adapter, then you may need to install the proper microcode for your device in addition to ensuring that the proper Intel Wireless kernel drivers are available. For my Intel Corporation PRO/Wireless AGN [Shiloh] Network Connection, I need to do the following:

# emerge net-wireless/iwl5000-ucode

udev (running by default) and the Linux kernel firmware loader support (CONFIG_FW_LOADER) will automatically load the microcode when needed.

Note that Gentoo and Funtoo provide different versions of the Intel microcode because the version you need will depend on the kernel you are using. For my RHEL5-based kernel, I had emerge an older version of the microcode to match what my kernel wireless driver was expecting by typing:

  1. emerge =net-wireless/iwl5000-ucode-5.4.0.11

This installed this file iwlwifi-5000-1.ucode which was required by my RHEL5-based kernel. Just typing emerge net-wireless-iwl5000-ucode installed iwlwifi-500-2.ucode, which my kernel could not use. Before I had the right version of the microcode, I saw an error like this when I viewed the kernel messages by typing dmesg: iwl5000: iwlwifi-5000-1.ucode firmware file req failed: Reason -2

This error message generally means "I can't find this file iwlwifi-5000-1.ucode that I'm looking for in /lib/firmware." With the proper firmware in place, then the wireless driver will be happy and wpa-supplicant can then bring the wireless interface up.

Set your root password

It's imperative that you set your root password before rebooting:

# passwd

Create a user account

Logging in as root is a bad idea on a Linux system. Before rebooting, create a user account for everyday use. Adjust the groups in the example below to match your needs. Some of them may not exist yet on your system. Replace '<user_name>' with the name your going to use for your everyday user. The '-m' option instructs useradd to create a home directory for your user. See the useradd manpage for more info.

useradd -m -G audio,cdrom,cdrw,floppy,usb,users,video,wheel -s /bin/bash <user_name>

Don't forget to set a password for your new user:

passwd <user_name>

Verify boot time services

You should verify that all of your needed services have been added to the appropriate runlevel.

eselect rc list | less

Scroll though the list and check. Example of things you might need to add:

  • lvm if you use logical volumes
  • Your system logger if you installed one
  • hibernate-cleanup if you use tuxonice
  • iptables
  • dbus

Add anything you need with the following command:

eselect rc add <script> <runlevel>

First boot

Now is the time to leave chroot, to unmount Funtoo Linux partitions and files and to restart your PC. If you installed GRUB, you will get an option to launch Funtoo Linux. Otherwise you will get to your already installed Linux and you will have to update your GRUB menu.

Leave the chroot, change directory to /, and unmount your funtoo partitions. Adjust the unmount command to match your setup

exit
cd /
umount /mnt/funtoo/home /mnt/funtoo/boot /mnt/funtoo/dev /mnt/funtoo/proc /mnt/funtoo/usr/portage /mnt/funtoo
   Note

In case of LVM2 also: swapoff /dev/mapper/vg-swap, vgchange -a n , if not You will see: Device dmcrypt_root is busy. In case of luks: cryptsetup luksClose dmcrypt_root to close the container.


Restart

shutdown -r now

What's next