DEV Community

Bob Nadler
Bob Nadler

Posted on

Ubuntu 18.04 Upgrade Problem Resolutions

Original post: Ubuntu 18.04 Upgrade Problem Resolutions

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:

  1. "Login Loop": After a valid authentication on the login screen, the display goes black momentarily, and then returns you to the login screen.
  2. systemd-udevd CPU usage: On my system, it consumed about 20% of the CPU. I've read that it can be much higher on other systems (like 100%).

The Upgrade

Simple: From Software & Updates on the Updates tab, select 'For any new version':

After the next update, the Software Updater will offer the 18.04 upgrade option.

Just click on the Upgrade... button and follow the instructions from there.

Login Loop

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:

$ sudo apt-get purge gdm*
$ sudo apt-get purge lightdm
$ sudo apt-get install lightdm
$ sudo apt-get install nvidia-352
Just removing gdm and re-installing lightdm 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.

systemd-udevd CPU Usage

Now that you can login to your desktop, you may notice high CPU usage. If top or htop show that systemd-udevd is the culprit, confirm that UDEV events are being generated with udevadm. For me the output looked like this:
$ 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)

This can be resolved by stopping the systemd-udevd service:

$ sudo systemctl stop systemd-udevd systemd-udevd-control.socket systemd-udevd-kernel.socket

The CPU usage will drop and udevadm stops reporting events.

If needed, the systemd-udevd service can be started again:

$ sudo systemctl start systemd-udevd systemd-udevd-control.socket systemd-udevd-kernel.socket

I found that the CPU issue did not re-appear after the service was restarted.

Startup Changes

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 systemctl command as root without having to enter a password.

Create a script and set the correct permissions as follows:

$ echo 'systemctl stop systemd-udevd systemd-udevd-control.socket systemd-udevd-kernel.socket' >
$ sudo chown root.root
$ sudo chmod 4755

Next, run:

$ sudo visudo

and add the following line at the bottom (this is important) of the /etc/sudoers file.

bob ALL=(root) NOPASSWD: /home/bob/

Of course, change bob and /home/bob as needed.

Now you should be able to run

$ sudo ./

without being prompted for a password.

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

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

Hope this helps. Enjoy!

Top comments (14)

tux0r profile image

The need to work around a feature of systemd might make you want to switch to a non-systemd distro - doesn't it?

slavius profile image

Yes, it may get into your way sometimes but as a long-term Gentoo user you will manage. I'm running Sabayon with mixed emerged packages for over 2 years now without major problems. I still do 'equo update; equo upgrade' - with Sabayon's package manager and emerge packages I need USE flags control; or -9999 versions from git; or are not part of Sabayon's repo - either from layman's repos or just by downloading/creating custom overlay.

Thread Thread
tux0r profile image

How hard is it to get a package into Sabayon's repo? I have been waiting for months that Gentoo accepts one of mine, and I might consider suggesting it to Sabayon instead. (Do they accept ebuilds?)

Thread Thread
slavius profile image

Not sure, never tried that. But basicaly it seems to be one-man-show as far as I understood it.
Sabayon is not definitely flexible but I found it the best alternative to not have to compile everything by being able to pull binary packages from their repos while still be able to integrate my own compiled apps into existing system with full control I'm used to in Gentoo/Funtoo.

Pretty much works well on my old laptop. If I had a 4c8t cpu and SSD I would go for Gentoo/Funtoo instead and compile on my own (I have no discc either).

thangnguyennhu profile image
Thang Nguyen

Login loop has been fixed in Ubuntu 18.04.1.

tux0r profile image


slavius profile image

Gentoo, Funtoo, Sabayon?

My favorites...

Thread Thread
tux0r profile image
tux0r • Edited

I own a Gentoo laptop, but I really don't think Ubuntu users should dive into Gentoo over night ... :-)

Also, Gentoo supports systemd officially (at least as a choice). But at least you have the chance to install the (quite acceptable) OpenRC instead.

Thread Thread
slavius profile image

Let's try Sabayon. Gentoo based with binary packages.

You still have portage available and you can emerge (compile - note for others) packages into the system (they share the same database).

Thread Thread
tux0r profile image

Emerge does much more than just compile (it involves checking the changelog, patching the sources, respecting the USE flags etc.), but you are generally right.

Sabayon's binary packages sacrifice Gentoo's "selling point" of being a flexible "meta distribution" though, and it was reported that there are more disadvantages in daily usage. I haven't tried Sabayon, I went right from Void to Gentoo because of that.

At least Gentoo has official binary packages for the most annoying ports, i.e. LibreOffice and Firefox.

pmcgowan profile image

I had the login loop on 16.04 intermittently, always after upgrading nvidia drivers. I spent days on different occasions searchong for the answer. No issues on 18.04 though - wish I saw this then!

sh3artanis profile image

It works! I just tried the installation of nvodia-352, then the loop login issue was immediately fixed!