Sudo pacman - < pkglist.txt fails

I just reinstalled Archlabs linux onto my system (thanks again natemaia!) after upgrading my motherboard and I am trying to install all the packages I had before. I used Pacman to create a text document of all my packages, and I copied it over to my new install. The problem is that whenever I CD into the directory of my document and run
sudo pacman -S --needed - < pkglist.txt
all the packages have an “error: target not found: allmypackages” issue.
How to I fix this?

[EDIT] I have already install pamac-aur using Yay and enabled the AUR

You must have something in there that is not actually a package or do you mean it errors on literally all of the packages?

Can you try with just one?

Tried pacman -Syyu beforehand to update the database?

Yes.
image

Here’s the output from my terminal when I try to update and install one package.

[colson@archlabs ~]$ sudo pacman -Syyu
[sudo] password for colson: 
:: Synchronizing package databases...
{trimmed to show end result}
:: Starting full system upgrade...
 there is nothing to do

// trying with just 1 package now

[colson@archlabs ~]$ sudo pacman -S zoom 3.5.383291.0407-1
error: target not found: zoom
error: target not found: 3.5.383291.0407-1
[colson@archlabs ~]$ sudo pacman -S zoom
error: target not found: zoom
[colson@archlabs ~]$ sudo pacman -Syu zoom
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
 archlabs_repo is up to date
error: target not found: zoom

I have internet access (as I’m posting this reply from my Archlabs install)
Could it be that these packages aren’t available to pacman but are available to pamac? Many of these packages were installed through pamac.

Lets just start with one we know is failing but is in the official repos, try

su
pacman -S xorg-xinit

I’m just using su here because sometime there is network issues even though things like browsers can access it and I want to know if that’s the case, reinstalling iputils seems to fix it.

Can you post a small snippet of what the pkglist.txt looks like?

tail /path/to/pkglist.txt

The xorg-xinit package installed succesfully.

Here’s the entire output of the tail command you gave me:
[root@archlabs Desktop]# tail pkglist.txt
zita-alsa-pcmi 0.3.2-2
zita-convolver 4.0.3-2
zita-resampler 1.6.2-2
zlib 1:1.2.11-4
zoom 3.5.383291.0407-1
zsh 5.8-1
zstd 1.4.4-1
zvbi 0.2.35-3
zxing-cpp 1.0.8-1
zziplib 0.13.69-1
[root@archlabs Desktop]#

Ok I think I see what’s going on maybe XD

Try

sudo pacman -S $(awk '{print $1}' /path/to/pkglist.txt)

EDIT: Okok, yes, some of your packages (zoom, etc.) will not be available, use baph instead it will sort out which need to be installed from the aur and which can be done with pacman.

baph -inN $(awk '{print $1}' /path/to/pkglist.txt)
1 Like

In the future when making the package dumps you can strip off the versions and split AUR/non-AUR packages up into separate files, then your original command would work fine.

pacman -Qqtn > officialpkgs.txt
pacman -Qqtm > aurpkgs.txt

-q will strip colours and versions leaving just package names.
-m list foreign packages (AUR), -n list non-foreign packages.
-t ignores packages which are dependencies of other packages to reduce the list size.

Woah, it worked! 1,516 packages installed flawlessly! Thanks again!
The only issue I ran into was with installing amdgpu-core-meta, which also didn’t install in Pamac and in the end never hurt me in being able to play my games.
Also, is there some way I can install all the AUR packages in the list, or do I need to manually install them?

They should have been installed by baph using the above command.

Check eg.

pacman -Q zoom

I alrady installed zoom explicitly, so here I’ll substitute with brave:
image

You should be able to filter the file through pacman one package at a time in a loop and add it to a new file if it’s an aur package, then feed that file into whichever aur helper you like.