From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id AA638158041 for ; Sun, 7 Apr 2024 01:32:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 593F0E2A3B; Sun, 7 Apr 2024 01:32:11 +0000 (UTC) Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 01749E2A33 for ; Sun, 7 Apr 2024 01:32:10 +0000 (UTC) Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-2a485169476so1070579a91.1 for ; Sat, 06 Apr 2024 18:32:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712453529; x=1713058329; darn=lists.gentoo.org; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=xpuaPX7DIbcnHA9+zT5q3uUjW6mqj18HkWZJ/D3raOg=; b=lUQz6mYlGQpME7yU75FPVyU3qrLTi/EgVdaSiAcQEGiFR5luZBWQ8B2hWSEsM1eMmg PJ8fRvXwBSirqBUsTe7xKBCizGfpAIKbdZtFjgxZLUt7+Lgz1xrFudgDLHfoXZZVDpAY M73UgAeORvnCf8yx/Wkor8oLJJqN3QaMvV56dxe7i/+LbYlUyCWsQetQRq2PV6hMrEwP QO8CMRHzJYmmJmQZuEHcZ8Anysim1eSXOrtUVktm2L/0RYK1SEO8OrSL4hKay5M8Or3S TkHE5rAXPGCaffCCUP2fAFTLf5ksWVFhKF+kImdtdc7B8L/1jvOPtzimhSpHNZPJUH/A 6tRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712453529; x=1713058329; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=xpuaPX7DIbcnHA9+zT5q3uUjW6mqj18HkWZJ/D3raOg=; b=QId0PaQ/VjCQynshrKRkgBQVv2Fx9yak2R5tUC68xSqzDtgUYKUBv+pRlbvetXi5zH P+Nrtj/ZzNe6BogPmOoxc0QD82tYlgup2z56bdxrrgfCv8dnbd50ZQVEKVc3KHpCXARC umMAHCtwgsLJQGXNdTTuOYCOP/uU+tDr7Z1Z3eOLylW2897Hfs+SCYShLmhUkCZZh1Kt ttdCCdkP3+vUYa0xmN+otKJYpo71B+J853gbCK88aaBf/+X0FZtuNCPm4IMZ9Nz39h5p P/KIMar6BpzQ01nhuTPKDgwMYsHaVaMtl+At53ywObV7x8Cmrqr4hhzQwceQN/PHDFJQ fN0g== X-Gm-Message-State: AOJu0YztzQuMYMs08Ozlfo7UeC6YcpYIADK3kn4u2Y8UilX1awVcs1oG ROUsyAUGd/x8AWGAfA2hbnkNN3LoBrq56JzB5SU03H/buqnm9Lx0Mq6GLICm X-Google-Smtp-Source: AGHT+IFLcD9zm9/r6QgT5W5eCrLnDar58XaWawK6faB/q8CLddIe9B34CzeBO18lI0Z1b3+pUTIdoA== X-Received: by 2002:a05:6a21:6d8b:b0:1a3:bde1:3c7b with SMTP id wl11-20020a056a216d8b00b001a3bde13c7bmr5367795pzb.2.1712453528995; Sat, 06 Apr 2024 18:32:08 -0700 (PDT) Received: from [192.168.247.5] (d206-116-145-237.bchsia.telus.net. [206.116.145.237]) by smtp.gmail.com with ESMTPSA id j7-20020a170902da8700b001e2a7e90321sm4031352plx.224.2024.04.06.18.32.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 06 Apr 2024 18:32:08 -0700 (PDT) Message-ID: <395ad795-24c9-4f78-b0f9-75119e859ddf@gmail.com> Date: Sat, 6 Apr 2024 18:32:07 -0700 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: gentoo-user@lists.gentoo.org From: Daniel Frey Subject: [gentoo-user] systemd unit executing but not persistent later in boot Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Archives-Salt: e2e64263-cdc6-4108-a085-e8e61ee25999 X-Archives-Hash: 5477f83e7771a61f8aac4d70dfce5628 Hi all, Still new to systemd and am struggling with a custom unit file. Some background: I have a HTPC that requires loading a custom keymap in order for the remote to work. It sets up an alternate protocol that the driver supports but not defaults to. In short: # ir-keytable Found /sys/class/rc/rc0/ with: Name: iMON Remote (15c2:0038) Driver: imon Default keymap: rc-imon-pad Input device: /dev/input/event8 LIRC device: /dev/lirc0 Supported kernel protocols: rc-6 imon --> Enabled kernel protocols: imon bus: 3, vendor/product: 15c2:0038, version: 0x0001 Repeat delay = 500 ms, repeat period = 125 ms This protocol needs to change to rc-6. This is done by a simple command: /usr/bin/ir-keytable -c -p rc-6 -w /etc/rc_keymaps/imon_mce.toml So my thought was to create a custom Unit: [Unit] Description=Add custom keymap to iMon remote [Service] ExecStart=/bin/bash -c "exec /usr/bin/ir-keytable -c -p rc-6 -w /etc/rc_keymaps/imon_mce.toml" I've called it ir-key-map.service. I can see through the status that it is indeed running and applying the keymaps and protocol changes: # systemctl status ir-key-map ○ ir-key-map.service - Add custom keymap to iMon remote Loaded: loaded (/etc/systemd/system/ir-key-map.service; enabled; preset: disabled) Active: inactive (dead) since Sat 2024-04-06 18:17:43 PDT; 6min ago Duration: 46ms Main PID: 292 (code=exited, status=0/SUCCESS) CPU: 12ms Apr 06 18:17:43 htpclivingrm systemd[1]: Started Add custom keymap to iMon remote. Apr 06 18:17:43 htpclivingrm bash[292]: Read imon_mce table Apr 06 18:17:43 htpclivingrm bash[292]: Old keytable cleared Apr 06 18:17:43 htpclivingrm bash[292]: Wrote 76 keycode(s) to driver --> Apr 06 18:17:43 htpclivingrm bash[292]: Protocols changed to rc-6 Apr 06 18:17:43 htpclivingrm systemd[1]: ir-key-map.service: Deactivated successfully. As the output says, it ran successfully. lircd also is running after this unit like it's supposed to (snipped from `journalctl --unit lircd`: Apr 06 18:17:43 htpclivingrm systemd[1]: Starting Flexible IR remote input/output application support... However, the remote does not work. When I log in and check: # ir-keytable Found /sys/class/rc/rc0/ with: Name: iMON Remote (15c2:0038) Driver: imon Default keymap: rc-imon-pad Input device: /dev/input/event8 LIRC device: /dev/lirc0 Supported kernel protocols: rc-6 imon ARGH --> Enabled kernel protocols: imon bus: 3, vendor/product: 15c2:0038, version: 0x0001 Repeat delay = 500 ms, repeat period = 125 ms It's like the unit is running in an isolated environment or something which is not at all helpful. What's even stranger is if I manually start it and restart lircd it works! `systemctl start ir-key-map` `systemctl restart lircd` ...and it is set up normally and the remote works: # systemctl start ir-key-map # systemctl restart lircd # ir-keytable Found /sys/class/rc/rc0/ with: Name: iMON Remote (15c2:0038) Driver: imon Default keymap: rc-imon-pad Input device: /dev/input/event8 LIRC device: /dev/lirc0 Supported kernel protocols: rc-6 imon YAY --> Enabled kernel protocols: rc-6 bus: 3, vendor/product: 15c2:0038, version: 0x0001 Repeat delay = 500 ms, repeat period = 125 ms So why does this not work at boot time? Are these units spawned in an environment on their own and thusly not modifying the main system? I'm quite confused. In openrc I just edited /etc/init.d/lircd and put the ir-keytable command in it before lircd was started and it was working fine. Can someone give some pointers? Dan