Gentoo FreeBSD

Gentoo/FreeBSD is a Gentoo system based on FreeBSD. It is FreeBSD with the following changes:


 * Portage replaces ports.
 * The base system is managed by portage.
 * Software in and  is replaced with Gentoo Linux versions.
 * The rc system is replaced with OpenRC.
 * Python, wget and bash are included in the base system to support portage.
 * FreeBSD's bootloader is removed from the base system (useful for jails).

What is FreeBSD?
FreeBSD is a free (license) Unix-like operating system. Back in 1993 when development of 386BSD stopped, two projects were born: NetBSD, commonly known to run on a huge number of architectures, and FreeBSD which supports the x86, amd64, ia64, sparc64 and alpha platforms. FreeBSD is renowned for its stability, performance and security, thus being used from small to huge companies all over the world.

FreeBSD's current production release is version 11.0. Gentoo/FreeBSD is based on version 11.0 and older versions of Gentoo/FreeBSD are discontinued and no longer supported.

What is Gentoo/FreeBSD?
FreeBSD project is a sub-project of the Alt project project, with the goal of providing a fully-capable FreeBSD operating system featuring design sensibilities taken from Gentoo Linux, such as the init system and the Portage package management system.

FreeBSD and Linux
Users migrating from Linux to FreeBSD commonly consider the two operating systems "almost the same". In fact, FreeBSD really shares a lot of similarities with Linux distributions in general. Nevertheless, it has some key differences that are worth noting:


 * Contrary to Linux, which actually only refers to the kernel, FreeBSD is a complete operating system, consisting of a C library, userland tools and much more. This development approach makes the overall system very consistent.
 * Contrary to the Linux kernel, FreeBSD development is not led by one person, but instead managed by a small group of people called the Core Team.

Besides, FreeBSD also has some technical differences which set it apart from Linux. Some of them are very important to know, even if you don't plan on joining the Gentoo/FreeBSD development effort:


 * To get run-time dynamic linking functions like dlopen, programs do not need to be linked against libdl like on GNU/Linux. Instead they are linked against libc.
 * FreeBSD doesn't have an official tool for kernel compilation, thus you'll have to resolve feature dependencies on your own.
 * FreeBSD supports UFS/UFS2 and ZFS as native file systems.
 * FreeBSD also supports Linux filesystems, but you cannot install your system on them. ext2/ext3 supports read/write access. ReiserFS, XFS are read-only support. details please see FreeBSD's handbook 21.3. Linux® Filesystems

Caution
This guide provide minimal information about Gentoo/FreeBSD. You need specialized knowledge of Gentoo/Linux and FreeBSD. The Gentoo Linux Handbook and FreeBSD Handbook should be close friends.

Preparation
Gentoo/FreeBSD doesn't have install media. Instead, you can use vanilla FreeBSD 9.0 or later version install media. Please get i386 or amd64 image. Of course, -bootonly.iso can be used to install Gentoo/FreeBSD. Write to a CD or memory stick as necessary.

Boot your PC with a installation CD. Wait for display a dialog. Please choose Live CD, if a Welcome screen is displayed. Then login prompt, enter root.

Optional: Setting keymap
If your keyboard is not an English 101 keyboard, please set keymap.

A list of key map is available with the following command.

Network setting
First, create a directory to rewrite the :

Identify your network devices. In this example the network interface is :

Set the default gateway and IP address.

When setting a static address:

When using DHCP:

Optional: Installing via ssh
If you want to install via ssh from this step.

Please connect with any ssh client. The username is root.

Setting the partition
The installation target device of serial ATA and IDE are /dev/ada*. SCSI and USB drive are /dev/da*. Please identify the HDD using ls /dev/ada* or dmesg | grep ada. In this case, the device is ada0:

Using the UFS2 file system (GPT)
This example is simple only two partitions. If necessary, you can split, , , , and. Please set using gpart.

Using FreeBSD's default bootloader. [Recommend]
Please run gpart show in order to verify the partition could be set.

Results when you create a partition with option -a 4k.

Using the UFS2 file system
Please do not forget newfs  option to label.

Your choice GPT:

Your choice MBR:

And mount it:

Using the ZFS file system (experimental)
Load the kernel module in order to enable ZFS:

Prepare the RAM disk to write :

Please use gnop if you have 4KB/sector HDD. You can get the best performance:

Creates a new storage pool. if you are using gnop, please specify instead of.

Creates a new ZFS file system:

Downloading the stage3 tarball and Portage snapshot
Now, Gentoo/FreeBSD 9.0 stage3 is available for x86-fbsd. And Gentoo/FreeBSD 9.1 stage3 is available for amd64-fbsd.

The first settings and time zone settings
env-update and time zone settings. Of course, you can modify.

Bug fixes (for x86-fbsd users, 9.0 stage3 only)
Bugs have been fixed in several packages. Please upgrade them. For details, see, , and.

Special settings for ZFS
If you select ZFS file system, the following additional work is required.

Installing a kernel source
Unlike Gentoo/Linux, freebsd-sources package is the only sources.

Compiling and installing kernel
Now let's compile the kernel. Copy the GENERIC in conf, you can change it by changing the kernel configuration. For more information see the FreeBSD Handbook.

System settings
Familiar setting. Please refer to Gentoo Linux Handbook if you need more information.

If you select UFS2:

If you select ZFS. Note that the Pass# column should be zero for ZFS, because it cannot be checked by fsck.

Setting the host name

Editing network setting

Adding net.em0 to the default runlevel

Setting keymap

Please edit if you want to change keymap.

A list of key map is available with the following command.

Setting the root password

Adding a User for Daily Use (sample)

You can also be configured to run at startup sshd.

Special settings for ZFS
If you select ZFS file system, the following additional work is required.

Special settings for virtual machine
If you are installing on a virtual machine, require additional configuration.

Installing the required packages
If dhcpcd is required if you use DHCP:

Installing the boot loader
Let's install a boot loader to boot the Gentoo/FreeBSD:

Please see this section if you want to use grub2. But it is experimental!

Setting boot loader
Let's prepare for using.

If you select UFS2 (GPT):

If you select UFS2 (MBR):

If you select ZFS (GPT):

Exit from the chroot environment
Work done in the chroot environment, now exit the environment:

Cleaning up and setting the remaining
Do you want to reboot now ? Just a minute. ZFS user must have setting a little more.

Special settings for ZFS
If you select ZFS file system, the following additional work is required.

Reboot!
Don't have a problem? Now restart.

Don't forget to remove the Installation CD of FreeBSD.

Howto run G/FBSD in vanilla FreeBSD's jail
Details of jail, please see the FreeBSD Handbook.

Setting
Configure jail to start with FreeBSD:

Setting to operate Gentoo/FreeBSD in jail:

run jail
Let's run jail:

Verify that it worked:

To enter the jail environment will use the jexec command:

How to help
There are many things you could help with, depending on your skill level and spare time:


 * Working on current ebuilds: this means working closely with ebuild maintainers in order to create patches or modify ebuilds in a way that can be accepted into the main tree.
 * Security: if you are into security, we need you! Although security advisories from the FreeBSD project are tracked and fixed, we can always use help in this area.
 * Contacts: we need people who can get in touch with FreeBSD developers to maintain contacts between us and the original project to exchange patches and discuss various problems and their solutions. Note that this should never involve any kind of spamming of mailing lists or IRC channels.
 * Testing: the more people are actively using Gentoo/FreeBSD, the more bugs will be discovered, which helps us improving the quality of the port. If you are good at describing bugs or problems, we definitely want to hear from you.
 * Other areas where we need help include: system ebuilds, creation of installation CDs, documentation, kernel hacking.

All commands is not working after emerge sys-apps/baselayout
After failing to emerge baselayout, all commands will not work. For details see.

If you have not restarted the PC, please run this command first:

If you restart or turn off your PC already has a need to restore your system using the installation CD of FreeBSD.


 * 1) boot using the installation media of FreeBSD.
 * 2) Live CD select
 * 3) Mount the root partition of G/FBSD (e.g.  )
 * 4)   (Please replace to, , ... from , , ...)

Please check lib in, ,.

In this case, the symbolic link is simply removed. Let's re-create symbolic link.

You need to migrate from to  before run emerge baselayout so far. Run the script for migration.

If you have to recover by using FreeBSD's installation media, please enter in G/FBSD run chroot /mnt !

Kernel fails to mount a ZFS root filesystem with error 2
The file is missing information about the pool containing the root filesystem.

Boot a FreeBSD LiveCD and enter the shell. Then import your pool using the name of your pool intead of "rpool":

Inform ZFS what your root dataset is using its name instead of "rpool/ROOT/freebsd":

Export the pool:

Import the pool again, except this time over your Live CD's root filesystem:

Now force the system to reboot and it should work. This procedure originally described on the FreeBSD forums.

Emerge fails app-misc/screen
For details see and.

Please use instead of.

cc: not found
For details see :

Contacts

 * gentoo-bsd mailing list (Gentoo Mailing Lists)
 * IRC channel on Freenode (Gentoo Linux IRC channels list)