AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-15010

MountainX's questions

Martin Hope
MountainX
Asked: 2021-12-19 19:16:54 +0800 CST

驻留在 SSHFS 挂载上时如何使用 sudo 执行脚本?

  • 1

我不是在询问挂载 SSHFS 挂载点,这是我发现的所有类似问题的主题。

我的挂载点 ( /path/to/sshfs/mount/) 已正确挂载,我可以作为我的用户列出、读取、写入所有预期的文件。

我确实有权将脚本复制到本地目录。但是,因为该脚本需要几个包含库文件和资源的子目录,所以我更喜欢在它所在的位置执行该脚本,而不是在本地复制它。此外,无需将其复制到本地机器即可完成其预期工作。

不幸的是,对于 SSHFS 挂载,该脚本需要 root 权限才能进行许多操作,因为它必须将一些文件安装到系统目录并更新系统中存在的不同用户的文件。

这是我的错误:

$ cd /path/to/sshfs/mount/
$ sudo ./myscript.sh
sudo: unable to execute ./myscript.sh: Permission denied

以下是我执行的检查:

$ ls -la
-rwxr-x--- 1 myuser team   8173 Dec 15 06:33 myscript.sh

$ sudo -i
[sudo] password for myuser:
#

$ cat /etc/fstab
myuser@myserver:/path/to/sshfs/mount/ /path/to/sshfs/mount/  fuse.sshfs x-systemd.automount,_netdev,user,follow_symlinks,identityfile=/path/to/.ssh/key_file,allow_other,default_permissions   0 2

这表明所需的 fuse.conf 选项已启用:

$ cat /etc/fuse.conf
user_allow_other

什么 SSHFS 配置将允许我运行:

$ sudo /path/to/sshfs/mount/myscript.sh
sudo sshfs
  • 2 个回答
  • 290 Views
Martin Hope
MountainX
Asked: 2021-11-16 22:29:30 +0800 CST

这是什么 zsh 语法?名称()真

  • 3

我假设以下块代表一个函数,但它可能不是:

mounted()true
if
  ...
fi ... && mounted

我想了解那个构造是什么。我在zsh的函数标题下没有找到类似的语法

更完整的实际代码片段是:

#! /bin/zsh -p

# leaving out a section...

tmpdir=$(mktemp -d) || exit

mounted()true
if
  mount "$type[@]" -o "${(j[,])opts}" -- "$dev" "$tmpdir"
then
  mount --bind -- "$tmpdir/$subdir" "$dest" || mounted()false
  umount -- "$tmpdir"
fi && rmdir -- "$tmpdir" && mounted

一旦我理解了它,我将把整个 zsh 脚本转换成我更熟悉的语言。我可能会将其转换为 bash 作为中间步骤。

zsh
  • 1 个回答
  • 487 Views
Martin Hope
MountainX
Asked: 2021-11-06 21:43:50 +0800 CST

如何为我正在挂载的挂载点自动挂载一个先决条件挂载点?

  • 0

我正在运行 Arch Linux 和 systemd。

在/etc/fstab我有这样的事情:

LABEL=XYZ       /mypath       vfat    noauto,[...]
/mypath/main    /newplace     none    bind,noauto    0 0

我目前必须/newplace使用两个命令进行挂载:

mount /mypath
mount /newplace

我也必须umount两者兼而有之。

我需要将其简化为一个mount(或umount)命令:

mount /newplace

由于现有脚本,我需要使用上面显示的确切mount(和相关)命令。umount澄清:

单个命令mount /newplace应首先 mount /mypath,然后 mount/newplace并/mypath应保持已安装状态。

该命令umount /newplace应首先 umount /newplace,然后也是umount /mypath。

我可以更改/etc/fstab设备的其他一些细节。但我无法更改调用mount /newplace. 我也无法自动挂载/newplace,因为它通常需要保持卸载状态,除非在脚本运行时。

我一直在阅读有关递归绑定挂载、共享、私有、从属和其他挂载选项的信息,但我还没有看到实现我所寻求的方法。

更新:回应评论,这显然不是递归挂载,所以我称之为“先决条件”挂载。我希望这个词是合适的。我想到了“反向递归安装”这个词,但这似乎很糟糕。我认为“先决条件”是指必须先于并为必要条件提供持续基础的东西。通常,在继续进行必备项时,不能忘记或删除必备项。

在这种情况下,/mypath(prerequisite) 和/newplace(requisite) 在挂载时都保持挂载/newplace,并且在调用时它们都将被挂载(当然可能以相反的顺序)umount /newplace。

理想的解决方案将使用 systemd、Python 3 或 Xonsh。(也可以接受 Bash 脚本。我没有安装 zsh 或其他 shell。)

mount
  • 1 个回答
  • 99 Views
Martin Hope
MountainX
Asked: 2021-09-26 15:14:33 +0800 CST

如何使用 nohup 从终端重新启动 Plasma 5?

  • -1

关于重启 Plasma 5 有很多问题和答案。我意识到使用 KRunner 是最好的选择,但今天我无法访问 KRunner,不得不使用终端。

在阅读了 nohup、disown 和 & 之间的区别之后,我觉得这两个主题(重新启动 Plasma 5 和 nohub/disown/background 作业)需要组合成一个特定于以正确方式重新启动 KDE Plasma 5 的答案。我看到的关于重启 Plasma 5 的几乎所有答案都忽略了nohup.

通过遵循有关重新启动 Plasma 5 的不同答案,我在不同时间发现自己无法关闭终端窗口而不杀死我新启动的 Plasma 5 会话。

以下脚本来自几个答案,主要是https://unix.stackexchange.com/a/499373,并被修改为包含nohup. 这是最终的、全面的解决方案吗?还是需要避免的混乱?

#!/bin/sh
kbuildsycoca5 # rebuilds the plasmashell database
timeout 5 kquitapp5 plasmashell #without timeout, it can hang for ~30-60 seconds
pgrep -U $USER -x plasmashell &>/dev/null && pkill -U $USER -x plasmashell
pgrep -U $USER -x plasmashell &>/dev/null && pkill -U $USER -x -9 plasmashell # here the process does not get to clean-up.
killall -9 plasmashell #sends a signal to all processes running any of the specified commands
pgrep -U $USER -x plasmashell &>/dev/null && echo "ERROR: cannot kill plasmashell"
nohup plasmashell &

我的具体问题是关于最后一行:

nohup plasmashell &

在这种情况下是否正确?

shell-script plasma5
  • 1 个回答
  • 498 Views
Martin Hope
MountainX
Asked: 2021-09-19 14:44:12 +0800 CST

对于 path 下的每个目录,从该目录执行 shell 脚本(当 find -execdir 不合适时)

  • 0

我有一个现有的 bash 脚本,我这样称呼它:

find /path/to/my/stuff -type d -exec sh -c 'cd "$0"; /path/to/my/script.sh function_name fn_parameter' {} \;

我经常更改/path/to/my/stuffand fn_parameter。我有时还需要更改function_name.

不断重新输入这个命令变得很乏味,所以我想将它包装在另一个脚本中,并像这样传递这三个参数:

wrapper.sh function_name "/path/to/my/stuff" fn_parameter

旁注:我更改了参数的顺序,因为“function_name”是最不频繁更改的参数。

当我尝试制作这个包装脚本时,我被引用和转义弄得不知所措。我查看了 shellcheck.net 中的脚本,还尝试使用数组 for cmd(请参阅下面的失败尝试之一)但没有成功。我确实理解问题很可能是引号和反斜杠没有得到尊重,但我不明白如何解决这个问题。

这是我许多失败的尝试之一:

包装器.sh

#!/bin/bash
function_name=$1
mpath="$2"
arg=$3

find "$mpath" -type d -exec sh -c "cd \"$0\"; /path/to/my/script.sh $function_name $arg" {} \;

这是失败尝试的另一个示例:

#!/bin/bash
function_name=$1
mpath="$2"
arg=$3
cmd="'cd \$0; /path/to/my/script.sh $function_name $arg'"
echo "find \"$mpath\" -type d -exec sh -c $cmd {} \;"
find "$mpath" -type d -exec sh -c $cmd {} \;

在上面的例子中,如果我在命令行输入 echo 语句的输出,它就可以正常工作。但是包装器失败了:

$0;: -c: line 1: unexpected EOF while looking for matching `''
$0;: -c: line 2: syntax error: unexpected end of file

为了完整起见,myscript.sh 与此类似:

#!/bin/bash

fn1() {
  ...
}

fn2() {
  ...
}


fn3() {
  ...
}

"$@"
bash shell-script
  • 2 个回答
  • 127 Views
Martin Hope
MountainX
Asked: 2020-03-06 15:11:42 +0800 CST

rsync:通知任何被跳过的文件

  • 0

我正在使用以下rsync包含“更新”选项的命令,这意味着它将跳过接收器上较新的文件。它可以工作,只是我需要它来告诉我跳过的文件,因为它们在接收器上较新。

rsync -ahHX --delete --itemize-changes --stats --update /path/to/source/ --exclude=/dir1/ --exclude=/dir2/ --exclude=/dir3/ /path/to/receiver/

我已经查看了手册页,但没有看到这样的选项。我希望我只是错过了它或不明白一些东西。

如果 rsync 不会这样做,我还可以使用哪些其他工具?我试过diff -rqw /path/to/source/ /path/to/receiver/了,但这需要的时间太长了。它做的比我需要的要多。

71,835 个文件的总文件大小为 24.60 GB。

rsync file-copy
  • 2 个回答
  • 768 Views
Martin Hope
MountainX
Asked: 2020-02-14 22:39:30 +0800 CST

如何将 /dev/ttyUSB0 (usbserial CP210x) 映射到 wine 中的 COM 端口?

  • 2

我在 wine 中运行一个 Windows 应用程序。该应用程序只能看到 COM 端口 1-4。

我的系统有以下 USB 串行设备:

# lsmod | grep cp210x
cp210x                 36864  0

# ls /dev/ttyUSB0
crw-rw---- 1 root uucp 188, 0 Feb 14 00:42 /dev/ttyUSB0

如何将其作为 COM1 呈现给葡萄酒应用程序?

serial-port wine
  • 2 个回答
  • 9534 Views
Martin Hope
MountainX
Asked: 2020-02-14 20:58:57 +0800 CST

要安装哪个软件包:lib32-libglvnd-git 或 lib32-mesa-libgl-noglvnd?

  • 1

我正在集成 Intel HD 520 显卡的笔记本电脑上安装交叉。它运行 64 位 Arch Linux,64 位显示驱动程序是mesa(版本 19.3.3-1)。

我正在安装交叉,我有以下选择:

:: There are 8 providers available for lib32-libgl:
:: Repository AUR
    1) catalyst-test 2) lib32-amdgpu-pro-libgl 3) lib32-catalyst-libgl 4) lib32-libglvnd-git 5) lib32-mesa-libgl-noglvnd 6) lib32-nvidia-340xx-utils 7) lib32-nvidia-libgl-352 8) lib32-nvidia-libgl-llb

我应该选择哪个选项?

我相信选择是在lib32-libglvnd-git或之间lib32-mesa-libgl-noglvnd。

这是我所知道的libglvnd:

libglvnd 是一个供应商中立的调度层,用于仲裁多个供应商之间的 OpenGL API 调用。它允许来自不同供应商的多个驱动程序在同一个文件系统上共存,并确定在运行时将每个 API 调用分派给哪个供应商。支持 GLX 和 EGL,与 OpenGL 和 OpenGL ES 任意组合。

但是,我仍然不知道该选择哪个选项。

arch-linux drivers
  • 1 个回答
  • 1228 Views
Martin Hope
MountainX
Asked: 2020-02-13 20:30:04 +0800 CST

在跳过所有挂载的同时快速更改 $HOME 中所有目录的权限

  • 0

在用户主目录包含一个或多个 NFS 挂载点的情况下,如何跳过这些挂载并有效地更改目录权限?

我想chmod o-rwx在用户主目录下的所有未安装目录上运行。

我将以 root 用户身份运行该命令,因为我正在为系统上的所有用户执行此操作。(NFS 挂载具有root_squash挂载选项。)

这是我尝试过的。但是,它没有按预期工作。

sudo find /home/myuser/ -mount -path ./Documents -prune -o -type d -exec chmod o-rwx {} \;
chmod: changing permissions of '/home/myuser/Documents': Operation not permitted

我想避免错误消息。更重要的是,find 命令需要很长时间才能运行。我相信这表明它正在下降到挂载点(其中包含许多目录和文件)。

我的命令的另一个问题是我必须明确编码要跳过的位置。所有用户都安装了 Documents,但有些用户安装了其他名称不同的 NFS。

我的目标是自动修复用户帐户(即chmod o-rwx)中的简单目录权限问题。我该如何在我的情况下做到这一点?

filesystems permissions
  • 1 个回答
  • 217 Views
Martin Hope
MountainX
Asked: 2020-02-11 22:29:51 +0800 CST

指定服务器接受的允许的客户端 SSH 密钥类型

  • 10

我有一台服务器(运行 openssh 8.1p1-2),其 sshd_config 配置如下,仅接受 ed25519 密钥:

PubkeyAcceptedKeyTypes [email protected],ssh-ed25519

这对我们的团队很有用。我们都只使用 ed25519 密钥。并且该指令正常工作,因为其他键类型被拒绝。

但是,现在我需要暂时让一个只能使用 rsa 密钥类型的人进行连接(根据他们无法控制的政策)。

我做了以下更改:

PubkeyAcceptedKeyTypes ssh-rsa,[email protected],[email protected],ssh-ed25519

...并重新启动 sshd:

systemctl restart sshd

根据systemctl status sshd, sshd 状态是没有错误的。但是,当此人尝试连接服务器时,日志显示:

sshd[12345]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedKeyTypes [preauth]

客户端的错误很简单:

No more authentication methods to try. user@ip: Permission denied (publickey).

我不明白这个问题,因为ssh-rsa在 PubkeyAcceptedKeyTypes 中。我错过了什么?

sshd ssh
  • 2 个回答
  • 14078 Views
Martin Hope
MountainX
Asked: 2020-02-07 21:08:07 +0800 CST

在 Arch 中安装 python-language-server 时,如何确保它使用 YAPF 进行代码格式化?

  • 1

该包python-language-server(Python LSP 支持)是 Arch Linux 中 Kate 编辑器的一个新的可选依赖项。

以下是为什么这可能很有趣的一些背景:

Langserver.org

为什么选择 LSP?LSP 创造了减少 m-times-n 复杂性问题的机会,即为任何编辑器、IDE 或客户端端点中的任何编程语言提供高级别的支持,以简化 m-plus-n 问题。

我决定要试一试。所以我在这里查看了更多信息:

palantir/python-language-server:Python 语言服务器协议的实现

我想使用YAPF,所以我记下了以下信息:

可以使用 extras 语法安装可选的提供程序。以安装 YAPF 格式为例:

pip install 'python-language-server[yapf]'

我想使用 Arch repos 而不是 pip 安装它。我的问题是,从 Arch 存储库安装“python-language-server”时如何获得相同的结果?这会是等价的吗?

pacman -Syu python-language-server yapf

可选背景:我为什么要使用 YAPF:

大多数当前的 Python 格式化程序——例如,autopep8 和 pep8ify——都是为了从代码中删除 lint 错误。这有一些明显的局限性。例如,可能不会重新格式化符合 PEP 8 指南的代码。但这并不意味着代码看起来不错。

YAPF 采取了不同的方法。它基于 Daniel Jasper 开发的“clang-format”。本质上,该算法采用代码并将其重新格式化为符合样式指南的最佳格式,即使原始代码没有违反样式指南。这个想法也类似于 Go 编程语言的“gofmt”工具:结束所有关于格式化的圣战——如果一个项目的整个代码库在进行修改时简单地通过 YAPF 进行管道传输,那么整个项目的风格保持一致,并且有没有必要在每次代码审查中争论风格。

最终目标是 YAPF 生成的代码与程序员遵循样式指南编写的代码一样好。它消除了维护代码的一些苦差事。

arch-linux software-installation
  • 1 个回答
  • 613 Views
Martin Hope
MountainX
Asked: 2020-02-07 18:59:52 +0800 CST

如何在 Arch Linux 上为 python 2 安装 python-reportlab?

  • 1

自从我开始使用 Arch 以来,我一直从 Arch 存储库安装 python 包,而不是使用任何 python 包管理器(例如pip)。

现在我正在尝试安装ExportPDFCMYK。这取决于Uniconvertor和ImageMagick。问题在于,这Uniconvertor取决于缺少的包python2-reportlab。

这是我通常的软件包安装工作流程无法完成的极少数情况之一。

我可以使用哪些步骤python2-reportlab在 Arch 上安装?我可以使用 python 包管理器吗?这足以满足Uniconvertor包的依赖关系吗?

或者,我可以使用另一种方法来安装ExportPDFCMYK,这仍然是我的最终目标吗?

arch-linux software-installation
  • 1 个回答
  • 385 Views
Martin Hope
MountainX
Asked: 2020-02-02 18:35:19 +0800 CST

如何将新的(自定义)mime 类型与文件关联(基于文件扩展名)?

  • 3

这是如何使用 CLI 工具在我的 Linux 系统上安装新的(自定义)mime 类型的第 2 部分?

使用上述问题的已接受答案中的步骤,我创建了以下 mime-type mx-publickey.xml

<?xml version="1.0" encoding="utf-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/x-publickey">
<comment>Custom type for public key files (plain text)</comment>
    <glob-deleteall/>
    <glob pattern="*.pub"/>
</mime-type>
</mime-info>

我使用以下命令在系统范围内安装了它:

# xdg-mime install --mode system mx-publickey.xml

我添加了所需的图标:

xdg-icon-resource install --context mimetypes --size 256 x-publickey-icon.png text-x-publickey

然后我测试了它。我的 '*.pub` 文件仍然有旧的关联:

$ xdg-mime query filetype id_rsa_test.pub
text/plain

$ xdg-mime query default text/plain
org.kde.kate.desktop

将“*.pub”文件与我的新 mime 类型相关联需要哪些额外步骤?

编辑:

我执行了以下步骤,但*.pub默认情况下,公钥文件仍未使用来自 Electron 应用程序的 Kate 打开。

# xdg-mime default  org.kde.kate.desktop text/x-publickey

# xdg-mime query default text/x-publickey
org.kde.kate.desktop

$ xdg-mime query default text/x-publickey
org.kde.kate.desktop

接下来,我使用 GUI 工具(KDE 系统设置 > 应用程序 > 文件关联)和*.pub 与 Kate 关联的公钥文件。Electron 应用程序仍然拒绝*.pub使用 Kate 打开文件。

电子应用程序以前使用 Okular。在上面显示的xdg-mime default命令之后,Okular 关联消失了,但没有任何东西取代它。Electron 应用程序现在显示一个 KIO 对话框,要求我选择要使用的应用程序。(这比强迫我使用错误的应用程序要好,但这仍然不是正确的行为。看来 Electron 应用程序正在其他地方寻找文件关联。我想了解这一点。)

我是否.desktop在某个位置缺少所需的文件?

另一个想法:经过上述步骤,我相信我现在应该看到text/x-publickeyin的条目/usr/share/applications/mimeinfo.cache。但是,没有一个。

xdg-open mime-types
  • 1 个回答
  • 1999 Views
Martin Hope
MountainX
Asked: 2020-02-01 15:04:39 +0800 CST

KDE 没有保存 mime 类型的文件关联

  • 8

我正在运行 Arch Linux 和 KDE,并且正在探索 mime 类型在我的系统上的行为(和行为不端)。

考虑这种 mime 类型的文件关联。以下控制台输出显示我有 mime-type xml 定义文件,并且.pub文件和 mime-type之间存在关联application/vnd.ms-publisher。

$ xdg-mime query filetype ~/.ssh/id_rsa_test.pub
application/vnd.ms-publisher

$ less mimeapps.list
[Added Associations]
application/vnd.ms-publisher=org.kde.kate.desktop;

# find /usr -name vnd.ms-publisher.xml
/usr/share/mime/application/vnd.ms-publisher.xml

# less /usr/share/mime/application/vnd.ms-publisher.xml

<?xml version="1.0" encoding="utf-8"?>
<mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info" type="application/vnd.ms-publisher">
<!--Created automatically by update-mime-database. DO NOT EDIT!-->
<sub-class-of type="application/x-ole-storage"/>
<glob pattern="*.pub"/>
</mime-type>

(我不喜欢 ms-publisher 与我的 Linux 系统上的公钥相关联的事实,但这是另一个问题的主题。)

从上面可以看出,一切都井井有条。

接下来我决定为 Kate(文本编辑器)添加一个关联来处理.pub公钥文件。我使用 KDE 系统设置 > 应用程序 > 文件关联创建了它。

这个屏幕截图显示了我所做的。当我单击“应用”时,进度对话框会短暂出现,并且操作似乎已成功。

添加文件关联

然而,在重新访问同一个对话框时,我刚刚添加的 Kate 关联消失了。“应用程序优先顺序”下的框为空。

我添加的关联消失了

我的问题是:是什么导致此文件关联无法保存,我该如何解决?

检查journalctl -r我发现以下消息(以相反的顺序)。所有行都以前缀 simlarl 开头,Jan 31 17:24:18 laptop systemsettings5[20318]但我删除了大部分以节省空间。

Jan 31 17:24:19 laptop systemsettings5[20318]: Mimetype Comment Dirty: old= "Kindle book document" m_comment= "Amazon KF8 ebook format"
Jan 31 17:24:19 laptop systemsettings5[20318]: Mimetype Comment Dirty: old= "ODB database" m_comment= "OpenDocument Database"
Jan 31 17:24:19 laptop systemsettings5[20318]: kf5.kservice.services: KMimeTypeTrader: mimeType "application/vnd.ms-publisher" not found
Jan 31 17:24:19 laptop systemsettings5[20318]: kf5.kservice.services: KMimeTypeTrader: mimeType "application/vnd.ms-publisher" not found
Jan 31 17:24:19 laptop systemsettings5[20318]: ("services", "servicetypes", "xdgdata-mime", "apps")

...

Jan 31 17:24:18 laptop systemsettings5[20318]: "application/vnd.ms-publisher" hasDefinitionFile: false
kf5.kservice.sycoca: Service type not found: "audio/x-xm"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.presentation-template"
kf5.kservice.sycoca: Service type not found: "text/x-rst"
kf5.kservice.sycoca: Service type not found: "application/pdf"
kf5.kservice.sycoca: Service type not found: "application/x-bzip"
kf5.kservice.sycoca: Service type not found: "application/x-cue"
kf5.kservice.sycoca: Service type not found: "image/x-rgb"
kf5.kservice.sycoca: Service type not found: "application/x-gzpdf"
kf5.kservice.sycoca: Service type not found: "application/x-cmakecache"
kf5.kservice.sycoca: Service type not found: "image/x-sigma-x3f"
kf5.kservice.sycoca: Service type not found: "application/x-tellico"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.spreadsheet-flat-xml"
kf5.kservice.sycoca: Service type not found: "application/x-mswrite"
kf5.kservice.sycoca: Service type not found: "application/x-t602"
kf5.kservice.sycoca: Service type not found: "image/x-nikon-nef"
kf5.kservice.sycoca: Service type not found: "video/x-flic"
kf5.kservice.sycoca: Service type not found: "x-content/video-vcd"
kf5.kservice.sycoca: Service type not found: "audio/flac"
kf5.kservice.sycoca: Service type not found: "application/xspf+xml"
kf5.kservice.sycoca: Service type not found: "image/svg+xml"
kf5.kservice.sycoca: Service type not found: "application/x-tar"
kf5.kservice.sycoca: Service type not found: "image/x-xpixmap"
kf5.kservice.sycoca: Service type not found: "application/vnd.sun.xml.calc"
kf5.kservice.sycoca: Service type not found: "application/gzip"
kf5.kservice.sycoca: Service type not found: "application/x-zip-compressed-fb2"
kf5.kservice.sycoca: Service type not found: "application/x-compressed-tar"
kf5.kservice.sycoca: Service type not found: "audio/x-wavpack"
kf5.kservice.sycoca: Service type not found: "video/vnd.rn-realvideo"
kf5.kservice.sycoca: Service type not found: "image/x-pic"
kf5.kservice.sycoca: Service type not found: "application/vnd.sun.xml.draw"
kf5.kservice.sycoca: Service type not found: "audio/x-pn-realaudio-plugin"
kf5.kservice.sycoca: Service type not found: "application/x-kexi-connectiondata"
kf5.kservice.sycoca: Service type not found: "application/x-mobipocket-ebook"
kf5.kservice.sycoca: Service type not found: "audio/ac3"
kf5.kservice.sycoca: Service type not found: "application/vnd.openofficeorg.extension"
kf5.kservice.sycoca: Service type not found: "image/x-win-bitmap"
kf5.kservice.sycoca: Service type not found: "application/vnd.kde.okular-archive"
kf5.kservice.sycoca: Service type not found: "application/x-zstd-compressed-tar"
kf5.kservice.sycoca: Service type not found: "audio/mpeg"
kf5.kservice.sycoca: Service type not found: "video/mlt-playlist"
kf5.kservice.sycoca: Service type not found: "image/x-kde-raw"
kf5.kservice.sycoca: Service type not found: "application/x-7z-compressed"
kf5.kservice.sycoca: Service type not found: "audio/vnd.rn-realaudio"
kf5.kservice.sycoca: Service type not found: "image/x-panasonic-rw"
kf5.kservice.sycoca: Service type not found: "text/x-patch"
kf5.kservice.sycoca: Service type not found: "application/x-kdenlivetitle"
kf5.kservice.sycoca: Service type not found: "application/vnd.lotus-1-2-3"
kf5.kservice.sycoca: Service type not found: "x-content/blank-cd"
kf5.kservice.sycoca: Service type not found: "application/vnd.ms-asf"
kf5.kservice.sycoca: Service type not found: "video/quicktime"
kf5.kservice.sycoca: Service type not found: "image/vnd.djvu"
kf5.kservice.sycoca: Service type not found: "video/x-anim"
kf5.kservice.sycoca: Service type not found: "text/plain"
kf5.kservice.sycoca: Service type not found: "application/x-java-keystore"
kf5.kservice.sycoca: Service type not found: "application/x-archive"
kf5.kservice.sycoca: Service type not found: "application/x-sv4crc"
kf5.kservice.sycoca: Service type not found: "application/vnd.appimage"
kf5.kservice.sycoca: Service type not found: "application/vnd.visio"
kf5.kservice.sycoca: Service type not found: "image/x-tga"
kf5.kservice.sycoca: Service type not found: "application/x-zoom"
kf5.kservice.sycoca: Service type not found: "image/heif"
kf5.kservice.sycoca: Service type not found: "image/rle"
kf5.kservice.sycoca: Service type not found: "text/csv"
kf5.kservice.sycoca: Service type not found: "application/vnd.ms-cab-compressed"
kf5.kservice.sycoca: Service type not found: "application/vnd.lotus-wordpro"
kf5.kservice.sycoca: Service type not found: "application/x-xar"
kf5.kservice.sycoca: Service type not found: "audio/aac"
kf5.kservice.sycoca: Service type not found: "application/vnd.openxmlformats-officedocument.presentationml.template"
kf5.kservice.sycoca: Service type not found: "image/x-icns"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.presentation"
kf5.kservice.sycoca: Service type not found: "audio/x-tta"
kf5.kservice.sycoca: Service type not found: "application/x-cbt"
kf5.kservice.sycoca: Service type not found: "image/tiff"
kf5.kservice.sycoca: Service type not found: "application/ogg"
kf5.kservice.sycoca: Service type not found: "application/vnd.ms-wpl"
kf5.kservice.sycoca: Service type not found: "image/x-pentax-pef"
kf5.kservice.sycoca: Service type not found: "image/x-olympus-orf"
kf5.kservice.sycoca: Service type not found: "application/vnd.ms-excel"
kf5.kservice.sycoca: Service type not found: "application/pgp-keys"
kf5.kservice.sycoca: Service type not found: "image/x-jng"
kf5.kservice.sycoca: Service type not found: "application/x-lz4-compressed-tar"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.text-master"
kf5.kservice.sycoca: Service type not found: "application/vnd.sun.xml.impress.template"
kf5.kservice.sycoca: Service type not found: "application/x-font-pcf"
kf5.kservice.sycoca: Service type not found: "application/xhtml+xml"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.text"
kf5.kservice.sycoca: Service type not found: "application/x-java"
kf5.kservice.sycoca: Service type not found: "image/x-sgi"
kf5.kservice.sycoca: Service type not found: "audio/basic"
kf5.kservice.sycoca: Service type not found: "application/x-executable"
kf5.kservice.sycoca: Service type not found: "text/spreadsheet"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.spreadsheet-template"
kf5.kservice.sycoca: Service type not found: "audio/x-ms-wma"
kf5.kservice.sycoca: Service type not found: "image/x-fuji-raf"
kf5.kservice.sycoca: Service type not found: "application/x-compress"
kf5.kservice.sycoca: Service type not found: "audio/vnd.dts"
kf5.kservice.sycoca: Service type not found: "image/fits"
kf5.kservice.sycoca: Service type not found: "application/x-xz"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.formula-template"
kf5.kservice.sycoca: Service type not found: "image/gif"
kf5.kservice.sycoca: Service type not found: "audio/x-ms-asx"
kf5.kservice.sycoca: Service type not found: "video/x-mng"
kf5.kservice.sycoca: Service type not found: "image/x-gimp-gbr"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.chart-template"
kf5.kservice.sycoca: Service type not found: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
kf5.kservice.sycoca: Service type not found: "application/x-bzpdf"
kf5.kservice.sycoca: Service type not found: "image/png"
kf5.kservice.sycoca: Service type not found: "application/x-gzdvi"
kf5.kservice.sycoca: Service type not found: "application/mxf"
kf5.kservice.sycoca: Service type not found: "application/x-wpg"
kf5.kservice.sycoca: Service type not found: "image/x-xwindowdump"
kf5.kservice.sycoca: Service type not found: "image/x-dcraw"
kf5.kservice.sycoca: Service type not found: "audio/x-mpegurl"
kf5.kservice.sycoca: Service type not found: "x-content/audio-player"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.text-web"
kf5.kservice.sycoca: Service type not found: "x-content/blank-dvd"
kf5.kservice.sycoca: Service type not found: "image/cgm"
kf5.kservice.sycoca: Service type not found: "application/x-fictionbook+xml"
kf5.kservice.sycoca: Service type not found: "application/vnd.palm"
kf5.kservice.sycoca: Service type not found: "video/webm"
kf5.kservice.sycoca: Service type not found: "image/wmf"
kf5.kservice.sycoca: Service type not found: "text/tab-separated-values"
kf5.kservice.sycoca: Service type not found: "application/x-pagemaker"
kf5.kservice.sycoca: Service type not found: "application/vnd.comicbook-rar"
kf5.kservice.sycoca: Service type not found: "image/openraster"
kf5.kservice.sycoca: Service type not found: "application/illustrator"
kf5.kservice.sycoca: Service type not found: "application/vnd.ms-publisher"
kf5.kservice.sycoca: Service type not found: "application/msword"
kf5.kservice.sycoca: Service type not found: "application/x-krita"
kf5.kservice.sycoca: Service type not found: "application/x-dvi"
kf5.kservice.sycoca: Service type not found: "image/x-portable-bitmap"
kf5.kservice.sycoca: Service type not found: "audio/AMR"
kf5.kservice.sycoca: Service type not found: "application/x-cpio"
kf5.kservice.sycoca: Service type not found: "image/webp"
kf5.kservice.sycoca: Service type not found: "application/vnd.sun.xml.writer"
kf5.kservice.sycoca: Service type not found: "text/css"
kf5.kservice.sycoca: Service type not found: "image/x-adobe-dng"
kf5.kservice.sycoca: Service type not found: "image/x-eps"
kf5.kservice.sycoca: Service type not found: "application/vnd.sun.xml.draw.template"
kf5.kservice.sycoca: Service type not found: "image/x-compressed-xcf"
kf5.kservice.sycoca: Service type not found: "application/x-bzip-compressed-tar"
kf5.kservice.sycoca: Service type not found: "application/x-quattropro"
kf5.kservice.sycoca: Service type not found: "application/x-ms-dos-executable"
kf5.kservice.sycoca: Service type not found: "application/vnd.ms-access"
kf5.kservice.sycoca: Service type not found: "application/vnd.ms-powerpoint"
kf5.kservice.sycoca: Service type not found: "application/x-sv4cpio"
kf5.kservice.sycoca: Service type not found: "audio/mp4"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.chart"
kf5.kservice.sycoca: Service type not found: "application/x-lrzip-compressed-tar"
kf5.kservice.sycoca: Service type not found: "application/vnd.comicbook+zip"
kf5.kservice.sycoca: Service type not found: "application/vnd.sun.xml.writer.global"
kf5.kservice.sycoca: Service type not found: "application/vnd.apple.mpegurl"
kf5.kservice.sycoca: Service type not found: "application/x-xojpp"
kf5.kservice.sycoca: Service type not found: "application/x-bzdvi"
kf5.kservice.sycoca: Service type not found: "image/x-gimp-pat"
kf5.kservice.sycoca: Service type not found: "image/x-gimp-gih"
kf5.kservice.sycoca: Service type not found: "application/vnd.sun.xml.math"
kf5.kservice.sycoca: Service type not found: "image/vnd.zbrush.pcx"
kf5.kservice.sycoca: Service type not found: "video/x-flv"
kf5.kservice.sycoca: Service type not found: "x-content/audio-cdda"
kf5.kservice.sycoca: Service type not found: "image/jpeg"
kf5.kservice.sycoca: Service type not found: "application/vnd.sun.xml.calc.template"
kf5.kservice.sycoca: Service type not found: "image/x-sony-arw"
kf5.kservice.sycoca: Service type not found: "image/emf"
kf5.kservice.sycoca: Service type not found: "image/x-sony-srf"
kf5.kservice.sycoca: Service type not found: "image/x-panasonic-rw2"
kf5.kservice.sycoca: Service type not found: "application/prs.plucker"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.graphics-flat-xml"
kf5.kservice.sycoca: Service type not found: "video/dv"
kf5.kservice.sycoca: Service type not found: "application/x-trash"
kf5.kservice.sycoca: Service type not found: "application/pgp-encrypted"
kf5.kservice.sycoca: Service type not found: "image/x-dds"
kf5.kservice.sycoca: Service type not found: "image/x-xcursor"
kf5.kservice.sycoca: Service type not found: "audio/midi"
kf5.kservice.sycoca: Service type not found: "image/x-kodak-dcr"
kf5.kservice.sycoca: Service type not found: "application/vnd.rn-realmedia"
kf5.kservice.sycoca: Service type not found: "application/smil+xml"
kf5.kservice.sycoca: Service type not found: "application/x-font-bdf"
kf5.kservice.sycoca: Service type not found: "application/octet-stream"
kf5.kservice.sycoca: Service type not found: "application/x-k3b"
kf5.kservice.sycoca: Service type not found: "audio/x-it"
kf5.kservice.sycoca: Service type not found: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
kf5.kservice.sycoca: Service type not found: "application/x-bzpostscript"
kf5.kservice.sycoca: Service type not found: "application/vnd.amazon.mobi8-ebook"
kf5.kservice.sycoca: Service type not found: "application/vnd.rar"
kf5.kservice.sycoca: Service type not found: "application/vnd.sun.xml.impress"
kf5.kservice.sycoca: Service type not found: "audio/x-musepack"
kf5.kservice.sycoca: Service type not found: "image/x-sun-raster"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.graphics-template"
kf5.kservice.sycoca: Service type not found: "application/pgp-signature"
kf5.kservice.sycoca: Service type not found: "application/zip"
kf5.kservice.sycoca: Service type not found: "application/x-cd-image"
kf5.kservice.sycoca: Service type not found: "application/x-rpm"
kf5.kservice.sycoca: Service type not found: "application/mathml+xml"
kf5.kservice.sycoca: Service type not found: "image/x-xcf"
kf5.kservice.sycoca: Service type not found: "video/x-nsv"
kf5.kservice.sycoca: Service type not found: "audio/x-scpls"
kf5.kservice.sycoca: Service type not found: "audio/x-speex"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.presentation-flat-xml"
kf5.kservice.sycoca: Service type not found: "application/x-shorten"
kf5.kservice.sycoca: Service type not found: "audio/x-wav"
kf5.kservice.sycoca: Service type not found: "image/x-canon-cr2"
kf5.kservice.sycoca: Service type not found: "application/epub+zip"
kf5.kservice.sycoca: Service type not found: "image/x-photo-cd"
kf5.kservice.sycoca: Service type not found: "audio/x-adpcm"
kf5.kservice.sycoca: Service type not found: "font/ttf"
kf5.kservice.sycoca: Service type not found: "application/vnd.stardivision.writer"
kf5.kservice.sycoca: Service type not found: "image/jp2"
kf5.kservice.sycoca: Service type not found: "x-content/video-svcd"
kf5.kservice.sycoca: Service type not found: "application/javascript"
kf5.kservice.sycoca: Service type not found: "image/bmp"
kf5.kservice.sycoca: Service type not found: "image/x-portable-anymap"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.text-master-template"
kf5.kservice.sycoca: Service type not found: "application/vnd.ms-htmlhelp"
kf5.kservice.sycoca: Service type not found: "audio/x-gsm"
kf5.kservice.sycoca: Service type not found: "video/mp4"
kf5.kservice.sycoca: Service type not found: "application/sdp"
kf5.kservice.sycoca: Service type not found: "image/x-xbitmap"
kf5.kservice.sycoca: Service type not found: "application/xml"
kf5.kservice.sycoca: Service type not found: "image/x-bzeps"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.text-template"
kf5.kservice.sycoca: Service type not found: "video/x-msvideo"
kf5.kservice.sycoca: Service type not found: "application/x-xpinstall"
kf5.kservice.sycoca: Service type not found: "image/svg+xml-compressed"
kf5.kservice.sycoca: Service type not found: "application/x-iwork-keynote-sffkey"
kf5.kservice.sycoca: Service type not found: "application/vnd.debian.binary-package"
kf5.kservice.sycoca: Service type not found: "application/x-matroska"
kf5.kservice.sycoca: Service type not found: "audio/x-s3m"
kf5.kservice.sycoca: Service type not found: "application/x-ksysguard"
kf5.kservice.sycoca: Service type not found: "application/x-keepass2"
kf5.kservice.sycoca: Service type not found: "audio/mp2"
kf5.kservice.sycoca: Service type not found: "image/x-kodak-k25"
kf5.kservice.sycoca: Service type not found: "x-content/blank-hddvd"
kf5.kservice.sycoca: Service type not found: "text/x-google-video-pointer"
kf5.kservice.sycoca: Service type not found: "application/vnd.sun.xml.writer.template"
kf5.kservice.sycoca: Service type not found: "x-content/blank-bd"
kf5.kservice.sycoca: Service type not found: "text/html"
kf5.kservice.sycoca: Service type not found: "application/vnd.ms-works"
kf5.kservice.sycoca: Service type not found: "application/vnd.openxmlformats-officedocument.presentationml.slide"
kf5.kservice.sycoca: Service type not found: "audio/x-flac+ogg"
kf5.kservice.sycoca: Service type not found: "application/x-gzpostscript"
kf5.kservice.sycoca: Service type not found: "text/vcard"
kf5.kservice.sycoca: Service type not found: "image/x-sony-sr2"
kf5.kservice.sycoca: Service type not found: "inode/directory"
kf5.kservice.sycoca: Service type not found: "application/x-xopp"
kf5.kservice.sycoca: Service type not found: "application/x-kdenlive"
kf5.kservice.sycoca: Service type not found: "application/vnd.corel-draw"
kf5.kservice.sycoca: Service type not found: "application/vnd.wordperfect"
kf5.kservice.sycoca: Service type not found: "image/x-minolta-mrw"
kf5.kservice.sycoca: Service type not found: "application/vnd.sqlite3"
kf5.kservice.sycoca: Service type not found: "image/x-portable-pixmap"
kf5.kservice.sycoca: Service type not found: "text/vnd.qt.linguist"
kf5.kservice.sycoca: Service type not found: "image/x-canon-crw"
kf5.kservice.sycoca: Service type not found: "application/vnd.openxmlformats-officedocument.presentationml.slideshow"
kf5.kservice.sycoca: Service type not found: "x-content/video-dvd"
kf5.kservice.sycoca: Service type not found: "application/vnd.kde.fontspackage"
kf5.kservice.sycoca: Service type not found: "application/vnd.openxmlformats-officedocument.wordprocessingml.template"
kf5.kservice.sycoca: Service type not found: "application/oxps"
kf5.kservice.sycoca: Service type not found: "application/x-khtml-adaptor"
kf5.kservice.sycoca: Service type not found: "video/mp2t"
kf5.kservice.sycoca: Service type not found: "application/vnd.adobe.flash.movie"
kf5.kservice.sycoca: Service type not found: "audio/x-mod"
kf5.kservice.sycoca: Service type not found: "image/vnd.rn-realpix"
kf5.kservice.sycoca: Service type not found: "application/postscript"
kf5.kservice.sycoca: Service type not found: "application/vnd.openxmlformats-officedocument.spreadsheetml.template"
kf5.kservice.sycoca: Service type not found: "image/vnd.adobe.photoshop"
kf5.kservice.sycoca: Service type not found: "application/x-lzma"
kf5.kservice.sycoca: Service type not found: "audio/AMR-WB"
kf5.kservice.sycoca: Service type not found: "audio/x-aiff"
kf5.kservice.sycoca: Service type not found: "image/x-portable-graymap"
kf5.kservice.sycoca: Service type not found: "text/markdown"
kf5.kservice.sycoca: Service type not found: "application/x-bcpio"
kf5.kservice.sycoca: Service type not found: "application/x-lzip-compressed-tar"
kf5.kservice.sycoca: Service type not found: "video/x-matroska"
kf5.kservice.sycoca: Service type not found: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
kf5.kservice.sycoca: Service type not found: "audio/x-stm"
kf5.kservice.sycoca: Service type not found: "audio/prs.sid"
kf5.kservice.sycoca: Service type not found: "audio/x-ape"
kf5.kservice.sycoca: Service type not found: "application/x-designer"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.graphics"
kf5.kservice.sycoca: Service type not found: "image/vnd.microsoft.icon"
kf5.kservice.sycoca: Service type not found: "text/x-ldif"
kf5.kservice.sycoca: Service type not found: "application/x-kexiproject-shortcut"
kf5.kservice.sycoca: Service type not found: "application/x-font-type1"
kf5.kservice.sycoca: Service type not found: "image/x-exr"
kf5.kservice.sycoca: Service type not found: "image/x-kodak-kdc"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.formula"
kf5.kservice.sycoca: Service type not found: "application/x-cb7"
kf5.kservice.sycoca: Service type not found: "image/x-gzeps"
kf5.kservice.sycoca: Service type not found: "application/x-xopt"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.text-flat-xml"
kf5.kservice.sycoca: Service type not found: "image/x-hdr"
kf5.kservice.sycoca: Service type not found: "multipart/x-mixed-replace"
kf5.kservice.sycoca: Service type not found: "application/x-iso9660-appimage"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.spreadsheet"
kf5.kservice.sycoca: Service type not found: "application/x-java-applet"
kf5.kservice.sycoca: Service type not found: "application/x-sony-bbeb"
kf5.kservice.sycoca: Service type not found: "application/x-kwallet"
kf5.kservice.sycoca: Service type not found: "application/x-tzo"
kf5.kservice.sycoca: Service type not found: "application/vnd.oasis.opendocument.database"
kf5.kservice.sycoca: Service type not found: "video/vnd.mpegurl"
kf5.kservice.sycoca: Service type not found: "application/x-dbf"
kf5.kservice.sycoca: Service type not found: "application/x-hwp"
kf5.kservice.sycoca: Service type not found: "application/x-navi-animation"
kf5.kservice.sycoca: Service type not found: "application/x-font-afm"
kf5.kservice.sycoca: Service type not found: "audio/x-opus+ogg"
kf5.kservice.sycoca: Service type not found: "application/ram"
kf5.kservice.sycoca: Service type not found: "multipart/mixed"
kf5.kservice.sycoca: Service type not found: "image/fax-g3"

...

Jan 31 17:24:18 laptop systemsettings5[20318]: kf5.kservice.services: KMimeTypeTrader: mimeType "application/vnd.ms-publisher" not found
Jan 31 17:24:18 laptop systemsettings5[20318]: kf5.kservice.services: KMimeTypeTrader: mimeType "application/vnd.ms-publisher" not found
Jan 31 17:24:18 laptop systemsettings5[20318]: Entry  "application/vnd.ms-publisher"  is dirty. Saving.
Jan 31 17:21:57 laptop systemsettings5[20318]: kf5.kservice.services: KMimeTypeTrader: mimeType "application/vnd.ms-publisher" not found
Jan 31 17:21:57 laptop systemsettings5[20318]: kf5.kservice.services: KMimeTypeTrader: mimeType "application/vnd.ms-publisher" not found
Jan 31 17:21:57 laptop systemsettings5[20318]: "application/vnd.ms-publisher" hasDefinitionFile: false

上面的一些值得注意的消息包括:

kf5.kservice.sycoca: Service type not found: "application/vnd.ms-publisher"
kf5.kservice.sycoca: Service type not found: "application/illustrator"

我已经证明了 mime 类型application/vnd.ms-publisher是存在和定义的。所以我随机检查了几个。这是application/illustrator(删除评论以节省空间)。

less /usr/share/mime/application/illustrator.xml

<?xml version="1.0" encoding="utf-8"?>
<mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info" type="application/illustrator">
<!--Created automatically by update-mime-database. DO NOT EDIT!-->
<generic-icon name="image-x-generic"/>
<glob pattern="*.ai"/>
<alias type="application/vnd.adobe.illustrator"/>
</mime-type>

All the mime-type definitions seems to be present according to a listing of ls /usr/share/mime/application/ (There is not sufficient space to post the entire directory listing here.)

I do not understand why the log messages indicate "Service type not found" for mime-types that are present on my system. But more importantly, why can I not add an application to handle the mime type as shown above?

Response to comments by Nathaniel M. Beaver

$ ktraderclient5 --mimetype application/vnd.ms-publisher
mimetype is : application/vnd.ms-publisher
got 1 offers.
---- Offer 0 ----
Invalid property Actions
StartupNotify : 'TRUE'
StartupWMClass : 'libreoffice-draw'
Invalid property UntranslatedGenericName
Invalid property X-GIO-NoFuse
X-KDE-Protocols : 'file - http - ftp - webdav - webdavs'
Type : 'Application'
Name : 'LibreOffice Draw'
Comment : 'Create and edit drawings, flow charts, and logos by using Draw.'
GenericName : 'Drawing Program'
Icon : 'libreoffice-draw'
Exec : 'libreoffice --draw %U'
Terminal : 'FALSE'
Invalid property TerminalOptions
Invalid property Path
ServiceTypes : 'application/vnd.oasis.opendocument.graphics - application/vnd.oasis.opendocument.graphics-flat-xml - application/vnd.oasis.opendocument.graphics-template - application/vnd.sun.xml.draw - application/vnd.sun.xml.draw.template - application/vnd.visio - application/x-wpg - application/vnd.corel-draw - application/vnd.ms-publisher - image/x-freehand - application/clarisworks - application/x-pagemaker - application/pdf - application/x-stardraw - image/x-emf - image/x-wmf - Application'
AllowAsDefault : 'TRUE'
InitialPreference : '5'
Invalid property Library
DesktopEntryPath : '/usr/share/applications/libreoffice-draw.desktop'
DesktopEntryName : 'libreoffice-draw'
Keywords : 'Vector - Schema - Diagram - Layout - OpenDocument Graphics - Microsoft Publisher - Microsoft Visio - Corel Draw - cdr - odg - svg - pdf - vsd'
FormFactors : ''
Categories : 'Office - FlowChart - Graphics - 2DGraphics - VectorGraphics - X-Red-Hat-Base - X-MandrivaLinux-Office-Drawing'

What is the recommended way to remove this?

kde mime-types
  • 3 个回答
  • 1924 Views
Martin Hope
MountainX
Asked: 2020-02-01 14:01:42 +0800 CST

深入挖掘不同的 mime 类型关联

  • 2

我想更深入地了解 mime 类型。到目前为止,感谢@munzir-taha ,我了解以下内容

在不同系统上具有不同的 mime 类型文件关联是正常的,即使这些系统运行的是同一发行版的相同版本,即使用户没有自定义任何 mime 关联。这是因为关联取决于每个系统中安装的软件包,可能还取决于它们的安装顺序。

我还了解用户可以使用以下任一方法添加或删除 mime 类型关联:

  1. 手动编辑~/.config/mimeapps.list

  2. 使用 GUI 工具。在 KDE 中,这可以在系统设置中或通过 Dolphin 完成(例如,右键单击文件 > 属性 > 文件类型选项并将文件类型与您想要的应用程序相关联)

但是,我希望更深入地研究这一点。我正在运行 Arch Linux 和 KDE。我创建了一个新的用户帐户进行测试。它具有以下属性:

软件包 shared-mime-info 已安装:

sudo pacman -Qs shared-mime-info
local/shared-mime-info 1.15-2
    Freedesktop.org Shared MIME Info

公钥具有 mime 类型的 text/plain:

$ xdg-mime query filetype id_rsa_test.pub
text/plain

text/plain 的默认处理程序是 Atom 编辑器:

$ xdg-mime query default text/plain
atom.desktop

该用户没有mimeapps.list。典型文件不存在(如下所示),并且mimeapps.list此用户帐户中没有其他文件。

$ less ~/.config/mimeapps.list
/home/deleteme/.config/mimeapps.list: No such file or directory

该系统似乎与具有.pubmime-type 的文件具有系统范围的关联application/vnd.ms-publisher。该文件存在于系统中:

/usr/share/mime/application/vnd.ms-publisher.xml

上述文件的内容包括文件的 glob 模式 .pub:

<?xml version="1.0" encoding="utf-8"?>
<mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info" type="application/vnd.ms-publisher">
<!--Created automatically by update-mime-database. DO NOT EDIT!-->
<sub-class-of type="application/x-ole-storage"/>
<glob pattern="*.pub"/>
</mime-type>

为什么上面的 mime-type 不能确定这个查询的结果?

$ xdg-mime query filetype id_rsa_test.pub
text/plain

据我所知,我希望用户本地的 mimeapps.list 将负责该关联,但没有任何此类文件。

我没有找到.pub该系统上文件的任何其他关联。正如我所提到的,这个新用户帐户没有 mimeapps.list。

arch-linux mime-types
  • 1 个回答
  • 168 Views
Martin Hope
MountainX
Asked: 2020-01-30 15:03:57 +0800 CST

如何使用 CLI 工具在我的 Linux 系统上安装新的(自定义)mime 类型?

  • 14

我想知道在我的系统上创建和注册新的自定义mime 类型的完整步骤。如果重要的话,我在 Arch Linux 上运行 KDE。

这些步骤应包括编写 XML 文件并将图标与文件类型相关联以及我需要做的任何其他事情。我更喜欢只使用xdg-mime命令行实用程序。

我希望了解为 1)我的用户帐户以及 2)系统范围添加此 mime 关联。

例如,假设我想使用自定义应用程序打开证书文件,我将调用 MyCertInspector。我相信 XML 应该看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
  <mime-type type="text/publickey">
    <glob-deleteall/>
    <glob pattern="*.crt"/>
    <glob pattern="*.cert"/>
  </mime-type>
</mime-info>

据我了解,当包含glob-deleteall在用户本地定义中时,它会删除任何现有的系统范围的 mime 关联。我想确认我的理解是正确的。

我还了解到,此过程的第一步是检查是否存在具有我计划使用的文件扩展名的 mime 类型。我不确定如何在 Arch 上执行此操作,因为 Arch 上没有/usr/share/applications/defaults.list并且(至少在我的系统上)没有系统范围的mimeapps.list文件。

对于答案,我希望有一个分步指南,涵盖每个需要的步骤,并提到 Arch Linux 系统上应该放置的特定目录。

从我目前的研究来看,我相信一般步骤是:

  1. 检查是否存在具有我计划使用的文件扩展名的 mime 类型
  2. 为我想要的 mime 类型创建一个 XML 文件。
  3. 使用注册我的 XML 文件sudo xdg-mime install [options](我们应该同时处理系统模式和本地用户模式。
  4. 将新的 mime 类型与用于打开它的应用程序相关联。
  5. 注册 mime 类型的图标。
  6. 其他任何事情(例如一个人应该做的检查和验证步骤)

我的目标是,任何阅读此问题答案的人都将能够掌握在他们的系统上创建和安装自定义 mime 类型的所有完整过程。

mime-types
  • 1 个回答
  • 3408 Views
Martin Hope
MountainX
Asked: 2020-01-30 14:32:23 +0800 CST

如何使用 CLI 工具从我的 Linux 系统中完全删除 mime 关联?

  • 4

我正在运行 Arch Linux 和 KDE。我已经在几台设备上安装了 Arch KDE,在通常情况下,文件没有特定的 mime 类型关联.pub(在我的情况下是公钥)。它们将由纯文本文档的默认处理程序打开。这是我希望在我的标准 Arch Linux 安装中看到的:

$ xdg-mime query filetype id_rsa_test.pub
text/plain

但是,在我的主桌面上,.pub文件与 ms-publisher 相关联。

$ xdg-mime query filetype id_rsa_test.pub
application/vnd.ms-publisher

我想完全删除这个关联。以下是我发现这种关联证据的一些地方:

$ grep -irl '.pub' ./.local/share/mime/
./.local/share/mime/packages/application-vnd.ms-publisher.xml
./.local/share/mime/application/vnd.ms-publisher.xml
./.local/share/mime/globs
./.local/share/mime/globs2
./.local/share/mime/types
./.local/share/mime/mime.cache

$ sudo grep -irl 'ms-publisher' /usr
/usr/share/applications/mimeinfo.cache
/usr/share/mime/packages/freedesktop.org.xml
/usr/share/mime/application/vnd.ms-publisher.xml
/usr/share/mime/globs
/usr/share/mime/globs2
/usr/share/mime/subclasses
/usr/share/mime/types
/usr/share/mime/mime.cache
/usr/share/icons/breeze/mimetypes/64/application-vnd.ms-publisher.svg
/usr/share/icons/breeze/mimetypes/22/application-vnd.ms-publisher.svg
/usr/share/icons/breeze/breeze-icons.rcc
/usr/share/icons/breeze/icon-theme.cache
/usr/share/icons/breeze-dark/mimetypes/22/application-vnd.ms-publisher.svg
/usr/share/icons/breeze-dark/breeze-icons-dark.rcc
/usr/share/icons/breeze-dark/icon-theme.cache
/usr/lib/libreoffice/share/xdg/draw.desktop

根据xdg-mime手册页,该uninstall命令可能会起作用。至少在我的情况下,该uninstall命令无效。

# xdg-mime uninstall /usr/share/mime/application/vnd.ms-publisher.xml
# echo $?
0

# sudo grep -irl 'ms-publisher' /usr
/usr/share/file/misc/magic.mgc
/usr/share/applications/mimeinfo.cache
/usr/share/mime/packages/freedesktop.org.xml
/usr/share/mime/application/vnd.ms-publisher.xml
/usr/share/mime/globs
/usr/share/mime/globs2
/usr/share/mime/subclasses
/usr/share/mime/types
/usr/share/mime/mime.cache
/usr/share/icons/breeze/mimetypes/64/application-vnd.ms-publisher.svg
/usr/share/icons/breeze/mimetypes/22/application-vnd.ms-publisher.svg
/usr/share/icons/breeze/breeze-icons.rcc
/usr/share/icons/breeze/icon-theme.cache
/usr/share/icons/breeze-dark/mimetypes/22/application-vnd.ms-publisher.svg
/usr/share/icons/breeze-dark/breeze-icons-dark.rcc
/usr/share/icons/breeze-dark/icon-theme.cache
/usr/lib/libreoffice/share/xdg/draw.desktop

# grep -irl '.pub' /usr/share/mime/
/usr/share/mime/packages/freedesktop.org.xml
/usr/share/mime/packages/calibre-mimetypes.xml
/usr/share/mime/application/pkcs7-mime.xml
/usr/share/mime/application/pkcs8-encrypted.xml
/usr/share/mime/application/epub+zip.xml
/usr/share/mime/application/x-pkcs7-certificates.xml
/usr/share/mime/application/pkcs8.xml
/usr/share/mime/application/pkcs10.xml
/usr/share/mime/application/pkcs12.xml
/usr/share/mime/application/vnd.ms-publisher.xml
/usr/share/mime/globs
/usr/share/mime/globs2
/usr/share/mime/magic
/usr/share/mime/subclasses
/usr/share/mime/types
/usr/share/mime/generic-icons
/usr/share/mime/mime.cache

对于我的问题,我想大致了解如何仅使用 CLI 工具从我的系统中删除任何mime 类型关联。

编辑:对答案的回应:

在新用户帐户上,我显示以下内容:

sudo pacman -Qs shared-mime-info
local/shared-mime-info 1.15-2
    Freedesktop.org Shared MIME Info

$ xdg-mime query filetype id_rsa_test.pub
text/plain

$ xdg-mime query default text/plain
atom.desktop

$ less ~/.config/mimeapps.list
/home/deleteme/.config/mimeapps.list: No such file or directory

该系统已多次(每天)更新,与.pub文件的 ms-publisher 关联尚未恢复。请注意,这个系统已经shared-mime-info安装,我可以使用纯文本编辑器打开公钥文件,正如我所料。在此系统上的另一个用户帐户中,我通过~/.config/mimeapps.list该用户的条目获得了我的首选关联。

$ xdg-mime query default text/plain
org.kde.kate.desktop

回到主要问题:如何.pub在系统级别完全删除文件与 Okular 和/或 Libre Office Draw 的关联?即使这不是批准的方法,我该怎么做?

mime-types
  • 1 个回答
  • 2842 Views
Martin Hope
MountainX
Asked: 2020-01-29 19:10:51 +0800 CST

mime.cache 文件的用途是什么?

  • 3

mime.cacheArch Linux KDE 桌面系统上文件的用途是什么?

Arch Wiki 讨论了mimeapps.list文件,但没有提到mime.cache.

在我的系统上,只有一个mimeapps.list文件,但有多个mime.cache文件。例子:

/usr/share/mime/mime.cache
~/.local/share/mime/mime.cache

本地用户版本是否替换或扩展系统范围的mime.cache文件?

mime.cache可以手动删除这些文件(例如,使用rm)吗?

在尝试解决 mime 类型问题时,我认为删除它们可能有助于避免在我进行更改时与旧缓存值混淆。

如果它们被删除,是否需要手动重新创建?如果是这样,怎么做?

arch-linux mime-types
  • 1 个回答
  • 1480 Views
Martin Hope
MountainX
Asked: 2020-01-25 22:43:04 +0800 CST

XDG_DATA_DIRS 包含重复路径;怎么修?

  • 1

我正在运行 Arch Linux 和 KDE,并且很想了解 mime 类型文件关联。

在调查我的系统时,我注意到了这个问题:

$ echo $XDG_DATA_DIRS
/usr/share:/usr/share:/usr/local/share

请注意,路径/usr/share是重复的。我想知道如何解决它以及如何解决它。

此外,我的系统没有/usr/local/share/applications/ 可以从环境变量中删除该路径$XDG_DATA_DIRS吗?如果是这样,怎么做?

我认为最终的结果应该是:

$ echo $XDG_DATA_DIRS
/usr/share

这是一些故障排除信息。以 root 身份运行时,我看不到这些路径。这不会产生标准输出:

# echo $XDG_DATA_DIRS

在我机器上的普通用户帐户中,以下命令不产生标准输出并且返回值1:

$ grep -r XDG_DATA_DIRS /etc/profile.d/

除了二进制文件 places.sqlite(在 Firefox 配置文件中)之外,此搜索找不到匹配项:

find /home/myuser -mount -type f -exec grep -r XDG_DATA_DIRS= {} +

这也不会产生标准输出:

grep -r XDG_DATA_DIRS /etc/

到目前为止,我发现的唯一匹配是:

# grep -r XDG_DATA_DIRS= /usr
/usr/share/ECM/kde-modules/prefix.sh.cmake:export XDG_DATA_DIRS=@KDE_INSTALL_FULL_DATADIR@:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}

所以...

pacman -F /usr/share/ECM/kde-modules/prefix.sh.cmake
usr/share/ECM/kde-modules/prefix.sh.cmake is owned by extra/extra-cmake-modules 5.66.0-1

Arch Linux - extra-cmake-modules 5.66.0-1 (any) https://www.archlinux.org/packages/extra/any/extra-cmake-modules/

我希望这个包不负责搞砸我的 mime 类型关联......

在另一台设备上全新安装 Arch 的新用户帐户中,以下三个命令不会产生标准输出:

echo $XDG_DATA_DIRS
grep -r XDG_DATA_DIRS /etc/profile.d/
grep -r XDG_DATA_DIRS= /usr
mime-types
  • 5 个回答
  • 723 Views
Martin Hope
MountainX
Asked: 2020-01-23 17:46:04 +0800 CST

linux用户名中的一个点导致:“用户名不在sudoers文件中。将报告此事件。”

  • 2

我有一个正常工作的 Debian 服务器。所有已被授予sudo权限的现有用户都可以sudo毫无问题地使用。但是,用户名中带有点的新用户在尝试sudo.

我没有看到该用户遗漏的任何步骤。这是我的步骤:

在用户名中创建一个带有点的特权用户。我使用这个小脚本来添加开发人员用户帐户。

#!/bin/bash
uu=$1
useradd -m -G sudo,webdev -s /bin/bash $uu
passwd $uu
cd /home/$uu/
mkdir .ssh/
touch .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
chmod 700 .ssh/
chown -R $uu:$uu .ssh/
ls -la .ssh/
cat $uu.pub > /home/$uu/.ssh/authorized_keys
echo "finished"

检查用户是否在 sudo 组中:

getent group sudo

这已经存在于/etc/sudoers

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

接下来我制作了 /etc/sudoers.d/user.name (并将权限设置为 640):

nano /etc/sudoers.d/user.name
user.name ALL=(ALL) NOPASSWD: ALL

要进行测试,请使用用户帐户登录并尝试sudo. 我收到上述错误。

我能够解决此问题的一种方法是将此用户添加到具有 sudo 权限的不同组中。

要么我遗漏了某些东西,要么用户名中的点导致了其他用户名没有遇到的问题。

sudo
  • 1 个回答
  • 3191 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve