1. 程式人生 > >64位ubuntu上安裝32位環境

64位ubuntu上安裝32位環境

基本參照下面的連結:

https://help.ubuntu.com/community/DebootstrapChroot

我是在Ubuntu 11.04(natty)下安裝的, 所以步驟如下:

1 安裝debootstrap 和 schroot 

apt-get install debootstrap
apt-get install schroot

2 建立配置檔案:
touch /etc/schroot/chroot.d/natty32.conf 而後修改其內容為:
[natty32]
type=directory
description=Ubuntu Natty 32bit
directory=/chroot/natty32
root-users=winter,db

users=db,winter
root-groups=root
personality=linux32

執行schroot -l ,輸出結果為:
chroot:natty32

3 執行debootstrap
mkdir /chroot/natty32
而後執行如下命令:

debootstrap --variant=buildd --arch i386 natty /chroot/natty32 http://archive.ubuntu.com/ubuntu/

這一步可能需要檢查網址和代理設定.

4 檢查安裝
schroot -c natty32 後進入natty32環境, 得到的提示符為:
(natty32)[email protected]
:/usr/lib# uname -a

Linux desktop 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC 2011 i686 i686 i386 GNU/Linux

經常還碰到如何在64bit系統中安裝32位libs的問題. 對於屬於ia32-libs的lib而言, 在64bit環境下直接執行 apt-get install ia32-libs 就可以了, 而對於其他, 則比較複雜, 一般的方法都是下載deb的包, 而後用dpkg -i 並制定強制安裝, 但這樣又可能破壞當前系統.

相比而言, 建立一個32bit的虛擬環境看起來是一個更好的方法, 雖然可能帶來冗餘的庫...

This article demonstrates a quick and easy way to create a chroot environment on an Ubuntu computer, which is like having a virtual system without the overhead of actual virtualization.

chroot can be used for things like:

  • Running a 32-bit Firefox browser or a 32-bit Wine bottle on a 64-bit system.
  • Trying an older or newer Ubuntu release without reinstalling the operating system.
  • Trying a Debian release or other distribution derived from Debian.

  • Cross compiling and building packages for a different platform likeLaunchpad or Soyuz does it.

Example Configuration

In this example, we use a current Ubuntu 9.04 Jaunty system (the "host") to create a chroot for the older Ubuntu 8.04 Hardy release (the "target"). We are arbitrarily naming the new chroot environment hardy_i386 and putting it in the /srv/chroot directory on the host system.

Step 1: Install packages on the host computer.

First, install debootstrap, which is a utility that downloads and unpacks a basic Ubuntu system:

 $ sudo apt-get install debootstrap

Second, install schroot, which is a utility that wraps the regular chroot program and automatically manages chroot environments:

 $ sudo apt-get install schroot

Note: The debootstrap utility is usually backwards compatible with older releases, but it may be incompatible with newer releases. For example, the debootstrap that is bundled with Jaunty can prepare a Hardy chroot like we are doing here, but the debootstrap that is bundled with Hardy cannot prepare a Jaunty chroot.

If you have any difficultly with a debootstrap version mismatch, then visit http://packages.ubuntu.com/ to manually download and install thedebootstrap package on the host system from the repository for the target release.

Step 2: Create a configuration file for schroot.

Choose a short name for the chroot, we use hardy_i386 in this example, and create a configuration file for it like this:

  sudo editor /etc/schroot/chroot.d/hardy_i386.conf

Note: In lucid the filename must not contain '.' , it should be lucid_i386_conf.

Put this in the new file:

  [hardy_i386]
  description=Ubuntu 8.04 Hardy for i386
  location=/srv/chroot/hardy_i386
  #personality=linux32
  root-users=bob
  run-setup-scripts=true
  run-exec-scripts=true
  type=directory
  users=alice,bob,charlie

Note: if you copy this example to your clipboard, be careful to start each line in column 1 before you save the new file! If you forget, the commandschroot -l will fail with an error, e.g.E: /etc/schroot/chroot.d/hardy_i386.conf: line 0: Invalid line: “  [hardy_i386]”.

Note: for lucid use directory instead of location, e.g. directory=/srv/chroot/hardy_i386 .

Change these things in the example configuration file to fit your system:

  • location: This should be a directory that is outside of the /home tree. The latest schroot documentation recommends /srv/chroot.

  • personality: Enable this line if the host system is 64-bit running on an amd64/x64 computer and the chroot is 32-bit for i386. Otherwise, leave it disabled.

  • users: These are users on the host system that can invoke the schroot program and get access to the chroot system. Your username on the host system should be here.

  • root-users: These are users on the host system that can invoke the schroot program and get direct access to the chroot system as the root user.

Note: Do not put whitespace around the '=' character, and do not quote strings after the '=' character.

Step 3: Run debootstrap.

This will download and unpack a basic Ubuntu system to the chroot directory, similar to what the host system already has at the real root directory ("/").

 $ sudo mkdir -p /srv/chroot/hardy_i386
 $ sudo debootstrap --variant=buildd --arch=i386 hardy /srv/chroot/hardy_i386 http://archive.ubuntu.com/ubuntu/

This command should work for any distribution that is derived from Debian. Substitute the architecture "i386", the release name "hardy", and the repository address "http://archive.ubuntu.com/ubuntu/" appropriately. For example, do this to get the 64-bit build of Hardy instead of the 32-bit build:

  $ sudo debootstrap --arch=amd64 hardy /srv/chroot/hardy_amd64/ http://archive.ubuntu.com/ubuntu/

Note: Remember to change all instances of hardy_i386 to hardy_amd64 in the configuration file and on the command line if you actually do this.

Do something like this to get an upstream Debian release:

  $ sudo debootstrap --arch=amd64 sid /srv/chroot/sid_amd64/ http://ftp.debian.org/debian/

If trouble arises, debootsrap accepts a --verbose flag that may provide further insight.

Step 4: Check the chroot

This command lists configured chroots:tro

  $ schroot -l

If hardy_i386 appears in the list, then run:

  $ schroot -c hardy_i386 -u root

Note: This should work without using sudo to invoke the schroot program, and it should result in a root prompt in the chroot environment.

Check that the root prompt is in a different system:

  # lsb_release -a

For the Hardy system that we just built, the lsb_release command should print:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 8.04
Release:        8.04
Codename:       hardy

We're done!

WARNING

For convenience, the default schroot configuration rebinds the /home directory on the host system so that it appears in the chroot system. This could be unexpected if you are familiar with the older dchroot program or the regular chroot program because it means that you can accidentally delete or otherwise damage things in /home on the host system.

To change this behavior run:

  $ sudo editor /etc/schroot/mount-defaults

And disable the /home line so that the file reads:

  # mount.defaults: static file system information for chroots.
  # Note that the mount point will be prefixed by the chroot path
  # (CHROOT_PATH)
  #
  # <file system> <mount point>   <type>  <options>       <dump>  <pass>
  proc            /proc           proc    defaults        0       0
  /dev/pts        /dev/pts        none    rw,bind         0       0
  tmpfs           /dev/shm        tmpfs   defaults        0       0
  #/home           /home           none    rw,bind         0       0
  /tmp            /tmp            none    rw,bind         0       0

The mount.defaults file is the /etc/fstab for chroot environments.

Hints

Install the ubuntu-minimal package in a new chroot after you create it:

  $ schroot -c hardy_i386 -u root
  # apt-get install ubuntu-minimal

If you get locale warnings in the chroot like "Locale not supported by C library." or "perl: warning: Setting locale failed." , then try one or more of these commands:

  $ sudo dpkg-reconfigure locales
  $ sudo apt-get install language-pack-en
  $ locale-gen en_US.UTF-8

If your preferred language is not English, then change "-en" and "en_US" appropriately.

As of Lucid, schroot has changed in these ways:

  • The file should be named: /etc/schroot/chroot.d/hardy-i386

  • The keywords in the file have changed and some have been deprecated. Additionally, keywords have to start at the beginning of the line. The file should read:
  [hardy-i386]
  description=Ubuntu 8.04 Hardy for i386
  directory=/srv/chroot/hardy-i386
  #personality=linux32
  root-users=bob
  type=directory
  users=alice,bob,charlie

As of Maverick schroot has further changed in these ways:

  • The configuration file should be stored in /etc/schroot/

TLDR

There's a much simplier way to get a basic chroot environment from an ISO image; if the text above seems TLDR, try this.

First of all, install Ubuntu Customization Kit:

  $ sudo apt-get install uck

Then set the directory in which you want to create the chroot environment:

  $ export BASEDIR=/path/to/chroot/directory/

Unpack the ISO image (this may take quite some time):

  $ sudo uck-remaster-unpack-iso /path/to/your/image.iso "$BASEDIR" && sudo uck-remaster-unpack-rootfs "$BASEDIR" && sudo uck-remaster-unpack-initrd "$BASEDIR"

You're done! Now, to enter the chroot environment, just execute

  $ sudo uck-remaster-chroot-rootfs /path/to/chroot/directory/

every time you wish to enter the chroot console. To leave it, type "exit".

To be able to run X applications, e.g. gedit, run

  # HOME=/root

in the chroot environment.


相關推薦

64ubuntu安裝32環境

基本參照下面的連結:https://help.ubuntu.com/community/DebootstrapChroot我是在Ubuntu 11.04(natty)下安裝的, 所以步驟如下:1 安裝debootstrap 和 schroot apt-get install

64ubuntu無法安裝32軟體,或者是執行32.run等檔案,出現`no such file or directory`問題

64位系統是能安裝32位的應用軟體和程式的,出現問題,最大可能是沒有安裝 32位的依賴庫,或者是安裝的32位依賴庫不對。 linux一般都是在/etc/dpkg/dpkg.cfg.d/路徑下有相關的檔

64ubuntu下使用32軟體時,明明設定好了環境變數仍提示找不到檔案

[email protected]:~$ arm-linux-gcc -v Reading specs from /home/kanata/armlinux/bin/../lib/gcc/arm-linux/3.4.5/specs Configured with: /work/tools/creat

64ubuntu下編譯32彙編程式(同時連結C庫)

cmd.s如下://.include "linux.s" .section .data output1: .ascii "There are %d parameters:\n\0" //output2: // .ascii "%s/0" .section .text

Linux在64執行32程式(安裝32庫:rpm、deb)

記錄: ------------------------------------------------------------------- centos7.x 安裝了glibc:glibc-2.17-157.el7.i686 glibc-2.17 nodeps安裝,即可

Win7安裝32Oracle客戶端錯誤解決方法:[INS-30131] 執行安裝程式驗證所需的初始設定失敗

當需要在Win7上安裝32位的Oracle客戶端時,有時會出現以下錯誤: 解決方法如下: 1.首先將“控制面板\所有控制面板項\管理工具\服務\SERVER”這一個服務啟動。如下圖: 2.開啟“

64 Ubuntu下用32 的Qt GCC 編譯程式

一、多架構支援1.確認64位架構的核心輸入dpkg --print-architecture顯示 amd64 確認為64位架構核心2.確認開啟多架構支援功能(出現32位依賴問題時,安裝32位的包)輸入dpkg --print-foreign-architectures顯示 i

64作業系統執行32的程式

執行 32 位程式 WOW64 子系統使 32 位程式能夠在基於 x64 版本的 Windows Server 2003 和 Windows XP 專業 x64 版的執行而不用修改。WOW64 子系統是通過在基於 x64 版本的 Windows Server 2003 和

win8 X64安裝32Oracle Instant Client(即時客戶端) 安裝與配置

一、下載 這是Oracle Instant Client的下載首頁,有很多種版本可供下載。 但要注意第三方工具如:PL/SQL Developer和Toad的版本,32位的要對應32位的OracleInstant Client,不要因為系統是64位的就下載64位的,

64ubuntu 14.04 開展32Qt 程式開發環境配置(pro檔案中增加 QMAKE_CXXFLAGS += -m32 命令)

為了能中一個系統上開發64或32位C++程式,費了些周折,現在終於能夠開始幹過了。在此記錄此時針對Q5.4版本的32位開發環境配置過程。 1. 下載Qt 5.4 的32位版本,進行安裝,安裝過程中會發現一些32位的庫沒有安裝,根據提示的錯誤逐個安裝上即可。 2. 開啟一個SampleCode 中的cube

64Kali和Ubuntu安裝32執行環境和編譯環境

kali 安裝32位執行環境 這裡使用kali的原始更新源,使用命令: leafpad /etc/apt/sources.list 在文字中輸入: deb http://http.

無法安裝64office,因為您的PC32

edit all 展開 運行 roo 開頭 office clas 文件 場景:安裝visio2013時,突然報以下錯誤 解決方案: 1. 單擊開始--所有程序--附件--運行,在運行輸入“regedit“ 2. 彈出註冊表編輯器窗口,選擇HKEY_CLASSES_ROO

Ubuntu 64安裝32執行庫

 學嵌入式時安裝了 Ubuntu 16.04 x64 ,安裝交叉編譯工具鏈的時候出了問題: $ ./arm-none-linux-gnueabi-gcc -v -bash: ./arm-none-linux-gnueabi-gcc: No such file or director

【遠端登入】64Ubuntu安裝32teamviewer及安裝配置SecureCRT

  一、64位Ubuntu安裝32位teamviewer   步驟:   (1)下載teamviewer。在Ubuntu系統下開啟瀏覽器去teamviewer官網,選擇Linux的Ubuntu版本下的

Ubuntu 14.04 (32)搭建Hadoop 2.5.1單機和偽分散式環境

引言 一直用的Ubuntu 32位系統(準備下次用Fedora,Ubuntu越來越不適合學習了),今天準備學習一下Hadoop,結果下載Apache官網上釋出的最新的封裝好的2.5.1版,配置完了根本啟動不起來,檢視錯誤日誌發現是native庫的版本和系統不一致,使用fil

Ubuntu 14.04 64安裝32相容包

問題描述我的作業系統是64bit版的Ubuntu 14.04,很多32bit的軟體無法安裝使用,因此希望通過安裝32位相容包解決。安裝過程在Ubuntu 13.10之前,可以通過安裝 ia32-libs 來支援32位軟體。但是,該版本之後,Ubuntu就去掉了。不過可以通過安

【轉載】64Win7下成功安裝64的Oracle、32的InstantClient和PLSQL Developer

註銷 五步 ldb 需要 windows inf 目錄 登錄 class 感謝原作者,原文鏈接:https://wenku.baidu.com/view/433d0b544a7302768f993926.html 經實際安裝操作,通過以下步驟能夠成功地把Oracle安裝到

在Win7 64電腦安裝Sql Server 2008 R2 Express

技術分享 下載網址 com 操作系統 參考 默認 title 安裝 英文 安裝環境說明: 操作系統:Win7 64位 英文版 安裝步驟: 1、準備安裝文件 下載網址:https://www.microsoft.com/zh-CN/download/detai

8.Ubuntu安裝32依賴

軟件 使用 ia32 post 軟件包 sudo命令 sta 支持 all Ubuntu16.04版本已不支持ia32-libs的軟件包,而是使用了lib32ncurses5、lib32z1軟件包做為替代,所以在Ubuntu16.04版本當中應該安裝執行: apt-get

嘗試加載 Oracle 客戶端庫時引發 BadImageFormatException。如果在安裝 32 Oracle 客戶端組件的情況下以 64 模式運行,將出現此問題

orm 項目 inf article res info csdn 題解 cep 解決辦法: 原因:VS2013生成的網站,裏面有個地方調用32位的DLL文件,放到64位的服務器上提示錯誤“System.BadImageFormatException: 試圖