smalldragoon
Posts: 17
Joined: Mon Sep 18, 2017 4:02 pm

Do no display desktop ( or hide it ) before Chrome in Kiosk started

Fri Apr 16, 2021 1:06 pm

Hello,
Not sure 100% it is the right category. happy to move it if it's not of course.
I'm building a media center and runs as GUI a Chrome browser in Kiosk mode.
I disabled splash, booting info..etc.. and now, I would like to avoid for end user to see the desktop until Chrome is launched and in front .
I changed the background picture to solid color ( black ), but still get the menubar displayed
Any suggestion is welcome, as I really do not need the desktop at all.

Thanks !

User avatar
thagrol
Posts: 4710
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Do no display desktop ( or hide it ) before Chrome in Kiosk started

Fri Apr 16, 2021 2:54 pm

If all you need is chrome and no desktop at all try this.
  1. Disable boot to desktop. Boot to command line without an automatic login instead.
  2. login as your normal user
  3. Add your user to the tty group:

    Code: Select all

    sudo usermod -a -G tty pi
    replace "pi" as needed. Change won't take effect until your next login.
  4. Code: Select all

    crontab -e
  5. Add something like the following:

    Code: Select all

    @reboot sudo chmod g+rw /dev/tty2 ; /usr/bin/startx /path/to/chrome arguemts for chrome
    hange the obviuos bits in that example. You may also neeed to change "2" for another number, it depends on your OS. The quick hacky fix is to use /dev/tty? to set permissions on all of them.
  6. Save and close your crontab.
On your next boot you should get just chrome with no desktop running at all.

The above assumes the latest RPiOS.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

bls
Posts: 1359
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: Do no display desktop ( or hide it ) before Chrome in Kiosk started

Fri Apr 16, 2021 5:22 pm

If you want a lot more control over the desktop, you should consider using RasPiOS Lite, and install just the minimum X stuff into it. You can then have complete control over when it starts.

Of course, this depends on the requirements of your app, but in the case of Chrome, it seems to run quite well on a Minimum X on Lite.
Pi tools:
Quickly and easily build customized-just-for-you SD Cards: https://github.com/gitbls/sdm
Easily run your network's DHCP/DNS on a Pi: https://github.com/gitbls/ndm
Easy strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

User avatar
thagrol
Posts: 4710
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Do no display desktop ( or hide it ) before Chrome in Kiosk started

Fri Apr 16, 2021 11:42 pm

bls wrote:
Fri Apr 16, 2021 5:22 pm
If you want a lot more control over the desktop, you should consider using RasPiOS Lite, and install just the minimum X stuff into it. You can then have complete control over when it starts.

Of course, this depends on the requirements of your app, but in the case of Chrome, it seems to run quite well on a Minimum X on Lite.
Sure. But:
  1. OP has a working system based on RPiOS full. Your suggestion would mean a complete rebuild and possibly a new set of skills to learn.
  2. Unless disc space is really tight it's often easier to start with a full install and disable stuff you don't want that to work out everything that needs to be installed and configured to get what you do.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

bls
Posts: 1359
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: Do no display desktop ( or hide it ) before Chrome in Kiosk started

Sat Apr 17, 2021 12:12 am

thagrol wrote:
Fri Apr 16, 2021 11:42 pm
bls wrote:
Fri Apr 16, 2021 5:22 pm
If you want a lot more control over the desktop, you should consider using RasPiOS Lite, and install just the minimum X stuff into it. You can then have complete control over when it starts.

Of course, this depends on the requirements of your app, but in the case of Chrome, it seems to run quite well on a Minimum X on Lite.
Sure. But:
  1. OP has a working system based on RPiOS full. Your suggestion would mean a complete rebuild and possibly a new set of skills to learn.
  2. Unless disc space is really tight it's often easier to start with a full install and disable stuff you don't want that to work out everything that needs to be installed and configured to get what you do.
Maybe. OP didn't say that he wanted to avoid doing a complete rebuild nor did he say he was adverse to learning new skills. As mentioned by several people in these forums (probably including you :) ) the Pi and RasPiOS are great platforms for learning.

I personally think it's easier to start with a Lite install and add the things you want, rather than trying to figure out how to work around the Fully stuffed system when you don't need all of it.

As you noted "All advice given is based on my experience. it worked for me, it may not work for you."
Pi tools:
Quickly and easily build customized-just-for-you SD Cards: https://github.com/gitbls/sdm
Easily run your network's DHCP/DNS on a Pi: https://github.com/gitbls/ndm
Easy strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

User avatar
thagrol
Posts: 4710
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Do no display desktop ( or hide it ) before Chrome in Kiosk started

Sat Apr 17, 2021 12:30 am

bls wrote:
Sat Apr 17, 2021 12:12 am
I personally think it's easier to start with a Lite install and add the things you want, rather than trying to figure out how to work around the Fully stuffed system when you don't need all of it.
Having done it both ways, I'd say it ultimately depends on what your end goal is, what your skill level is, and how much time you have available. I should probably have said "sometimes" rather than "often" though.
As you noted "All advice given is based on my experience. it worked for me, it may not work for you."
Sure. Didn't mean to suggest that I was right and you were wrong, just to prompt discussion. There's almost always more than one way of doing something.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

bls
Posts: 1359
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: Do no display desktop ( or hide it ) before Chrome in Kiosk started

Sat Apr 17, 2021 12:46 am

thagrol wrote:
Sat Apr 17, 2021 12:30 am
Sure. Didn't mean to suggest that I was right and you were wrong, just to prompt discussion. There's almost always more than one way of doing something.
Fair enough. I'm of the "Lite persuasion", so typically will suggest alternatives building up to what you want. But, the Full desktop has value, I get it. In fact, I just added a couple of desktop-only features to my SD management tool (left-handed mouse and "disable piwiz"), for those times when I give the full desktop a spin.

OP, perhaps you could share a bit more on your situation/goals:
  • Are you focused on trying to make your current SD card work as you desire?
  • Ignoring the current undesirable, but fixable, behavior, are you happy with the system startup performance of your Full Desktop system?
  • Are you more focused on "getting it working ASAP" or "learning something new"?
All that said, @thagrol's solution looks promising (proof is always in the pudding, as they say...sigh! ). I suggested an alternative that could improve performance (aka system boot to "Chrome visible" time), but if that's not an issue, then you've got a great path forward.
Pi tools:
Quickly and easily build customized-just-for-you SD Cards: https://github.com/gitbls/sdm
Easily run your network's DHCP/DNS on a Pi: https://github.com/gitbls/ndm
Easy strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

User avatar
thagrol
Posts: 4710
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Do no display desktop ( or hide it ) before Chrome in Kiosk started

Sat Apr 17, 2021 11:20 am

Some backgorund I should have included in my first post in this thread.

The chmod command sets permissions so that a normal user can access the console, specifically the VT that X runs on.

startx program doesn't start the full desktop. It starts an X server and runs the specified program. It will exit when the specifie dprogram does. The primary drawback of this approach is that nothing else is running, not even a window manager.

Running it from cron means no useer is loged in so even if someone manages to close the program they still won't have access to the system without the relevant password. A systemd service instead of cron can automatically restart things on exit/failure.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

smalldragoon
Posts: 17
Joined: Mon Sep 18, 2017 4:02 pm

Re: Do no display desktop ( or hide it ) before Chrome in Kiosk started

Tue Apr 20, 2021 4:41 pm

@thagrol and @bls : Thanks a lot for all these inputs !
let me then give you more insights on what I'm working currently :

1 - This will be an autonomous system, running on batteries. So as much power consumption I can avoid, better it is.( so I assume just running Chrome will save as well CPU, ie , batteries )
2 - my first plans were to run it on a Pi Zero, but even with overclocking, seems that it is still very slow ( chrome accessing a local lamp server ) . Switching to a "normal" pi, then I would aim using a pi4.... Do you think there are ways to improve this ( except the launching time ) . One idea I have is create a Vdisk in RAM, to "pre-browse" all pages with Chrome cache defined to be stored in the Vdisk. make sense ?
3 - this will be an autonomous device, without any keyboard or access. It is not so important to block access to the console/login ( 5 keys available : up, down, left, right, select ) . if system is logged out or not responding, reboot.
4 - storage space is not a big deal for now, he 128Go of the SD card is more than I need
5 - At the end, I would tend to say equal for me on the dist to use. Both are fine, add required stuff or disable some ( as space on SDcard is not an issue )
Thanks !

bls
Posts: 1359
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: Do no display desktop ( or hide it ) before Chrome in Kiosk started

Tue Apr 20, 2021 7:21 pm

smalldragoon wrote:
Tue Apr 20, 2021 4:41 pm
@thagrol and @bls : Thanks a lot for all these inputs !
let me then give you more insights on what I'm working currently :

1 - This will be an autonomous system, running on batteries. So as much power consumption I can avoid, better it is.( so I assume just running Chrome will save as well CPU, ie , batteries )
2 - my first plans were to run it on a Pi Zero, but even with overclocking, seems that it is still very slow ( chrome accessing a local lamp server ) . Switching to a "normal" pi, then I would aim using a pi4.... Do you think there are ways to improve this ( except the launching time ) . One idea I have is create a Vdisk in RAM, to "pre-browse" all pages with Chrome cache defined to be stored in the Vdisk. make sense ?
3 - this will be an autonomous device, without any keyboard or access. It is not so important to block access to the console/login ( 5 keys available : up, down, left, right, select ) . if system is logged out or not responding, reboot.
4 - storage space is not a big deal for now, he 128Go of the SD card is more than I need
5 - At the end, I would tend to say equal for me on the dist to use. Both are fine, add required stuff or disable some ( as space on SDcard is not an issue )
Thanks !
If you're going to be running on batteries, you definitely want to start with Lite and build up. There's just less "stuff" running in the system by default.

I'm guessing you'll to need a much bigger battery for a Pi4 than a Pi0. Others will have more detailed comments on that, I'd guess.
Pi tools:
Quickly and easily build customized-just-for-you SD Cards: https://github.com/gitbls/sdm
Easily run your network's DHCP/DNS on a Pi: https://github.com/gitbls/ndm
Easy strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

User avatar
thagrol
Posts: 4710
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Do no display desktop ( or hide it ) before Chrome in Kiosk started

Tue Apr 20, 2021 7:34 pm

bls wrote:
Tue Apr 20, 2021 7:21 pm
I'm guessing you'll to need a much bigger battery for a Pi4 than a Pi0. Others will have more detailed comments on that, I'd guess.
Not me but searching the forum will likely help. Running Pi on batteries comes up reasonably often.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

Return to “Media centres”