Kde

KDE 沒有保存 mime 類型的文件關聯

  • May 16, 2020

我正在執行 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>

所有的 mime 類型定義似乎都根據ls /usr/share/mime/application/(沒有足夠的空間在此處發布整個目錄列表。)

我不明白為什麼對於我係統上存在的 mime 類型,日誌消息會顯示“未找到服務類型”。但更重要的是,為什麼我不能添加一個應用程序來處理如上所示的 mime 類型?

回應 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'

刪除此問題的推薦方法是什麼?

在完全不同的系統上也一樣。以普通使用者的身份執行此操作:

update-mime-database $HOME/.local/share/mime

如果您需要完全重置,請執行以下操作:

cd $HOME/.local/share/
mv mime mime2
mkdir -p mime/packages
update-mime-database $HOME/.local/share/mime

這將重置所有已損壞的 mime 設置,但它會繼續工作。目前 KDE 在進行更改後不會呼叫更新數據庫,從而導致此問題。

這是調試 mimetype 關聯問題的分步方法。

  1. 確定文件的 mimetype。
$ xdg-mime query filetype ~/.ssh/id_rsa.pub
application/vnd.ms-publisher
  1. 確定 mimetype 的預設處理程序。
$ xdg-mime query default application/vnd.ms-publisher
libreoffice-writer.desktop

添加XDG_UTILS_DEBUG_LEVEL=2環境變數以獲取更多資訊。

$ XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default application/vnd.ms-publisher
Running KDE trader query "application/vnd.ms-publisher" mimetype and "Application" servicetype
libreoffice-writer.desktop
  1. 用於xdg-mime更改預設關聯。
$ XDG_UTILS_DEBUG_LEVEL=2 xdg-mime default org.kde.kate.desktop application/vnd.ms-publisher
make_default_kde: No kde runtime detected
make_default_generic org.kde.kate.desktop application/vnd.ms-publisher
Updating /home/nathaniel/.config/mimeapps.list

這也可以通過圖形程序(例如 Dolphin)來完成。正如我們將看到的,結果並不總是相同的。 4. 檢查是否更改了預設處理程序。

如果xdg-mime成功,它將如下所示:

$ xdg-mime query default application/vnd.ms-publisher
org.kde.kate.desktop

如果它不起作用,你會再次看到這個。

$ xdg-mime query default application/vnd.ms-publisher
libreoffice-writer.desktop
  1. 如果xdg-mime沒有工作,它的調試時間。首先檢查這個文件:

~/.config/mimeapps.list

它有以下部分:[Added Associations][Default Applications][Removed Associations]

讓我們快速grep看看發生了什麼。

$ grep 'application/vnd.ms-publisher' ~/.config/mimeapps.list
application/vnd.ms-publisher=libreoffice-writer.desktop;libreoffice-draw.desktop;
application/vnd.ms-publisher=org.kde.kate.desktop;

嗯,看起來不太對勁。如果我們進一步檢查該文件,我們會看到xdg-mime添加了 kate 在[Default Applications]但不是[Added Associations]. 如果我們使用 Dolphin / 更改了 mimetype keditfiletype5 application/vnd.ms-publisher,我們會觀察到它org.kde.kate.desktop;之前會libreoffice-writer.desktop;[Added Associations].

https://cgit.kde.org/kde-cli-tools.git/tree/keditfiletype/mimetypedata.cpp?id=5d1c3d77798949c21958b60cf78d36fb49c57ea2#n367

不過,按照FreeDesktop 規範,這無關緊要;即使[Default Applications]未在[Added Associations].

$$ Default Applications $$group 指示用於給定 mimetype 的預設應用程序。例如,這是在文件管理器中點兩下文件時將啟動的。如果不再安裝該應用程序,則嘗試列表中的下一個應用程序,依此類推。

所以這可能是 KDE 中的一個錯誤,它似乎已在上游修復:

將 mimeapps.list 中的“預設應用程序”設為首選應用程序

https://phabricator.kde.org/D26690

可能也是 中的一個錯誤xdg-mime是一個巨大的 shell 腳本,由於它需要完成一項頂級工作,因此沒有得到足夠的關注。

無論如何,讓我們修復那條線,讓它改為:

application/vnd.ms-publisher=org.kde.kate.desktop;libreoffice-writer.desktop;libreoffice-draw.desktop;

讓我們看看這是否有幫助。

$ xdg-mime query default application/vnd.ms-publisher
libreoffice-writer.desktop

嗯,怎麼沒效果?

這是因為xdg-mime它不會自行檢查,它會呼叫桌面使用的任何工具。在 KDE 上,這是kmimetypefinder5,ktraderclient5kbuildsycoca5. 最後一個很重要,因為它是 KDE 建構其 mimetype 關聯記憶體的方式。

請注意,這不是位於 的記憶體~/.local/share/applications/mimeinfo.cache,儘管這也是一個 mimetype 記憶體,因為該位置在最新規範中被列為“為了兼容性,已棄用”

正確的方法是重建 KDE 的 mimetype:

$ kbuildsycoca5

但我們也可以直接刪除它:

$ rm ~/.cache/ksycoca5_*

然後再試一次:

$ xdg-mime query default application/vnd.ms-publisher
org.kde.kate.desktop

這看起來很有希望。現在讓我們嘗試打開一個實際的文件:

$ xdg-open ~/.ssh/id_rsa.pub

在 KDE 上,這與以下基本相同

$ kde-open5 ~/.ssh/id_rsa.pub

這應該在 Kate 文本編輯器中打開。成功! 6. 如果還是不行怎麼辦?

在 KDE Plasma 5 上,xdg-mime query default只需呼叫ktraderclient5 --mimetype. 因此ktraderclient5 --mimetype application/vnd.ms-publisher將提供有用的資訊,儘管輸出可能是大量的。

添加XDG_UTILS_DEBUG_LEVEL=2xdg-*命令可能會提供更好的調試輸出。

啟用登錄 KDE 以獲取qDebug輸出也可能有所幫助。

$ if ! test -f ~/.config/QtProject/qtlogging.ini; then printf '[Rules]\n*.debug=true\nqt.*.debug=false\n' > ~/.config/QtProject/qtlogging.ini; else printf 'Error: ~/.config/QtProject/qtlogging.ini already exists.\n'; fi;

另外,檢查您的應用程序正在使用什麼文件。xdg-open使用kde-open5,但您的應用程序的行為可能會有所不同。例如,它可能正在查看一個舊的、棄用的 mimetype 關聯文件位置:

  • ~/.local/share/applications/mimeapps.list或者可能是更舊的位置:

  • ~/.local/share/applications/defaults.list您可能必須深入探勘原始碼或使用strace以確定應用程序實際使用的文件。

如果您使用自定義 mimetypes 或自定義桌面文件,情況會變得更加複雜。

引用自:https://unix.stackexchange.com/questions/565202