Solve slow shutdown with cifs mount in fstab on wireless connection

Post your tutorials and howtos here.
User avatar
Arjen Balfoort
Site Admin
Posts: 8860
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Solve slow shutdown with cifs mount in fstab on wireless connection

Postby Arjen Balfoort » 29 Jun 2016 20:52

For a long time now I have a cifs mount in my fstab. With a wired connection there is no problem. However, in my house everything goes wireless if possible (too many cables already) and that gives a shutdown problem with my cifs mount. I've learned to live with it: I shutdown my system and go get myself a cup of tea and when I come back my system is usually shut down. The time out occurs in 90 seconds. This is caused by NetworkManager closing the wireless connection before the cifs mount was unmounted. The unmount is then unsuccessful because it cannot find a network.

[Edit: 23-2-2018]
There doesn't seem to be a clean and neat solution but I found a workaround that seems to function good enough. I will implement this in the solydxk-system package as well (currently in testing).

Create a systemd service:

Code: Select all

sudo nano /lib/systemd/system/solydxk-cifs-umount.service
and paste the following:

Code: Select all

[Unit]
 Description=Umount cifs mounts at shutdown

[Service]
 RemainAfterExit=true
 ExecStart=/bin/true
 ExecStop=/bin/umount -alf -t cifs

[Install]
 WantedBy=multi-user.target
Run these commands and you're done:

Code: Select all

sudo systemctl enable solydxk-cifs-umount.service
sudo systemctl daemon-reload
Below is the original solution which worked well in Jessie but didn't in Stretch.

I don't remember where I found the workaround but this worked for me:
  • Create this directory:

    Code: Select all

    sudo mkdir /etc/systemd/system/wpa_supplicant.service.d
  • Create an override file with the following content:

    Code: Select all

    sudo nano /etc/systemd/system/wpa_supplicant.service.d/override.conf

    Code: Select all

    [Unit]
    After=dbus.service
    Before=network.target
    Wants=network.target


SolydXK needs you!
Development | Testing | Translations

kurotsugi
Posts: 2116
Joined: 09 Jan 2014 00:17

Re: Solve slow shutdown with cifs mount in fstab on wireless connection

Postby kurotsugi » 29 Jun 2016 20:57

this one is interesting

User avatar
Arjen Balfoort
Site Admin
Posts: 8860
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: Solve slow shutdown with cifs mount in fstab on wireless connection

Postby Arjen Balfoort » 30 Jun 2016 06:50

I'll keep on using this workaround for a while (main system and laptop) and see how it behaves and if it does, we might consider adding it to the default SolydXK configuration (solydxk-system).


SolydXK needs you!
Development | Testing | Translations

User avatar
palimmo
Posts: 764
Joined: 19 Nov 2013 19:44
Contact:

Re: Solve slow shutdown with cifs mount in fstab on wireless connection

Postby palimmo » 30 Jun 2016 08:13

Proud user of SolydK!

Dai diamanti non nasce niente, dal letame nascono i fior. http://aquilone.wordpress.com/

kurotsugi
Posts: 2116
Joined: 09 Jan 2014 00:17

Re: Solve slow shutdown with cifs mount in fstab on wireless connection

Postby kurotsugi » 30 Jun 2016 09:18

similar issue but different cause. this one happened because systemd wait volume manager to unmount the partition but it can't because the network is already dies. the hack tell systemd to not kill networkmanager before the partition successfully unmounted.

OTOH we don't know what systemd was waiting on your case. if you're using a partition over a network then the cause of the problem would be similar.

User avatar
Arjen Balfoort
Site Admin
Posts: 8860
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: Solve slow shutdown with cifs mount in fstab on wireless connection

Postby Arjen Balfoort » 01 Jul 2016 11:31

I have added the file to solydxk-system.
Let's see if we get complaints :mrgreen:


SolydXK needs you!
Development | Testing | Translations

User avatar
bas_otten
Posts: 203
Joined: 19 Oct 2013 12:22
Location: Netherlands

Re: Solve slow shutdown with cifs mount in fstab on wireless connection

Postby bas_otten » 20 Jul 2016 09:16

No complaints, on the contrary: it works :!:

SolydForEver
Posts: 339
Joined: 13 Oct 2014 05:25
Location: East part of The Netherlands

Re: Solve slow shutdown with cifs mount in fstab on wireless connection

Postby SolydForEver » 20 Jul 2016 18:43

It is not THE solution although it could be a solution: try automount.
I did that some years ago because I noticed Dolphin was hanging when "the other side" was switched off and I had a cifs connection in fstab.
Now, only when I actually use the connection is it alive and 10 seconds after I don't need it anymore the connection is gone. No more hanging, no more waiting.
It is something I really started to love and I wonder why so few people use it. You seldom hear about it.

No idea why it takes longer on wifi then on a wired network though. All I say is when the connection is not there it can't slow you down.

User avatar
Zill
Posts: 1850
Joined: 13 Aug 2013 14:28
Location: Lincolnshire, UK

Re: Solve slow shutdown with cifs mount in fstab on wireless connection

Postby Zill » 20 Jul 2016 19:04

SolydForEver wrote:It is not THE solution although it could be a solution: try automount...
+1
I use automount for all my NFS mounts as this is easy to set up and works very reliably. I never go near Windows systems though... ;-)

User avatar
Arjen Balfoort
Site Admin
Posts: 8860
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: Solve slow shutdown with cifs mount in fstab on wireless connection

Postby Arjen Balfoort » 23 Apr 2017 10:38

This issue seems to be back in Stretch and the workaround with /etc/systemd/system/wpa_supplicant.service.d/override.conf does not seem to work anymore.

Can anybody confirm this?


SolydXK needs you!
Development | Testing | Translations

User avatar
Arjen Balfoort
Site Admin
Posts: 8860
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: Solve slow shutdown with cifs mount in fstab on wireless connection

Postby Arjen Balfoort » 23 Feb 2018 11:33

I've updated the OP with a workaround for Stretch (and should work for other versions as well).


SolydXK needs you!
Development | Testing | Translations


Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 2 guests