I've created a simple startup script so that I can use my Ultrawide Monitor with Ubuntu 21.04 (should be similar with the previous version as well). However when I configured this script to be run on startup using 'Autostart' I get an error upon startup instead with the script unable to run. Manually running the script works fine - It's a pain to run it on every start manually....

Anyhow I get this error:

Warning: Could not start program '/home/user/scripts/2560x1080.sh' with arguments '/home/user/scripts/2560x1080.sh'.

Warning: execve: Exec format error

Also, here's the simple script:

#! /bin/bash
#cd /home/user/scripts/
xrandr --newmode "2560x1080_60.00" 230.00  2560 2720 2992 3424  1080 1083 1093 1120 -hsync +vsync
xrandr --addmode HDMI-2 2560x1080_60.00
xrandr --output HDMI-2 --mode 2560x1080_60.00

Thanks in advance

  • Have you tried chronjobs to initialize this script?
    – conmak
    Jul 27, 2021 at 18:29
  • Maybe these links: link 1 and link 2 can help you. The method is tested on verson 20.04 LTS of Ubuntu and Lubuntu.
    – sudodus
    Jul 27, 2021 at 18:47
  • 1
    Thanks for the crontab suggestion! Adding "@reboot sleep 10 && /home/user/scripts/2560x1080.sh" (no quotes) to the end of crontab didn't work and didn't provide an error message so I have no idea what went a rye :[ This is actually on KDE or Kubuntu...
    – Hamm
    Jul 27, 2021 at 23:07
  • Are you trying to run the script on startup or on login? Jul 29, 2021 at 17:50
  • I'm trying to run this on startup. I just want the monitor to work on it's native ultrawide resolution on startup. Am I creating a new "startscript.sh" that runs my 2562x1080.sh script that crontab will run?
    – Hamm
    Aug 3, 2021 at 12:15

1 Answer 1


Have you tried a cronjob yet?

You can use crontab for this:

crontab -e

At the bottom of the file you can add an item to run at reboot:


@reboot /home/{your user}/scripts/startscript.sh

Note: This may run before all of dependencies load. You may want to run the shell script asychronously (eg using & in bash) and add a sleep time to your shell script.

Note: You may want to play around with permissions a bit depending on if you want to run with sudo.

Note: sudo crontab -e is different than crontab -e


To add logging to your startscript.sh you can try piping the output of commands to a log file like this: /home/user/scripts/startscript.sh

# Source your bashrc for environment variables
# Note this uses . as source (old school unix) 
# because the source command might not be available depending on the OS
. /home/user/.bashrc
sleep 30
echo "Starting Log" > /home/user/scripts/log.txt
/home/user/scripts/myscript.sh >> /home/user/scripts/log.txt

Note: Paths should be absolute in chronjobs.

  • Did you try to run [a script with] xrandr from crontab @reboot? A script with xrandr works for me from autostart.
    – sudodus
    Jul 27, 2021 at 19:40

You must log in to answer this question.

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