I'm trying to run an Xorg server in Docker, due to the host OS not having any X installed, nor can it preserve installed packages between updates (however, Docker containers are preserved).
My goal is to run an X app in "kiosk" mode (no desktop environment, no window manager, just a single X app taking up the whole display), confined to the Docker container - specifically, Chromium to open the web management interface of the host (which is embedded in the distro).
After reading a swathe of Xorg/Xinput articles, setup guides, manuals and whatnot, and I'm still not sure what's going wrong.
This is my current Dockerfile:
FROM alpine:3.16
# Install Xorg
RUN \
apk add --no-cache \
xorg-server eudev mesa \
xinput xinit xhost evtest \
xf86-input-libinput xf86-video-fbdev xf86-input-evdev \
dbus xrandr xset xsetroot \
xeyes libinput mesa-dri-swrast mesa-dri-gallium mesa-egl
# Install Chromium
RUN \
apk add --no-cache \
chromium
CMD [ "/usr/bin/xinit", "/usr/bin/chromium-browser", "--no-sandbox", "--kiosk" ]
Then run it by passing in all the necessary udev entries:
docker run --rm -it \
--device=/dev/input \
--device=/dev/console \
--device=/dev/dri \
--device=/dev/fb0 \
--device=/dev/tty \
--device=/dev/tty1 \
--device=/dev/vga_arbiter \
--device=/dev/snd \
--cap-add=SYS_TTY_CONFIG \
alpine-xorg:latest http://172.17.0.1:8123/
In my case, I'm trying to use a 7" touchscreen HDMI display, designed for Raspberry Pis (however, I'm not using a Pi, but an Intel based mini PC).
Xorg logs aren't much help, they contain just init information about Xinput, no devices identified or anything.
Here's the log: https://paste-bin.xyz/65152
I've also fiddled around with evtest - in my case, /dev/input/event3 corresponds to the touchscreen's input, and evtest successfully recognises them: https://paste-bin.xyz/65154
However xinput doesn't even see these as a possible device:
a369b238e0f1:/var/log# xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
According to the Xorg logs, the appropriate init scripts have been loaded:
[ 3724.820] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
/usr/share/X11/xorg.conf.d/10-evdev.conf exists, and contains all the needed entries:
#
# Catch-all evdev loader for udev-based systems
# We don't simply match on any device since that also adds accelerometers
# and other devices that we don't really want to use. The list below
# matches everything but joysticks.
Section "InputClass"
Identifier "evdev pointer catchall"
MatchIsPointer "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Section "InputClass"
Identifier "evdev keyboard catchall"
MatchIsKeyboard "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Section "InputClass"
Identifier "evdev touchpad catchall"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Section "InputClass"
Identifier "evdev tablet catchall"
MatchIsTablet "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Section "InputClass"
Identifier "evdev touchscreen catchall"
MatchIsTouchscreen "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Where is this setup going wrong, why can't xinput register the evdev devices when the necessary events are clearly there and usable?
I am attempting to convert the docker file for :
https://hub.docker.com/r/dpokidov/imagemagick/
to singularity. The docker builds fine in docker. In my singularity def file the following line fails with the error.
yasm cmake
libde265-0 libde265-dev libjpeg62-turbo libjpeg62-turbo-dev x265 libx265-dev libtool
libpng16-16 libpng-dev libjpeg62-turbo libjpeg62-turbo-dev libwebp6 libwebp-dev libgomp1 libwebpmux3 libwebpdemux2 ghostscript
yasm cmake
yasm: warning: can open only one input file, only the last file will be processed
yasm: file name already has no extension: output will be in `yasm.out'
yasm: FATAL: Could not open input file
FATAL: failed to execute %post proc: exit status 1
FATAL: While performing build: while running engine: exit status 255
When I cut the list of names to 1 it still fails to open the file.
I can't find a reference for this with singularity.
The docker build looks the same and works fine. So I assume its a singularity thing?
Seems like something with the assembler and the build environment being a bit different than it's expecting.
Is there a reason you're creating a definition file from scratch rather than using the docker image directly? singularity pull docker://dpokidov/imagemagick should give you what you need.
If you want to make further changes to the image, you can also use:
Bootstrap: docker
From: dpokidov/imagemagick
%post
# custom stuff here
I need to run gdb inside Docker, and I have a strong preference for the interface provided by emacs.
When doing M-x gdb, I enter "docker-compose -f ~/docker-services/dev/docker-compose.yml exec dev_rhel7 bash -c "gdb -i=mi"", and then it shows me the following message.
Current directory is /home/drcoeurjoly/docker-services/dev/
Error: you did not specify -i=mi on GDB's command line!
WARNING: The MY_UID variable is not set. Defaulting to a blank string.
1-inferior-tty-set /dev/pts/3
2-gdb-set height 0
3-gdb-set non-stop 1
4-enable-pretty-printing
5-file-list-exec-source-files
6-file-list-exec-source-file
7-gdb-show prompt
8-stack-info-frame
9-thread-info
10-break-list
11-thread-info
12-break-list
=thread-group-added,id="i1"
~"GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-114.el7\n"
~"Copyright (C) 2013 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type \"show copying\"\nand \"show warranty\" for details.\n"
~"This GDB was configured as \"x86_64-redhat-linux-gnu\".\nFor bug reporting instructions, please see:\n"
~"http://www.gnu.org/software/gdb/bugs/.\n"
=cmd-param-changed,param="history save",value="on"
=cmd-param-changed,param="history filename",value="/home/drcoeurjoly/dotfiles/gdb/.gdb_history"
=cmd-param-changed,param="print pretty",value="on"
=cmd-param-changed,param="print object",value="on"
=cmd-param-changed,param="print vtbl",value="on"
=cmd-param-changed,param="demangle-style",value="gnu-v3"
=cmd-param-changed,param="follow-fork-mode",value="child"
=cmd-param-changed,param="detach-on-fork",value="off"
(gdb)
1^done
(gdb)
2^done
(gdb)
3^done
(gdb)
4^done
(gdb)
5^done,files=[]
(gdb)
6^error,msg="No symbol table is loaded. Use the \"file\" command."
(gdb)
7^done,value="(gdb) "
(gdb)
8^error,msg="No registers."
(gdb)
9^done,threads=[]
(gdb)
10^done,BreakpointTable={nr_rows="0",nr_cols="6",hdr=[{width="7",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="10",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[]}
(gdb)
11^done,threads=[]
(gdb)
12^done,BreakpointTable={nr_rows="0",nr_cols="6",hdr=[{width="7",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="10",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[]}
(gdb)
Note that I successfully enter gdb in Docker, since GDB says:
"GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-114.el7\n"
In my host operating system (Debian):
gdb --version
outputs:
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
In Debian, I execute the Docker command:
docker-compose -f ~/docker-services/dev/docker-compose.yml exec dev_rhel7 bash -c "gdb -i=mi"
and I get the machine-oriented text interface.
From the previous test I deduce that it is an issue of emacs, not Docker.
When entering the path of a binary instead of the option -i=mi, it reads the symbols just fine:
M-x gdb RETURN docker-compose -f ~/docker-services/dev/docker-compose.yml exec dev_rhel7 bash -c "gdb ~/babel_sandbox/build/foo"
which outputs:
Current directory is /home/drcoeurjoly/docker-services/dev/
Error: you did not specify -i=mi on GDB's command line!
WARNING: The MY_UID variable is not set. Defaulting to a blank string.
1-inferior-tty-set /dev/pts/3
2-gdb-set height 0
3-gdb-set non-stop 1
4-enable-pretty-printing
5-file-list-exec-source-files
6-file-list-exec-source-file
7-gdb-show prompt
8-stack-info-frame
9-thread-info
10-break-list
11-thread-info
12-break-list
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-114.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /home/drcoeurjoly/babel_sandbox/build/foo...done.
(gdb) 1-inferior-tty-set /dev/pts/3
Undefined command: "1-inferior-tty-set". Try "help".
(gdb) 2-gdb-set height 0
Undefined command: "2-gdb-set". Try "help".
(gdb) 3-gdb-set non-stop 1
Undefined command: "3-gdb-set". Try "help".
(gdb) 4-enable-pretty-printing
Undefined command: "4-enable-pretty-printing". Try "help".
(gdb) 5-file-list-exec-source-files
Undefined command: "5-file-list-exec-source-files". Try "help".
(gdb) 6-file-list-exec-source-file
Undefined command: "6-file-list-exec-source-file". Try "help".
(gdb) 7-gdb-show prompt
Undefined command: "7-gdb-show". Try "help".
(gdb) 8-stack-info-frame
Undefined command: "8-stack-info-frame". Try "help".
(gdb) 9-thread-info
Undefined command: "9-thread-info". Try "help".
(gdb) 10-break-list
Undefined command: "10-break-list". Try "help".
(gdb) 11-thread-info
Undefined command: "11-thread-info". Try "help".
(gdb) 12-break-list
Undefined command: "12-break-list". Try "help".
(gdb)
I also tried putting the gdb -i=mi inside a script and calling that from emacs, to no avail. Calling directly from bash worked and not from emacs.
Relevant information:
My spacemacs config
foo program used for testing argument passing to gdb in emacs.
I don't know if the dockerfile and docker-compose yml are relevant. If so, I will create a repo.
Versions:
Host:
uname -a
Linux des26 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11) x86_64 GNU/Linux
Emacs in host:
emacs --version
GNU Emacs 26.3
GDB in host:
gdb --version
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
Docker in host:
docker --version
Docker version 18.09.1, build 4c52b90
Docker-compose in host:
docker-compose --version
docker-compose version 1.21.0, build unknown
Docker container:
cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
GDB in docker container:
gdb --version
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-114.el7
This issue was reported by Robert Mecklenburg here and here as early as august 2017.
I exhausted my virtual memory when trying to install SyntaxNet from this Dockerfile using the Docker Toolbox. I received this message when compiling the Dockerfile:
ERROR: /root/.cache/bazel/_bazel_root/5b21cea144c0077ae150bf0330ff61a0/external/org_tensorflow/tensorflow/core/kernels/BUILD:1921:1: C++ compilation of rule '#org_tensorflow//tensorflow/core/kernels:svd_op' failed: gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wl,-z,-relro,-z,now -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-canonical-system-headers ... (remaining 115 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1. virtual memory exhausted: Cannot allocate memory ____Building complete. ____Elapsed time: 8548.364s, Critical Path: 8051.91s
I have a feeling this could be resolved by changing Bazel's default jobs limit with (for example) --jobs=1, however I'm not sure where I would put that in the Dockerfile.
There are two possibilities: You could either modify the Dockerfile so that it creates a ~/.bazelrc that contains the following text:
build --jobs=1
Note that this works, even though the Dockerfile runs bazel test (as opposed to bazel build), because build flags in the .bazelrc also apply to Bazel's test command.
The other possibility would be to modify the RUN command in the Dockerfile to include the --jobs=1 parameter, e.g. RUN [...] && bazel test --jobs=1 --genrule_strategy=standalone [...].
Bazel should then spawn not more than a single child process during the build. You can verify this by running "ps axuf" on your host and looking at the process tree of your container. If you modified the RUN cmd, you should also see the --jobs=1 parameter on Bazel's command-line.
In ns-3 simulator documentation they provide a simple bash function to ease your life:
function waff {
CWD="$PWD"
cd $NS3DIR
./waf --cwd="$CWD" $*
cd -
}
This function is supposed to execute the ./waf program situated in the ns-3 root folder but inside the folder you are actually situated into.
So in the case of ~/project$ waff --run first waf will run the first script in the ~/project folder.
But if I try to run any simulation by adding one parameter to the script's command like ~/project$ waff --run "first --PrintHelp" it throws an error
waf: error: no such option: --PrintHelp.
It only works when I actually run the scripts from the root folder without the waff function.
How to modify the function to make it expand the $* to an argument between double commas?
Well, I feel embarrased because the solution was way easier than expected.
If anyone using DCE has the same problem, it's as easy as quoting the $*:
./waf --cwd="$CWD" $*
with:
./waf --cwd="$CWD" "$*"
This function works for me with bash (supposed you defined the environment variable $NS3DIR) :
function waff {
CWD="$PWD"
cd $NS3DIR >/dev/null
./waf --cwd="$CWD" "$#"
cd - >/dev/null
}
Proof it works is :
$ waff --run "wifi-simple-adhoc --help"
Waf: Entering directory `/home'
Waf: Leaving directory `/home'
'build' finished successfully (2.013s)
ns3.22-wifi-simple-adhoc-debug [Program Arguments] [General Arguments]
Program Arguments:
--phyMode: Wifi Phy mode [DsssRate1Mbps]
--rss: received signal strength [-80]
--packetSize: size of application packet sent [1000]
--numPackets: number of packets generated [1]
--interval: interval (seconds) between packets [1]
--verbose: turn on all WifiNetDevice log components [false]
General Arguments:
--PrintGlobals: Print the list of globals.
--PrintGroups: Print the list of groups.
--PrintGroup=[group]: Print all TypeIds of group.
--PrintTypeIds: Print all TypeIds.
--PrintAttributes=[typeid]: Print all attributes of typeid.
--PrintHelp: Print this help message.
$ waff --run wifi-simple-adhoc --command-template=" %s --help"
Waf: Entering directory `/home'
Waf: Leaving directory `/home'
'build' finished successfully (1.816s)
ns3.22-wifi-simple-adhoc-debug [Program Arguments] [General Arguments]
Program Arguments:
--phyMode: Wifi Phy mode [DsssRate1Mbps]
--rss: received signal strength [-80]
--packetSize: size of application packet sent [1000]
--numPackets: number of packets generated [1]
--interval: interval (seconds) between packets [1]
--verbose: turn on all WifiNetDevice log components [false]
General Arguments:
--PrintGlobals: Print the list of globals.
--PrintGroups: Print the list of groups.
--PrintGroup=[group]: Print all TypeIds of group.
--PrintTypeIds: Print all TypeIds.
--PrintAttributes=[typeid]: Print all attributes of typeid.
--PrintHelp: Print this help message.