element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Single-Board Computers
  • Products
  • Dev Tools
  • Single-Board Computers
  • More
  • Cancel
Single-Board Computers
Forum how to write a system service to auto startup chromium on wayland with non-root user?
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Single-Board Computers requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 8 replies
  • Subscribers 57 subscribers
  • Views 4974 views
  • Users 0 members are here
Related

how to write a system service to auto startup chromium on wayland with non-root user?

gonewtinwind
gonewtinwind over 4 years ago

Hi Joshua  & all

 

I use the below system service can auto startup chromium on maaxboard wayland with root user, but it's not safe with root user, so I need to startup with non-root user.

I tried to modify it somewhere, but not work.

any help?

 

my service ,you can see it's root user with --no-sandbox option :

/etc/systemd/system/chromium.service

----

 

Description=launch chromium

 

[Service]

User=root

Environment=DISPLAY=:0

Environment=XDG_RUNTIME_DIR="/run/user/0"

Type=oneshot

ExecStart=/bin/sleep 15

ExecStart=/usr/bin/chromium --no-sandbox --disable-infobars --user-data-dir=/tmp/chromium --gpu-no-context-lost --enable-gpu-rasterization --start-fullscreen --kiosk --no-first-run --incognito http://localhost:3300/rpi.html > /dev/null 2>&1 &

 

[Install]

WantedBy=multi-user.target

 

ref:can not auto startup chromium(chromium-ozone-wayland)

  • Sign in to reply
  • Cancel

Top Replies

  • jafoste4
    jafoste4 over 3 years ago +1
    Hi Peter, Did you have success in finding a solution to this? Here is our reccomendation " It could be specified one user in system service , For example, let user ‘avnet’ start this service, then modify…
  • jafoste4
    jafoste4 over 3 years ago in reply to gonewtinwind +1
    Hi Peter, This should solve your problem. Refer to the following steps to solve this problem: 1 start the weston desktop on maaxboard with ‘avnet’ user. (Refer to the guide in PDF form below for detailed…
  • jafoste4
    jafoste4 over 3 years ago

    Hi Peter,

     

    Did you have success in finding a solution to this?

     

    Here is our reccomendation

    "

    It could be specified one user in system service , For example, let user ‘avnet’ start this service, then modify the property:

    /etc/systemd/system/chromium.service

    [Service]

    User=avnet

     

    Another method is to delete the property ‘’ User=’’ , then any user could use the service.

    "

     

    Thanks,
    Josh

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • gonewtinwind
    gonewtinwind over 3 years ago in reply to jafoste4

    Hi Josh,

    no work!

     

    debug

     

     

    systemctl status chromium.service

    * chromium.service - launch chromium

       Loaded: loaded (/etc/systemd/system/chromium.service; enabled; vendor preset>

       Active: failed (Result: signal) since Tue 2021-05-25 18:47:53 UTC; 2min 26s >

      Process: 832 ExecStart=/bin/sleep 15 (code=exited, status=0/SUCCESS)

      Process: 833 ExecStart=/usr/bin/chromium --user-data-dir=/tmp/chromium --gpu->

    Main PID: 833 (code=killed, signal=TRAP)

     

     

    May 25 18:47:37 maaxboard systemd[1]: Starting launch chromium...

    May 25 18:47:52 maaxboard chromium[833]: [833:833:0525/184752.979981:ERROR:wayl>

    May 25 18:47:52 maaxboard chromium[833]: [833:833:0525/184752.980050:FATAL:ozon>

    May 25 18:47:53 maaxboard systemd[1]: chromium.service: Main process exited, co>

    May 25 18:47:53 maaxboard systemd[1]: chromium.service: Failed with result 'sig>

    May 25 18:47:53 maaxboard systemd[1]: Failed to start launch chromium.

     

    both following services:

     

    1

     

    Description=launch chromium

     

    [Service]

    User=myuser

    Environment=DISPLAY=:0

    Environment=XDG_RUNTIME_DIR="/run/user/0"

    Type=oneshot

    ExecStart=/bin/sleep 15

    ExecStart=/usr/bin/chromium  --user-data-dir=/tmp/chromium --gpu-no-context-lost --enable-gpu-rasterization --start-fullscreen --kiosk --no-first-run --incognito http://localhost:3300/rpi.html > /dev/null 2>&1 &

     

    [Install]

    WantedBy=multi-user.target

     

     

    2

     

    Description=launch chromium

     

    [Service]

    User=myuser

    Environment=DISPLAY=:0

    Environment=XDG_RUNTIME_DIR="/run/user/0"

    Type=oneshot

    ExecStart=/bin/sleep 15

    ExecStart=/usr/bin/sudo -u myuser /usr/bin/chromium  --user-data-dir=/tmp/chromium --gpu-no-context-lost --enable-gpu-rasterization --start-fullscreen --kiosk --no-first-run --incognito http://localhost:3300/rpi.html > /dev/null 2>&1 &

     

    [Install]

    WantedBy=multi-user.target

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • gonewtinwind
    gonewtinwind over 3 years ago in reply to gonewtinwind

    I posted NXP too, but no solutions.

    I tried to research online. but only old solutions for rc(old skills worked well before) not systemd.

     

    https://community.nxp.com/t5/i-MX-Processors/how-to-write-a-system-service-to-auto-startup-chromium-on/m-p/1275666#M1739…

    any suggestions?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • jafoste4
    jafoste4 over 3 years ago in reply to gonewtinwind

    Hi Peter,

     

    This should solve your problem.

     

    Refer to the following steps to solve this problem:

    1  start the weston desktop on maaxboard with ‘avnet’ user. (Refer to the guide in PDF form below for detailed example)

    2  create a service file and enable this service to automatically start Google Chrome

       maaxboard:~# vi /etc/systemd/system/chromium.service

    [Unit]

    Description=chromium Browser

    After=weston.service

     

    [Service]

    User=avnet

    Environment=DISPLAY=:0

    Environment=XDG_RUNTIME_DIR="/run/user/1000"

    Type=oneshot

    ExecStart=/usr/bin/chromium --start-fullscreen > /dev/null 2>&1 &

     

    [Install]

    WantedBy=multi-user.target

       maaxboard:~# sudo systemctl daemon-reload

       maaxboard:~# systemctl enable chromium.service

     

    Note: in the chromium.service file , the number 1000 is the user's id.

    Use the command “id avnet” to get the user's id value

     

    3  reboot the system.

     

    Detailed guide see document - https://avtinc.sharepoint.com/:b:/t/ET-Downloads/EQCw2IF8l89Jo3yJokpDgHABeQbHIp2qwwOVyN759U4odg?e=ePHugh

     

    Thx,

    Josh

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • gonewtinwind
    gonewtinwind over 3 years ago in reply to jafoste4

    hi Josh,

    Thank you very much.

    did you test it on your maaxboard(yocto-zeus)? I followed your guide, but it still does not work.

     

    debug info:

     

    systemctl start chromium.service

    [   88.067474] audit: type=1701 audit(1622567912.343:5): auid=4294967295 uid=1001 gid=1002 ses=4294967295 pid=831 comm="chromium-bin" exe="/usr/lib/chromium/chromium-bin" sig=5 res=1

    [   88.083553] audit: type=1701 audit(1622567912.351:6): auid=4294967295 uid=1001 gid=1002 ses=4294967295 pid=819 comm="chromium-bin" exe="/usr/lib/chromium/chromium-bin" sig=5 res=1

    Job for chromium.service failed because a fatal signal was delivered to the control process.

    See "systemctl status chromium.service" and "journalctl -xe" for details.

    -sh-5.0# systemctl status chromium.service

    * chromium.service - chromium Browser

       Loaded: loaded (/etc/systemd/system/chromium.service; enabled; vendor preset>

       Active: failed (Result: signal) since Tue 2021-06-01 17:18:32 UTC; 7s ago

      Process: 819 ExecStart=/usr/bin/chromium --start-fullscreen > /dev/null 2>&1 >

    Main PID: 819 (code=killed, signal=TRAP)

     

     

    Jun 01 17:18:32 maaxboard systemd[1]: Starting chromium Browser...

    Jun 01 17:18:32 maaxboard systemd[1]: chromium.service: Main process exited, co>

    Jun 01 17:18:32 maaxboard systemd[1]: chromium.service: Failed with result 'sig>

    Jun 01 17:18:32 maaxboard systemd[1]: Failed to start chromium Browser.

    lines 1-10/10 (END)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • jafoste4
    jafoste4 over 3 years ago in reply to gonewtinwind

    Hi Peter,


    I will verify the OS used.

    Can you share similiar screen captures as shown in the user guide provided to make sure we are on the same page?

     

    Thx,
    Josh

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • gonewtinwind
    gonewtinwind over 3 years ago in reply to jafoste4

    my commands:

    NXP i.MX Release Distro 5.4-zeus maaxboard ttymxc0

     

     

    maaxboard login: [   22.879528] Atheros 8035 ethernet 30be0000.ethernet-1:04: attached PHY driver [Atheros 8035 ethernet] (mii_bus:phy_addr=30be0000.ethernet-1:04, irq=POLL)

    [   25.954678] fec 30be0000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx

    [   25.962474] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

    [   25.988602] IPv6: ADDRCONF(NETDEV_CHANGE): eth0.1: link becomes ready

    [   26.003080] IPv6: ADDRCONF(NETDEV_CHANGE): eth0.2: link becomes ready

    root

    Password:

    Last login: Tue Jun  1 17:29:08 UTC 2021 on tty7

    -sh-5.0# useradd avnet

    -sh-5.0# passwd avnet                                                                                                                                                                         

    New password:

    Retype new password: [   67.986464] audit: type=1006 audit(1622568601.259:3): pid=783 uid=0 old-auid=4294967295 auid=0 tty=(none) old-ses=4294967295 ses=2 res=1

     

     

    passwd: password updated successfully

    -sh-5.0# usermod -aG video avnet

    -sh-5.0# groups avnet

    video avnet

     

     

    id avnet

    uid=1001(avnet) gid=1002(avnet) groups=1002(avnet),44(video)

    -sh-5.0# cat /etc/systemd/system/chromium.service                                                                                                                                             

    [Unit]

     

     

    Description=chromium Browser

     

     

    After=weston.service

     

     

     

     

     

    [Service]

     

     

    User=avnet

     

     

    Environment=DISPLAY=:0

     

     

    Environment=XDG_RUNTIME_DIR="/run/user/1001"

     

     

    Type=oneshot

     

     

    ExecStart=/usr/bin/chromium --start-fullscreen > /dev/null 2>&1 &

     

     

     

     

     

    [Install]

     

     

    WantedBy=multi-user.target

     

     

     

     

     

     

    sudo systemctl daemon-reload

    (

    [  361.369813] systemd-fstab-generator[803]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [  361.384935] systemd-fstab-generator[803]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [  361.400019] systemd-fstab-generator[803]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [  361.415015] systemd-fstab-generator[803]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [  361.430032] systemd-fstab-generator[803]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [  361.445022] systemd-fstab-generator[803]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [  361.460009] systemd-fstab-generator[803]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [  361.474984] systemd-fstab-generator[803]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [  361.489958] systemd-fstab-generator[803]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [  361.504923] systemd-fstab-generator[803]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [  361.521806] printk: systemd-fstab-g: 15 output lines suppressed due to ratelimiting

    systemctl enable chromium.service

    Created symlink /etc/systemd/system/multi-user.target.wants/chromium.service -> /etc/systemd/system/chromium.service.                      (see here: the link generated, the following errors is not for it)

    [   94.334139] systemd-fstab-generator[805]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [   94.349296] systemd-fstab-generator[805]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [   94.364402] systemd-fstab-generator[805]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [   94.364491] systemd-fstab-generator[805]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [   94.364577] systemd-fstab-generator[805]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [   94.364661] systemd-fstab-generator[805]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [   94.364750] systemd-fstab-generator[805]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [   94.439157] systemd-fstab-generator[805]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [   94.454146] systemd-fstab-generator[805]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [   94.469121] systemd-fstab-generator[805]: Failed to create unit file /run/systemd/generator/run-media-sda1.mount, as it already exists. Duplicate entry in /etc/fstab?

    [   94.485944] printk: systemd-fstab-g: 15 output lines suppressed due to ratelimiting

     

     

    after reboot or power off/on:

     

     

     

     

    systemctl start chromium.service

    [   66.891113] audit: type=1701 audit(1622569050.163:4): auid=4294967295 uid=1001 gid=1002 ses=4294967295 pid=802 comm="chromium-bin" exe="/usr/lib/chromium/chromium-bin" sig=5 res=1

    Job for chromium.service failed because a fatal signal was delivered to the control process.

    See "systemctl status chromium.service" and "journalctl -xe" for details.

    -sh-5.0# systemctl status chromium.service

    * chromium.service - chromium Browser

       Loaded: loaded (/etc/systemd/system/chromium.service; enabled; vendor preset>

       Active: failed (Result: signal) since Tue 2021-06-01 17:37:30 UTC; 8s ago

      Process: 802 ExecStart=/usr/bin/chromium --start-fullscreen > /dev/null 2>&1 >

    Main PID: 802 (code=killed, signal=TRAP)

     

     

    Jun 01 17:37:29 maaxboard systemd[1]: Starting chromium Browser...

    Jun 01 17:37:30 maaxboard chromium[802]: [802:802:0601/173730.165212:ERROR:wayl>

    Jun 01 17:37:30 maaxboard chromium[802]: [802:802:0601/173730.165287:FATAL:ozon>

    Jun 01 17:37:30 maaxboard systemd[1]: chromium.service: Main process exited, co>

    Jun 01 17:37:30 maaxboard systemd[1]: chromium.service: Failed with result 'sig>

    Jun 01 17:37:30 maaxboard systemd[1]: Failed to start chromium Browser.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • gonewtinwind
    gonewtinwind over 3 years ago in reply to gonewtinwind

    anyway,I did the way as your guide many times in both maaxboard and iwave  before, but did not work! I asked the same question on NXP, but there was no solution either

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube