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) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B0F36158004 for ; Sun, 7 Apr 2024 19:59:15 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8F0EEE2A2F; Sun, 7 Apr 2024 19:59:09 +0000 (UTC) Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) (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 2BA5DE29F3 for ; Sun, 7 Apr 2024 19:59:09 +0000 (UTC) Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6ed0938cd1dso1790873b3a.2 for ; Sun, 07 Apr 2024 12:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712519947; x=1713124747; darn=lists.gentoo.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=WODJQhO0VNw2L1mUCveoWYxkCtgIzMNx+tCfXCmXweI=; b=cm6pGf77uPy1FiF3tjOK86JRYNiPXRmXgsBrJ/0QCm5Aw8Dq30Tn73uYdbGKydyZWa 256fWYgQK7uSiExglfF/AUeKyrAkvpiA5ONxsr4XgZcbbD0fEwO4iW0hKEkRjrk/NpWn X2cE8cxa0X259v6+mGWGa4OLaug+Lk29BiwgcnC10liaCL5gkK/aKc4uq1iMxVVbqpKv J2EjFle8SA1pUtZTLm0xNIU0FSox55pdAa2SkYx1GC3s0IfmazsaZEUgq+tRW0JcfMU/ vFpCnkqNb5ruMMogokDjcndCTfui9UUKxDpLSQE+pEZzjxczp6J6mO7pKTR52oANaZ7P 4GUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712519947; x=1713124747; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WODJQhO0VNw2L1mUCveoWYxkCtgIzMNx+tCfXCmXweI=; b=E3nAFhFgu8p99KxKMgWpdvnheakCb+0LssIq+QZmhjxwZ4tDyMnCDWtAmrIrfMkUdT zgIm3Ia8OjwrZsTBD/fnVJKVYsWGrR+WqbHhXByL8l2/RrsPuhZNBcQIXFF8oZe/E5JX kGIumDkdcV/kX6MsynEVyveKvJIDSCz73XgsmjY/GHxrgyTigHxeaFLzSovk3qXDsxPn ncBCyYkvzlZz3KA1cuXozzAErt8Ih0yTJ1rYYpTMovc0FwyZrudXRKGZbfk5a7SEhK9n ZmkJDSDgmDbUMORCzIWw7BuLI6RhOLp76HyqhQvz5ERo91D/zDyjgEiQK01bgafOWEYv WOJQ== X-Gm-Message-State: AOJu0YxamGAs1ubr/eUNByfMJUgrtPnhCiQfP7KGG1zu/YKusExWTkuq 0uodzkBBe/we3M8RMDenMVXhJmlQpe37HVzyc4EauJFW6WVjdKTdTT/bjfkI X-Google-Smtp-Source: AGHT+IF03le0U8ZPGTz+JCzSmd4UmrqyM54oGjLUcIk+vJcMwaD4hXoNvSQJqIQ/co5LrdCkpWzuVw== X-Received: by 2002:a05:6a00:4f93:b0:6ec:ff5e:7e66 with SMTP id ld19-20020a056a004f9300b006ecff5e7e66mr9474240pfb.1.1712519947171; Sun, 07 Apr 2024 12:59:07 -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 x22-20020a056a000bd600b006ea6ca5295bsm5019394pfu.164.2024.04.07.12.59.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Apr 2024 12:59:06 -0700 (PDT) Message-ID: <03d858ca-17cf-4d22-8e06-2ed99cc5a2ee@gmail.com> Date: Sun, 7 Apr 2024 12:59:05 -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 Subject: Re: [gentoo-user] systemd unit executing but not persistent later in boot To: gentoo-user@lists.gentoo.org References: <395ad795-24c9-4f78-b0f9-75119e859ddf@gmail.com> Content-Language: en-US From: Daniel Frey In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Archives-Salt: db6c684f-a147-4c74-a145-4fbd4af99911 X-Archives-Hash: 507ef52638e4aca9f57c88aab354f365 On 4/6/24 18:38, Andrew Udvare wrote: > On Sat, 6 Apr 2024 at 21:32, Daniel Frey wrote: >> What's even stranger is if I manually start it and restart lircd it works! > > Have you tried adding Before=lircd.service in the [Unit] section? > OK, I have finally sorted out the IR keymap/lircd/irexec/LCDd problems. It turns out the systemd units as shipped just simply do not work, at least for my hardware. The custom unit I made to apply a new keytable and protocol change was working fine. After a lot of reading about systemd units and also poring through logs, I discovered udev was triggering something related to the LCD/IR module - my custom unit was running before this happened but the udev trigger reset it to defaults (for whatever reason.) In order to fix that, I had to change my unit to this: [Unit] Description=Add custom keymap to iMon remote Requires=systemd-udevd.service systemd-udev-settle.service systemd-udev-trigger.service After=systemd-udevd.service systemd-udev-settle.service systemd-udev-trigger.service Before=lircd.service inputlircd.service irexec.service [Service] RemainAfterExit=true ExecStart=/usr/bin/ir-keytable -c -p rc-6 -w /etc/rc_keymaps/imon_mce.toml [Install] WantedBy=multi-user.target RequiredBy=lircd.service irexec.service This made the keymap change work reliably. After this lircd was working normally. I use lircd so I can use irexec to listen for the power button and just shut the computer off. Kodi is too finicky and just wouldn't turn off or it would just logout, even with the polkit policy in the wiki applied. Now, starting irexec didn't work the the shipped systemd unit either, it would just exit and not stay running. I fixed that with this custom unit: [Unit] Documentation=man:irexec(1) Documentation=http://lirc.org/html/configure.html Documentation=http://lirc.org/html/configure.html#lircrc_format Description=Handle events from IR remotes decoded by lircd(8) After=lircd.service Requires=lircd.service [Service] ; user=lirc ; group=lirc ; Hardening opts, see systemd.exec(5). Doesn't add much unless ; not running as root. If these are applicable or not depends on ; what commands irexec.lircrc invokes. ; ; NoNewPrivileges=true ; MemoryDenyWriteExecute=true ; PrivateTmp=true ; ProtectHome=true ; ProtectSystem=full Type=forking ExecStart=/usr/bin/irexec --daemon /etc/lirc/irexec.lircrc [Install] WantedBy=multi-user.target So irexec would start and actually stay running. I did also tell it to start after lircd (although I'm not 100% sure this matters - it may not.) Of course the LCD unit wouldn't start and stay running either, again the systemd unit shipped didn't work so I customized it: [Unit] Description=LCDProc (LCDd) After=network-online.target lircd.service Requires=lircd.service [Service] ExecStart=/usr/sbin/LCDd -c /etc/LCDd.conf Type=forking [Install] WantedBy=multi-user.target After all this, then Kodi wouldn't start up. I figured out quickly this was caused by lightdm starting before the network was ready, fixed with this custom unit: [Unit] Description=Light Display Manager Documentation=man:lightdm(1) After=systemd-user-sessions.service After=network-online.target Wants=network-online.target [Service] ExecStart=/usr/sbin/lightdm Restart=always IgnoreSIGPIPE=no BusName=org.freedesktop.DisplayManager [Install] Alias=display-manager.service Hopefully this may be helpful to others with HTPCs switching to systemd from openrc. In openrc nearly all of this customization isn't needed - I only modified /etc/init.d/lircd in openrc in order to load the keymap before lircd started. Dan