Slow reboot, solved by unmounting CIFS shares first, what is best way to fix?

NOTE: I’m going to attempt to give the backstory, how I’ve tried to resolve it, and what issue remains. If you want to skip to a single question, jump down to the TL;DR below:

When I reboot (both from terminal using reboot and selecting restart from application menu in KDE) my computer goes to a black screen with my HP logo spinning. It takes about 90-seconds then it finally restarts. I have another machine that reboots in a matter of seconds. I finally started looking around and found some other forum posts that seem to point to CIFS shares - and yes I do have some on this machine and not the other. From what I read, and the output in from journalctl -b -1 -o short-monotonic -g Stopped --no-pager seems to be that the network is going down before it unmounts anything so it hangs and times out. Based on some stuff I read I learned i could press esc and see what the issue is, and sure enough after it timed out I saw a quick message about unmounting CIFS shares. So I was pretty sure that was the culprit.

So, with what little I’ve learned since starting my Linux journey I thought I would add an alias to the reboot command to unmount all the CIFS shares automatically when I type reboot. So I typed the following:

alias reboot='umount -a -t cifs -l && reboot'

Sure enough after doing this I did a reboot and I was at the BIOS screen in a couple seconds and at the GRUB screen about 2 seconds after that.

Unfortunately, when I listed my aliases after reboot (both for my user and root) my alias was not there. I was able to add it but it doesn’t seem to be persistent. Strange, but okay. So I went and did some google and seems I should add the alias command to my (and root’s) ~/.bashrc file. So I did that, and it appears to work.

But… This fixes when I reboot from the terminal. But what about when I select restart? That still takes a minute.

TL;DR
How can I force the unmounting of my CIFS shares before the network stack goes down on a reboot? Is there a bash file that runs “on restart” or something? Is there a systemd service config that I can force CIFS shares to unmount before stopping the network?

I’m on Tumbleweed and use KDE in case it matters, I update pretty much daily so “latest” everything available.

How I deal with similar issue here:

# alias | grep boot
alias REboot='cd; history -w; swapoff -a; umount -a; systemctl reboot '
alias Reboot='cd; history -w; swapoff -a; umount -a; systemctl reboot '
#

How your CIFS shares are mounted to start with?

I added them to /etc/fstab.

Then show your /etc/fstab. Also, reboot without unmounting CIFS mount points first and after reboot as root provide the full output of

journalctl -b -1 --full --no-pager

upload to https://paste.opensuse.org/

So I think I uploaded it there, only because you asked. If I may, what’s the benefit of using this as opposed to including it in-line like below? I’ve not used paste.opensuse.org before so hope it works well

https://paste.opensuse.org/pastes/bb9d60b46269

The relevant bits are copied below:

//192.168.1.97/Media                       /volume1/Media          cifs   credentials=/home/jbeck/.credentials,_netdev,noauto,x-systemd.automount,iocharset=utf8,file_mode=0777,dir_mode=0777,vers=3.0  0  0
//192.168.1.97/homes/jbeck                 /volume1/home           cifs   credentials=/home/jbeck/.credentials,_netdev,noauto,x-systemd.automount,iocharset=utf8,file_mode=0777,dir_mode=0777,vers=3.0  0  0
//192.168.1.97/photo                       /volume1/photo          cifs   credentials=/home/jbeck/.credentials,_netdev,noauto,x-systemd.automount,iocharset=utf8,file_mode=0777,dir_mode=0777,vers=3.0  0  0
//192.168.1.95/jbeck                       /volume1/praetorian     cifs   credentials=/home/jbeck/.credentials,_netdev,noauto,x-systemd.automount,iocharset=utf8,file_mode=0777,dir_mode=0777,vers=3.0  0  0
//192.168.1.98/Data-01                     /volume1/hp-z6-g4       cifs   credentials=/home/jbeck/.credentials,_netdev,noauto,x-systemd.automount,iocharset=utf8,file_mode=0777,dir_mode=0777,vers=3.0  0  0

Sorry I’m in bed took a look on my phone and realized I didn’t give you the journalctl output. I’ll do that tomorrow sorry.

Because it is long and likely will exceed allowed post size.

And you never even mentioned it.
Provide the full output of

systemctl show volume-Media.mount

after /volume/Media has been mounted. If you have issues only with some mount points, provide this output for them.

Okay… As to the x-systemd.automount, your comment makes it seem like I’m omitting something important. If I am, I am unaware. Originally I didn’t use systemd to mount these volumes (I was using //192.168.1.97/Media /volume1/Media cifs credentials=/home/jbeck/.credentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0 in my /etc/fstab). Unfortunately with this method the mounts would not happen on startup unless I ran a mount -a after logging in. So, after some googling around I tried the systemd mount and sure enough it waited for the network to make the mount and they just work, . So, that’s why I use systemd. I do document everything I do so I can go back and check other stuff I tried probably if necessary but ultimately I didn’t want to have to type mount -a every time I log in.

NOW FOR THE DATA:

Results of journalctl -b -1 --full --no-pager after rebooting WITHOUT unmounting the shares first:
https://paste.opensuse.org/pastes/c002ea69e6fe
(I now see why we use paste, because this is a large, large output)

The relevant pause (I believe) is between 10:11:45 and 10:13:14. It’s in color in the terminal but the color didn’t copy through in the paste but that should help you find it, you see there the unmount times out so that is why I believed the pause is directly related to a failed unmount.

Here’s the results of systemctl show volume-Media.mount:
https://paste.opensuse.org/pastes/b86096f15b88

Sorry, it should have been volume1-Media.mount. But it is not need anymore.

Nov 28 10:11:42 suse-dd systemd-logind[1230]: System is rebooting.
Nov 28 10:11:42 suse-dd systemd[1]: Stopping Session 3 of User jbeck...
...
Nov 28 10:11:44 suse-dd systemd[1811]: Reached target Exit the Session.
Nov 28 10:11:44 suse-dd systemd[1]: user@1000.service: Killing process 4630 (dbus-launch.x11) with signal SIGKILL.
Nov 28 10:11:44 suse-dd NetworkManager[1403]: <info>  [1732806704.7899] device (wlo1): state change: activated -> deactivating (reason 'connection-removed', managed-type: 'full')
Nov 28 10:11:44 suse-dd NetworkManager[1403]: <info>  [1732806704.7901] manager: NetworkManager state is now DISCONNECTING
...
Nov 28 10:11:44 suse-dd systemd[1]: Unmounting /volume1/Media...
Nov 28 10:11:44 suse-dd systemd[1]: Unmounting /volume1/home...
...
Nov 28 10:11:44 suse-dd NetworkManager[1403]: <info>  [1732806704.9966] device (wlo1): supplicant interface state: completed -> disconnected
Nov 28 10:11:44 suse-dd NetworkManager[1403]: <info>  [1732806704.9968] device (wlo1): state change: deactivating -> disconnected (reason 'connection-removed', managed-type: 'full')
Nov 28 10:11:45 suse-dd NetworkManager[1403]: <info>  [1732806705.1303] manager: NetworkManager state is now DISCONNECTED
...
Nov 28 10:13:14 suse-dd systemd[1]: volume1-home.mount: Unmounting timed out. Terminating.
Nov 28 10:13:14 suse-dd kernel: CIFS: VFS: \\192.168.1.97 __cifs_put_smb_ses: Session Logoff failure rc=-512

You configured your network connections as user connections. It means that as soon as your session stops, NetworkManager disconnects interface because it no more has connection definition (and even if it had, it no more has the secret for your access point). This also explains why

Network is not up until you log in.

If you want to mount network resources during boot, you need to configure connections as system, so they are started early. And you need to store the WiFi password system wide, not in your user’s kwallet.

By itself it is not enough - NetworkManager configures interfaces asynchronously and if something needs network during boot you need to explicitly configure your system to wait until network is up (for some definition of “up” at least). In practice, it means enabling NetworkManager-wait-online.service. But read comments in this unit file, as the precise effect also depends on your NetworkManager configuration.

I’m guessing this is a WiFi specific thing? I have other wired tumbleweed systems that have network access even without logging in (I use them as servers and just ssh in as needed).

I appreciate the explanation and will take a look at the comments to see if I can figure out how to convert it over to system connection.

So tell me: What is your opinion on how to do this? I’m okay with it being user or system as long as there isn’t a compelling reason that one is somehow inferior. Ideally whatever way I use will be low maintenance. It does just work and with the “workaround” if unmounting before logging out it works.

Anyway thanks for the education.

No. It is just that users almost never (need to) configure wired connections so they remain on default auto-generated systemd-wide connections, while with WiFi you are forced to define connection to store password. And KDE defaults to per-user connection.

Check All users may connect to this network in KDE connection properties.