# Having a hard time trying to re-install NR

**URL:** <https://discourse.nodered.org/t/having-a-hard-time-trying-to-re-install-nr/3826>\
**Category:** General\
**Created:** [9 October 2018 15:42 UTC](https://discourse.nodered.org/t/having-a-hard-time-trying-to-re-install-nr/3826 "2018-10-09T15:42:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![vazquezjm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vazquezjm/32/7952_2.png) [@vazquezjm](https://discourse.nodered.org/u/vazquezjm)\
**Post date:** [9 October 2018 15:42 UTC](https://discourse.nodered.org/t/having-a-hard-time-trying-to-re-install-nr/3826/1 "2018-10-09T15:42:28Z")

</div>

Hi all.

I'm experiencing a weird behavior trying to re-install NR on my Raspbery Pi 3 running Raspbian 9.4 (Stretch).

After a power fault (mains), RPi booted and NR was not working so I tried to fix it manually but messed it up and ended running the install script as described here: [https://nodered.org/docs/hardware/raspberrypi](https://nodered.org/docs/hardware/raspberrypi)

After I run the script, I get the following errors:

 ![screenshot1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/d/d9e54019233c02b23180707373130ca455571ba3.png)

then, if I click "y", everything starts over.

```
Node-RED is not yet fully installed

Fetching Node-RED update.

```

At this point, I don't know what to do. I'm thinking about re-installing the OS and so on, but wanted to hear from you guys.

TIA.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [9 October 2018 19:49 UTC](https://discourse.nodered.org/t/having-a-hard-time-trying-to-re-install-nr/3826/2 "2018-10-09T19:49:50Z")

</div>

Odd one. Can you manually remove that /root/.npm directory. Re-run the bash scipt - and report the install log that it writes to if or when it fails again ?

---

<div class="post-metadata">

**Author:** ![vazquezjm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vazquezjm/32/7952_2.png) [@vazquezjm](https://discourse.nodered.org/u/vazquezjm)\
**Post date:** [9 October 2018 21:01 UTC](https://discourse.nodered.org/t/having-a-hard-time-trying-to-re-install-nr/3826/3 "2018-10-09T21:01:32Z")

</div>

I have this at /:  
`drwx------ 6 root root 4096 Oct 7 21:35 root`

then if I run `rm -rf /.npm` as pi user I get (as expected) `rm: cannot remove '/root/.npm': Permission denied`

So I do `sudo -i`, try `rm -rf /root/.npm` and I get `rm: cannot remove '/root/.npm/_cacache/index-v5/b1/60': Permission denied` 😲

Now, I try to list the files in that directory with `ls _cacache/index-v5/b1/60/` and I get:  
`ls: cannot open directory '_cacache/index-v5/b1/60/': Permission denied` 😲😲😲

Permissions are as follows:  
`dr-xr-xr-x 3 pi pi 4096 Aug 21 11:10 .`  
`drwxr-xr-x 3 pi pi 4096 Oct 9 17:44 ..`  
`drwxr-xr-x 2 pi pi 4096 Feb 17 2010 60`

You might notice directory "60" creation(?) date is Feb, 17 2010

How come I cannot delete that directory? 🤔

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [9 October 2018 21:03 UTC](https://discourse.nodered.org/t/having-a-hard-time-trying-to-re-install-nr/3826/4 "2018-10-09T21:03:37Z")

</div>

Strange disk permissions on a pi have in my experience been the first sign of a dying sd card.  
My suggestion would be to copy any files you want if it and then replace it.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [9 October 2018 21:25 UTC](https://discourse.nodered.org/t/having-a-hard-time-trying-to-re-install-nr/3826/5 "2018-10-09T21:25:39Z")

</div>

well it may have just been corrupted by the power blip - so it may be possible to recover it. try creating a blank file in the / (root) of the card by `sudo touch /forcefsck` then shutdown and reboot - this will force a file system check on reboot. Hopefully you will then be able to delete that file... s

Second best would be to reformat the whole card and re-image it... (after saving off anything you can - maybe the `.node-red` directory with your flows in.. )

Ultimate would be a new SD card...

---

<div class="post-metadata">

**Author:** ![vazquezjm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vazquezjm/32/7952_2.png) [@vazquezjm](https://discourse.nodered.org/u/vazquezjm)\
**Post date:** [10 October 2018 21:10 UTC](https://discourse.nodered.org/t/having-a-hard-time-trying-to-re-install-nr/3826/6 "2018-10-10T21:10:08Z")

</div>

> [@dceejay](#):
>
> well it may have just been corrupted by the power blip - so it may be possible to recover it. try creating a blank file in the / (root) of the card by `sudo touch /forcefsck` then shutdown and reboot - this will force a file system check on reboot. Hopefully you will then be able to delete that file... s

Still no luck...

> [@dceejay](#):
>
> Second best would be to reformat the whole card and re-image it... (after saving off anything you can - maybe the `.node-red` directory with your flows in.. )

It's not the first time it happens. I formatted it and re-installed Raspbian several times. Unfortunately blackouts are common where I live ☹

> [@dceejay](#):
>
> Ultimate would be a new SD card...

At this point, I think it's the only way out

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [11 October 2018 08:06 UTC](https://discourse.nodered.org/t/having-a-hard-time-trying-to-re-install-nr/3826/7 "2018-10-11T08:06:28Z")

</div>

> [@vazquezjm](#):
>
> It's not the first time it happens. I formatted it and re-installed Raspbian several times.

It is worth using good cards, not cheap unbranded ones. In addition if you get to the point where you have everything installed and basically working then take an image backup of the card. Then you can easily get back to that point just by restoring the image. In addition if you use the Projects feature then you just need to restore the image and fetch the latest version of the project from the repository and you are back up and running.

---

<div class="post-metadata">

**Author:** ![vazquezjm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vazquezjm/32/7952_2.png) [@vazquezjm](https://discourse.nodered.org/u/vazquezjm)\
**Post date:** [11 October 2018 12:43 UTC](https://discourse.nodered.org/t/having-a-hard-time-trying-to-re-install-nr/3826/8 "2018-10-11T12:43:20Z")

</div>

> [@Colin](#):
>
> In addition if you get to the point where you have everything installed and basically working then take an image backup of the card. Then you can easily get back to that point just by restoring the image.

Thanks @Colin. Can you point me to some doc on how to do this?

> [@Colin](#):
>
> In addition if you use the Projects feature then you just need to restore the image and fetch the latest version of the project from the repository and you are back up and running.

I did not know the existence of Project 😊 Will take a look at it once everything is up and running again.

Thank you!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [11 October 2018 13:02 UTC](https://discourse.nodered.org/t/having-a-hard-time-trying-to-re-install-nr/3826/9 "2018-10-11T13:02:02Z")

</div>

> [@vazquezjm](#):
>
> Can you point me to some doc on how to do this?

I use clonezilla (which strictly is not an image backup as it is compressed).  
If you google for  
sd card image  
you will see many other ways of doing it.
