我试图让 Audex在 20.04 LTS 主机上的 16.04 LTS Docker 容器中运行。
以下方法适用于基于 Gtk 的应用程序,我已经测试过了。
在当前情况下,我做了以下事情:
sudo apt-get update
sudo apt-get install docker.io
sudo usermod -a -G docker $USER
# reboot
mkdir ~/docker-audex
cat > ~/docker-audex/Dockerfile << EOF
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y audex
CMD audex
EOF
docker build -t ubuntu:audex ~/docker-audex
然后尝试从终端启动它并得到输出:
$ docker run -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --user="$(id --user):$(id --group)" ubuntu:audex QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave. audex(7): KUniqueApplication: Cannot find the D-Bus session server: "/usr/bin/dbus-launch terminated abnormally with the following error: Autolaunch error: X11 initialization failed. " audex(6): KUniqueApplication: Pipe closed unexpectedly.
或者
$ docker run -e DISPLAY -e DBUS_SESSION_BUS_ADDRESS -v /tmp/.X11-unix:/tmp/.X11-unix --user="$(id --user):$(id --group)" ubuntu:audex QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave. audex(7): KUniqueApplication: Cannot find the D-Bus session server: "Failed to connect to socket /run/user/1000/bus: No such file or directory" audex(6): KUniqueApplication: Pipe closed unexpectedly.```
或者
$ docker run -e DISPLAY -e DBUS_SESSION_BUS_ADDRESS -v /tmp/.X11-unix:/tmp/.X11-unix -v /run:/run --user="$(id --user):$(id --group)" ubuntu:audex QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave. audex(7): KUniqueApplication: Cannot find the D-Bus session server: "An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender="(null)" (inactive) interface="org.freedesktop.DBus" member="Hello" error name="(unset)" requested_reply="0" destination="org.freedesktop.DBus" (bus)" audex(6): KUniqueApplication: Pipe closed unexpectedly.
并且未显示应用程序窗口。
我想我在这里的 D-Bus 有问题。我们该如何解决?
更新,遵循下面的@SimonSudler回答:
$ docker run -e DISPLAY -e DBUS_SESSION_BUS_ADDRESS -v /tmp/.X11-unix:/tmp/.X11-unix -v /run:/run --user="$(id --user):$(id --group)" --security-opt apparmor=unconfined ubuntu:audex
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
Error: Can not find password entry for uid 1000.
trying to create local folder //.kde: Permission denied
audex(7)/KSharedDataCache KSharedDataCache::Private::mapSharedMemory: Failed to establish shared memory mapping, will fallback to private memory -- memory usage will increase
Usage: mv [OPTION]... [-T] SOURCE DEST
or: mv [OPTION]... SOURCE... DIRECTORY
or: mv [OPTION]... -t DIRECTORY SOURCE...
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
Mandatory arguments to long options are mandatory for short options too.
--backup[=CONTROL] make a backup of each existing destination file
-b like --backup but does not accept an argument
-f, --force do not prompt before overwriting
-i, --interactive prompt before overwrite
-n, --no-clobber do not overwrite an existing file
If you specify more than one of -i, -f, -n, only the final one takes effect.
--strip-trailing-slashes remove any trailing slashes from each SOURCE
argument
-S, --suffix=SUFFIX override the usual backup suffix
-t, --target-directory=DIRECTORY move all SOURCE arguments into DIRECTORY
-T, --no-target-directory treat DEST as a normal file
-u, --update move only when the SOURCE file is newer
than the destination file or when the
destination file is missing
-v, --verbose explain what is being done
-Z, --context set SELinux security context of destination
file to default type
--help display this help and exit
--version output version information and exit
The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.
The version control method may be selected via the --backup option or through
the VERSION_CONTROL environment variable. Here are the values:
none, off never make backups (even if --backup is given)
numbered, t make numbered backups
existing, nil numbered if numbered backups exist, simple otherwise
simple, never always make simple backups
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Report mv translation bugs to <http://translationproject.org/team/>
Full documentation at: <http://www.gnu.org/software/coreutils/mv>
or available locally via: info '(coreutils) mv invocation'
audex(7)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
Error: Can not find password entry for uid 1000.
X Error: BadAccess (attempt to access private resource denied) 10
Extension: 130 (MIT-SHM)
Minor opcode: 1 (X_ShmAttach)
Resource id: 0x12d
X Error: BadShmSeg (invalid shared segment parameter) 128
Extension: 130 (MIT-SHM)
Minor opcode: 5 (X_ShmCreatePixmap)
Resource id: 0x3a00017
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
Major opcode: 62 (X_CopyArea)
Resource id: 0x3a00018
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
Major opcode: 62 (X_CopyArea)
Resource id: 0x3a00018
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
Major opcode: 62 (X_CopyArea)
Resource id: 0x3a00018
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
Major opcode: 62 (X_CopyArea)
Resource id: 0x3a00018
添加--ipc=host
也无济于事:
$ docker run --ipc=host -e DISPLAY -e DBUS_SESSION_BUS_ADDRESS -v /tmp/.X11-unix:/tmp/.X11-unix -v /run:/run --user="$(id --user):$(id --group)" --security-opt apparmor=unconfined ubuntu:audex
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
Error: Can not find password entry for uid 1000.
trying to create local folder //.kde: Permission denied
audex(7)/KSharedDataCache KSharedDataCache::Private::mapSharedMemory: Failed to establish shared memory mapping, will fallback to private memory -- memory usage will increase
Usage: mv [OPTION]... [-T] SOURCE DEST
or: mv [OPTION]... SOURCE... DIRECTORY
or: mv [OPTION]... -t DIRECTORY SOURCE...
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
Mandatory arguments to long options are mandatory for short options too.
--backup[=CONTROL] make a backup of each existing destination file
-b like --backup but does not accept an argument
-f, --force do not prompt before overwriting
-i, --interactive prompt before overwrite
-n, --no-clobber do not overwrite an existing file
If you specify more than one of -i, -f, -n, only the final one takes effect.
--strip-trailing-slashes remove any trailing slashes from each SOURCE
argument
-S, --suffix=SUFFIX override the usual backup suffix
-t, --target-directory=DIRECTORY move all SOURCE arguments into DIRECTORY
-T, --no-target-directory treat DEST as a normal file
-u, --update move only when the SOURCE file is newer
than the destination file or when the
destination file is missing
-v, --verbose explain what is being done
-Z, --context set SELinux security context of destination
file to default type
--help display this help and exit
--version output version information and exit
The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.
The version control method may be selected via the --backup option or through
the VERSION_CONTROL environment variable. Here are the values:
none, off never make backups (even if --backup is given)
numbered, t make numbered backups
existing, nil numbered if numbered backups exist, simple otherwise
simple, never always make simple backups
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Report mv translation bugs to <http://translationproject.org/team/>
Full documentation at: <http://www.gnu.org/software/coreutils/mv>
or available locally via: info '(coreutils) mv invocation'
audex(7)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
Error: Can not find password entry for uid 1000.
运行没有 apparmor 配置文件的容器
原因是 apparmor 的docker-default配置文件。规则通过此模板集成到 docker 守护程序中。
有一种快速验证方法,如果此配置文件导致问题,请将其添加
--security-opt apparmor=unconfined
到run
命令中:您可以开始为 audex 编写 apparmor 配置文件,但我认为这不值得。由于
audix
是 CD 开膛手,因此用户需要一些“特权”访问才能将 CD 插入/取出 PC。所以使用apparmor=unconfined
应该足够安全。Audex的核心转储
启动时
audex
,它会执行几个预期是编码器的命令(例如faac --help
)。由于某种原因,它也会执行mv --help
,这会产生奇怪的输出。至少这似乎不是问题的一部分。此外,此行为仅在~/.kde/share/config/audexrc
写入文件之前发生。在那之后,只剩下崩溃了……查看 audex 的核心转储:
audix
我在尝试读取 CD-ROM 设备 URL 时接缝死了。我添加了/dev/sr0
and/dev/cdrom
来适应它,但它没有任何效果(请参阅 docker 的 handbreak 示例)。audex
将容器中的用户添加到cdrom
组中也没有帮助。这似乎是 16.04 旧版本中的一个错误
audix
,它需要一个旧的 URL 字符串。由于缺少一些“旧”的 KDE 行为,可能无法在当前的 Ubuntu 系统上运行
audex
。ubuntu:16.04
然而,有一个来自 KDE 的Neon/Docker,但它还需要主机上的 KDE。