The Dell Precision M4500, which had already given me so much grief died this morning. It was working fine last night, but this morning it would simply not power on; no lights, beeps, no indication of life at all. (I’m thinking motherboard; even though I got myself back up and running, I’ll probably order a replacement, just to get it working again so I can add it to my ever-growing pile of working-but-unused laptops.) Since this was my primary school and development laptop, it was imperative that I get something working.
(Note that I wasn’t worried about data loss. I use Tarsnap and have been quite happy with it, and I was pretty sure the HD was OK in any case; I just needed a working computer, preferably one with all my stuff on it.)
I still had my old Thinkpad T61 at home (which the M4500 was intended to replace), I figured I’d try a simple HD swap. This usually works well on Linux installs with stock kernels, as the distros tend to include drivers for everything so that changing hardware isn’t an issue. In this case, however, I ran into two problems.
Things that did not work
Setting the boot flag on the protective MBR partition did not work. Setting the legacy boot flag on the Linux system partition did not work. Installing Grub did not work (on GPT Grub needs its own partition to work with, and I didn’t have room to create one).
GPT vs. MBR
The M4500 was built to boot via GPT and UEFI; the Thinkpad supports neither. The
first step was to get it booting via the old MBR+BIOS. Although there are
apparently ways to partition your HD so that both GPT and MBR booting are
supported, I hadn’t done that when I set this system up. That left converting
the GPT structures to MBR. I only had three partitions, so I didn’t expect any
problems, but it’s still scary whenever you do something that involves
blowing away the partition table and building it from scratch. I used a Linux
live USB drive (running Mint 17.1, the same version I’m using on the desktop)
r menu contains a
g option to convert GPT to MBR. It
does almost all the work for you: you only have to set the boot flag on your
Linux system partition when it’s done.
Grub for UEFI vs. MBR
The newly-created MBR does not have any bootloader code in it, so I had to
reinstall Grub. This isn’t hard to do from a Live install, but there were
a few quirks. Most tutorials will tell you to mount your existing Linux,
/proc and a few other things into it, and then
chroot in to
grub-install. But in my case, I didn’t have the
x86-pc Grub modules,
just the UEFI modules. So I also had to mount in
/usr/lib/grub from the
flash drive. After that the Grub install/update worked fine. (After booting
my new system, I installed the
grub-pc package so that the modules would
always be available. This also removed the UEFI modules and reinstalled Grub
(again!) just to make sure everything is in sync.)
The full process
Here’s a transcript of the full process, run from a live USB drive, after
converting from GPT to MBR (which is just a matter of running
sudo gdisk, then
g, then exit and set the boot flag with the utility
of your choice).
mint@mint ~ $ sudo mkdir /mnt/hd mint@mint ~ $ sudo mount /dev/sda2 /mnt/hd mint@mint ~ $ sudo mount --bind /dev /mnt/hd/dev mint@mint ~ $ sudo mount --bind /dev/pts /mnt/hd/dev/pts mint@mint ~ $ sudo mount --bind /proc /mnt/hd/proc mint@mint ~ $ sudo mount --bind /sys /mnt/hd/sys mint@mint ~ $ sudo mount --bind /usr/lib/grub/ /mnt/hd/usr/lib/grub/ mint@mint ~ $ sudo chroot /mnt/hd mint / # grub-install /dev/sda Installing for i386-pc platform. Installation finished. No error reported. mint / # grub-install --recheck /dev/sda Installing for i386-pc platform. Installation finished. No error reported. mint / # update-grub Generating grub configuration file ... Found linux image: /boot/vmlinuz-3.13.0-37-generic Found initrd image: /boot/initrd.img-3.13.0-37-generic Found memtest86+ image: /boot/memtest86+.elf Found memtest86+ image: /boot/memtest86+.bin No volume groups found done mint / # exit mint@mint ~ $ sudo umount /mnt/hd/sys mint@mint ~ $ sudo umount /mnt/hd/proc mint@mint ~ $ sudo umount /mnt/hd/dev/pts mint@mint ~ $ sudo umount /mnt/hd/dev mint@mint ~ $ sudo umount /mnt/hd/usr/lib/grub mint@mint ~ $ sudo umount /mnt/hd
After all that, I was able to boot my system into X just fine. Only a few issues remained:
I had fiddled with the touchpad threshold values (in order to make the M4500’s touchpad less insane) and the new values didn’t make any sense on the Thinkpad. I reset them to
Having a different Wifi adapter means all my remembered connections were forgotten. Aparently the saved connections are keyed to the GUID of the WiFi card itself, which on one hand would allow you to have a separate set of connections per card (if you had more than one), but would also mean that just replacing your WiFi device would invalidate all your existing connections, too.
I also had some issues with NVidia (as usual), which for now seem to have been largely dealt with by adding
Section “Device” Identifier “Quadro NVS 140M” Driver “nvidia” Option “NoLogo” “1” Option “RenderAccel” “1” Option “TripleBuffer” “true” Option “MigrationHeuristic” “greedy” Option “UseEvents” “False” EndSection
NoLogois purely cosmetic; it just disables the NVidia spash screen when X starts up.
UseEventshopefully prevents an issue where the NVidia driver fills up X’s event queue and makes the server hang.)