You are not logged in.

#1 2018-07-02 00:30:37

jernst
Member
From: Silicon Valley
Registered: 2014-03-04
Posts: 290
Website

Making the new pacman --sysroot work

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

#2 2018-07-02 10:32:56

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,866

Re: Making the new pacman --sysroot work

man pacman wrote:

      --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.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2018-07-02 10:38:53

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Making the new pacman --sysroot work

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
...

No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#4 2018-07-02 10:57:04

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Making the new pacman --sysroot work

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.

See https://bugs.archlinux.org/task/58778


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#5 2018-07-02 16:34:26

jernst
Member
From: Silicon Valley
Registered: 2014-03-04
Posts: 290
Website

Re: Making the new pacman --sysroot work

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

#6 2018-07-02 19:02:35

jernst
Member
From: Silicon Valley
Registered: 2014-03-04
Posts: 290
Website

Re: Making the new pacman --sysroot work

Offline

#7 2018-07-06 09:50:39

amish
Member
Registered: 2014-05-10
Posts: 470

Re: Making the new pacman --sysroot work

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

#8 2018-07-27 02:09:07

amish
Member
Registered: 2014-05-10
Posts: 470

Re: Making the new pacman --sysroot work

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

#9 2018-07-27 03:21:47

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: Making the new pacman --sysroot work

My guess...   --sysroot (chroot) into that directory, then apply --root.

Offline

#10 2018-07-27 11:39:55

amish
Member
Registered: 2014-05-10
Posts: 470

Re: Making the new pacman --sysroot work

May be if --sysroot is given --root should be ignored (with a warning?). Because eventually idea is to replace --root with --sysroot

Offline

Board footer

Powered by FluxBB