Convert 32-bit CentOS to 64-bit?

A 5 star hangout for overworked and underpaid system admins.
Post Reply
nutznboltz
Posts: 25
Joined: 2010/06/08 18:32:43

Convert 32-bit CentOS to 64-bit?

Post by nutznboltz » 2013/04/24 12:09:27

What if anything could go wrong when this is done?

[code]
Do not do this on a system with precious contents. Test this on a VM of no importance to anyone.
May have unknown consequences and could cause losses.
COMPLETELY AT-YOUR-OWN-RISK. NO WARANTIES EXPRESSED OR IMPLIED. YOU HAVE BEEN WARNED.

Start with a i686 (32-bit) CentOS installation.

Fetch the kernel from a mirror using wget http://centos.some-mirror.org/.../kernel-2.6.32-{some-version}.el6.x86_64.rpm
rpm -Uhv --force --ignorearch kernel-2.6.32-{someversion}.el6.x86_64.rpm
reboot
The system will be running the 64-bit kernel which is compatible with 32-bit userspace.

rpm -q | grep 86$ | sed 's/\.....//' | xargs yumdownloader
rm *.i686.rpm
rpm -iv --force *.rpm
reboot

The system will be 64-bit.
[/code]

Note:
* If you have a working 64-bit system you can use yumdownloader to fetch the kernel and scp it to the 32-bit system instead of using wget.
* The rpm -q | grep 86$ | sed 's/\.....//' | xargs yumdownloader part could be improved to not download i686 RPMs along with the x86_64 ones.
* The *.rpm may expand to be longer than a command line can be. It may be possible to create a dummy RPM that lists all the required RPMs as dependencies in the spec file.

User avatar
vonskippy
Posts: 839
Joined: 2006/12/30 03:00:04
Location: Western Slope Colorado

Convert 32-bit CentOS to 64-bit?

Post by vonskippy » 2013/04/24 19:47:13

Why risk it - and have to deal with a Frankenstein flaky system afterwards.

Backup your data and config files, wipe the hard drive, do a fresh 64bit install, restore data and app configs, and be confident your new 64bit system will be stable.

nutznboltz
Posts: 25
Joined: 2010/06/08 18:32:43

Re: Convert 32-bit CentOS to 64-bit?

Post by nutznboltz » 2013/04/24 21:06:47

I was hoping for something more specific than that but thanks anyway.

If I made two VMs, on 64-bit from the start and the other 32-bit converted to 64-bit and removed all the 32-bit kernels, and yum logs, syslogs, wtmp files, etc. and gave you root on both and asked you to tell me which was which I bet you couldn't (at least not without guessing and that would give you a 50% chance.)

User avatar
vonskippy
Posts: 839
Joined: 2006/12/30 03:00:04
Location: Western Slope Colorado

Re: Convert 32-bit CentOS to 64-bit?

Post by vonskippy » 2013/04/25 03:39:38

I'm guessing a quick look at the default installed repo's will tell me which is which.

nutznboltz
Posts: 25
Joined: 2010/06/08 18:32:43

Re: Convert 32-bit CentOS to 64-bit?

Post by nutznboltz » 2013/04/25 13:01:56

And that is your definition of a flaky system?

User avatar
AlanBartlett
Forum Moderator
Posts: 9345
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk
Contact:

Re: Convert 32-bit CentOS to 64-bit?

Post by AlanBartlett » 2013/04/25 22:46:31

Moved to [i]CentOS Social[/i], as this thread does not contain a support query.

nutznboltz
Posts: 25
Joined: 2010/06/08 18:32:43

Re: Convert 32-bit CentOS to 64-bit?

Post by nutznboltz » 2013/04/26 00:57:40

It's OK. Even if the question was in the support forum nobody here is smart enough to answer it.

Atratus
Posts: 1
Joined: 2014/10/25 00:17:31

Re: Convert 32-bit CentOS to 64-bit?

Post by Atratus » 2014/10/25 00:30:49

I've been experimenting with this and run into one little glitch: at the point of installing all the downloaded x86_64.rpm files it rpm itself has a cow when the architecture of the rpm command changes. At that point I deleted the __db.* files from /var/lib/rpm , rebuilt the database with rpm --rebuilddb , and then reran the rpm -iv *.rpm command. So far so good, but I am still waiting for it to finish.

This old thread ended up being relevant to me out of a desire to upgrade a 32-bit install of CentOS 6 to CentOS 7 where there is no longer a 32-bit version.

Yes, I realize the a fresh install is the recommended way to go, but there is a special combination of curious and lazy involved in this experiment ;)

Post Reply