From: Pang Yan Han <pangyanhan@gmail.com> When db.lck file is present, pacman -Syy and other Sync operations involving transactions show: :: Synchronizing package databases... error: failed to update core (unable to lock database) error: failed to update extra (unable to lock database) error: failed to update community (unable to lock database) error: failed to update multilib (unable to lock database) error: failed to synchronize any databases Whereas pacman -U <pkg> shows: error: failed to init transaction (unable to lock database) if you're sure a package manager is not already running, you can remove /var/lib/pacman/db.lck which is much more meaningful. Standardize the output to that of pacman -U when db.lck is present. Reported-by: Allan McRae <allan@archlinux.org> Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> --- src/pacman/sync.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/src/pacman/sync.c b/src/pacman/sync.c index ea32a26..37f6ecb 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -288,6 +288,15 @@ static int sync_synctree(int level, alpm_list_t *syncs) ret = alpm_db_update((level < 2 ? 0 : 1), db); if(ret < 0) { + enum _alpm_errno_t err = alpm_errno(config->handle); + pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to init transaction (%s)\n"), + alpm_strerror(err)); + if(err == ALPM_ERR_HANDLE_LOCK) { + fprintf(stderr, _(" if you're sure a package manager is not already\n" + " running, you can remove %s\n"), + alpm_option_get_lockfile(config->handle)); + return 0; + } pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to update %s (%s)\n"), alpm_db_get_name(db), alpm_strerror(alpm_errno(config->handle))); } else if(ret == 1) { -- 1.7.6.1.385.gb7fcd0