007revad / Synology_enable_Deduplication

Enable deduplication with non-Synology SSDs and unsupported NAS models
MIT License
70 stars 4 forks source link

sbtd initialized in wrong place - breaks SAN manager #38

Closed darthstrydre closed 6 months ago

darthstrydre commented 6 months ago

In file syno_enable_dedupe.sh, Line 882 “sbtd=support_tiny_btrfs_dedupe” Should be moved up by line 859, since the variable sbtd is used on lines 872-876.

Without that, the synoinfo.conf gets messed up with an extra “= no” line near the end.

On my 1522+ this corruption somehow kills SAN manager, which in turn prevents Virtual Machine Manager from running.

007revad commented 6 months ago

Thank you.

I've released a new version v1.2.15

I just tried synosetkeyvalue with an unset variable as the keyname and while it did return 1 as the exist code instead 0 it didn't create an ="no" line.

gallivanter commented 6 months ago

After applying v1.2.14 I also experiened this problem. I tried using the --restore arg and rebooting but it didn't allow me to start or repair SAN Manager. I also tried applying v1.2.15 and rebooting but that also didn't help. There isn't a rogue = no line near the end of my synoinfo.conf.

I don't use iSCSI so there are no targets or snapshots currently. If there's a quick way to clear the package config entirely so that I can get the package working I'd be open to that as a solution.

Attaching journalctl output when attempting to repair the SAN Manager and synoinfo.conf. journalctl.log synoinfo.conf.txt

darthstrydre commented 6 months ago

The fix worked for me, thank you revad. Gallivanter, I did have to reboot after manually restoring the synoinfo.conf.bak file once for SAN manager to be happy. Just using the —restore did not work because it left an unclean conf for me because of the extra “=no”. Give that a try.

I’m going to close, and though, because the initial issue is fixed.

007revad commented 6 months ago

If there's a quick way to clear the package config entirely so that I can get the package working I'd be open to that as a solution.

Download https://global.synologydownload.com/download/Package/spk/ScsiTarget/1.0.10-0314/ScsiTarget-x86_64-1.0.10-0314.spk

Then uninstall SAN Manager with the following command. sudo synopkg uninstall ScsiTarget

Finally in Package Center do a "Manual Install" of the ScsiTarget-x86_64-1.0.10-0314.spk you downloaded.

gallivanter commented 6 months ago

Thanks for the suggestions @darthstrydre and @007revad .

I manually restored synoinfo.conf from synoinfo.conf.bak, rebooted and attempted to manually remove the ScsiTarget package and reinstall using the manual install method. Unfortunately SAN Manager still won't start. The relevant log lines appear to be:

Dec 29 22:06:45 nas01 systemd[1]: Starting iSCSI Service...
Dec 29 22:06:45 nas01 synocheckiscsitrg[6570]: iSCSI:iscsi_repair.cpp:80:SYNOiSCSIRepair Total 0 issue(s) are detected.
Dec 29 22:06:45 nas01 S78iscsitrg.sh[6542]: :: Running lunbackup garbage collection ... [  OK  ]
Dec 29 22:06:45 nas01 synoiscsiep[6575]: iSCSI:iscsi_lun_service_start_all.cpp:105:SYNOiSCSILunServiceStartAllWithoutLock mkdir(/config/target/core/iblock_0, 448), err=No such file or directory
Dec 29 22:06:45 nas01 synoiscsiep[6575]: iSCSI:iscsi_start_all.cpp:22:SYNOiSCSIStartAllWithoutLock SYNOiSCSILunServiceStartAllWithoutLock(), err=Failed to create directory
Dec 29 22:06:45 nas01 synoiscsiep[6575]: iSCSI:iscsi_start_all.cpp:115:SYNOiSCSIStartAll SYNOiSCSIStartAllWithoutLock(), err=Failed to create directory
Dec 29 22:06:45 nas01 synoiscsiep[6579]: iSCSI:iscsi_lun_service_start_all.cpp:105:SYNOiSCSILunServiceStartAllWithoutLock mkdir(/config/target/core/iblock_0, 448), err=No such file or directory
Dec 29 22:06:45 nas01 synoiscsiep[6579]: iSCSI:vhost_scsi_start_all.cpp:13:SYNOiSCSIVhostStartAllWithoutLock SYNOiSCSILunServiceStartAllWithoutLock(), err=Failed to create directory
Dec 29 22:06:45 nas01 synoiscsiep[6579]: iSCSI:vhost_scsi_start_all.cpp:39:SYNOiSCSIVhostStartAll SYNOiSCSIVhostStartAllWithoutLock(), err=Failed to start service
Dec 29 22:06:45 nas01 synoiscsiep[6598]: iSCSI:iscsi_lun_service_start_all.cpp:105:SYNOiSCSILunServiceStartAllWithoutLock mkdir(/config/target/core/iblock_0, 448), err=No such file or directory
Dec 29 22:06:45 nas01 synoiscsiep[6598]: iSCSI:iscsi_lun_service_start_all.cpp:145:SYNOiSCSILunServiceStartAll SYNOiSCSILunServiceStartAllWithoutLock(), err=Failed to create directory
Dec 29 22:06:45 nas01 synoiscsiep[6602]: iSCSI:iscsi_lun_service_start_all.cpp:105:SYNOiSCSILunServiceStartAllWithoutLock mkdir(/config/target/core/iblock_0, 448), err=No such file or directory
Dec 29 22:06:45 nas01 synoiscsiep[6602]: iSCSI:iscsi_loopback_start_all.cpp:29:SYNOiSCSILoopbackStartAll SYNOiSCSILunServiceStartAllWithoutLock(), err=Failed to create directory
Dec 29 22:06:45 nas01 synoiscsiep[6606]: iSCSI:iscsi_lun_service_start_all.cpp:105:SYNOiSCSILunServiceStartAllWithoutLock mkdir(/config/target/core/iblock_0, 448), err=No such file or directory
Dec 29 22:06:45 nas01 synoiscsiep[6606]: iSCSI:fc_start_all.cpp:53:SYNOFCStartAll SYNOiSCSILunServiceStartAllWithoutLock(), err=Failed to create directory
Dec 29 22:06:45 nas01 systemd[1]: pkg-iscsi.service: main process exited, code=exited, status=221/CONFIRM
Dec 29 22:06:45 nas01 systemd[1]: Failed to start iSCSI Service.

/config exists but is empty.

007revad commented 6 months ago

There is no /config folder on my DS1821+ with DSM 7.2.1. Where are seeing the config folder?

What DSM version are you using?

Another alternative is to reinstall the same DSM version: https://github.com/007revad/Synology_DSM_reinstall

gallivanter commented 6 months ago

Interesting, you don't have a /config directory on your NAS? My DS1821+ has a /config dir:

admin@nas01:~$ ls -la /config
total 4
drwxr-xr-x  2 root root    0 Dec 29 22:20 .
drwxr-xr-x 26 root root 4096 Dec 29 22:21 ..

I'm running DSM 7.2.1-69057 Update 3. If that /config path definitely shouldn't exist I'm tempted to remove it since it's empty, before trying anything more drastic like re-installing DSM.

gallivanter commented 6 months ago

Checking if /config was referenced anywhere before removal, I found that it's actually mounted as configfs.

admin@nas01:~$ mount |grep config
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
none on /config type configfs (rw,nosuid,nodev,noexec,relatime)

ETA: If I unmount and delete /config it's recreated and remounted in the same way after attempting to repair SAN Manager.

007revad commented 6 months ago

Reinstalling the same DSM version is no different than upgrading DSM. All your files and settings etc are retained.

ScsiTarget-x86_64-1.0.10-0314 is the version included in DSM 7.2.1-69057 Update 3.

Oh, I do have /config I was looking for a ScsiTarget config folder in /var/packages/ScsiTarget/target and /usr/local/packages/@appstore/ScsiTarget

My DS1812+'s /config folder contains a bunch folders and files:

# ls -lR /config
/config:
total 0
drwxr-xr-x 2 root root 0 Dec 30 10:40 pool
drwxr-xr-x 2 root root 0 Dec 30 10:40 rodsys
drwxr-xr-x 6 root root 0 Dec 30 10:41 target
drwxr-xr-x 2 root root 0 Dec 21 18:35 volume
drwxr-xr-x 2 root root 0 Dec 28 14:46 vsys

/config/pool:
total 0
-r--r--r-- 1 root root 4096 Dec 30 10:42 cache_info
-rw-r--r-- 1 root root 4096 Dec 30 10:42 ext_jnl_cache_cnt
-rw-r--r-- 1 root root 4096 Dec 30 10:42 ext_jnl_enable
-rw-r--r-- 1 root root 4096 Dec 30 10:42 ext_jnl_path
-rw-r--r-- 1 root root 4096 Dec 30 10:42 ext_jnl_suspend
-r--r--r-- 1 root root 4096 Dec 30 10:42 help
-rw-r--r-- 1 root root 4096 Dec 30 10:42 preread_control

/config/rodsys:
total 0
-r--r--r-- 1 root root 4096 Dec 30 10:42 help
-r--r--r-- 1 root root 4096 Dec 30 10:42 local_key
-rw-r--r-- 1 root root 4096 Dec 30 10:42 throttle_interval_msec

/config/target:
total 0
drwxr-xr-x 8 root root    0 Dec 21 18:35 core
-rw-r--r-- 1 root root 4096 Dec 30 10:42 dbroot
-r--r--r-- 1 root root 4096 Dec 30 10:42 dump_qos_lists
-rw-r--r-- 1 root root 4096 Dec 30 10:42 io_delay_msec
-rw-r--r-- 1 root root 4096 Dec 30 10:42 io_delay_per_io
drwxr-xr-x 3 root root    0 Dec 21 18:35 iscsi
-r--r--r-- 1 root root 4096 Dec 30 10:42 lio_event
drwxr-xr-x 3 root root    0 Dec 21 18:35 loopback
-rw-r--r-- 1 root root 4096 Dec 30 10:42 target_iops
-r--r--r-- 1 root root 4096 Dec 30 10:42 version
drwxr-xr-x 3 root root    0 Dec 21 18:35 vhost

/config/target/core:
total 0
drwxr-xr-x 3 root root 0 Dec 21 18:35 alua
drwxr-xr-x 2 root root 0 Dec 21 18:35 epio_0
drwxr-xr-x 2 root root 0 Dec 21 18:35 epio_1
drwxr-xr-x 2 root root 0 Dec 21 18:35 fileio_0
drwxr-xr-x 2 root root 0 Dec 21 18:35 iblock_0
drwxr-xr-x 2 root root 0 Dec 21 18:35 multifile_0

/config/target/core/alua:
total 0
drwxr-xr-x 3 root root 0 Dec 21 18:35 lu_gps

/config/target/core/alua/lu_gps:
total 0
drwxr-xr-x 2 root root 0 Dec 21 18:35 default_lu_gp

/config/target/core/alua/lu_gps/default_lu_gp:
total 0
-rw-r--r-- 1 root root 4096 Dec 30 10:42 lu_gp_id
-r--r--r-- 1 root root 4096 Dec 30 10:42 members

/config/target/core/epio_0:
total 0
-r--r--r-- 1 root root 4096 Dec 30 10:42 hba_info
-rw-r--r-- 1 root root 4096 Dec 30 10:42 hba_mode
-r--r--r-- 1 root root 4096 Dec 30 10:42 odx_info
-rw-r--r-- 1 root root 4096 Dec 30 10:42 odx_mode

/config/target/core/epio_1:
total 0
-r--r--r-- 1 root root 4096 Dec 30 10:42 hba_info
-rw-r--r-- 1 root root 4096 Dec 30 10:42 hba_mode
-r--r--r-- 1 root root 4096 Dec 30 10:42 odx_info
-rw-r--r-- 1 root root 4096 Dec 30 10:42 odx_mode

/config/target/core/fileio_0:
total 0
-r--r--r-- 1 root root 4096 Dec 30 10:42 hba_info
-rw-r--r-- 1 root root 4096 Dec 30 10:42 hba_mode
-r--r--r-- 1 root root 4096 Dec 30 10:42 odx_info
-rw-r--r-- 1 root root 4096 Dec 30 10:42 odx_mode

/config/target/core/iblock_0:
total 0
-r--r--r-- 1 root root 4096 Dec 30 10:42 hba_info
-rw-r--r-- 1 root root 4096 Dec 30 10:42 hba_mode
-r--r--r-- 1 root root 4096 Dec 30 10:42 odx_info
-rw-r--r-- 1 root root 4096 Dec 30 10:42 odx_mode

/config/target/core/multifile_0:
total 0
-r--r--r-- 1 root root 4096 Dec 30 10:42 hba_info
-rw-r--r-- 1 root root 4096 Dec 30 10:42 hba_mode
-r--r--r-- 1 root root 4096 Dec 30 10:42 odx_info
-rw-r--r-- 1 root root 4096 Dec 30 10:42 odx_mode

/config/target/iscsi:
total 0
drwxr-xr-x 2 root root    0 Dec 21 18:35 discovery_auth
-rw-r--r-- 1 root root 4096 Dec 30 10:42 global_np_enable
-r--r--r-- 1 root root 4096 Dec 30 10:42 lio_version

/config/target/iscsi/discovery_auth:
total 0
-r--r--r-- 1 root root 4096 Dec 30 10:42 authenticate_target
-rw-r--r-- 1 root root 4096 Dec 30 10:42 enforce_discovery_auth
-rw-r--r-- 1 root root 4096 Dec 30 10:42 password
-rw-r--r-- 1 root root 4096 Dec 30 10:42 password_mutual
-rw-r--r-- 1 root root 4096 Dec 30 10:42 userid
-rw-r--r-- 1 root root 4096 Dec 30 10:42 userid_mutual

/config/target/loopback:
total 0
drwxr-xr-x 2 root root    0 Dec 21 18:35 discovery_auth
-r--r--r-- 1 root root 4096 Dec 30 10:42 version

/config/target/loopback/discovery_auth:
total 0

/config/target/vhost:
total 0
drwxr-xr-x 2 root root    0 Dec 21 18:35 discovery_auth
-rw-r--r-- 1 root root 4096 Dec 30 10:42 throttle_interval_msec
-r--r--r-- 1 root root 4096 Dec 30 10:42 version

/config/target/vhost/discovery_auth:
total 0

/config/volume:
total 0

/config/vsys:
total 0
-r--r--r-- 1 root root 4096 Dec 30 10:42 help
gallivanter commented 6 months ago

I bit the bullet and used Synology_DSM_reinstall to reinstall the current version of DSM. My /config path now looks like yours and SAN Manager is working as expected. Thanks for all the help!