Nethserver upgrade issues with the yum

First i tried ti use pop2 connector , it does’t work , then i decided to install mail2 , then this error appear:

[root@server ~]# yum swap \

-- remove nethserver-mail-{common,disclaimer,filter,server} \
-- install nethserver-mail2-{common,disclaimer,filter,server}

Loaded plugins: changelog, fastestmirror, nethserver_events
Traceback (most recent call last):
File “/usr/bin/yum”, line 29, in
yummain.user_main(sys.argv[1:], exit_code=True)
File “/usr/share/yum-cli/yummain.py”, line 375, in user_main
errcode = main(args)
File “/usr/share/yum-cli/yummain.py”, line 170, in main
base.getOptionsConfig(args)
File “/usr/share/yum-cli/cli.py”, line 295, in getOptionsConfig
(opts, self.cmds) = self.optparser.setupYumConfig(args=args)
File “/usr/share/yum-cli/cli.py”, line 2311, in setupYumConfig
if not self.base.conf.usercache and os.geteuid() != 0:
AttributeError: ‘YumConf’ object has no attribute ‘usercache’

I think you have seen this documentation:

http://docs.nethserver.org/en/v7/mail2.html#from-pop3-connector-module

But perhaps the following thread could help you:

My opinion error doesn’t relate to packages in general it’s something with YUM.

I agree.

Do other yum commands work as expected?

No, it’s doesn’t work at all. But through the dashboard updating performs without troubles. Also i have amle server but there it’s not in installed packages.

results of command “yum update”

[root@server ~]# yum update
Loaded plugins: changelog, fastestmirror, nethserver_events
Traceback (most recent call last):
File “/usr/bin/yum”, line 29, in
yummain.user_main(sys.argv[1:], exit_code=True)
File “/usr/share/yum-cli/yummain.py”, line 375, in user_main
errcode = main(args)
File “/usr/share/yum-cli/yummain.py”, line 170, in main
base.getOptionsConfig(args)
File “/usr/share/yum-cli/cli.py”, line 295, in getOptionsConfig
(opts, self.cmds) = self.optparser.setupYumConfig(args=args)
File “/usr/share/yum-cli/cli.py”, line 2311, in setupYumConfig
if not self.base.conf.usercache and os.geteuid() != 0:
AttributeError: ‘YumConf’ object has no attribute ‘usercache’
[root@server ~]#

Let’s try to narrow down the problem, you probably have an invalid configuration.
Execute and report the output of:

grep -R usercache /etc/yum*

If any match is found, remove it from the containing file.

Perhaps did you edit the yum config by hand?

There is nothing in output from command. Yum wasn’t changed manually.

So you need to find where yum is blocking, try if the debug flag may help: yum --debuglevel=10 update

Otherwise you need to dig into the yum code and find out what is not working.

nothing new, any suggestions?

[root@server ~]# yum --debuglevel=10 update
Loading “changelog” plugin
Loading “fastestmirror” plugin
Loading “nethserver_events” plugin
Config time: 0.015
Traceback (most recent call last):
File “/usr/bin/yum”, line 29, in
yummain.user_main(sys.argv[1:], exit_code=True)
File “/usr/share/yum-cli/yummain.py”, line 375, in user_main
errcode = main(args)
File “/usr/share/yum-cli/yummain.py”, line 170, in main
base.getOptionsConfig(args)
File “/usr/share/yum-cli/cli.py”, line 295, in getOptionsConfig
(opts, self.cmds) = self.optparser.setupYumConfig(args=args)
File “/usr/share/yum-cli/cli.py”, line 2311, in setupYumConfig
if not self.base.conf.usercache and os.geteuid() != 0:
AttributeError: ‘YumConf’ object has no attribute ‘usercache’
[root@server ~]#

I’m out of ideas. Try to reinstall it:

yum reinstall yum

If it doesn’t work, just try to understand the source code.

I hope someone else has better ideas :wink:

Same error.)

When i tried install mail2 through the dashboard this happened :

This is unrelated.
The error reported in the UI is enforced to avoid the installation of conflicting rpms.

You need to use the yum swap command in your scenario.

If you want to use the UI, you must first remove the legacy mail server then install the new one.

Email service is installed but there no mark that it’s in the system.

Does yum works properly now?
Can you share the list of installed modules?

rpm -qa nethserver-*

No, still not working.

output from command: rpm -qa nethserver-*

[root@server ~]# rpm -qa nethserver-*
nethserver-memcached-1.1.0-1.ns7.noarch
nethserver-openssh-1.2.2-1.ns7.noarch
nethserver-directory-3.3.0-1.ns7.noarch
nethserver-collectd-3.0.6-1.ns7.noarch
nethserver-lsm-1.2.3-1.ns7.noarch
nethserver-mail-common-1.6.7-1.ns7.noarch
nethserver-diagtools-1.0.2-1.ns7.noarch
nethserver-sssd-1.4.0-1.ns7.noarch
nethserver-sogo-1.7.3-1.ns7.noarch
nethserver-nethforge-release-7-2.ns7.noarch
nethserver-rh-php71-php-fpm-1.0.0-1.ns7.noarch
nethserver-letsencrypt-1.1.6-1.ns7.noarch
nethserver-backup-config-2.1.0-1.ns7.noarch
nethserver-roundcubemail-1.2.9-1.ns7.noarch
nethserver-mail-server-1.12.3-1.ns7.noarch
nethserver-base-3.4.0-1.ns7.noarch
nethserver-backup-data-1.3.4-1.ns7.noarch
nethserver-unbound-1.1.0-1.ns7.noarch
nethserver-vsftpd-1.1.0-1.ns7.noarch
nethserver-rh-php56-php-fpm-1.0.0-1.ns7.noarch
nethserver-mysql-1.1.3-1.ns7.noarch
nethserver-httpd-admin-2.3.2-1.ns7.noarch
nethserver-ejabberd-1.1.5-1.ns7.noarch
nethserver-firewall-base-ui-3.4.1-1.ns7.noarch
nethserver-smartd-1.1.0-1.ns7.noarch
nethserver-postgresql-1.1.0-1.ns7.noarch
nethserver-mail-smarthost-1.0.1-1.ns7.noarch
nethserver-httpd-3.2.5-1.ns7.noarch
nethserver-restore-data-1.2.4-1.ns7.noarch
nethserver-lib-2.2.7-1.ns7.noarch
nethserver-hosts-1.2.2-1.ns7.noarch
nethserver-spamd-1.0.1-1.ns7.noarch
nethserver-cgp-2.1.3-1.ns7.noarch
nethserver-lang-en-1.2.12-1.ns7.noarch
nethserver-mail-filter-1.4.4-1.ns7.noarch
nethserver-firewall-base-3.4.1-1.ns7.noarch
nethserver-ntp-1.1.3-1.ns7.noarch
nethserver-mail-disclaimer-1.6.7-1.ns7.noarch
nethserver-nextcloud-1.2.2-1.ns7.noarch
nethserver-getmail-1.0.3-1.ns7.noarch
nethserver-dnsmasq-1.6.6-1.ns7.noarch
nethserver-yum-1.4.1-1.ns7.noarch
nethserver-php-1.2.0-1.ns7.noarch
nethserver-antivirus-1.2.1-1.ns7.noarch
nethserver-phonehome-1.3.0-1.ns7.noarch
nethserver-duc-1.4.3-1.ns7.noarch
nethserver-lang-ru-1.2.12-1.ns7.noarch
nethserver-release-7-8.ns7.noarch
[root@server ~]#

To upgrade to mail2 would be as specified in the manual for the pop3connector upgrade procedure:

yum swap -- remove nethserver-mail-{common,disclaimer,filter,server} nethserver-getmail nethserver-spamd -- install nethserver-mail2-{common,disclaimer,filter,server,getmail}

But first we should find a way to make yum work again, and I’m not sure how.
Is there enough free space on the partitions for temp/cache files?

df -h

Probably it’s OK, but If you don’t mind sharing yum.conf file content:

cat /etc/yum.conf

Some other checks (share results):

rpm -qa python rpm* yum*    # get packages version
rpm -qaV python rpm* yum*   # verify file properties against rpm database
yum --noplugins check-update    # try yum without plugins (probably will make no difference, but just in case)
yum --setopt usercache=1 check-update    # try with the reported usercache attribute

Another idea is to check yum history for some mistype or copy/paste error that could have lead to this situation. See if you spot something:

yum history info <transaction ID number or * wildcard>
2 Likes

cat /etc/yum.conf

[root@server ~]# cat /etc/yum.conf
#================= DO NOT MODIFY THIS FILE =================
#
#Manual changes will be lost when this file is regenerated.
#
#Please read the developer's guide, which is available
#at NethServer official site: https://www.nethserver.org
#
#
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=https://github.com/NethServer/dev
distroverpkg=centos-release
#
#20proxy - disabled
#

#
#30groups use compat group mode
#
group_command=compat

#This is the default, if you make this bigger yum won't see if the metadata
#is newer on the remote and so you'll "gain" the bandwidth of not having to
#download the new metadata and "pay" for it by yum not having correct
#information.
#It is esp. important, to have correct metadata, for distributions like
#Fedora which don't keep old packages around. If you don't like this checking
#interupting your command line usage, it's much better to have something
#manually check the metadata once an hour (yum-updatesd will do this).
#metadata_expire=90m

#PUT YOUR REPOS HERE OR IN separate files named file.repo
#in /etc/yum.repos.d


http_caching=none

rpm -qa python rpm* yum* # get packages version

[root@server ~]# rpm -qa python rpm* yum*
yum-plugin-fastestmirror-1.1.31-45.el7.noarch
yum-3.4.3-158.el7.centos.noarch
rpm-python-4.11.3-32.el7.x86_64
rpm-4.11.3-32.el7.x86_64
yum-metadata-parser-1.1.4-10.el7.x86_64
rpm-libs-4.11.3-32.el7.x86_64
yum-plugin-changelog-1.1.31-45.el7.noarch
rpm-build-libs-4.11.3-32.el7.x86_64
yum-cron-3.4.3-158.el7.centos.noarch
python-2.7.5-68.el7.x86_64

rpm -qaV python rpm* yum* # verify file properties against rpm database

[root@server ~]# rpm -qaV python rpm* yum*
S.5....T.  c /etc/yum.conf
S.5....T.  c /etc/yum/yum-cron.conf

yum --noplugins check-update # try yum without plugins (probably will make no difference, but just in case)

[root@server ~]# yum --noplugins check-update
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 375, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 170, in main
    base.getOptionsConfig(args)
  File "/usr/share/yum-cli/cli.py", line 295, in getOptionsConfig
    (opts, self.cmds) = self.optparser.setupYumConfig(args=args)
  File "/usr/share/yum-cli/cli.py", line 2311, in setupYumConfig
    if not self.base.conf.usercache and os.geteuid() != 0:
AttributeError: 'YumConf' object has no attribute 'usercache'

yum --setopt usercache=1 check-update # try with the reported usercache attribute

[root@server ~]# yum --setopt usercache=1 check-update
Loaded plugins: changelog, fastestmirror, nethserver_events
Main config did not have a usercache attr. before setopt
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 375, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 170, in main
    base.getOptionsConfig(args)
  File "/usr/share/yum-cli/cli.py", line 354, in getOptionsConfig
    self.parseCommands() # before we return check over the base command + args
  File "/usr/share/yum-cli/cli.py", line 396, in parseCommands
    self._set_repos_cache_req()
  File "/usr/share/yum-cli/cli.py", line 445, in _set_repos_cache_req
    if repo._matchExpireFilter():
AttributeError: 'YumRepository' object has no attribute '_matchExpireFilter'

yum history info <transaction ID number or * wildcard>

[root@server ~]# yum history info <transaction ID number or * wildcard>
-bash: syntax error near unexpected token `newline'

Only difference in /etc/yum.conf is:

Not present by default. I guess you added it to try to solve the problem.


Sorry for the confusion, the command would be using the transaction IDs you can get with yum history command, or all transactions with the wildcard:

yum history info *

This would just help if you spot some malformed command.

Python and packages versions are ok (I was suspecting a problem with the python version or some other required library).

Do you have custom repos?

yum repolist

Also note:

1 Like

**yum history info ***

[root@server ~]# yum history info *
Loaded plugins: changelog, fastestmirror, nethserver_events
Traceback (most recent call last):
File “/usr/bin/yum”, line 29, in
yummain.user_main(sys.argv[1:], exit_code=True)
File “/usr/share/yum-cli/yummain.py”, line 375, in user_main
errcode = main(args)
File “/usr/share/yum-cli/yummain.py”, line 170, in main
base.getOptionsConfig(args)
File “/usr/share/yum-cli/cli.py”, line 295, in getOptionsConfig
(opts, self.cmds) = self.optparser.setupYumConfig(args=args)
File “/usr/share/yum-cli/cli.py”, line 2311, in setupYumConfig
if not self.base.conf.usercache and os.geteuid() != 0:
AttributeError: ‘YumConf’ object has no attribute ‘usercache’
[root@server ~]#

yum repolist

[root@server ~]# yum history info *
Loaded plugins: changelog, fastestmirror, nethserver_events
Traceback (most recent call last):
File “/usr/bin/yum”, line 29, in
yummain.user_main(sys.argv[1:], exit_code=True)
File “/usr/share/yum-cli/yummain.py”, line 375, in user_main
errcode = main(args)
File “/usr/share/yum-cli/yummain.py”, line 170, in main
base.getOptionsConfig(args)
File “/usr/share/yum-cli/cli.py”, line 295, in getOptionsConfig
(opts, self.cmds) = self.optparser.setupYumConfig(args=args)
File “/usr/share/yum-cli/cli.py”, line 2311, in setupYumConfig
if not self.base.conf.usercache and os.geteuid() != 0:
AttributeError: ‘YumConf’ object has no attribute ‘usercache’
[root@server ~]#

There is no problem with repository

If yum reinstall yum didn’t succeed, as all yum commands are failing, you can try to install it with rpm command:

rpm -Uvh --replacepkgs http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm -Uvh --replacepkgs http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm

Head scratching issue… disk health (file corruption)?, upstream bug? (have the same version but didn’t run into this issue)

3 Likes