Ubuntu 18.04 Upgrade Problem Resolutions
Tags: ubuntu, linux, howto
Published: 2018-08-18 21:45:57

---
title: Ubuntu 18.04 Upgrade Problem Resolutions
published: true
description: Tips on upgrading a Lenovo X1 Carbon from Ubuntu 16.04 to 18.04.
tags: ubuntu,linux,howto
---

Original post: <a href="https://bobonmedicaldevicesoftware.com/blog/2018/08/04/ubuntu-18-04-upgrade-problem-resolutions/">Ubuntu 18.04 Upgrade Problem Resolutions</a>

<a href="https://www.ubuntu.com" target="_blank" rel="noopener"><img class="alignright wp-image-852 size-thumbnail" src="https://bobonmedicaldevicesoftware.com/blog/wp-content/uploads/2018/08/ubuntu-150x150.png" alt="" width="150" height="150" /></a>I recently upgraded my 3-year-old Lenovo X1 Carbon from Ubuntu 16.04 TLS to 18.04 LTS. I think I ran into the two most common upgrade issues, and since both of them are show-stoppers, I thought it would be worth sharing the resolutions that worked for me.

Here are the two problems:
<ol>
 	<li><strong>"Login Loop"</strong>: After a valid authentication on the login screen, the display goes black momentarily, and then returns you to the login screen.</li>
 	<li><strong>systemd-udevd CPU usage</strong>: On my system, it consumed about 20% of the CPU. I've read that it can be much higher on other systems (like 100%).</li>
</ol>
<h3>The Upgrade</h3>
Simple: From <em>Software &amp; Updates</em> on the Updates tab, select 'For any new version':

<img class="aligncenter wp-image-853 " src="https://bobonmedicaldevicesoftware.com/blog/wp-content/uploads/2018/08/anynewversion.png" alt="" width="482" height="39" />

After the next update, the <em>Software Updater</em> will offer the 18.04 upgrade option.

<img class="aligncenter wp-image-855" src="https://bobonmedicaldevicesoftware.com/blog/wp-content/uploads/2018/08/upgradeto1804.png" alt="" width="357" height="106" />

Just click on the <code>Upgrade...</code> button and follow the instructions from there.
<h3>Login Loop</h3>
After the upgrade is complete, this problem will prevent you from logging in to a Gnome desktop. Use Alt-Ctrl-F2 to drop to a terminal and login. Execute the following:
<pre class="lang:sh mark:4 decode:true">$ sudo apt-get purge gdm*
$ sudo apt-get purge lightdm
$ sudo apt-get install lightdm
$ sudo apt-get install nvidia-352</pre>
Just removing <code>gdm</code> and re-installing <code>lightdm</code> was not sufficient to resolve this issue for me. Installation of the Nvidia driver (line 4) was the key. Later versions than nvidia-352 (like nvidia-384) will also probably work.
<h3>systemd-udevd CPU Usage</h3>
Now that you can login to your desktop, you may notice high CPU usage. If <code>top</code> or <code>htop</code> show that systemd-udevd is the culprit, confirm that UDEV events are being generated with <code>udevadm</code>. For me the output looked like this:
<pre class="lang:sh decode:true">$ udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[33.704228] add      /module/nvidia (module)
KERNEL[33.704784] add      /kernel/slab/:0012288 (slab)
KERNEL[33.705062] remove   /kernel/slab/:0012288 (slab)
UDEV  [33.705332] add      /kernel/slab/:0012288 (slab)
UDEV  [33.705659] remove   /kernel/slab/:0012288 (slab)
KERNEL[33.724214] remove   /module/nvidia (module)
KERNEL[33.755768] add      /module/nvidia (module)
KERNEL[33.756482] add      /kernel/slab/:0012288 (slab)
KERNEL[33.756764] remove   /kernel/slab/:0012288 (slab)
UDEV  [33.757642] add      /kernel/slab/:0012288 (slab)
UDEV  [33.757981] remove   /kernel/slab/:0012288 (slab)
KERNEL[33.772269] remove   /module/nvidia (module)
UDEV  [33.792191] add      /module/nvidia (module)
UDEV  [33.807097] remove   /module/nvidia (module)
KERNEL[33.830290] add      /module/nvidia (module)
...
</pre>
This can be resolved by stopping the systemd-udevd service:
<pre class="lang:sh decode:true">$ sudo systemctl stop systemd-udevd systemd-udevd-control.socket systemd-udevd-kernel.socket</pre>
The CPU usage will drop and <code>udevadm</code> stops reporting events.

If needed, the systemd-udevd service can be started again:
<pre class="lang:sh decode:true">$ sudo systemctl start systemd-udevd systemd-udevd-control.socket systemd-udevd-kernel.socket</pre>
I found that the CPU issue did <strong>not</strong> re-appear after the service was restarted.
<h4>Startup Changes</h4>
This is great, but you don't want to have to manually run a command every time you log into your system. Here is how to execute this command automatically at startup.

First, you need to be able to execute the <code>systemctl</code> command as root without having to enter a password.

Create a script and set the correct permissions as follows:
<pre class="lang:sh decode:true ">$ echo 'systemctl stop systemd-udevd systemd-udevd-control.socket systemd-udevd-kernel.socket' &gt; stop_systemd_udevd.sh
$ sudo chown root.root stop_systemd_udevd.sh
$ sudo chmod 4755 stop_systemd_udevd.sh</pre>
Next, run:
<pre class="lang:sh decode:true ">$ sudo visudo</pre>
and add the following line <strong>at the bottom</strong> (this is important) of the <code>/etc/sudoers</code> file.
<pre class="lang:default decode:true">bob ALL=(root) NOPASSWD: /home/bob/stop_systemd_udevd.sh</pre>
Of course, change bob and /home/bob as needed.

Now you should be able to run
<pre class="lang:default decode:true">$ sudo ./stop_systemd_udevd.sh</pre>
without being prompted for a password.

The last step is to add execution of this script when your system starts up. Use <em>Startup Application Preferences</em> and add the follow (change /home/bob, of course).

<img class="aligncenter wp-image-854" src="https://bobonmedicaldevicesoftware.com/blog/wp-content/uploads/2018/08/startup-application.png" alt="" width="493" height="200" />

That should do it! Reboot your system and the systemd-udevd service should not be running.

Hope this helps. Enjoy!