007revad / Synology_app_mover

Easily move Synology packages from 1 volume to another volume
MIT License
356 stars 25 forks source link

Emergency, need to back up the app, but the prompt ./syno_app_mover.sh: line 1492: package_names["${package_name}"]: bad array subscript #111

Closed yilin101 closed 1 month ago

yilin101 commented 1 month ago

pve + sa6400 SA6400 DSM 7.2.1-69057-1

Hello. I used to use hdd drive, to improve performance I added M2 drive, so I re-installed the app and migrated the database to M2 drive (done in synology system), after running normally for few months, But a few days ago photo app database was lost inexplicably, and today cloudsync also lost its database, but I re-entered photo, and found that its database is back to the same level as the day I lost it.

I want to use this tool to back up the databases stored on both hard drives to overwrite and restore my cloudsync, but when I run the tool, I get the following error

PLS help me,Thank you!

root@NAS:/volume3/backup/Synology_app_mover-3.1.60# ./syno_app_mover.sh Synology_app_mover v3.1.60 SA6400 DSM 7.2.1-69057-1

Running from: /volume3/backup/Synology_app_mover-3.1.60/syno_app_mover.sh

1) Move 2) Backup 3) Restore Select the mode: 2 You selected Backup

Backup path is: /volume3/backup/app_bak

./syno_app_mover.sh: line 1492: package_names["${package_name}"]: bad array subscript Do you want to backup All packages? [y/n]

007revad commented 1 month ago

I have no idea what pve is.

Can you run this test script and tell me what it outputs? https://github.com/007revad/Synology_HDD_db/blob/test/sam_issue_111.zip

yilin101 commented 1 month ago

I have no idea what pve is.

Can you run this test script and tell me what it outputs? https://github.com/007revad/Synology_HDD_db/blob/test/sam_issue_111.zip

Hello and thank you for your reply

pve=Proxmox VE

New script,outputs: root@NAS:/volume3/backup# ./sam_issue_111.sh package: nodejs package_name: ./sam_issue_111.sh: line 43: package_names["${package_name}"]: bad array subscript

007revad commented 1 month ago

Is nodejs an old syno community package? Synology's node.js packages are name Node.js_v18, Node.js_v20 etc.

Your nodejs package does not have displayname or package in it's /var/packages/nodejs/INFO file. It's an easy fix.

But I am curious what information /var/packages/nodejs/INFO contains. Can you tell what this command outputs?

while read -r line; do if [[ ! $line =~ description|package_icon ]]; then echo "$line"; fi done <  /var/packages/nodejs/INFO
yilin101 commented 1 month ago

root@NAS:~# while read -r line; do if [[ ! $line =~ description|package_icon ]]; then echo "$line"; fi done < /var/packages/nodejs/INFO -ash: /var/packages/nodejs/INFO: No such file or directory

The file doesn't seem to exist.

root@NAS:~# cd /var/packages/ root@NAS:/var/packages# cd nodejs/ root@NAS:/var/packages/nodejs# ls conf etc home scripts target tmp var

微信截图_20240916141207

007revad commented 1 month ago

I wonder if the nodejs folder and symlinks were left over from an old version of nod.js that was previously uninstalled.

What do the following commands return?

ls /var/packages/nodejs/target
ls -l /var/packages/nodejs_v16
ls /var/packages/nodejs_v16/target
ls -l /var/packages/nodejs_v18
ls /var/packages/nodejs_v18/target
ls -l /var/packages/nodejs_v20
ls /var/packages/nodejs_v20/target
yilin101 commented 1 month ago

It could be caused by having uninstalled it before.

root@NAS:~# ls /var/packages/nodejs/target app bin lib var root@NAS:~# ls -l /var/packages/nodejs_v16 ls: cannot access '/var/packages/nodejs_v16': No such file or directory root@NAS:~# ls /var/packages/nodejs_v16/target ls: cannot access '/var/packages/nodejs_v16/target': No such file or directory root@NAS:~# ls -l /var/packages/nodejs_v18 ls: cannot access '/var/packages/nodejs_v18': No such file or directory root@NAS:~# ls /var/packages/nodejs_v18/target ls: cannot access '/var/packages/nodejs_v18/target': No such file or directory root@NAS:~# ls -l /var/packages/nodejs_v20 ls: cannot access '/var/packages/nodejs_v20': No such file or directory root@NAS:~# ls /var/packages/nodejs_v20/target ls: cannot access '/var/packages/nodejs_v20/target': No such file or directory root@NAS:~#

007revad commented 1 month ago

If you go to "Package Center > Installed" are any packages showing as broken or need repair?

Check if any other packages are missing the INFO file:

for p in /var/packages/*; do if [[ ! -f $p/INFO ]]; then echo "$p"; fi; done
yilin101 commented 1 month ago

Sometimes it prompts need repair, but not currently

root@NAS:~# for p in /var/packages/*; do if [[ ! -f $p/INFO ]]; then echo "$p"; fi; done /var/packages/CMS /var/packages/Chat /var/packages/DiagnosisTool /var/packages/MigrationAssistant /var/packages/PDFViewer /var/packages/git /var/packages/itools /var/packages/nodejs

007revad commented 1 month ago

Sometimes it prompts need repair, but not currently That is really strange.

I would uninstall then reinstall Central Management System, Synology Chat Server, Diagnosis Tool, git, Migration Assistant, PDF Viewer, itools and all Node.js packages.

When you uninstall git and Synology Chat Server make sure you don't tick the option to remove the data.

After uninstalling and reinstalling those packages the syno_app_mover script should run okay.

yilin101 commented 1 month ago

Okay, I'll test it.

yilin101 commented 1 month ago

I found that chat app that I can't delete because I can't find it in the software center, but the app exists on the homepage, which is very strange, and I think it should be caused by this app, do you know how to delete this app with ssh please?

007revad commented 1 month ago
sudo synopkg uninstall Chat
yilin101 commented 1 month ago

微信截图_20240916170747

I'm using the same command, but it doesn't work.

NAS:~# sudo synopkg uninstall Chat {"action":"prepare","error":{"code":0},"stage":"prepare","success":true}

use synopkg list ,Couldn't find the app either, which is likely what caused it.

AntiVirus-1.5.6-3225: Synology Anti-Virus Console CloudDrive2-0.7.14-1: CloudDrive 是一个强大的多云盘管理工具,为用户提供包含云盘本地挂载的一站式的多云盘解决方案。⚠️本套件将以root权限运行! QuickConnect-1.0.7-0142: QuickConnect allows client applications to connect to your Synology NAS via the Internet without setting up port forwarding rules. It can also work with Synology-developed packages, such as File Station, Surveillance Station, Synology Drive, Synology Photos, and mobile applications. qemu-ga-9.0.1-7: QEMU Guest Agent for Synology. ⚠️本套件将以root权限运行! UniversalViewer-1.3.0-0312: Universal Viewer allows you to view different file formats directly on the Synology Drive without having to open each application. Certain packages require Universal Viewer to function fully. PHP8.2-8.2.21-0104: PHP is an open source scripting language which aims to help web developers write dynamically generated web pages efficiently. This language is suitable for web development in that it can be easily embedded into HTML. CloudSync-2.7.0-2610: With Cloud Sync, you can seamlessly sync and share files among your Synology NAS and multiple public clouds, such as Dropbox, Baidu Cloud and Google Drive. WebDAVServer-2.4.5-20131: WebDAV Server allows users to edit and manage files stored on the remote servers. When WebDAV Server is enabled, client programs that support WebDAV, such as certain Windows apps, Mac OS Finder, Linux File Browser, will be able to remotely access Synology NAS just like accessing a local network drive. StorageManager-1.0.0-0017: Storage Manager is a built-in application for managing storage on your Synology NAS. It offers a centralized interface to allocate storage capacity, monitor usage, check your drives' health, and use advanced features such as hot spare drives and SSD cache. ffmpeg5-5.1.5-3: FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. It includes libavcodec - the leading audio/video codec library. More information from SynoCommunity FFmpeg package available at https://github.com/SynoCommunity/spksrc/wiki/FAQ-FFmpeg SimplePermissionManager-1.0.0-9: Simple Permission Manager is used to approve some packages' priviledged commands automatically, some drivers packages and other packages need high permission to execute their actions. PlexMediaServer-1.41.0.8992-70008992: Plex organizes all of your personal media so you can easily access and enjoy it. pan-xunlei-com-3.21.0-0322072417: 迅雷官方出品,下载更快!但不止于快!支持迅雷App远程下载和会员超级加速。 内测版本:3.21.0-0322072417 编译版本:5d916f14 SnapshotReplication-7.4.5-1698: Snapshot Replication is an expert of data backup and recovery with the point-in-time copy mechanism. Businesses need data protection to prevent data loss from accidental deletion, application crashes, data corruption, and viruses. CodecPack-3.1.0-3005: Advanced Media Extensions (AME) allows you to view High-Efficiency Video Coding (HEVC) files on your Synology NAS. (Note: Sign in to your Synology Account to install the codec pack after installing AME) SupportService-2.0.1-21035: rr-manager-2.0-19: RR Manager is a Redpill Recovery DSM application aimed to provide the ability to configure/update RR without booting to RR recovery. This package is for experienced users. HybridShare-1.4.2-1728: Hybrid Share is a cloud file management solution that combines C2 cloud storage with on-prem NAS hosts across multiple locations. It offers high scalability, quick multi-site file access, and rapid deployment, facilitating efficient cross-site collaboration. RustDeskServer-1.1.11-1: RustDesk是一款可以完全由用户定义的远程桌面软件。您可以使用RustDesk服务器自建中继服务器,先尝试打洞加密直连,不行再由服务器转发。 jackett-0.22.361: Jackett works as a proxy server. It translates queries from apps into tracker-site-specific http queries, parses the html response, then sends results back to the requesting software. Jackett is a single repository of maintained indexer scraping and translation logic - removing the burden from other apps. SMBService-4.15.13-0877: SMB Service is an easy-to-use file service management tool, allowing you to manage general settings related to the SMB/CIFS file sharing service. Through SMB Service, Windows, macOS, and Linux users can access your Synology NAS from the network once you have enabled the SMB service option in Control Panel. Python2-2.7.18-1004: Python is an interpreted, interactive, and object-oriented programming language suitable for distributed application development, scripting, numeric computing and system testing. With Python, you can develop or integrate your systems more quickly and effectively. zerotier-1.14.0-1: Securely connect any device, anywhere. 使用教程:https://imnks.com/3175.html,⚠️本套件将以root权限运行! aliyundrive-webdav-2.3.3: 阿里云盘 WebDAV 服务,主要使用场景为配合支持 WebDAV 协议的客户端 App 如 Infuse、nPlayer 等实现在电视上直接观看云盘视频内容, 支持上传文件,但受限于 WebDAV 协议不支持文件秒传。套件使用教程:https://imnks.com/3939.html TextEditor-1.2.5-0254: Text Editor provides you with extensive editing features to handle plain text files, such as programming scripts and HTML files, directly in DSM. SynoFinder-1.7.0-0704: Synology Universal Search is a powerful search tool for your Synology NAS. In one search, you can find matched items from photos to notes. You can also index folders to provide precise and prompt search results by filename or file content. With Synology Universal Search, everything on your Synology NAS is just a few clicks away. HyperBackup-4.1.1-3758: Hyper Backup helps you protect shared folder data, packages, and LUNs on your Synology NAS thoroughly, providing diverse backup destinations and multiple backup versions. Restoration is available with a straightforward version browsing interface. FileStation-1.4.1-1559: File Station is the centralized file management tool for your Synology NAS. Through File Station, you can manage and search files/folders, view files of various types, share private files with external users, mount remote folders and virtual drives for access, and do much more! StorageAnalyzer-2.1.0-0620: Storage Analyzer allows you to have a quick glance at the overall usage trends of your Synology NAS, create and manage tasks to analyze storage spaces, and generate detailed reports on volume usage. headscale-0.22.3: Headscale 是第三方开源版本的 Tailscale 服务端。使用教程:https://imnks.com/6935.html SecureSignIn-1.1.6-0391: Secure SignIn Service provides enhanced account security for your DSM. It allows passwordless logins and offers sign-in options in addition to basic 2-factor authentication methods. python311-3.11.5-8: Python Programming Language. PHP7.4-7.4.33-0130: PHP is an open source scripting language which aims to help web developers write dynamically generated web pages efficiently. This language is suitable for web development in that it can be easily embedded into HTML. Perl-5.34.1-0301: Perl is an object-oriented programming language which can be used for CGI scripts, system administration, network programming and other applications. It has features that can ease the task of programming, including regular expressions and strong string manipulation. ScsiTarget-1.0.10-0314: SAN Manager helps you to manage and monitor your iSCSI and Fibre Channel services easily. Both iSCSI and Fibre Channel are storage area network (SAN) services that provide access to consolidated and block-level data storage. Clients can access storage space over storage network as if the space were local disks. NoteStation-2.6.5-3801: Note Station helps you fully enjoy writing, viewing, managing, and sharing content-rich notes. It is very easy to create content with rich text editing, media embedding, attachments, and much more. Manage your notes by using tags and grouping notes into Notebooks. When you are ready, Note Station makes sharing your content via social networking platforms simple and quick. Create, share, and enjoy! Tailscale-1.74.0-700074000: Connect all your devices using WireGuard, without the hassle. ContainerManager-24.0.2-1525: Container Manager is a lightweight virtualization application that gives you the ability to run thousands of containers created by developers from all over the world on DSM. The hugely popular built-in image repository, Docker Hub, allows you to find shared applications from other talented developers. EmbyServer-4.8.8.0-724080800: Emby Server is a personal media server with apps on just about every device ReplicationService-1.3.0-0409: Replication Service is a core service that offers the ability to replicate taken snapshots from the source to the destination. This package cannot run alone and depends on core packages that offer snapshot features. LogCenter-1.3.0-1660: Log Center offers an easy solution for gathering and displaying log messages from network devices. It provides you with a centralized log management interface and the flexible search function to help you find the useful information efficiently. qBittorrent-4.6.6: qBittorrent是一个新的轻量级BitTorrent客户端,可运行于Linux、windows及其他可能系统,它简单易用,漂亮的外观,功能强大。现在它可以被视为一个良好的替代其他BitTorrent软件的客户端。默认用户名:admin,默认密码:adminadmin。 ActiveInsight-3.0.2-24053: Active Insight is a cloud service that provides better technical support experience with faster troubleshooting. When enabled on multiple of your Synology hosts, it allows you to manage them across locations with a performance monitoring and automated warning system.

yilin101 commented 1 month ago

微信截图_20240916172111 Removed these, including nodejs

007revad commented 1 month ago

Using rm -rf would have left all the @appstore folders.

image

yilin101 commented 1 month ago

I deleted all the files in the “conf”“ home”“ share ”“store ”“temp ”“data”“folder about the following

rm -rf CMS rm -rf Chat rm -rf git rm -rf itools rm -rf Node.js_v* rm -rf nodejs rm -rf DiagnosisTool rm -rf MigrationAssistant rm -rf PDFViewer


After running it prompts the following There seems to be a little error.

Running from: /volume3/backup/Synology_app_mover-3.1.60/syno_app_mover.sh

1) Move 2) Backup 3) Restore Select the mode: 2 You selected Backup

Backup path is: /volume3/backup/app_bak

./syno_app_mover.sh: line 1492: package_names["${package_name}"]: bad array subscript Do you want to backup All packages? [y/n]

[Installed package list] 1) /volume1 CloudDrive2 7) /volume3 Antivirus Essential 2) /volume1 Jackett 8) /volume3 Cloud Sync 3) /volume1 Plex Media Server 9) /volume3 Universal Viewer 4) /volume1 QEMU Guest Agent 10) /volume3 WebDAV Server 5) /volume1 RustDesk服务器 11) /volume3 迅雷 6) /volume2
Select the package to backup:

yilin101 commented 1 month ago

Newly installed app, can't list

007revad commented 1 month ago

I assume that looked like:

1) /volume1 CloudDrive2         7) /volume3 Antivirus Essential
2) /volume1 Jackett             8) /volume3 Cloud Sync
3) /volume1 Plex Media Server   9) /volume3 Universal Viewer
4) /volume1 QEMU Guest Agent   10) /volume3 WebDAV Server
5) /volume1 RustDesk服务器      11) /volume3 迅雷
6) /volume2

Which package is installed on volume2 ?

yilin101 commented 1 month ago

It may have been installed at one time, but volume2 has been removed and the drive is not currently available

007revad commented 1 month ago

What do these 2 commands return?

for p in /var/packages/*; do ls -lR "$p" | grep '^l' | grep 'volume2'; done
ls -lR /usr/syno/etc/packages/ | grep '^l' | grep 'volume2'
yilin101 commented 1 month ago

for p in /var/packages/*; do ls -lR "$p" | grep '^l' | grep 'volume2'; done lrwxrwxrwx 1 root root 27 Jun 5 2021 etc -> /volume2/@appconf/PDFViewer lrwxrwxrwx 1 root root 27 Dec 8 2020 home -> /volume2/@apphome/PDFViewer lrwxrwxrwx 1 root root 28 Nov 20 2019 target -> /volume2/@appstore/PDFViewer lrwxrwxrwx 1 root root 27 Dec 8 2020 tmp -> /volume2/@apptemp/PDFViewer lrwxrwxrwx 1 root root 27 Dec 8 2020 var -> /volume2/@appdata/PDFViewer root@NAS:~# ls -lR /usr/syno/etc/packages/ | grep '^l' | grep 'volume2' lrwxrwxrwx 1 root root 27 Jun 5 2021 PDFViewer -> /volume2/@appconf/PDFViewer

How do I delete this?

007revad commented 1 month ago
rm /usr/syno/etc/packages/PDFViewer
rm -rf /volume2/@appconf/PDFViewer
rm -rf /volume2/@appdata/PDFViewer
rm -rf /volume2/@apphome/PDFViewer
rm -rf /volume2/@appstore/PDFViewer
rm -rf /volume2/@apptemp/PDFViewer
yilin101 commented 1 month ago

Problems persist after running

root@yilin101-NAS:~# rm /usr/syno/etc/packages/PDFViewer root@yilin101-NAS:~# rm -rf /volume2/@appconf/PDFViewer root@yilin101-NAS:~# rm -rf /volume2/@appdata/PDFViewer root@yilin101-NAS:~# rm -rf /volume2/@apphome/PDFViewer root@yilin101-NAS:~# rm -rf /volume2/@appstore/PDFViewer root@yilin101-NAS:~# rm -rf /volume2/@apptemp/PDFViewer root@yilin101-NAS:~# for p in /var/packages/; do ls -lR "$p" | grep '^l' | grep 'volume2'; done lrwxrwxrwx 1 root root 27 Jun 5 2021 etc -> /volume2/@appconf/PDFViewer lrwxrwxrwx 1 root root 27 Dec 8 2020 home -> /volume2/@apphome/PDFViewer lrwxrwxrwx 1 root root 28 Nov 20 2019 target -> /volume2/@appstore/PDFViewer lrwxrwxrwx 1 root root 27 Dec 8 2020 tmp -> /volume2/@apptemp/PDFViewer lrwxrwxrwx 1 root root 27 Dec 8 2020 var -> /volume2/@appdata/PDFViewer root@yilin101-NAS:~# ls -lR /usr/syno/etc/packages/ | grep '^l' | grep 'volume2' root@yilin101-NAS:~# rm -rf /volume2/@appconf/PDFViewer root@yilin101-NAS:~# for p in /var/packages/; do ls -lR "$p" | grep '^l' | grep 'volume2'; done lrwxrwxrwx 1 root root 27 Jun 5 2021 etc -> /volume2/@appconf/PDFViewer lrwxrwxrwx 1 root root 27 Dec 8 2020 home -> /volume2/@apphome/PDFViewer lrwxrwxrwx 1 root root 28 Nov 20 2019 target -> /volume2/@appstore/PDFViewer lrwxrwxrwx 1 root root 27 Dec 8 2020 tmp -> /volume2/@apptemp/PDFViewer lrwxrwxrwx 1 root root 27 Dec 8 2020 var -> /volume2/@appdata/PDFViewer

007revad commented 1 month ago

Do you have a Windows PC?

When rm -f cannot delete a file, folder or symlink I use WinSCP's ui to browse to the file, folder or symlink and delete them.

007revad commented 1 month ago

Lets delete the symlinks that are pointing to volume2:

rm /var/packages/PDFViewer/etc
rm /var/packages/PDFViewer/share
rm /var/packages/PDFViewer/target
rm /var/packages/PDFViewer/tmp
rm /var/packages/PDFViewer/var
yilin101 commented 1 month ago

image

Hello. It's finally done. Thank you for your patience, you're a great guy. Now I can use your great program.