「64ビット環境に32ビット環境をインストール」の版間の差分
(ページの作成:「Category:Arch の入手とインストール cs:Install bundled 32-bit system in 64-bit system en:Install bundled 32-bit system in 64-bit system fr:Install...」) |
Kusakata.bot (トーク | 投稿記録) 細 (文字列「http://xyne.archlinux.ca/」を「https://xyne.archlinux.ca/」に置換) |
||
(2人の利用者による、間の5版が非表示) | |||
3行目: | 3行目: | ||
[[en:Install bundled 32-bit system in 64-bit system]] |
[[en:Install bundled 32-bit system in 64-bit system]] |
||
[[fr:Install environnement 32 sur un systeme 64]] |
[[fr:Install environnement 32 sur un systeme 64]] |
||
− | [[zh- |
+ | [[zh-hans:Install bundled 32-bit system in 64-bit system]] |
この記事では32ビットのアプリケーションを動作させる一つの方法を説明しています。multilib リポジトリから lib32-* ライブラリをインストールする代わりに32ビットのアプリケーションを分離させます。この方法では "chroot 監獄" を作成して32ビットのアプリを管理します。 |
この記事では32ビットのアプリケーションを動作させる一つの方法を説明しています。multilib リポジトリから lib32-* ライブラリをインストールする代わりに32ビットのアプリケーションを分離させます。この方法では "chroot 監獄" を作成して32ビットのアプリを管理します。 |
||
− | {{Tip|1=Xyne |
+ | {{Tip|1=Xyne が下記のように 32ビットの chroot に最小インストールするパッケージを作成しています。詳しくは [https://bbs.archlinux.org/viewtopic.php?id=97629] や [https://xyne.archlinux.ca/projects/arch32-light] を見て下さい。}} |
== インストール == |
== インストール == |
||
19行目: | 19行目: | ||
# sed -e 's@/etc/pacman.d/mirrorlist@/opt/arch32/mirrorlist@g' -e '/Architecture/ s,auto,i686,' /etc/pacman.conf > /opt/arch32/pacman.conf |
# sed -e 's@/etc/pacman.d/mirrorlist@/opt/arch32/mirrorlist@g' -e '/Architecture/ s,auto,i686,' /etc/pacman.conf > /opt/arch32/pacman.conf |
||
+ | *これらのファイルは (後でインストールする) 通常の pacman ファイルと衝突します。 |
||
− | *These files would conflict with the normal pacman files, which will be installed in the later steps. |
||
+ | *そのため一時的な場所に保存する必要があります (上記では {{ic|/opt/arch32}} を使用)。 |
||
− | *For this reason they must be put ''into'' a temporary location ({{ic|/opt/arch32}} is used here). |
||
− | * |
+ | *multilib リポジトリを有効にしている場合は {{ic|/opt/arch32/pacman.conf}} ファイルで無効化しておいてください。 |
3. ディレクトリを作成: |
3. ディレクトリを作成: |
||
35行目: | 35行目: | ||
# pacman --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg --config /opt/arch32/pacman.conf -S base base-devel |
# pacman --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg --config /opt/arch32/pacman.conf -S base base-devel |
||
+ | (任意) 他のマシンの chroot でコンパイルをするときはお好きなテキストエディタと distcc を追加してください: |
||
− | Optionally add your favorite text editor and distcc if you plan to compile within the chroot with other machines: |
||
# pacman --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg --config /opt/arch32/pacman.conf -S base base-devel sudo vim distcc |
# pacman --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg --config /opt/arch32/pacman.conf -S base base-devel sudo vim distcc |
||
+ | (任意) pacman のミラーリストを移動して下さい: |
||
− | Optionally move the pacman mirror list into place: |
||
# mv /opt/arch32/mirrorlist /opt/arch32/etc/pacman.d |
# mv /opt/arch32/mirrorlist /opt/arch32/etc/pacman.d |
||
49行目: | 49行目: | ||
# for i in passwd* shadow* group* sudoers resolv.conf localtime locale.gen vimrc mtab inputrc profile.d/locale.sh; do cp -p /etc/"$i" /opt/arch32/etc/; done |
# for i in passwd* shadow* group* sudoers resolv.conf localtime locale.gen vimrc mtab inputrc profile.d/locale.sh; do cp -p /etc/"$i" /opt/arch32/etc/; done |
||
− | + | ビルドする前に {{ic|/opt/arch32/etc/makepkg.conf}} で MAKEFLAGS などの値を正しく定義してください。 |
|
=== デーモンと systemd サービス === |
=== デーモンと systemd サービス === |
||
153行目: | 153行目: | ||
# chroot /opt/arch32 |
# chroot /opt/arch32 |
||
+ | 通常の環境との区別がつくように32ビットの chroot 環境では bash プロンプトをカスタマイズすることを推奨します。例えば、{{ic|~/.bashrc}} で定義する ''PS1'' 変数に ''ARCH32'' という文字列を追加します。Debian のデフォルトの .bashrc プロンプトは作業ディレクトリが chroot の中かどうか表示するようになっています。 |
||
− | It is recommended to use a custom bash prompt inside the 32-bit chroot installation in order to differentiate from the regular system. You can, for example, add a ''ARCH32'' string to the ''PS1'' variable defined in {{ic|~/.bashrc}}. In fact, the default Debian .bashrc prompt string contains appropriate logic to report whether the working directory is within a chroot. |
||
=== 初期設定 === |
=== 初期設定 === |
||
183行目: | 183行目: | ||
aliases=32,default |
aliases=32,default |
||
− | + | (任意) {{ic|/etc/schroot/arch32/mount}} を編集して {{ic|/usr/local/bin/arch32}} で作成されるマウントと一致させます。 |
|
=== Schroot を使って32ビットのアプリケーションを実行 === |
=== Schroot を使って32ビットのアプリケーションを実行 === |
||
+ | chroot の中にあるアプリケーションを呼び出すときは以下のようにします: |
||
− | The general syntax for calling an application ''inside'' the chroot is: |
||
# schroot -p -- htop |
# schroot -p -- htop |
||
+ | 上記の例の場合、htop は32ビット環境から実行されます。 |
||
− | In this example, htop is called from within the 32-bit environment. |
||
== トラブルシューティング == |
== トラブルシューティング == |
||
207行目: | 207行目: | ||
===ビデオ問題=== |
===ビデオ問題=== |
||
+ | ビデオアクセラレーションが必要なアプリケーションを実行したときに以下のように表示される場合: |
||
− | If you get: |
||
X Error of failed request: BadLength (poly request too large or internal Xlib length error) |
X Error of failed request: BadLength (poly request too large or internal Xlib length error) |
||
+ | chroot の中で適切な[[Xorg#ドライバーのインストール|ビデオドライバー]]をインストールしてください。 |
||
− | while trying to run an application that requires video acceleration, make sure you have installed appropriate [[video drivers]] in your chroot. |
||
=== Flash の音声 === |
=== Flash の音声 === |
||
+ | Firefox の Flash プレイヤーから音を流すには、ターミナルを開いて32ビット環境に chroot: |
||
− | To get sound from the flash player in Firefox, open a terminal and chroot inside the 32-bit system: |
||
# chroot /opt/arch32 |
# chroot /opt/arch32 |
||
− | + | そして、[[pacman]]で {{Pkg|alsa-oss}} をインストールします。 |
|
+ | それから以下を入力してください: |
||
− | Then type: |
||
$ export FIREFOX_DSP="aoss" |
$ export FIREFOX_DSP="aoss" |
||
231行目: | 231行目: | ||
For [[Wine]] this works the same way. The package alsa-oss will also install the alsa libs required by [[Wine]] to output sound. |
For [[Wine]] this works the same way. The package alsa-oss will also install the alsa libs required by [[Wine]] to output sound. |
||
+ | == ヒントとテクニック == |
||
− | == Tips and tricks == |
||
=== chroot の Java === |
=== chroot の Java === |
||
+ | [[Java]] を見て下さい。インストール後、パスを設定します: |
||
− | See [[Java]]. After installation, adjust the path: |
||
$ export PATH="/opt/java/bin/:$PATH" |
$ export PATH="/opt/java/bin/:$PATH" |
||
241行目: | 241行目: | ||
=== 32ビットアプリケーションから64ビットの PulseAudio にアクセス === |
=== 32ビットアプリケーションから64ビットの PulseAudio にアクセス === |
||
+ | chroot 環境にパスをバインドマウントする必要があります: |
||
− | Additional paths have to be bind-mounted to the chroot environment: |
||
# mount --bind /var/run /opt/arch32/var/run |
# mount --bind /var/run /opt/arch32/var/run |
||
# mount --bind /var/lib/dbus /opt/arch32/var/lib/dbus |
# mount --bind /var/lib/dbus /opt/arch32/var/lib/dbus |
||
+ | 環境を離れるときはアンマウントしてください: |
||
− | Unmount them when leaving the environment: |
||
# umount /opt/arch32/var/run |
# umount /opt/arch32/var/run |
||
# umount /opt/arch32/var/lib/dbus |
# umount /opt/arch32/var/lib/dbus |
||
− | Optionally add the commands to the {{ic|/usr/local/bin/arch32}} script after the other bind-mount/umount commands. See [[PulseAudio/ |
+ | Optionally add the commands to the {{ic|/usr/local/bin/arch32}} script after the other bind-mount/umount commands. See [[PulseAudio/サンプル#chroot から PulseAudio (e.g. 32-bit chroot in 64-bit install)|PulseAudio from within a chroot]] for details |
=== Firefox の音声 === |
=== Firefox の音声 === |
||
− | + | root で {{ic|/usr/bin/firefox32}} を作成: |
|
#!/bin/sh |
#!/bin/sh |
||
schroot -p firefox $1;export FIREFOX_DSP="aoss" |
schroot -p firefox $1;export FIREFOX_DSP="aoss" |
||
+ | 実行可能属性を付与: |
||
− | Make it executable: |
||
# chmod +x /usr/bin/firefox32 |
# chmod +x /usr/bin/firefox32 |
||
+ | 必要であれば Firefox のエイリアスを作成: |
||
− | Now you can make an alias for Firefox, if desired: |
||
alias firefox="firefox32" |
alias firefox="firefox32" |
||
+ | 上記を {{ic|~/.bashrc}} に追加して source してください。もしくは、デスクトップ環境のランチャーから firefox32 が使われるように変更してもかまいません。 |
||
− | Add this to {{ic|~/.bashrc}} and source it to enable it. Or you can just change all your desktop environment's launchers to firefox32 if you still want 64-bit Firefox to be available. |
||
=== 3D アクセラレーション === |
=== 3D アクセラレーション === |
||
+ | 適切なパッケージをインストールしてください。 |
||
− | You need to install the corresponding package under your "native" arch for 3D support. |
||
+ | グラッフィックアダプタの設定については以下の記事を参照: |
||
− | For information on how to set up your graphic adapter refer to: |
||
* [[ATI]] |
* [[ATI]] |
||
282行目: | 282行目: | ||
=== Wine === |
=== Wine === |
||
+ | Wine をコンパイルするには、32ビット環境をインストールする必要があります。[http://art.ified.ca/?page_id=40 PulseAudio] を動作させるパッチをあてるには Wine のコンパイルが必要です。AUR の {{AUR|wine-hacks}}{{Broken package link|{{aur-mirror|wine-hacks}}}} を見てください。 |
||
− | In order to compile wine, you need a 32-bit system installed. Compiling wine is needed for applying patches in order to get [http://art.ified.ca/?page_id=40 PulseAudio] working. See also {{AUR|wine-hacks}} from AUR. |
||
− | + | 以下のエイリアスを {{ic|~/.bashrc}} に追加: |
|
alias wine='schroot -pqd "$(pwd)" -- wine' |
alias wine='schroot -pqd "$(pwd)" -- wine' |
||
292行目: | 292行目: | ||
=== 印刷 === |
=== 印刷 === |
||
− | {{note|If you have a 64-bit base installation with a |
+ | {{note|If you have a 64-bit base installation with a 32-bit chroot environment, explicit installation of CUPS is not necessary in the 32-bit environment.}} |
+ | chroot 環境からインストール済みの CUPS プリンターにアクセスするには、{{ic|/var/run/cups}} ディレクトリを chroot 環境の同じ場所にバインドする必要があります。 |
||
− | To access installed CUPS printers from the chroot environment, one needs to bind the {{ic|/var/run/cups}} directory to the same (relative) location in the chroot environment. |
||
− | + | chroot 環境に {{ic|/var/run/cups}} ディレクトリが存在することを確認してホストの {{ic|/var/run/cups}} を chroot 環境にバインドマウントしてください: |
|
# mkdir ''chroot32-dir/var/run/cups'' |
# mkdir ''chroot32-dir/var/run/cups'' |
||
# mount --bind /var/run/cups ''chroot32-dir/var/run/cups'' |
# mount --bind /var/run/cups ''chroot32-dir/var/run/cups'' |
||
+ | すぐに32ビットの chroot アプリケーションからプリンターが使えるようになるはずです。 |
||
− | and printers should be available from 32-bit chroot applications immediately. |
2018年2月6日 (火) 23:43時点における最新版
この記事では32ビットのアプリケーションを動作させる一つの方法を説明しています。multilib リポジトリから lib32-* ライブラリをインストールする代わりに32ビットのアプリケーションを分離させます。この方法では "chroot 監獄" を作成して32ビットのアプリを管理します。
目次
インストール
1. ディレクトリを作成:
# mkdir /opt/arch32
2. chroot 用に一時的な pacman の設定ファイルを作成:
# sed -e 's/\$arch/i686/g' /etc/pacman.d/mirrorlist > /opt/arch32/mirrorlist # sed -e 's@/etc/pacman.d/mirrorlist@/opt/arch32/mirrorlist@g' -e '/Architecture/ s,auto,i686,' /etc/pacman.conf > /opt/arch32/pacman.conf
- これらのファイルは (後でインストールする) 通常の pacman ファイルと衝突します。
- そのため一時的な場所に保存する必要があります (上記では
/opt/arch32
を使用)。 - multilib リポジトリを有効にしている場合は
/opt/arch32/pacman.conf
ファイルで無効化しておいてください。
3. ディレクトリを作成:
# mkdir -p /opt/arch32/var/{cache/pacman/pkg,lib/pacman}
4. pacman を同期:
# pacman --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg --config /opt/arch32/pacman.conf -Sy
5. base グループと任意で base-devel グループをインストール:
# pacman --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg --config /opt/arch32/pacman.conf -S base base-devel
(任意) 他のマシンの chroot でコンパイルをするときはお好きなテキストエディタと distcc を追加してください:
# pacman --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg --config /opt/arch32/pacman.conf -S base base-devel sudo vim distcc
(任意) pacman のミラーリストを移動して下さい:
# mv /opt/arch32/mirrorlist /opt/arch32/etc/pacman.d
設定
重要な設定ファイルをコピーしてください:
# for i in passwd* shadow* group* sudoers resolv.conf localtime locale.gen vimrc mtab inputrc profile.d/locale.sh; do cp -p /etc/"$i" /opt/arch32/etc/; done
ビルドする前に /opt/arch32/etc/makepkg.conf
で MAKEFLAGS などの値を正しく定義してください。
デーモンと systemd サービス
/etc/systemd/system/arch32.service
[Unit] Description=32-bit chroot [Service] Type=oneshot RemainAfterExit=yes ExecStart=/usr/local/bin/arch32 start ExecStop=/usr/local/bin/arch32 stop [Install] WantedBy=multi-user.target
/usr/local/bin/arch32
#!/bin/bash ## User variables. MOUNTPOINT=/opt/arch32 ## Set MANAGEPARTITION to any value if /opt/arch32 resides on a separate ## partition and not mounted by /etc/fstab or some other means. ## If /opt/arch32 is part of your rootfs, leave this empty. MANAGEPARTITION= ## Leave USEDISTCC empty unless you wish to use distccd from within the chroot. USEDISTCC= DISTCC_SUBNET='10.9.8.0/24' ## PIDFILE shouldn't need to ba changed from this default. PIDFILE=/run/arch32 start_distccd() { [[ ! -L "$MOUNTPOINT"/usr/bin/distccd-chroot ]] && ln -s /usr/bin/distccd "$MOUNTPOINT"/usr/bin/distccd-chroot DISTCC_ARGS="--user nobody --allow $DISTCC_SUBNET --port 3692 --log-level warning --log-file /tmp/distccd-i686.log" [[ -z "$(pgrep distccd-chroot)" ]] && linux32 chroot "$MOUNTPOINT" /bin/bash -c "/usr/bin/distccd-chroot --daemon $DISTCC_ARGS" } stop_distccd() { [[ -n "$(pgrep distccd-chroot)" ]] && linux32 chroot "$MOUNTPOINT" /bin/bash -c "pkill -SIGTERM distccd-chroot" } case $1 in start) [[ -f "$PIDFILE" ]] && exit 1 if [[ -n "$MANAGEPARTITION" ]]; then mountpoint -q $MOUNTPOINT || mount LABEL="arch32" $MOUNTPOINT fi dirs=(/tmp /dev /dev/pts /home) for d in "${dirs[@]}"; do mount -o bind $d "$MOUNTPOINT"$d done mount -t proc none "$MOUNTPOINT/proc" mount -t sysfs none "$MOUNTPOINT/sys" touch "$PIDFILE" [[ -n "$USEDISTCC" ]] && start_distccd ;; stop) [[ ! -f "$PIDFILE" ]] && exit 1 [[ -n "$USEDISTCC" ]] && stop_distccd if [[ -n "$MANAGEPARTITION" ]]; then umount -R -A -l "$MOUNTPOINT" else dirs=(/home /dev/pts /dev /tmp) [[ -n "$USEDISTCC" ]] && stop_distccd umount "$MOUNTPOINT"/{sys,proc} for d in "${dirs[@]}"; do umount -l "$MOUNTPOINT$d" done fi rm -f "$PIDFILE" ;; *) echo "usage: $0 (start|stop)" exit 1 esac
初期化スクリプトに実行可能属性を付与してください:
# chmod +x /usr/local/bin/arch32
設定
新しい環境に chroot:
# /usr/local/bin/arch32 start $ xhost +SI:localuser:username_to_give_access_to # chroot /opt/arch32
通常の環境との区別がつくように32ビットの chroot 環境では bash プロンプトをカスタマイズすることを推奨します。例えば、~/.bashrc
で定義する PS1 変数に ARCH32 という文字列を追加します。Debian のデフォルトの .bashrc プロンプトは作業ディレクトリが chroot の中かどうか表示するようになっています。
初期設定
ロケールの問題を修正:
# /usr/bin/locale-gen
pacman を初期化:
# sed -i 's/CheckSpace/#CheckSpace/' /etc/pacman.conf # pacman-key --init && pacman-key --populate archlinux
Schroot
schroot をネイティブの64ビット環境にインストール:
/etc/schroot/schroot.conf
を編集して [Arch32] セクションを作成して下さい。
[Arch32] type=directory profile=arch32 description=Arch32 directory=/opt/arch32 users=user1,user2,user3 groups=users root-groups=root personality=linux32 aliases=32,default
(任意) /etc/schroot/arch32/mount
を編集して /usr/local/bin/arch32
で作成されるマウントと一致させます。
Schroot を使って32ビットのアプリケーションを実行
chroot の中にあるアプリケーションを呼び出すときは以下のようにします:
# schroot -p -- htop
上記の例の場合、htop は32ビット環境から実行されます。
トラブルシューティング
コンパイルとインストール
Ensure the desired options are set in the local /etc/makepkg.conf
.
Some packages may require a --host
flag be added to the ./configure script in the PKBUILD:
$ ./configure --host="i686-pc-linux" ...
This is the case when the build makes use of values (for example, the output of the uname
command) inherited from your base system.
ビデオ問題
ビデオアクセラレーションが必要なアプリケーションを実行したときに以下のように表示される場合:
X Error of failed request: BadLength (poly request too large or internal Xlib length error)
chroot の中で適切なビデオドライバーをインストールしてください。
Flash の音声
Firefox の Flash プレイヤーから音を流すには、ターミナルを開いて32ビット環境に chroot:
# chroot /opt/arch32
そして、pacmanで alsa-oss をインストールします。
それから以下を入力してください:
$ export FIREFOX_DSP="aoss"
Every chroot into the 32-bit system will require this export command to be entered so it may be best to incorporate it into a script.
Finally, launch Firefox.
For Wine this works the same way. The package alsa-oss will also install the alsa libs required by Wine to output sound.
ヒントとテクニック
chroot の Java
Java を見て下さい。インストール後、パスを設定します:
$ export PATH="/opt/java/bin/:$PATH"
32ビットアプリケーションから64ビットの PulseAudio にアクセス
chroot 環境にパスをバインドマウントする必要があります:
# mount --bind /var/run /opt/arch32/var/run # mount --bind /var/lib/dbus /opt/arch32/var/lib/dbus
環境を離れるときはアンマウントしてください:
# umount /opt/arch32/var/run # umount /opt/arch32/var/lib/dbus
Optionally add the commands to the /usr/local/bin/arch32
script after the other bind-mount/umount commands. See PulseAudio from within a chroot for details
Firefox の音声
root で /usr/bin/firefox32
を作成:
#!/bin/sh schroot -p firefox $1;export FIREFOX_DSP="aoss"
実行可能属性を付与:
# chmod +x /usr/bin/firefox32
必要であれば Firefox のエイリアスを作成:
alias firefox="firefox32"
上記を ~/.bashrc
に追加して source してください。もしくは、デスクトップ環境のランチャーから firefox32 が使われるように変更してもかまいません。
3D アクセラレーション
適切なパッケージをインストールしてください。
グラッフィックアダプタの設定については以下の記事を参照:
Wine
Wine をコンパイルするには、32ビット環境をインストールする必要があります。PulseAudio を動作させるパッチをあてるには Wine のコンパイルが必要です。AUR の wine-hacksAUR[リンク切れ: アーカイブ: aur-mirror] を見てください。
以下のエイリアスを ~/.bashrc
に追加:
alias wine='schroot -pqd "$(pwd)" -- wine'
The -q
switch makes schroot operate in quiet mode, so it works like "regular" wine does. Also note that If you still use dchroot instead of schroot, you should use switch -d
instead of -s
.
印刷
chroot 環境からインストール済みの CUPS プリンターにアクセスするには、/var/run/cups
ディレクトリを chroot 環境の同じ場所にバインドする必要があります。
chroot 環境に /var/run/cups
ディレクトリが存在することを確認してホストの /var/run/cups
を chroot 環境にバインドマウントしてください:
# mkdir chroot32-dir/var/run/cups # mount --bind /var/run/cups chroot32-dir/var/run/cups
すぐに32ビットの chroot アプリケーションからプリンターが使えるようになるはずです。