This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux:filesystems:boot [2012/04/25 16:57] tkilla |
linux:filesystems:boot [2022/11/06 21:39] (current) tkilla |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
**linux boot process tricks** | **linux boot process tricks** | ||
- | === howto clone harddisc and boot new system === | + | ==== howto clone harddisc and boot new system |
**To transfer all system files,** it's best to get a live USB-stick or CD and boot into it \\ | **To transfer all system files,** it's best to get a live USB-stick or CD and boot into it \\ | ||
Line 13: | Line 13: | ||
rsync -a -v -z -h --perms -E -o -g --times --compress --update --delete \ | rsync -a -v -z -h --perms -E -o -g --times --compress --update --delete \ | ||
- | --exclude="/ | + | --exclude="/ |
+ | -> may cause strange bugs, like permissions in /var/run/, maybe /dev probs | ||
2. simple **copy** with " | 2. simple **copy** with " | ||
Line 25: | Line 26: | ||
- | 4. **gparted** - no ext4, only from livesystems | + | 4. **parted** - no ext4, only from livesystems |
etc... | etc... | ||
Line 33: | Line 34: | ||
**Fix partition-identifier UUIDs in fstab** of the new system. | **Fix partition-identifier UUIDs in fstab** of the new system. | ||
The UUIDs need to be replaced by the new UUIDs in **/ | The UUIDs need to be replaced by the new UUIDs in **/ | ||
- | + | This shows 'em all: :) | |
- | | + | ls -l / |
- | + | ||
- | .. shows 'em all :) | + | |
---- | ---- | ||
\\ | \\ | ||
- | **Install grub2 bootloader to the new disc** - | + | **Install grub2 bootloader** to the new disc - \\ |
- | unfortunatly | + | unfortunately |
- | * **mount dev, proc, sys** via " | + | **mount dev, proc, sys** via " |
mount -o bind /dev / | mount -o bind /dev / | ||
mount -t proc none / | mount -t proc none / | ||
mount -t sysfs none / | mount -t sysfs none / | ||
- | * **enter** the new (virtual) root system: | + | |
+ | **Enter** the new (virtual) root system: | ||
chroot / | chroot / | ||
- | * now inside this future system, grub2 installer scripts will work. \\ | ||
- | generate a new (/ | ||
+ | Now inside this future system, grub2 installer scripts will work - \\ | ||
+ | **generate a new (/ | ||
update-grub | update-grub | ||
+ | |||
+ | In case of error "no such disc" run | ||
+ | grub-mkdevicemap | ||
+ | |||
+ | |||
+ | **Install to the MBR (no partition number) of the new disc, finally:** | ||
grub-install /dev/sdX | grub-install /dev/sdX | ||
+ | |||
+ | reboot & good luck! | ||
+ | |||
+ | |||
+ | ---- | ||
+ | \\ | ||
+ | |||
+ | ** initramfs ** | ||
+ | the step after the bootloader needs all (fs, rais,..) modules to mount root, check: / | ||
+ | |||
+ | update existing initramfs: | ||
+ | update-initramfs -u -k all | ||
+ | |||
+ | ** RAID ** | ||
+ | if you changed your raid setup, you need to update initramfs: | ||
+ | dpkg-reconfigure mdadm | ||
+ | |||
+ | make sure these modules are in / | ||
+ | raid0 | ||
+ | raid1 | ||
+ | md | ||
+ | |||
+ | \\ | ||
+ | References: http:// | ||
+ | |||
+ | |||
+ | \\ | ||
+ | ==== howto boot from grub2 rescue console ==== | ||
+ | |||
+ | If you drop to the grub rescue after cloning a system disc or something, it's possible to boot an existing system. | ||
+ | |||
+ | Enter this, to start a system on sda3 for example: | ||
+ | |||
+ | set prefix=(hd0, | ||
+ | insmod (hd0, | ||
+ | |||
+ | if this works, the console gets upgraded to standard grub console. | ||
+ | |||
+ | if it doesn' | ||
+ | |||
+ | This boots arch linux: | ||
+ | |||
+ | set root=(hd0, | ||
+ | linux / | ||
+ | initrd / | ||
+ | boot | ||
+ | |||
+ | This is required to boot debian - unfortunately the filenames contain versionnumbers :( | ||
+ | set root=(hd0, | ||
+ | linux / | ||
+ | initrd / | ||
+ | boot | ||
+ | | ||
+ | |||
+ | This should boot your system. Just re-install grub: | ||
+ | |||
+ | update-grub | ||
+ | grub-install /dev/sdX | ||
+ | |||
+ | |||
+ | ===== Bugs ===== | ||
+ | |||
+ | Inside a chroot, grub complains | ||
+ | # update-grub | ||
+ | Generating grub configuration file ... | ||
+ | WARNING: Device /dev/ram0 not initialized in udev database even after waiting 10000000 microseconds. | ||
+ | ... | ||
+ | |||
+ | Fix: | ||
+ | |||
+ | Outside chroot /debian/: | ||
+ | |||
+ | mkdir / | ||
+ | mount --bind /run/udev / | ||
+ | mount --bind /run/udev / | ||
+ | |||
+ | |||
+ | ===== Crypto Bugs ===== | ||
+ | |||
+ | |||
+ | Grub complains root device couldn' | ||
+ | |||
+ | Fix: | ||
+ | - set | ||
+ | GRUB_ENABLE_CRYPTODISK=y | ||
+ | |||
+ | apt install cryptsetup-initramfs lvm2 | ||
+ | | ||
+ | |||
+ | - if it is a brtfs, set in / | ||
+ | btrfs | ||
+ | |||
+ | |||
+ | Commands to execute in chroot to reinstall grub: | ||
+ | |||
+ | update-initramfs -c -k all | ||
+ | grub-install /dev/sdX | ||
+ | update-grub | ||
+ | If update-grub echos: " | ||
+ | mount -o " | ||
+ | is required to mount the @ subvol! | ||