Public bug reported:

Xfer: https://github.com/GoogleCloudPlatform/compute-image-
packages/issues/783

I initially reported the bug there, but it appears the file is owned by
you guys?

I see this bug in Google Cloud images of 18.04 in
--image=ubuntu-1804-bionic-v20190514 --image-project=gce-uefi-images.

What happens is, the image contains the file
/lib/udev/rules.d/99-gce.rules with the following rule:

# Switch to using NOOP as the default scheduler per GCE request
SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_VENDOR}=="*Google*", 
ATTR{queue/scheduler}="noop"

The rule matches both devices (/sda) and partitions (/sda1), but the
scheduler is a device property and does not apply to partition. These
lines are logged multiple times during the first boot of the image, when
the partition and the filesystem is grown, and once on every subsequent
boot, once per every partition:

    Jun  3 04:46:49 toy-sec-1 systemd-udevd[1442]: error opening 
ATTR{/sys/devices/pci0000:00/0000:00:03.0/virtio0/host0/target0:0:1/0:0:1:0/block/sda/sda1/queue/scheduler}
 for writing: No such file or directory
    Jun  3 04:46:49 toy-sec-1 systemd-udevd[1438]: error opening 
ATTR{/sys/devices/pci0000:00/0000:00:03.0/virtio0/host0/target0:0:1/0:0:1:0/block/sda/sda15/queue/scheduler}
 for writing: No such file or directory
    Jun  3 04:46:49 toy-sec-1 systemd-udevd[1437]: error opening 
ATTR{/sys/devices/pci0000:00/0000:00:03.0/virtio0/host0/target0:0:1/0:0:1:0/block/sda/sda14/queue/scheduler}
 for writing: No such file or directory

To repro, no GCE necessary; you can boot any VM with the guest using the
virtio driver, drop in this file, and run e. g. parted, or any program
opening the raw device, as it triggers kernel uevents. Start parted, and
the messages are logged. Quit parted, and they are logged again.

This issue is harmless, but when you ingest logs, you'd rather have them
as error-level message free as possible.

I can think of 3 ways to solve this issue:

1. Make the rule not match partitions. I drop-replace this file in all
my images with the following:

    SUBSYSTEM=="block", ENV{DEVTYPE}!="partition", ACTION=="add|change",
ENV{ID_VENDOR}=="*Google*", ATTR{queue/scheduler}="noop"

2. Since Ubuntu is providing GCE images, kernel command line option
'elevator=none' sets the I/O scheduler to all applicable devices by
default; no udev integration necessary. The default is not locked, so if
anyone needs to change it (e. g. for a physical disk directly attached
to a VM, not a GCE setup but in a local VM it's possible), they can
select a different elevator strategy with udev rules. This is the
setting widely recommended by other Linux-based system, e. g. there is a
RHEL support page recommending that. It obviously a better choice shift
the I/O elevation job to the host, as it handles requests from all
guests, and can prioritize I/O much better, as it has all consolidated
information available at any moment for the physical device actually
doing the block I/O.

3. Since these GCE images come with a special kernel build (it has a
'-gcp' version suffix), the default of none can be simply selected at
compile time. It also make sense to compile in virtio into the kernel;
as it is, the device is probed from initramfs. Since all VM boot drives
are virtio, it is probably a sensible choice to have it compiled-in;
definitely so for the GCP-specific kernel build.

Thanks, you'll probably know better than me which of these (or maybe
other options I could not think of right now), as you probably
understand all the implications I'm likely unaware of, so I'm just
sharing my thoughts on this issue, not preferring any of these.

I did not check other images available from the same GCE project, but
I'm sure if the rule is there, the result will be identical--it's a
kernel thing, and partitions do not have I/O schedulers by design.

** Affects: gce-compute-image-packages (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1833660

Title:
  /lib/udev/rules.d/99-gce.rules tries to apply 'scheduler=none' to
  partitions

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gce-compute-image-packages/+bug/1833660/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to