# Upgrade node-red on raspberry pi

**URL:** <https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846>\
**Category:** General\
**Created:** [31 October 2022 15:08 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846 "2022-10-31T15:08:36Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![henrik1](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@henrik1](https://discourse.nodered.org/u/henrik1)\
**Post date:** [2 November 2022 19:01 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/21 "2022-11-02T19:01:20Z")

</div>

> [@Colin](#):
>
> Can you run  
> `which node`  
> then  
> `/usr/sbin/node -v`  
> `ls -l /usr/sbin/node`  
> and copy/paste that whole sequence here, including the lines where you enter the commands please.

Sure

```auto
pi@homeautomatic:~ $ which node
/usr/sbin/node
pi@homeautomatic:~ $ /usr/sbin/node -v
v16.3.0
pi@homeautomatic:~ $ ls -l /usr/sbin/node
lrwxrwxrwx 1 root root 20 Oct 30 19:38 /usr/sbin/node -> /opt/nodejs/bin/node
pi@homeautomatic:~ $

```

---

<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:** [2 November 2022 19:27 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/22 "2022-11-02T19:27:44Z")

</div>

Delete /usr/sbin/node and rerun the install script.

---

<div class="post-metadata">

**Author:** ![henrik1](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@henrik1](https://discourse.nodered.org/u/henrik1)\
**Post date:** [3 November 2022 06:39 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/23 "2022-11-03T06:39:26Z")

</div>

OK I deleted the /usr/sbin/node and ran the script again

```auto
pi@homeautomatic:~ $ bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --node16

```

Now the install script woun't work

```auto
Running Node-RED install for user pi at /home/pi on raspbian

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

This can take 20-30 minutes on the slower Pi versions - please wait.

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
  Stop Node-RED ✘
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
  Remove old version of Node-RED ✔
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
  Remove old version of Node.js ✔ v16.18.0
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
  Install Node.js for Armv6 ✘sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
   v16.18.0 Npm 8.19.2
  Clean npm cache ✘
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
  Install Node-RED core ✘
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
  Move global nodes to local -
  Leave existing nodes -
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
  Install extra Pi nodes ✘
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
  Add shortcut commands ✘
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
md5sum: /lib/systemd/system/nodered.service.temp: No such file or directory
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
  Update systemd script - Skipped - existing script is customized.
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

All done.
You can now start Node-RED with the command node-red-start
  or using the icon under Menu / Programming / Node-RED
Then point your browser to localhost:1880 or http://{your_pi_ip-address}:1880

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

Just FYI : Your settings.js file is different from the latest defaults.
You may wish to run
   diff -y --suppress-common-lines /usr/lib/node_modules/node-red/settings.js /home/pi/.node-red/settings.js
to compare them and see what the latest options are.

**********************************************************************************
 ### WARNING ###
 DO NOT EXPOSE NODE-RED TO THE OPEN INTERNET WITHOUT SECURING IT FIRST

 Follow the guide at https://nodered.org/docs/user-guide/runtime/securing-node-red
 to setup security.

 ### ADDITIONAL RECOMMENDATIONS ###
  - Remove the /etc/sudoers.d/010_pi-nopasswd file to require entering your password
    when performing any sudo/root commands:

      sudo rm -f /etc/sudoers.d/010_pi-nopasswd

  - Change the ownership of its settings file to 'root' to prevent unauthorised changes:

      sudo chown root:root ~/.node-red/settings.js

**********************************************************************************

```

Now it seems I do not have the rights to install? How has that changed?  
I then ran `ls -la /usr/bin/sudo` and got

```auto
pi@homeautomatic:~ $ ls -la /usr/bin/sudo
-rwsr-xr-x 1 pi pi 147560 Jan 20 2021 /usr/bin/sudo

```

From what I can read on the net, the rights for sudo should be owned my root. How can that change?

---

<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:** [3 November 2022 07:52 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/24 "2022-11-03T07:52:29Z")

</div>

> [@henrik1](#):
>
> ```auto
> pi@homeautomatic:~ $ ls -la /usr/bin/sudo
> -rwsr-xr-x 1 pi pi 147560 Jan 20 2021 /usr/bin/sudo
> 
> ```

That is really bad news. Do you know how you got to that condition? Did you run `sudo chown` something? If so then I wonder whether you have accidentally set large sections of the file system to be owned by pi instead of root. I think possibly the only way of recovering is to take the SD card out and plug it into a PC and change the ownership of sudo back to root:root. I don't know how to do that on a Windows PC. Even that may not be enough. Have a look at the ownership of / and /usr and /usr/bin. If they all show as owned by pi then you might have further issues. In fact the easiest thing might be to start again on a new SSD card. Don't overwrite your existing card in case you need to get stuff off it, unless you are sure you have everything backed up.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [3 November 2022 08:24 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/25 "2022-11-03T08:24:48Z")

</div>

Something is odd about your install on your Pi. I would export your flow and then get a new SD card,

1. flash it with the latest [Raspberry Pi OS Lite](https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2022-09-26/2022-09-22-raspios-bullseye-armhf-lite.img.xz) (you can use the [Raspberry Pi Imager](https://www.raspberrypi.com/software/) which makes things easy)
2. do an `sudo apt update && sudo apt full-upgrade`
3. then run the bash script to install NR
4. Try and start NR and see if it works

If it works, you could then import your flow and the nodes it needs and test it 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:** [3 November 2022 08:50 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/26 "2022-11-03T08:50:13Z")

</div>

The sort of thing that can cause this issue is to run something like  
`sudo chown -R pi:pi /home/pi`  
but accidentally add a space after the first slash, which runs it recursively on the whole system. Another regular thing that can destroy a system is to run  
`sudo rm -rf /home/pi/something`  
but again accidentally add a space after the first slash. This has the effect of deleting everything in the whole file system, which is embarrassing to say the least. For this reason I never run sudo commands with a full path as the parameter. Instead, for the chown command I would do  
`cd /home/pi`  
then check carefully that I am in the right folder, then  
`sudo chown -R pi:pi .`  
That is a dot at the end, which means the current directory.

---

<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:** [3 November 2022 08:56 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/27 "2022-11-03T08:56:00Z")

</div>

> [@zenofmud](#):
>
> I would export your flow and then get a new SD car

If you backup the whole of the .node-red folder except node\_modules, and copy that to the new system then go into your .node-red folder and run  
`npm install`  
and it will automatically install all your contrib nodes and also the credentials and anything configured in settings.js should still work.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [3 November 2022 10:06 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/28 "2022-11-03T10:06:45Z")

</div>

> [@henrik1](#):
>
> `-rwsr-xr-x 1 pi pi 147560 Jan 20 2021 /usr/bin/sudo`

I still have a Raspberry Pi running Buster and I see  
-rwsr-xr-x 1 root root 147560 Jan 20 2021 /usr/bin/sudo  
Interesting to see the modification date is the same as yours because if I chown a file it changes the modification date.

Anyway, I don't think the situation is recoverable, you should certainly follow the advice to rebuild it.

> [@Colin](#):
>
> If you backup the whole of the .node-red folder except node\_modules,

A useful one-line command to achieve this is  
**tar cf noderedbackup --exclude="node\_modules" .node-red**  
Save this file to a USB stick and once you have installed Node-red recover from the backup with  
**tar xf noderedbackup**

---

<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:** [3 November 2022 10:42 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/29 "2022-11-03T10:42:47Z")

</div>

> [@jbudd](#):
>
> if I chown a file it changes the modification date.

For me it does not change the date.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [3 November 2022 11:01 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/30 "2022-11-03T11:01:23Z")

</div>

Ah. Maybe my expectations overruled what my eyes saw via ls -l Confirmation bias.

And the other thing I said - recover from backup after installing node-red - might be wrong too, at least if you are going to a new version of NR.

I'm clearly not having a good day.

---

<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:** [3 November 2022 11:06 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/31 "2022-11-03T11:06:01Z")

</div>

I expected the date to change too, so was surprised when I saw it didn't.

For the restore, it would be necessary to run `npm install` in order to rebuild node\_modules.

---

<div class="post-metadata">

**Author:** ![henrik1](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@henrik1](https://discourse.nodered.org/u/henrik1)\
**Post date:** [3 November 2022 16:16 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/32 "2022-11-03T16:16:10Z")

</div>

Thank you all for you time and inputs. I will backup the node-red files do a fresh install on my Raspberry Pi on a fresh SD card (Thank you @Colin, @zenofmud and jbudd). This will have to wait until the weekend, and I will let you know how it went.

Henrik

---

<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:** [3 November 2022 16:41 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/33 "2022-11-03T16:41:49Z")

</div>

Out of interest, do you know what it might have been that you did that messed up the file ownership?

---

<div class="post-metadata">

**Author:** ![henrik1](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@henrik1](https://discourse.nodered.org/u/henrik1)\
**Post date:** [3 November 2022 17:31 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/34 "2022-11-03T17:31:00Z")

</div>

> [@Colin](#):
>
> Out of interest, do you know what it might have been that you did that messed up the file ownership?

Hmm, on basis of what you have suggested could have done the change of ownership, my best guess is when I deleted /usr/sbin/node

> [@Colin](#):
>
> Delete /usr/sbin/node and rerun the install script.

I used the `rm` command but had not the rights to delete it, so I used `sudo rm`. After that I reran the installation script for Node Red and I began seeing the `sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set`.

I admit it. I am mostly a Windows guy since the beginning of the 1990's, but have tried several times since about 1999 to learn/use Linux with mixed results... I just don't have the overview of all the commands Linux offers and which ones should be handled with care...

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [3 November 2022 17:52 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/35 "2022-11-03T17:52:58Z")

</div>

> [@henrik1](#):
>
> I used the `rm` command but had not the rights to delete it, so I used `sudo rm`. After that I reran the installation script for Node Red

The NR installation script does execute **sudo chown pi:pi blahblah** but I can't see any circumstances where blahblah equates to /usr/bin/sudo.  
On the other hand nor can I see any circumstances where you could mistype **sudo rm /usr/sbin/node** and end up with **sudo chown pi:pi /usr/bin/sudo**.

> [@henrik1](#):
>
> I just don't have the overview of all the commands Linux offers and which ones should be handled with care...

You have to remember that Linux commands do not come with an Undo option, they generally don't say "are you sure?" and often they don't even report that they did anything.  
So all should be handled with some care.  
If a command includes sudo, never, never press return without checking that you have the command, it's options and especially any pathnames exactly right.

---

<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:** [3 November 2022 21:21 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/36 "2022-11-03T21:21:57Z")

</div>

> [@jbudd](#):
>
> The NR installation script does execute **sudo chown pi:pi blahblah** but I can't see any circumstances where blahblah equates to /usr/bin/sudo.  
> On the other hand nor can I see any circumstances where you could mistype **sudo rm /usr/sbin/node** and end up with **sudo chown pi:pi /usr/bin/sudo**

I agree, I can't see any way the script could have done it, or the rm command. The chown would not have to have been done directly on /usr/bin/sudo, it could have been on that whole directory or one of the parent directories (up to /) if recursive were specified). It is most odd.  
@henrik1 are you sure you did not run `chown` manually?  
Also could you have a look at the card and see if it is just /usr/bin/sudo that is owned by pi, or is it the whole of that directory, or possibly even the whole file system. You can check by running  
`ls -al /`  
`ls -al /usr`  
`ls -al /usr/bin`  
You don't need to post all that, just look to see if the files are owned by root or pi.  
We would really like to know how it happened in case it is the script, or something related to node-red that caused it. We don't want other users to have to re-install their OS.

**[Edit]** Also could you do  
`ls -n /usr/bin/sudo`  
`ls -n $HOME`

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [3 November 2022 21:27 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/37 "2022-11-03T21:27:57Z")

</div>

> [@henrik1](#):
>
> The short version: I have upgraded nodejs to version 16.3.0

In my mind, this means the OP upgraded node.js by a means other than the NR script.

I would think that is likely to be the source of why things went wrong from then on rather than an issue with the script

---

<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:** [3 November 2022 22:17 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/38 "2022-11-03T22:17:14Z")

</div>

Yes, that may well be where the extra nodejs install came from. It doesn't explain the problem with sudo though.

---

<div class="post-metadata">

**Author:** ![henrik1](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@henrik1](https://discourse.nodered.org/u/henrik1)\
**Post date:** [4 November 2022 07:13 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/39 "2022-11-04T07:13:20Z")

</div>

> [@Colin](#):
>
> Also could you have a look at the card and see if it is just /usr/bin/sudo that is owned by pi, or is it the whole of that directory, or possibly even the whole file system. You can check by running  
> `ls -al /`

All says root root

> [@Colin](#):
>
> ls -al /usr

```auto
pi@homeautomatic:~ $ ls -al /usr
total 896
drwxr-xr-x 10 root root 4096 Feb 6 2021 .
drwxr-xr-x 18 root root 4096 Jan 11 2021 ..
-rw-r--r-- 1 pi pi 692851 Nov 2 20:58 CHANGELOG.md
-rw-r--r-- 1 pi pi 88740 Nov 2 20:58 LICENSE
-rw-r--r-- 1 pi pi 35345 Nov 2 20:58 README.md
drwxr-xr-x 2 pi pi 36864 Nov 2 21:06 bin
drwxr-xr-x 2 root root 4096 Dec 9 2020 games
drwxr-xr-x 36 pi pi 16384 Oct 30 11:13 include
drwxr-xr-x 59 pi pi 4096 Nov 1 16:28 lib
drwxr-xr-x 10 root root 4096 Jan 11 2021 local
drwxr-xr-x 2 root root 12288 Nov 2 20:55 sbin
drwxr-xr-x 95 pi pi 4096 Apr 16 2022 share
drwxr-xr-x 2 root root 4096 Dec 9 2020 src

```

> [@Colin](#):
>
> ls -al /usr/bin

ALL says pi pi

> [@Colin](#):
>
> ls -n /usr/bin/sudo

```auto
pi@homeautomatic:~ $ ls -n /usr/bin/sudo
-rwsr-xr-x 1 1000 1000 147560 Jan 20 2021 /usr/bin/sudo

```

> [@Colin](#):
>
> ls -n $HOME

```auto
pi@homeautomatic:~ $ ls -n $HOME
total 308
-rw-r--r-- 1 1000 1000 307200 Nov 3 17:09 noderedbackup
-rw-r--r-- 1 1000 1000 81 Oct 30 21:06 package-lock.json
drwxr-xr-x 2 1000 1000 4096 Oct 30 19:38 temp

```

> [@Colin](#):
>
> @henrik1 are you sure you did not run `chown` manually?

I am absolutely sure I don't know the `chown` command, so I have not typed it in my self. That said I did search the net for advice what to do when I got the `sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set` running the Node-Red install script . I have been through my web browsers history and found this site I have visited [https://unix.stackexchange.com/questions/419122/sudo-must-be-owned-by-uid-0-and-have-the-setuid-bit-set](https://unix.stackexchange.com/questions/419122/sudo-must-be-owned-by-uid-0-and-have-the-setuid-bit-set) and in there the following commands are used:

```auto
# return ownership
chown root:root /usr/bin/sudo

# fix permissions
chmod 4755 /usr/bin/sudo

reboot

```

I am pretty sure I ran this to try to fix the error I got, but that was AFTER a got the `sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set` running the Node-Red install script .

---

<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:** [4 November 2022 07:44 UTC](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846/40 "2022-11-04T07:44:17Z")

</div>

> [@henrik1](#):
>
> `-rw-r--r-- 1 pi pi 692851 Nov 2 20:58 CHANGELOG.md`

I think it likely that is when it happened. Do you know what you were doing then? Can you show us the start of that file please.  
Thanks for helping with this, we would very much like to know how it happened.

Also the start of the readme there please.

[Previous page](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846.md?page=1)

[Next page](https://discourse.nodered.org/t/upgrade-node-red-on-raspberry-pi/69846.md?page=3)
