Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have read and followed Is it possible to update, upgrade and install software before flashing an image?. I managed to mount the official Arch image, synchronise the database and update the preinstalled packages. Unfortunately, it was rather slow. I think it was slow because pacman was being emulated, which seems a little excessive.

I did a little research and man pacman lists the following option

-r, --root
Specify an alternative installation root (default is /). This should not be used as a way to install software into /usr/local instead of /usr. This option is used if you want to install a package on a temporary mounted partition that is "owned" by another system.
NOTE: if database path or logfile are not specified on either the command line or in pacman.conf(5), their default location will be inside this root path.

Can we use exploit this option to install packages on a mounted image?

share|improve this question

migrated from raspberrypi.stackexchange.com Jul 10 '12 at 22:58

This question came from our site for users and developers of hardware and software for Raspberry Pi.

up vote 3 down vote accepted


It's not too hard. Make sure you have followed the instructions on Is it possible to update, upgrade and install software before flashing an image? carefully and you have qemu-user-static installed correctly on the mounted system.


The /etc/pacman.conf file controls pacman, and normally, we wouldn't need to edit it. However, there is a problem with the supplied pacman.conf when used in this way. It includes the directive

Include = /etc/pacman.d/mirrorlist

Unfortunately, this picks up the mirror list from your host system, which probably won't mirror ARM packages. Copy /etc/pacman.conf from your mount to an appropriate directory and replace that line with

Server = http://mirror.archlinuxarm.org/arm/$repo

You can find my adapted pacman.conf at github.

Running pacman

You can now run pacman. Assuming your config file is in your pwd, run

sudo pacman -r <mount-point> --config pacman.conf -Syu


  1. Github project, which is forked from @Jivings Github project.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.