Samba Error / Error Mounting Shared Drives?

I am running Ubuntu Mate 16.04 on my Pi2. Recently my NAS stopped mounting at boot. I tried mounting manually but I got an error:

~$ sudo mount -a
Child process terminated abnormally.

I tried reinstalling Samba but I get the following error:

~$ sudo apt-get install samba
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  attr libaio1 python-dnspython samba-dsdb-modules samba-vfs-modules tdb-tools
Suggested packages:
  bind9 bind9utils ctdb ldb-tools smbldap-tools winbind
The following NEW packages will be installed:
  attr libaio1 python-dnspython samba samba-dsdb-modules samba-vfs-modules tdb-tools
0 upgraded, 7 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/1,409 kB of archives.
After this operation, 13.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package python-dnspython.
dpkg: warning: files list file for package 'libgssdp-1.0-3:armhf' missing; assuming package has no files currently installed
(Reading database ... 165429 files and directories currently installed.)
Preparing to unpack .../python-dnspython_1.12.0-1_all.deb ...
Unpacking python-dnspython (1.12.0-1) ...
Selecting previously unselected package tdb-tools.
Preparing to unpack .../tdb-tools_1.3.8-2_armhf.deb ...
Unpacking tdb-tools (1.3.8-2) ...
Selecting previously unselected package samba.
Preparing to unpack .../samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.21_armhf.deb ...
Unpacking samba (2:4.3.11+dfsg-0ubuntu0.16.04.21) ...
Selecting previously unselected package attr.
Preparing to unpack .../attr_1%3a2.4.47-2_armhf.deb ...
Unpacking attr (1:2.4.47-2) ...
Selecting previously unselected package libaio1:armhf.
Preparing to unpack .../libaio1_0.3.110-2_armhf.deb ...
Unpacking libaio1:armhf (0.3.110-2) ...
Selecting previously unselected package samba-dsdb-modules.
Preparing to unpack .../samba-dsdb-modules_2%3a4.3.11+dfsg-0ubuntu0.16.04.21_armhf.deb ...
Unpacking samba-dsdb-modules (2:4.3.11+dfsg-0ubuntu0.16.04.21) ...
Selecting previously unselected package samba-vfs-modules.
Preparing to unpack .../samba-vfs-modules_2%3a4.3.11+dfsg-0ubuntu0.16.04.21_armhf.deb ...
Unpacking samba-vfs-modules (2:4.3.11+dfsg-0ubuntu0.16.04.21) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for systemd (229-4ubuntu21.22) ...
Processing triggers for ureadahead (0.100.0-19.1) ...
Setting up python-dnspython (1.12.0-1) ...
Setting up tdb-tools (1.3.8-2) ...
update-alternatives: using /usr/bin/tdbbackup.tdbtools to provide /usr/bin/tdbbackup (tdbbackup) in auto mode
Setting up samba (2:4.3.11+dfsg-0ubuntu0.16.04.21) ...
Job for smbd.service failed because the control process exited with error code. See "systemctl status smbd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript smbd, action "start" failed.
â— smbd.service - LSB: start Samba SMB/CIFS daemon (smbd)
   Loaded: loaded (/etc/init.d/smbd; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2019-10-23 11:09:10 SAST; 58ms ago
     Docs: man:systemd-sysv-generator(8)
  Process: 6890 ExecStart=/etc/init.d/smbd start (code=exited, status=1/FAILURE)

Oct 23 11:09:10 Pi2 systemd[1]: Starting LSB: start Samba SMB/CIFS daemon (smbd)...
Oct 23 11:09:10 Pi2 smbd[6890]:  * Starting SMB/CIFS daemon smbd
Oct 23 11:09:10 Pi2 smbd[6890]: /usr/sbin/smbd: error while loading shared libraries: /usr/lib/arm-linux-gnueabihf/libsamba-credentials.so.0: invalid ELF header
Oct 23 11:09:10 Pi2 smbd[6890]:    ...fail!
Oct 23 11:09:10 Pi2 systemd[1]: smbd.service: Control process exited, code=exited status=1
Oct 23 11:09:10 Pi2 systemd[1]: Failed to start LSB: start Samba SMB/CIFS daemon (smbd).
Oct 23 11:09:10 Pi2 systemd[1]: smbd.service: Unit entered failed state.
Oct 23 11:09:10 Pi2 systemd[1]: smbd.service: Failed with result 'exit-code'.
dpkg: error processing package samba (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up attr (1:2.4.47-2) ...
Setting up libaio1:armhf (0.3.110-2) ...
Setting up samba-dsdb-modules (2:4.3.11+dfsg-0ubuntu0.16.04.21) ...
Setting up samba-vfs-modules (2:4.3.11+dfsg-0ubuntu0.16.04.21) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for systemd (229-4ubuntu21.22) ...
Processing triggers for ureadahead (0.100.0-19.1) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Errors were encountered while processing:
 samba
E: Sub-process /usr/bin/dpkg returned an error code (1)

What should I do to fix this, since I can't mount my drives ? Thanks.

/usr/sbin/smbd: error while loading shared libraries: /usr/lib/arm-linux-gnueabihf/libsamba-credentials.so.0: invalid ELF header

Looks like that file's damaged. Reinstall it and you should be okay.

@arQon Hi, how would I go about doing that ? Thanks.

Find the package that contains that lib.
dpkg -S libsamba-credentials.so.0
reinstall it.
sudo apt install --reinstall <whatever> (probably samba-libs)

ideally, re-download it and reinstall it, but since you say it used to work the file probably got damaged after installation.

Thanks, did exactly what you said and it's working again !