{"id":304,"date":"2020-09-01T15:06:04","date_gmt":"2020-09-01T23:06:04","guid":{"rendered":"http:\/\/nramkumar.org\/tech\/?p=304"},"modified":"2020-09-01T15:06:04","modified_gmt":"2020-09-01T23:06:04","slug":"fixing-slow-shutdown-in-linux-from-cifs-smb-mounts-over-wifi","status":"publish","type":"post","link":"https:\/\/nramkumar.org\/tech\/blog\/2020\/09\/01\/fixing-slow-shutdown-in-linux-from-cifs-smb-mounts-over-wifi\/","title":{"rendered":"Fixing slow shutdown in Linux from CIFS\/SMB mounts over WiFi"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">After a pleasant year of using Manjaro Linux on my laptop at home, I started seeing problems with SMB mounts. My setup is that I have all of the main storage on my home server which is shared through SMB shares and these shares are mounted on the laptop through <a href=\"https:\/\/kde.org\/applications\/en\/utilities\/org.kde.smb4k\">SMB4k<\/a>. SMB4k started doing strange things (mounting it with the wrong user id, hanging after suspend\/resume etc.) after the latest round of package updates. Instead of trying to fix that, I decided to move to <a href=\"https:\/\/help.ubuntu.com\/community\/Autofs\">autofs<\/a> as my solution for mounting the SMB shares. The setup for using autofs is somewhat involved but I got it setup so I was able to mount my shares and use them normally. However, one problem I noticed was that shutdown of the laptop became slow &#8211; reading through the logs, I saw that the issue was that the WiFi network was getting shutdown during the shutdown of autofs causing a three minute timeout and eventual force terminate of autofs during shutdown. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Even though the <a href=\"https:\/\/help.ubuntu.com\/community\/Autofs\">systemd<\/a> configurations and dependencies were right, this problem seemed to persist &#8211; eventually I figured out a simple and correct solution to the problem. The issue seems to be that the WiFi connection is marked for use only for my user in <a href=\"https:\/\/wiki.archlinux.org\/index.php\/NetworkManager\">NetworkManager<\/a> &#8211; so during shutdown, the logout for the user immediately shuts down the WiFi connection. The easy way to correct this is to do the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Find your WiFi connection UUID\nnmcli connection show \n# Check connection.permissions. Check if it says user:&lt;username>\nnmcli connection show &lt;UUID of WiFi Connection>\n# If you saw user:&lt;username>, this is your problem. Fix it with this command\nnmcli connection modify &lt;UUID> connection.permissions \"\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Alternately, on KDE Plasma, you can go to System Settings > Connections > Your WiFi Network > General Configuration and select the &#8220;All users may connect to this network&#8221; option. This prevents the desktop from incorrectly yanking the connection out with user logout and prevents the extended delay during shutdown. I will write a follow-up post on using autofs for a stable way of mounting, unmounting and handling suspend\/sleep\/resume on a Linux laptop with SMB shares.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After a pleasant year of using Manjaro Linux on my laptop at home, I started seeing problems with SMB mounts. My setup is that I have all of the main storage on my home server which is shared through SMB shares and these shares are mounted on the laptop through SMB4k. SMB4k started doing strange&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,44],"tags":[],"class_list":["post-304","post","type-post","status-publish","format-standard","hentry","category-linux","category-smb"],"_links":{"self":[{"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/posts\/304","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/comments?post=304"}],"version-history":[{"count":1,"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/posts\/304\/revisions"}],"predecessor-version":[{"id":305,"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/posts\/304\/revisions\/305"}],"wp:attachment":[{"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/media?parent=304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/categories?post=304"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nramkumar.org\/tech\/wp-json\/wp\/v2\/tags?post=304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}