Autostart scripts not running Fedora 34 KDE

On a fresh install of Fedora 34 KDE spin, scripts under ~/.config/autostart-scripts/ don’t run.

I’ve been using this in previous versions to ssh-add on login. Even a trivial script to log something just doesn’t get executed:

#!/bin/sh
echo "$(date) something!" >> ~/something.log

Creating an equivalent ~/.config/autostart/something.desktop does work. So it’s only the scripts that aren’t getting executed.

I’m sure I haven’t touched any other configs since setting up the ssh client is the first thing I do on a new workstation.

2 Likes

Hi there, script that should be executed on login usually reside in
/etc/profile
/etc/profile.d/ ## <<-- my suggestion would be here
or they are located in the users or system wide bashrc files.
~/.bashrc
/etc/bashrc

Those things under .config might not be that reliable, if that ever worked.
I believe there just resides userspace config data of various applications.
Maybe there is or was some auto start application?

1 Like

Wherever they should reside, this is a setting in the KDE setting that used to work. I have the same issue. I had a script at login to start conky and it no longer works. If I run that same script in a terminal it is working fine.

Worked perfectly fine in Fedora 33 KDE.

1 Like

@chillyshacktd @esamson
If you don’t mind could you add any additional information you have to: 1956022 – KDE doesn't run scripts in $HOME/.config/autostart-scripts

Thanks!

2 Likes

@grumpey I do not have any more info on this sorry. I checked the logs and don’t see anything related to this. If you want me to look or provide something specific let me know and I will check.

Incidentally, I’m also using X11 instead of Wayland. Besides that, I have nothing more to add.

As I understood you wanted to run some script as soon as someone logs in.

You can try to do the following.

create a file like this:
sudo touch /etc/profile.d/greeting.sh

Paste in the following content:

#!/bin/bash
echo Hello ${USER}!

Save and open a Terminal or login.

@huben you are misunderstanding the question.

$HOME/.config/autostart-scripts is a directory with scripts that a Plasma session should start when starting a desktop session. There are several directories with files the desktop session looks at. The best description I’m aware of is found on the Arch wiki.

In contrast, the various profile files are sourced by bash when it is started as an interactive login shell (and in a few other cases). That could be quite different. As an example a console login or SSH login, both non-graphical, should both source profile, but not do anything with .config/autostart-scripts. If you dig into the details, there are a lot of differences. (Changing the profile files in /etc would also affect all users, which wasn’t the intention as far as we know.)

As reported in the bug mentioned above, the autostart-scripts function broke in F34.

4 Likes

I thought for the use case of the opening poster, who wants to use it for ssh-add, this usual adds an ssh-key for the ssh-key-agent, it might be a workaround. One probably would use a terminal for that. So I’ve seen implementations that use a script in the bashrc or profile, but that’s a tat more complicated. For that scenario it could be fine to do it this way, for example by using it in the bashrc. But you are right, on the other hand the autostart-scripts are broken and this has other advantages. So sometimes it would be better to use those. One clearly is not starting a bash-session just by login to the desktop. And if you quit the terminal session, the desktop-session would still be active.

Edit
No, works, if you login to your desktop session, the bashrc is being sourced.
But it is sourced once more as soon as the user starts a terminal.

One could work around by adding this to the bashrc or profiled-script:

if [[ $doOnce == 1 ]]; then
echo “You already have been greeted.” >> ~/greetings.txt
else
echo “Hello ${USER}! It is $(date +%T) o’clock.” > ~/greetings.txt
export doOnce=1
fi

Now you can open Terminals as much as you want, and type in “cat ~/greetings.txt”.

Hi, @huben.

Thanks for trying to help. Sorry if ssh-add distracted the discussion but the problem really is about autostart-scripts.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.