Skip to content

arch nspawn 使用参考

tsuibin edited this page Jul 31, 2021 · 4 revisions

arch-nspawn 从名字就可以看出,其实是基于systemd-nspawn,在systemd-nspawn的基础上添加了一些arch linux特有的参数的支持,如下所示:

[tsuibin@archlinux ~]$ arch-nspawn -h
Usage: arch-nspawn [options] working-dir [systemd-nspawn arguments]
A wrapper around systemd-nspawn. Provides support for pacman.

 options:
    -C <file>     Location of a pacman config file
    -M <file>     Location of a makepkg config file
    -c <dir>      Set pacman cache
    -f <file>     Copy file from the host to the chroot
    -s            Do not run setarch
    -h            This message

其中

-C 参数可以指定pacman的配置文件

-M 参数指定makepkg的配置文件

这两个对于要在x86_64上执行其他架构的rootfs是非常有帮助的

-c 设置下载的软件包的缓存目录

-f 从本地主机拷贝到chroot