diff --git a/src/pacman/util.c b/src/pacman/util.c index 0f50ae0b..d3422739 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -152,12 +152,25 @@ int sync_syncdbs(int level, alpm_list_t *syncs) { int ret; int force = (level < 2 ? 0 : 1); + alpm_errno_t err; multibar_move_completed_up(false); ret = alpm_db_update(config->handle, syncs, force); + if(ret < 0) { + err = alpm_errno(config->handle); pm_printf(ALPM_LOG_ERROR, _("failed to synchronize all databases (%s)\n"), - alpm_strerror(alpm_errno(config->handle))); + alpm_strerror(err)); + + if(err == ALPM_ERR_HANDLE_LOCK) { + const char *lockfile = alpm_option_get_lockfile(config->handle); + pm_printf(ALPM_LOG_ERROR, _("could not lock database: %s\n"), + strerror(errno)); + if(access(lockfile, F_OK) == 0) { + fprintf(stderr, _(" if you're sure a package manager is not already\n" + " running, you can remove %s\n"), lockfile); + } + } } return (ret >= 0);