Outils pour utilisateurs

Outils du site


informatique:partition_boot_remplie_sur_debian_grub_rescue

Ceci est une ancienne révision du document !


Partition boot remplie sur Debian 13

Ma partition boot s'est remplie. Une mise à jour avec un nouveau noyau n'a pas pu se faire correctement et quand j'essaye de démarrer, je me retrouve dans “grub rescue”…

J'ai booté sur une clé usb que j'avais sous la main (fedora workstation live).

À partir de là, je peux avoir un terminal complet, un clavier bien configuré (et pas un qwerty..). L'objectif va être de nettoyer la partition grub mais aussi de chroot sur mon installation pour pouvoir relancer une mise à jour.

$ sudo -i
# blkid
(partitions de la clé usb)
/dev/sda5: ... #partition principale chiffrée
/dev/sda1: ... #partition boot

(Note: On peut aussi utiliser lsblk ou fdisk pour voir les partitions.)

Bon, maintenant, faut les monter ces partitions. Je vais suivre les instructions de ce tutoriel.

# mkdir /rescue
 
# mount /dev/sda5 /rescue/
mount: /rescue: unknown filesystem type 'crypto_LUKS'
 
root@localhost-live:/rescue# cryptsetup luksOpen /dev/sda5 data
Enter passphrase for /dev/sda5: 
 
root@localhost-live:/rescue# ls -l /dev/mapper/
total 0
lrwxrwxrwx. 1 root root       7 Jun  5 08:07 betula--vg-root -> ../dm-1
lrwxrwxrwx. 1 root root       7 Jun  5 08:07 betula--vg-swap_1 -> ../dm-2
crw-------. 1 root root 10, 236 Jun  5 07:41 control
lrwxrwxrwx. 1 root root       7 Jun  5 08:07 data -> ../dm-0
 
root@localhost-live:/rescue# lsblk
NAME                    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
loop0                     7:0    0   2.3G  1 loop  /run/rootfsbase
sda                       8:0    0 447.1G  0 disk  
├─sda1                    8:1    0   487M  0 part  
├─sda2                    8:2    0     1K  0 part  
└─sda5                    8:5    0 446.7G  0 part  
  └─data                252:0    0 446.6G  0 crypt 
    ├─betula--vg-root   252:1    0 445.7G  0 lvm   
    └─betula--vg-swap_1 252:2    0   980M  0 lvm   
sdb                       8:16   1  14.6G  0 disk  
├─sdb1                    8:17   1   2.6G  0 part  /run/initramfs/live
└─sdb2                    8:18   1    30M  0 part  
sr0                      11:0    1  1024M  0 rom   
zram0                   251:0    0     8G  0 disk  [SWAP]
 
root@localhost-live:/rescue# mount -t ext4 -o noatime /dev/mapper/betula--vg-root /rescue
 
root@localhost-live:/rescue# ls /rescue/
bin  boot  dev  etc  home  initrd.img  initrd.img.old  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  snap  srv  sys  tmp  usr  var  vmlinuz  vmlinuz.old
 
root@localhost-live:/rescue# mount /dev/sda1 /rescue/boot/
 
root@localhost-live:/rescue# ls /rescue/boot/
config-6.1.0-27-amd64         config-6.12.90+deb13-amd64      lost+found                        System.map-6.12.86+deb13-amd64  vmlinuz-6.12.74+deb13+1-amd64
config-6.1.0-28-amd64         grub                            System.map-6.1.0-27-amd64         System.map-6.12.90+deb13-amd64  vmlinuz-6.12.86+deb13-amd64
config-6.12.74+deb13+1-amd64  initrd.img-6.12.86+deb13-amd64  System.map-6.1.0-28-amd64         vmlinuz-6.1.0-27-amd64          vmlinuz-6.12.90+deb13-amd64
config-6.12.86+deb13-amd64    initrd.img-6.12.90+deb13-amd64  System.map-6.12.74+deb13+1-amd64  vmlinuz-6.1.0-28-amd64
 
root@localhost-live:/boot# rm System.map-6.1.0-2*
root@localhost-live:/boot# rm System.map-6.12.74+deb13+1-amd64 
root@localhost-live:/boot# rm config-6.1.0-2*
root@localhost-live:/boot# rm config-6.12.74+deb13+1-amd64 
root@localhost-live:/boot# rm vmlinuz-6.1.0-2*
root@localhost-live:/boot# rm vmlinuz-6.12.74+deb13+1-amd64
 
root@localhost-live:/boot# df -h /boot/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       455M  268M  163M  63% /boot
 
root@localhost-live:/# mount -t proc proc /rescue/proc/
root@localhost-live:/# mount -t sysfs sys /rescue/sys/
root@localhost-live:/# mount -o bind /dev/ /rescue/dev/
root@localhost-live:/# mount -t devpts pts /rescue/dev/pts/
 
root@localhost-live:/# chroot /rescue/

Maintenant on peut réparer !

# apt update
# apt upgrade
The following packages were automatically installed and are no longer required:
  libsdl-ttf2.0-0  libwoff1  linux-headers-6.12.74+deb13+1-amd64  linux-headers-6.12.74+deb13+1-common  linux-image-6.1.0-27-amd64  linux-image-6.12.74+deb13+1-amd64  linux-kbuild-6.12.74+deb13+1
Use 'apt autoremove' to remove them.
 
Upgrading:
  (...) linux-headers-amd64 (...)
 
Installing dependencies:
  linux-headers-6.12.90+deb13.1-amd64  linux-headers-6.12.90+deb13.1-common  linux-image-6.12.90+deb13.1-amd64  linux-kbuild-6.12.90+deb13.1
 
Suggested packages:
  linux-doc-6.12  debian-kernel-handbook
 
Summary:
  Upgrading: 16, Installing: 4, Removing: 0, Not Upgrading: 0
  1 not fully installed or removed.
  Download size: 492 MB
  Space needed: 187 MB / 63.2 GB available
   - in /boot:  146 MB / 171 MB available
 
root@localhost-live:/boot# sudo apt autoremove
(...)
Summary:
  Upgrading: 0, Installing: 0, Removing: 11, Not Upgrading: 0
  1 not fully installed or removed.
  Freed space: 782 MB
(...)

Il faut réinstaller grub:

root@localhost-live:/# grub-install --target=i386-pc /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
 
root@localhost-live:/# update-grub
Generating grub configuration file ...
Found background image: .background_cache.png
Found linux image: /boot/vmlinuz-6.12.90+deb13.1-amd64
Found initrd image: /boot/initrd.img-6.12.90+deb13.1-amd64
Found linux image: /boot/vmlinuz-6.12.90+deb13-amd64
Found initrd image: /boot/initrd.img-6.12.90+deb13-amd64
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done

Après le redémarrage, je suis tombé sur une autre erreur.

Ça m'a rappelé ceci : utiliser_debian_live_pour_reparer_un_probleme_d_initramfs_kernel_panic

J'ai pu démarrer sur un ancien kernel et lancer :

# update-initramfs -u

Problème résolu!

informatique/partition_boot_remplie_sur_debian_grub_rescue.1780652193.txt.gz · Dernière modification : de simon