Installing 18.04 when systemd-udevd consumes 100% of CPU

installation
system

#1

This installation has a lot of problems caused by a kernel bug in 4.14+, the cpu will race to 100% in a couple of minutes making it impossible to install. ( see https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1759836 )

To work around this i made a short howto

#Open Terminal
After booting up the iso I had to open a terminal (ctrl-alt-t)

$ sudo su
$ systemctl disable systemd-udevd.service
$ systemctl disable systemd-udevd-control.socket
$ systemctl disable systemd-udevd-kernel.socket
$ systemctl stop systemd-udevd.service
$ systemctl stop systemd-udevd-control.socket
$ systemctl stop systemd-udevd-kernel.socket
$ killall systemd-udevd
$ killall systemd-udevd-control.socket
$ killall systemd-udevd-kernel.socket

then run top and make sure system-udevd is not running

$ top

After this you follow the installer.

#First boot
When you boot into mate quickly open a terminal (ctrl+alt+t)

$ sudo su
$ systemctl disable systemd-udevd.service
$ systemctl disable systemd-udevd-control.socket
$ systemctl disable systemd-udevd-kernel.socket
$ systemctl stop systemd-udevd.service
$ systemctl stop systemd-udevd-control.socket
$ systemctl stop systemd-udevd-kernel.socket
$ killall systemd-udevd
$ killall systemd-udevd-control.socket
$ killall systemd-udevd-kernel.socket

#Install older kernel
Then download the 4.13 kernel from: http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13/

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13/linux-headers-4.13.0-041300_4.13.0-041300.201709031731_all.deb
$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13/linux-headers-4.13.0-041300-generic_4.13.0-041300.201709031731_amd64.deb
$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13/linux-image-4.13.0-041300-generic_4.13.0-041300.201709031731_amd64.deb
$ sudo dpkg -i *.deb

#Remove all 4.15 kernels
$ dpkg --list|grep linux-.*4.15.0-|awk '{print $2}'|xargs sudo dpkg -P

#Reboot
$ reboot

Enjoy, comment if you find more problems. I’m still fighting a couple


So many kernel, how to remove most of them?
#2

@karnemelk Hi, would you kindly edit your post and highlight the commands as codes(preformatted text)?
Just select what you want to format and click on the “preformatted text” icon, or just press Ctrl+Shift+C.


#3

I already noticed backticks not working so i had to change to $(), this makes it much easier, thanks.


#4

Since I upgrade my Ubuntu 16.04 into 18.04, systemd-udevd consume 100% CPU and I tried to solved according your assistance. It fail. I tried twice but still fail. Now every time I start up Ubuntu, I must kill systemd-udevd manually.

What should I do? Roll back into 16.04 or waiting new update?


#5

Installing the older kernel has solved all problems in many cases.
Post the output of the following command please ?

uname -a


#6

EDIT: Forgot the single quotes around EOF :blush: tested and it works for me.

So, i created a service, its untested i dont have the time right now.
If you execute these it should create a service and enable it for those still on 4.15 and hopefully fix this for the time being.

cat <<'EOF'>bugfix-1759836.service
[Unit]
Description=Fix for https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1759836

[Service]
Type=oneshot
ExecStart=/bin/bash -c "services='systemd-udevd systemd-udevd-kernel.socket systemd-udevd-control.socket';systemctl stop $services;systemctl start $services"

[Install]
WantedBy=multi-user.target
EOF

sudo cp bugfix-1759836.service /etc/systemd/system
sudo systemctl enable bugfix-1759836.service

#7

I also had this problem upgrading from 16.04 to 18.04 on a vostro 3700 laptop. It worked OK on a desktop but not on the vostro.
A bit of searching on the net found this to be a fairly common problem going back to at least 14.04 versions of Ubuntu but not limited to.

My question is, how safe is writing your own unit file? What kind of effect will it have on your system in the long term? Having said that it looks like you have just written something to recreate the udev socket (which would explain why just restarting the service would not work, systemd-udevd respwans with a different pid).

As a makeshift solution I rebooted to the old kernel and amended the /etc/default/grub file to boot from the previously booted kernel:

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

the second line needs to be added. You need to shutdown completely after the amendment for it to work and it will ignor future kernel upgrades although it will install new kernels, you will need to boot to them manually, if you dare!


#8

My question is, how safe is writing your own unit file?

I don’t see any problems, you could add this to /etc/profile but it would be harder to manage (disable/enable/troubleshooting). Now you can just disable the service when they fix it upstream.

Having said that it looks like you have just written something…

This unit file just stops and start the systemd-udevd* services.

As a makeshift solution I rebooted to the old kernel …

I just removed all older 4.15 kernels so it would default to the 4.13, no need to do anything after that. But like icecream pick whatever you want.

I test this with 4.19 mainline and i saw no problems after that.