Damus
ndeet profile picture
ndeet
@ndeet
#openclaw lessons: crash during update, all broken, `openclaw` commands do not work anymore

##What happened:

When running `openclaw update` there were some warnings but the usual screen that asks you for restarting the service did not appear, it just stopped.

**Error on console you see when that happens during `openclaw update` (or not if you let openclaw update itself 💀 **

`Update Result: ERROR Root: /home/ndeet/.npm-global/lib/node_modules/openclaw Reason: global update Before: 2026.2.15`

When trying to run `openclaw status` there was an error that the binary was not found anymore:

`$ openclaw -bash: /home/ndeet/.npm-global/bin/openclaw: File or directory not found`

##What happened (in my case):

System ran out of memory and I did not have a swapfile configured. I run openclaw on a local server using proxmox kvm VM and it has 4GB of ram.

**to check if your server also ran out of memory: **
`journalctl -b | grep -i "out of memory\|oom\|killed process"`

if it shows some crashes of openclaw.service or npm then you likely have the same issue as me

In my case the old install was moved to temporary directory but new version not installed yet due to error

```
$ ls -lah ~/.npm-global/bin/
total 8,0K
drwxrwxr-x 2 ndeet ndeet 4,0K 18. Feb 11:29 .
drwxrwxr-x 4 ndeet ndeet 4,0K 30. Jän 17:35 ..
lrwxrwxrwx 1 ndeet ndeet 44 30. Jän 18:06 clawdhub -> ../lib/node_modules/clawdhub/bin/clawdhub.js
lrwxrwxrwx 1 ndeet ndeet 40 30. Jän 18:06 mcporter -> ../lib/node_modules/mcporter/dist/cli.js
lrwxrwxrwx 1 ndeet ndeet 41 16. Feb 11:54 .openclaw-8sOzPP85 -> ../lib/node_modules/openclaw/openclaw.mjs
```
note that there is no symbolic link pointing to openclaw.mjs but only the temporarily moved one of `openclaw-8sOzPP85`

Solution: move symlink so openclaw works again

`mv ~/.npm-global/bin/.openclaw-8sOzPP85 ~/.npm-global/bin/openclaw`

Now openclaw should work again (try by running `openclaw status`) but doing update would likely crash again. The best solution would be to allocate more RAM but it could also be that you did not have any swap configured that can be used for ram spikes like this (check with `free -h | grep Swap`). So if you don't have any swap you can create a swapfile.

##Create a swapfile:

```
# Create the file
sudo fallocate -l 4G /swapfile

# Secure it (only root should read it)
sudo chmod 600 /swapfile

# Format as swap
sudo mkswap /swapfile

# Enable it
sudo swapon /swapfile

# Verify
free -h
```
Make it permanent across reboots:
`echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab`

Optionally, tune swappiness (default is 60, lower = RAM preferred over swap):
`echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf`
`sudo sysctl vm.swappiness=10`

**You can now try the update again and it should work. 🥳 **



1
ndeet · 3d
seems I'm too dumb for making nostr render my markdown 😛