User:KirisameMarisa/Archiso offline (简体中文)

From ArchWiki

Archiso Offline 是 传统archiso 包的附加组件. 开启的用户可从官方的iso中生成离线的iso。很像其它大多数的Linux发行版拥有的默认选项,Arch用户可创建最小iso构建使用这个包。 Archiso Offline的另一个特性是,可以在ISO构建过程中包含AUR包。

Setup

安装 archiso-offline-relengAURTemplate:Broken package link (简体中文), 这就同时安装 archiso (在安装了的情况下也可使用archiso-gitAUR.


使用步骤大抵于Archiso相同 但是,Archiso有两个自带的“配置文件”": releng and baseline"Archiso Offline增加了一个附加配置文件叫offline_releng

The offline_releng profile replaces all of the online-dependent steps in a normal installation process with locally hosted packages within the ISO. So instead of trying to fetch packages online, packages are sourced from the ISO directly.

The build process enables this by by sourcing the packages.x86_64 and running pacman --noconfirm -w --cachedir ... <packages> and placing the files in a HTTP-like structure under /srv/http. Then pointing the ISO pacman.conf to that structure.
AUR packages are also sourced, but cached a little bit differently. But AUR packages are sourced from packages.aur.
The full list of packages sourced by default are base base-devel and any packages listed in packages.x86_64 from the official releng config.

Additional packages can be added as described in Archiso#Profile structure

Installing packages

Follow the same procedure as described in Archiso#PackagesTemplate:Broken section link (简体中文), the only difference being packages.aur which is a additional feature in the build process, enabling the possibility to include AUR Packages into the offline medium.

Note: If AUR packages are found by the build process, a build-user will be automatically created with "%wheel ALL=(ALL) NO" sudoers permission. It's a known issue and a long term bad solution. Make sure your sudoers file looks correct after building your offline ISO for now.

Build the ISO

This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.

Reason: Use "#" only for root prompt, e.g. makepkg should not be run as root. See Help:Reading#Regular user or root. (Discuss in User talk:KirisameMarisa/Archiso offline (简体中文))

Again, assuming you have followed the Archiso documentation, more specifically the Archiso#Build the ISO steps, you should have a ISO under ~/archlive/out/.

Example build process

Example of installation steps:

# mkdir -p /tmp/archiso-offline
# cd /tmp/archiso-offline
# wget https://aur.archlinux.org/cgit/aur.git/snapshot/archiso-offline-releng.tar.gz
# tar xvzf archiso-offline-releng
# cd archiso-offline-releng
# makepkg -s
# pacman -U *.zst

The actual build process:

# mkdir -p /tmp/iso_build_dir
# cp -r /usr/share/archiso/configs/offline_releng/* /tmp/iso_build_dir/
# cd /tmp/iso_build_dir
# echo "python" >> packages.x86_64
# echo "lighttpd2-git" >> packages.aur
# echo "systemctl enable lighttpd2" >> ./airootfs/root/customize_airootfs.sh
# rm -rf work*
# ./build.sh -v
# file out/*.iso

And that should be it. This example installs python to the live ISO environment as well as lighttpd2-gitAUR. It also enables auto-start of lighttpd2 once the ISO boots.

See also

Documentation and tutorials

Example build script

Known shortcommings

A few things and issues are known in this project.
The first being that some packages might want to be hosted locally, but not installed locally in the ISO environment. As of today there is no good solution for this, so all packages declared in packages.{x86_64, aur} are both installed - and hosted in the ISO environment.

Another big issue is the AUR build-user. There is no clear way to solve this, but there are better solutions than the one in place today. Especially the use of sudoers.