Résoudre les problèmes de démarrage des VM Linux en raison d'une panique du noyau
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Ce document inclut des informations de dépannage concernant une VM qui ne répond plus en raison d'erreurs de panique du noyau.
Avant de commencer
Si vous souhaitez journaliser la sortie du port série sur Cloud Logging, familiarisez-vous avec Cloud Logging.
Si ce n'est pas déjà fait, configurez l'authentification.
L'authentification valide votre identité pour accéder aux services et aux API Google Cloud . Pour exécuter du code ou des exemples depuis un environnement de développement local, vous pouvez vous authentifier auprès de Compute Engine en sélectionnant l'une des options suivantes :
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and
APIs, you don't need to set up authentication.
gcloud
Installez la Google Cloud CLI.
Une fois que la Google Cloud CLI est installée, initialisez-la en exécutant la commande suivante :
Pour utiliser les exemples API REST de cette page dans un environnement de développement local, vous devez utiliser les identifiants que vous fournissez à la gcloud CLI.
Installez la Google Cloud CLI.
Une fois que la Google Cloud CLI est installée, initialisez-la en exécutant la commande suivante :
Pour en savoir plus, consultez la section S'authentifier pour utiliser REST dans la documentation sur l'authentification Google Cloud .
Panique du noyau
Une panique du noyau peut se produire lorsque le noyau ne peut pas charger correctement les modules initramfs, qui sont requis pour que le système d'exploitation invité démarre.
Une autre forme de panique du noyau peut se produire dans une situation où le noyau ne sait pas comment gérer une requête donnée et se protège en s'arrêtant.
La panique du noyau peut se produire sur une VM Compute Engine exécutant RedHat, SUSE, CentOS ou Ubuntu.
Messages d'erreur fréquents
Voici quelques-uns des événements de panique du noyau les plus courants, à titre de référence :
Kernel panic - not syncing: hung_task: blocked tasks
Kernel Panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Kernel panic - not syncing: NMI: Not continuing
Kernel panic - not syncing: out of memory. panic_on_oom is selected
Kernel panic - not syncing: Fatal Machine check
Causes courantes
L'erreur de panique du noyau peut se produire pour plusieurs raisons. Voici quelques-unes des raisons les plus courantes :
L'entrée associée au fichier initramfs correspondant au noyau n'existe pas dans le fichier grub.cfg.
Le fichier initramfs n'est pas généré dans le répertoire /boot lors de l'installation du noyau.
Le fichier initramfs n'est que partiellement généré ou corrompu.
Symptômes
En cas de panique du noyau sur une instance de VM, l'un des symptômes courants est que le noyau ne vous permet pas de vous connecter à la VM, même lorsque vous utilisez la console série.
Vous devez vérifier les journaux de la console série pour identifier le noyau chargé par le système d'exploitation invité, par exemple :
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.10.0-1160.95.1.el7.x86_64 (mockbuild@x86-vm-42.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) ) #1 SMP Thu Aug 10 10:46:21 EDT 2023
Vérifiez également l'erreur de panique du noyau. Cette erreur est généralement visible au niveau de la ligne de noyau au démarrage de la VM ou à la fin des journaux de la console série avec plusieurs traces d'appel de pile.
L'exemple suivant montre une panique du noyau en raison de problèmes initramfs :
[ 1.520840] No filesystem could mount root, tried:
[ 1.520840]
[ 1.521964] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 1.523495] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 3.10.0-1160.95.1.el7.x86_64 #1
[ 1.524932] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022
[ 1.526901] Call Trace:
[ 1.527421] dump_stack+0x41/0x60
[ 1.527978] panic+0xe7/0x2ac
[ 1.528578] mount_block_root+0x2be/0x2e6
[ 1.529693] ? do_early_param+0x95/0x95
[ 1.530441] prepare_namespace+0x135/0x16b
[ 1.531237] kernel_init_freeable+0x203/0x22d
[ 1.532081] ? rest_init+0xaa/0xaa
[ 1.532808] kernel_init+0xa/0x103
[ 1.533395] ret_from_fork+0x35/0x40
[ 1.535229] Kernel Offset: 0x23a00000 from 0xffffffff81000000
Résoudre l'erreur de panique du noyau
Pour résoudre l'erreur de panique du noyau, procédez comme suit :
Connectez-vous à la console série, puis connectez-vous à la VM à partir de la console Google Cloud .
Cliquez sur Réinitialiser pour la VM dans la console Google Cloud .
Une fois que l'écran d'accueil GRUB s'affiche, sélectionnez le noyau préalablement opérationnel ou le noyau de secours, puis démarrez le système. La VM démarre alors avec le noyau sélectionné.
Lorsque la VM est accessible, vous pouvez établir une connexion SSH à la VM.
Identifiez la cause du problème et prenez les mesures nécessaires.
Par exemple, si le fichier initramfs est manquant ou corrompu, procédez comme suit :
Générez le fichier initramfs correspondant au noyau d'origine à l'aide de la commande dracut :
Remplacez KERNEL_VERSION par la version actuelle du noyau de la VM. Exemple :3.10.0-1160.95.1.el7.x86_64
Mettez à jour le fichier grub2.cfg à l'aide de la commande grub2-mkconfig, par exemple :
grub2-mkconfig -o /boot/grub2/grub.cfg
Une fois le fichier initramfs généré, vous pouvez redémarrer la VM sans aucune erreur.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eThis document provides troubleshooting steps for when a virtual machine (VM) becomes unresponsive due to kernel panic errors, which can occur on VMs running operating systems like RedHat, SUSE, CentOS, or Ubuntu.\u003c/p\u003e\n"],["\u003cp\u003eKernel panic errors can occur when the kernel fails to load \u003ccode\u003einitramfs\u003c/code\u003e modules, an essential part of guest operating systems booting, or when the kernel cannot manage a request, causing it to shut down.\u003c/p\u003e\n"],["\u003cp\u003eCommon symptoms of a kernel panic include an inability to connect to the VM, even via the serial console, and the appearance of error messages in the serial console logs, often including stack call traces.\u003c/p\u003e\n"],["\u003cp\u003eTo resolve a kernel panic, you can access the serial console, reset the VM, select a previous or rescue kernel from the GRUB menu to boot from, then initiate an SSH connection to investigate and fix the root cause.\u003c/p\u003e\n"],["\u003cp\u003eIf the issue stems from a missing or corrupted \u003ccode\u003einitramfs\u003c/code\u003e file, users can use the \u003ccode\u003edracut\u003c/code\u003e command to regenerate the file and \u003ccode\u003egrub2-mkconfig\u003c/code\u003e to update the \u003ccode\u003egrub2.cfg\u003c/code\u003e, allowing the VM to restart successfully.\u003c/p\u003e\n"]]],[],null,["# Troubleshoot Linux VM boot issues due to kernel panic\n\n*** ** * ** ***\n\nThis document includes troubleshooting information about a VM becoming unresponsive due to kernel panic errors.\n\n\u003cbr /\u003e\n\nBefore you begin\n----------------\n\n- If you want to log serial port output in Cloud Logging, familiarize yourself with [Cloud Logging](/logging).\n- If you haven't already, set up [authentication](/compute/docs/authentication). Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:\n\n Select the tab for how you plan to use the samples on this page: \n\n ### Console\n\n\n When you use the Google Cloud console to access Google Cloud services and\n APIs, you don't need to set up authentication.\n\n ### gcloud\n\n 1.\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n After installation,\n [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command:\n\n ```bash\n gcloud init\n ```\n\n\n If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n | **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.\n 2. [Set a default region and zone](/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client).\n\n ### REST\n\n\n To use the REST API samples on this page in a local development environment, you use the\n credentials you provide to the gcloud CLI.\n 1. [Install](/sdk/docs/install) the Google Cloud CLI. After installation, [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command: \n\n ```bash\n gcloud init\n ```\n 2. If you're using an external identity provider (IdP), you must first [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n\n For more information, see\n [Authenticate for using REST](/docs/authentication/rest)\n in the Google Cloud authentication documentation.\n\nKernel panic\n------------\n\nA kernel panic can happen when the kernel is unable to load properly `initramfs`\nmodules, which are required for the guest OS to boot.\n\nAnother form of kernel panic can occur in a situation where the kernel doesn't\nknow how to handle a certain request and protects itself by stopping.\nKernel panic can happen on a Compute Engine VM running RedHat, SUSE, CentOS,\nor Ubuntu.\n\n### Common error messages\n\nBelow are some of the most common kernel panic events for reference: \n\n```\nKernel panic - not syncing: hung_task: blocked tasks\n``` \n\n```\nKernel Panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)\n``` \n\n```\nKernel panic - not syncing: NMI: Not continuing\n``` \n\n```\nKernel panic - not syncing: out of memory. panic_on_oom is selected\n``` \n\n```\nKernel panic - not syncing: Fatal Machine check \n```\n\n### Common causes\n\nThe kernel panic error can occur due to multiple reasons. Some of the\ncommon reasons are:\n\n- The entry related to the `initramfs` file that corresponds to the kernel doesn't exist in the `grub.cfg` file.\n- The `initramfs` file doesn't get generated in the `/boot` directory during kernel installation.\n- The `initramfs` file gets only partially generated or is corrupted.\n\n### Symptoms\n\nWhen you experience kernel panic on a VM instance, a common symptom is that the\nkernel does not allow you to connect to the VM, even when using the serial\nconsole.\n\nYou should check the serial console logs to identify the kernel that was loaded\nby the guest OS, for example: \n\n```\n[ 0.000000] Initializing cgroup subsys cpu\n[ 0.000000] Initializing cgroup subsys cpuacct\n[ 0.000000] Linux version 3.10.0-1160.95.1.el7.x86_64 (mockbuild@x86-vm-42.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) ) #1 SMP Thu Aug 10 10:46:21 EDT 2023\n```\nAlso check the kernel panic error. This error is normally seen either at the kernel line when the VM starts or at the end of the serial console logs with multiple stack call traces.\n\n\u003cbr /\u003e\n\nThe following example shows a kernel panic event due to `initramfs` issues: \n\n```\n[ 1.520840] No filesystem could mount root, tried:\n[ 1.520840]\n[ 1.521964] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)\n[ 1.523495] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 3.10.0-1160.95.1.el7.x86_64 #1\n[ 1.524932] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022\n[ 1.526901] Call Trace:\n[ 1.527421] dump_stack+0x41/0x60\n[ 1.527978] panic+0xe7/0x2ac\n[ 1.528578] mount_block_root+0x2be/0x2e6\n[ 1.529693] ? do_early_param+0x95/0x95\n[ 1.530441] prepare_namespace+0x135/0x16b\n[ 1.531237] kernel_init_freeable+0x203/0x22d\n[ 1.532081] ? rest_init+0xaa/0xaa\n[ 1.532808] kernel_init+0xa/0x103\n[ 1.533395] ret_from_fork+0x35/0x40\n[ 1.535229] Kernel Offset: 0x23a00000 from 0xffffffff81000000 \n```\n\nResolve the kernel panic error\n------------------------------\n\nTo resolve the kernel panic error, perform the following steps:\n\n1. Connect to the [serial console](/compute/docs/troubleshooting/troubleshooting-using-serial-console#connectserialconsole)\n and log in to the VM from the Google Cloud console.\n\n2. Click **Reset** for VM in the Google Cloud console.\n\n3. After the GRUB splash screen appears, select the previously working\n kernel or rescue kernel, and then boot the system. This causes the VM\n to start with the selected kernel.\n\n | **Note:** Booting the VM by selecting the previous kernel from the GRUB splash screen doesn't make changes to GRUB configuration file, so this is not a persistent change.\n4. When the VM is accessible, you can initiate an SSH connection to the VM.\n\n5. Identify the cause of the issue and take further action accordingly.\n\n For example, if the `initramfs` file is missing or corrupted,\n complete the following steps:\n 1. Generate the `initramfs` file corresponding to original kernel by using\n the `dracut` command:\n\n ```\n dracut -f /boot/initramfs-KERNEL_VERSION.img KERNEL_VERSION\n ```\n\n Replace \u003cvar translate=\"no\"\u003eKERNEL_VERSION\u003c/var\u003e with the VM's current\n kernel version. For example, `3.10.0-1160.95.1.el7.x86_64`.\n 2. Update the `grub2.cfg` file using the `grub2-mkconfig` command, for\n example:\n\n ```\n grub2-mkconfig -o /boot/grub2/grub.cfg\n ```\n 3. After the `initramfs` file is generated, you can restart the VM without\n any errors."]]