You are not logged in.

#1 2019-01-09 18:00:14

olocin
Member
Registered: 2018-01-03
Posts: 171

[solved] udevd error after systemd update

After the recent update, I get this error in my journal after recovering from suspend:

 systemd-udevd[9952]: Failed to wait spawned command '/usr/bin/tlp auto': Input/output error 

Should I file a bug?

Last edited by olocin (2019-01-28 14:21:46)

Offline

#2 2019-01-09 18:01:59

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [solved] udevd error after systemd update

No. Read your journal for that service unit; and paste the actual service file.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2019-01-09 18:27:04

olocin
Member
Registered: 2018-01-03
Posts: 171

Re: [solved] udevd error after systemd update

 journalctl -b | grep udevd | grep tlp 

only gives multiple copies of

systemd-udevd[9952]: Process '/usr/bin/tlp auto' failed with exit code 4.
systemd-udevd[9952]: Failed to wait spawned command '/usr/bin/tlp auto': Input/output error

All other instances of udevd seem uncorrelated and have different udevd[...] numbers.

 cat /usr/lib/systemd/system/systemd-udevd.service 

gives

#  SPDX-License-Identifier: LGPL-2.1+
#
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit]
Description=udev Kernel Device Manager
Documentation=man:systemd-udevd.service(8) man:udev(7)
DefaultDependencies=no
After=systemd-sysusers.service systemd-hwdb-update.service
Before=sysinit.target
ConditionPathIsReadWrite=/sys

[Service]
Type=notify
OOMScoreAdjust=-1000
Sockets=systemd-udevd-control.socket systemd-udevd-kernel.socket
Restart=always
RestartSec=0
ExecStart=/usr/lib/systemd/systemd-udevd
KillMode=mixed
WatchdogSec=3min
TasksMax=infinity
PrivateMounts=yes
MemoryDenyWriteExecute=yes
RestrictRealtime=yes
RestrictAddressFamilies=AF_UNIX AF_NETLINK AF_INET AF_INET6
SystemCallFilter=@system-service @module @raw-io
SystemCallErrorNumber=EPERM
SystemCallArchitectures=native
LockPersonality=yes
IPAddressDeny=any

Offline

#4 2019-01-09 18:32:07

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [solved] udevd error after systemd update

The error is TLP, not udev...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2019-01-09 19:09:11

olocin
Member
Registered: 2018-01-03
Posts: 171

Re: [solved] udevd error after systemd update

$ journalctl -b | grep tlp
systemd-udevd[286]: Process '/usr/bin/tlp auto' failed with exit code 4.
systemd-udevd[286]: Failed to wait spawned command '/usr/bin/tlp auto': Input/output error
systemd-udevd[277]: Process '/usr/bin/tlp auto' failed with exit code 4.
systemd-udevd[277]: Failed to wait spawned command '/usr/bin/tlp auto': Input/output error
tlp[612]: Applying power save settings...done.
tlp[612]: Setting battery charge thresholds...done.
audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=tlp comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
kernel: audit: type=1130 audit(1546998178.159:32): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=tlp comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=tlp-sleep comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
kernel: audit: type=1130 audit(1546998704.200:43): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=tlp-sleep comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
systemd[1]: tlp-sleep.service: Succeeded.
audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=tlp-sleep comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
kernel: audit: type=1131 audit(1547036312.756:50): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=tlp-sleep comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=tlp-sleep comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
kernel: audit: type=1130 audit(1547036983.304:57): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=tlp-sleep comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
systemd[1]: tlp-sleep.service: Succeeded.

repeated many times

Offline

#6 2019-01-09 19:10:36

olocin
Member
Registered: 2018-01-03
Posts: 171

Re: [solved] udevd error after systemd update

$ cat /usr/lib/systemd/system/tlp.service
# tlp - systemd startup/shutdown service
#
# Copyright (c) 2018 Thomas Koch <linrunner at gmx.net>
# This software is licensed under the GPL v2 or later.

[Unit]
Description=TLP system startup/shutdown
Wants=bluetooth.service NetworkManager.service
After=multi-user.target bluetooth.service NetworkManager.service
Before=shutdown.target
Documentation=http://linrunner.de/tlp

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/tlp init start
ExecStop=/usr/bin/tlp init stop

[Install]
WantedBy=multi-user.target

and

$ cat /usr/lib/systemd/system/tlp-sleep.service
# tlp - systemd suspend/resume service
#
# Copyright (c) 2018 Thomas Koch <linrunner at gmx.net>
# This software is licensed under the GPL v2 or later.

[Unit]
Description=TLP suspend/resume
Before=sleep.target
StopWhenUnneeded=yes
Documentation=http://linrunner.de/tlp

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/tlp suspend
ExecStop=/usr/bin/tlp resume

[Install]
WantedBy=sleep.target

Offline

#7 2019-01-09 20:00:28

loqs
Member
Registered: 2014-03-06
Posts: 19,104

Re: [solved] udevd error after systemd update

cat /usr/lib/udev/rules.d/85-tlp.rules
cat /usr/lib/udev/tlp-usb-udev

Offline

#8 2019-01-09 20:01:08

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [solved] udevd error after systemd update

So where is the command `tlp auto` coming from?

Disable TLP.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#9 2019-01-09 20:02:44

olocin
Member
Registered: 2018-01-03
Posts: 171

Re: [solved] udevd error after systemd update

$ cat /usr/lib/udev/rules.d/85-tlp.rules
# tlp - udev rules
#
# Copyright (c) 2018 Thomas Koch <linrunner at gmx.net>
# This software is licensed under the GPL v2 or later.

# handle change of power source ac/bat
ACTION=="change", SUBSYSTEM=="power_supply", RUN+="/usr/bin/tlp auto"

# handle added usb devices (exclude subdevices via DRIVER=="USB")
ACTION=="add", SUBSYSTEM=="usb", DRIVER=="usb", ENV{DEVTYPE}=="usb_device", RUN+="/usr/lib/udev/tlp-usb-udev %p"

Offline

#10 2019-01-09 20:04:56

olocin
Member
Registered: 2018-01-03
Posts: 171

Re: [solved] udevd error after systemd update

$ cat /usr/lib/udev/tlp-usb-udev
#!/bin/sh
# tlp - handle added usb devices
#
# Copyright (c) 2018 Thomas Koch <linrunner at gmx.net>
# This software is licensed under the GPL v2 or later.

# Remark: the calling udev rule is triggered for "base" devices only,
#         not for the corresponding subdevices.

# --- Constants
readonly LOGGER=logger

readonly USBD=/sys/bus/usb/devices
readonly USB_TIMEOUT=2
readonly USB_TIMEOUT_MS=2000
readonly USB_WWAN_VENDORS="0bdb 05c6 1199"

readonly RUNDIR=/run/tlp
readonly USB_DONE=usb_done

readonly CONFFILE=/etc/default/tlp

# --- Subroutines
wordinlist () { # test if word in list
                # $1: word, $2: whitespace-separated list of words
    local word

    if [ -n "${1-}" ]; then
        for word in ${2-}; do
            [ "${word}" != "${1}" ] || return 0 # exact match
        done
    fi

    return 1 # no match
}

echo_debug () { # $1: tag; $2: msg; echo debug msg if tag matches
    if wordinlist "$1" "$TLP_DEBUG"; then
        $LOGGER -p debug -t "tlp[$$,$PPID]" "$2"
    fi
}

# --- MAIN

# read config
[ -f $CONFFILE ] || exit 0
. $CONFFILE

# exit if TLP or autosuspend disabled
[ "$TLP_ENABLE" = "1" ] && [ "$USB_AUTOSUSPEND" = "1" ] || exit 0

# USB autosuspend has two principal operation modes:
#
# Mode 1 (optional):
# - System startup is handled by tlp-functions:set_usb_suspend()
# - Startup completion is signaled by "flag file" $USB_DONE
# - Newly added devices are handled by this udev script
# - Mode 1 is enabled by the private config variable X_TLP_USB_MODE=1
#
# Mode 2 (default):
# - Everything - including system startup, but not shutdown - is handled by this udev script

# do exit if mode 1 and no startup completion flag
[ "$X_TLP_USB_MODE" = "1" ] && [ ! -f $RUNDIR/$USB_DONE ] && exit 0

# get args
usbdev=/sys$1

# handle device
if [ -f $usbdev/power/autosuspend ] || [ -f $usbdev/power/autosuspend_delay_ms ]; then
    # device is autosuspendable

    # apply autosuspend
    ctrlf="control"
    autof="autosuspend_delay_ms"
    vendor="$(cat $usbdev/idVendor 2> /dev/null)"
    usbid="$vendor:$(cat $usbdev/idProduct 2> /dev/null)"
    busdev="Bus $(cat $usbdev/busnum) Dev $(cat $usbdev/devnum 2> /dev/null)"
    dclass="$(cat $usbdev/bDeviceClass 2> /dev/null)"
    control="auto"
    exc=""
    chg=0
    drvlist=""

    # trace only: get drivers for all subdevices
    if [ "$X_USB_DRIVER_TRACE" = "1" ]; then
        drvlist=$(for dl in $usbdev/*:*/driver; do readlink $dl | \
            sed -r 's/.+\///'; done | sort -u | tr '\n' ' ')
        drvlist="(${drvlist% })"
    fi

    if wordinlist "$usbid" "$USB_WHITELIST"; then
        # device is in whitelist -- whitelist always wins
        control="auto"
        exc="_dev_white"
    elif wordinlist "$usbid" "$USB_BLACKLIST"; then
        # device is in blacklist
        control="on"
        exc="_dev_black"
    else
        # wait for subdevices to populate
        sleep 0.5

        # check for hid subdevices
        for subdev in $usbdev/*:*; do
            if [ "$(cat $subdev/bInterfaceClass  2> /dev/null)" = "03" ]; then
                control="on"
                exc="_hid_black"
                break
            fi
        done

        if [ -z "$exc" ]; then
            # check for bluetooth devices
            USB_BLACKLIST_BTUSB=${USB_BLACKLIST_BTUSB:-0} # default is include

            if [ "$USB_BLACKLIST_BTUSB" = "1" ] \
                && [ "$dclass" = "e0" ] \
                && [ "$(cat $usbdev/bDeviceSubClass 2> /dev/null)" = "01" ] \
                && [ "$(cat $usbdev/bDeviceProtocol 2> /dev/null)" = "01" ]; then
                control="on"
                exc="_btusb_black"
            fi
        fi # bluetooth

        if [ -z "$exc" ]; then
            # check for phone devices
            USB_BLACKLIST_PHONE=${USB_BLACKLIST_PHONE:-0} # default is include

            if [ "$USB_BLACKLIST_PHONE" = "1" ]; then
                if [ "$vendor" = "0fca" ]; then
                    # RIM
                    if [ "$dclass" = "ef" ]; then
                        # RIM / BlackBerry
                        control="on"
                        exc="_phone_black"
                    elif [ "$dclass" = "00" ]; then
                       for subdev in $usbdev/*:*; do
                            if [ -d $subdev ]; then
                                if [ "$(cat $subdev/interface 2> /dev/null)" = "BlackBerry" ]; then
                                    # Blackberry
                                    control="on"
                                    exc="_phone_black"
                                    break
                                fi
                            fi
                        done
                    fi

                elif [ "$vendor" = "045e" ] && [ "$dclass" = "ef" ]; then
                    # Windows Phone
                    control="on"
                    exc="_phone_black"

                elif [ "$vendor" = "05ac" ] && [ "$(cat $usbdev/product 2> /dev/null)" = "iPhone" ]; then
                    # iPhone
                    control="on"
                    exc="_phone_black"

                elif [ "$dclass" = "00" ]; then
                    # class defined at interface level, iterate subdevices
                    for subdev in $usbdev/*:*; do
                        if [ -d $subdev ]; then
                            if [ "$(cat $subdev/interface 2> /dev/null)" = "MTP" ]; then
                                # MTP: mostly Android
                                control="on"
                                exc="_phone_black"
                                break
                            elif [ "$(cat $subdev/bInterfaceClass 2> /dev/null)" = "ff" ] \
                                && [ "$(cat $subdev/bInterfaceSubClass 2> /dev/null)" = "42" ] \
                                && [ "$(cat $subdev/bInterfaceProtocol 2> /dev/null)" = "01" ]; then
                                # ADB: Android
                                control="on"
                                exc="_phone_black"
                                break
                            elif [ "$(cat $subdev/bInterfaceClass 2> /dev/null)" = "06" ] \
                                && [ "$(cat $subdev/bInterfaceSubClass 2> /dev/null)" = "01" ] \
                                && [ "$(cat $subdev/bInterfaceProtocol 2> /dev/null)" = "01" ]; then
                                # PTP: iPhone, Lumia et al.
                                # caveat: may also be a camera
                                control="on"
                                exc="_phone_black"
                                break
                            fi
                        fi
                    done

                fi # dclass 00
            fi # blacklist phone
        fi # phone

        if [ -z "$exc" ]; then
            # check for printers
            USB_BLACKLIST_PRINTER=${USB_BLACKLIST_PRINTER:-1} # default is exclude

            if [ "$USB_BLACKLIST_PRINTER" = "1" ]; then
                if [ "$dclass" = "00" ]; then
                    # check for printer subdevices
                    for subdev in $usbdev/*:*; do
                        if [ "$(cat $subdev/bInterfaceClass 2> /dev/null)" = "07" ]; then
                            control="on"
                            exc="_printer_black"
                            break
                        fi
                    done
                fi
            fi
        fi # printer

        if [ -z "$exc" ]; then
            # check for wwan devices
            USB_BLACKLIST_WWAN=${USB_BLACKLIST_WWAN:-1} # default is exclude

            if [ "$USB_BLACKLIST_WWAN" = "1" ]; then
                if [ "$dclass" != "00" ]; then
                    # check for cdc subdevices
                    for subdev in $usbdev/*:*; do
                        if [ "$(cat $subdev/bInterfaceClass 2> /dev/null)" = "0a" ]; then
                            control="on"
                            exc="_wwan_black"
                            break
                        fi
                    done
                fi

                if [ -z "$exc" ]; then
                    # check for vendors
                    if wordinlist "$vendor" "$USB_WWAN_VENDORS"; then
                        control="on"
                        exc="_wwan_black"
                    fi
                fi
            fi # blacklist wwan
        fi # wwan
    fi # !device blacklist

    if [ -f $usbdev/power/control ]; then
        if [ "$(cat $usbdev/power/control 2> /dev/null)" != "$control" ]; then
            # Write actual changes only
            { printf '%s\n' "$control" > $usbdev/power/control; } 2> /dev/null
            chg=1
        fi
    else
        # level is deprecated
        if [ "$(cat $usbdev/power/level 2> /dev/null)" != "$control" ]; then
            # Write actual changes only
            { printf '%s\n' "$control" > $usbdev/power/level; } 2> /dev/null
            chg=1
        fi
        ctrlf="level"
    fi

    if [ "$X_TLP_USB_SET_AUTOSUSPEND_DELAY" = "1" ]; then
        # set autosuspend_delay
        if [ -f $usbdev/power/autosuspend_delay_ms ]; then
            { printf '%s\n' $USB_TIMEOUT_MS > $usbdev/power/autosuspend_delay_ms; } 2> /dev/null
        else
            # autosuspend is deprecated
            { printf '%s\n' $USB_TIMEOUT > $usbdev/power/autosuspend; } 2> /dev/null
            autof="autosuspend"
        fi
        echo_debug "usb" "udev_usb.$control$exc: $busdev ID $usbid $usbdev [$ctrlf $autof] $drvlist"
    elif [ $chg -eq 1 ]; then
        # default: change control but not autosuspend_delay, i.e. keep kernel default setting
        echo_debug "usb" "udev_usb.$control$exc: $busdev ID $usbid $usbdev [$ctrlf] $drvlist"
    else
        # we didn't change anything actually
        echo_debug "usb" "udev_usb.$control$exc: $busdev ID $usbid $usbdev $drvlist"
    fi
fi

exit 0

Last edited by olocin (2019-01-09 20:07:16)

Offline

#11 2019-01-09 20:07:28

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [solved] udevd error after systemd update

So, your udev rule is the problem.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#12 2019-01-09 20:22:07

olocin
Member
Registered: 2018-01-03
Posts: 171

Re: [solved] udevd error after systemd update

That udev rule has always been there though, while the error only appeared recently.

Offline

#13 2019-01-09 20:37:03

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [solved] udevd error after systemd update

Well, a quick look at the man page didn't reveal an auto command to me...

You decide what you want to do about it; if it was me, I'd remove TLP.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#14 2019-01-09 20:44:28

loqs
Member
Registered: 2014-03-06
Posts: 19,104

Re: [solved] udevd error after systemd update

An alternative would be bisecting systemd between 239 and 240 to see if you can find the causal commit.
Already fixed issues in the current arch release which you may encounter during the bisect see https://git.archlinux.org/svntogit/pack … b98beb#n64

Offline

#15 2019-01-09 22:36:02

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,674

Offline

#16 2019-01-09 22:38:15

olocin
Member
Registered: 2018-01-03
Posts: 171

Re: [solved] udevd error after systemd update

Right, I did see that github post, although only one of my two errors is mentioned there.

Offline

#17 2019-01-09 22:53:42

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,674

Re: [solved] udevd error after systemd update

Folow-up "error", came w/ systemd 240:
https://github.com/systemd/systemd/issues/11341
https://github.com/systemd/systemd/pull/11347

Wrap this into some script that checks for a running instance of tlp before trying to execute it, call that script from udev.

Offline

#18 2019-01-09 22:59:03

olocin
Member
Registered: 2018-01-03
Posts: 171

Re: [solved] udevd error after systemd update

I see, will try that and report, thanks.

Offline

#19 2019-01-09 23:26:20

loqs
Member
Registered: 2014-03-06
Posts: 19,104

Re: [solved] udevd error after systemd update

Or ask for the arch systemd package to cherry-pick https://github.com/systemd/systemd/comm … 7246c72feb (after testing it resolves your issue)

Offline

#20 2019-01-09 23:35:56

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,674

Re: [solved] udevd error after systemd update

The original tlp "error" that causes this would still remain in any event.

Offline

#21 2019-01-09 23:44:13

loqs
Member
Registered: 2014-03-06
Posts: 19,104

Re: [solved] udevd error after systemd update

Ah I read the systemd commit as changing behavior to only generating a message for a positive exit code at the debug level which I thought would mean no message should be generated by default.

Last edited by loqs (2019-01-09 23:44:26)

Offline

#22 2019-01-28 13:52:45

louisl
Member
Registered: 2017-02-03
Posts: 3

Re: [solved] udevd error after systemd update

TLDR

Exit code 4 = tlp already running. - this is safe to ignore for now as systemd will treat as debug output in a future release.

Offline

#23 2019-01-28 14:21:33

olocin
Member
Registered: 2018-01-03
Posts: 171

Re: [solved] udevd error after systemd update

Right, I'll mark as solved.

Offline

Board footer

Powered by FluxBB