I am using a docker image which does not have the ALSA's snd-dummy module available. I need to emulate a sound card. I do not need (or want) to listen to audio.
Based on the many searches I have done I am rather certain that I want to use ALSA's snd-dummy module for emulating a sound card, which is essentially /dev/null.
Looking over the guide for ALSA Matrix:Module-dummy, it states that if "modinfo soundcore" returns that you have this module, then you don't need to recompile your kernel.
In my instance, I do NOT have "soundcore" or "sound" available. I gather that this means I have to recompile the kernel. Recompiling the kernel of a docker image is a new concept to me. Docker is a new concept to me.
In sort, I need to install ALSA's snd-dummy module onto a Linux docker image, which does NOT have soundcore/sound compiled into the kernel.
Docker Image:
https://github.com/fcwu/docker-ubuntu-vnc-desktop
ALSA Matrix snd-dummy:
https://www.alsa-project.org/main/index.php/Matrix:Module-dummy
Is this a potential solution for me?:
https://github.com/torvalds/linux/blob/master/sound/drivers/dummy.c
Edit:
When replacing ~/.asoundrc to the following and running "alsactl restore" I get the following output. Also, my host machine's volume is affected.
# .asoundrc
pcm.dummy {
type hw
card 0
}
ctl.dummy {
type hw
card 0
}
$ alsactl restore
alsactl: load_state:1683: Cannot open /var/lib/alsa/asound.state for
reading: No such file or directory Found hardware: "HDA-Intel"
"Realtek ALC269VB" "HDA:10ec0269,10280446,00100100
HDA:80862805,80860101,00100000" "0x1028" "0x0446" Hardware is
initialized using a generic method Found hardware: "Dummy" "Dummy
Mixer" "" "" "" Hardware is initialized using a generic method
I think the solution would be to mount the sound device into docker, the problem here that you must use privileged:
docker run -v /dev/snd:/dev/snd --privileged myImage ...
UPDATE
you may also insert kernel module snd-aloop and specify 2 as the index of sound loop device on your host:
sudo modprobe snd-aloop index=2
docker run -it --rm -p 6080:80 --device /dev/snd -e ALSADEV=hw:2,0 dorowu/ubuntu-desktop-lxde-vnc
Related
I'm having trouble setting up DB2 on macOS via Docker on my M1-Max MacBook Pro (32 GB RAM). I already had a look at this question, which might be related, however there is not a lot of information and I cannot exactly say, if it is about the exact same thing.
I set up following docker-compose.yml:
version: '3.8'
services:
db2:
image: ibmcom/db2
platform: linux/amd64
container_name: db2-test
privileged: true
environment:
LICENSE: "accept"
DB2INSTANCE: "db2dude"
DB2INST1_PASSWORD: "db2pw"
DBNAME: "RC1DBA"
BLU: "false"
ENABLE_ORACLE_COMPATIBILITY: "false"
UPDATEVAIL: "NO"
TO_CREATE_SAMPLEDB: "false"
REPODB: "false"
IS_OSXFS: "true"
PERSISTENT_HOME: "true"
HADR_ENABLED: "false"
ETCD_ENDPOINT: ""
ETCD_USERNAME: ""
ETCD_PASSWORD: ""
volumes:
- ~/workspace/docker/db2-error/db2/database:/database
- ~/workspace/docker/db2-error/db2/db2_data:/db2_data
ports:
- 50000:50000
on my Intel-MacBook, this spins up without any issue, on my M1-MacBook however I see after Task #4 finished, I see following portion inside of the STDOUT:
DBI1446I The db2icrt command is running.
DBI1070I Program db2icrt completed successfully.
(*) Fixing /etc/services file for DB2 ...
/bin/bash: db2stop: command not found
From what I could figure out, the presence of (*) Fixing /etc/services file for DB2 ... already seems to be wrong (since it does not appear in my intel log and does not sound like everything's fine) and the /bin/bash: db2stop: command not found appears due to line 81 of /var/db2_setup/include/db2_common_functions, which states su - ${DB2INSTANCE?} -c 'db2stop force'.
As far as I understand, su - should run with the path of the target user. In every single .profile or .bashrc in the home directory, the ~/sqllib/db2profile is being sourced (via . /database/config/db2dude/sqllib/db2profile).
However, when as root inside of the container (docker exec -it db2-test bash), calling su - db2dude -c 'echo $PATH', it prints /usr/local/bin:/bin:/usr/bin. Therefore, the PATH obviously is not as expected.
Maybe someone can figure out, what's happening at this point. I also tried running Docker with "new Virtualization framework", which did not change anything. I assume, Dockers compatibility magic might not be perfect, however I'm looking forward to find some kind of workaround, maybe by building an image upon ibmcom/db2.
I highly appreciate your time and advice. Thanks a lot in advance.
As stated in #mshabou's answer, there is no support yet. One way you can still make it work is by prepending your Docker command with DOCKER_DEFAULT_PLATFORM=linux/amd64 or executing export DOCKER_DEFAULT_PLATFORM=linux/amd64 in your shell before starting the container.
Alternatively, you can also use colima. Install colima as described on their GitHub page and then start it in emulated mode like colima start --arch x86_64. Now you will be able to use your ibmcom/db2 image the way you're used to (albeit with decreased performance).
db2 is not supported on ARM architecture, only theses Architectures are supported: amd64, ppc64le, s390x
https://hub.docker.com/r/ibmcom/db2
I want to use XFS filesystem quotas inside a docker container to limit the size of some directories. I already put quotactl in the seccomp whitelist (I am fully aware that this is not secure), but now I get a no such file or directory error.
The XFS filesystem is just accessible by a bind mount, so I tried using both the storage device from the host and from the container for the system call (for example /dev/sda2 and /dev/sda5), neither of them worked. The exact same program works perfectly fine on the host system.
Edit:
This is was strace tells me:
# On host system
quotactl(QCMD(Q_XSETQLIM, PRJQUOTA), "/dev/sda5", 0, {d_version=1, d_flags=XFS_PROJ_QUOTA, d_fieldmask=0x8, d_id=0, d_blk_hardlimit=20480, d_blk_softlimit=0, d_ino_hardlimit=0, d_ino_softlimit=0, d_bcount=0, d_icount=0, d_itimer=0, d_btimer=0, d_iwarns=0, d_bwarns=0, d_rtb_hardlimit=0, d_rtb_softlimit=0, d_rtbcount=0, d_rtbtimer=0, d_rtbwarns=0}) = 0
# Inside container
quotactl(QCMD(Q_XSETQLIM, PRJQUOTA), "/dev/sda5", 0, {d_version=1, d_flags=XFS_PROJ_QUOTA, d_fieldmask=0x8, d_id=0, d_blk_hardlimit=20480, d_blk_softlimit=0, d_ino_hardlimit=0, d_ino_softlimit=0, d_bcount=0, d_icount=0, d_itimer=0, d_btimer=0, d_iwarns=0, d_bwarns=0, d_rtb_hardlimit=0, d_rtb_softlimit=0, d_rtbcount=0, d_rtbtimer=0, d_rtbwarns=0}) = -1 ENOENT (No such file or directory)
With some help from the comments I was able to solve this problem, there are three things you need to do in order to use quotactl inside a docker container:
Use your own seccomp configuration for the container and whitelist the quotactl system call
Add the device to the container with the command line option --device=/dev/sdXX:/dev/sdXX
Run the container in privileged mode with --privileged
Tasks image_resource property is marked as optional in the documentation, but GNU/Linux tasks fail without it.
Also, the docs for the type property of image_resource say:
Required. The type of the resource. Usually docker-image
But I couldn't find any information about other supported types.
How can I run tasks on the underlying system without any container technology, like in my Windows and macOS workers?
In Concourse, you really are not supposed to do anything outside of Docker. That is one of the main features. Concourse runs in Docker containers and starts new containers for each build. If you want to run one or more Linux commands in sh or bash in the container, you can try something like this below, for your task config.
- task: linux
config:
platform: linux
image_resource:
type: docker-image
source: {repository: ubuntu, tag: '18.04'}
run:
dir: /<path-to-dir>
path: sh
user: root
args:
- -exc
- |
echo "Running in Linux!"
ls
scp <you#your-host-machine:file> .
telnet <your-host-machine>
<whatever>
...
I doing Docker tests about using apps with GUI. SublimeText,Eclipse,Hangout and others apps good working but in this case i try install popcorntime app in to docker container using Debian image and when i execute the app show me some errors. Sorry, but i'm new in Docker world and would like know how to fix this problem for future occasions.
First, I execute to docker container of next form:
docker run -ti -v /tmp/.X11-unix/:/tmp/.X11-unix -e DISPLAY --shm-size=1024m --memory 512m --device /dev/snd popcorntime bash
Next, into contaniner:
root#1cc4aea76556:/opt/popcorntime# ./Popcorn-Time
libudev: udev_has_devtmpfs: name_to_handle_at on /dev: Operation not permitted [59:1106/211526:WARNING:x11_util.cc(315)] X failed to attach to shared memory segment 262145 [59:1106/211529:INFO:CONSOLE(120)] "Uncaught ReferenceError: pageOptions is not defined", source: http://app.time4popcorn.eu/?uid=17F98CC7FD403488DA7B5E1D6989EE2C®ister_date=1478465906&version=0.3.0&os=linux&r=0.025844353018328547 (120) [59:1106/211529:INFO:CONSOLE(120)] "Uncaught ReferenceError: pageOptions is not defined", source: http://app.time4popcorn.eu/?uid=17F98CC7FD403488DA7B5E1D6989EE2C®ister_date=1478465906&version=0.3.0&os=linux&r=0.025844353018328547 (120) [59:1106/211529:ERROR:crash_handler_host_linux.cc(380)] Failed to write crash dump for pid 79 Cannot upload crash dump: cannot alloc [59:1106/211529:ERROR:breakpad_linux.cc(1225)] crash dump file written to /tmp/chromium-renderer-minidump-b10e73ec0d1694fc.dmp
Please, someone that me orient for know how to execute this app using docker container???....
Docker Seccomp default profile disabled a system call that your container is calling.
As quick and dirty solution, try running the container with additional option after docker run
--security-opt seccomp=unconfined
This way you run a container without the default seccomp profile. Then it should be better to use a custom profile putting in the white list the systemn call your container needs.
I am building a Yocto image for Intel Edison.
One of the image's components is u-boot with an Edison-specific patch. By default, Edison's UART port is used for u-boot console. I want to disable this feature, but only on the serial interface(u-boot also listens on USB and that needs to stay).
My main concern is the "Press any key to stop autoboot" feature on the UART port. I need this port to connect an accessory that might send something during the boot process of the main device.
How do I approach this problem? Is there an environment variable for this, or do I need to modify the sources?
Thanks in advance!
I'm getting back to this issue almost a year later, now I've managed to find a proper solution.
The board I was working on had a reasonably new u-boot in its BSP. To disable the serial console I had to do the following:
Add the following defines to the board's config header(located in include/configs/board.h):
#define CONFIG_DISABLE_CONSOLE
#define CONFIG_SILENT_CONSOLE
#define CONFIG_SYS_DEVICE_NULLDEV
Check if your board has early_init_f enabled in the same file:
#define CONFIG_BOARD_EARLY_INIT_F 1
Find the arch file(Something like arch/x86/cpu/architecture/architecture.c) and add this call to its early_init_f function. It actually modifies board's global data variable to have these flags:
gd->flags |= (GD_FLG_SILENT | GD_FLG_DISABLE_CONSOLE);
My board did not have one, so I had to add the whole function
int board_early_init_f(void)
{
gd->flags |= (GD_FLG_SILENT | GD_FLG_DISABLE_CONSOLE);
return 0;
}
Example:
If you are looking for board_early_init_f of Orange Pi 4B it is in /build/cache/sources/u-boot/v2020.10/board/rockchip/evb_rk3399/evb-rk3399.c
That's it. Hope this helps someone else!
see also
Setting the u-boot environment variable bootdelay to -2 disables the ability for the UART to interrupt the boot process on U-Boot 2017.01 release. It appears that -1 is a special case.
See common/autoboot.c from your U-Boot source tree for details.
About U-Boot Environment Variables
There's no way to do this, without modifying the source (configuration) of U-Boot.
To disable the serial console in U-Boot, you need to reconfigure U-Boot. The documentation from the master branch of U-Boot: Readme.silent
According to that one, you need to set:
CONFIG_SILENT_CONSOLE
CONFIG_SILENT_CONSOLE_UPDATE_ON_SET
CONFIG_SYS_DEVICE_NULLDEV
CONFIG_SILENT_U_BOOT_ONLY is also needed if you want only U-Boot to be silent.
You might also need to test with CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC and possibly adding silent 1 to CONFIG_EXTRA_ENV_SETTINGS.
== UPDATE ==
See the following options for a possible workaround:
CONFIG_ZERO_BOOTDELAY_CHECK
CONFIG_AUTOBOOT_KEYED
CONFIG_AUTOBOOT_KEYED_CTRLC
CONFIG_AUTOBOOT_PROMPT
CONFIG_AUTOBOOT_DELAY_STR
CONFIG_AUTOBOOT_STOP_STR
These options will at least give you a way of requiring a magic string to stop the boot. It might be enough to help you. See README.autoboot
As told by Kyle you can set the bootdelay u-boot environment variable to -2.
This can even be done from a booted system using the fw_setenv utility.
On my mender raspberry pi image this utility was preinstalled.
Using sudo fw_printenv bootdelay showed it was set to 2, i set it to -2 with sudo fw_setenv bootdelay -- -2 (note the -- before the value, so -2 is interpreted as the value, not an option).
In my case it was a similar issue than the OP, with a LoraWAN node on a raspberry pi connected over the serial port that interrupted the boot.
So
remove the serial device causing issue
set bootdelay either from the booted system or from the bootloader
shutdown and add the serial device back
Here is the video where it is explained step by step how to prevent U-boot console from interrupting autoboot and sending debug messages on UART on Raspberry Pi - it should work similarly for other boards, provided they use U-boot. You will however need to find the right config files for your board in u-boot source folder. I know links only answers are frowned upon, so here' s a quick breakdown of a solution:
Install the dependencies
sudo apt install git make gcc gcc-aarch64-linux-gnu bison flex
Git clone the official u-boot repository. Alternatively you can git clone my fork of repository, where I already have the necessary changes for silent autoboot - but if you need the latest version, then you need to clone the official repository and make changes yourself.
git clone --depth 1 git://git.denx.de/u-boot.git
cd u-boot
Find your board config files - they depend on the model, e.g. rpi_3_defconfig for Raspberry Pi 3, rpi_4_defconfig for Raspberry Pi 4 and so on. Add the following lines to the end of the file
CONFIG_BOOTDELAY=-2
CONFIG_SILENT_CONSOLE=y
CONFIG_SYS_DEVICE_NULLDEV=y
CONFIG_SILENT_CONSOLE_UPDATE_ON_SET=y
CONFIG_SILENT_U_BOOT_ONLY=y
The first line removes the boot delay, so autoboot will not be interrupted by messages sent on UART interface. Next four lines enable silent boot, so U-boot will not send any messages on UART itself, because the messages might in turn confuse your device. One more little thing left, set silent boot environmental variable. Change the header file for your board (for raspberry pi it is include/configs/rpi.h ) by adding the following:
#define CONFIG_EXTRA_ENV_SETTINGS \
"dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \
"silent=1\0" \
ENV_DEVICE_SETTINGS \
ENV_DFU_SETTINGS \
ENV_MEM_LAYOUT_SETTINGS \
BOOTENV
Now configure with
make rpi_3_defconfig
from repository main folder And build with
make CROSS_COMPILE=aarch64-linux-gnu-
When the build process finishes you will have a u-boot.bin file, which you need to rename (uboot_rpi_3.bin for Raspberry Pi 3) and copy to Raspberry Pi SD card at /boot/firmware/. Now you Raspberry Pi will not be disturbed by any messages on UART during boot. The UART functionality after boot will not be affected.
Relevant docs: https://gitlab.denx.de/u-boot/u-boot/blob/HEAD/doc/README.autoboot https://gitlab.denx.de/u-boot/u-boot/blob/HEAD/doc/README.silent https://wiki.ubuntu.com/ARM/RaspberryPi