You are not logged in.

#1 2016-05-27 17:27:41

william.pursell
Member
Registered: 2016-05-27
Posts: 4

Upgrading pacman from 4.1.2 to 5.0.1, pacman-db-upgrade post_upgrade

I am new to arch, and new to a custom distro that uses arch snapshots.  Currently trying to upgrade
pacman on our fleet from 4.1.2 to 5.0.1.  Simply upgrading the package (pacman -U) renders
the system unusable until running pacman-db-upgrade.  I'd like to put pacman-db-upgrade
in our post-upgrade hook, but it fails because it cannot acquire the lock (/var/lib/pacman/db.lck).

Would it be safe to write the post_upgrade() hook as:
rm /var/lib/pacman/db.lck
pacman-db-upgrade
touch /var/lib/pacman/db.lck

Any other simple suggestions for the correct way to do this?

Offline

#2 2016-05-27 17:49:53

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,520
Website

Re: Upgrading pacman from 4.1.2 to 5.0.1, pacman-db-upgrade post_upgrade

william.pursell wrote:

I am new to arch, and new to a custom distro that uses arch snapshots.

Which is it?  Are you using arch, or a custom distro based on arch?  If the later, which one, and why?

If this is arch linux, this is likely the problem fortold in the news item you seem to have ignored.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2016-05-27 18:23:57

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

Re: Upgrading pacman from 4.1.2 to 5.0.1, pacman-db-upgrade post_upgrade

Trilby wrote:

If this is arch linux, this is likely the problem fortold in the news item you seem to have ignored.

This is due to updating pre-v4.2.0 pacman; nothing to do with hooks.

william.pursell wrote:

Would it be safe to write the post_upgrade() hook as:
rm /var/lib/pacman/db.lck
pacman-db-upgrade
touch /var/lib/pacman/db.lck

Safe?  You are removing a lock file to modify pacman's database while pacman is in the middle of updating it.  Depending on the exact circumstances of the upgrade, you may get away with it without issues, but it is definitely not what I would call safe.

Offline

#4 2016-05-27 18:31:45

william.pursell
Member
Registered: 2016-05-27
Posts: 4

Re: Upgrading pacman from 4.1.2 to 5.0.1, pacman-db-upgrade post_upgrade

This is a custom distro, based on arch. 

I would agree that deleting the lock while pacman is running is unwise, hence the question.  Perhaps it should have
been phrased "How can I update the pacman database automatically using pacman?", and present this "solution"
as a terrible hack that I am reluctant to use.

Is there a reasonable way around this, or do I need to run a "pacman -U pacman; pacman-db-upgrade" script
on every host in the fleet?

Offline

#5 2016-05-27 18:58:51

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

Re: Upgrading pacman from 4.1.2 to 5.0.1, pacman-db-upgrade post_upgrade

What  exactly is wrong with appending "; pacman-db-upgrade" to the command you already have to run?


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

Offline

#6 2016-05-27 20:46:32

william.pursell
Member
Registered: 2016-05-27
Posts: 4

Re: Upgrading pacman from 4.1.2 to 5.0.1, pacman-db-upgrade post_upgrade

The current procedure is to update a dependency list to a meta-package.  When that package is upgraded, I do not know
the order in which pacman would be updated, and it seems the cleanest solution is to insert the db update into the
post_upgrade hook of the modified pacman package.  But perhaps a manual update of pacman is simpler.

Offline

#7 2016-05-27 20:55:22

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

Re: Upgrading pacman from 4.1.2 to 5.0.1, pacman-db-upgrade post_upgrade

Do you mean that you do not know what order pacman will update packages in within a single transaction?  That does not matter.

Offline

#8 2016-05-28 00:22:30

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

Re: Upgrading pacman from 4.1.2 to 5.0.1, pacman-db-upgrade post_upgrade

I would not do it with an post_upgrade hook.   Especially in the middle of an update.   You would changing to the new database format while the old version of pacman is still installing packages...

Offline

#9 2016-05-28 01:04:29

william.pursell
Member
Registered: 2016-05-27
Posts: 4

Re: Upgrading pacman from 4.1.2 to 5.0.1, pacman-db-upgrade post_upgrade

Thanks for all the replies.  My concern was that if I upgraded the meta package, if pacman were to be upgraded in the
middle of the list, then upgrades after it would fail (after it upgrades, pacman fails until pacman-db-upgrade is called)
But perhaps my concern is unfounded.  In any case, I've just changed the command that updates the meta package
to first update pacman, then update the db, then update the meta package.

Thanks again.

Offline

#10 2016-05-28 01:13:27

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

Re: Upgrading pacman from 4.1.2 to 5.0.1, pacman-db-upgrade post_upgrade

Ah....   just updating pacman?   Or pacman and all of its dependencies?     You may soon find out that partial updates are unsupported.

Offline

#11 2016-05-28 01:14:42

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

Re: Upgrading pacman from 4.1.2 to 5.0.1, pacman-db-upgrade post_upgrade

That is unnecessary, pacman will not suddenly forget how to read its database in the middle of an upgrade.

Offline

#12 2016-05-28 08:51:11

Jristz
Member
From: America/Santiago
Registered: 2011-06-11
Posts: 1,022

Re: Upgrading pacman from 4.1.2 to 5.0.1, pacman-db-upgrade post_upgrade

Just run a Pacman -Sy and a Pacman -Suw and then a pacman -Syu and merge and correct files, first, keep an updated arch-cd just in case you run in troubles.


Well, I suppose that this is somekind of signature, no?

Offline

Board footer

Powered by FluxBB