You are not logged in.
I've had a script to install a new custom system into a mounted directory for a long time, and I'm attempting to migrate it to the new pacman --sysroot (from --root, now obsolete). I'm not understanding how this is supposed to work.
Old code, with the future root directory mounted at /somewhere:
pacman --root /somewhere -Sy --config /tmp/config --cachedir /somewhere/var/cache/pacman/pkg --noconfirm pack1 pack2 ...
Works fine. If I don't specify my custom /tmp/config, it uses the running system's.
New code:
cp /tmp/config /somewhere/tmp/config
pacman --sysroot /somewhere -Sy --config /tmp/config --cachedir /var/cache/pacman/pkg --noconfirm pack1 pack2 ...
This requires me to first copy a config file into the /somewhere directory, which at that time is completely empty. And specify the paths relative to /somewhere, not outside of it. But then I get messages like this:
Synchronizing package databases...
error: failed retrieving file 'xxx.db' from example.com: Could not resolve host: example.com
error: failed to update xxx (download library error)
Just how does pacman enter this chroot? This shouldn't impact the network, should it? Or does it need some other files present, like /etc/resolv.conf or such?
P.S. Neither wiki nor pacstrap seems to have been updated with this new option. They still use -r aka --root.
Offline
--sysroot <dir>
Specify an alternative system root. Pacman will chroot and chdir into the system root prior to running. This allows mounted
guest systems to be properly operated on . Any other paths given will be interpreted as relative to the system root. Requires
root privileges.
emphasis by me
sysroot appears to be intended to connect to an existing installation, not a new one.
according to pacstrap -h it doesn't have an -r option at all, check it's options.
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
I believe that the OP meant that the pacstrap script still uses the to be depreceated pacman -r, not that there was a -r flag to pacstrap.
...
msg 'Installing packages to %s' "$newroot"
if ! pacman -r "$newroot" -Sy "${pacman_args[@]}"; then
die 'Failed to install packages to new root'
fi
...
Offline
At the current point in time, --sysroot is not a full replacement for --root. It uses the network connection from the host, which means resolv.conf plus the relevant NSS libs. Whenever this may get fixed, we will transition from --root to --sysroot in pacstrap itself.
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
In which case, I suggest that until it is a full replacement:
put -r | --root documentation back into man pacman (was completely removed)
put some version of @Eschwartz' comment above into the man page's --sysroot section
remove "warning: option --root is deprecated; use --sysroot instead" output from pacman when using -r
I'll file a bug to that extent if this sounds reasonable.
Last edited by jernst (2018-07-02 16:35:10)
Offline
Bug report: https://bugs.archlinux.org/task/59218
Offline
I agree with @jernst.
Infact I would like to suggest to keep both --root and --sysroot options instead of plans to remove --root in future.
--root can be used in arch-install-scripts
and else where --sysroot
In future (if possible and necessary) --root can be made alias to --sysroot
Last edited by amish (2018-07-06 09:50:53)
Offline
https://bugs.archlinux.org/task/59283
https://git.archlinux.org/pacman.git/co … 57ac63284d
--root is now un-deprecated (expected in 5.1.1)
PS: Documentation does not mention what happens if both --root and --sysroot are mentioned.
Offline
My guess... --sysroot (chroot) into that directory, then apply --root.
Offline
May be if --sysroot is given --root should be ignored (with a warning?). Because eventually idea is to replace --root with --sysroot
Offline