Re: [systemd-devel] Manual start of user@.service failed with permission denied
On 2023-12-07 23:03, Lennart Poettering wrote: The 503 is a system user. So, just to try it out, I created a user, which got the UID 1001. Using that UID gave me the same result as the 503. It's a bad idea to run user stuff as system user. Lennart Why's that? Best regards, Aki
Re: [systemd-devel] rc-local.service and its future in systemd?
If you'd still like to continue using /etc/rc.d/rc.local, and it would be enough for it to be executed "after boot", IOW, after the default runlevel at boot is reached, the following four commands might help you: $ cat >/tmp/order-last.conf < Did you test this yourself? I couldn't get it to work. If I don't disable systemd-rc-local-generator, it'll create a multi-user.target.wants for rc-local.service in /run/systemd. rc-local.service is also referenced in multiple other service files in /usr/lib/systemd/system. I arrived into this following config that is now working: 1) # /etc/systemd/system/rc-local.service.d/override.conf [Unit] After=systemd-user-sessions.service [Install] WantedBy=default.target 2) mkdir /root/systemd mv /usr/lib/systemd/system-generators/systemd-rc-local-generator /root/systemd/ ln -s /dev/null /usr/lib/systemd/system-generators/systemd-rc-local-generator 3) chmod 700 /etc/rc.d/rc.local systemctl enable rc-local.service As one Red Hat employee once said: "And I'm pretty sure that the people who still insist on using it would shout at us very loudly if rc-local.service were removed...". I hope rc-local.service can be kept in systemd in the future. Best regards, Aki P.S. My hunch was correct and rc.local is now (After=systemd-user-sessions.service) ran after crond. root1045 0.0 0.0 3272 1792 ?Ss 19:58 0:00 /usr/sbin/atd -f root1046 0.0 0.0 224304 3584 ?Ss 19:58 0:00 /usr/sbin/crond -n root1047 0.0 0.0 222940 3328 ?Ss 19:58 0:00 /bin/bash /etc/rc.d/rc.local start root1049 0.0 0.0 224692 3328 ?R19:58 0:00 \_ ps auxwwf root1050 0.0 0.0 238216 3200 ?S19:58 0:00 \_ sort -n -k 2,2 cat /etc/rc.d/rc.local #!/bin/bash date > /var/tmp/boot.ps ps auxwwf | sort -n -k 2,2 >> /var/tmp/boot.ps
Re: [systemd-devel] rc-local.service and its future in systemd?
If you'd still like to continue using /etc/rc.d/rc.local, and it would be enough for it to be executed "after boot", IOW, after the default runlevel at boot is reached, the following four commands might help you: $ cat >/tmp/order-last.conf < Isn't that the same as running "systemctl edit rc-local.service" and then enter that config there? Best regards, Aki
Re: [systemd-devel] rc-local.service and its future in systemd?
Would it be possible to change the rc-local.service configuration as follows, so that it could be used similarly as before i.e. running close to the end of the "runlevel" or systemd target: [Unit] After=crond.service Why crond? Why is that the "end of the runlevel"? I checked the service startup after boot with "journalctl -b 0 -t systemd" and it showed crond starting near the end of the target. Is there some issue with setting rc-local.service for "After=systemd-update-utmp-runlevel.service" ? It caused that cyclic dependency problem. Best regards, Aki
Re: [systemd-devel] rc-local.service and its future in systemd?
> > This totally depends on the unit you wrote. Without it, we can't help. In general, ignore and forget the run level concept. > > BR > > Silvio > > I only changed these settings in rc-local.service: > > > [Unit] > After=systemd-update-utmp-runlevel.service > > [Install] > WantedBy=default.target > > and disabled /usr/lib/systemd/system-generators/systemd-rc-local-generator from running. > When I tried to boot, the system didn't come up any more. > Well, you created a circular dependency. Just don't use the rc-local.service at all, but put the commands from there in their own .service units. Think about their dependencies and order Proper with Wants=, Before= and After=. If you're able to share your rc.local script, than we can help. The cyclic dependency problem doesn't come from the rc.local file, but from systemd. I only run one simple command in it. Best regards, Aki
Re: [systemd-devel] rc-local.service and its future in systemd?
> I tried to set After=systemd-update-utmp-runlevel.service but I got some cyclic dependency problem. Would you know how to do that? > > Best regards, > > Aki > This totally depends on the unit you wrote. Without it, we can't help. In general, ignore and forget the run level concept. BR Silvio I only changed these settings in rc-local.service: [Unit] After=systemd-update-utmp-runlevel.service [Install] WantedBy=default.target and disabled /usr/lib/systemd/system-generators/systemd-rc-local-generator from running. When I tried to boot, the system didn't come up any more. Best regards, Aki
Re: [systemd-devel] rc-local.service and its future in systemd?
as Lennard already told you in the GitHub issue that "last" just doesn't make sense in systemd, there is also no need to change the dependencies global for everyone. Especially as there are systems out there which doesn't have crond installed (because there are .timer). Your best bet is really to change all your custom scripts from rc.local into proper .service and instead of crond check out systemd.timer. BR Silvio I tried to set After=systemd-update-utmp-runlevel.service but I got some cyclic dependency problem. Would you know how to do that? Best regards, Aki
Re: [systemd-devel] rc-local.service and its future in systemd?
I tried to set After=systemd-update-utmp-runlevel.service but I got some cyclic dependency problem. Would you know how to do that?Best regards,AkiOn Apr 24, 2023 12:24 PM, killermoe...@gmx.net wrote:
Re: [systemd-devel] rc-local.service and its future in systemd?
I forgot to add that I also disabled /usr/lib/systemd/system-generators/systemd-rc-local-generator from running as it added rc-local.service to multi-user.target (in /run/systemd).Best regards,AkiOn Apr 24, 2023 11:57 AM, Aki Ketolainen wrote:
[systemd-devel] rc-local.service and its future in systemd?
Hi, I noticed in Rocky Linux 8.7 LXC container image that they've added a message to /etc/rc.d/rc.local: # In contrast to previous versions due to parallel execution during boot # this script will NOT be run after all other services. I created an issue report on this at github: https://github.com/systemd/systemd/issues/27340 "How to run /etc/rc.d/rc.local as the last Linux bootup task?" Would it be possible to change the rc-local.service configuration as follows, so that it could be used similarly as before i.e. running close to the end of the "runlevel" or systemd target: [Unit] After=crond.service [Install] WantedBy=default.target chmod 700 /etc/rc.d/rc.local systemctl enable rc-local.service I tested this and see in ps output (ps auxwwf | sort -n -k 2,2 >> /var/tmp/boot.ps) that it starts after crond in both multi-user.target and graphical.target. Best regards, Aki