Corrupted install on a synology after a power outage

I had a power outage and am unable to fix my Channels install.

Here is my history:
I am running a Synology DS918+ with Disk Manager 7.1.1 and have been running Channels DVR for over a year. My DS918+ is connected to an APC, so it nicely turns off as expected when the power goes out. I changed the default directory, but knew how to move it back and forth to other directories by giving the internal system user "channels" the appropriate read/write permissions. I have a mix of clients, but mostly firesticks and my network is mostly ubiquiti (7 wired access points, 2 internet (1 main and 1 backup).

Here is my issue:
I lost power this morning for about 2 hours, the UPS's exhausted and shut down the netork equipment nicely (including the Synology). I was about to turn on the generator, but then power came back on, so I manually powered up the Synology, however, the power cut again and the betteries didn't have enough charge in them to let it shut down gracefully. The power stayed off for another hour. When it came back on, I let it charge the batteries a little longer and then powered up the Synology. Everything came up OK on the Synology (everything in Docker, pi-hole, echo-speaks (for Hubitat) and other various projects) as well as my drives reporting well. It did start a data scrub because of the earlier abnormal power failure. However, Channels did not start, it was reporting:
within Package Center "Unable to run "Channels DVR". ChannelsDVR is already running."
So I opened Package Center and it showed Channels DVR at the top with "Failed to start "Channels DVR". Please try again later or contact the package developer." and it had an orange Repair button to the right. I restarted Synology hoping for a fluke after I checked to make sure the appropriate folders were still intact. It came up the same way after a reboot. So I hit the repair, and it ran through what appear to act like an install but it ended with "Failed o run the package service. ChannelsDVR is already running".

Channels was definitely not running, I couldn't get to the administration on port 8089, nor could any of my clients get to it and the firewall is definitely not blocking it. So, I thought, no biggie, I'll reinstall it and reimport the database. I went back to the package center, hit the Repair a couple more times, then it changed to give me an uninstall option which I chose. After it uninstalled, I reinstalled using ChannelsDVR_1.1.0.spk. I had the same issues as I did when running the repair. So I uninstalled again. This time I noticed the volume "ChannelsDVR" never uninstalled. Ok, so I removed it. Same issue after reinstalling - said it was already running. Each time I looked for a /volume1/@appstore/ChannelsDVR/channels-dvr/data/channels-dvr.log and it just never got that far, as a matter of fact, no logs were created in that folder. I also noticed the system user channels wasn't getting removed so I would do a cd /usr/syno/sbin/ then a sudo synouser --del channels after each attempt (which showed successful) of an uninstall.

I'm fairly confident I'm removing all traces of Channels when I uninstall it, so I can't for the life of me figure out why I can't get it installed (I've tried it on a clean reboot, not rebooting, many different ways - removing the folders, the system user channels, etc). Perhaps the install package doesn't like DM 7.1.1? As I stated earlier I was using a different root folder than the default ChannelsDVR, but I removed them and opted for a fresh start in the name of just getting it installed as a clean slate ... and still could not. Heck, I even temporarily stopped some processes and removed some like tailscale (since thats a new thing with Channels) in the hopes that none were interfering.

Any help would be appreciated, I'm at a loss.

That errors comes from looking at /var/packages/ChannelsDVR/var/ChannelsDVR.pid and if pidof channels-dvr returns the same thing. Maybe you need to ps aux | grep channels-dvr and kill the process.

ps aux | grep channels-dvr only shows the grep that is happening:

ps aux | grep channels-dvr
mark 29058 0.0 0.0 23244 2244 pts/0 S+ 15:43 0:00 grep --color=auto channels-dvr

If you see it in ps as running you should be able to connect to port 8089. What happens with something like curl -v localhost:8089 (or IP of the NAS)

ls -l /var/packages/ChannelsDVR/target/channels-dvr/data

The curl gives me a failure to connect, localhost or ip, the ls -l gives me total 0.

find /var/packages/ChannelsDVR/target/channels-dvr/ -ls

are there any installed binaries or versions?

you could try installing manually:

cd /var/packages/ChannelsDVR/target/channels-dvr/
curl -f https://getchannels.com/dvr/setup.sh -o setup.sh
DOWNLOAD_ONLY=1 sh setup.sh

I was able to download it (had to use sudo), how do I initiate the install manually?

Here is the listing for the find:
6409124 0 drwxr-xr-x 1 channels channels 90 May 20 15:54 /var/packages/ChannelsDVR/target/channels-dvr/
6409125 0 drwxr-xr-x 1 channels channels 0 Jul 8 2021 /var/packages/ChannelsDVR/target/channels-dvr/data
6409160 0 drwxr-xr-x 1 channels channels 120 May 20 15:04 /var/packages/ChannelsDVR/target/channels-dvr/2023.05.19.2045
6409162 4 -rwxr-xr-x 1 channels channels 376 May 20 15:02 /var/packages/ChannelsDVR/target/channels-dvr/2023.05.19.2045/linux-x86_64.sha256
6409163 114604 -rwxr-xr-x 1 channels channels 117353608 May 20 15:02 /var/packages/ChannelsDVR/target/channels-dvr/2023.05.19.2045/ffmpeg
6409168 15712 -rwxr-xr-x 1 channels channels 16088504 May 20 15:03 /var/packages/ChannelsDVR/target/channels-dvr/2023.05.19.2045/ffprobe
6409173 15272 -rwxr-xr-x 1 channels channels 15636088 May 20 15:03 /var/packages/ChannelsDVR/target/channels-dvr/2023.05.19.2045/comskip
6409175 51236 -rwxr-xr-x 1 channels channels 52462656 May 20 15:03 /var/packages/ChannelsDVR/target/channels-dvr/2023.05.19.2045/channels-dvr
6409177 14064 -rwxr-xr-x 1 channels channels 14398728 May 20 15:04 /var/packages/ChannelsDVR/target/channels-dvr/2023.05.19.2045/ffmpeg-dl
6409184 0 lrwxrwxrwx 1 channels channels 15 May 20 15:04 /var/packages/ChannelsDVR/target/channels-dvr/latest -> 2023.05.19.2045
6409686 4 -rw------- 1 root root 2927 May 20 15:54 /var/packages/ChannelsDVR/target/channels-dvr/setup.sh
6409687 0 drwx------ 1 root root 50 May 20 15:56 /var/packages/ChannelsDVR/target/channels-dvr/channels-dvr
find: `/var/packages/ChannelsDVR/target/channels-dvr/channels-dvr': Permission denied

Perhaps I should just ssh as the root - here is is the full listing now: (edit, just needed to sudo -i )
6409124 0 drwxr-xr-x 1 channels channels 90 May 20 15:54 /var/packages/ChannelsDVR/target/channels-dvr/
6409125 0 drwxr-xr-x 1 channels channels 0 Jul 8 2021 /var/packages/ChannelsDVR/target/channels-dvr/data
6409160 0 drwxr-xr-x 1 channels channels 120 May 20 15:04 /var/packages/ChannelsDVR/target/channels-dvr/2023.05.19.2045
6409162 4 -rwxr-xr-x 1 channels channels 376 May 20 15:02 /var/packages/ChannelsDVR/target/channels-dvr/2023.05.19.2045/linux-x86_64.sha256
6409163 114604 -rwxr-xr-x 1 channels channels 117353608 May 20 15:02 /var/packages/ChannelsDVR/target/channels-dvr/2023.05.19.2045/ffmpeg
6409168 15712 -rwxr-xr-x 1 channels channels 16088504 May 20 15:03 /var/packages/ChannelsDVR/target/channels-dvr/2023.05.19.2045/ffprobe
6409173 15272 -rwxr-xr-x 1 channels channels 15636088 May 20 15:03 /var/packages/ChannelsDVR/target/channels-dvr/2023.05.19.2045/comskip
6409175 51236 -rwxr-xr-x 1 channels channels 52462656 May 20 15:03 /var/packages/ChannelsDVR/target/channels-dvr/2023.05.19.2045/channels-dvr
6409177 14064 -rwxr-xr-x 1 channels channels 14398728 May 20 15:04 /var/packages/ChannelsDVR/target/channels-dvr/2023.05.19.2045/ffmpeg-dl
6409184 0 lrwxrwxrwx 1 channels channels 15 May 20 15:04 /var/packages/ChannelsDVR/target/channels-dvr/latest -> 2023.05.19.2045
6409686 4 -rw------- 1 root root 2927 May 20 15:54 /var/packages/ChannelsDVR/target/channels-dvr/setup.sh
6409687 0 drwx------ 1 root root 50 May 20 15:56 /var/packages/ChannelsDVR/target/channels-dvr/channels-dvr
6409688 0 drwx------ 1 root root 120 May 20 15:56 /var/packages/ChannelsDVR/target/channels-dvr/channels-dvr/2023.05.19.2045
6409690 4 -rwx------ 1 root root 376 May 20 15:54 /var/packages/ChannelsDVR/target/channels-dvr/channels-dvr/2023.05.19.2045/linux-x86_64.sha256
6409691 114604 -rwx------ 1 root root 117353608 May 20 15:55 /var/packages/ChannelsDVR/target/channels-dvr/channels-dvr/2023.05.19.2045/ffmpeg
6409694 15712 -rwx------ 1 root root 16088504 May 20 15:55 /var/packages/ChannelsDVR/target/channels-dvr/channels-dvr/2023.05.19.2045/ffprobe
6409695 15272 -rwx------ 1 root root 15636088 May 20 15:56 /var/packages/ChannelsDVR/target/channels-dvr/channels-dvr/2023.05.19.2045/comskip
6409698 51236 -rwx------ 1 root root 52462656 May 20 15:56 /var/packages/ChannelsDVR/target/channels-dvr/channels-dvr/2023.05.19.2045/channels-dvr
6409701 14064 -rwx------ 1 root root 14398728 May 20 15:56 /var/packages/ChannelsDVR/target/channels-dvr/channels-dvr/2023.05.19.2045/ffmpeg-dl
6409689 0 drwx------ 1 root root 0 May 20 15:54 /var/packages/ChannelsDVR/target/channels-dvr/channels-dvr/data
6409702 0 lrwxrwxrwx 1 root root 15 May 20 15:56 /var/packages/ChannelsDVR/target/channels-dvr/channels-dvr/latest -> 2023.05.19.2045

Okay are you able to start it via the NAS interface now?

Alternatively you could move all of /var/packages/ChannelsDVR somewhere and then try the install spk from scratch

No, it still shows:
Failed to run the package service.
ChannelsDVR is already running.

I'm not sure how to install from command line on a synology.

You would still install from the interface but with that directory removed it shouldn't get confused by any previous data

If you continue to get the "already running" error you'd need to find where the start-stop-status script is installed and try to run it manually to see what's going wrong with it

Also do make sure you have the latest dsm7 spk from getchannels.com/dvr-server

I removed that directory - it removed when I did an uninstall from the package center. That part works just fine. I did grab the spk from the url you have listed, just did it again to be sure (v 1.1.0). I ran it again, and it created the directory as expected (I watched in ssh), but errored out with the same error of:
ChannelsDVR is already running.

Can you see if sudo synopkg list --name shows ChannelsDVR

It does show it.

and sudo synopkg start ChannelsDVR ?

That gives me:
{"action":"start","beta":false,"error":{"code":272,"description":"Failed to run script, script=[start]"},"finished":true,"language":"enu","last_stage":"prepare_start","package":"ChannelsDVR","pid":6266,"scripts":[{"code":1,"message":"ChannelsDVR is already running.\n","type":"start"}],"stage":"start_failed","status":"start_failed","status_code":272,"status_description":"failed to start on previous startup","success":false,"username":"","version":"1.1.0"}

ps aux | grep 6266

find /var/packages/ChannelsDVR | grep start-stop-status

What if you restart?

sudo synopkg restart ChannelsDVR