Headless OS Reinstall Using NOOBS

If you run a headless Raspberry Pi then its not always convenient to connect it up to a keyboard, mouse and monitor if you wanted to reinstall the operating system on it. Provided you have installed the operating system using NOOBS and still have access to SSH then the below instructions can be used to get back to a clean install.

 

Mount the SD Card Root

Open up an SSH session and create an empty directory: 

sudo mkdir n00bs

Mount the root of the SD card to this folder: 

sudo mount /dev/mmcblk0p1 n00bs/ 

 

Edit recovery.cmdline

Open up the file in your preferred text editor (in this case I’m using nano): 

sudo nano n00bs/recovery.cmdline

The file should contain something similar to:

quiet vt.cur_default=1 elevator=deadline

Add

vncinstall forcetrigger

 to the end of the line and save the file. This tells NOOBS to direct the GUI to a VNC instance and forces it to start the install screen as if shift had been held down at reboot.

You can now unmount the root of the SD card 

sudo umount n00bs/

and reboot  

sudo reboot

 

Re-Installation

Use your favourite VNC client to connect to the IP address of the Raspberry Pi where you can continue the reinstall process.

Once the installation is complete, you’ll need to log back into the Pi using SSH. Use the steps above to mount the SD card root again and remove the 

vncinstall forcetrigger

from the recovery.cmdline file. This is necessary to prevent your Pi from stopping at the NOOBS install screen every time it restarts.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *