Google coral kiosk mode with virtual keyboard - google-coral

Can i run on the Google Coral devboad a chromium in kiosk mode with a virtual keyboard ?
On this exemple they run a chromium with a mouse.

MendelOs, the os on the dev board is just a derivative of Debian10 (buster).
After some research, I found how how to do it (prior I have no idea what kiosk mode is):
update and install needed packages
sudo su
apt-get update
apt-get -y install unclutter xorg chromium openbox lightdm locales
add kiosk group and user
groupadd kiosk
user add -m kiosk -g kiosk -s /bin/bash
mkdir -p /home/kiosk/.config/openbox
chown -R kiosk:kiosk
Tell lightdm to automatically starts with kiosk user
cat > /etc/lightdm/lightdm.conf << EOF
[SeatDefaults]
autologin-user=kiosk
EOF
Tell kiosk user to do this on start
cat > /home/kiosk/.config/openbox/autostart << EOF
#!/bin/bash
unclutter -idle 0.1 -grab -root &
while:
do
chromium \
--no-first-run \
--start-maximized \
--window-position=0,0 \
--window-size=1024,768 \
--disable \
--disable-translate \
--disable-infobars \
--disable-suggestions-service \
--disable-save-password-bubble \
--disable-session-crashed-bubble \
--incognito \
--kiosk "https://google.com/"
sleep 5
done &
EOF
Cheers

Related

quantconnect IBController needing to relogin every few hours,

I have updated Ryan Kennedy's IBConnect Docker image by getting the latest versions from Quantconnect, here is the Docker image I ended up with.
Basically the dockerfile contains:
FROM ubuntu:18.04
MAINTAINER Ryan Kennedy <hello#ryankennedy.io>
RUN apt-get update \
&& apt-get install -y wget \
&& apt-get install -y unzip \
&& apt-get install -y xvfb \
&& apt-get install -y libxtst6 \
&& apt-get install -y libxrender1 \
&& apt-get install -y libxi6 \
&& apt-get install -y socat \
&& apt-get install -y software-properties-common
# Setup IB TWS
RUN mkdir -p /opt/TWS
WORKDIR /opt/TWS
ENV ibgateway_version x64-v974.4g
ENV ibgateway_script ibgateway-latest-standalone-linux-${ibgateway_version}.sh
ENV ibcontroller_file IBController-QuantConnect-3.2.0.5.zip
# from https://github.com/QuantConnect/Lean/blob/master/DockerfileLeanFoundation
RUN wget http://cdn.quantconnect.com/interactive/${ibgateway_script} && \
chmod 777 ${ibgateway_script} && \
./${ibgateway_script} -q && \
wget -O ~/Jts/jts.ini http://cdn.quantconnect.com/interactive/ibgateway-latest-standalone-linux-${ibgateway_version}.jts.ini && \
rm ${ibgateway_script}
# Install IB Controller: Installs to /opt/IBController
RUN wget http://cdn.quantconnect.com/interactive/${ibcontroller_file} && \
unzip ${ibcontroller_file} -d /opt/IBController && \
chmod -R 777 /opt/IBController && \
rm ${ibcontroller_file}
# Install Java 8
RUN \
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
add-apt-repository -y ppa:webupd8team/java && \
apt-get update && \
apt-get install -y oracle-java8-installer && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/oracle-jdk8-installer
WORKDIR /
#CMD yes
# Launch a virtual screen
RUN Xvfb :1 -screen 0 1024x768x24 2>&1 >/dev/null &
RUN export DISPLAY=:1
ADD runscript.sh runscript.sh
CMD bash runscript.sh
It all works well, except every few hours starts logging:
05:48:36:462 IBController: detected frame entitled: Connecting to server...; event=Activated
05:51:19:741 IBController: detected dialog entitled: Re-login is required; event=Opened
05:51:19:743 IBController: Let user choose whether to re-login
05:51:19:751 IBController: detected dialog entitled: Re-login is required; event=Activated
05:54:20:608 IBController: detected dialog entitled: Re-login is required; event=Closed
05:54:21:191 IBController: detected dialog entitled: Re-login is required; event=Opened
05:54:21:191 IBController: Let user choose whether to re-login
I guess it loses connection due to any reason, and then there's an unhandled dialog for reconnecting, I'm not sure how to fix this.
IBGateway, IB API C#, and the IBController project versions are all fairly tightly coupled. They should probably not be used in isolation or you'll have version compatibility issues like this one.
LEAN (the open source algorithmic trading project you're extending from) ships with versions of these programs which we've constructed work perfectly together. In total LEAN's deployed and managed more than 50,000 live algorithms so its pretty well battle tested! We've also forked the IBController and maintain a production-ready bug, free version.
I'd recommend using the original LEAN Foundation if you can. It will save you months of headache. We have full-time engineers maintain and contributing to the code base ensuring these components remain reliable for the 70,000 quants in the QuantConnect community.
--
I'm founder # QC.

dbus errrors when trying to start GUI app from Docker CentOS container

I am trying to run a GUI from a CentOS container. I tried to follow this example. This is my Dockerfile:
#!/bin/bash
FROM centos:7
#RUN yum install -y firefox dbus dbus-x11
RUN yum install -y firefox
# Replace 0 with your user / group id
RUN export uid=1000 gid=100
RUN mkdir -p /home/developer
RUN echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd
RUN echo "developer:x:${uid}:" >> /etc/group
RUN echo "developer ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN chmod 0440 /etc/sudoers
RUN chown ${uid}:${gid} -R /home/developer
#RUN dbus-uuidgen > /var/lib/dbus/machine-id
#RUN export $(dbus-launch)
USER developer
ENV HOME /home/developer
CMD /usr/bin/firefox
I then run the following commands in my terminal.
docker run -ti --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
firefox
process 8: D-Bus library appears to be incorrectly set up; failed to read machine uuid: UUID file '/etc/machine-id' should contain a hex string of length 32, not length 0, with no other text
See the manual page for dbus-uuidgen to correct this issue.
D-Bus not built with -rdynamic so unable to print a backtrace
Running without a11y support!
No protocol specified
Error: cannot open display: :0.0
I have tried this solution, where I add the following lines to my Dockerfile,
# apt-get install -y dbus
# dbus-uuidgen > /var/lib/dbus/machine-id
But that didn't fix the problem. Any ideas?
Edit: My host OS is Arch Linux. And I really am trying to run this example in CentOs.I don't really need a container that runs a Firefox GUI. I was just trying to get the simplest example of a GUI running in a CentOS container running, and I failed at that.
Problem is with your DockerFile, your base image is Centos and rest of command you running for Ubuntu.
FROM ubuntu
RUN apt-get update && apt-get install -y firefox
# Replace 1000 with your user / group id
RUN export uid=1000 gid=1000 && \
mkdir -p /home/developer && \
echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \
echo "developer:x:${uid}:" >> /etc/group && \
echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \
chmod 0440 /etc/sudoers.d/developer && \
chown ${uid}:${gid} -R /home/developer
USER developer
ENV HOME /home/developer
CMD /usr/bin/firefox
You Run command will be
docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix firefox
The above image is tested in Ubuntu 18.04 and working fine.
For window try like this
docker run -ti --rm -e DISPLAY=$DISPLAY firefox
You check the above image on docker registry.
docker pull adilm7177/firefox

Run firefox in docker container on raspberry pi

I've followed this thread
to build a docker container to run on Raspberry pi. I've managed to run it on a normal centos, but on pi I always get this error (I always run in mobaxterm application on windows 10 because it has x11 support):
Unable to init server: broadway display type not supported 'machinename:0'
Error: cannot open display: machinename:0
I've tried to build it with 2 different dockerfile, the 1st:
FROM resin/rpi-raspbian:latest
# Make sure the package repository is up to date
RUN apt-get update && apt-get install -y firefox-esr
USER root
ENV HOME /root
CMD /usr/bin/firefox
And tried to run it with this script:
#!/usr/bin/env bash
CONTAINER=firefox_wo_vnc
COMMAND=/bin/bash
DISPLAY="machinename:0"
USER=$(whoami)
docker run -ti --rm \
-e DISPLAY \
-v "/c/Users/$USER:/home/$USER:rw" \
$CONTAINER
$COMMAND
and I got the error :(
The 2nd that I've tried:
# Firefox over VNC
#
# VERSION 0.1
# DOCKER-VERSION 0.2
FROM resin/rpi-raspbian:latest
RUN apt-get update
# Install vnc, xvfb in order to create a 'fake' display and firefox
RUN apt-get install -y x11vnc xvfb firefox-esr
RUN mkdir ~/.vnc
# Setup a password
RUN x11vnc -storepasswd 1234 ~/.vnc/passwd
# Autostart firefox (might not be the best way to do it, but it does the trick)
RUN bash -c 'echo "firefox" >> /.bashrc'
And tried to run:
#!/usr/bin/env bash
CONTAINER=firefoxvnc
COMMAND=/bin/bash
DISPLAY="machinename:0"
USER=$(whoami)
docker run \
-it \
--rm \
--user=$USER \
--workdir="/home/$USER" \
-v "/c/Users/$USER:/home/$USER:rw" \
-e DISPLAY \
$CONTAINER \
$COMMAND
This way I can login via VNC but firefox is not running and I can't see actually anything just an empty desktop.
I've read many thread, I've installed xorg, openbox, x11 apps ...

Inside a Docker Container: "Error: cannot open display: localhost:11.0"

I am trying to use programs with a graphical interface in a docker container over ssh.
Currently I am connected over ssh on an external machine where docker and the containers are running. On the host I can start programs like firefox which was displayed correctly. The connection is established with:
ssh -Y root#host
When I try the same in a docker container, with the firefox image (see below):
docker run -it --privileged --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /root/.Xauthority:/root/.Xauthority:rw \
firefox
I just get:
Error: cannot open display: localhost:11.0
I already tried to set xhost + on the host, but it is still not working.
The host runs Scientific Linux release 7.2 and the docker image is created with the
Dockerfile from http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/:
FROM ubuntu:14.04
RUN apt-get update && apt-get install -y firefox
# Replace 1000 with your user / group id
RUN export uid=1000 gid=1000 && \
mkdir -p /home/developer && \
echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \
echo "developer:x:${uid}:" >> /etc/group && \
echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \
chmod 0440 /etc/sudoers.d/developer && \
chown ${uid}:${gid} -R /home/developer
USER developer
ENV HOME /home/developer
CMD /usr/bin/firefox
Adding --net=host to docker run solved the problem.

Running GUI in docker (no ssh, no VNC)

TL;DR: root is not supposed to run GUI app, set a regular user to do so.
I'm trying to run arduino IDE (downloaded, not the package) from within a Docker. I wrote the Dockerfile as follow:
FROM ubuntu:14.04
MAINTAINER Mael Auzias <docker#mael.auzias.net>
ENV HOME /home/arduino
ENV USER arduino
RUN apt-get update && apt-get install -y \
libx11-6 libxext-dev libxrender-dev libxtst-dev \
--no-install-recommends \
&& useradd --create-home --home-dir $HOME $USER \
&& chown -R $USER:$USER $HOME
ADD arduino-1.6.6-linux64.tar.xz $HOME
WORKDIR $HOME/arduino-1.6.6
USER $USER
ENTRYPOINT ["/bin/bash"]
I spent time to understand how does Jessica Frazelle usually starts her graphical containers to rightly start mine with the command:
$docker run --name arduino --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix 25af73b6cb3c ./arduino
No protocol specified
Picked up JAVA_TOOL_OPTIONS:
No protocol specified
Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
I installed strace and check with xeyes what was wrong, and I get the following error:
connect(3, {sa_family=AF_LOCAL, sun_path=#"/tmp/.X11-unix/X0"}, 20) = -1 ECONNREFUSED (Connection refused)
Did anyone experience this? Can any point me out some doc or see what I'm doing wrong?
Any help would be welcome.
PS: as specified in the title I do not want to use ssh or VNC. No cryptography should be used nor network when a unix socket is faster and enough.
Solution
Got some news...
As the user root I cannot start graphical application. When I su regular-user and start xterm or xeyes it works. I don't really understand why though :/
Here is the working Dockerfile, tested on Fedora 23.
The application must not be ran as root so it starts using X.
Note that, unrelated to this issue, a Java option has been removed from the bash file arduino (so it starts properly).
After a docker build -t arduino-1.6.6 ., docker run --name arduino --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix arduino-1.6.6 ./arduino start the arduino IDE.
You will not be able to upload any code into an arduino without adding a --device or -v to share the /dev/ttyUSB0.
FROM ubuntu:14.04
MAINTAINER Mael Auzias <docker#mael.auzias.net>
ENV HOME /home/arduino
ENV USER arduino
RUN apt-get update && apt-get install -y \
libx11-6 libxext-dev libxrender-dev libxtst-dev \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --create-home --home-dir $HOME $USER \
&& chown -R $USER:$USER $HOME
ADD arduino-1.6.6-linux64.tar.xz $HOME
RUN sed -i 's/"-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"//g' /home/arduino/arduino-1.6.6/arduino
WORKDIR $HOME/arduino-1.6.6
USER $USER
ENTRYPOINT ["/bin/bash"]
Got some news...
As the user root I cannot start graphical application. When I su regular-user and start xterm or xeyes it works. I don't really understand why though :/
Here is the working Dockerfile, tested on Fedora 23.
The application must not be ran as root so it starts using X.
Note that, unrelated to this issue, a Java option has been removed from the bash file arduino (so it starts properly).
After a docker build -t arduino-1.6.6 ., docker run --name arduino --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix arduino-1.6.6 ./arduino start the arduino IDE.
You will not be able to upload any code into an arduino without adding a --device or -v to share the /dev/ttyUSB0.
FROM ubuntu:14.04
MAINTAINER Mael Auzias <docker#mael.auzias.net>
ENV HOME /home/arduino
ENV USER arduino
RUN apt-get update && apt-get install -y \
libx11-6 libxext-dev libxrender-dev libxtst-dev \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --create-home --home-dir $HOME $USER \
&& chown -R $USER:$USER $HOME
ADD arduino-1.6.6-linux64.tar.xz $HOME
RUN sed -i 's/"-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"//g' /home/arduino/arduino-1.6.6/arduino
WORKDIR $HOME/arduino-1.6.6
USER $USER
ENTRYPOINT ["/bin/bash"]

Resources