In the last two days, I've noticed that something starts youtube-dl when I start my system (Debian 11); it seems to be as soon as I login. The reason I noticed is that it steals all resources and I have to go to a console with Ctl-Alt-F2 and log in as root. Killing the process doesn't help - it seems to be part of a job stream, so the only way is to temporarily rename the python executable, which makes them fail quickly.

I suspect it is related to the fact that I have been downloading a large number of small videos for a course, but where does it actually start from?


I think I may have found what the problem was - I will see when I get a chance to reboot (or just log out/in). It was quite subtle; I couldn't find any reference to youtube-dl in any file that has anything to do with sddm (since I use KDE), except for my .local/share/sddm/xorg-session.log, where it says:

/etc/sddm/Xsession: 70: /etc/profile: function: not found
Error: /undefinedfilename in (/usr/bin/startplasma-x11.ps)
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push
Dictionary stack:
   --dict:733/1123(ro)(G)--   --dict:0/20(G)--   --dict:75/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 9.53.3: Unrecoverable error, exit code 1
rm: cannot remove '/usr/bin/startplasma-x11.ps': No such file or directory
/etc/sddm/Xsession: 78: /etc/profile: function: not found
ERROR: [something very long ...]\ufffd\x03\x12\x08' is not a valid URL. Set --default-search "ytsearch" (or run  youtube-dl "ytsearch:^?ELF^B^A^A^C^C>^A0M@��@8^K@^^^]^F^D@@@h^Bh^B^H^C^D�^B�^B�^B^\^\^A^A^D�=�=^P^A^E@@@^]O^]O^P^A^D����#�#^P^A^Fh�h�hǨ^H�^H^P^B^Fp�p�pȀ^B�^B^H^D^D�^B�^B�^BDD^DP�td^Dh�h�h��^A�^A^DQ�td^F^PR�td^Dh�h�hǘ^H�^H^A/lib64/ld-linux-x86-64.so.2^D^T^CGNU���eBFD�ӝ^C�^KC�u�U�^D^P^AGNU^C^B^C�^A^F�@�^A^H����|�e�mCE���qX^\�^R^Rj^G^R^_^L^RB^P^R^H^B^R�^S^R^_^U^R�^C^R^H" ) to search YouTube

Looking at the first line of /etc/sddm/Xsession

#! /bin/sh
# Xsession - run as user


I suddenly realised that the old Bourne shell doesn't understand the newer shell function syntax function xyz, but requires xyz() instead - hence the error message in .local/share/sddm/xorg-session.log. I had just defined a function that calls youtube-dl when the problem started; the Xsession script sources /etc/profile, can't handle function and then runs what is inside the function definition, ie youtube-dl, with whatever parameter happen to be defined in Xsession.

1 Answer 1


If you want to find out what's spawning it, use ps axuf; this will show the process list in tree format, which in turn should let you spot which process spawned it and keeps respawning it.

youtube-dl definitely should not be doing this by itself; did you use something else to automate the "downloading a large number of small videos" part?

  • Great tip! I'll try that when I restart my system. As for what I did, I didn't do anything - which is to say, I upgraded to the latest version (youtube-dl -U), and I created a couple of shell functions - basically wrappers to alow me to easily download a list of videos from URLs in a text file.
    – j4nd3r53n
    Mar 13, 2022 at 9:01
  • 1
    I've accepted this answer as it has helped me get a lot closer. As it turns out, it is started by /bin/sh /etc/sddm/Xsession /usr/bin/startplasma-x11. Now I need to find out why this happens.
    – j4nd3r53n
    Mar 14, 2022 at 7:43
  • Going out on a limb a bit since I don't have all that much experience with plasma as a window manager, but I'm going to guess that one of the shell scripts wound up in plasma's run-after-startup section somehow. Mar 14, 2022 at 8:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .