Opened 3 years ago

Closed 3 years ago

#4914 closed task (fixed)

eudev-3.2.11

Reported by: pierre Owned by: lfs-book
Priority: normal Milestone: 11.1
Component: Book Version: git
Severity: normal Keywords:
Cc:

Description

See https://github.com/gentoo/eudev/issues/199

It looks like udev can be extracted directly from systemd (needs meson and ninja): https://gitea.artixlinux.org/packagesX/xudev/src/branch/master/trunk/PKGBUILD

Attachments (1)

replace-eudev-with-udev.patch (20.2 KB ) - added by DJ Lucas 3 years ago.
Patch to replace eudev with udev directly from systemd

Download all attachments as: .zip

Change History (17)

comment:1 by Bruce Dubbs, 3 years ago

This is unfortunate. The procedure referenced is very complicated.

comment:2 by Xi Ruoyao, 3 years ago

I think the following will work:

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

# systemd-249-security_fix-1.patch is unneeded for udev
# but udev rules should be fixed as well
# or we can create "render" and "sgx" groups in chapter 7?
sed -i -e 's/GROUP="render"/GROUP="video"/' \
       -e 's/GROUP="sgx", //' rules.d/50-udev-default.rules.in

# meson
mkdir build
cd build
meson .. --prefix=/usr ... # follow systemd instruction

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

# install
install -vm755 udevadm /usr/bin
ln -sv ../bin/udevadm /usr/sbin/udevd
install -vm755 libudev.so{,*[0-9]} /usr/lib
install -vm644 src/libudev/*.pc /usr/lib/pkgconfig
install -vm644 src/udev/*.pc /usr/share/pkgconfig
install -d -vm755 {/usr/lib,/etc}/{hwdb,rules}.d
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 need to be installed from systemd-man-pages-249.tar.xz
tar xf ../../systemd-man-pages-249.tar.xz --strip-components=1 -C /usr/share/man \
    systemd-man-pages-249/{man3/libudev.3,man5/udev.conf.5,man7/{udev,hwdb}.7,man8/udevadm.8}

# configuring: generate /etc/udev/hwdb.bin
udevadm hwdb --update
Version 0, edited 3 years ago by Xi Ruoyao (next)

comment:3 by DJ Lucas, 3 years ago

Did you catch Joe's note about not linking to libsystemd/udev? Although, ISTR that we might actually want libudev, there are packages that look for it. Might want to repost in the dev thread. Also, the additional rules that use .in files should be created. The closer we are to upstream, the better IMO. I'm not sure if that's covered above or not, but I've got to run.

comment:4 by pierre, 3 years ago

Another alternative: libudev-zero. Alpine linux should begin to use it.

Last edited 3 years ago by pierre (previous) (diff)

in reply to:  4 ; comment:5 by Bruce Dubbs, 3 years ago

Replying to pierre:

Another alternative: libudev-zero. Alpine linux should begin to use it.

Looks interesting. Are you going to try it?

in reply to:  5 comment:6 by ken@…, 3 years ago

Replying to Bruce Dubbs:

Replying to pierre:

Another alternative: libudev-zero. Alpine linux should begin to use it.

Looks interesting. Are you going to try it?

It seems to be incomplete - apart from possibly breaking dosfstools, it needs a device manager for hotplugging (e.g. usb disks, sticks, printers). It mentions mdev, looking at closed issues that seems to be the preferred way.

I remember the name mdev (I think hardened lfs maybe used it), the first link google came up with for me was https://wiki.gentoo.org/wiki/Mdev - does not look encouraging.

comment:7 by DJ Lucas, 3 years ago

Replying to Xi Ruoyao:

I think the following will work:

# use systemd tarball
<snip>
install -vm755 $(find src/udev -type f | fgrep -v ".") /usr/lib/udev
<snip>

Works, except you need to create /usr/lib/udev just before this line, and libudev.h needs to be installed: install -vdm755 /usr/lib/udev ... install -vm644 ../src/libudev/libudev.h /usr/include

I queued it up locally and was running a -j8 jhalfs build. I didn't catch the lack of libudev.h until util-linux so I'm going to start over quick. I run all testsuites, so it'll be about 2.5 hours including kernel so I can boot it. Using revision for the sysv book was not possible, so I just made a copy locally. Currently I've called it systemd-udev to make it easy for my pacman variant of LFS, but will fix that in my sandbox shortly, assuming that is not what is ultimately wanted, the title for the page/package should just be udev?

by DJ Lucas, 3 years ago

Patch to replace eudev with udev directly from systemd

comment:8 by DJ Lucas, 3 years ago

Sorry, forgot to report back on this.

So, there were a couple of minor changes, but this will work. We will need to correct the location of /usr/sbin/udevadm in elogind in BLFS, but otherwise, this works well.

I needed it anyway, so a complete patch based on what Xi had above is attached (minus changelog, also build size is not correct) in the event that this is the selected route over other options.

FWIW, this is my preferred solution, despite the addition of Jinja2 and MarkupSafe, because it stays closer to upstream and it further minimizes the differences between the books of the two init variants.

comment:9 by DJ Lucas, 3 years ago

I stand corrected. No file descriptors are created in /dev, including the /dev/fd -> /proc/self/fd symlink. Still investigating.

comment:10 by DJ Lucas, 3 years ago

Caused by this commit: https://github.com/systemd/systemd/commit/6b2229c6c60d0486#diff-000342aa23dfb7299537dded24bb982625fdb7bc62f94be779c94041e49e1e5aR1861-L1865

This is simple enough to revert, but would we want to? It's easy enough to create the five missing symlinks as upstream suggests, presumably in the udev bootscript.

From src/shared/dev-setup.c:

...
int dev_setup(const char *prefix, uid_t uid, gid_t gid) {
        static const char symlinks[] =
                "-/proc/kcore\0"     "/dev/core\0"
                "/proc/self/fd\0"    "/dev/fd\0"
                "/proc/self/fd/0\0"  "/dev/stdin\0"
                "/proc/self/fd/1\0"  "/dev/stdout\0"
                "/proc/self/fd/2\0"  "/dev/stderr\0";
...

comment:11 by pierre, 3 years ago

FWIIW, looking at the code in dev-setup.c, the "-" before /proc/kcore means that the existence of that file is tested, and the symlink is not created if non existent.

comment:12 by pierre, 3 years ago

From Frans de Boer message on -support, Eudev might be maintained again at devuan or at alpine linux

comment:13 by Bruce Dubbs, 3 years ago

A new github instance: https://github.com/eudev-project/eudev

Currently still at the version we have in the book.

comment:14 by Bruce Dubbs, 3 years ago

Summary: Eudev deprecationeudev-3.2.11

Now at version 3.2.11.

comment:15 by Bruce Dubbs, 3 years ago

Release 3.2.11

What's Changed

  • add actions workflows to check compilation on glibc and musl (devuan, alpine)
  • Add build instructions
  • src/libudev/conf-files.c: fix bug of using basename
  • Permit eudev to work with rules which include escaped double-quotes
  • sync src/ata_id/ata_id.c
  • sync src/v4l_id/v4l_id.c
  • sync src/scsi_id/scsi_id.c
  • sync src/mtd_probe/*.[ch]
  • sparse: avoid clash with __bitwise and __force from 4.10 linux/types.
  • Silence deprecation warnings
  • update CONTRIBUTING to reflect updated governance, clarify systemd commit hash requirements
  • hashmap: don't initialize devt_hash_ops in the header
  • Update to latest Devuan stable
  • hwdb: sync with systemd/main
  • Add getrandom(2) system call number for PowerPC

comment:16 by Bruce Dubbs, 3 years ago

Resolution: fixed
Status: newclosed

Fixed at commit ad89f7b0d63fac3c1bca0e5d11880d97c511f84e

Package updates.
    Update to e2fsprogs-1.46.5.
    Update to zstd-1.5.1.
    Update to expat-2.4.2.
    Update to shadow-4.10.
    Update to sysvinit-3.01.
    Update to linux-5.15.12.
    Update to iana-etc-20211224.
    Update to openssl-3.0.1.
    Update to eudev-3.2.11.
    Update lfs-latest-git.php currency for new eudev location.
Note: See TracTickets for help on using tickets.