Parfois, j’oublie le mot de passe Raspberry Pi sur mes projets. C’est pénible, mais ce guide fournit une technique pour réinitialiser le mot de passe et accéder au système et le remettre en marche. Vous avez besoin d’un accès physique à la carte SD, d’un PC séparé et de la possibilité de connecter votre Pi à un moniteur et à un clavier. J’ai utilisé un PC Windows mais cela devrait fonctionner correctement sur une machine Mac ou Linux.
Étape 1 – Exigences de récupération de mot de passe Pi
Pour utiliser cette technique, vous devez :
- Avoir un accès physique au Pi et à sa carte SD
- Accès à un clavier et un moniteur
- Adaptateurs appropriés si vous utilisez un Pi Zero
- Avoir un PC/ordinateur portable avec un lecteur de carte microSD
Étape 2 – Prenez la carte SD
Éteignez le Pi et retirez la carte SD. Insérez-le dans votre PC.
Étape 3 – Modifier cmdline.txt
La partition de démarrage doit être visible et contenir un fichier nommé « cmdline.txt ». Modifiez ce fichier dans un éditeur de texte et ajoutez ce qui suit à la fin du texte existant :
init=/bin/sh
Si le contenu original était :
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=04ceb741-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
il devrait maintenant ressembler à :
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=04ceb741-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait init=/bin/sh
Assurez-vous que tout est sur une seule ligne ! Enregistrez le fichier texte et éjectez la carte SD du PC.
Étape 4 – Réinitialiser le mot de passe Pi
Insérez la carte dans le Pi avec un moniteur et un clavier connectés. Mettez le Pi sous tension. Il peut y avoir un délai, mais un curseur devrait vous être présenté.
À l’invite, tapez la commande suivante :
mount -o remount, rw /
Si cela se traduit par un message d’erreur tel que :
/bin/sh: 0: can’t access tty; job control turned off [ 21.366191] random: crng init done
essayez simplement à nouveau la commande mount :
mount -o remount, rw /
Enfin vous pouvez maintenant tenter de changer le mot de passe :
passwd pi
Vous serez alors invité à entrer un nouveau mot de passe. Entrez-le soigneusement et appuyez sur le [Return] clé. Il vous demandera maintenant de retaper le mot de passe.
Le mot de passe a été modifié.
Tapez maintenant les commandes suivantes :
sync exec /sbin/init
Le Pi continuera à démarrer et vous ramènera à l’invite de ligne de commande normale.
Arrêtez le Pi et éteignez-le.
sudo halt
Étape 5 – Modifier cmdline.txt
Retirez la carte SD du Pi et à l’aide du PC, modifiez à nouveau le fichier « cmdline.txt » et supprimez le texte « init=/bin/sh » que vous avez ajouté à l’étape 2.
Éjectez en toute sécurité la carte SD du PC et réinsérez-la dans le Pi.
Allumez le Pi et votre nouveau mot de passe devrait maintenant être actif.
Maintenant, n’oubliez plus ce mot de passe !
-
Geekworm Raspberry Pi 4 11mm Embedded Heatsink (P165-B), Raspberry Pi 4B Heatsink/Radiator for Raspberry Pi 4 Model B & Pi 4 Expansion Board Support POE ExtensionNew version Geekworm embedded armor aluminum alloy Heatsink (P165-B) is only designed for Raspberry Pi 4 Model B 1GB/2GB/4GB/8GB Version, embedded heatsink with 11mm thickness. WIKI for reference: raspberrypiwiki.com/P165 Supports to cooling down the Raspberry Pi 4 board when using the Pi 4 expansion board(also support PoE board); It is compatible with Raspberry Pi 4 expansion board to slove the raspberry pi 4 overheat problem, BUT you will need to prepare the proper standoffs or screws to use the P165-B with other expansion board. Only equipped with 4pcs M2.5X5+6mm spacers for the P165-B embedded heatsink, you will need to prepare extra standoffs or screws for Raspberry Pi 4 with other expansion boards. Add one piece thermal tape as gift in case you will need. But it is strongly recommend to use the CPU grease (not included) to get better heat dissipation. Supports the installation of 30mm fan; Cooling fan can be added when the heat dissipation of a single aluminum heatsink is not enough, so that all Raspberry Pi 4 heat dissipation problems can be solved.
-
Retroflag PiStation Boîtier avec écran LCD, 2 Haut-parleurs stéréo, arrêt sécurisé, réinitialisation sécurisée, Ventilateur Raspberry Pi, radiateurs Raspberry Pi pour Raspberry Pi 4 modèle BArrêt sécurisé et réinitialisation sécurisée Boutons POWER et RESET fonctionnels PiStation Case+LCD spécialement conçu pour Raspberry Pi 4 Accès facile à la carte SD et à tous les autres ports sans ouvrir le boîtier Écran LCD 4,3 * 800 * 400 pixels avec boutons de haut-parleurs stéréo Aspect de l'écran interchangeable 4:3 à 16:9 Le forfait comprend: 1x boîtier Retroflag PiStation avec écran LCD de 4,3 pouces, 1x ventilateur Raspberry Pi 4, 4x radiateurs Raspberry Pi, 1x sac en flanelle, 1x manuel d'instructions, 1x tournevis
-
GeeekPi Raspberry Pi Micro GPIO Terminal Block Breakout Board Module with LED,Raspberry Pi LED Screw Terminal Hat pour Raspberry Pi 4B/3B+/3B/2BCompatible with all Raspberry Pi series: for Raspberry Pi 1 Model B+, Pi 2 Model B, Pi 3 Model B, Pi 3 Model B+, Pi 4 Model B, Pi Zero, Pi Zero W, Pi Zero 2 W All 40pins of Raspberry Pi are transferred out by screw terminals, which is convenient for cable access. Does not occupy other space, very convenient when doing DIY circuits. Easy to assemble,GPIO LED indicator,Stable connection for wiring circuit 2x20 positions header connect to Raspberry Pi board,Terminal block pitch is 2.54mm/0.1". GPIO function mark sticky for easy identification. wire size range 28AWG to 18AWG, strip length 4.5mm, screw M1.6 steel, pin header and cage copper. Package includes:1 x Mini Terminal Breakout Board with LED For Raspberry Pi;1 x Silk-Mark Color Stickers;1 x Acrylic Pannel;4 x M2.5 Copper Pillar;6 x M2.5 Screw;2 x M2.5 Double Pass Copper Pillar; 2 x Nut; 1 x Screw Driver Technical Support: https://wiki.52pi.com/index.php?title=EP-0168