Should I reinstall Linux when changing the laptop's CPU?

13,873

Solution 1

Ubuntu (and generally speaking Linux) don't particularly care what hardware they're running on, and will perform a check on all devices at boot rather than assuming that the same devices are there each time. So long as your CPU is compatible with your chipset, Ubuntu will see it and start using it. Ubuntu 18.04 is also only available in the 64-bit version, so that's not a concern either.

Windows, on the other hand, has licensing to worry about. When you buy a copy of Windows, the idea is that you buy it for a single machine, so Windows tends to more or less "lock" itself to a system's hardware. This doesn't mean that you can't change hardware, but if you do it too frequently (like I've managed to do) it will start to say your key is invalid. If you're in a dual-boot system, this is something to keep in mind.

Solution 2

should I completely reinstall Ubuntu?

No.

Counter-intuitively, changing CPU is one the least meaningful changes in hardware. Usually it doesn't require any changes in software.

That's because your CPU swapping options are extremely limited by socket and chipset. Those limit you to CPUs coming from one or two product generations that are very similar feature-wise. Sure, they may differ in features that matter to you, like number of cores, clock speed and cache size. But those are virtually transparent to the software. The architecture, instructions, registers and all other details that are important to how the software uses CPU remain same. Top execution speed is not something that modern software depends on (the actual execution speed fluctuates all the time due to energy saving anyway).

Even non-open systems, which lock license to the hardware (like Windows) don't consider CPU as "important" hardware. Swapping CPU and RAM are considered standard customer procedures and don't invalidate license.

Solution 3

If the CPU architecture is the same (e.g. 64 bit/amd64) it should work out of the box. 15 years ago, I took a harddisk of one computer to a different one (both 32bit) and it worked out of the box as expected.

The "slower/different start" depends partly on the speed of the CPUs, so if your new CPU is faster/newer/more expensive it should be and boot faster.

Solution 4

No, you don't need to reinstall, because Ubuntu compiles all packages for what is known as "generic amd64". This is a collection of instruction sets present in every single amd64 CPU. Any programs that use instructions beyond this base set(also known as instruction set extensions) include fall-backs.

Now, let's assume:

  • you were using packages that make use of instruction set extensions, such as AVX2 and don't provide fall-backs,
  • you're moving to a CPU which doesn't support this particular instruction set.

This is highly unlikely to happen when only switching CPUs. You'd have to be downgrading the CPU to find one on the same motherboard that supports less instruction sets.

Even then, you wouldn't need to reinstall your OS, although it might be the easier option. You could instead recompile your packages to generic amd64. After switching everything would work fine, albeit slower. To accelerate it, you could recompile yet again, this time using extensions supported by the new CPU.

Share:
13,873

Related videos on Youtube

hadarS
Author by

hadarS

In C++: Got a problem? Use a pointer. Now you have 2 problems...

Updated on September 18, 2022

Comments

  • hadarS
    hadarS over 1 year

    I am planning on changing my laptop's CPU in the next few days.

    Should I expect anything from Ubuntu? Like a slower/different start for the first time, or should I completely reinstall Ubuntu?

    They are both of 64-bit architecture.


    Later Edit: After a few weeks, I can proudly say that Linux truly is wonderful! My laptop worked perfectly after changing the CPU.

    As a side note, my Windows worked also without anything extra.

    • EODCraft Staff
      EODCraft Staff about 5 years
      Was your Original install 32 Bit compared to 64 and is the processor now 64?
    • Pilot6
      Pilot6 about 5 years
      It is impossible to switch a laptop CPU from 32 to 64 bit on the same motherboard.
    • Mark
      Mark about 5 years
      @Pilot6, I'm not familiar with laptops, but on the desktop, it's at least theoretically possible for a Socket 754 or LGA 775 board to support both 32-bit and 64-bit CPUs.
    • technical_difficulty
      technical_difficulty about 5 years
      only if you run gentoo
  • Ismael Miguel
    Ismael Miguel about 5 years
    This holds true even when you go from real hardware to a VM. At the company I'm working at, we've combined 3 servers into a single Debian machine with 3 VMs. One of them was my trusted web development machine. Before, it was a dedicated tower for it. It runs flawlessly. (For the record, I use VirtualBox)
  • Iluvathar
    Iluvathar about 5 years
    Note that it's only the "normal" Ubuntu which is 64-bit only: other flavors like Kubuntu and Xubuntu do offer 32-bit versions. And although Kubuntu doesn't seem to have a 32-bit download for 18.10, Xubuntu does for that version too.
  • Alexander
    Alexander about 5 years
    @Minty "When you buy a copy of Windows, the idea is that you buy it for a single machine, so Windows tends to more or less "lock" itself to a system's hardware." Haha, sounds like the ship of Theseus. Unless it locks to one particular component, that could have interesting consequences. If I change my CPU, then my motherboard, then my graphics card, ..., one component at a time, booting each time to confirm Windows is still happy, will Windows eventually reject my system? What's the cut-off?
  • Mark
    Mark about 5 years
    @Alexander, the last time I looked at it, the cutoff was ten "points" of change in a six-month period, where different hardware parts had different point values (eg. a change in memory capacity was 1 point, while changing a network card was something like 5 points).
  • Mark
    Mark about 5 years
    Today, with everything being multi-core, it's true that the CPU is nearly the least significant thing you can change. But going from one core to more than one core is probably the most significant change you can make (multi-threading is a lot more complicated and bug-prone when you really can have two things happening at the same time).
  • ski
    ski about 5 years
    @Mark: True, but the times where distributions came with separate kernels for SMP and non-SMP are long gone. Modern kernels (which I define very generously, because AFAIR this feature has existed for at least a decade) start up under the assumption that they run a native SMP CPU, and if they detect a single-core CPU without hyperthreading, they use runtime binary patching to overwrite the SMP code with more efficient one. Likewise, the kernel can dynamically detect a hypervisor and switch to paravirtualization on bootup.
  • ski
    ski about 5 years
    @Mark: After all, most distributions have a Live CD now, that runs a single kernel almost everywhere.
  • James_pic
    James_pic about 5 years
    Note that there are a handful of Linux-based OSs that do sometimes care about changes to CPU, Gentoo being the most obvious example. However, these OSs are very much aimed at power users.
  • user149408
    user149408 about 5 years
    I did the same when I switched laptops, AFAIR on Ubuntu 16.04. Moved the hard disk from the old laptop into the new one (I had upgraded the HD some time before, to something bigger than the new laptop came with), and it booted with no issues. The only thing I needed to to is re-configure my wifi connections to use the new wifi adapter—which may be a general concern for any configuration setting that is bound to a particular device, most notably network adapters.
  • vaquito
    vaquito about 5 years
    @Alexander The exact details are not made public by Microsoft (presumably because they don't want hackers to find it and remove it). Remember this is what keep most people honest and actually buy the product.