ZyXEL NSA325v2 how to install new Samba (Entware-ng) and where to find it
All Replies
-
It looks like we have both "snatched defeat from the jaws of victory" as I too have lost the SMB2 and I'm also unable to login to the NAS through its web-interface. I appear to be able to SSH, but the nano editor that I installed from the random package is not there.
I think that the system is failing to boot properly. I think the Zycel replacement is in the boot-up path bacause it is stored in /init.d and something is going wrong in the boot-up.
I too have installed the Tweaks - perhaps that is the culprit.
Perhaps Mijzelf may be able to throw some light on the problem?
0 -
When booting, at some point the script /etc/init.d/zypkg.sh is called with argument 'startup'. (That is not the real name, I can't remember it at the moment, and I don't have a ZyXEL at hand, but you'll recognize it.)
This script starts all installed packages by calling their startscript with argument 'startup'. This happens sequentially, and if one script is blocking, it will block the boot process. The Entware-ng startscript creates the /opt symlink, and the executes all executables in /opt/etc/init.d/ with argument 'start'. These scripts are blocking too.
The sequence in which packages are started is a bit funny. Inside the ZYPKG_INFO.tgz file (or PKG_INFO.tgz) as it was downloaded from the vendor repository, there is a file ZYPKG_DEPS (PKG_DEPS?) which defines a sequence.
/etc/init.d/zypkg.sh first start all installed packages which are mentioned in ZYPKG_DEPS in the given sequence. Then it will start all installed packaged which aren't started yet in alphabetical sequence. And finally it will call all startscripts in /usr/local/zy-pkgs/etc/init.d/ which aren't called yet in alphabetical sequence.
(I have written some documentation here)
If there is a blocking script, it might be visible in top. (The backend of Process Monitor uses '/bin/top -bn1').
AFAIK Tweaks can not be the culprit, as in, I have never got feedback like this, in the 10~15 years the package exists.
0 -
Hello,
well, I found the cause of the problem, snooping around all logs I found these ones:
/usr/local/zy-pkgs/opt/var/log/log.nmbd
ERROR: can't open /opt/var/run/nmbd-ZyXELSambaReplacement.conf.pid: Error was File exists
/usr/local/zy-pkgs/opt/var/log/log.smbd
ERROR: can't open /opt/var/run/smbd-ZyXELSambaReplacement.conf.pid: Error was File exists
I presume they are files used to find the PID to Kill.
I deleted those 2 files, and rebooted, and now it works and I can see nmbd e smbd on process monitor.
Now, I fear that rebooting will cause again the same problem… but at least I know how to fix it.
Thanks
0 -
Now, I fear that rebooting will cause again the same problem…
It isn't supposed to, of course. smbd and nmbd are supposed to remove their pid file on a proper shutdown. And the package manager is supposed to shutdown all packages cleanly. And the Entware-ng package is supposed to shutdown your samba cleanly.
Which are a lot 'supposed to's.
It is quite easy to automatically cleanup all pid files on reboot. On all Linux distro's I know pid files are put in /run or /var/run, which are ramdisks, and so automatically empty on boot. Can't remember if the NSA line has a /var/run, but at least it has a /var/lock, which is also in ram.
So, if you exchange the directory /opt/var/run by a symlink to /var/lock (or /var/run, if that exists), your problem is gone.
rm -rf /opt/var/runln -s /var/lock /opt/var/run0 -
For me the reason why the .pid files had not been deleted was due to a line in the original samba.sh
In the stop) section there are two of these If statements (one for nmbd and one for smbd)
if [ -f $NMBDPID ] && ! ps h
cat $NMBDPID> /dev/nullthis throws the error:
ps: invalid option — 'h'
BusyBox v1.17.2 (2012-02-03 17:38:03 CST) multi-call binary.
Usage: psIt looks like the implementation of ps in BusyBox does not support any options, so this line fails and as a result the rm -f $NMBDPID is not executed.
My solution is to comment out the ps call and just go with the file existence check, and assuming that the daemon has been killed. I increased the wait from the kill call to the .pid file deletion from sleep 1 to sleep 2, just to be sure.
if [ -f $SMBDPID ] # && ! ps h
cat $SMBDPID> /dev/nullI've stored the samba.modified.sh in /usr/local/zy-pkgs/opt/etc/samba
and created a script that is executed on boot-up that is stored in /usr/local/zy-pkgs/etc/init.d/
using the line:
cp /usr/local/zy-pkgs/opt/etc/samba/samba.modified.sh /etc/init.d/samba.shThis startup script then goes on to modify the smb.conf file to change smb ports = 139 to smb port = 445, 139
SMBCONF=/etc/samba/smb.conf
#substitute port 139 for 445, 139 to enable SMB2
sed -i "s/139/445, 139/" $SMBCONF
#restart samba
/etc/init.d/samba.sh restartThe startup script concept came from Mijzelf who posted something similar on the Whirlpool Medion NAS forum back in 2014 - so, thanks (again) Mijzelf :-) .
0 -
Hello Mijzelf, You were right.
I did try to switch off and on the NAS, and everything is fine.
may be some anomalous happened during one of the reboot I did in the previous days.
Thanks
0 -
I've reached a point where I can get the new samba server to work, but something in the entware-ng package causes the reboot to fail after it is enabled.
The thing is that owing to some change I've made to the system, my Win11 machine now happily connects to the NAS using the firmware samba and dialect 1.5 (the same as my Router NAS).
So, considering that this was all about making the NAS work with Win11, I'll take that as a win and leave entware disabled.
I tried to modify the S09ZyXELSambaReplacement to work with absolute paths to config and .pid files to make it "entware independant", but it didn't work. I've just tried creating the link between /usr/local/zy-pkgs/opt/ to /opt/ and run the original S09ZyXELSambaReplacement start and everything worked. so maybe I just need to put that in a script before S09ZyXELSambaReplacement gets called and I'm in business.
More testing to follow, and I know that I have a fall-back if I can't get the replacement to run smoothly with entware-ng disabled.
0
Categories
- All Categories
- 439 Beta Program
- 2.8K Nebula
- 200 Nebula Ideas
- 126 Nebula Status and Incidents
- 6.3K Security
- 499 USG FLEX H Series
- 323 Security Ideas
- 1.6K Switch
- 83 Switch Ideas
- 1.3K Wireless
- 49 Wireless Ideas
- 6.8K Consumer Product
- 287 Service & License
- 457 News and Release
- 89 Security Advisories
- 31 Education Center
- 10 [Campaign] Zyxel Network Detective
- 4.3K FAQ
- 34 Documents
- 34 Nebula Monthly Express
- 85 About Community
- 96 Security Highlight
Freshman Member
Guru Member