Nmb doesn't shut down cleanly during shutdown or reboot. Causes 90 second delay

So theres 2 things I can think to do.

The first is rather superficial …

We can shorten that wait period to, say, 10 seconds.

printf '[Manager]\nDefaultTimeoutStopSec=10s' | sudo tee -a /etc/systemd/system.conf.d/faster-shutdown.conf

(reboot)

The second would be to add a service file to run some commands before shutdown:
/etc/systemd/system/before-shutdown.service

[Unit]
Description=Do stuff before shutdown

[Service]
Type=oneshot
RemainAfterExit=true
ExecStop=/bin/systemctl stop nmb.service

[Install]
WantedBy=multi-user.target

(or however you are shutting down nmb and/or other stuff you want to put there)

Then reload and enable it with

systemctl daemon-reload && systemctl enable before-shutdown.service

(reboot)

Of course you arent limited to one or the other … you can do both.