You are not logged in.

#1 2017-07-14 08:28:33

rddweb
Member
From: Porto Alegre, Brazil
Registered: 2010-07-24
Posts: 6

Reinstalling pacman after broken upgrade

Something went wrong in my daily pacman -Suy. Suddenly lost pacman command after this, during the upgrade process.

error: could not open file /var/cache/pacman/pkg/pacman-5.0.2-2-x86_64.pkg.tar.xz: No such file or directory
error: could not commit transaction
error: failed to commit transaction (transaction aborted)

So i just tried to follow something like this: https://bbs.archlinux.org/viewtopic.php?id=95007

It didn't work.

Cleaned my /var/cache/pacman, then I manually downloaded pacman from my local mirror and did this:

sudo tar -xvpf pacman-5.0.2-2-x86_64.pkg.tar.xz  -C / --exclude .PKGINFO --exclude .INSTALL

Now I have my pacman command again available, but now I have this all over the place:

error: could not open file /var/lib/pacman/local/pacman-5.0.2-2/desc: No such file or directory

So I just tried to force pacman reinstall:

$: sudo pacman -S --force pacman
warning: pacman-5.0.2-2 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...
error: could not open file /var/lib/pacman/local/pacman-5.0.2-2/desc: No such file or directory
warning: could not fully load metadata for package pacman-5.0.2-2
error: failed to prepare transaction (invalid or corrupted package)

Already tried wild things like `pacman -Syyccu` [error: can't use clean and refresh at same time] and `pacman -Suu` [nothing to do].

This pacman seems to work fine, I just made a pacman -Syu, with that 'could no open .../pacman.../desc' repeated a lot of times, but it worked fine, except I cant upgrade my pacman in the future? big_smile

Any ideas to help recover my beloved system? Thanks!

Last edited by rddweb (2017-07-14 08:36:13)

Offline

#2 2017-07-14 11:18:16

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

Re: Reinstalling pacman after broken upgrade

That thread is very old and there are better ways to deal with breakages.
Just checking the pacman page on wiki would have pointed you to several solutions.
Next time you got problems search wiki before forum please.

You need to boot into  a reliable system to execute repairs.
prepare latest archlinux install media, boot it and follow https://wiki.archlinux.org/index.php/Pa … an_upgrade

Last edited by Lone_Wolf (2017-07-14 11:19:03)


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 2017-07-14 11:35:21

loqs
Member
Registered: 2014-03-06
Posts: 17,327

Re: Reinstalling pacman after broken upgrade

@Lone_Wolf including step 3 which mounts the root filesystem two additional times at /mnt/proc and /mnt/sys?

Offline

#4 2017-07-14 11:36:13

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

Re: Reinstalling pacman after broken upgrade

Yes. But it's not mounting the root filesystem, it's mounting /proc and /sys in the chroot target.

Last edited by Slithery (2017-07-14 11:37:38)


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

#5 2017-07-14 11:55:19

loqs
Member
Registered: 2014-03-06
Posts: 17,327

Re: Reinstalling pacman after broken upgrade

Then why use the parameter /dev/sdaX instead of none or rebind as per Change_root?
Edit:
Spelling

Last edited by loqs (2017-07-14 11:55:56)

Offline

#6 2017-07-14 12:10:13

rddweb
Member
From: Porto Alegre, Brazil
Registered: 2010-07-24
Posts: 6

Re: Reinstalling pacman after broken upgrade

Lone_Wolf wrote:

That thread is very old and there are better ways to deal with breakages.
Just checking the pacman page on wiki would have pointed you to several solutions.
Next time you got problems search wiki before forum please.

You need to boot into  a reliable system to execute repairs.
prepare latest archlinux install media, boot it and follow https://wiki.archlinux.org/index.php/Pa … an_upgrade


Sorry. I read that before. The 'several' solutions like that https://wiki.archlinux.org/index.php/Pa … ing_pacman, is just the same I did, so , it didn't worked.

Just thought that booting live media to solve something 'simple' like that is kinda lame. That must be a easier way to solve something recurrent with Arch (broken packages).

I'm long time arch user (and much more linux user), and in the past, problems like that were more easily solved. Pacman changed that hard and I didn't saw?

Anyway, just copied the missing files from my VPS that also uses archlinux.

It must be a easier way... must. For now on, since I can't trust pacman to reinstall pacman anymore, I'm moving my /*/pacman/* to a btfrs subvolume and snapshoting everytime before an upgrade.

Thanks all. Solved.

Please, please don't take personally. I read wiki everytime, I have even it cached offline on my smartphone.

Last edited by rddweb (2017-07-14 12:13:19)

Offline

#7 2017-07-14 13:37:22

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

Re: Reinstalling pacman after broken upgrade

rddweb wrote:

Something went wrong in my daily pacman -Suy. Suddenly lost pacman command after this, during the upgrade process.

error: could not open file /var/cache/pacman/pkg/pacman-5.0.2-2-x86_64.pkg.tar.xz: No such file or directory
error: could not commit transaction
error: failed to commit transaction (transaction aborted)

What you're saying doesn't make sense -- you seem to be saying that pacman aborted without doing anything, when it successfully found/downloaded /var/cache/pacman/pkg/pacman-5.0.2-2-x86_64.pkg.tar.xz during the download stage, and failed to find it when doing the extraction stage. Either that was a very well-timed `rm` or you have filesystem corruption???

Either way, a "transaction aborted" would not cause pacman to break, because nothing should happen. So there is something you aren't telling us.

So i just tried to follow something like this: https://bbs.archlinux.org/viewtopic.php?id=95007

It didn't work.

Cleaned my /var/cache/pacman, then I manually downloaded pacman from my local mirror and did this:

sudo tar -xvpf pacman-5.0.2-2-x86_64.pkg.tar.xz  -C / --exclude .PKGINFO --exclude .INSTALL

Now I have my pacman command again available, but now I have this all over the place:

error: could not open file /var/lib/pacman/local/pacman-5.0.2-2/desc: No such file or directory

So I just tried to force pacman reinstall:

$: sudo pacman -S --force pacman
warning: pacman-5.0.2-2 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...
error: could not open file /var/lib/pacman/local/pacman-5.0.2-2/desc: No such file or directory
warning: could not fully load metadata for package pacman-5.0.2-2
error: failed to prepare transaction (invalid or corrupted package)

Again, the commands you actually listed could not have this effect. pacman is erroring because your local install database is inconsistent -- it claims you have the package installed, but it cannot find the desc file. You could fix that by deleting the /var/lib/pacman/local/pacman-5.0.2-2/ directory and using `pacman -S --dbonly pacman` to repair the database, then cleaning up the potential file mismatches, but that still doesn't explain how it happened in the first place...


Already tried wild things like `pacman -Syyccu` [error: can't use clean and refresh at same time] and `pacman -Suu` [nothing to do].

That's pretty wild alright, where did you get the idea that that might do something?

Like most application, pacman options have defined meanings, you can read about them on the manpage. Which part of their descriptions implied they might help in the event of an "invalid or corrupted package" error?

Last edited by eschwartz (2017-07-14 13:40:20)


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

Offline

#8 2017-07-15 22:55:41

rddweb
Member
From: Porto Alegre, Brazil
Registered: 2010-07-24
Posts: 6

Re: Reinstalling pacman after broken upgrade

Eschwartz wrote:
rddweb wrote:

Something went wrong in my daily pacman -Suy. Suddenly lost pacman command after this, during the upgrade process.

error: could not open file /var/cache/pacman/pkg/pacman-5.0.2-2-x86_64.pkg.tar.xz: No such file or directory
error: could not commit transaction
error: failed to commit transaction (transaction aborted)

What you're saying doesn't make sense -- you seem to be saying that pacman aborted without doing anything, when it successfully found/downloaded /var/cache/pacman/pkg/pacman-5.0.2-2-x86_64.pkg.tar.xz during the download stage, and failed to find it when doing the extraction stage. Either that was a very well-timed `rm` or you have filesystem corruption???

Either way, a "transaction aborted" would not cause pacman to break, because nothing should happen. So there is something you aren't telling us.

So i just tried to follow something like this: https://bbs.archlinux.org/viewtopic.php?id=95007

It didn't work.

Cleaned my /var/cache/pacman, then I manually downloaded pacman from my local mirror and did this:

sudo tar -xvpf pacman-5.0.2-2-x86_64.pkg.tar.xz  -C / --exclude .PKGINFO --exclude .INSTALL

Now I have my pacman command again available, but now I have this all over the place:

error: could not open file /var/lib/pacman/local/pacman-5.0.2-2/desc: No such file or directory

So I just tried to force pacman reinstall:

$: sudo pacman -S --force pacman
warning: pacman-5.0.2-2 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...
error: could not open file /var/lib/pacman/local/pacman-5.0.2-2/desc: No such file or directory
warning: could not fully load metadata for package pacman-5.0.2-2
error: failed to prepare transaction (invalid or corrupted package)

Again, the commands you actually listed could not have this effect. pacman is erroring because your local install database is inconsistent -- it claims you have the package installed, but it cannot find the desc file. You could fix that by deleting the /var/lib/pacman/local/pacman-5.0.2-2/ directory and using `pacman -S --dbonly pacman` to repair the database, then cleaning up the potential file mismatches, but that still doesn't explain how it happened in the first place...


Already tried wild things like `pacman -Syyccu` [error: can't use clean and refresh at same time] and `pacman -Suu` [nothing to do].

That's pretty wild alright, where did you get the idea that that might do something?

Like most application, pacman options have defined meanings, you can read about them on the manpage. Which part of their descriptions implied they might help in the event of an "invalid or corrupted package" error?

You say me... I have a pretty wild setup on a rolling release distro. (:

I'm using btrfs on a 256GB Samsung 850 EVO for /
I moved things like /var/cache/pacman, and other download, documents, etc to a BTRFS raid 0 on 2x 4TB Hitachi 5400RPM drives.
Also my docker, vagrant machines, mysql, postgres data are running on ext4 on 7200rpm 1TB Seagate.
Rock solid for 4 years (just replaced the SSD by cloning from 128GB Samsung 740 and Raid from 2x 1.5TB Western Digital last year).

I just did what I do every 4 A.M. Wake up, made a coffee while doing `pac` command (that does something like pacman -Suy).

What I didn't had was a proper subvolume backup for pacman caches, since I trusted pacman A LOT on last 7 (SEVEN) years as Arch user issuing simple commands to restore broken packages, etc. So I just used to old pacman behavior. The wiki didn't said about --dbonly, and man pages are useless since 90's [except if you dont have internet].

Don't know what happened. Just asked if someone had simple commands to recover this type of situations, like we ALWAYS had.

It successfully downloaded like 30 packages, installed 20 something and stopped issuing that line. Maybe a BTRFS fault? Hardware fault? Don't know. My hardware health checks indicates nothing, my essential files are just fine (with a proper backup on external drives). Just wanted to recover fast that glitch, like I always did since my first time using arch.

/s Time to move back to gentoo or move forward to freebsd. /s smile

Or seriously, I will test your command later and maybe write something on wiki? Thanks for the enlightenment about pacman's 5 behavior. big_smile

Last edited by rddweb (2017-07-15 22:58:15)

Offline

#9 2017-07-16 04:21:37

apg
Developer
Registered: 2012-11-10
Posts: 211

Re: Reinstalling pacman after broken upgrade

Offline

#10 2017-07-16 21:58:05

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

Re: Reinstalling pacman after broken upgrade

yikes Yeah, messing with the CacheDir would do that. Use a bind mount or modify pacman.conf's CacheDir setting rather than symlinking it.


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

Offline

Board footer

Powered by FluxBB