{"id":137,"date":"2010-06-21T14:35:40","date_gmt":"2010-06-21T22:35:40","guid":{"rendered":"http:\/\/www.wilyness.com\/blog\/?p=137"},"modified":"2011-06-13T13:59:38","modified_gmt":"2011-06-13T21:59:38","slug":"fix-for-preupgrade-cli-on-fedora-12","status":"publish","type":"post","link":"https:\/\/www.wilyness.com\/blog\/?p=137","title":{"rendered":"Fix for preupgrade-cli on Fedora 12"},"content":{"rendered":"<p><strong>Background:<br \/>\n<\/strong>I had been running Fedora 12 on my home server with a 5-year old CPU and Nvidia video card.  Last weekend, I decided to modernize with fancy new hardware, an Intel G6950 dual-core with integrated graphics.  This is great, but Fedora 12 has graphics drivers that like to crash with Intel integrated graphics hardware, so once I changed the hardware, my desktop would freeze, about 30 seconds after logging in.  So I decided to upgrade to Fedora 13.<\/p>\n<p>The generally recommended way to upgrade on Fedora is to use the preupgrade tool, which would be nice, graphical, and great if my graphical desktop didn&#8217;t crash (and if it didn&#8217;t, I&#8217;d be sticking with F12 for now).  So the alternative is supposed to be &#8220;preupgrade-cli&#8221;.  This would work, because I could boot and do a console (non-graphical) login, so the video driver couldn&#8217;t muck things up (as easily?).<\/p>\n<p><strong>Problem: preupgrade-cli doesn&#8217;t work in Fedora 12.<br \/>\n<\/strong>(Okay, maybe it will for you, because you have executive platinum status with Fedora.)  I got this error, which is pasted below:<br \/>\n<code># preupgrade-cli<br \/>\nLoaded plugins: blacklist, dellsysidplugin2, priorities, versionlock, whiteout<br \/>\nNo plugin match for: rpm-warm-cache<br \/>\nNo plugin match for: auto-update-debuginfo<br \/>\nNo plugin match for: refresh-packagekit<br \/>\nNo plugin match for: presto<br \/>\nTraceback (most recent call last):<br \/>\nFile \"\/usr\/share\/preupgrade\/preupgrade-cli.py\", line 316, in<br \/>\npu = PreUpgradeCli()<br \/>\nFile \"\/usr\/share\/preupgrade\/preupgrade-cli.py\", line 52, in __init__<br \/>\nPreUpgrade.__init__(self)<br \/>\nFile \"\/usr\/lib\/python2.6\/site-packages\/preupgrade\/__init__.py\", line 80, in __init__<br \/>\nself._getConfig()<br \/>\nFile \"\/usr\/lib\/python2.6\/site-packages\/yum\/__init__.py\", line 282, in _getConfig<br \/>\nstartupconf.pluginconfpath,disabled_plugins,enabled_plugins)<br \/>\nFile \"\/usr\/lib\/python2.6\/site-packages\/yum\/__init__.py\", line 465, in doPluginSetup<br \/>\nplugin_types, confpath, disabled_plugins, enabled_plugins)<br \/>\nFile \"\/usr\/lib\/python2.6\/site-packages\/yum\/plugins.py\", line 160, in __init__<br \/>\nself.run('config')<br \/>\nFile \"\/usr\/lib\/python2.6\/site-packages\/yum\/plugins.py\", line 177, in run<br \/>\nfunc(conduitcls(self, self.base, conf, **kwargs))<br \/>\nFile \"\/usr\/lib\/yum-plugins\/versionlock.py\", line 153, in config_hook<br \/>\nconduit.registerCommand(VersionLockCommand())<br \/>\nFile \"\/usr\/lib\/python2.6\/site-packages\/yum\/plugins.py\", line 499, in registerCommand<br \/>\nself._base.registerCommand(command)<br \/>\nFile \"\/usr\/share\/yum-cli\/cli.py\", line 106, in registerCommand<br \/>\nif name in self.yum_cli_commands:<br \/>\nAttributeError: 'PreUpgradeCli' object has no attribute 'yum_cli_commands'<br \/>\n<\/code><br \/>\nApparently the anonymous poster at the <a href=\"http:\/\/www.howtoforge.com\/how-to-upgrade-from-fedora-12-to-fedora-13-desktop-and-server\">How to Upgrade<\/a> page had the same problem.  Perhaps we are the only two to bother with the &#8220;arcane&#8221; command-line preupgrade tool.  I am curious as to whether anyone (at all) succeeded with preupgrade-cli for Fedora 12 to Fedora 13.<\/p>\n<p><strong>Solution: Patch preupgrade-cli.py.<\/strong>  If you don&#8217;t have experience writing code on Linux, this is probably not for you.  But it&#8217;s pretty straightforward.  You need to change the definition of the PreUpgradeCli class so that it self.yum_cli_commands is valid.  Do this by replacing the line:<\/p>\n<pre><code>class PreUpgradeCli(PreUpgrade, YumUtilBase):<\/code><\/pre>\n<p>with<br \/>\n<code><\/p>\n<pre>class PreUpgradeCli(PreUpgrade, YumUtilBase, YumBaseCli):\r\n<\/code><\/pre>\n<p>so that it inherits from a class with such an attribute and insert this line:<br \/>\n<code><\/p>\n<pre>        YumBaseCli.__init__(self)\r\n<\/code><\/pre>\n<p>as the first line of the initializer, below<br \/>\n<code><\/p>\n<pre>    def __init__(self):\r\n<\/code><\/pre>\n<p>and before<\/p>\n<pre><code>        PreUpgrade.__init__(self)\r\n<\/code><\/pre>\n<p>so that the parent class's initializer gets called and self.yum_cli_commands gets populated.  The file is found at <code>\/usr\/share\/preupgrade\/preupgrade-cli.py<\/code><\/p>\n<p>Remember, this is Python, so line indentation is important.  There you go.  preupgrade-cli should work as normal now.<\/p>\n<p>Note:  I don't know whether this is the Right Way To Fix It, but it seemed reasonable to me, and I got the result I wanted.  I will probably point the developer of preupgrade-cli.py to this page so he\/she can compose a better fix.<\/p>\n<p>Update (6\/13\/2011): This fix has been accepted officially (see comments), thanks to the efforts of Andrew Meredith, who opened the bug on Red Hat's bugzilla, and Martin Dengler who opened a ticket in preupgrade's own Trac site.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Background: I had been running Fedora 12 on my home server with a 5-year old CPU and Nvidia video card. Last weekend, I decided to modernize with fancy new hardware, an Intel G6950 dual-core with integrated graphics. This is great, &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/www.wilyness.com\/blog\/?p=137\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/www.wilyness.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/137"}],"collection":[{"href":"https:\/\/www.wilyness.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wilyness.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wilyness.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wilyness.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=137"}],"version-history":[{"count":13,"href":"https:\/\/www.wilyness.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/137\/revisions"}],"predecessor-version":[{"id":150,"href":"https:\/\/www.wilyness.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/137\/revisions\/150"}],"wp:attachment":[{"href":"https:\/\/www.wilyness.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wilyness.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wilyness.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}