Opened 17 months ago

Closed 17 months ago

Last modified 6 months ago

#5285 closed enhancement (fixed)

Replace eudev with udev extracted from systemd — at Version 31

Reported by: Douglas R. Reno Owned by: Douglas R. Reno
Priority: normal Milestone: 12.0
Component: Book Version: git
Severity: normal Keywords:
Cc:

Description (last modified by Xi Ruoyao)

This ticket is to convert eudev to systemd-udev. See blfs:#18292 for details - but eudev is using libudev 243. libgudev now needs at least 247 because of using some newer API to properly handle tags.

The goal is to do similar to what was suggested back in #4914. I'll test this system with some libgudev consumers as well to make sure that this doesn't result in any problems.

Work on this will be done in the renodr/libudev-from-systemd branch

Change History (31)

comment:1 by Douglas R. Reno, 17 months ago

Owner: changed from lfs-book to Douglas R. Reno
Status: newassigned

comment:2 by Joe Locash, 17 months ago

This lfs-dev thread from 2 years ago addressed that: https://lists.linuxfromscratch.org/sympa/arc/lfs-dev/2021-08/msg00132.html

comment:3 by Bruce Dubbs, 17 months ago

I just looked at what we are installing now with eudev.

Two files in /sbin: udevadm and udevd
One library: libudev.so.1.6.3
Two headers: libudev.h and udev.h

There are some files in /usr/lib/udev/ that are interesting. There are 11 binary files there like ata_id.

All the other files are .hwdb, rules, manpages, scripts, and other data type files.

comment:4 by Xi Ruoyao, 17 months ago

Summary: Replace eudev with libudev extracted from systemdReplace eudev with udev extracted from systemd

Retitle because udev is not only a library.

comment:5 by Xi Ruoyao, 17 months ago

I made a try in a VM but the boot process hangs starting udevd.

in reply to:  5 comment:6 by Xi Ruoyao, 17 months ago

Replying to Xi Ruoyao:

I made a try in a VM but the boot process hangs starting udevd.

Alright, it's because I've installed udevadm into /usr/bin but LFS bootscript expects it in /sbin.

comment:7 by Xi Ruoyao, 17 months ago

My instruction:

# use systemd tarball
tar xf systemd-253.tar.gz
cd systemd-253

sed -i -e 's/GROUP="render"/GROUP="video"/' \
       -e 's/GROUP="sgx", //' rules.d/50-udev-default.rules.in

# meson
# -Dlink-udev-shared=false is added so we won't need to install libsystemd-shared-253.so
# The other flags are same as systemd
mkdir -p build
cd       build

meson setup \
      --prefix=/usr                 \
      --buildtype=release           \
      -Ddefault-dnssec=no           \
      -Dfirstboot=false             \
      -Dinstall-tests=false         \
      -Dldconfig=false              \
      -Dsysusers=false              \
      -Drpmmacrosdir=no             \
      -Dhomed=false                 \
      -Duserdb=false                \
      -Dman=false                   \
      -Dmode=release                \
      -Dpamconfdir=no               \
      -Ddev-kvm-mode=0660           \
      -Ddocdir=/usr/share/doc/systemd-253 \
      -Dlink-udev-shared=false

# build
ninja udevadm \
      $(grep '^build' build.ninja | sed 's/build \([^:]*\).*/\1/' | grep -E "^src/libudev|^src/udev|^rules.d|^hwdb.d") \
      $(realpath libudev.so --relative-to .)

# install
install -d -vm755 {/usr/lib,/etc}/udev/{hwdb,rules}.d
install -vm755 udevadm /usr/bin
ln -sv ../bin/udevadm /usr/sbin/udevd
install -vm755 libudev.so{,*[0-9]} /usr/lib
install -vm755 $(find src/udev -type f | grep -F -v ".") /usr/lib/udev
install -vm644 src/libudev/*.pc /usr/lib/pkgconfig
install -vm644 src/udev/*.pc /usr/share/pkgconfig
install -vm644 ../src/udev/udev.conf /etc/udev
install -vm644 rules.d/* ../rules.d/{*.rules,README} /usr/lib/udev/rules.d
install -vm644 hwdb.d/* ../hwdb.d/{*.hwdb,README} /usr/lib/udev/hwdb.d

# man pages
tar xf ../../systemd-man-pages-253.tar.xz --strip-components=1 -C /usr/share/man \
    systemd-man-pages-253/{man3/libudev.3,man5/udev.conf.5,man7/{udev,hwdb}.7,man8/{systemd-udevd.service.8,udevadm}.8}
mv /usr/share/man/man8/{systemd-udevd.service,udevd}.8

# configuring: generate /etc/udev/hwdb.bin
udevadm hwdb --update

Note:

  1. udevadm is installed as /usr/bin/udevadm, not /usr/sbin/udevadm. So we need to edit the LFS bootscripts to call /bin/udevadm instead of /sbin/udevadm. I don't think we should really put udevadm into /usr/sbin because actually it can be used as a normal user (at least udevadm settle does not need any privilege).
  2. Tested on a complete LFS system ("overwriting" eudev, and the system has MarkupSafe and Jinja2 installed), but not tested with a build from scratch yet.
Last edited 17 months ago by Xi Ruoyao (previous) (diff)

in reply to:  7 ; comment:8 by Joe Locash, 17 months ago

Replying to Xi Ruoyao:

My instruction:

<snip>

Looks good but you forgot to include usr/include/libudev.h in the install.

in reply to:  8 comment:9 by Xi Ruoyao, 17 months ago

Replying to jlocash:

Replying to Xi Ruoyao:

My instruction:

<snip>

Looks good but you forgot to include usr/include/libudev.h in the install.

Ouch, good catch.

in reply to:  7 comment:10 by Bruce Dubbs, 17 months ago

Replying to Xi Ruoyao:

> # install
> install -d -vm755 {/usr/lib,/etc}/udev/{hwdb,rules}.d
> install -vm755 udevadm /usr/bin
> ln -sv ../bin/udevadm /usr/sbin/udevd
> install -vm755 libudev.so{,*[0-9]} /usr/lib
> install -vm755 $(find src/udev -type f | grep -F -v ".") /usr/lib/udev
> install -vm644 src/libudev/*.pc /usr/lib/pkgconfig
> install -vm644 src/udev/*.pc /usr/share/pkgconfig
> install -vm644 ../src/udev/udev.conf /etc/udev
> install -vm644 rules.d/* ../rules.d/{*.rules,README} /usr/lib/udev/rules.d
> install -vm644 hwdb.d/* ../hwdb.d/{*.hwdb,README} /usr/lib/udev/hwdb.d

I did a manual DESTDIR install into /build/systemd/install/.  I needed to 

mkdir /build/systemd/install/usr/sbin and 
mkdir -p /build/systemd/install/usr/share/pkgconfig

I want to validate the installed files against the current files installed by eudev. I'll report back what I find.

comment:11 by Bruce Dubbs, 17 months ago

Needed mkdir $DEST/usr/bin/
Needed mkdir $DEST/usr/lib/pkgconfig/
install -vm755 udevadm /usr/bin is missing a trailing /.

Currently  
$ ll /usr/sbin/udev*
-rwxr-xr-x 1 root root 364512 Jul 11 11:37 /usr/sbin/udevadm
-rwxr-xr-x 1 root root 348160 Jul 11 11:37 /usr/sbin/udevd

are different files, but above instructions have
/usr/sbin/udevd -> ../bin/udevadm

libudev.so and libudev.so.1 are not symlinks

/usr/lib/udev/rules.d:
60-infiniband.rules     is new
70-power-switch.rules   is new 
70-uaccess.rules        is new
71-seat.rules           is new
73-seat-late.rules      is new
80-net-name-slot.rules  is missing
80-net-setup-link.rules is new
90-vconsole.rules       is new
99-systemd.rules        is new
README                  is new

/usr/lib/udev/collect is missing 

There are no files in /etc/udev/hwdb.d.  They appear to be in /usr/lib/udev/hwdb.d/

60-autosuspend-chromiumos.hwdb is new

/usr/include is missing.

/usr/lib/libudev.la is mission (not a bad thing)




in reply to:  11 ; comment:12 by Xi Ruoyao, 17 months ago

Replying to Bruce Dubbs:

install -vm755 udevadm /usr/bin is missing a trailing /.

Hmm, why a trailing / is necessary here?

Currently  
$ ll /usr/sbin/udev*
-rwxr-xr-x 1 root root 364512 Jul 11 11:37 /usr/sbin/udevadm
-rwxr-xr-x 1 root root 348160 Jul 11 11:37 /usr/sbin/udevd

are different files, but above instructions have
/usr/sbin/udevd -> ../bin/udevadm

In a systemd installation it's a symlink:

$ readlink /usr/lib/systemd/systemd-udevd
../../bin/udevadm
libudev.so and libudev.so.1 are not symlinks

Ah it's wrong. I guess we need to use cp -av instead of install -vm755 here.

/usr/lib/udev/collect is missing 

I can't find this file in the systemd build. What it is for?

There are no files in /etc/udev/hwdb.d. They appear to be in /usr/lib/udev/hwdb.d/

/etc/udev/{hwdb.d,rules.d} are designed to be "system administrator only". So in a fresh installation they should be empty. But lfs-udev installs 3 rules into /etc/udev/hwdb.d and I'm not sure if we should change it to /usr/lib/udev/hwdb.d instead.

60-autosuspend-chromiumos.hwdb is new

/usr/include is missing.

As Joe pointed out, I've forgotten to install the header(s) :(.

comment:13 by Xi Ruoyao, 17 months ago

The install section should be updated:

# install
install -d -vm755 {/usr/lib,/etc}/udev/{hwdb,rules}.d
install -vm755 udevadm /usr/bin
ln -sv ../bin/udevadm /usr/sbin/udevd
cp -av libudev.so{,*[0-9]} /usr/lib      # <===== Ensure libudev.so and libudev.so.1 are symlinks
install -vm644 ../src/libudev/libudev.h /usr/include/libudev.h      # <===== Install the header
install -vm755 $(find src/udev -type f | grep -F -v ".") /usr/lib/udev
install -vm644 src/libudev/*.pc /usr/lib/pkgconfig
install -vm644 src/udev/*.pc /usr/share/pkgconfig
install -vm644 ../src/udev/udev.conf /etc/udev
install -vm644 rules.d/* ../rules.d/{*.rules,README} /usr/lib/udev/rules.d
install -vm644 hwdb.d/* ../hwdb.d/{*.hwdb,README} /usr/lib/udev/hwdb.d

Eudev also installs udev.h, but I cannot find it in systemd tree.

in reply to:  12 ; comment:14 by Bruce Dubbs, 17 months ago

Replying to Xi Ruoyao:

Replying to Bruce Dubbs:

install -vm755 udevadm /usr/bin is missing a trailing /.

Hmm, why a trailing / is necessary here?

If /usr/bin/ is missing in a DESDIR install, the file is named 'bin'.

Currently  
$ ll /usr/sbin/udev*
-rwxr-xr-x 1 root root 364512 Jul 11 11:37 /usr/sbin/udevadm
-rwxr-xr-x 1 root root 348160 Jul 11 11:37 /usr/sbin/udevd

are different files, but above instructions have
/usr/sbin/udevd -> ../bin/udevadm

In a systemd installation it's a symlink:

Perhaps it's OK then.

libudev.so and libudev.so.1 are not symlinks

Ah it's wrong. I guess we need to use cp -av instead of install -vm755 here.

/usr/lib/udev/collect is missing 

I can't find this file in the systemd build. What it is for?

$ /usr/lib/udev/collect --help
collect [options] <checkpoint> <id> <idlist>

Collect variables across events.

  -h --help        Print this message
  -a --add         Add ID <id> to the list <idlist>
  -r --remove      Remove ID <id> from the list <idlist>
  -d --debug       Debug to stderr

  Adds ID <id> to the list governed by <checkpoint>.
  <id> must be part of the list <idlist>.
  If all IDs given by <idlist> are listed (ie collect has been
  invoked for each ID in <idlist>) collect returns 0, the
  number of missing IDs otherwise.
  On error a negative number is returned.

I do not know how to use this or if it it is needed at all.

There are no files in /etc/udev/hwdb.d. They appear to be in /usr/lib/udev/hwdb.d/

/etc/udev/{hwdb.d,rules.d} are designed to be "system administrator only". So in a fresh installation they should be empty. But lfs-udev installs 3 rules into /etc/udev/hwdb.d and I'm not sure if we should change it to /usr/lib/udev/hwdb.d instead.

I'm good with using /etc for the LFS specific files.

in reply to:  14 comment:15 by Xi Ruoyao, 17 months ago

Replying to Bruce Dubbs:

$ /usr/lib/udev/collect --help
collect [options] <checkpoint> <id> <idlist>

Collect variables across events.

  -h --help        Print this message
  -a --add         Add ID <id> to the list <idlist>
  -r --remove      Remove ID <id> from the list <idlist>
  -d --debug       Debug to stderr

  Adds ID <id> to the list governed by <checkpoint>.
  <id> must be part of the list <idlist>.
  If all IDs given by <idlist> are listed (ie collect has been
  invoked for each ID in <idlist>) collect returns 0, the
  number of missing IDs otherwise.
  On error a negative number is returned.

I do not know how to use this or if it it is needed at all.

In systemd it's dropped in https://github.com/systemd/systemd/pull/9920/, the maintainer considered it "nonsense". The removal happens almost 5 years ago, if something depended on it the systemd revision would already blow up. So I think we can just leave it...

in reply to:  13 comment:16 by Xi Ruoyao, 17 months ago

Replying to Xi Ruoyao:

The install section should be updated:

# install
install -d -vm755 {/usr/lib,/etc}/udev/{hwdb,rules}.d
install -vm755 udevadm /usr/bin
ln -sv ../bin/udevadm /usr/sbin/udevd
cp -av libudev.so{,*[0-9]} /usr/lib      # <===== Ensure libudev.so and libudev.so.1 are symlinks
install -vm644 ../src/libudev/libudev.h /usr/include/libudev.h      # <===== Install the header
install -vm755 $(find src/udev -type f | grep -F -v ".") /usr/lib/udev
install -vm644 src/libudev/*.pc /usr/lib/pkgconfig
install -vm644 src/udev/*.pc /usr/share/pkgconfig
install -vm644 ../src/udev/udev.conf /etc/udev
install -vm644 rules.d/* ../rules.d/{*.rules,README} /usr/lib/udev/rules.d
install -vm644 hwdb.d/* ../hwdb.d/{*.hwdb,README} /usr/lib/udev/hwdb.d

Eudev also installs udev.h, but I cannot find it in systemd tree.

Hmm, the eudev udev.h is completely unusable. It contains things like

#include "libudev-private.h"

But libudev-private.h is not installed anywhere. So it's already broken and dropping it should be fine.

in reply to:  7 ; comment:17 by thomas, 17 months ago

Replying to Xi Ruoyao:

My instruction:

... Note:

  1. udevadm is installed as /usr/bin/udevadm, not /usr/sbin/udevadm. So we need to edit the LFS bootscripts to call /bin/udevadm instead of /sbin/udevadm. I don't think we should really put udevadm into /usr/sbin because actually it can be used as a normal user (at least udevadm settle does not need any privilege).

We should also keep the mkinitramfs script (BLFS) in mind - it does some checks if and where to find udevadm and some other udev-files. Maybe that has to be tweaked.

comment:18 by Xi Ruoyao, 17 months ago

The LFS change is queued in xry111/systemd-udevd-for-sysv.

Installed files:

/etc/udev/hwdb.bin	11878541	root:root	444	
/etc/udev/rules.d/55-lfs.rules	525	root:root	644	
/etc/udev/rules.d/81-cdrom.rules	204	root:root	644	
/etc/udev/rules.d/83-cdrom-symlinks.rules	551	root:root	644	
/etc/udev/udev.conf	305	root:root	644	
/usr/bin/udev-hwdb	225896	root:root	755	
/usr/bin/udevadm	1669248	root:root	755	
/usr/include/libudev.h	9798	root:root	644	
/usr/lib/libudev.so	12	root:root	777	libudev.so.1
/usr/lib/libudev.so.1	16	root:root	777	libudev.so.1.7.6
/usr/lib/libudev.so.1.7.6	308192	root:root	755	
/usr/lib/pkgconfig/libudev.pc	569	root:root	644	
/usr/lib/udev/ata_id	136400	root:root	755	
/usr/lib/udev/cdrom_id	160968	root:root	755	
/usr/lib/udev/dmi_memory_id	151384	root:root	755	
/usr/lib/udev/fido_id	212608	root:root	755	
/usr/lib/udev/hwdb.d/20-OUI.hwdb	2519164	root:root	644	
/usr/lib/udev/hwdb.d/20-acpi-vendor.hwdb	153543	root:root	644	
/usr/lib/udev/hwdb.d/20-bluetooth-vendor-product.hwdb	140340	root:root	644	
/usr/lib/udev/hwdb.d/20-dmi-id.hwdb	832	root:root	644	
/usr/lib/udev/hwdb.d/20-net-ifname.hwdb	111	root:root	644	
/usr/lib/udev/hwdb.d/20-pci-classes.hwdb	15708	root:root	644	
/usr/lib/udev/hwdb.d/20-pci-vendor-model.hwdb	3561723	root:root	644	
/usr/lib/udev/hwdb.d/20-sdio-classes.hwdb	783	root:root	644	
/usr/lib/udev/hwdb.d/20-sdio-vendor-model.hwdb	4181	root:root	644	
/usr/lib/udev/hwdb.d/20-usb-classes.hwdb	8070	root:root	644	
/usr/lib/udev/hwdb.d/20-usb-vendor-model.hwdb	1480035	root:root	644	
/usr/lib/udev/hwdb.d/20-vmbus-class.hwdb	1810	root:root	644	
/usr/lib/udev/hwdb.d/60-autosuspend-chromiumos.hwdb	2218	root:root	644	
/usr/lib/udev/hwdb.d/60-autosuspend-fingerprint-reader.hwdb	6478	root:root	644	
/usr/lib/udev/hwdb.d/60-autosuspend.hwdb	2438	root:root	644	
/usr/lib/udev/hwdb.d/60-evdev.hwdb	24936	root:root	644	
/usr/lib/udev/hwdb.d/60-input-id.hwdb	2427	root:root	644	
/usr/lib/udev/hwdb.d/60-keyboard.hwdb	97840	root:root	644	
/usr/lib/udev/hwdb.d/60-seat.hwdb	1119	root:root	644	
/usr/lib/udev/hwdb.d/60-sensor.hwdb	42703	root:root	644	
/usr/lib/udev/hwdb.d/70-analyzers.hwdb	1243	root:root	644	
/usr/lib/udev/hwdb.d/70-av-production.hwdb	2860	root:root	644	
/usr/lib/udev/hwdb.d/70-cameras.hwdb	679	root:root	644	
/usr/lib/udev/hwdb.d/70-joystick.hwdb	1751	root:root	644	
/usr/lib/udev/hwdb.d/70-mouse.hwdb	25014	root:root	644	
/usr/lib/udev/hwdb.d/70-pda.hwdb	926	root:root	644	
/usr/lib/udev/hwdb.d/70-pointingstick.hwdb	7712	root:root	644	
/usr/lib/udev/hwdb.d/70-touchpad.hwdb	2316	root:root	644	
/usr/lib/udev/hwdb.d/80-ieee1394-unit-function.hwdb	48344	root:root	644	
/usr/lib/udev/hwdb.d/README	518	root:root	644	
/usr/lib/udev/init-net-rules.sh	3673	root:root	644	
/usr/lib/udev/mtd_probe	56800	root:root	755	
/usr/lib/udev/rule_generator.functions	3540	root:root	644	
/usr/lib/udev/rules.d/50-udev-default.rules	5287	root:root	644	
/usr/lib/udev/rules.d/60-autosuspend.rules	704	root:root	644	
/usr/lib/udev/rules.d/60-block.rules	703	root:root	644	
/usr/lib/udev/rules.d/60-cdrom_id.rules	1071	root:root	644	
/usr/lib/udev/rules.d/60-drm.rules	413	root:root	644	
/usr/lib/udev/rules.d/60-evdev.rules	1093	root:root	644	
/usr/lib/udev/rules.d/60-fido-id.rules	491	root:root	644	
/usr/lib/udev/rules.d/60-infiniband.rules	379	root:root	644	
/usr/lib/udev/rules.d/60-input-id.rules	282	root:root	644	
/usr/lib/udev/rules.d/60-persistent-alsa.rules	616	root:root	644	
/usr/lib/udev/rules.d/60-persistent-input.rules	2719	root:root	644	
/usr/lib/udev/rules.d/60-persistent-storage-tape.rules	2204	root:root	644	
/usr/lib/udev/rules.d/60-persistent-storage.rules	9371	root:root	644	
/usr/lib/udev/rules.d/60-persistent-v4l.rules	769	root:root	644	
/usr/lib/udev/rules.d/60-sensor.rules	1618	root:root	644	
/usr/lib/udev/rules.d/60-serial.rules	1136	root:root	644	
/usr/lib/udev/rules.d/64-btrfs.rules	616	root:root	644	
/usr/lib/udev/rules.d/70-camera.rules	281	root:root	644	
/usr/lib/udev/rules.d/70-joystick.rules	432	root:root	644	
/usr/lib/udev/rules.d/70-memory.rules	184	root:root	644	
/usr/lib/udev/rules.d/70-mouse.rules	734	root:root	644	
/usr/lib/udev/rules.d/70-power-switch.rules	576	root:root	644	
/usr/lib/udev/rules.d/70-touchpad.rules	473	root:root	644	
/usr/lib/udev/rules.d/70-uaccess.rules	3366	root:root	644	
/usr/lib/udev/rules.d/71-seat.rules	3818	root:root	644	
/usr/lib/udev/rules.d/73-seat-late.rules	643	root:root	644	
/usr/lib/udev/rules.d/75-net-description.rules	452	root:root	644	
/usr/lib/udev/rules.d/75-probe_mtd.rules	174	root:root	644	
/usr/lib/udev/rules.d/78-sound-card.rules	4816	root:root	644	
/usr/lib/udev/rules.d/80-drivers.rules	600	root:root	644	
/usr/lib/udev/rules.d/80-net-setup-link.rules	295	root:root	644	
/usr/lib/udev/rules.d/81-net-dhcp.rules	528	root:root	644	
/usr/lib/udev/rules.d/90-vconsole.rules	489	root:root	644	
/usr/lib/udev/rules.d/99-systemd.rules	5039	root:root	644	
/usr/lib/udev/rules.d/README	435	root:root	644	
/usr/lib/udev/scsi_id	164672	root:root	755	
/usr/lib/udev/v4l_id	56656	root:root	755	
/usr/lib/udev/write_cd_rules	3595	root:root	755	
/usr/lib/udev/write_net_rules	4345	root:root	755	
/usr/sbin/udevd	14	root:root	777	../bin/udevadm
/usr/share/doc/udev-20171102/lfs/55-lfs.txt	758	root:root	644	
/usr/share/doc/udev-20171102/lfs/README	1040	root:root	644	
/usr/share/man/man8/udev-hwdb.8	1980	root:root	644	
/usr/share/man/man8/udevd.8	8297	root:root	644	
/usr/share/pkgconfig/udev.pc	426	root:root	644	

The list is generated by jhalfs and it seems not complete. The instruction installs many man pages into /usr/share/man/man3 (for documenting functions provided by libudev) but jhalfs does not list them.

in reply to:  17 comment:19 by Xi Ruoyao, 17 months ago

Replying to thomas:

Replying to Xi Ruoyao:

My instruction:

... Note:

  1. udevadm is installed as /usr/bin/udevadm, not /usr/sbin/udevadm. So we need to edit the LFS bootscripts to call /bin/udevadm instead of /sbin/udevadm. I don't think we should really put udevadm into /usr/sbin because actually it can be used as a normal user (at least udevadm settle does not need any privilege).

We should also keep the mkinitramfs script (BLFS) in mind - it does some checks if and where to find udevadm and some other udev-files. Maybe that has to be tweaked.

The script has:

# Systemd installs udevadm in /bin. Other udev implementations have it in /sbin
if [ -x /usr/bin/udevadm ] ; then binfiles="$binfiles udevadm"; fi

So it should work.

comment:20 by Joe Locash, 17 months ago

Did more testing and so far the only issue I've noticed is that nothing is getting logged. This is probably because by default all systemd services log to the journal so udev is trying doing the same. There are options to override the logging but that is with using the StandardOutput=/StandardError= options in the service unit file. It doesn't help here because the udev daemon isn't started by systemd.

Last edited 17 months ago by Joe Locash (previous) (diff)

comment:21 by Bruce Dubbs, 17 months ago

I'm not sure this is working. On my workstation with eudev I can plug in a USB drive and it shows up as /dev/sdc. On my development system with the new udev from systemd, I see no changes to /dev/when plugging in the same drive.

On my workstation:

Jul 16 16:56:48 lfs11 kernel: [432469.962478] sd 8:0:0:0: [sdc] Synchronizing SCSI cache

On my development system -- nothing.

comment:22 by Bruce Dubbs, 17 months ago

Correction. On my development system it was a HW problem. Probably a loose cable on my USB hub. Now the new udev recognizes when the drive is plugged in and removed.

Also, I don't understand Joe's comment about logging. At least as far as a USB drive goes, the messages are from the kernel and they show up fine. What udev specific message(s) should I be looking for?

comment:23 by Douglas R. Reno, 17 months ago

Bruce, can you look for /lib/udev/rules.d/70-power-switch.rules? I read from Gentoo that it may interfere with elogind, so we might want to remove it and let elogind install its version.

comment:24 by Bruce Dubbs, 17 months ago

The udev version has:

ACTION=="remove", GOTO="power_switch_end"

SUBSYSTEM=="input", KERNEL=="event*", ENV{ID_INPUT_SWITCH}=="1", TAG+="power-switch"
SUBSYSTEM=="input", KERNEL=="event*", ENV{ID_INPUT_KEY}=="1", TAG+="power-switch"

LABEL="power_switch_end"

I'm not familiar with the TAG reference and I don't know where the ID_INPUT* variables would be set.

After elogind I have:

ACTION=="remove", GOTO="power_switch_end"

SUBSYSTEM=="input", KERNEL=="event*", ENV{ID_INPUT_SWITCH}=="1", TAG+="power-switch"
SUBSYSTEM=="input", KERNEL=="event*", ENV{ID_INPUT_KEY}=="1", TAG+="power-switch"
#if 1 /// elogind supports eudev and needs some extra rules.
SUBSYSTEM=="input", KERNEL=="event*", SUBSYSTEMS=="acpi", TAG+="power-switch"
SUBSYSTEM=="input", KERNEL=="event*", KERNELS=="thinkpad_acpi", TAG+="power-switch"
SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="twl4030_pwrbutton", TAG+="power-switch"
SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="tps65217_pwr_but", TAG+="power-switch"
SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="* WMI hotkeys", TAG+="power-switch"
#endif // 1

LABEL="power_switch_end"

Personally I rarely use the power switch to turn off the computer. I do it with the poweroff command or via a menu item. It may be more useful on a laptop though.

in reply to:  22 comment:25 by Xi Ruoyao, 17 months ago

Replying to Bruce Dubbs:

Correction. On my development system it was a HW problem. Probably a loose cable on my USB hub. Now the new udev recognizes when the drive is plugged in and removed.

Also, I don't understand Joe's comment about logging. At least as far as a USB drive goes, the messages are from the kernel and they show up fine. What udev specific message(s) should I be looking for?

During the boot:

  *   Setting hostname to lfs-udev ... [OK]
      Populating /dev with device nodes... Starting systemd-udevd version 253
  *   ... [OK]

I suppose the "Starting systemd-udevd" line should be sent to system journal, not stderr. But I've not figured out how yet.

comment:26 by Bruce Dubbs, 17 months ago

I didn't notice that before. I suppose we need:

sed -i "/Starting/s|||" src/udev/udevd.c

in reply to:  26 ; comment:27 by Xi Ruoyao, 17 months ago

Replying to Bruce Dubbs:

I didn't notice that before. I suppose we need:

sed -i "/Starting/s|||" src/udev/udevd.c

diff --git a/bootscripts/lfs/init.d/udev b/bootscripts/lfs/init.d/udev
index 612685af7..f7d4b9bff 100644
--- a/bootscripts/lfs/init.d/udev
+++ b/bootscripts/lfs/init.d/udev
@@ -45,7 +45,7 @@ case "${1}" in
 
       # Start the udev daemon to continually watch for, and act on,
       # uevents
-      /sbin/udevd --daemon
+      SYSTEMD_LOG_TARGET=kmsg /sbin/udevd --daemon
 
       # Now traverse /sys in order to "coldplug" devices that have
       # already been discovered

This will make the logging work. Ideally we should use the "syslog" target here, but when udevd starts sysklogd is not started yet so we have to use "kmsg".

in reply to:  27 comment:28 by Xi Ruoyao, 17 months ago

Replying to Xi Ruoyao:

Replying to Bruce Dubbs:

I didn't notice that before. I suppose we need:

sed -i "/Starting/s|||" src/udev/udevd.c

diff --git a/bootscripts/lfs/init.d/udev b/bootscripts/lfs/init.d/udev
index 612685af7..f7d4b9bff 100644
--- a/bootscripts/lfs/init.d/udev
+++ b/bootscripts/lfs/init.d/udev
@@ -45,7 +45,7 @@ case "${1}" in
 
       # Start the udev daemon to continually watch for, and act on,
       # uevents
-      /sbin/udevd --daemon
+      SYSTEMD_LOG_TARGET=kmsg /sbin/udevd --daemon
 
       # Now traverse /sys in order to "coldplug" devices that have
       # already been discovered

This will make the logging work. Ideally we should use the "syslog" target here, but when udevd starts sysklogd is not started yet so we have to use "kmsg".

Viewing the log, there are two udev rules referring to systemd helper programs and they should be removed.

comment:29 by Xi Ruoyao, 17 months ago

Resolution: fixed
Status: assignedclosed

Fixed:

comment:30 by Bruce Dubbs, 16 months ago

Milestone: 11.412.0

Milestone renamed

comment:31 by Xi Ruoyao, 6 months ago

Description: modified (diff)

Update the desc to allow accessing the BLFS ticket easier.

Note: See TracTickets for help on using tickets.