![在 Xubuntu 14.04 上的 Gentoo chroot 中挂载 /dev/shm](https://linux22.com/image/1433959/%E5%9C%A8%20Xubuntu%2014.04%20%E4%B8%8A%E7%9A%84%20Gentoo%20chroot%20%E4%B8%AD%E6%8C%82%E8%BD%BD%20%2Fdev%2Fshm.png)
我正在尝试安装 Gentoo,但我没有使用 Gentoo 提供的可启动最小安装 CD,而是在 Ubuntu 中使用 chroot。我主要遵循此处概述的说明,http://www.wikihow.com/Install-Gentoo-Linux-from-Ubuntu但每当我需要时我也会参考本指南。https://wiki.gentoo.org/wiki/Handbook:AMD64
现在,我决定引导我的安装以获得最佳性能,在经历了一些初始问题之后,我已经到了应该运行“emerge -e system”的地步。每当我这样做时,它都会失败并出现以下错误:
* configure has detected that the sem_open function is broken.
* Please ensure that /dev/shm is mounted as a tmpfs with mode 1777.
* ERROR: dev-lang/python-2.7.7::gentoo failed (configure phase):
* Broken sem_open function (bug 496328)
*
* Call stack:
* ebuild.sh, line 93: Called src_configure
* environment, line 3892: Called die
* The specific snippet of code:
* die "Broken sem_open function (bug 496328)";
*
* If you need support, post the output of `emerge --info '=dev-lang/python-2.7.7::gentoo'`,
* the complete build log and the output of `emerge -pqv '=dev-lang/python-2.7.7::gentoo'`.
* The complete build log is located at '/var/tmp/portage/dev-lang/python-2.7.7/temp/build.log'.
* The ebuild environment file is located at '/var/tmp/portage/dev-lang/python-2.7.7/temp/environment'.
* Working directory: '/var/tmp/portage/dev-lang/python-2.7.7/work/x86_64-pc-linux-gnu'
* S: '/var/tmp/portage/dev-lang/python-2.7.7/work/Python-2.7.7'
>>> Failed to emerge dev-lang/python-2.7.7, Log file:
>>> '/var/tmp/portage/dev-lang/python-2.7.7/temp/build.log'
* Messages for package sys-apps/sysvinit-2.88-r7:
* The last/lastb/mesg/mountpoint/sulogin/utmpdump/wall tools have been moved to
* sys-apps/util-linux. The pidof tool has been moved to sys-process/procps.
* Messages for package dev-libs/glib-2.40.0-r1:
* Unable to find kernel sources at /usr/src/linux
* Unable to calculate Linux Kernel version for build, attempting to use running version
* Messages for package dev-lang/python-2.7.7:
* configure has detected that the sem_open function is broken.
* Please ensure that /dev/shm is mounted as a tmpfs with mode 1777.
* ERROR: dev-lang/python-2.7.7::gentoo failed (configure phase):
* Broken sem_open function (bug 496328)
*
* Call stack:
* ebuild.sh, line 93: Called src_configure
* environment, line 3892: Called die
* The specific snippet of code:
* die "Broken sem_open function (bug 496328)";
*
* If you need support, post the output of `emerge --info '=dev-lang/python-2.7.7::gentoo'`,
* the complete build log and the output of `emerge -pqv '=dev-lang/python-2.7.7::gentoo'`.
* The complete build log is located at '/var/tmp/portage/dev-lang/python-2.7.7/temp/build.log'.
* The ebuild environment file is located at '/var/tmp/portage/dev-lang/python-2.7.7/temp/environment'.
* Working directory: '/var/tmp/portage/dev-lang/python-2.7.7/work/x86_64-pc-linux-gnu'
* S: '/var/tmp/portage/dev-lang/python-2.7.7/work/Python-2.7.7'
以下是 emerge --info '=dev-lang/python-2.7.7::gentoo' 的输出:
Portage 2.2.14 (python 2.7.7-final-0, default/linux/amd64/13.0/desktop, gcc-4.8.3, glibc-2.19-r1, 3.17.2-zen-liquorix-**************-**** x86_64)
=================================================================
System Settings
=================================================================
System uname: Linux-3.17.2-zen-liquorix-**************-****-x86_64-Intel-R-_Core-TM-2_Duo_CPU_E8500_@_3.16GHz-with-gentoo-2.2
KiB Mem: 8180452 total, 5912720 free
KiB Swap: 8386556 total, 8386556 free
Timestamp of tree: Sat, 13 Dec 2014 21:30:01 +0000
ld GNU ld (Gentoo 2.24 p1.4) 2.24
app-shells/bash: 4.2_p45
dev-lang/perl: 5.18.2-r1
dev-lang/python: 2.7.7, 3.3.5-r1
dev-util/pkgconfig: 0.28-r1
sys-apps/baselayout: 2.2
sys-apps/openrc: 0.12.4
sys-apps/sandbox: 2.6-r1
sys-devel/autoconf: 2.69
sys-devel/automake: 1.13.4
sys-devel/binutils: 2.24-r3
sys-devel/gcc: 4.8.3
sys-devel/gcc-config: 1.7.3
sys-devel/libtool: 2.4.2-r1
sys-devel/make: 3.82-r4
sys-kernel/linux-headers: 3.16 (virtual/os-headers)
sys-libs/glibc: 2.19-r1
Repositories: gentoo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -msse4.1 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=core2 -msse4.1 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://gentoo.arcticnetwork.ca/ http://gentoo.gossamerhost.com/ rsync://gentoo.gossamerhost.com/gentoo-distfiles/ http://mirror.the-best-hosting.net/ ftp://mirrors.tera-byte.com/pub/gentoo http://gentoo.mirrors.tera-byte.com/ rsync://mirrors.tera-byte.com/gentoo ftp://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ http://mirror.csclub.uwaterloo.ca/gentoo-distfiles/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
USE="X a52 aac acl acpi alsa amd64 berkdb bindist bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gif glamor gpm gtk iconv ipv6 jpeg lcms ldap libnotify mad mmx mng modules mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds qt3support qt4 readline sdl session spell sse sse2 sse3 sse4_1 ssl ssse3 startup-notification svg tcpd tiff truetype udev udisks unicode upower usb vorbis wxwidgets x264 xcb xml xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC, USE_PYTHON
=================================================================
Package Settings
=================================================================
dev-lang/python-2.7.7 was built with the following:
USE="gdbm ipv6 ncurses readline ssl threads (wide-unicode) xml -berkdb -build -doc -examples -hardened -sqlite -tk -wininst" ABI_X86="64"
CFLAGS="-O2 -pipe -fwrapv"
CXXFLAGS="-O2 -pipe -fwrapv"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -L."
对于我的 chroot 环境,我使用以下挂载命令:
sudo mount /dev/sda4 /mnt/gentoo
sudo mount -t proc none /mnt/gentoo/proc
sudo mount --rbind /sys /mnt/gentoo/sys
sudo mount --rbind /dev /mnt/gentoo/dev
尽管我已经弄清楚了如何在 Ubuntu 中编译自己的内核,但我仍然是 Linux 的新手。事实上,我昨天才了解 /dev/shm。我还了解到在 Ubuntu 上,/dev/shm 只是 /run/shm 的一个链接,所以这可能是我遇到困难的原因。我实际上也尝试过挂载 /run/shm,但无济于事。
如果有人知道如何正确挂载 /dev/shm,那就太好了。
答案1
从父环境中,mount --bind /dev/shm /mnt/gentoo/dev/shm
或者这是我们对 Gentoo Infra 使用的调用:
echo /dev /dev/shm /dev/pts /proc /sys /run |xargs -n1 |xargs -I{} mount -o bind {} /mnt/gentoo/{}