[GH-ISSUE #145] Errors on line 73 and 107 when running this script #458

Closed
opened 2026-03-12 15:46:58 +03:00 by kerem · 23 comments
Owner

Originally created by @githubaccountforme on GitHub (Jan 7, 2024).
Original GitHub issue: https://github.com/007revad/Synology_enable_M2_volume/issues/145

Hi, I have a Synology DS723+ that is running DSM 7.2.1-69057 Update 3.

I am running the script as follows (the file is in my downloads folder), specifically: "sudo -i ~/Downloads/Synology_enable_M2_volume-1.1.15/syno_enable_m2_volume.sh"

but I am receiving the following error messages:

"line 73: ${1,,}: bad substitution"

"line 107: get_key_value: command not found
This script only works for DSM 7."

I'm unsure what I'm doing incorrectly here as I thought I was following the exact instructions to run the script.

Any ideas on what I can do to bypass this hurdle?

For reference I currently have a Crucial MX 500 2.5" SATA SSD in one of the drive slots, and two Crucial P3 Plus 4TB PCIe Gen4 3D NAND NVMe M.2 SSD's in the slots on the bottom of the device.

Synology recognizes the initial Crucial MX 500 2.5 SSD, but won't recognize the NMVe's, thus why I'm trying to run this script.

Any ideas would be appreciated, thank you! Please let me know if I'm leaving out anything pertinent.

Originally created by @githubaccountforme on GitHub (Jan 7, 2024). Original GitHub issue: https://github.com/007revad/Synology_enable_M2_volume/issues/145 Hi, I have a Synology DS723+ that is running DSM 7.2.1-69057 Update 3. I am running the script as follows (the file is in my downloads folder), specifically: "sudo -i ~/Downloads/Synology_enable_M2_volume-1.1.15/syno_enable_m2_volume.sh" but I am receiving the following error messages: "line 73: ${1,,}: bad substitution" "line 107: get_key_value: command not found This script only works for DSM 7." I'm unsure what I'm doing incorrectly here as I thought I was following the exact instructions to run the script. Any ideas on what I can do to bypass this hurdle? For reference I currently have a Crucial MX 500 2.5" SATA SSD in one of the drive slots, and two Crucial P3 Plus 4TB PCIe Gen4 3D NAND NVMe M.2 SSD's in the slots on the bottom of the device. Synology recognizes the initial Crucial MX 500 2.5 SSD, but won't recognize the NMVe's, thus why I'm trying to run this script. Any ideas would be appreciated, thank you! Please let me know if I'm leaving out anything pertinent.
kerem closed this issue 2026-03-12 15:47:04 +03:00
Author
Owner

@007revad commented on GitHub (Jan 7, 2024):

The get_key_value command should exist in every version of DSM. This command:

which get_key_value

should return:

/bin/get_key_value

Are you actually running it with the first double quote before sudo?

Try running it without the quotes:

sudo -i ~/Downloads/Synology_enable_M2_volume-1.1.15/syno_enable_m2_volume.sh

Or with $HOME instead of ~

sudo -i "$HOME/Downloads/Synology_enable_M2_volume-1.1.15/syno_enable_m2_volume.sh"
<!-- gh-comment-id:1880149485 --> @007revad commented on GitHub (Jan 7, 2024): The get_key_value command should exist in every version of DSM. This command: ``` which get_key_value ``` should return: ``` /bin/get_key_value ``` Are you actually running it with the first double quote before sudo? Try running it without the quotes: ``` sudo -i ~/Downloads/Synology_enable_M2_volume-1.1.15/syno_enable_m2_volume.sh ``` Or with $HOME instead of ~ ``` sudo -i "$HOME/Downloads/Synology_enable_M2_volume-1.1.15/syno_enable_m2_volume.sh" ```
Author
Owner

@githubaccountforme commented on GitHub (Jan 7, 2024):

Thank you for the reply. FYI I'm way out of my depth here on using terminal (Mac) at all, so I'll do my best to answer your questions.

For example, I'm unsure how to embed a command in this window, which is why I used double quotes to show which command I input. I didn't include any quotes in the actual command itself.

Also, the error messages I received didn't include quotes either, I was just including those for the same reason mentioned above.

I'm unsure what is being referenced in your reply in terms of the get_key_value command. Because of that, I'm not sure what to enter in the terminal in order to utlize the 'which get_key_value' (again, sorry for the quotes).

Not sure if it will help, but I've opened the script and included a copy so you can see the line its referencing.

screenshot of script

<!-- gh-comment-id:1880153027 --> @githubaccountforme commented on GitHub (Jan 7, 2024): Thank you for the reply. FYI I'm way out of my depth here on using terminal (Mac) at all, so I'll do my best to answer your questions. For example, I'm unsure how to embed a command in this window, which is why I used double quotes to show which command I input. I didn't include any quotes in the actual command itself. Also, the error messages I received didn't include quotes either, I was just including those for the same reason mentioned above. I'm unsure what is being referenced in your reply in terms of the get_key_value command. Because of that, I'm not sure what to enter in the terminal in order to utlize the 'which get_key_value' (again, sorry for the quotes). Not sure if it will help, but I've opened the script and included a copy so you can see the line its referencing. ![screenshot of script](https://github.com/007revad/Synology_enable_M2_volume/assets/47697547/46fc92a4-2315-4db7-9d41-7e22053b17d8)
Author
Owner

@githubaccountforme commented on GitHub (Jan 7, 2024):

Terminal

This is what I'm seeing in terminal when I enter the initial command

<!-- gh-comment-id:1880153529 --> @githubaccountforme commented on GitHub (Jan 7, 2024): ![Terminal ](https://github.com/007revad/Synology_enable_M2_volume/assets/47697547/cdef4c77-2e14-45f5-9c74-005eccdb2a97) This is what I'm seeing in terminal when I enter the initial command
Author
Owner

@007revad commented on GitHub (Jan 7, 2024):

In the terminal type: which get_key_value

<!-- gh-comment-id:1880154388 --> @007revad commented on GitHub (Jan 7, 2024): In the terminal type: `which get_key_value`
Author
Owner

@githubaccountforme commented on GitHub (Jan 7, 2024):

I receive: get_key_value not found

<!-- gh-comment-id:1880154503 --> @githubaccountforme commented on GitHub (Jan 7, 2024): I receive: get_key_value not found
Author
Owner

@githubaccountforme commented on GitHub (Jan 7, 2024):

get_key_value

Not sure if this helps, but the first time the get_key_value command shows up is line 155. Not sure why my error message references line 107 for this when it says its not found

<!-- gh-comment-id:1880154738 --> @githubaccountforme commented on GitHub (Jan 7, 2024): ![get_key_value](https://github.com/007revad/Synology_enable_M2_volume/assets/47697547/4e61df76-3cf0-4253-9160-f5c8504b34fd) Not sure if this helps, but the first time the get_key_value command shows up is line 155. Not sure why my error message references line 107 for this when it says its not found
Author
Owner

@007revad commented on GitHub (Jan 7, 2024):

Did you previously open the syno_enable_m2_volume.sh file in a file editor and then save it? It's as if some of the line endings have changed or some non-printable characters have been added.

Also the get_key_value not found error suggests the terminal is looking for get_key_value on the Mac.

Is the syno_enable_m2_volume.sh file in a folder on the Synology?

Have you used SSH to connect to the Synology?

<!-- gh-comment-id:1880157057 --> @007revad commented on GitHub (Jan 7, 2024): Did you previously open the syno_enable_m2_volume.sh file in a file editor and then save it? It's as if some of the line endings have changed or some non-printable characters have been added. Also the `get_key_value not found` error suggests the terminal is looking for get_key_value on the Mac. Is the syno_enable_m2_volume.sh file in a folder on the Synology? Have you used SSH to connect to the Synology?
Author
Owner

@githubaccountforme commented on GitHub (Jan 7, 2024):

The only thing I did was unzip the zip file to have a look inside, but I didn't open and save anything so as to change it.

The syno_enable_m2_volume.sh is only in the zip folder it came in, sitting in my Mac downloads folder. I haven't added anything to Synology yet.

Should I just delete the zip file, redownload, and try again?

<!-- gh-comment-id:1880158158 --> @githubaccountforme commented on GitHub (Jan 7, 2024): The only thing I did was unzip the zip file to have a look inside, but I didn't open and save anything so as to change it. The syno_enable_m2_volume.sh is only in the zip folder it came in, sitting in my Mac downloads folder. I haven't added anything to Synology yet. Should I just delete the zip file, redownload, and try again?
Author
Owner

@githubaccountforme commented on GitHub (Jan 7, 2024):

I just deleted all the downloads, redownloaded the zip file again. Unzipped the file so now the unzipped folder is sitting in my downloads. tried the following command:

sudo -i ~/Downloads/Synology_enable_M2_volume-1.1.15/syno_enable_m2_volume.sh

and received the same error messages about line 73 and 107, and that this script only works on DSM 7.

Any way to check to see if I somehow accidentally put something on the Synology? I don't think I did as I haven't uploaded anything there

<!-- gh-comment-id:1880158923 --> @githubaccountforme commented on GitHub (Jan 7, 2024): I just deleted all the downloads, redownloaded the zip file again. Unzipped the file so now the unzipped folder is sitting in my downloads. tried the following command: sudo -i ~/Downloads/Synology_enable_M2_volume-1.1.15/syno_enable_m2_volume.sh and received the same error messages about line 73 and 107, and that this script only works on DSM 7. Any way to check to see if I somehow accidentally put something on the Synology? I don't think I did as I haven't uploaded anything there
Author
Owner

@007revad commented on GitHub (Jan 7, 2024):

Did you unzip it to a folder on your Mac or a folder on the Synology?

It needs to be in a folder on the Synology.

The Synology needs to have SSH enabled. https://kb.synology.com/en-id/DSM/tutorial/How_to_login_to_DSM_with_root_permission_via_SSH_Telnet

Then in the terminal you need to connect to the Synology using SSH. If your admin account on the Synology was "myadmin" and the Synology's IP address was "192.168.0.12" and you left the SSH port set to 22 you'd connect with:
ssh myadmin@192.168.0.12 -p 22

Then enter your Synology account's password.

Now you can run the script with:
sudo -i "/syno_enable_m2_volume.sh"

And enter your Synology account's password again.

<!-- gh-comment-id:1880161388 --> @007revad commented on GitHub (Jan 7, 2024): Did you unzip it to a folder on your Mac or a folder on the Synology? It needs to be in a folder on the Synology. The Synology needs to have SSH enabled. https://kb.synology.com/en-id/DSM/tutorial/How_to_login_to_DSM_with_root_permission_via_SSH_Telnet Then in the terminal you need to connect to the Synology using SSH. If your admin account on the Synology was "myadmin" and the Synology's IP address was "192.168.0.12" and you left the SSH port set to 22 you'd connect with: `ssh myadmin@192.168.0.12 -p 22` Then enter your Synology account's password. Now you can run the script with: sudo -i "<path-to-file-on-synology>/syno_enable_m2_volume.sh" And enter your Synology account's password again.
Author
Owner

@githubaccountforme commented on GitHub (Jan 7, 2024):

Ah, there is the problem. I have only downloaded the file into my Downloads folder on my Mac, not on the Synology.

I thought I was following the instructions step by step but somehow missed all of the steps you just mentioned above.

I didn't realize I needed to download it onto my Synology, ROOKIE mistake. I knew it was going to be some form of user error on my part. Let me give this all a go and see if I can get it done.

Thank you so much and again, apologies for the rookie-ness... :)

Ok, I SSH'd in, opened the Synology File Station and created a 'home' folder, then copied the unzipped folder into it, as well as the syno_enable_m2_volume.sh file itself.

I used the following prompt but now get 'no such file or directory' (without quotes):

sudo -i /home/syno_enable_m2_volume.sh

I've also tried sudo sudo -i /home/Synology_enable_M2_volume-1.1.15/syno_enable_m2_volume.sh
and get the same message. Its clear I don't understand the proper structure to find this file as my Synology is currently set up.

Current setup

<!-- gh-comment-id:1880170744 --> @githubaccountforme commented on GitHub (Jan 7, 2024): Ah, there is the problem. I have only downloaded the file into my Downloads folder on my Mac, not on the Synology. I thought I was following the instructions step by step but somehow missed all of the steps you just mentioned above. I didn't realize I needed to download it onto my Synology, ROOKIE mistake. I knew it was going to be some form of user error on my part. Let me give this all a go and see if I can get it done. Thank you so much and again, apologies for the rookie-ness... :) Ok, I SSH'd in, opened the Synology File Station and created a 'home' folder, then copied the unzipped folder into it, as well as the syno_enable_m2_volume.sh file itself. I used the following prompt but now get 'no such file or directory' (without quotes): sudo -i /home/syno_enable_m2_volume.sh I've also tried sudo sudo -i /home/Synology_enable_M2_volume-1.1.15/syno_enable_m2_volume.sh and get the same message. Its clear I don't understand the proper structure to find this file as my Synology is currently set up. ![Current setup](https://github.com/007revad/Synology_enable_M2_volume/assets/47697547/e6de22d7-650b-44e9-b808-06a35a67792d)
Author
Owner

@githubaccountforme commented on GitHub (Jan 7, 2024):

Ok, finally ran: sudo -i home/"syno_enable_m2_volume.sh" which didn't give me an error message. The terminal went to the next line with a > and ability to enter more commands.

Do I need to type anything else in here now? I'm unsure if this successfully ran the script as this is all I'm seeing.

<!-- gh-comment-id:1880175813 --> @githubaccountforme commented on GitHub (Jan 7, 2024): Ok, finally ran: sudo -i home/"syno_enable_m2_volume.sh" which didn't give me an error message. The terminal went to the next line with a > and ability to enter more commands. Do I need to type anything else in here now? I'm unsure if this successfully ran the script as this is all I'm seeing.
Author
Owner

@007revad commented on GitHub (Jan 7, 2024):

Your original issue has helped me devise a plan to improve my scripts and readme pages.

  1. In each script I will add a check that the script is running on a Synology, and show a warning if it isn't.
  2. And I'll add a troubleshooting section to each script's readme page, and instructions on enabling and using SSH.

Your current issue is:

  1. The home folder is not a real folder. It is actually a link to /volume1/homes/
  2. Every folder is actually on a volume and when using SSH you need to include the volume.

Via SSH you need to use the actual folder path. Not the path you see in File Station.

Try

sudo -i ~/syno_enable_m2_volume.sh

Or

sudo -i $HOME/syno_enable_m2_volume.sh

Or

sudo -i /volume1/homes/<your-username>/syno_enable_m2_volume.sh

Replace with your Synology username.

<!-- gh-comment-id:1880179625 --> @007revad commented on GitHub (Jan 7, 2024): Your original issue has helped me devise a plan to improve my scripts and readme pages. 1. In each script I will add a check that the script is running on a Synology, and show a warning if it isn't. 2. And I'll add a troubleshooting section to each script's readme page, and instructions on enabling and using SSH. Your current issue is: 1. The home folder is not a real folder. It is actually a link to /volume1/homes/<your-username> 2. Every folder is actually on a volume and when using SSH you need to include the volume. Via SSH you need to use the actual folder path. Not the path you see in File Station. Try ``` sudo -i ~/syno_enable_m2_volume.sh ``` Or ``` sudo -i $HOME/syno_enable_m2_volume.sh ``` Or ``` sudo -i /volume1/homes/<your-username>/syno_enable_m2_volume.sh ``` Replace <your-username> with your Synology username.
Author
Owner

@007revad commented on GitHub (Jan 7, 2024):

The terminal went to the next line with a > and ability to enter more commands

Does your terminal normally show > while waiting for you type something?

Or does it normally show # or $

If it doesn't normally show > while waiting for you type something then press Ctrl+C to get back to normal # or $

<!-- gh-comment-id:1880180502 --> @007revad commented on GitHub (Jan 7, 2024): > The terminal went to the next line with a > and ability to enter more commands Does your terminal normally show > while waiting for you type something? Or does it normally show # or $ If it doesn't normally show > while waiting for you type something then press Ctrl+C to get back to normal # or $
Author
Owner

@githubaccountforme commented on GitHub (Jan 7, 2024):

no idea, Ctrl+C took me back to the normal #

Glad my complete lack of understanding could help for others like me in the future!

I tried all three of those commands and still get the same message: -ash: /root/syno_enable_m2_volume.sh: No such file or directory.

Is there any possibility that I didn't set up my Synology correctly and that is what is causing the problems?

<!-- gh-comment-id:1880185258 --> @githubaccountforme commented on GitHub (Jan 7, 2024): no idea, Ctrl+C took me back to the normal # Glad my complete lack of understanding could help for others like me in the future! I tried all three of those commands and still get the same message: -ash: /root/syno_enable_m2_volume.sh: No such file or directory. Is there any possibility that I didn't set up my Synology correctly and that is what is causing the problems?
Author
Owner

@007revad commented on GitHub (Jan 7, 2024):

Is there any possibility that I didn't set up my Synology correctly and that is what is causing the problems?

I did wonder about that when you said you created the home folder in File Station.

  1. Delete that home folder in File Station.
  2. Go to "Control Panel > Users & Groups"
  3. Click on the Advanced tab.
  4. Scroll down and tick "Enable user home service".
  5. Click Apply.

You will need to copy the syno_enable_m2_volumes.sh file to your home folder again.

<!-- gh-comment-id:1880203028 --> @007revad commented on GitHub (Jan 7, 2024): > Is there any possibility that I didn't set up my Synology correctly and that is what is causing the problems? I did wonder about that when you said you created the home folder in File Station. 1. Delete that home folder in File Station. 2. Go to "Control Panel > Users & Groups" 3. Click on the Advanced tab. 4. Scroll down and tick "Enable user home service". 5. Click Apply. You will need to copy the syno_enable_m2_volumes.sh file to your home folder again.
Author
Owner

@007revad commented on GitHub (Jan 7, 2024):

I just reread your original comment and noticed this:

Synology recognizes the initial Crucial MX 500 2.5 SSD, but won't recognize the NMVe's, thus why I'm trying to run this script.

Do you mean you can't see the NVMe drives in Storage Manager?

If yes, then this script probably won't help. In which case shut down the Synology, remove the NVMe drives then plug them back in.

<!-- gh-comment-id:1880222807 --> @007revad commented on GitHub (Jan 7, 2024): I just reread your original comment and noticed this: > Synology recognizes the initial Crucial MX 500 2.5 SSD, but won't recognize the NMVe's, thus why I'm trying to run this script. Do you mean you can't see the NVMe drives in Storage Manager? If yes, then this script probably won't help. In which case shut down the Synology, remove the NVMe drives then plug them back in.
Author
Owner

@githubaccountforme commented on GitHub (Jan 8, 2024):

Halleluja it worked! I had to delete the home folder, delete the homes folder by unchecking the "enable user home services' botton. Then I re-checked it which recreated both folders. I then copied the file into the home folder and ran:

sudo -i ~/syno_enable_m2_volume.sh

Which finally ran the script successfully. I was able to get both those NMVe drives set up in a pool properly.

I set up the recommended HDD_db script (on boot up) and the script we've been working on above (on shutdown) in the Task Scheduler.

Only remaining question I have is each drive shows as healthy, but then shows the firmware is unrecognized, is that because we just changed it using this script above?

task 1
task 2
task 3
Task 4

thank you SO MUCH for all your help in seeing this whole process through with me.

<!-- gh-comment-id:1880296905 --> @githubaccountforme commented on GitHub (Jan 8, 2024): Halleluja it worked! I had to delete the home folder, delete the homes folder by unchecking the "enable user home services' botton. Then I re-checked it which recreated both folders. I then copied the file into the home folder and ran: sudo -i ~/syno_enable_m2_volume.sh Which finally ran the script successfully. I was able to get both those NMVe drives set up in a pool properly. I set up the recommended HDD_db script (on boot up) and the script we've been working on above (on shutdown) in the Task Scheduler. Only remaining question I have is each drive shows as healthy, but then shows the firmware is unrecognized, is that because we just changed it using this script above? ![task 1](https://github.com/007revad/Synology_enable_M2_volume/assets/47697547/5eab7ca3-e0ff-44a5-9f1f-905df0ea372c) ![task 2](https://github.com/007revad/Synology_enable_M2_volume/assets/47697547/9bbeecbe-6157-48ca-95d2-c6f0e90339d0) ![task 3](https://github.com/007revad/Synology_enable_M2_volume/assets/47697547/9bf7bb67-1401-4af2-abe0-e30784a6d837) ![Task 4](https://github.com/007revad/Synology_enable_M2_volume/assets/47697547/4127dfd4-5f5b-43f4-a745-f195a2d1a899) thank you SO MUCH for all your help in seeing this whole process through with me.
Author
Owner

@007revad commented on GitHub (Jan 8, 2024):

You do NOT want to update the drive database.

The drive database Update Now button won't work because when you ran the syno_hdd_db script with the -n option it changed the the drive database download URL (to prevent DSM updating the drive database and making your drives unsupported or unrecognized).

The syno_hdd_db script should have made the drives and their firmware recognised as compatible by DSM.

Did you schedule the syno_hdd_db script to run with the -f option? If you did, remove -f from the scheduled task, then reboot.

<!-- gh-comment-id:1880361910 --> @007revad commented on GitHub (Jan 8, 2024): You do NOT want to update the drive database. The drive database Update Now button won't work because when you ran the syno_hdd_db script with the -n option it changed the the drive database download URL (to prevent DSM updating the drive database and making your drives unsupported or unrecognized). The syno_hdd_db script should have made the drives and their firmware recognised as compatible by DSM. Did you schedule the syno_hdd_db script to run with the -f option? If you did, remove -f from the scheduled task, then reboot.
Author
Owner

@githubaccountforme commented on GitHub (Jan 8, 2024):

Good to know, thanks.

I only ran the base script with the -nr option as shown in the instructions, I didn't add any additional options.

Will my new drives work properly with my Synology even though this message says the firmware is unrecognized? Or do I need to do something else in order for them to be recognized?

<!-- gh-comment-id:1880427498 --> @githubaccountforme commented on GitHub (Jan 8, 2024): Good to know, thanks. I only ran the base script with the -nr option as shown in the instructions, I didn't add any additional options. Will my new drives work properly with my Synology even though this message says the firmware is unrecognized? Or do I need to do something else in order for them to be recognized?
Author
Owner

@007revad commented on GitHub (Jan 8, 2024):

Your new drives will work properly.

The only thing that won't work is Storage Manager won't let you run Data Deduplication on the NVMe drives. But if you are using snapshots you should never run data deduplication anyway. You'd also need 4GB of memory for Data Deduplication.

<!-- gh-comment-id:1880638797 --> @007revad commented on GitHub (Jan 8, 2024): Your new drives will work properly. The only thing that won't work is Storage Manager won't let you run Data Deduplication on the NVMe drives. But if you are using snapshots you should never run data deduplication anyway. You'd also need 4GB of memory for Data Deduplication.
Author
Owner

@githubaccountforme commented on GitHub (Jan 8, 2024):

Perfect, everything is now set up and operational.

I sent a tip via Paypal as a thanks for walking me through all of this. Thank you again for creating this in the first place!

<!-- gh-comment-id:1881964216 --> @githubaccountforme commented on GitHub (Jan 8, 2024): Perfect, everything is now set up and operational. I sent a tip via Paypal as a thanks for walking me through all of this. Thank you again for creating this in the first place!
Author
Owner

@007revad commented on GitHub (Jan 8, 2024):

Thanks.

I added you to the donators list at the bottom of the Synology_HDD_db readme.

<!-- gh-comment-id:1881970817 --> @007revad commented on GitHub (Jan 8, 2024): Thanks. I added you to the donators list at the bottom of the [Synology_HDD_db](https://github.com/007revad/Synology_HDD_db) readme.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Synology_enable_M2_volume#458
No description provided.