2

Is there a way to have the update-alternatives command operate on a root file system mounted on a path other than '/'? For example, the update-rc.d and ldconfig commands have an -r <path> option to do this. The update-alternatives man page does not indicate such support.

  • Can you chroot in into the root file system, and run the command in that chroot? – saiarcot895 Sep 10 '15 at 19:55
  • Thanks. I had resolved this issue with some shell scripting to do the equivalent of the update-alternatives command. The chroot option looks like it will also work and would be simpler. – Jay Sep 11 '15 at 16:54
0

You can use the --admindir option to choose a state directory such as /my/root/var/lib/dpkg/alternatives, and the --altdir option to choose a link directory such as /my/root/etc/alternatives. However update-alternatives will see absolute symbolic links in /my/root/etc/alternatives, pointing to /usr/bin and the like, so it might see broken links for programs that aren't installed in the alternate root.

There's no option to tell it to work entirely inside a root. So use the generic method: chroot.

chroot /my/root update-alternatives …

If you don't want to run as root, you can use fakechroot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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