Archiso (简体中文)

From ArchWiki
Revision as of 14:29, 27 June 2014 by 469377116 (talk | contribs)
Jump to navigation Jump to search

zh-CN:Archiso “Archiso”是一个能够建立功能全面的基于Arch Linux的Live CD和USB映像的bash脚本小工具。它是用来生成正式的CD / USB镜像的工具,但它是一个非常实用的工具,它可以被用来生成救援系统,安装盘,以及含有特殊利益的live CD/ DVD / USB系统和其他。简单地说,如果要将Arch放入其他可移动设备,它可以帮你做到这一点。 Archiso的核心,是mkarchiso。它的所有选项都记录在它的用法输出,所以mkarchiso的直接使用方法将不在这里讨论。相反,这篇wiki文章将在任何时候教你使用Archiso。




注意: 以下操作请在ROOT权限下使用,在错误的权限下操作会造成一下问题.

当我们开始之前, 我们需要 install archisoofficial repositories. 另外, archiso-gitAUR 能在 AUR中找到.

创建一个用于工作的目录, 实时镜像将会在这里被处理: ~/archlive 需要做精.

$ mkdir ~/archlive


Archiso 配置了2个"profiles": relengbaseline.

如果您想要创建完全定制的Live Arch Linux,预安装所有您最喜爱的程序和配置,使用 ' releng '。


所以根据你的需要来决定使用 releng 还是baseline作为基础配置文件 .

# cp -r /usr/share/archiso/configs/PROFILE/ ~/archlive

如果你要使用 releng 配置文件来定制一个完全自定义的Live介质,那么你可以继续到:#配置我们的Live介质.




更改到我们早些时候创建的目录 (~/archlive/releng/ 如果你一直按照本向导在执行), 你将会看到大量的文件和目录 ; 我们只关注这些,主要是: packages.* -这是你列出一行一行你想要安装的包的地方, 和 根映像目录- 这是一个覆盖目录,你将在这里完成所有的定制工作。

一般来说,每一个管理任务,你通常会经过全新安装,除了安装程序包做可以编写脚本为 ~/archlive/releng/root-image/root/ 它必须从新环境的角度写入, 所以脚本中的 / 意味着已被创建的Live ISO的根.


你会想在你的CD系统上创建一个你想安装的包的列表. 一个全是文件名列表的文件. 这是含有巨大特殊利益的Live CD,只需在packages.both指定你想要的包和烧录的镜像。 The packages.i686 和 packages.x86_64 文件允许你分别只在32位还是64位安装文件。

若你准备在没有互联网连接的设备上安装系统,我建议你安装"rsync",要不然就重新跳过下载它. (#安装)


Merge-arrows-2.pngThis article or section is a candidate for merging with Pacman tips#自定义本地库.Merge-arrows-2.png

Notes: 移动一般信息 (e.g. repo tree) 到主文章. (Discuss in Talk:Archiso (简体中文)#)

你也可以 创建自定义本地资源库AUR/ABS准备自定义包. 当这样处理这两种架构的软件包,您应该遵循一定的目录顺序,才不会出现问题。 例如

  • ~/customrepo
    • ~/customrepo/x86_64
      • ~/customrepo/x86_64/foo-x86_64.pkg.tar.xz
      • ~/customrepo/x86_64/customrepo.db.tar.gz
      • ~/customrepo/x86_64/customrepo.db (symlink created by repo-add)
    • ~/customrepo/i686
      • ~/customrepo/i686/foo-i686.pkg.tar.xz
      • ~/customrepo/i686/customrepo.db.tar.gz
      • ~/customrepo/i686/customrepo.db (symlink created by repo-add)

然后您可以添加您的存储库把下列句子变成 ~/archlive/releng/pacman.conf, 上面的其他存储库条目 (优先):

# custom repository
SigLevel = Optional TrustAll
Server = file:///home/user/customrepo/$arch



error: failed to prepare transaction (package architecture is not valid)
:: package foo-i686 does not have a valid architecture


(为保证文章的准确性,本节使用英文原文) By, default /usr/bin/mkarchiso, a script which is used by ~/archlive/releng/, calls one of the arch-install-scripts named pacstrap without the -i flag, which causes Pacman to not wait for user input during the installation process.

When blacklisting base group packages by adding them to the IgnorePkg line in ~/archlive/releng/pacman.conf, Pacman asks if they still should be installed, which means they will when user input is bypassed. To get rid of these packages there are several options:

  • Dirty: Add the -i flag to each line calling pacstrap in /usr/bin/mkarchiso.
  • Clean: Create a copy of /usr/bin/mkarchiso in which you add the flag and adapt ~/archlive/releng/ so that it calls the modifed version of the mkarchiso script.
  • Advanced: Create a function for ~/archlive/releng/ which explicitly removes the packages after the base installation. This would leave you the comfort of not having to type enter so much during the installation process.


用户管理可以在正常的安装过程中用相同的方式处理,除了你把你的命令脚本放到 ~/archlive/releng/root-image/root/ 详情参阅 用户管理.


Note: You must be root to do this, do not change the ownership of any of the files you copy over, everything within the root-image directory must be root owned. Proper ownerships will be sorted out shortly.

The root-image directory acts as an overlay, think of it as root directory '/' on your current system, so any files you place within this directory will be copied over on boot-up.

So if you have a set of iptables scripts on your current system you want to be used on you live image, copy them over as such:

# cp -r /etc/iptables ~/archlive/releng/root-image/etc

Placing files in the users home directory is a little different. Do not place them within root-image/home, but instead create a skel directory within root-image/ and place them there. We will then add the relevant commands to the which we are going to use to copy them over on boot and sort out the permissions.

First, create the skel directory; making sure you are within ~/archlive/releng/root-image/etc directory (if this is where you are working from):

# cd ~/archlive/releng/root-image/etc && mkdir skel

Now copy the 'home' files to the skel directory, again doing everything as root! e.g for .bashrc.

# cp ~/.bashrc ~/archlive/releng/root-image/etc/skel/

When ~/archlive/releng/root-image/root/ is executed and a new user is created, the files from the skel directory will automatically be copied over to the new home folder, permissions set right.


The default file should work fine, so you should not need to touch it.

The aitab file holds information about the filesystems images that must be created by mkarchiso and mounted at initramfs stage from the archiso hook. It consists of some fields which define the behaviour of images.

# <img>         <mnt>                 <arch>   <sfs_comp>  <fs_type>  <fs_size>
Image name without extension (.fs .fs.sfs .sfs).
Mount point.
Architecture { i686 | x86_64 | any }.
SquashFS compression type { gzip | lzo | xz }.
Set the filesystem type of the image { ext4 | ext3 | ext2 | xfs | btrfs }. A special value of "none" denotes no usage of a filesystem. In that case all files are pushed directly to SquashFS filesystem.
An absolute value of file system image size in MiB (example: 100, 1000, 4096, etc) A relative value of file system free space [in percent] {1%..99%} (example 50%, 10%, 7%). This is an estimation, and calculated in a simple way. Space used + 10% (estimated for metadata overhead) + desired %
Note: Some combinations are invalid. Example both sfs_comp and fs_type are set to none


The default file should work fine, so you should not need to touch it.

An initcpio is necessary for creating a system that is able to "wake-up" from a CD/DVD/USB,

The default list will get you a system that can be booted off a CD/DVD or a USB device. It is worth mentioning that hardware auto-detection and things of that nature do not belong here. Only what is necessary to get the system on its feet, and out of the initcpio really belong here, fancier stuff can be done on the booted system anyway.


The default file should work fine, so you should not need to touch it.

Due to the modular nature of isolinux, you are able to use lots of addons since all *.c32 files are copied and available to you. Take a look at the official syslinux site and the archiso git repo. Using said addons, it is possible to make visually attractive and complex menus. See here.


Starting X at boot is done by enabling your login manager's systemd service. If you know which .service file needs a softlink: Great. If not, you can easily find out in case you're using the same program on the system you build your iso on. Just use

# systemctl disable nameofyourloginmanager

to temporarily turn it off. Next type the same command again and replace "disable" with "enable" to activate it again. Systemctl prints information about softlink it creates. Now change to ~/archiso/releng/root-image/etc/systemd/system and create the same softlink there.

An example (make sure you're either in ~/archiso/releng/root-image/etc/systemd/system or add it to the command):

# ln -s /usr/lib/systemd/system/lxdm.service display-manager.service

This will enable LXDM at system start on your live system.


The configuration for getty's automatic login is located under root-image/etc/systemd/system/getty@tty1.service.d/autologin.conf.

You can modify this file to change the auto login user:

ExecStart=-/sbin/agetty --autologin isouser --noclear %I 38400 linux

Or remove it altogether to disable auto login.


Now you are ready to turn your files into the .iso which you can then burn to CD or USB: Inside the directory you are working with, either ~/archlive/releng, or ~/archlive/baseline, execute:

# ./ -v

The script will now download and install the packages you specified to work/*/root-image, create the kernel and init images, apply your customizations and finally build the iso into out/.



Just burn the iso to a cd. You can follow CD Burning as you wish.


See USB Flash Installation Media.


Grub4dos is a utility that can be used to create multiboot usbs, able to boot multiple linux distros from the same usb stick.

To boot the generated system on a usb with grub4dos already installed, loop mount the ISO and copy the entire /arch directory to the root of the usb. Then edit the menu.lst file from the grub4dos (it must be on the usb root) and add these lines:

title Archlinux x86_64
kernel /arch/boot/x86_64/vmlinuz archisolabel=<your usb label>
initrd /arch/boot/x86_64/archiso.img

Change the x86_64 part as necessary and put your real usb label there.


Boot the created CD/DVD/USB. If you wish to install the Archiso you created -as it is-, there are several ways to do this, but either way we're following the Beginners' guide mostly.

If you don't have an internet connection on that PC, or if you don't want to download every packages you want again, follow the guide, and when you get to Beginners' guide#Install_the_base_system, instead of downloading, use this: Full system backup with rsync. (more info here: Talk:Archiso)

You can also try: Archboot, GUI installer.