LXDE desktop autostart not working

Creating a bug report/issue

I have searched the existing open and closed issues

Required Information

  • DietPi version | cat /boot/dietpi/.version
    G_DIETPI_VERSION_CORE=9
    G_DIETPI_VERSION_SUB=10
    G_DIETPI_VERSION_RC=0
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’
    G_LIVE_PATCH_STATUS[0]=‘applied’
    G_LIVE_PATCH_STATUS[1]=‘not applicable’
    G_LIVE_PATCH_STATUS[2]=‘not applicable’
    G_LIVE_PATCH_STATUS[3]=‘applied’

  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN
    bookworm 0

  • Kernel version | uname --all
    Linux sonospi 6.6.74+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.74-1+rpt1 (2025-01-27) aarch64 GNU/Linux

  • Architecture | dpkg --print-architecture
    arm64

  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3)
    RPi 3 Model B (aarch64)

  • Power supply used | (EG: 5V 1A RAVpower)
    CanaKit 2.5A (Micro USB)

  • SD card used | (EG: SanDisk ultra)
    SanDisk 32GB

Additional Information (if applicable)

node-sonos-http-api
music-screen-api
fresh install of DietPi

Steps to reproduce

Tried various dietpi-config AutoStart Options

Expected behaviour

DietPi boots into LXDE desktop, runs autostart commands, loads music-screen app (see below)

Actual behaviour

Typically terminal prompt with various errors, including permission errors, unable to open display, etc. (see below)

Extra details

I’m trying to move this Sonos Album Art music display project from a (older) stock Raspberry Pi install to a DietPi install:

The project uses a Raspberry Pi 3, a Hyperpixel Square Display, the node-sonos-http-api (to get Sonos track info) and the music-screen-api (to show the album art on the display).

So I’ve followed all the steps there, and have got the script(s) working. (I can VNC in and run the music-screen-api go_sonos_highrez.py Python script and show the currently playing track album art on the VNC window display as expected.)

The problem is I can’t get Step 9: Make it run on startup working:

The tutorial (which is from many years ago) directs you to edit the LXDE autostart file:

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

The first thing I noticed is the Dietpi uses this path instead:

/etc/xdg/lxsession/LXDE/autostart

I tried editing that file, but it has no affect. I’ve read various threads here and elsewhere about creating a user (non-root) version of that autostart file in a user’s .config directory, but that has no effect either.

I’ve also tried the DietPi custom.sh script autostart with autologin (both as root user and non-root user), but that produces the terminal errors mentioned above, such as:

xset:  unable to open display ""

Any ideas or advice? I’m sure it is my lack of experience that I am missing something – appreciate any help/info.

Thanks.

If I select AutoStart > Desktops > 2: Automatic login

the pi will load a desktop onto the Hyperpixel (hat) display, with a blank screen and cursor (no album art).

If I VNC in, the album art will display in the VNC (using the :1 display) window. If I log in locally on the Pi, and pull up the LXTerminal and run the python script:

python3 music-screen-api/go_sonos_highres.py

The album art will display correctly and as expected on the Hyperpixel display. So clearly I have the wrong autostart (script) location and/or settings to target the hat display installed on the pi.

Any ideas?

Since I’ve eliminated all the LXDE autostart files (the root and user instances, even trying both the LXDE and LXDE-pi paths) and still get the same blank/black screen with a cursor in the middle, I assume this issue is the autostart file isn’t being loaded for X11.