You are not logged in.
I am trying to download a set of packages for updating an offline machine. My plan was to use
pacman --config ./pacman.conf --dbpath ./tmp --cachedir ./cache --noconfirm -Sywdd base ... but I get the following error
error: you cannot perform this operation unless you are root.Why does pacman need root permissions for downloading packages to a non-system directory? Is there a way to use pacman to download packages without root?
Offline
The -Sy is probably what causes this warning .
The typical approach to do this is run the command as root, then copy the downloaded stuff to a usb stick (or optical medium) .
On the target system you will have to run the update as root anyway, so it shouldn't be an issue the media / downloaded folder is root-owned.
Is there a specific reason you want to download without root rights ?
Last edited by Lone_Wolf (2023-07-05 10:58:58)
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
Is there a specific reason you want to download without root rights ?
No reason apart from not liking to elevate permissions to do things that do not seem like they need elevated permissions. Our machines that have internet access are more locked down than those without internet access. I was hoping to pawn the downloading and updating off on someone else who is not root on the network machines, but is root on the offline machines that need to be updated.
Offline
Is there a way to use pacman to download packages without root?
Yes, you can use fakeroot to simulate root privileges. The "checkupdates" script from pacman-contrib package uses it to be executable without root priviliges.
Offline
Looking at /usr/bin/checkupdates and the man-page for fakeroot that would probably work.
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
Don't know about the 'fakeroot' approach, but if the packages of the target machine are also installed on the network one, you could use 'curl' and do something like:
for i in $(pacman -Q <package-list> | sed 's/ /-/'); do curl --output-dir "./cache" -f -O https://mirror.moson.org/arch/\{core,extra\}/os/x86_64/${i}-x86_64.pkg.tar.\{zst,zst.sig\}; done(Pick a mirror you'd normally use)
Last edited by dogknowsnx (2023-07-05 13:02:50)
Don't know about the 'fakeroot' approach, but if the packages of the target machine are also installed on the network one, you could use 'curl' and do something like:
for i in $(pacman -Q <package-list> | sed 's/ /-/'); do curl --output-dir "./cache" -f -O https://mirror.moson.org/arch/\{core,extra\}/os/x86_64/${i}-x86_64.pkg.tar.zst\{.sig\}; done(Pick a mirror you'd normally use)
Try:
pacman -Sp <pkglist>Online
Hey @Allan, I actually tried that, but on a non local package and got a bunch of 'unable to satisfy dependency' errors (I also revised the command I posted prior to your reply - nevermind
. Thanks for the hint)
EDIT: Reply to @Trilby s post below:
LC_ALL=C pacman -Sp gnome-shell
error: failed to prepare transaction (could not satisfy dependencies)
:: unable to satisfy dependency 'polkit' required by accountsservice
:: unable to satisfy dependency 'accountsservice' required by gnome-shell
:: unable to satisfy dependency 'polkit' required by colord
:: unable to satisfy dependency 'colord' required by mutter
:: unable to satisfy dependency 'xorg-xwayland' required by mutter
:: unable to satisfy dependency 'mutter' required by gnome-shell
:: unable to satisfy dependency 'polkit' required by colord
:: unable to satisfy dependency 'colord' required by mutter
:: unable to satisfy dependency 'xorg-xwayland' required by mutter
:: unable to satisfy dependency 'libmutter-12.so=0-64' required by gnome-shellThe version numbers were needed for my suggested approach, otherwise 'curl' would fail.
EDIT#2: This thread actually solved an "issue" for me that I didn't realize existed before.
'gnome-shell' requires packages I don't want on my system and have 'pacman' ignore them, which naturally produced the errors above and led me to discarding 'pacman -Sp' and look for a different approach while trying to respond in a helpful way... ![]()
Thanks @Trilby @Allan (I won't blame pacman)
Last edited by dogknowsnx (2023-07-05 15:37:53)
Hey @Allan, I actually tried that, but on a non local package and got a bunch of 'unable to satisfy dependency' errors
That's odd - the -p flag should work fine - what are the actual errors?
But if nothing else, get rid of that sed pipe: if you want a list of local packages withou version numbers use -Qq, not -Q. That said, why use -Q at all? That's getting only *currently installed* packages - there shouldn't be a need to download currently installed packages! edit: you did start your post with "if all the packages ... are installled", so that kinda' addresses this point - but if they are actually all installed, they will be in the local cache, so there's no reason to download them at all.
A downside, though, of -Sp is that it will not list any dependencies that are already installed on the machine running the command. Though an alternative db would solve this. Alternatively, expanding the target list by other means could also work, e.g. contrast the following on my current machine:
$ pacman -Sp base
https://arch.mirror.constant.com/core/os/x86_64/base-3-1-any.pkg.tar.zst
$ pacman -Sp $(expac %D base)
https://arch.mirror.constant.com/core/os/x86_64/filesystem-2023.01.31-1-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/glibc-2.37-3-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/gcc-libs-13.1.1-1-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/bash-5.1.016-4-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/coreutils-9.3-1-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/xz-5.4.3-1-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/bzip2-1.0.8-5-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/file-5.44-3-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/findutils-4.9.0-3-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/gawk-5.2.2-1-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/grep-3.11-1-x86_64.pkg.tar.zst
file:///var/cache/pacman/pkg/procps-ng-4.0.3-1-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/sed-4.9-3-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/tar-1.34-2-x86_64.pkg.tar.zst
file:///var/cache/pacman/pkg/gettext-0.22-1-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/pciutils-3.10.0-1-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/psmisc-23.6-1-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/shadow-4.13-2-x86_64.pkg.tar.zst
file:///var/cache/pacman/pkg/util-linux-2.39.1-1-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/gzip-1.12-2-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/licenses-20220125-2-any.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/pacman-6.0.2-7-x86_64.pkg.tar.zst
file:///var/cache/pacman/pkg/archlinux-keyring-20230704-1-any.pkg.tar.zst
file:///var/cache/pacman/pkg/systemd-253.5-2-x86_64.pkg.tar.zst
file:///var/cache/pacman/pkg/systemd-sysvcompat-253.5-2-x86_64.pkg.tar.zst
https://arch.mirror.constant.com/core/os/x86_64/iputils-20221126-2-x86_64.pkg.tar.zst
file:///var/cache/pacman/pkg/iproute2-6.4.0-1-x86_64.pkg.tar.zstKeep in mind the above is just an example - as written, the second command does not expand dependencies recursively. But it also shows another benefit of -Sp: pacman will determine what needs to actually be downloaded versus what is already available in the local cache (as a file:// uri).
Last edited by Trilby (2023-07-05 13:26:59)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline