This FAQ is a collection of questions and answers collected from the gentoo-dev mailing list and from Gentoo channels on Freenode Internet Relay Chat (IRC).
- 1 介绍
- 2 开始
- 3 安装
- 3.1 使用"using -O9 -ffast-math -fomit-frame-pointer "优化选项后系统变得不可用，发生了什么？
- 3.2 如何修改root或其它用户的密码？
- 3.3 如何添加普通用户？
- 3.4 为什么用户不能su到root?
- 3.5 不重装系统，如何将gentoo从一个版本升级至另一个版本？
- 3.6 安装后内核启动失败，怎么办？
- 3.7 网络代理需要需要授权，怎么办？
- 3.8 How do I burn an ISO file?
- 3.9 What CD/stage should I use for my CPU?
- 3.10 The Internet does not work after rebooting. What is wrong?
- 3.11 Can I dual boot with Windows or other operating systems?
- 3.12 Attempting to boot Windows from GRUB Legacy or LILO only shows a black screen. What should I do?
- 3.13 How do I install Gentoo using a stage1 or stage2 tarball?
- 4 Package management
- 4.1 In what form are the packages stored?
- 4.2 I want to perform the ./configure step myself. Can I?
- 4.3 What if rsync does not work for me?
- 4.4 I have a slow (or no) Internet connection at home. Can I download sources somewhere else and add them to my system?
- 4.5 Source tarballs are collecting in /usr/portage/distfiles/. Is it safe to delete these files?
- 4.6 What is in /var/tmp/portage? Is it safe to delete the files and directories in /var/tmp/portage?
- 5 Usage
- 6 Maintenance
- 7 Development
- 8 Resources
Please note that many of these questions are answered within the official Gentoo documents and guides. This is simply a list of common questions. Please read Gentoo documentation and man pages to gain a greater understanding of how Gentoo and GNU/Linux works, and for answers to questions which may not be answered here.
gentoo使用了与bsd的ports系统类似的portage系统。portage是一种软件包管理 系统，它使得在gentoo系统中软件的安装与维护十分灵活。它提供了编译时选项 （通过USE标志），条件依赖，预安装软件包概述，通过沙盒安全地安装与卸载 软件包，系统描述，以及包含其它几个特性的配置文件保护功能。
默认的情况下，gentoo的整个系统都是通过源代码，使用用户的优化选项编译而 成的。对于安不安装什么软件，用户有完全的控制权。gentoo提供了丰富的选项， 用户可以把gentoo安装成他们最喜欢的样子，这也就是为什么gentoo被称为"元 发布"了。
gentoo开发活跃，整个开发采用快速的开发模式：软件包补丁被迅速集成到主线 开发树；文档基本每天更新；portage特性添加频繁；官方发布一年更新两个版 本。
使用"using -O9 -ffast-math -fomit-frame-pointer "优化选项后系统变得不可用，发生了什么？
使用passwd命令修改当前登录用户的密码，root用户通过passwd username可修 改其它用户的密码，man passwd查看手册了解其它选项和设置。
命令"useradd larry"将添加普通用户larry。然而，这种方法没有赋予用户足够 的权力来正常使用系统，推荐使用：
useradd -m -G users,audio,wheel larry
users:系统中标准的交互型用户组 audio:允许使用音频的用户组 wheel:允许使用su命令切换到root权限，前提知道root用户的密码
gpasswd -a <username> wheel
事实上，各个gentoo版本在安装后并无不同。gentoo 1.4及后续版本基于 glibc-2.3.x（或更高）。如此，运行命令"emerge --sync && emerge -uDN @world"即可更新至最新gentoo。单个gentoo版本间的不同，只在于安装介质与 其中包含的预编译好的软件包。参见"gentoo升级指南"查看更多描述文件以及它 们在升级中扮演的角色的信息。
同时注意，命令"emerge -uDN @world"更新已安装的软件包以及它们的运行时依 赖（软件正常运行离不开的包，运行时依赖），但不会升级编译软件需要的依赖 （运行不需要，但编译需要，编译时依赖）。同时更新编译时依赖，加上选项 "--with-bdeps=y"选项。
这并不意味着要重做安装中的每一个步骤，审查编译内核及内核相关的安装步骤 却是必要的。假设gentoo安装在/dev/sda1(/boot), /dev/sda3(/), 而/dev/sda2(swap)用作交换分区。
mount /dev/sda3 /mnt/gentoo
mount /dev/sda1 /mnt/gentoo/boot
mount -t proc none /mnt/gentoo/proc
chroot /mnt/gentoo /bin/bash
env-update && source /etc/profile
make && make modules_install
cp arch/i386/boot/bzImage /boot/<kernel_name>
umount /mnt/gentoo/proc /mnt/gentoo/boot /mnt/gentoo
http_proxy="http://username:firstname.lastname@example.org:portnumber" ftp_proxy="ftp://username:email@example.com:portnumber" RSYNC_PROXY="rsync://username:firstname.lastname@example.org:portnumber"
How do I burn an ISO file?
ISO files must be burned in raw mode. This means the file should not just be placed on the CD, but interpreted as an entire CD.
There are lots of CD burning tools available; covering them all would be a Sisyphean problem. However, describing a few popular tools never hurts:
- With EasyCD Creator select File, Record CD from CD image. Then change the Files of type to ISO image file. Then locate the ISO file and click Open. After clicking Start recording the ISO image will be burned correctly onto the CD/DVD.
- With Nero Burning ROM, cancel the wizard which automatically pops up and select Burn Image from the File menu. Select the image to burn and click Open. Now click the Burn button and watch the brand new Gentoo Live CD being burnt.
- With cdrecord, simply type cdrecord dev=/dev/cdrom (replace /dev/cdrom with the CDROM drive's device path) followed by the path to the ISO file.
- With K3B, select Tools → CD → Burn CD Image. Then locate the ISO file within the 'Image to Burn' area. Click Start to begin the burn process.
- With Mac OS X Panther, launch Disk Utility from Applications/Utilities, select Open from the Images menu, select the mounted disk image in the main window and select Burn in the Images menu.
- With Mac OS X Jaguar, launch Disk Copy from Applications/Utilities, select Burn Image from the File menu, select the ISO and click the Burn button.
What CD/stage should I use for my CPU?
First find out what CPU is in the system Gentoo is to be installed on (for instance a Pentium-M). Next find out what CPU type it is compatible with (instruction-wise) to find a proper match with Gentoo's CD or stages. Consulting the CPU's vendor website for this information usually works, although querying a search engine of choice is usually more efficient.
When uncertain, take a "lower" CD/stage file, for instance a i686 or even generic x86 (or the equivalent in the system's arch). This will ensure that the system will work, but may not be as fast as further optimizations.
Please note that many more options exist than those for which Gentoo builds binary stages. Please see the GCC guide for setting the
The Internet does not work after rebooting. What is wrong?
First verify that the network card is discovered properly by the kernel. Run ifconfig -a and look for network interfaces. Something such as eth0, eno1, enp2s0, enp0s8, wlan0 (in case of certain wireless network cards) should be present. Specific kernel modules may be required for the kernel to properly detect the network card. If that is the case, make sure that the required kernel modules are listed in the /etc/conf.d/modules file.
If support for the system's network card has been left out of the kernel, it will need to be reconfigured and, in some cases, recompiled.
If the network card is found by the kernel, but the network configuration has been set to use DHCP, a DHCP client might not have been installed on the system. There are many DHCP clients available in Gentoo, a common one being dhcpcd. If necessary to get the connection to the Internet working reboot to the installation CD and emerge -a dhcpcd.
Information on how to rescue the system using the installation CD is available here as well.
Can I dual boot with Windows or other operating systems?
Attempting to boot Windows from GRUB Legacy or LILO only shows a black screen. What should I do?
This is a known problem and only applies to older bootloaders such as GRUB Legacy and LILO. Windows refuses to boot when it is not installed on the first hard drive and shows a black/blank screen. To handle this, it is necessary to "fool" Windows into believing that it is installed on the first hard drive with a little tweak in the boot loader configuration. Please note that in the below example, Gentoo is installed on /dev/sda (first disk) and Windows on /dev/sdb (second disk). Adjust the configuration as needed:
title Windows XP map (hd1) (hd0) map (hd0) (hd1) rootnoverify (hd1,0) chainloader +1
The above example is for GRUB Legacy bootloader, not GRUB2. For information on how to dual boot Windows with GRUB2 see the GRUB2 article.
other=/dev/sdb1 label=WindowsXP table=/dev/sdb map-drive = 0x80 to = 0x81 map-drive = 0x81 to = 0x80
This will make Windows believe it is installed on the first hard drive and boot without problems. More information can be found in official GRUB documentation and in man lilo.conf.
How do I install Gentoo using a stage1 or stage2 tarball?
The Gentoo Handbook only describes a Gentoo installation using a stage3 tarball. However, Gentoo still provides stage1 and stage2 tarballs. This is for development purposes (the Release Engineering team starts from a stage1 tarball to obtain a stage3) but should not be used by users: a stage3 tarball can very well be used to bootstrap the system. A working Internet connection is a requirement.
Bootstrapping means building the toolchain (the C library and compiler) for the system after which all core system packages are installed. To bootstrap the system, perform a stage3 installation. Before starting the chapter on Configuring the Kernel, it might be necessary to modify the bootstrap.sh script to match personal requirements:
After modifications, run the script.
Next, rebuild all core system packages with the newly built toolchain. We need to rebuild them since the stage3 tarball already offers them:
emerge -e system
Now continue with Configuring the Kernel.
In what form are the packages stored?
Packages are not "stored" per se. Instead, Gentoo provides a set of scripts which can resolve dependencies, fetch source code, and compile a version of the package tailored to the user's needs. Generally Gentoo only builds binaries for releases and snapshots. The Gentoo Developer Manual covers the contents of an ebuild script in detail.
For full ISO releases, a full suite of binary packages will be created using an enhanced .tbz2 format, which is .tar.bz2 compatible with meta-information attached to the end of the file. These can be used to install a working (though not fully optimized) version of the package quickly and efficiently.
It is possible to create RPMs (Red Hat package manager files) using Gentoo's Portage, but it is not currently possible to use existing RPMs to install packages.
I want to perform the ./configure step myself. Can I?
Yes, but it is not trivial, nor is it recommended. Since the method to do this requires a good understanding of Portage internals and commands, it is instead recommended that the ebuild is patched to do whatever it is that the user wants and place it in a Portage overlay (that is why overlays exist). This is much better for maintainability, and usually easier. See the Gentoo Developer Manual for more information.
What if rsync does not work for me?
When behind a firewall that does not permit rsync traffic through port 873, the emerge-webrsync command can be used to fetch and install a Portage snapshot through regular HTTP. See this section for information on downloading source files and Portage snapshots via a proxy.
I have a slow (or no) Internet connection at home. Can I download sources somewhere else and add them to my system?
Definitely. Run emerge --pretend package/atom to see what programs are going to be installed. To find out the sources for those packages and where to download the sources from, run emerge -fp package/atom. Download sources and bring them on any media home. Put the sources into the /usr/portage/distfiles/ folder and then simply run emerge package/atom. Be warned: this can be a very tedious process.
Source tarballs are collecting in /usr/portage/distfiles/. Is it safe to delete these files?
Deleting these files will have no negative impact on day-to-day performance. However, it might be wise to keep the most recent version of the files; often several ebuilds will be released for the same version of a specific piece of software. If the archive is deleted and the software is upgraded or rebuilt it will be necessary to download them from the Internet again.
Use the eclean script from app-portage/gentoolkit to manage the contents of /usr/portage/distfiles/ and a few other locations. Please read man eclean to learn more about its usage, as well as the Gentoolkit article.
What is in /var/tmp/portage? Is it safe to delete the files and directories in /var/tmp/portage?
During compilation, Gentoo saves the sources of the package in /var/tmp/portage. These files and folder are usually deleted upon a successful merge, but this sometimes fails. It is safe to clean out all contents of this directory if the emerge command is not running. Be sure to always pgrep emerge before cleaning out this directory.
How do I set up an International Keyboard Layout?
keymap variable in /etc/conf.d/keymaps. To have console working correctly with extended characters in the keymap, it might be necessary to set up the variables
consoletransation in the /etc/conf.d/consolefont file (for further information on localizing the environment, refer to the localization guide). Then, issue a reboot, or restart the keymaps and consolefont scripts:
DNS name resolution works for root only
/etc/resolv.conf has the wrong permissions; chmod it as follows:
chmod 0644 /etc/resolv.conf
Why can't my user use their own crontab?
Add that user to the cron group:
gpasswd -a <username> cron
How do I get numlock to start on boot?
The following command will add the numlock service to the default runlevel, enabling numlock at boot:
rc-update add numlock default
Each GUI provides different tools for this sort of thing; please check the help section or online manuals for the GUI of choice for further assistance.
How do I have my terminal cleared when I log out?
To have the terminal cleared, add the clear command to the user's ~/.bash_logout script:
echo clear >> ~/.bash_logout
To have this happen automatically when adding a new user, do the same for the /etc/skel/.bash_logout file:
echo clear >> /etc/skel/.bash_logout
ReiserFS and filesystem corruption issues - how to fix them, etc
If the ReiserFS partition is corrupt, try booting the Gentoo Install CD and run reiserfsck --rebuild-tree on the corrupted filesystem. This should make the filesystem consistent again, although there may be some lost files or directories due to the corruption.
Where can I report bugs?
How often are new releases made?
Gentoo's packages are usually updated shortly after the upstream authors release new code. As for when Gentoo itself makes new stage/profile/ISO releases, check the Release Engineering Project page. New releases are announced on the gentoo-announce mailing list. See this section for more information.
My speaker beeps like crazy. How do I disable console beeps?
Console beeps can be turned off using setterm, like this:
setterm -blength 0
To turn off the console beeps on boot, put the following command in the /etc/conf.d/local.start file. However, this only disables beeps for the current terminal. To disable beeps for other terminals, pipe the command output to the target terminal, like this:
setterm -blength 0 > /dev/vc/1
Replace /dev/vc/1 with the terminal for which console beeps need to be disabled.
Where can I find more information about Gentoo Linux?
Much of the official Gentoo documentation can be found here on the Wiki.
Can I buy a CD of Gentoo Linux?
Users who are not able to download and burn installation CDs personally might find one through one of our licensed stores. However, most stores have dropped offering CDs and DVDs as these installation media quickly become obsolete.
The licensed stores are listed on the stores page.
This FAQ has not answered my question. What do I do now?A good first step is to browse through the relevant documentation, failing that, the various Gentoo Linux mailing lists listed here. If all else fails, or to just hang out with Gentoo folks, visit us on the #gentoo Freenode IRC channel.
This article is based on a document formerly found on our main website gentoo.org.
The following people contributed to the original document: Daniel Robbins, Colin Morey, John P. Davis, Eric Stockbridge, Stoyan Zhekov, Carl Anderson, Jorge Paulo, Benny Chuang, Jonathan Smith, nightmorph
They are listed here as the Wiki history does not allow for any external attribution. If you edit the Wiki article, please do not add yourself here; your contributions are recorded on the history page.