homebridge: Updating Node.js from vx.xx to v20.9.0...fails, node: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by node)

Analysis

Homebridge stuck on starting now.

Tried logging in and updating via SSH but not working.

Expected Behavior

Homebridge to work

Steps To Reproduce

sudo hb-service update-node
ℹ Updating Node.js from v18.18.2 to v20.9.0...
ℹ Target: /opt/homebridge
✔ Download complete.
✔ Cleaned up npm at at /opt/homebridge/lib/node_modules/npm
✔ Installed Node.js v20.9.0
ℹ Rebuilding for Node.js v20.9.0...
node: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by node)
Error: Command failed: node -v
node: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by node)

✖ ERROR: Failed Operation
⚠ Please restart Homebridge for the changes to take effect.

Logs

This is the error I get.

/usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by node)

Configuration

Can't access to post.

Environment

  • OS: Raspberry Pi
  • Software: 1.61
  • Node: 18.18.0 (tried to update to 20.04)
  • npm: Not sure

Process Supervisor

hb-service

Additional Context

I have tried the following, all to no avail.

sudo apt-get install libstdc++6 sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade

Nothing works. I keep getting the same error repeated.

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Reactions: 1
  • Comments: 93 (18 by maintainers)

Commits related to this issue

Most upvoted comments

What helped me to get back to 18.18.2 have been the following steps:

Uninstall nodejs 20.9.0 (installation done by using nodesource) sudo apt-get purge nodejs

Following the installation steps like described in nodesource

sudo apt-get update

sudo apt-get install -y ca-certificates curl gnupg

sudo mkdir -p /etc/apt/keyrings

curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg

echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt-get update

sudo apt-get install nodejs -y

No need for starting from scratch!

I had the same issue. the only way for me was to get back to Node 18.18.0

I’ve asked the ChatGPT-4 😃

Removing and Reinstalling a Specific Version of Node.js on Raspberry Pi: Removal:

First, stop the Homebridge service and remove the current version of Node.js along with npm (Node Package Manager) and any associated files:

sudo hb-service stop
sudo apt-get remove --purge nodejs npm
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d
sudo rm -rf /usr/local/include/node /usr/local/bin/node

This will clean up the system by removing Node.js, npm, and related files from global system directories. Removing Dependencies:

If you have installed other Node.js packages, you can remove them with:

sudo apt-get autoremove

This helps in cleaning up unused packages that were automatically installed to satisfy dependencies for other packages. Reinstalling Node.js:

Now, you can install the desired version of Node.js using the Homebridge service command:

sudo hb-service update-node --version 18.18.0

This command uses the Homebridge service’s utility to install the specified version of Node.js. Verification:

After installation, check that Node.js is correctly installed:

node -v

The command should return the version of Node.js that you have just installed. Restarting Homebridge Service:

Once Node.js is installed, restart the Homebridge service:

sudo hb-service start

Service Check:

Verify that Homebridge is running properly:

sudo hb-service status

If you encounter any issues during the process, they should be addressed with detailed error messages. Remember that when updating Node.js, you may also need to update dependencies of your Node-based applications to ensure compatibility with the new version. Make sure that your Homebridge plugins are compatible with the new version of Node.js.

I had the same issue. the only way for me was to get back to Node 18.18.0

I’ve asked the ChatGPT-4 😃

Removing and Reinstalling a Specific Version of Node.js on Raspberry Pi: Removal:

First, stop the Homebridge service and remove the current version of Node.js along with npm (Node Package Manager) and any associated files:

sudo hb-service stop
sudo apt-get remove --purge nodejs npm
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d
sudo rm -rf /usr/local/include/node /usr/local/bin/node

This will clean up the system by removing Node.js, npm, and related files from global system directories. Removing Dependencies:

If you have installed other Node.js packages, you can remove them with:

sudo apt-get autoremove

This helps in cleaning up unused packages that were automatically installed to satisfy dependencies for other packages. Reinstalling Node.js:

Now, you can install the desired version of Node.js using the Homebridge service command:

sudo hb-service update-node --version 18.18.0

This command uses the Homebridge service’s utility to install the specified version of Node.js. Verification:

After installation, check that Node.js is correctly installed:

node -v

The command should return the version of Node.js that you have just installed. Restarting Homebridge Service:

Once Node.js is installed, restart the Homebridge service:

sudo hb-service start

Service Check:

Verify that Homebridge is running properly:

sudo hb-service status

If you encounter any issues during the process, they should be addressed with detailed error messages. Remember that when updating Node.js, you may also need to update dependencies of your Node-based applications to ensure compatibility with the new version. Make sure that your Homebridge plugins are compatible with the new version of Node.js.

That did it for me, thanks for posting!

@Raptor0014 - We will be releasing a update to Homebridge-config-ui-x to block this update for users who may be impacted

Would have been helpful around 2130 last night when my journey started. 😂

Same. I spent a few hours trying to update nodejs and get homebridge to work. I never did. I finally did a new install and then restored my homebridge settings from a backup and got back to where I was before I tried to update. I’m just going to let it ride for a while because I can’t go through that again.

None of this works. None of it. Tried OS upgrade, still at 10. Says node isn’t installed but it is. Everything wants the new GCC. What a CF. What’s the solution?

pi@homebridge:~ $ sudo hb-service stop
node: /lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by node)
pi@homebridge:~ $ sudo apt-get remove --purge nodejs npm
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'npm' is not installed, so not removed
Package 'nodejs' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@homebridge:~ $ node
node: /lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by node)
pi@homebridge:~ $ npm
node: /lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by node)

I ended up taking a copy of my config.json file, completely uninstalling Homebridge then reinstalling. Then copied over the config file and reinstalled my plugins and everything started working again!

@NorthernMan54 Thanks for such a great job and for taking the suggestions. I have a few more:

  1. SSH / FTP should be enabled by default. Maybe also, during the first launch where the login and password to the panel are set, the same password should be set for SSH / FTP?
  2. There is built-in FTP (you can connect to Raspberry and edit files) but it is strongly hidden. In fact, activating SSH (in hb-config / Configure OS / Interface Options / SSH) also activates FTP, and deactivating SSH deactivates FTP. One option is to change name: SSH to SSH & FTP. Other option is to split it into two independent options. It would also be good to add information what data should be provided to connect to FTP.
  3. There should be a simple command in the terminal and SSH that will create a backup and put it in the root directory of the memory card. There should also be a second simple command that will copy existing (last created) backup to the root directory of the memory card (in case for some reason the first command does not work).
  4. After starting the terminal (via Homebridge or SSH), more commands should be visible with their description of what it is used for, e.g.: hb-config (configuration), sudo reboot (restart), apt update and apt full-upgrade (component update), Two commands about which I wrote above (for creating backups), etc.
  5. The widget on the desktop should show the current version of Homebridge Image, as well as the latest version. If update available it should be visible immediately, not only when hovering (info about node update also). There should be links to: Homebridge Image page, Homebridge page and Homebridge Config Ui page.
  6. New widget - disk space. Used space and available space (SD cart).
  7. Option to filter logs by plugin and kyeword.
  8. Longer logs file (at least 24 h).
  9. New icons in navbar (next to logs and restart icon): terminal, homebridge settings.
  10. Built-in editor, something like the config.json editor, but able to edit plugin files.
  11. And the biggest challenge: the ability to integrate z-wave and zigbee, e.g. by connecting the appropriate pendrive / pendrives to raspberry and the ability to add zigbee and zwave devices directly to the homebridge.

Risked it (I like to live dangerously) and it went smoothly without hitch.

pi@homebridge:/var/lib/homebridge $ hb-service update-node ℹ Updating Node.js from v18.18.2 to v20.9.0… ℹ Target: /opt/homebridge ✔ Download complete. ✔ Cleaned up npm at at /opt/homebridge/lib/node_modules/npm ✔ Installed Node.js v20.9.0 ℹ Rebuilding for Node.js v20.9.0… rebuilt dependencies successfully ✔ Rebuilt homebridge-config-ui-x for Node.js v20.9.0. rebuilt dependencies successfully ✔ Rebuilt plugins in /opt/homebridge/lib/node_modules for Node.js v20.9.0. ⚠ Please restart Homebridge for the changes to take effect. pi@homebridge:/var/lib/homebridge $

If you using the Homebridge Raspbian image or the Homebridge APT Package, this will work to restore service without losing existing configuration.

sudo apt-get reinstall homebridge

This will downgrade the NodeJS version to 18.18.2 and reset the versions of homebridge and config-ui-x back to 1.6.1 and 4.50.6

My test run

Recreating the issue

sudo hb-service update-node
ℹ Updating Node.js from v18.18.2 to v20.9.0...
ℹ Target: /opt/homebridge
✔ Download complete.
✔ Cleaned up npm at at /opt/homebridge/lib/node_modules/npm
✔ Installed Node.js v20.9.0
ℹ Rebuilding for Node.js v20.9.0...
node: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by node)
Error: Command failed: node -v
node: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by node)

✖ ERROR: Failed Operation
⚠ Please restart Homebridge for the changes to take effect.

Broken

And restoring

sudo apt-get reinstall homebridge
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 4 not upgraded.
Need to get 0 B/35.8 MB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 132886 files and directories currently installed.)
Preparing to unpack .../homebridge_1.1.0_armhf.deb ...
Running pre-upgrade steps...
Stopping Homebridge service...
Unpacking may take several minutes on low powered devices.
Unpacking homebridge (1.1.0) over (1.1.0) ...
Setting up homebridge (1.1.0) ...
Merging package.json file...
Refreshing user plugins, this may take a few minutes, please wait...


changed 2 packages in 9s
rebuilt dependencies successfully

Running post-install steps...
Warning: The home dir /home/homebridge you specified already exists.
The system user `homebridge' already exists. Exiting.
Starting Homebridge service....

Doesn’t work.

pi@homebridge:~ $ sudo apt-get reinstall homebridge Reading package lists… Done Building dependency tree
Reading state information… Done E: Unable to locate package homebridge pi@homebridge:~ $

What helped me to get back to 18.18.2 have been the following steps:

Uninstall nodejs 20.9.0 (installation done by using nodesource) sudo apt-get purge nodejs

Following the installation steps like described in nodesource sudo apt-get update sudo apt-get install -y ca-certificates curl gnupg sudo mkdir -p /etc/apt/keyrings curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg

echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list

sudo apt-get update sudo apt-get install nodejs -y

No need for starting from scratch!

Are they 3 long commands. Or are they in seperate steps? (I’m not a guru with this and only use it for Homebridge for Apple integration).

@murtazabasrai Yes. I had to add everything to Apple Home again, set scenes and automations again. I fought it for 6 hours.

sudo hb-service rebuild

This worked for me. Revealed that I needed to update npm. Thanks!