[CentOS] yum tries to install a mix of architectures

Fri Mar 11 23:20:31 UTC 2011
Nico Kadel-Garcia <nkadel at gmail.com>

On Fri, Mar 11, 2011 at 2:32 PM, Tim Dunphy <bluethundr at gmail.com> wrote:
> This is pretty much the most useful thread I've ever been a part of on
> the CentOS mailing list!!
>
> Thanks a ton to everyone who helped!!
>
>  Also the senior SA I work with gave me this little gem today:
>
>  yum -y remove $(yum list installed |  awk '{print $1}'| egrep -v
> "(x86_64|noarch)")
>
>
> But of course make SURE you uname -a and make sure the arch is right
> before you do because of the -y flag or of course just remove it if
> that makes you more comfortable!
>
> Best!
> Tim

Tim, unless you've misinterpreted what he said, that "senior SA"
should have his scripting privileges revoked and his title replaced
with "script-kiddie wanna-be". That command is hideously dangerous.

The first flaw is that it will flush the GPG keys, which have
architecture '(none)'

The second flaw is that noarch and x86_64 packages may have
*dependencies* on components that are i386 or i686 or some other
architecture, and rippiong out the i386 packages may rip out the
x86_64 packages as well.

Third is that using "yum" to generate the target list will wind up
trying to remove packages you don't even have installed, or packages
that have i386 versions in one repository but not in the other
repository, and cause *real* chaos.

If you need to do something like this, take a look at an actual list
generated with

                LANG=C rpm -qa --qf '%{name}.%{arch}\n" | egrep -v
"(x86_64|noarch)")

Then use yum to go down the list and *manually* accept them, not
automatically, for your own safety.