Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux_faq:fix_grub_initramfs_boot [2020/09/26 14:51] – [initramfs] admin | linux_faq:fix_grub_initramfs_boot [2022/01/14 20:39] (current) – [Real Fix] admin | ||
---|---|---|---|
Line 36: | Line 36: | ||
exec switch_root /newroot /sbin/init | exec switch_root /newroot /sbin/init | ||
</ | </ | ||
- | ИЛИ | + | ИЛИ |
В случае с **Ubuntu** дефолтным рутом является директория **/root**, поэтому можно делать так: | В случае с **Ubuntu** дефолтным рутом является директория **/root**, поэтому можно делать так: | ||
< | < | ||
Line 46: | Line 46: | ||
mount --bind /sys /root/sys | mount --bind /sys /root/sys | ||
exit | exit | ||
- | </ | + | </ |
+ | ====== Чиним GRUB и initramfs ====== | ||
+ | После того, как система нормально загрузилась восстанавливаем **GRUB** и **initramfs**: | ||
+ | < | ||
+ | sudo grub-install --target=x86_64-efi --recheck --efi-directory=/ | ||
+ | sudo update-initramfs -u | ||
+ | sudo update-grub | ||
+ | sudo reboot | ||
+ | </ | ||
====== Live-CD ====== | ====== Live-CD ====== | ||
Если есть возможность загрузиться с Live-CD, то починить загрузчик GRUB можно так: | Если есть возможность загрузиться с Live-CD, то починить загрузчик GRUB можно так: | ||
Line 61: | Line 69: | ||
chroot /mnt/ | chroot /mnt/ | ||
grub-install /dev/sdb | grub-install /dev/sdb | ||
- | update-grub | ||
update-initramfs -u | update-initramfs -u | ||
+ | update-grub | ||
exit | exit | ||
umount / | umount / | ||
Line 89: | Line 97: | ||
* переустановить **grub**: < | * переустановить **grub**: < | ||
Всё. В итоге система поднялась. | Всё. В итоге система поднялась. | ||
+ | |||
+ | |||
+ | ====== Real Fix ====== | ||
+ | / | ||
+ | смотрим диски | ||
+ | < | ||
+ | root@rescue ~ # lsscsi | ||
+ | [N: | ||
+ | [N: | ||
+ | [N: | ||
+ | [N: | ||
+ | [N: | ||
+ | [N: | ||
+ | [N: | ||
+ | [N: | ||
+ | </ | ||
+ | Я знаю, что EFI находится на (hd1,gpt2), а / и /boot - на LVM-томе **/ | ||
+ | Монтируем root и биндим все что надо: | ||
+ | < | ||
+ | / | ||
+ | root@rescue ~ # lsblk / | ||
+ | NAME | ||
+ | pve-root 253:0 0 96G 0 lvm | ||
+ | root@rescue ~ # resize2fs / | ||
+ | resize2fs 1.46.2 (28-Feb-2021) | ||
+ | Please run ' | ||
+ | |||
+ | root@rescue ~ # e2fsck -f / | ||
+ | e2fsck 1.46.2 (28-Feb-2021) | ||
+ | Pass 1: Checking inodes, blocks, and sizes | ||
+ | Pass 2: Checking directory structure | ||
+ | Pass 3: Checking directory connectivity | ||
+ | Pass 4: Checking reference counts | ||
+ | Pass 5: Checking group summary information | ||
+ | / | ||
+ | root@rescue ~ # resize2fs / | ||
+ | resize2fs 1.46.2 (28-Feb-2021) | ||
+ | Resizing the filesystem on / | ||
+ | The filesystem on / | ||
+ | |||
+ | root@rescue ~ # lvreduce -L -1G / | ||
+ | WARNING: Reducing active logical volume to 95.00 GiB. | ||
+ | THIS MAY DESTROY YOUR DATA (filesystem etc.) | ||
+ | Do you really want to reduce pve/root? [y/n]: y | ||
+ | Size of logical volume pve/root changed from 96.00 GiB (24576 extents) to 95.00 GiB (24320 extents). | ||
+ | Logical volume pve/root successfully resized. | ||
+ | root@rescue ~ # e2fsck -f / | ||
+ | e2fsck 1.46.2 (28-Feb-2021) | ||
+ | Pass 1: Checking inodes, blocks, and sizes | ||
+ | Pass 2: Checking directory structure | ||
+ | Pass 3: Checking directory connectivity | ||
+ | Pass 4: Checking reference counts | ||
+ | Pass 5: Checking group summary information | ||
+ | / | ||
+ | root@rescue ~ # mount / | ||
+ | root@rescue ~ # mount -t proc proc /mnt/proc | ||
+ | root@rescue ~ # mount -t sysfs sys /mnt/sys | ||
+ | root@rescue ~ # mount -o bind /dev /mnt/dev | ||
+ | root@rescue ~ # mount -t devpts pts / | ||
+ | root@rescue ~ # chroot /mnt | ||
+ | root@rescue:/# | ||
+ | root@rescue:/# | ||
+ | Generating grub configuration file ... | ||
+ | Found linux image: / | ||
+ | Found initrd image: / | ||
+ | Found memtest86+ image: / | ||
+ | Found memtest86+ multiboot image: / | ||
+ | done | ||
+ | root@rescue:/# | ||
+ | Installing for i386-pc platform. | ||
+ | Installation finished. No error reported. | ||
+ | root@rescue:/# | ||
+ | exit | ||
+ | root@rescue ~ # umount /mnt/proc | ||
+ | root@rescue ~ # umount /mnt/sys | ||
+ | root@rescue ~ # umount / | ||
+ | root@rescue ~ # umount /mnt/dev | ||
+ | root@rescue ~ # umount / | ||
+ | root@rescue ~ # umount /mnt | ||
+ | </ | ||
+ | |||
+ |