User Tools

Site Tools


moving_debian_to_an_other_computer

If you want to send us your comments, please do so. Thanks
More on comments


Moving Debian to an other computer

Bind mount

A bind mount is an alternate view of a directory tree. A bind mount takes an existing directory tree and replicates it under a different mount point. The directories and files in the bind mount are the same as the original. So files and directories are changed on both trees if changed in one tree.

Introduction

After moving an existing Debian installation to an other computer, placing the harddisk in an other computer an error can occur:

Gave up waiting for suspend/resume device
Gave up waiting for root file system device. Common problems
- Boot args (cat /proc/cmdline)
  - Check rootdelay= (did the system wait long enough?)
- Missing modules (cat /proc/modules: ls /dev)
ALERT!  UUID=uuidhash does not exist. Dropping to a shell!

Busybox v1.30.1 (Debian 1:1.30.1-4) build in shell (ash)
Enter 'help' for a list of build in commands.

(initramfs)

GrubEFIReinstall also valid, most of it, for BIOS only computers

Observations

  • The disk to be booted from is know
  • ls /dev does not show the disk nor a /dev/disk/ directory
  • “Missing modules”. Which modules are missing?

Tried,

  • mkdir /mnt/sda
  • mount /dev/sda1 /mnt/sda
  • mkdir /mnt/sda/bindmount
  • cd /mnt/sda
  • mkdir /mnt/sda/bindmount/dev The same for proc, sys, and run
  • mount --bind /dev /mnt/sda/bindmount The same for proc, sys, and run
  • chroot bindmount → failed to run command '/bin/bash'. The same for chroot bindmount /bin/bash
  • Should /bin be bindmounted too so 'update-initramfs -u -k all` and `update-grub` can be ran?

EFI Formatting

EFI System Partition (ESP) should be formatted as vfat (FAT32 (FAT16 or FAT12 will also do mostly).

Grub2 reinstall via Chroot

Prerequisites

You will need a computer with

  • a PS/2 keyboard port and a PS/2 keyboard (used in the following procedure) or
  • a BIOS which can handle a USB keyboard (not tested)

For futrure use

We have a working system now. So, if it ain't broken do not fix it
These, “Todo” and “Other solutions, idea's”, can be tried on a next occasion:

Todo

IDE back to SATA in the BIOS. To add to the procedure above and do

  • MODULES=most in /etc/initramfs-tools/initramfs.conf
  • generate a new initramfs update-initramfs -u -k all
  • grub-install
  • update-grub
  • chroot exit
  • reboot

Other solutions, idea's

  • When using the Grml live disk on a system without the Grml default zsh: mount /dev/sda1 /mnt; grml-chroot /mnt /bin/bash
  • Search for “grub disk driver modules”
  • EFI System Partition (ESP) should be in vfat format
  • Grub2 insert additional kernel modules
  • Understanding the Various Grub Modules
  • Set the HDD driver to RAID in the BIOS instead of AHCI, SATA or IDE. Setting up RAID is not needed.
  • Install Grub2 via ChRoot

This is preformed on a BIOS only computer with an ext4 formatted harddisk, no RAID, no LVM, no bcache. Source

What we preformed

  • Boot to the latest Parted Magic Live CD
    • The CD should be booted in 64bit (not 32bit) if the system to fix is 64 bit
    • Alternative live CD: Grml
  • Open a terminal
  • Log in as root if not already
  • Determine your normal system partition with one of
    • fdisk -l (lowercase “L”)
    • blkid
    • df -Th
  • mount /dev/sdXY /mnt
    • Example: mount /dev/sda1 /mnt
    • If you have a separate boot partition (where sdXY is the /boot partition designation) do:
      • mount /dev/sdXY /mnt/boot
        • Example: mount /dev/sdb6 /mnt/boot
  • Mount the critical virtual filesystems. Run the following as a single command:
    • for i in /dev /dev/pts /proc /sys /run; do mount --bind $i /mnt/$i; done
  • Chroot into your normal system device
    • chroot /mnt
      • When we booted from Grml we got
        • chroot: failed to run command `/bin/zsh`: No such file or directory
          • ls /bin/zsh shows zsh
  • Reinstall GRUB 2 (substitute the correct device with sda, sdb, etc. Do not specify a partition number)
    • grub-install /dev/sdX
      • Example: grub-install /dev/sda
      • Result as expected:
        • Installing for i386-pc platform
        • Installation finished. No error reported.
      • Result with error:
        • Installing for i386-pc platform
        • grub-install: error: failed to get canonical path of `/dev/sda1`.
          • Investigation:
            • ls /dev /dev/disk does not exist
            • blkid yields no results
            • lsblk yields all the drives including sda and its partitions including sda1
            • mount yields /dev/sda1 on / type ext4 (rw,relatime,data=ordered)
            • exit chroot; ls /dev yields the sda disk and its partitions
  • Recreate the GRUB 2 menu file (grub.cfg)
    • update-grub
      • Result with error:
        • Three line of output with expected, normal text
        • mkdir: cannot create directory 'var/lib/os-prober/mount': No such file or directory
        • Done
        • ls /var results in one directory shown: /var/run
      • Solution. Run:
        • mkdir -p var/lib/os-prober/mount
        • update-grub
        • Now it works as expected
  • Exit chroot: CTRL-D on keyboard
  • Reboot
    • reboot
  • Back to 'ALERT! UUID=uuidhash does not exist. Dropping to a shell!'
  • Reboot
  • Changed the disk BIOS setting from SATA to IDE
    • System boots in
      • “You are in emergency mode”
      • Give root password for maintenance:
      • (Or press Control-D to continue):
    • Gave root password
    • Did journalctl -xb
    • Found one red line: indicating an external HDD was not connected
    • Did vi /etc/fstab and commented out the external HDD
    • reboot
  • Got the GUI login screen, logged in. Works as expected

Main subjects on this wiki: Linux, Debian, HTML, Microcontrollers, Privacy

RSS
Disclaimer
Privacy statement
Bugs statement
Cookies
Copyright © : 2014 - 2022 Webevaluation.nl and the authors
Changes reserved.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
moving_debian_to_an_other_computer.txt · Last modified: 27-07-2022 22:19 by wim