Gentoo FreeBSD
Please get latest information from "Depends on" of bug #462580.
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 ./contrib and ./crypto 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).
Gentoo FreeBSD is also not 100% script-compatible with regular FreeBSD by default. Script compatibility can be restored by installing sys-freebsd/ubin-wrappers. This makes it possible to use *BSD software like pkgsrc.
Installation
Caution
Since this guide has only minimal information, knowledge of both Gentoo/Linux and FreeBSD may be needed. The Gentoo/Linux Handbook and FreeBSD Handbook are your friends.
Preparation
The installation media of FreeBSD 9.0 to which the LiveCD function was added are used for installation. Please get the more suitable one of i386 or amd64. Of course, -bootonly.iso can be used to install Gentoo/FreeBSD. Write to a CD or memory stick as necessary.
Boot the PC using the installation CD. Wait a moment while watching the boot process. Please choose Live CD, if a Welcome screen is displayed. Then login prompt, enter root.
Please select "2. [Esc]ape to loader prompt" at boot time if you have a 4KB/sector HDD.
Set the device name of your HDD with 4KB sectors in the boot loader. ada1 and ada2... to increase if you have more than one.
set kern.cam.ada.0.quirks="1" boot
Optional: Setting keymap
If your keyboard is not an English 101 keyboard, please set keymap.
root # kbdcontrol -l uk.isoA list of key map is available with the following command.
root # ls -1 /usr/share/syscons/keymaps | lessNetwork setting
First, create a directory /tmp/bsdinstall_etc to rewrite the resolv.conf.
root # mkdir -p /tmp/bsdinstall_etcIdentify your network devices. This example is em0.
root # ifconfig
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC>
ether 00:00:00:00:00:00
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=3<RXCSUM,TXCSUM>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet 127.0.0.1 netmask 0xff000000
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>Set the default gateway and IP address.
If you not use DHCP (IP address is an example)
root # ifconfig em0 192.168.0.100
root # route add default 192.168.0.1
root # echo "nameserver 8.8.8.8" > /etc/resolv.conf (example used a Google Public DNS)If you use DHCP
root # dhclient em0Optional: want to install via ssh
So far we could not use ssh. If you want to install via ssh from this step.
root # mkdir -p /tmp/etc
root # mount -t tmpfs tmpfs /tmp/etc
root # mount -t unionfs /tmp/etc /etc
root # passwd
root # echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
root # /etc/rc.d/sshd onestartPlease 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.
root # dmesg | grep ada
ada0 at ata0 bus 0 scbus0 target 0 lun 0
ada0: <QEMU HARDDISK 0.15.> ATA-7 device
ada0: 16.700MB/s transfers (WDMA2, PIO 8192bytes)
ada0: 12288MB (25165824 512 byte sectors: 16H 63S/T 16383C)
ada0: Previously was known as ad0
If you want to use the UFS2 file system (GPT)
This example is simple only two partitions. If necessary, you can split /, /usr, /var, /tmp, and /home. Please set using gpart.
| Partition | Filesystem | Size | Description |
|---|---|---|---|
| /dev/ada0p1 | none | just a bit | Reserved for bootloader |
| /dev/ada0p2 | UFS2 + SU | entire disk - swap space | Root partition |
| /dev/ada0p3 | swap | Rest of the disk | Swap partition |
root # gpart create -s GPT ada0
root # gpart add -s 64k -t freebsd-boot ada0
root # gpart add -s 10G -t freebsd-ufs -l root ada0
root # gpart add -t freebsd-swap -l swap ada0Please run gpart show in order to verify the partition could be set.
root # gpart show
=> 34 25165757 ada0 GPT (12G)
34 128 1 freebsd-boot (64k)
162 20971520 2 freebsd-ufs (10G)
20971682 4194109 3 freebsd-swap (2G)Results when you create a partition with option -a 4k.
root # gpart show
=> 34 25165757 ada0 GPT (12G)
34 6 - free - (3.0k)
40 128 1 freebsd-boot (64k)
168 20971520 2 freebsd-ufs (10G)
20971688 4194096 3 freebsd-swap (2G)
25165784 7 - free - (3.5k)
If you want to use the UFS2 file system (MBR)
| Partition | Filesystem | Size | Description |
|---|---|---|---|
| /dev/ada0s1a | UFS2 + SU | entire disk - swap space | Root partition |
| /dev/ada0s1b | swap | Rest of the disk | Swap partition |
root # gpart create -s mbr ada0
root # gpart add -t freebsd ada0
root # gpart set -a active -i 1 ada0
root # gpart create -s bsd ada0s1
root # gpart add -s 10G -t freebsd-ufs ada0s1
root # gpart add -t freebsd-swap ada0s1If you want to use the ZFS file system (experimental) / (GPT)
root # gpart create -s GPT ada0
root # gpart add -s 64k -t freebsd-boot ada0
root # gpart add -t freebsd-zfs -l zfs-system ada0Creating and mounting a file system
If you want to use the UFS2 file system
Please do not forget newfs -L option to label.
Your choice GPT)
root # newfs -L gfbsdroot -U /dev/ada0p2Your choice MBR)
root # newfs -L gfbsdroot -U /dev/ada0s1aAnd mount it.
root # mount /dev/ufs/gfbsdroot /mnt
root # swapon /dev/gpt/swap (GPT)
root # swapon /dev/ada0s1b (MBR)If you want to use the ZFS file system (experimental)
Load the kernel module in order to enable ZFS.
root # kldload zfsPrepare the RAM disk to write /boot/zfs/zpool.cache.
root # mount -t tmpfs tmpfs /boot/zfsPlease use gnop if you have 4KB/sector HDD. You can get the best performance.
root # gnop create -S 4096 /dev/gpt/zfs-systemCreates a new storage pool. if you are using gnop, please specify /dev/gpt/zfs-system.nop instead of /dev/gpt/zfs-system.
root # zpool create zsys /dev/gpt/zfs-system
root # zfs set mountpoint=none zsysCreates a new ZFS file system.
root # zfs create zsys/root
root # zfs set mountpoint=/mnt zsys/root
root # zfs mount -a
root # zfs create zsys/root/usr
root # zfs create zsys/root/varroot # zfs create zsys/root/tmp
root # zfs create zsys/home
root # zfs create -V 8gb zsys/swap
root # zfs set org.freebsd:swap=on zsys/swap
root # zfs set checksum=off zsys/swaproot # mkdir /mnt/home
root # mount -t zfs zsys/home /mnt/homeDownloading 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.
root # cd /mnt
root # fetch http://dev.gentoo.org/~aballier/fbsd9.0/x86/stage3-i686-freebsd-9.0.tar.bz2 (for x86-fbsd users)
root # fetch http://dev.gentoo.org/~aballier/fbsd9.1/amd64/stage3-amd64-freebsd-9.1.tar.bz2 (for amd64-fbsd users)
root # fetch http://distfiles.gentoo.org/snapshots/portage-latest.tar.bz2Unpacking stage3 and Portage snapshot
root # cd /mnt
root # setenv LANG "en_US.UTF-8"
root # tar xjpf stage3-*.tar.bz2 -C /mnt
root # tar xjf portage-latest.tar.bz2 -C /mnt/usrEntering the new Environment
root # mount -t devfs devfs /mnt/dev
root # cp /etc/resolv.conf /mnt/etc/
root # chroot /mnt /bin/bashSettings and install more in chroot environment
The first settings and time zone settings
env-update and time zone settings. Of course, you can modify /etc/portage/make.conf.
(chroot) root # env-update && source /etc/profile
(chroot) root # cp /usr/share/zoneinfo/GMT /etc/localtime (please select your time zone)
(chroot) root # emerge -u sys-apps/portage ; emerge sys-devel/libtool app-admin/eselect
(chroot) root # emerge app-editors/nano
(chroot) root # mv /etc/make.conf /etc/portage/ (if /etc/make.conf is exist.)
(chroot) root # nano -w /etc/portage/make.conf (if necessary)Bug fixes (for x86-fbsd users, 9.0 stage3 only)
Bugs have been fixed in several packages. Please upgrade them. For details, see bug #324445, bug #412319, bug #417031 and bug #421191.
(chroot) root # emerge sys-devel/gcc-config
(chroot) root # emerge sys-freebsd/freebsd-mk-defs sys-freebsd/freebsd-lib app-arch/libarchive dev-libs/libeditBug fixes (for amd64-fbsd users, 9.1 stage3 only)
Bugs have been fixed in several packages. Please upgrade them. For details, see bug #456108.
(chroot) root # emerge dev-libs/opensslSpecial settings for ZFS
If you select ZFS file system, the following additional work is required.
(chroot) root # emerge flaggie
(chroot) root # flaggie +zfs
(chroot) root # emerge sys-devel/flex
(chroot) root # emerge sys-freebsd/freebsd-cddl
(chroot) root # emerge sys-freebsd/freebsd-lib sys-freebsd/freebsd-ubin sys-freebsd/boot0Installing a kernel source
Unlike Gentoo/Linux, freebsd-sources package is the only sources.
(chroot) root # USE=symlink emerge freebsd-sourcesCompiling 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.
(chroot) root # emerge -u sys-devel/flex
(chroot) root # cd /usr/src/sys/i386/conf (case of x86-fbsd)
(chroot) root # cd /usr/src/sys/amd64/conf (case of amd64-fbsd)
(chroot) root # cp GENERIC.hints /boot/device.hints(chroot) root # config GENERIC
(chroot) root # cd ../compile/GENERIC
(chroot) root # make cleandepend && make depend && make -j3 && make installInstalling the boot loader
Let's install a boot loader to boot the Gentoo/FreeBSD. Boot loader configuration is done after exiting the chroot.
(chroot) root # emerge -u '<sys-devel/gcc-4.6'(chroot) root # ls /usr/bin/gcc-4.5*
/usr/bin/gcc-4.5.4(chroot) root # CC=gcc-4.5.4 emerge sys-freebsd/boot0System setting
Familiar setting. Please refer to Gentoo Linux Handbook if you need more information.
If you select UFS2
(chroot) root # nano -w /etc/fstab
# Device Mountpoint FStype Options Dump Pass#
/dev/ufs/gfbsdroot / ufs rw 1 1
#your choice GPT (don't forget comment out)
#/dev/gpt/swap none swap sw 0 0
#your choice MBR (don't forget comment out)
#/dev/ada0s1b none swap sw 0 0
If you select ZFS
(chroot) root # nano -w /etc/fstab
# Device Mountpoint FStype Options Dump Pass#
#/dev/ad0s1a / ufs rw 1 1
#/dev/ad0s1b none swap sw 0 0
zsys/root / zfs rw 0 0
Setting the host name
(chroot) root # nano -w /etc/conf.d/hostname
# (Set the hostname variable to your host name)
hostname="daemon"
Editing network setting
(chroot) root # nano -w /etc/conf.d/net
# (Set the dns_domain variable to your domain name)
dns_domain_lo="homenetwork"
# Manually setting)
config_em0="192.168.0.100 netmask 255.255.255.0"
routes_em0="default via 192.168.0.1"
# Using DHCP)
config_em0="dhcp"
Adding net.em0 to the default runlevel
(chroot) root # cd /etc/init.d
(chroot) root # ln -s net.lo0 net.em0
(chroot) root # rc-update add net.em0 defaultSetting keymap
Please edit /etc/conf.d/syscons if you want to change keymap.
(chroot) root # nano -w /etc/conf.d/sysconsA list of key map is available with the following command.
(chroot) root # ls -1 /usr/share/syscons/keymaps | lessSetting the root password
(chroot) root # passwdYou can also be configured to run at startup sshd.
(chroot) root # emerge -u net-misc/openssh
(chroot) root # rc-update add sshd defaultSpecial settings for ZFS
If you select ZFS file system, the following additional work is required.
(chroot) root # rc-update add zfs boot
(chroot) root # rc-update add zvol default
(chroot) root # echo 'zfs_load="YES"' >> /boot/loader.conf
(chroot) root # echo 'vfs.root.mountfrom="zfs:zsys/root"' >> /boot/loader.confInstalling the required packages
If dhcpcd is required if you use DHCP.
(chroot) root # emerge net-misc/dhcpcdExit from chroot environment
Work done in the chroot environment. exit from chroot environment.
(chroot) root # exitWrites boot loader and Cleaning up
Do you want to reboot now ? Just a minute. We forgot to setting the boot loader.
If you select UFS2 (GPT)
root # gpart bootcode -b /mnt/boot/pmbr ada0
root # gpart bootcode -p /mnt/boot/gptboot -i 1 ada0If you select UFS2 (MBR)
root # gpart bootcode -b /mnt/boot/boot0 ada0
root # gpart bootcode -b /mnt/boot/boot ada0s1If you select ZFS
root # gpart bootcode -b /mnt/boot/pmbr ada0
root # gpart bootcode -p /mnt/boot/gptzfsboot -i 1 ada0Special settings for ZFS
If you select ZFS file system, the following additional work is required.
root # umount /mnt/dev
root # cd /
root # zpool set bootfs=zsys/root zsys
root # zpool export zsys
root # gnop destroy /dev/gpt/zfs-system.nop (please run if you are using gnop)root # zpool import zsys
root # mkdir /mnt/boot/zfs
root # cp /boot/zfs/zpool.cache /mnt/boot/zfs/
root # zfs unmount -aroot # zfs set mountpoint=none zsys
root # zfs set mountpoint=/usr zsys/root/usr
root # zfs set mountpoint=/var zsys/root/var
root # zfs set mountpoint=/tmp zsys/root/tmp
root # zfs set mountpoint=/home zsys/home
root # zfs set mountpoint=legacy zsys/rootreboot!
Don't have a problem? Now we restart. Don't forget to remove the Installation CD of FreeBSD.
root # shutdown -r nowHowto run G/FBSD in vanilla FreeBSD's jail
Details of jail, please see the FreeBSD Handbook.
Preparing directory
root # mkdir -p /usr/jail/gfbsd
root # cd /usr/jail/gfbsdDownloading and Unpacking the Stage3 Tarball and Portage snapshot
root # fetch http://dev.gentoo.org/~aballier/fbsd9.0/x86/stage3-i686-freebsd-9.0.tar.bz2 (for x86-fbsd users)
root # fetch http://dev.gentoo.org/~aballier/fbsd9.1/amd64/stage3-amd64-freebsd-9.1.tar.bz2 (for amd64-fbsd users)
root # fetch http://distfiles.gentoo.org/snapshots/portage-latest.tar.bz2
root # tar xjpf stage3-*.tar.bz2
root # tar xjf portage-latest.tar.bz2 -C /usr/jail/gfbsd/usrSetting
Configure jail to start with FreeBSD.
jail_enable="YES" jail_list="gfbsd" jail_gfbsd_rootdir="/usr/jail/gfbsd" jail_gfbsd_hostname="gfbsd.example.org" jail_gfbsd_devfs_enable="YES" # You will also need to add the following line if you need network access. # em0, please specify your network devices. jail_gfbsd_interface="em0" jail_gfbsd_ip="192.168.0.10"
Setting to operate Gentoo/FreeBSD in jail.
root # echo 'rc_sys="jail"' >> /usr/jail/gfbsd/etc/rc.conf
root # echo 'hostname="gfbsd"' > /usr/jail/gfbsd/etc/conf.d/hostname
root # echo 'syslogd_args="-ss"' >> /usr/jail/gfbsd/etc/conf.d/syslogdroot # chroot /usr/jail/gfbsd /bin/bash(chroot) root # rc-update add vixie-cron default
(chroot) root # exitrun jail
Let's run jail.
root # /etc/rc.d/jail startVerify that worked.
root # jls
JID IP Address Hostname Path
1 192.168.0.10 gfbsd /usr/jail/gfbsd
To enter the jail environment will use the jexec command.
root # jexec 1 /bin/bashUpgrade howto
This guide will show you how to upgrade Gentoo/FreeBSD 9.1 from previous version.
Preparation
Bug fix
need to fix some bugs for the upgrade to be successful.
Details, see bug #409815, bug #444918.
root # cd /usr/portage/sys-freebsd/boot0
root # wget -O boot0-9.1.ebuild "http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-bsd.git;a=blob_plain;f=sys-freebsd/boot0/boot0-9.9999.ebuild;h=c3832fc62168ce50fb4a4d0bb07d4d304d653a67;hb=215c51a65ef452b184003ae3a01b78adfa5881b3"
root # ebuild boot0-9.1.ebuild digest
root # mkdir -p /etc/portage/patches/sys-freebsd/freebsd-sources
root # wget -O /etc/portage/patches/sys-freebsd/freebsd-sources/freebsd-sources-9.1-MFC-r239588.patch "http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-bsd.git;a=blob_plain;f=sys-freebsd/freebsd-sources/files/freebsd-sources-9.1-MFC-r239588.patch;h=5390d0ed7439ad0211682ee44171165d4ec4f035;hb=c2024950819c1f42785d7b82410381eb3a61dd8d"Change to latest profile
To emerge related to FreeBSD 9.1 is necessary to change the profile.
Get a list of available profiles:
root # eselect profile list
Available profile symlink targets:
[1] default/bsd/fbsd/x86/9.0
[2] default/bsd/fbsd/x86/9.1
Set the profile of 9.1:
root # eselect profile set 2Updating sys-apps/portage
Please check first, what will be installed.
root # emerge -pu sys-apps/portage
[ebuild UD] sys-apps/portage-2.1.11.33 [2.2_rc49] USE="(ipc%*) (-pypy1_9) -python2% -xattr%"
After confirming that masked by: EAPI error does not appear, please upgrade.
Please add --exclude sys-freebsd/* option if failed messages sys-freebsd packages are mask is displayed.
root # emerge -u sys-apps/portageSuccessfully updated, please check the version.
root # emerge --version
Portage 2.1.11.33 (default/bsd/fbsd/x86/9.1, gcc-4.4.2, freebsd-lib-7.2, 9.1_rc3-Gentoo i386)need version 2.2. If it is not 2.2, update portage again.
root # emerge -u sys-apps/portage --exclude sys-freebsd/*Recheck the version.
root # emerge --version
Portage 2.2.0_alpha144 (default/bsd/fbsd/x86/9.1, gcc-4.4.2, freebsd-lib-7.2, 9.1_rc3-Gentoo i386)In addition, check that it includes preserve-libs to FEATURES. If it does not, please add FEATURES="preserve-libs" in make.conf.
root # emerge --info | grep FEATURES= | grep preserve-libs
FEATURES="assume-digests binpkg-logs chflags config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"Move /etc/make.conf
Recently, /etc/make.conf has been moved to /etc/portage/make.conf. if it exists in /etc, please move it.
In addition, remove LDFLAGS from make.conf. If it is set, upgrade may fail.
root # mkdir -p /etc/portage
root # if [ -e /etc/make.conf ] && [ ! -e /etc/portage/make.conf ] ; then
root # mv /etc/make.conf /etc/portage/make.conf
root # fi
root # gsed -i '/LDFLAGS=/d' /etc/portage/make.confFixed collision of tabs
If you are using version 8.0 and fewer, tabs might collide. Please check the following steps.
root # cd /var/db/pkg/sys-freebsdroot # grep -r tabs * | grep obj
freebsd-ubin-7.2/CONTENTS:obj /usr/bin/tabs 741bc04f9e321d5d0f312b5cb8a87d6a 1257735235
freebsd-ubin-7.2/CONTENTS:obj /usr/share/man/man1/tabs.1.bz2 ed7bca86bc66d164cc1434583f6d8cd7 1257735225
root # rm /usr/bin/tabs /usr/share/man/man1/tabs.1.bz2And please update sys-libs/ncurses.
root # emerge -u sys-libs/ncurses --exclude sys-freebsd/*Package updates the minimum required
update the minimal packages needed to upgrade.
root # emerge sys-freebsd/freebsd-mk-defs
root # emerge -u sys-apps/findutils --exclude sys-freebsd/*
root # emerge -u sys-devel/libtool --exclude sys-freebsd/*
root # emerge -u sys-devel/flex sys-devel/patch sys-devel/m4 net-libs/libpcap sys-devel/gettext app-arch/libarchive dev-libs/libelf --exclude sys-freebsd/*
root # emerge sys-devel/libtool --exclude sys-freebsd/*Migrate to lib from lib64 (for amd64-fbsd users, 9.0 stage3 only)
If you are using 9.0 stage3 of amd64-fbsd, you will need to migrate to lib from lib64 first.
If you skip this step, all the commands you will not be able to run when upgrade sys-apps/baselayout. For details, see bug #436560
root # wget -O /tmp/migrate_libdir.sh "http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-bsd.git;a=blob_plain;f=scripts/migrate_libdir.sh;hb=HEAD"
root # bash /tmp/migrate_libdir.sh
root # emerge -u sys-apps/baselayout --exclude sys-freebsd/*Kernel update
First of all, you need to update your kernel. It is because the package of a userland may use the new function of a kernel.
Please be sure to update a kernel first !
root # USE=symlink emerge freebsd-sources
root # cd /usr/src/sys/i386/conf (case of x86-fbsd)
root # cd /usr/src/sys/amd64/conf (case of amd64-fbsd)
root # cp GENERIC.hints /boot/device.hintsroot # config GENERIC
root # cd ../compile/GENERIC
root # make cleandepend && make depend && make -j3 && make installfailed to compile the kernel
Please get the GENERIC kernel of FreeBSD if you fail to compile the kernel. If you are using amd64-fbsd, please replace the i386 to amd64 in URL.
root # wget -P /tmp http://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.1-RELEASE/base.txz
root # wget -P /tmp http://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/9.1-RELEASE/kernel.txz
root # mv /boot /boot.orig
root # cd /
root # tar xvJf /tmp/base.txz ./boot
root # tar xvJf /tmp/kernel.txzreboot
Don't have a problem? Now we restart.
root # shutdown -r nowAfter rebooting your machine, please check if the kernel is new.
root # uname -a
FreeBSD daemon 9.1-Gentoo FreeBSD Gentoo 9.1 #0: Fri Jan 20 00:01:04 JST 2012
root@daemon:/usr/src/sys-9.1-r0/amd64/compile/GENERIC amd64
Updating FreeBSD userland
The first emerge the core library.
root # USE=build emerge -1 --nodeps sys-freebsd/freebsd-libUpdate the userland of FreeBSD.
root # emerge -C sys-process/fuser-bsd
root # USE=symlink emerge -auN boot0 freebsd-bin freebsd-cddl freebsd-contrib freebsd-lib freebsd-libexec freebsd-mk-defs freebsd-pam-modules freebsd-sbin freebsd-share freebsd-ubin freebsd-usbinCleanup, utmp related files
root # rm /var/run/utmp /var/log/lastlog /var/log/wtmp*Change CHOST and rebuild toolchain
Change CHOST, and emerge binutils gcc. (FYI, Changing the CHOST variable)
x86-fbsd users)
root # gsed -i 's:CHOST=.*:CHOST="i686-gentoo-freebsd9.1":g' /etc/portage/make.confamd64-fbsd users)
root # gsed -i 's:CHOST=.*:CHOST="x86_64-gentoo-freebsd9.1":g' /etc/portage/make.confemerge binutils gcc
root # emerge -1 sys-devel/binutils sys-devel/gcccheck gcc's 8.x stuff
root # gcc-config -l
* broken config file: /etc/env.d/gcc/i686-gentoo-freebsd8.0-4.4.3
[1] i686-gentoo-freebsd8.0-4.4.3 *
[2] i686-gentoo-freebsd9.1-4.6.3
remove 8.x stuff.
root # emerge -C '<gcc-4.6'root # gcc-config -c
i686-gentoo-freebsd9.1-4.6.3also check binutils
root # binutils-config -l
[1] i686-gentoo-freebsd9.1-2.20.1 *
root # binutils-config -c
i686-gentoo-freebsd9.1-2.20.1remove FreeBSD 8.x env data.
root # cd /etc/env.d/
root # grep gentoo-freebsd8. *
04gcc-i686-gentoo-freebsd8.0:PATH="/usr/i686-gentoo-freebsd8.0/gcc-bin/4.4.3"
04gcc-i686-gentoo-freebsd8.0:ROOTPATH="/usr/i686-gentoo-freebsd8.0/gcc-bin/4.4.3"
04gcc-i686-gentoo-freebsd8.0:MANPATH="/usr/share/gcc-data/i686-gentoo-freebsd8.0/4.4.3/man"
04gcc-i686-gentoo-freebsd8.0:INFOPATH="/usr/share/gcc-data/i686-gentoo-freebsd8.0/4.4.3/info"
04gcc-i686-gentoo-freebsd8.0:LDPATH="/usr/lib/gcc/i686-gentoo-freebsd8.0/4.6.3
04gcc-i686-gentoo-freebsd8.0:/usr/lib/gcc/i686-gentoo-freebsd8.0/4.4.3"
05gcc-i486-gentoo-freebsd8.0:MANPATH="/usr/share/gcc-data/i486-gentoo-freebsd8.0/4.4.3/man"
05gcc-i486-gentoo-freebsd8.0:INFOPATH="/usr/share/gcc-data/i486-gentoo-freebsd8.0/4.4.3/info"
05gcc-i486-gentoo-freebsd8.0:LDPATH="/usr/lib/gcc/i486-gentoo-freebsd8.0/4.4.3"
05gcc-i486-gentoo-freebsd8.0:PATH="/usr/i486-gentoo-freebsd8.0/gcc-bin/4.4.3"
05gcc-i486-gentoo-freebsd8.0:ROOTPATH="/usr/i486-gentoo-freebsd8.0/gcc-bin/4.4.3"
target file name is 04gcc-i686-gentoo-freebsd8.0, 05gcc-i486-gentoo-freebsd8.0 in this case.
root # rm 04gcc-i686-gentoo-freebsd8.0 05gcc-i486-gentoo-freebsd8.0
root # env-update && source /etc/profile
root # /usr/share/gcc-data/i686-gentoo-freebsd9.1/4.6.3/fix_libtool_files.sh 4.4.3 --oldarch i686-gentoo-freebsd8.0Recreate all packages.
root # emerge sys-devel/libtool
root # emerge -ae @world --exclude sys-apps/portage
root # emerge sys-apps/portageFailure to compile the package if any, 'emerge --resume --skipfirst' is your friend. Also, please bug report the problem if you like.
Cleaning
Let's remove the backup files when you have finished all the steps.
root # emerge sys-devel/libtool app-admin/eselect
root # emerge @preserved-rebuild
root # etc-updateRe-select profile
Please re-select the profile if make.profile exists in /etc.
root # ls -l /etc/make.profile
lrwxr-xr-x 1 root portage 48 Dec 1 00:00 /etc/make.profile -> ../usr/portage/profiles/default/bsd/fbsd/x86/9.1
root # rm /etc/make.profile
root # eselect profile list
Available profile symlink targets:
[1] default/bsd/fbsd/x86/9.0
[2] default/bsd/fbsd/x86/9.1
root # eselect profile set 2How to use X Window System with vesa video card
root # emerge portage ; emerge libtool app-admin/eselect
root # mv /etc/make.conf /etc/portage/make.conf (be careful !)
root # emerge -u flaggie
root # flaggie +python +Xroot # echo 'INPUT_DEVICES="keyboard mouse"' >> /etc/portage/make.conf
root # echo 'VIDEO_CARDS="vesa"' >> /etc/portage/make.conf
root # echo "media-libs/mesa -~amd64-fbsd -~x86-fbsd amd64" >> /etc/portage/package.keywordsroot # emerge -p xorg-x11
root # emerge xorg-x11
root # emerge x11-drivers/xf86-input-mouse
root # emerge xorg-drivers
root # emerge xterm twm xclock
root # Xorg -configure
root # mv /root/xorg.conf.new /etc/X11/xorg.confCheck the device for mouse
root # grep /dev /etc/X11/xorg.conf
Option "Device" "/dev/sysmouse"
OK, In this case /dev/sysmouse has been detected.
root # /etc/init.d/moused start
root # rc-update add moused default
root # startxOther video cards
xf86-video-vmware)
root # ACCEPT_KEYWORDS=amd64 emerge --nodeps '<x11-drivers/xf86-video-vmware-12.0.0'Q&A
Q. mouse does not work
A. PS/2 mouse is /dev/psm0、USB mouse is /dev/usm0. another one is /dev/sysmouse. Please specify in xorg.conf correctly. You need to start moused to use /dev/sysmouse. Run /etc/init.d/moused start.
Troubleshooting
amd64-fbsd
All commands is not working after emerge sys-apps/baselayout
After failing to emerge baselayout, all commands will not work. Details, see bug #436560
root # ls
Shared object "libutil.so.9" not found, required by "ls"
If you have not restarted the PC, please run this command first.
root # export LD_LIBRARY_PATH="/lib64:/usr/lib64"If you restart or turn off your PC already has a need to restore your system using the installation CD of FreeBSD.
- boot using the installation media of FreeBSD.
- Live CD select
- Mount the root partition of G/FBSD (eg. mount /dev/ufs/gfbsdroot /mnt)
- cd /mnt (Please replace to /mnt/,/mnt/usr... from /,/usr... )
Please check lib in /, /usr, /usr/local.
root # ls -l /lib /usr/lib /usr/local/lib
ls: /lib: No such file or directory
lrwxr-xr-x 1 root wheel 5 Oct 14 06:41 /usr/lib -> lib64
lrwxr-xr-x 1 root wheel 5 Oct 14 06:41 /usr/local/lib -> lib64
In this case, the symbolic link /lib is simply removed. Let's re-create symbolic link /lib.
root # ln -s lib64 /libYou need to migrate from lib64 to lib 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 !
root # wget -O /tmp/migrate_libdir.sh "http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-bsd.git;a=blob_plain;f=scripts/migrate_libdir.sh;hb=HEAD"
root # bash /tmp/migrate_libdir.sh
root # emerge sys-apps/baselayoutcan not boot a kernel panic always occurs
Details, see bug #408019
workaround is to use gcc 4.3 or clang to compile the kernel.
amd64 kernel + x86 stage environment, tar will not work successfully.
Details, see bug #444918
Error messages:
tar: getvfsbyname failed: No such file or directory tar: Error exit delayed from previous errors.
workaround fix
root # emerge =libarchive-3.0.3gcc fails to compile, Error message is recompile -fPIC
Details, see bug #415185 .
workaround fix
root # emerge --ask sys-devel/gccArchitecture Independent Issues
The kernel fails to mount a ZFS root filesystem with error 2
Your /boot/zfs/zpool.cache file is missing information about the pool containing your root filesystem.
Boot a FreeBSD LiveCD and enter the shell. Then import your pool using the name of your pool intead of "rpool":
root # zpool import -f -N rpoolInform ZFS what your root dataset is using its name instead of "rpool/ROOT/freebsd":
root # zfs set mountpoint=/ rpool/ROOT/freebsdExport the pool
root # zpool export rpoolImport the pool again, except this time over your Live CD's root filesystem:
root # zpool import rpoolNow force the system to reboot and it should work. This procedure originally described on the FreeBSD forums.
Emerge fails net-misc/openssh
Details, see bug #391011
workaround fix for openssh
root # EXTRA_ECONF='--disable-utmp --disable-wtmp' emerge '>net-misc/openssh-6.0'Another issue. If the following error message is displayed, please try EXTRA_ECONF='--disable-lastlog'
loginrec.c: In function 'lastlog_openseek': loginrec.c:1506:46: error: invalid application of 'sizeof' to incomplete type 'struct lastlog' loginrec.c: In function 'lastlog_write_entry': loginrec.c:1536:17: error: storage size of 'last' isn't known loginrec.c:1536:17: warning: unused variable 'last' [-Wunused-variable] loginrec.c: In function 'lastlog_get_entry': loginrec.c:1589:17: error: storage size of 'last' isn't known loginrec.c:1589:17: warning: unused variable 'last' [-Wunused-variable]
Emerge fails app-misc/screen
Details, see bug #393039 and bug #409819.
Please use app-misc/tmux instead of app-misc/screen.
lex: not found
root # emerge --ask sys-devel/flexcc: not found
Details, see bug #412319
root # emerge '>=sys-devel/gcc-config-1.7.1'Emerge fails sys-freebsd/boot0 using >gcc-4.6
Details, see bug #409815
workaround:
root # emerge -u '<sys-devel/gcc-4.6'
root # CC=gcc-4.5.4 emerge boot0Contacts
- gentoo-bsd mailing list ( Gentoo Mailing Lists)
- IRC Channel #gentoo-bsd on freenode ( Gentoo Linux IRC Resources )