couplands
Posts: 7
Joined: Fri Mar 01, 2013 8:18 am

Remote reset

Fri Nov 10, 2017 10:59 pm

Hi,

Is there a way to reset (as in reinstall the OS from the SD card) the Pi from a Remote Desktop..?

I'm running my Pi remotely and now and again I want to wipe it and reinstall the OS, but I can't easily be in front of the Pi.

Cheers

Simon

User avatar
rpdom
Posts: 15380
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Remote reset

Sat Nov 11, 2017 5:35 am

That is pretty much impossible. You'd need to overwrite the SD card that the Pi is running from, and as files are in use on that card the Pi would almost certainly crash.

broe23
Posts: 903
Joined: Thu Jan 28, 2016 9:35 pm
Location: Central IL
Contact: Website

Re: Remote reset

Sat Nov 11, 2017 7:20 am

rpdom wrote:
Sat Nov 11, 2017 5:35 am
That is pretty much impossible. You'd need to overwrite the SD card that the Pi is running from, and as files are in use on that card the Pi would almost certainly crash.
Shh, don't tell them that. That is like asking your mechanic if they can just swap out the engine on your vehicle while driving around.
Ren: Now listen, Cadet. I've got a job for you. See this button? Ren: Don't touch it! It's the History Eraser button, you fool! Stimpy: So what'll happen? Ren: That's just it. We don't know. Maybe something bad, maybe something good.

FM81
Posts: 518
Joined: Wed Apr 17, 2013 4:33 pm

Re: Remote reset

Sat Nov 11, 2017 7:48 am

Of course, I'm sure my post wouldn't help the thread-opener at all. But in general such a scenario is possible!

If you have a remote network-infrastructure which is allowing this, and you have a RPi3 or RPi2v1.2 (ore some person which swaps the SD-cards if it is a RPi2v1.1.).
This would give the possibility, to boot a small system in RAM, access this booted system with SSH and flash with a new image, accessed from the SSH-console for example with NFS from another (also remote) server.

Best regards, FM_81

PS: As said, not for real practice, but I wouldn't write it here, if I haven't it already tested ... :)
A: What does the command 'cat /dev/urandom', can you tell me please?
B: Yeah, that's very simple: It feeds your cat with radioactive material!

User avatar
rpdom
Posts: 15380
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Remote reset

Sat Nov 11, 2017 8:02 am

FM81 wrote:
Sat Nov 11, 2017 7:48 am
Of course, I'm sure my post wouldn't help the thread-opener at all. But in general such a scenario is possible!
True, and I would have mentioned it if it wasn't somewhat risky and the OP said "from a Remote Desktop", to which the answer is really "no, you will need ssh at some point and some custom boot image".

couplands
Posts: 7
Joined: Fri Mar 01, 2013 8:18 am

Re: Remote reset

Sat Nov 11, 2017 8:13 am

Thanks guys.

I have an iLO capability on my HP server which means I can do a "bare metal" install remotely. I just wondered if there was something that the ingenious Pi community had to do the similar thing.

I guess I was looking for the remote version of holding down the "shift" key when rebooting the Pi so it would go into the recovery mode.

Apologies if I'm using the wrong terminology as I've just got the Pi and getting used to.

Cheers

Simon

User avatar
rpdom
Posts: 15380
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Remote reset

Sat Nov 11, 2017 8:51 am

couplands wrote:
Sat Nov 11, 2017 8:13 am
Thanks guys.

I have an iLO capability on my HP server which means I can do a "bare metal" install remotely. I just wondered if there was something that the ingenious Pi community had to do the similar thing.

I guess I was looking for the remote version of holding down the "shift" key when rebooting the Pi so it would go into the recovery mode.
Unlike that sort of server, the Pi has no "BIOS" that can be booted into. Without the OS you have no keyboard, video or pretty much anything. This does have the advantage (for local working) that you can't trash the BIOS with a bad flash, a recovery just means putting in an SD card with a good OS on it, but that is not so easy remotely.

jahboater
Posts: 4762
Joined: Wed Feb 04, 2015 6:38 pm

Re: Remote reset

Sat Nov 11, 2017 10:00 am

couplands wrote:
Sat Nov 11, 2017 8:13 am
I guess I was looking for the remote version of holding down the "shift" key when rebooting the Pi so it would go into the recovery mode.
Just for interest, you can edit /boot/cmdline.txt and add something like "init=/bin/bash".
Then a reboot will drop you into a root shell (and not start systemd or anything else).

couplands
Posts: 7
Joined: Fri Mar 01, 2013 8:18 am

Re: Remote reset

Sat Nov 11, 2017 10:28 am

rpdom wrote:
Sat Nov 11, 2017 8:51 am
couplands wrote:
Sat Nov 11, 2017 8:13 am
Thanks guys.

I have an iLO capability on my HP server which means I can do a "bare metal" install remotely. I just wondered if there was something that the ingenious Pi community had to do the similar thing.

I guess I was looking for the remote version of holding down the "shift" key when rebooting the Pi so it would go into the recovery mode.
Unlike that sort of server, the Pi has no "BIOS" that can be booted into. Without the OS you have no keyboard, video or pretty much anything. This does have the advantage (for local working) that you can't trash the BIOS with a bad flash, a recovery just means putting in an SD card with a good OS on it, but that is not so easy remotely.
So what piece of the Pi logic recognises the held down shift key at boot time, so it can go into recovery mode..?

couplands
Posts: 7
Joined: Fri Mar 01, 2013 8:18 am

Re: Remote reset

Sat Nov 11, 2017 10:29 am

jahboater wrote:
Sat Nov 11, 2017 10:00 am
couplands wrote:
Sat Nov 11, 2017 8:13 am
I guess I was looking for the remote version of holding down the "shift" key when rebooting the Pi so it would go into the recovery mode.
Just for interest, you can edit /boot/cmdline.txt and add something like "init=/bin/bash".
Then a reboot will drop you into a root shell (and not start systemd or anything else).
Thanks..will have more of a play.

cheers

simon

User avatar
B.Goode
Posts: 8856
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Remote reset

Sat Nov 11, 2017 11:02 am

So what piece of the Pi logic recognises the held down shift key at boot time, so it can go into recovery mode..?
That's a function of the NOOBS Installer.

The full NOOBS Installer documentation has details of how to force entry into the NOOBS Recovery Console.

https://github.com/raspberrypi/noobs#ho ... oard-input

But this isn't going to help if you are not in front of the RPi since NOOBS is inherently a graphical interface. Nor will it help if you installed Raspbian directly-imaged, not via NOOBS.

User avatar
B.Goode
Posts: 8856
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Remote reset

Sat Nov 11, 2017 11:09 am

couplands wrote:
Sat Nov 11, 2017 10:29 am
jahboater wrote:
Sat Nov 11, 2017 10:00 am
couplands wrote:
Sat Nov 11, 2017 8:13 am
I guess I was looking for the remote version of holding down the "shift" key when rebooting the Pi so it would go into the recovery mode.
Just for interest, you can edit /boot/cmdline.txt and add something like "init=/bin/bash".
Then a reboot will drop you into a root shell (and not start systemd or anything else).
Thanks..will have more of a play.

cheers

simon

If you only have remote access to the target RPi this sounds like a sure way of denying yourself access to it, since the networking software may not have been started.

If you haven't done so already I suggest doing what NASA did in the Apollo 13 movie and build a replica setup where you are now and experiment on that before attempting potentially damaging operations on the module that is live in space...

couplands
Posts: 7
Joined: Fri Mar 01, 2013 8:18 am

Re: Remote reset

Sat Nov 11, 2017 11:58 am

Hehe, I'm doing this currently on my home network for exactly that reason..!

I wanted a way to remotely control the Pi in the event of a catastrophic failure that required a reinstall of the OS. But not before I've tested it within easy reach.

Its early days in my use of the Pi, so plenty of things to test out.

Thanks for the input and apologies for my naïve questions.

cheers

simon

User avatar
davidcoton
Posts: 4184
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Remote reset

Sat Nov 11, 2017 12:10 pm

So how about:
  • Install PINN (enhanced NOOBS).
  • Install two copies of Raspbian.
  • Make a separate data partition for each.
  • Install your program on both copies.
  • Run on just one copy. Periodically mount the opposite data partition and back up your data, then unmount.
  • When one Raspbian fails, simply reboot (via recovery) to the other. Use the other to run and to repair/reinstall the failed copy.
  • I think you can even arrange for the two copies to be on different devices (SDCard plus USB). On a Pi3B it might even work so that if the SDCard is primary and fails completely, reboot will come up on the USB.
  • You may need a software or hardware watchdog to perform an unattended reboot when software fails.
Disclaimer: I haven't used PINN, but from what I read most (if not all) of the above is possible.
The developer of PINN (@procount) is active here and gives support on the PINN thread.
Signature retired

User avatar
B.Goode
Posts: 8856
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Remote reset

Sat Nov 11, 2017 12:16 pm

That's good defensive thinking.

But we can only advise based on what you write...
I'm running my Pi remotely and now and again I want to wipe it and reinstall the OS, but I can't easily be in front of the Pi.
I think you may come to the conclusion that what you seek to do is not achievable with a single remote RPi.

fruitoftheloom
Posts: 20905
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Remote reset

Sat Nov 11, 2017 12:17 pm

couplands wrote:
Sat Nov 11, 2017 11:58 am
Hehe, I'm doing this currently on my home network for exactly that reason..!

I wanted a way to remotely control the Pi in the event of a catastrophic failure that required a reinstall of the OS. But not before I've tested it within easy reach.

Its early days in my use of the Pi, so plenty of things to test out.

Thanks for the input and apologies for my naïve questions.

cheers

simon

The Raspberry Pi when power is applied the boot is from the VPU and then seeks files on either a SD Card / USB MSD / Network Server depending on Raspberry Pi model.

https://www.raspberrypi.org/documentati ... bootmodes/

Obviously if when booting it can not find the required files it will not boot period and it is not therefore accessible period ;)
Retired disgracefully.....

couplands
Posts: 7
Joined: Fri Mar 01, 2013 8:18 am

Re: Remote reset

Sat Nov 11, 2017 1:12 pm

Some good ideas above. It will actually be on a network with other devices/servers, just not with me in front of it. So perhaps a network boot of a clean image would work, and I like the dual redundant image idea. Its a Pi3B, I'll read more on the boot modes.

Thanks again all.

cheers

simon

Return to “General discussion”