453 views
in System Integration by
How can I run the GUI automatically when booting Raspberry?

I have already tried it with /etc/rc.local, unfortunately no success.

2 Answers

0 votes
by

Hi,

so far I think the simplest way to achieve an autostart of an application is to adapt the /etc/rc.local file...

Did you transfer the binary? Do you get an error messages?

Maybe some Raspberry Pi forums can give you better support concerning this question as this is more related to Raspberry Pi rather than GUI development with Embedded Wizard.

Best regards,
Manfred.

by
I've also tried it with "systemd", unfortunately without success.

 

Jun 14 11:48:45 SFA EmbeddedWizard-RasPi-CM4[1521]: error: XDG_RUNTIME_DIR not set in the environment.
Jun 14 11:48:45 SFA EmbeddedWizard-RasPi-CM4[1521]: Initialize Display...                        [OK]
Jun 14 11:48:45 SFA EmbeddedWizard-RasPi-CM4[1521]: Initialize Touch Driver...                   [OK]
Jun 14 11:48:45 SFA EmbeddedWizard-RasPi-CM4[1521]: Initialize Memory Manager...                 [OK]
Jun 14 11:48:45 SFA EmbeddedWizard-RasPi-CM4[1521]: Initialize Graphics Engine...                [OK]
Jun 14 11:48:45 SFA EmbeddedWizard-RasPi-CM4[1521]: Create Embedded Wizard Root Object...        [OK]
Jun 14 11:48:45 SFA EmbeddedWizard-RasPi-CM4[1521]: Create Embedded Wizard Viewport...           [OK]
Jun 14 11:48:45 SFA EmbeddedWizard-RasPi-CM4[1521]: Error in opening file
Jun 14 11:48:46 SFA systemd[1]: ensure-file-exists.service: Main process exited, code=killed, status=11/SEGV
Jun 14 11:48:46 SFA systemd[1]: ensure-file-exists.service: Failed with result 'signal'.
by
Difficult to say....

On other Linux targets it is necessary to define the XDG_RUNTIME_DIR and a few other environment variables.

Can you try to start the binary with

XDG_SESSION_ID=c2 XDG_RUNTIME_DIR=/run/user/0 WAYLAND_DISPLAY=/run/wayland-0 ./EmbeddedWizard-RasPi-CM4

or

XDG_SESSION_ID=c2 XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-1  ./EmbeddedWizard-RasPi-CM4
by
If I copy the "EmbeddedWizard-RasPi-CM4" file to "/home/pi" and run it with "./EmbeddedWizard-RasPi-CM4", I get the following error:

pi@SFA:~ $ ./EmbeddedWizard-RasPi-CM4
Using drm device node '/dev/dri/card1'!
Available display interface(s):
HDMI_0
HDMI_1
DSI_0 (selected)
Display interface 'DSI_0' detected.

Available output modes:
  800 x  480 @ 60Hz (pixel clock:   25979kHz) (preferred mode)
Selected display mode: 800x480@60Hz (pixel clock: 25979kHz)
(Preferred display mode requested)

Initialize Display...                        [OK]
Initialize Touch Driver...                   [OK]
Initialize Memory Manager...                 [OK]
Initialize Graphics Engine...                [OK]
Create Embedded Wizard Root Object...        [OK]
Create Embedded Wizard Viewport...           [OK]
Error in opening file
Segmentation fault
by
Now I have another problem.
before it was always "error: XDG_RUNTIME_DIR not set in the environment". This is only set when a user is logged into a session.
I turned on "Autologin" in "raspi-config" and added the following to "~/.bashrc":
"cd /home/pi/RasPi-CM4/Application/Project"
and
"./EmbeddedWizard-RasPi-CM4"
Now the file will run without the "Error in opening file" error.

Unfortunately, the following comes up: Initialize Display... [failed]
by
Hi,

I already forwarded this question to one of my colleagues who is more familiar with this topic. He is out of office this week. I hope that we can find some helpful answer next week.

Best regards,

Manfred.
0 votes
by

Hi AlexanderMaron,

I just tried with latest RasPi-CM4-BuildEnvironment V12.00.01.00 and I could realise auto-starting an Embedded Wizard application using systemd as follows.

  1. copying application binary 'EmbeddedWizard-RasPi-CM4' to folder /home/pi (for example)
     
  2. adding file '/lib/systemd/system/ewdemo.service' with following content:
    [Unit]
    Description=Autostart Embedded Wizard Demo
    Wants=systemd-udev-settle.service
    After=systemd-udev-settle.service
    
    [Service]
    Type=simple
    User=root
    ExecStart=/home/pi/EmbeddedWizard-RasPi-CM4
    
    [Install]
    WantedBy=multi-user.target
    
     
  3. adapting permissions of '/lib/systemd/system/ewdemo.service'
    chown root:root /lib/systemd/system/ewdemo.service
    chmod 644 /lib/systemd/system/ewdemo.service
     
  4. adding following symbolic link:
    cd /etc/systemd/system/multi-user.target.wants
    ln -s /lib/systemd/system/ewdemo.service ewdemo.service
     
The added ewdemo.service can be testet with following command:
systemctl start ewdemo.service

After rebooting 'EmbeddedWizard-RasPi-CM4' should start automatically.
 
During my tests I used a HDMI display on HDMI0 connector. 
Which display / display connector are you using?

Regarding XDG_RUNTIME_DIR:
XDG_RUNTIME_DIR and further XDG environment variables are defined as long as you are logged in as normal user. As soon as you change to root user these environment variables are no longer available and would have to be set manually or via '.bashrc' for example. However, in our case XDG_RUNTIME_DIR seems not really to be needed.

Please let me know, if this solution is also working on your environment.

Kind Regards,
Martin
by

I get the error message from the following picture

by
Are you using one of the unchanged provided Examples of the Embedded Wizard BuildEnvironment or are you using your own application?
I'm asking regarding the message "Error in opening file" since no files are opend in the provided examples.
by
I have my own project in which I call config.txt, for example.
by
And is it working with one of the examples?

Embedded Wizard Website | Privacy Policy | Imprint

...