{"id":1599,"date":"2020-05-30T13:12:24","date_gmt":"2020-05-30T18:12:24","guid":{"rendered":"http:\/\/www.familytidings.com\/blog\/?p=1599"},"modified":"2023-01-29T12:22:46","modified_gmt":"2023-01-29T17:22:46","slug":"ubuntu-18-delay-before-login-screen-after-resume","status":"publish","type":"post","link":"https:\/\/www.familytidings.com\/blog\/?p=1599","title":{"rendered":"Ubuntu 18 delay before login screen after resume"},"content":{"rendered":"<p>After upgrading my laptop to Ubuntu 18 (or was it 16?), after a suspend\/resume, the lock screen would appear promptly, but there was a delay of about a minute after hitting Enter before the login prompt appeared. This delay was due to CIFS mounts being restored. In prior versions of Ubuntu, the mounts would sometimes be restored and sometimes not, but it didn&#8217;t wait for that before the login screen. With Ubuntu 18, it waits for the mounts before the login screen appears.\u00a0 While it&#8217;s nice to be sure the mounts are always restored, the delay is a sub-optimal user experience.\u00a0 The solution is to use autofs, which only mounts file systems when they are accessed.\u00a0 Here&#8217;s how that is done on my Thinkpad T560 with CIFS (Samba) mounts to a Synology DS411+II.<\/p>\r\n<p>Install autofs and cifs-utils.\r\n<p>After installing autofs, unmount the mounts in <code>\/etc\/fstab<\/code> that you want to have managed by autofs.\u00a0 Then edit <code>\/etc\/fstab<\/code> and comment them out.\u00a0 Edit <code>\/etc\/auto.master<\/code> and add an entry for each directory that will contain mounts.\u00a0 For example, to add mounts in <code>\/mnt<\/code>:<\/p>\r\n<blockquote>\r\n<pre>\/mnt \/etc\/auto.mnt<\/pre>\r\n<\/blockquote>\r\n<p>Keep in mind the contents of the directory being managed by autofs (<code>\/mnt<\/code> in this example) will not be accessible once autofs makes mounts there.\u00a0 The directory contents will not be deleted, you just won&#8217;t see them again until the mount is removed.<\/p>\r\n<p>Create the mount configuration for each mounted directory.\u00a0 In our example above that would be <code>\/etc\/auto.mnt<\/code>:<\/p>\r\n<blockquote>\r\n<pre>ds411p2-public-music -fstype=cifs,vers=1.0,rw,suid,gid=ds411p2,credentials=\/etc\/ds411p2pwd :\/\/ds411p2.local\/music<\/pre>\r\n<\/blockquote>\r\n<p>The format of this file is similar to <code>\/etc\/fstab<\/code> but not the same.\u00a0 For comparison, here&#8217;s that entry as it was in <code>\/etc\/fstab<\/code>:<\/p>\r\n<blockquote>\r\n<pre>\/\/ds411p2.local\/music \/mnt\/ds411p2-public-music cifs vers=1.0,rw,suid,gid=ds411p2,credentials=\/etc\/ds411p2pwd 0 0<\/pre>\r\n<\/blockquote>\r\n\r\n\r\n<p>So to create the entry in <code>\/etc\/auto.mnt<\/code> from <code>\/etc\/fstab<\/code>:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\"><li>The first field, the mountpoint, is the second field from <code>\/etc\/fstab<\/code>, but change it from an absolute path to one relative to the mount directory specified in <code>\/etc\/auto.master<\/code>.<\/li><li>The second field is a combination of fstab&#8217;s third and fourth fields, the file system type and mount options, except file system type is prefixed with <code>-fstype=<\/code>.  The other mount options follow, separated by commas, the same as in <code>fstab<\/code>.<\/li><li>The third field, the server directory, is the same as first field in fstab except it&#8217;s prefixed with <code>:<\/code>.<\/li><li>The last two fields from fstab (dump and fsck options) aren&#8217;t used. <\/li><\/ul>\r\n","protected":false},"excerpt":{"rendered":"<p>After upgrading my laptop to Ubuntu 18 (or was it 16?), after a suspend\/resume, the lock screen would appear promptly, but there was a delay of about a minute after hitting Enter before the login prompt appeared. This delay was due to CIFS mounts being restored. In prior versions of Ubuntu, the mounts would sometimes [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1599","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1599"}],"version-history":[{"count":5,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1599\/revisions"}],"predecessor-version":[{"id":1661,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1599\/revisions\/1661"}],"wp:attachment":[{"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.familytidings.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}