https://wiki.archlinux.org/api.php?action=feedcontributions&user=InsaneGuo&feedformat=atomArchWiki - User contributions [en]2024-03-29T02:21:27ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Optical_disc_drive_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=757951Optical disc drive (简体中文)2022-11-25T06:51:19Z<p>InsaneGuo: /* Playback */ tra</p>
<hr />
<div>[[Category:Multimedia (简体中文)]]<br />
[[Category:Optical disc (简体中文)]]<br />
[[en:Optical disc drive]]<br />
[[es:Optical disc drive]]<br />
[[ja:光学ディスクドライブ]]<br />
{{Related articles start}}<br />
{{Related|Codecs}}<br />
{{Related|MPlayer}}<br />
{{Related|dvdbackup}}<br />
{{Related|MEncoder}}<br />
{{Related|Blu-ray}}<br />
{{Related|Convert any Movie to DVD Video}}<br />
{{Related articles end}}<br />
<br />
来自维基百科:<br />
<br />
在计算机领域,Optical disc drive(ODD)是一种光盘驱动器,它使用激光或可见光频谱内或附近的电磁波作为向光盘读写数据过程的一部分。<br />
<br />
== 刻录 ==<br />
<br />
{{Expansion|是否有被 Arch Linux 打包过的命令行工具可以将文件分卷写入碟片中? (像是 GAFFitter 或 cdrkit 的 dirsplit) }}<br />
<br />
{{Warning|有很大数量的光学驱动器和碟片是有很大不同的。通常,在需要可靠性的时候,推荐使用慢速刻录。如果你遇到了未预期的行为时,尝试使用刻录器所支持的最慢速度刻录。}}<br />
<br />
光盘驱动器的刻录过程包括创建或获得一个图像并将其写入光学介质。该镜像原则上可以是任何数据文件。如果你想挂载生成的介质,那么它通常是一个ISO 9660文件系统的镜像文件。音频和多媒体光盘通常是从.bin文件刻录的,在.toc文件或.cue文件的控制下,告诉所需的轨道布局。<br />
<br />
=== 安装刻录工具 ===<br />
<br />
{{Style|Says twice that X is the traditional choice without stating why.}}<br />
<br />
如果你想要使用 GUI 程序,见 [[#Burning CD/DVD/BD with a GUI]]。<br />
<br />
这里列出的程序是面向命令行的。它们是大多数用于CD、DVD和BD的免费GUI程序所使用的后端。当涉及到故障排除或编写刻录活动的脚本时,GUI用户可能会用到它们。<br />
<br />
你至少需要一个创建文件系统镜像的程序和一个能够将数据刻录到你所需要的媒体类型的程序。<br />
<br />
可用于创建ISO9660类型镜像的应用有:<br />
<br />
* {{man|8|mkisofs}} 自 {{Pkg|cdrtools}}<br />
* {{man|1|xorriso}} 和 {{man|1|xorrisofs}} 自 {{Pkg|libisoburn}}<br />
<br />
常见的选择是 ''mkisofs''.<br />
<br />
可用于刻录媒体文件的应用有:<br />
<br />
* {{man|1|cdrdao}} 自 {{Pkg|cdrdao}} (仅 CD, 格式仅 TOC/CUE/BIN)<br />
* {{man|1|cdrecord}} 自 {{Pkg|cdrtools}}<br />
* {{man|1|cdrskin}} 自 {{Pkg|libburn}}<br />
* {{man|1|growisofs}} 自 {{Pkg|dvd+rw-tools}} (仅 DVD 和 BD)<br />
* {{man|1|xorriso}} 和 {{man|1|xorrecord}} 自 {{Pkg|libisoburn}}<br />
<br />
常见的对于 CD 的选择有 ''cdrecord'' 而 对于 DVD 和 BD 的选择有''growisofs'' 。为将 TOC/CUE/BIN 烧录到 CD,安装 {{Pkg|cdrdao}}.<br />
<br />
自由的 GUI 烧录程序至少依赖于一个上述包。<br />
<br />
在这份文档中,''xorrisofs'' 支持 ''mkisofs'' 选项。<br />
<br />
''cdrskin'' 支持 ''cdrecord'' 选项 ; ''xorrecord'' 在不处理音频 CD 时也支持它。<br />
<br />
=== 从已存在的文件构建一个 ISO 镜像 ===<br />
<br />
先将需要的文件拷贝到一个文件夹,是创建一个 ISO 镜像的最简单办法。例如:{{ic|./for.iso}}。<br />
<br />
然后用 ''mkisofs'' 生成这个镜像:<br />
<br />
$ mkisofs -V "''ARCHIVE_2013_07_27''" -J -r -o ''isoimage.iso'' ''./for_iso''<br />
<br />
这些选项在下列的节中被解释。<br />
<br />
==== 基本选项 ====<br />
<br />
;{{ic|-V}}: (分配给)文件系统的名称。ISO 9660 标准限定了 32 字节的长度,同样,这些字符被限制为:"A"-"Z","0"-"9"以及"_"。卷标签可能展示为挂载点,如果这个介质是被自动挂载的。<br />
;{{ic|-J}}: 启用 [[Wikipedia:Joliet (file system)|Joliet]] 扩展, 允许特定空间用 Unicode 存储文件名称。(最高每个文件 64 UTF-16 字符)。<br />
;{{ic|-joliet-long}}: 增加 Joliet 表命名的最大长度,从 64 到 103 字符。 不符合Joliet规范,通常不受支持。<br />
;{{ic|-r}}: Enables [[Wikipedia:Rock Ridge|Rock Ridge]] 扩展,POSIX 文件系统到一个镜像,包括 255 字符长度的文件名和 Unix 风格文件拓展名。<br />
;{{ic|-o}}: 为输出的 ISO 镜像设置文件路径。<br />
<br />
==== 移植点 ====<br />
<br />
可以让 "mkisofs" 查找文件和目录从制定路径<br />
<br />
$ mkisofs -V "''BACKUP_2013_07_27''" -J -r -o ''backup_2013_07_27.iso'' \<br />
-graft-points \<br />
/photos=/home/''user''/photos \<br />
/mail=/home/''user''/mail \<br />
/photos/holidays=/home/''user''/holidays/photos<br />
<br />
{{ic|-graft-points}} 允许识别由ISO文件系统中的目标地址组成的“路径规范” (如 {{ic|/photos}}) 和源地址 (如 {{ic|/home/user/photos}}). 使用 "=" 字符分隔。<br />
<br />
这个例子将 文件夹 {{ic|/home/user/photos}}{{ic|/home/user/mail}} and {{ic|/home/user/holidays/photos}} 分别设为 ISO 镜像中的 {{ic|/photos}}, {{ic|/mail}} and {{ic|/photos/holidays}}。<br />
<br />
''mkisofs'' 和 ''xorrisofs'' 使用相同的参数。使用安全备份,为 ''xorrisofs'' 加上 {{ic|--for_backup}},这将记录事件 ACL 并为每个文件存储 MD5 校验值。<br />
<br />
见 {{man|8|mkisofs}} 和 {{man|1|xorrisofs}} 手册以获得更多关于命令的参数的信息。<br />
<br />
=== 挂载一个 ISO 镜像 ===<br />
<br />
你可以挂载一个 ISO 镜像,如果你想要浏览它的文件。<br />
我们可以使用下面的指令挂载一个 ISO 镜像:<br />
<br />
# mount -t iso9660 -o ro,loop ''/path/to/file.iso'' ''/mount-point''<br />
<br />
浏览完毕后,一定记得卸载:<br />
<br />
# umount /mount-point<br />
<br />
无 Root 用户挂载镜像,见 [[Mounting images as user]]。<br />
<br />
=== 转换 img/ccd 到 iso ===<br />
<br />
转换 {{ic|img}}/{{ic|ccd}} 镜像, 你可使用 {{Pkg|ccd2iso}}:<br />
<br />
$ ccd2iso ''~/image.img'' ''~/image.iso''<br />
<br />
=== 知晓你的设备的名称 ===<br />
<br />
为剩余部分,假定你设的记录设备的节为 {{ic|/dev/sr0}}<br />
<br />
用下面的指令检查<br />
<br />
$ cdrecord dev=''/dev/sr0'' -checkdrive<br />
<br />
这将报告这个设备的 {{ic|Vendor_info}} 和 {{ic|Indentification}}。<br />
<br />
如果没有找到设备,检查一切 {{ic|/dev/sr*}} 是否存在,当他们提供了读写权限 ({{ic|wr-}}) 到你的组。<br />
<br />
如果没有 {{ic|/dev/sr*}} 存在,尝试手动[[Kernel modules|加载]]模块 {{ic|sr_mod}}。<br />
<br />
=== 读取 CD/DVD 的卷名 ===<br />
<br />
如果你想获得名称或标签,使用''dd'':<br />
<br />
$ dd if=''/dev/sr0'' bs=1 skip=32808 count=32<br />
<br />
=== 从 CD, DVD 或 BD 中创建 ISO 镜像 ===<br />
<br />
为从介质中拷贝数据,并不让空块填充它,先确定它的块/扇区数量与大小(多数为每个 2048)。<br />
<br />
{{hc|$ isosize -x /dev/sr0|<br />
sector count: 2041796, sector size: 2048<br />
}}<br />
<br />
或<br />
<br />
{{hc|$ isoinfo -d -i /dev/sr0 {{!}} awk '/block size{{!}}Volume size/'|<br />
Logical block size is: 2048<br />
Volume size is: 2041796<br />
}}<br />
<br />
{{Note|别忘记把{{ic|/dev/sr0}}换成你的光驱。}}<br />
<br />
然后用[[dd]]用获得的数据拷出来:<br />
<br />
$ dd if=/dev/sr0 of=discmage.iso bs=''sector_size'' count=''sector_count'' status=progress<br />
<br />
{{Tip|如果介质坏了,建议用类似于 {{Pkg|ddrescue}} 这样的专门工具,见 [[Disk cloning#Using ddrescue]] 。}}<br />
<br />
如果原介质是可启动的,它的拷贝也将是一个可启动镜像。你可能将它用于虚拟机的虚拟光驱或将它烧录到光学介质,这也将是可启动的。 [https://askubuntu.com/questions/147800/ripping-dvd-to-iso-accurately#874945]<br />
<br />
=== 擦除CD-RW和DVD-RW ===<br />
<br />
使用过的CD-RW介质需要在写上以前记录的数据之前被擦除。这可以通过以下方式完成<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
<br />
清空有两个选项:blank=fast 和 blank=all。完全清空的持续时间与完全写操作一样长。它覆盖了光盘上的有效载荷数据。然而这不应该被认为是安全地使这些数据不可读。为了这个目的,建议用随机数据进行几次全写运行。<br />
<br />
替代命令有:<br />
<br />
$ cdrskin -v dev=''/dev/sr0'' blank=fast<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
擦除 DVD-RW 使用 ''dvd+rw-format'' 工具来自 {{Pkg|dvd+rw-tools}}:<br />
<br />
$ dvd+rw-format -blank=fast ''/dev/sr0''<br />
<br />
替代命令有:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
$ cdrskin -v dev=''/dev/sr0'' blank=deformat_sequential_quickest<br />
$ xorriso -outdev ''/dev/sr0'' -blank deformat_quickest<br />
<br />
这种快速消隐的DVD-RW不适合多时段使用,也不能接受未预知长度的输入流。为此,人们必须使用以下方法之一:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=all<br />
$ dvd+rw-format -blank=full ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=as_needed<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
其他媒体类型要么是一次性写入(CD-R、DVD-R、DVD+R、BD-R),要么是无需擦除的可重写(DVD-RAM、DVD+RW、BD-RE)。<br />
<br />
=== 格式化 DVD-RW ===<br />
<br />
格式化过的 DVD-RW 介质可以在不提前擦除的情况下重写。所以考虑在其生命周期内格式化一次。<br />
<br />
$ dvd+rw-format -force ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=format_if_needed<br />
$ xorriso -outdev ''/dev/sr0'' -format as_needed<br />
<br />
不像 DVD-RAM, DVD+RW 和 BD-RE,格式化的 DVD-RW 无法被用于(低速)硬盘直写,而是需要驱动 ptcdvd。见 {{man|8|pktsetup}}。<br />
<br />
=== 格式化 BD-RE 和 BD-R ===<br />
<br />
BD-RE 需要在使用前格式化。当检测到未格式化状态时,烧录程序会自动完成它。然而,数据存储区域的大小可能会受到上述DVD-RW格式命令的影响。<br />
<br />
BD-R 可以是格式化的或非格式化的。非格式化的写入将会全程普通速度写入,并提供最大的存储空间。格式化的可以在写入操作时检查,坏块会从空闲块中被替换。这可能会把速度降到一半于普通速度。普通的格式化会使存储空间下降 768MiB。<br />
<br />
growisofs 默认会格式化 BD-R,其他的不会。growisofs 可不进行格式化。cdrskin 和 xorriso 可以完全速度写入格式化的 BD-RE 或 BD-R:<br />
<br />
$ growisofs -use-the-force-luke=spare:none ...growisofs.or.mkisofs.options...<br />
$ cdrskin stream_recording=on ...cdrecord.options...<br />
$ xorriso -stream_recording on ...xorriso.commands...<br />
<br />
=== 烧录一个 ISO 镜像到 CD、DVD 或 BD。 ===<br />
<br />
为烧录一个 ISO 镜像文件 {{ic|isoimage.iso}} 到光学介质,<br />
为CD: <br />
<br />
$ cdrecord -v -sao dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
为 DVD 或 BD:<br />
<br />
$ growisofs -dvd-compat -Z ''/dev/sr0''=''isoimage.iso''<br />
<br />
为 CD、BD 或 DVD:<br />
<br />
$ xorriso -as cdrecord -v dev=''/dev/sr0'' -dao ''isoimage.iso''<br />
<br />
{{Note|1=<br /><br />
* 当你准备写入时,确保介质未挂载。当介质包含一个可读的文件系统时,管挂载可能是自动的。在最好的情况下,它会防止烧录程序使用烧录设备。在最坏的情况下,可能会因为读取操作弄坏设备。所以,在不能确定的情况下,{{bc|# umount /dev/sr0}}<br />
* ''growisofs'' 有个关于 BD-R 空白介质的[https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=713016 小 bug]。它会报出一个错误信息在烧录完成后。像 ''k3b'' 这样的程序会认为整个烧录过程失败了。为防止这个问题:<br />
** 这样 {{ic|dvd+rw-format ''/dev/sr0''}} 格式化在使用 ''growisofs'' 之前。<br />
** 或用 ''growisofs'' 选项 {{ic|1= -use-the-force-luke=spare:none}}<br />
}}<br />
<br />
=== 验证烧录的ISO镜像 ===<br />
你可以验证烧录的介质的完整性,以确保它不包含错误。在验证之前一定要弹出介质并重新插入。这将保证任何内核缓存不会被用来读取数据。<br />
<br />
首先计算原始ISO镜像的MD5校验值:<br />
<br />
{{hc|$ md5sum isoimage.iso|<br />
e5643e18e05f5646046bb2e4236986d8 isoimage.iso<br />
}}<br />
<br />
之后在介质上为每个 ISO 文件系统计算 MD5。不过一些类型的介质完全提交给烧录程序相同数量的数据,很多其他的尾随的垃圾也会被读取。所以你需要限制为 ISO 镜像文件读取的大小。<br />
<br />
$ blocks=$(expr $(du -b isoimage.iso | awk '{print $1}') / 2048)<br />
<br />
{{hc|1=$ dd if=/dev/sr0 bs=2048 count=$blocks {{!}} md5sum|2=<br />
43992+0 records in<br />
43992+0 records out<br />
90095616 bytes (90 MB, 86 MiB) copied, 0.359539 s, 251 MB/s<br />
e5643e18e05f5646046bb2e4236986d8 -<br />
}}<br />
<br />
每次执行都需要给出相同的 MD5 校验值(这:{{ic|e5643e18e05f5646046bb2e4236986d8}})。如果没有,你可能会一同获得一个 I/O 错误自 {{ic|dd}} 的运行中。当你感兴趣的时候,[[dmesg]] 可能告诉你 SCSI 错误和块编号。<br />
<br />
=== ISO 9660 和运行时烧录 ===<br />
<br />
没有必要存储一个应急的 ISO 文件系统在硬盘,在它写到光学介质前。在写到一个空设备缓冲区的时候,只有极老的 CD 驱动器在极老的电脑上运行会遭受错误。<br />
<br />
如果你省略了 ''mkisofs'' 的 {{ic|-o}} 选项,它将写一个 ISO 镜像到标准输出。这可被用管道导到烧录程序。<br />
<br />
$ mkisofs -V "ARCHIVE_2013_07_27" -J -r ./for_iso | \<br />
cdrecord -v dev=/dev/sr0 -waiti -<br />
<br />
选项 {{ic|-waiti}} 此处并非必须. 它避免 ''cdrecord'' 在 ''mkisofs'' 在其输出前写入到介质。这将允许 ''mkisofs'' 排除干扰的去读取已开始烧录的介质。见关于多会话的下一节。<br />
<br />
在 DVD 和 BD 中, 你可能让 ''growisofs'' 为你操作 ''mkisofs'' 并在运行烧录它的输出:<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
=== 多会话 ===<br />
<br />
ISO-9960 多会话意味着一个介质使用只读文件系统的同时,依然可以在第一个未被使用的块地址写,并且在这个块上会有新的 ISO 树。这个新树协同于新加的或覆写的文件的数据块。数据的块在旧的 ISO 树中的,无法再被写。<br />
<br />
Linux 和其他操作系统将挂载在介质上的最新的会话上的文件夹树。最新的树也将正常的显示旧会话的文件。<br />
<br />
==== Multi-session by cdrecord ====<br />
<br />
CD-R and CD-RW stay writable (aka "appendable") if cdrecord option {{ic|-multi}} was used<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
Then the medium can be inquired for the parameters of the next session<br />
<br />
$ m=$(cdrecord dev=''/dev/sr0'' -msinfo)<br />
<br />
By help of these parameters and of the readable medium in the drive you can produce the add-on ISO session<br />
<br />
$ mkisofs -M ''/dev/sr0'' -C "$m" \<br />
-V "''ARCHIVE_2013_07_28''" -J -r -o ''session2.iso'' ''./more_for_iso''<br />
<br />
Finally append the session to the medium and keep it appendable again<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''session2.iso''<br />
<br />
Programs ''cdrskin'' and ''xorrecord'' do this too with DVD-R, DVD+R, BD-R and unformatted DVD-RW. Program ''cdrecord'' does multi-session with at least DVD-R and DVD-RW. They all do with CD-R and CD-RW, of course.<br />
<br />
Most re-usable media types do not record a session history that would be recognizable for a mounting kernel. But with ISO 9660 it is possible to achieve the multi-session effect even on those media.<br />
<br />
''growisofs'' and ''xorriso'' can do this and hide most of the complexity.<br />
<br />
==== Multi-session by growisofs ====<br />
<br />
By default, ''growisofs'' uses ''mkisofs'' as a backend for creating ISO images forwards most of its program arguments to . See above examples of ''mkisofs''. It bans option {{ic|-o}} and deprecates option {{ic|-C}}. By default it uses the ''mkisofs''. You may specify to use one of the others compatible backend program by setting environment variable {{ic|MKISOFS}}:<br />
<br />
$ export MKISOFS="xorrisofs"<br />
<br />
The wish to begin with a new ISO file system on the optical medium is expressed by option {{ic|-Z}}<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
The wish to append more files as new session to an existing ISO file system is expressed by option {{ic|-M}}<br />
<br />
$ growisofs -M ''/dev/sr0'' -V "''ARCHIVE_2013_07_28''" -r -J ''./more_for_iso''<br />
<br />
For details see the {{man|1|growisofs}} manual and the manuals of ''mkisofs'' and ''xorrisofs''.<br />
<br />
==== Multi-session by xorriso ====<br />
<br />
''xorriso'' learns the wish to begin with a new ISO file system from the blank state of the medium. So it is appropriate to blank it if it contains data. The command {{ic|-blank as_needed}} applies to all kinds of re-usable media and even to ISO images in data files on hard disk. It does not cause error if applied to a blank write-once medium.<br />
<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed \<br />
-volid "''ARCHIVE_2013_07_27''" -joliet on -add ''./for_iso'' --<br />
<br />
On non-blank writable media ''xorriso'' appends the newly given disc files if command {{ic|-dev}} is used rather than {{ic|-outdev}}. Of course, no command {{ic|-blank}} should be given here<br />
<br />
$ xorriso -dev ''/dev/sr0'' \<br />
-volid "''ARCHIVE_2013_07_28''" -joliet on -add ''./more_for_iso'' --<br />
<br />
For details see the {{man|1|xorriso}} man page and especially its examples.<br />
<br />
=== BD Defect Management ===<br />
<br />
BD-RE and formatted BD-R media are normally written with enabled Defect Management. This feature reads the written blocks while they are still stored in the drive buffer. In case of poor read quality the blocks get written again or redirected to the ''Spare Area'' where the data get stored in replacement blocks.<br />
<br />
This checkreading reduces write speed to at most half of the nominal speed of drive and BD medium. Sometimes it is even worse. Heavy use of the Spare Area causes long delays during read operations. So Defect Management is not always desirable.<br />
<br />
''cdrecord'' does not format BD-R. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''growisofs'' formats BD-R by default. The Defect Management can be prevented by option {{ic|1= -use-the-force-luke=spare:none}}. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''cdrskin'', ''xorriso'' and ''xorrecord'' do not format BD-R by default. They do with {{ic|1= cdrskin blank=format_if_needed}}, resp. {{ic|1= xorriso -format as_needed}}, resp. {{ic|1= xorrecord blank=format_overwrite}}. These three programs can disable Defect Management with BD-RE and already formatted BD-R by {{ic|1= cdrskin stream_recording=on}}, resp. {{ic|1= xorriso -stream_recording on}}, resp. {{ic|1= xorrecord stream_recording=on}}.<br />
<br />
=== Burning an audio CD ===<br />
<br />
Create your audio tracks and store them as uncompressed, 16-bit, 44100-Hz, stereo WAV files. To convert MP3 to WAV, ensure {{Pkg|lame}} is installed, ''cd'' to the directory with your MP3 files, and run:<br />
<br />
$ for i in *.mp3; do lame --decode "$i" "$(basename "$i" .mp3)".wav; done<br />
<br />
In case you get an error when trying to burn WAV files converted with LAME, try decoding with {{Pkg|mpg123}}:<br />
<br />
$ for i in *.mp3; do mpg123 --rate 44100 --stereo --buffer 3072 --resync -w $(basename "$i" .mp3).wav $i; done<br />
<br />
To convert AAC to WAV ensure {{Pkg|faad2}} is installed and run:<br />
$ for i in *.m4a; do faad $i; done<br />
<br />
To fix the bitrate of an already existing WAV file (or many other formats), try using {{Pkg|sox}}:<br />
$ for i in *.wav; do sox "$i" -c 2 -r 44100 "$(basename "$i" .wav)"-ok.wav; done<br />
<br />
Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as {{ic|01.wav}}, {{ic|02.wav}}, {{ic|03.wav}}, etc. Use the following command to simulate burning the WAV files as an audio CD:<br />
<br />
$ cdrecord '''-dummy''' -v -pad speed=1 dev=''/dev/sr0'' -dao -swab *.wav<br />
<br />
If everything worked, you can remove the {{ic|-dummy}} flag to actually burn the CD.<br />
<br />
{{Note|The produced disc may not play in all CD players. For an audio-only disc (discarding some track metadata), add the {{ic|-audio}} flag.}}<br />
<br />
To test the new audio CD, use [[MPlayer]]:<br />
<br />
$ mplayer cdda://<br />
<br />
=== Burning a BIN/CUE ===<br />
<br />
To burn a BIN/CUE image run:<br />
<br />
$ cdrdao write --device ''/dev/sr0'' ''image.cue''<br />
<br />
==== TOC/CUE/BIN for mixed-mode discs ====<br />
<br />
ISO images only store a single data track. If you want to create an image of a mixed-mode disc (data track with multiple audio tracks) then you need to make a TOC/BIN pair:<br />
<br />
$ cdrdao read-cd --read-raw --datafile ''image.bin'' --driver generic-mmc:0x20000 --device ''/dev/cdrom'' ''image.toc''<br />
<br />
Some software only likes CUE/BIN pair, you can make a CUE sheet with ''toc2cue'' (part of {{Pkg|cdrdao}}):<br />
<br />
$ toc2cue ''image.toc'' ''image.cue''<br />
<br />
=== Burn backend problems ===<br />
<br />
If you are experiencing problems, you may ask for advise at mailing list [mailto:cdwrite@other.debian.org cdwrite@other.debian.org], or try to write to the one of support mail addresses if some are listed near the end of the program's man page.<br />
<br />
Tell the command lines you tried, the medium type (如 CD-R, DVD+RW, ...), and the symptoms of failure (program messages, disappointed user expectation, ...). You will possibly get asked to obtain the newest release or development version of the affected program and to make test runs. But the answer might as well be, that your drive dislikes the particular medium.<br />
<br />
=== Burning CD/DVD/BD with a GUI ===<br />
<br />
There are several applications available to burn CDs in a graphical environment.<br />
<br />
See also [[Wikipedia:Comparison of disc authoring software]].<br />
<br />
* {{App|[[Wikipedia:AcetoneISO|AcetoneISO]]|All-in-one ISO tool (supports BIN, MDF, NRG, IMG, DAA, DMG, CDI, B5I, BWI, PDI and ISO).|https://sourceforge.net/projects/acetoneiso|{{AUR|acetoneiso2}}}}<br />
* {{App|BashBurn|Lightweight terminal based menu frontend for CD/DVD burning tools.|http://bashburn.dose.se/|{{Pkg|bashburn}}}}<br />
* {{App|[[Wikipedia:Brasero (software)|Brasero]]|Disc burning application for the GNOME desktop that is designed to be as simple as possible.|https://wiki.gnome.org/Apps/Brasero|{{Pkg|brasero}}}}<br />
* {{App|cdw|Ncurses frontend to ''cdrecord'', ''mkisofs'', ''growisofs'', ''dvd+rw-mediainfo'', ''dvd+rw-format'' and ''xorriso''.|http://cdw.sourceforge.net/|{{AUR|cdw}}}}<br />
* {{App|Graveman|GTK-based CD/DVD burning application. It requires configuration to point to correct devices.|https://graveman.tuxfamily.org/|{{AUR|graveman}}}}<br />
* {{App|isomaster|ISO image editor.|http://littlesvr.ca/isomaster|{{AUR|isomaster}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|[[Wikipedia:X-CD-Roast|X-CD-Roast]]|Lightweight ''cdrtools'' front-end for CD and DVD writing.|http://www.xcdroast.org/|{{AUR|xcdroast}}}}<br />
* {{App|[[Wikipedia:Xfce#Xfburn|Xfburn]]|Simple front-end to the libburnia libraries with support for CD/DVD(-RW), ISO images, and BurnFree.|https://docs.xfce.org/apps/xfburn/start|{{Pkg|xfburn}}}}<br />
* {{App|xorriso-tcltk|Graphical front-end to ISO and CD/DVD/BD burn tool xorriso|https://www.gnu.org/software/xorriso/|{{Pkg|libisoburn}}}}<br />
<br />
== 播放 ==<br />
<br />
=== CD ===<br />
<br />
CD的音频播放需要{{Pkg|libcdio}} 软件包。为了使KDE应用程序如Dolphin能够读取CD中的音频,你需要安装{{Pkg|audiocd-kio}}。<br />
<br />
=== DVD ===<br />
<br />
如果你想播放加密的DVD,你必须安装诸如libdvd*软件包。<br />
* {{Pkg|libdvdread}}<br />
* {{Pkg|libdvdcss}}<br />
* {{Pkg|libdvdnav}}<br />
<br />
除此之外,你还需要安装媒体播放器。热门的DVD播放器包括[[MPlayer]], [[Wikipedia:Xine|xine]] 和 [[VLC]]。 参见 [[List of applications/Multimedia#Video players|视频播放]] 上的列表和对于 [[MPlayer#DVD playing|MPlayer]] 的特殊介绍。<br />
<br />
=== Blu-ray ===<br />
<br />
参见 [[Blu-ray#Playback]]。<br />
<br />
== Ripping ==<br />
<br />
[[Wikipedia:Ripping|Ripping]] is the process of copying audio or video content to a hard disk, typically from removable media or media streams.<br />
<br />
=== Audio CD ===<br />
<br />
==== Console ====<br />
<br />
* {{App|abcde|Comprehensive command-line tool for ripping audio CDs.|https://abcde.einval.com/|{{AUR|abcde}}}}<br />
* {{App|cdda2wav|CD-audio extraction program with paranoia support.|http://www.cdda2wav.de/|{{Pkg|cdrtools}}}}<br />
* {{App|[[Wikipedia:cdparanoia|cdparanoia]]|Compact Disc Digital Audio (CDDA) Digital Audio Extraction (DAE) tool.|https://xiph.org/paranoia/index.html|{{Pkg|cdparanoia}}}}<br />
* {{App|cyanrip|Extensive CD ripper with musicbraniz integration, error detection, log generation, many formats, HDCD decoding, covert art automatic download.|https://github.com/cyanreg/cyanrip/|{{AUR|cyanrip}}}}<br />
* {{App|ripright|Minimal CD ripper modeled on autorip.|https://www.mcternan.me.uk/ripright/|{{AUR|ripright}}}}<br />
* {{App|[[Wikipedia:ripit|ripit]]|Command-line ripper that supports MusicBrainz, freeddb and various codecs. |https://www.ripit.pl/|{{AUR|ripit}}}}<br />
* {{App|shnsplit|Splits .wav and .flac files according to a CUE sheet and encodes the resulting pieces. A useful companion to ABCDE.|http://shnutils.freeshell.org/shntool/|{{AUR|shntool}}}}<br />
* {{App|whipper|CD ripper aiming for accuracy over speed. Uses cdparanoia, MusicBrainz, AccurateRip.|https://github.com/whipper-team/whipper|{{Pkg|whipper}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|[[Wikipedia:Asunder (software)|Asunder]]|GTK-based CD ripping program.|http://littlesvr.ca/asunder/|{{Pkg|asunder}}}}<br />
* {{App|Audex|Audio grabber tool for CD-ROM drives based on KDE.|https://userbase.kde.org/Audex|{{Pkg|audex}}}}<br />
* {{App|[[Wikipedia:Fre:ac|fre:ac]]|Audio converter and CD ripper with support for various popular formats and encoders.|https://freac.org/|{{AUR|freac}}}}<br />
* {{App|Goobox|CD player and ripper for GNOME.|https://people.gnome.org/~paobac/goobox/{{Dead link|2022|09|22|status=404}}|{{Pkg|goobox}}}}<br />
* {{App|[[Wikipedia:Grip (software)|Grip]]|Fast and light CD ripper within the GNOME project that resembles [[Wikipedia:Audiograbber|Audiograbber]].|https://sourceforge.net/projects/grip/|{{AUR|grip}}}}.<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|KAudioCreator|KDE program for ripping and encoding Audio-CDs. Unmaintained and [https://bugs.archlinux.org/task/67618 does not start anymore].|https://invent.kde.org/unmaintained/kaudiocreator|{{AUR|kaudiocreator-git}}}}<br />
* {{App|ripperX|GTK program to rip CD audio tracks and encode them to the Ogg, MP3, or FLAC formats.|https://sourceforge.net/projects/ripperx/|{{AUR|ripperx}}}}<br />
* {{App|rubyripper|Audio disc ripper that tries to deliver a secure rip through multiple rippings of the same track and corrections of any differences.|https://github.com/bleskodev/rubyripper|{{AUR|rubyripper}}}}<br />
* {{App|[[Wikipedia:Sound Juicer|Sound Juicer]]|CD ripper for GNOME.|https://wiki.gnome.org/Apps/SoundJuicer|{{Pkg|sound-juicer}}}}<br />
* {{App|1=soundKonverter|2=Front-end to various audio converters.|3=https://www.linux-apps.com/content/show.php?content=29024|4={{Pkg|soundkonverter}}}}<br />
<br />
=== DVD-Video ===<br />
<br />
See also [[Wikipedia:Comparison of DVD ripper software]].<br />
<br />
Often, the process of ripping a DVD can be broken down into two subtasks:<br />
<br />
# '''Data extraction''' — Copying the audio and/or video data to a hard disk,<br />
# [[Wikipedia:Transcode|Transcoding]] — Converting the extracted data into a suitable format.<br />
<br />
Some utilities perform both tasks, whilst others focus on one aspect or the other.<br />
<br />
==== Console ====<br />
<br />
* {{App|[[dvdbackup]]|Tool for pure data extraction which does not transcode. It is useful for creating ''exact'' copies of encrypted DVDs in conjunction with '''libdvdcss''' or for decrypting video for other utilities unable to read encrypted DVDs.|http://dvdbackup.sourceforge.net/|{{Pkg|dvdbackup}}}}<br />
* {{App|[[FFmpeg]]|Complete and free Internet live audio and video broadcasting solution for Linux/Unix, capable to do a direct rip in any format (audio/video) from a DVD-Video ISO image, just select the input as the ISO image and proceed with the desired options. It also allows to downmixing, shrinking, spliting, selecting streams among other features.|https://ffmpeg.org/|{{Pkg|ffmpeg}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake CLI]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping.|https://handbrake.fr/|{{Pkg|handbrake-cli}}}}<br />
* {{App|[[MEncoder]]|Free command line video decoding, encoding and filtering tool. It supports ripping and transcoding DVD-Video.|http://www.mplayerhq.hu/|{{Pkg|mencoder}}}}<br />
* {{App|subtitleripper|Convert DVD subtitles into text format.|http://subtitleripper.sourceforge.net/|{{AUR|subtitleripper}}}}<br />
* {{App|Transcode|Video/DVD ripper and encoder for the terminal/console. It is [https://www.linuxfromscratch.org/blfs/view/8.3/multimedia/transcode.html outdated/no longer actively maintained].||{{Pkg|transcode}}}}<br />
* {{App|Vobcopy|Copies DVD ''.vob'' files to hard disk, decrypting them on the way.|https://github.com/barak/vobcopy|{{AUR|vobcopy}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|dvd::rip|Front-end to {{Pkg|transcode}}, used to extract DVD's to the hard disk and transcode or extract and transcode on-the-fly.|https://www.exit1.org/dvdrip/|{{AUR|dvdrip}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping. GTK version.|https://handbrake.fr/|{{Pkg|handbrake}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|OGMRip|An application and a set of libraries for ripping and encoding DVD into AVI, OGM, MP4, or Matroska files using a wide variety of codecs. It relies on mplayer, mencoder, ogmtools, mkvtoolnix, mp4box, oggenc, lame, and faac to perform its tasks.|http://ogmrip.sourceforge.net/|{{AUR|ogmrip}}}}<br />
<br />
=== DVD-Audio ===<br />
<br />
* {{App|Python Audio Tools|Includes dvda2track, which is easy to use command line tool to extract DVD-Audio tracks to uncompressed wav files.<br />
|http://audiotools.sourceforge.net/|{{AUR|audiotools}}}}<br />
<br />
=== Multi-format ===<br />
<br />
* {{App|Aaru|Software for archival ripping of CDs, DVDs, and harddrives|https://aaru.app|{{AUR|aaru}}}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Brasero fails to normalize audio CD ===<br />
<br />
If you try to burn it may stop at the first step called Normalization.<br />
<br />
As a workaround you can disable the normalization plugin using the ''Edit > Plugins'' menu<br />
<br />
=== VLC: Error "... could not open the disc /dev/dvd" ===<br />
<br />
If you get an error like<br />
<br />
vlc dvdread could not open the disc "/dev/dvd"<br />
<br />
it may be because there is no device node {{ic|/dev/dvd}} on your system. Udev no longer creates {{ic|/dev/dvd}} and instead uses {{ic|/dev/sr0}}. To fix this, edit the VLC configuration file ({{ic|~/.config/vlc/vlcrc}}):<br />
<br />
# DVD device (string)<br />
dvd=/dev/sr0<br />
<br />
=== DVD drive is noisy ===<br />
<br />
If playing DVD videos causes the system to be very loud, it may be because the disc is spinning faster than it needs to. To temporarily change the speed of the drive, run:<br />
<br />
# eject -x 12 /dev/dvd<br />
<br />
Sometimes:<br />
<br />
# hdparm -E12 /dev/dvd<br />
<br />
Any speed that is supported by the drive can be used, or 0 for the maximum speed.<br />
<br />
[https://michal.kosmulski.org/computing/tips/cd-rom-speed.html Setting CD-ROM and DVD-ROM drive speed]<br />
<br />
=== Playback does not work with new computer (new DVD-Drive) ===<br />
<br />
If playback does not work and you have a new computer (new DVD-Drive) the reason might be that the [[Wikipedia:DVD region code|region code]] is not set. You can read and set the region code with the {{AUR|regionset}} package.<br />
<br />
=== None of the above programs are able to rip/encode a DVD to my hard disk! ===<br />
<br />
Make sure the region of your DVD reader is set correctly; otherwise, you will get loads of inexplicable [[Wikipedia:Content Scramble System|CSS]]-related errors. Use the {{AUR|regionset}} package to do so.<br />
<br />
If ripping still does not work with the correct region set, refer to the [https://videolan.videolan.me/libdvdcss/ libdvdcss developer documentation] for enabling log messages and setting other relevant options.<br />
<br />
=== GUI program log indicates problems with backend program ===<br />
<br />
If you use a GUI program and experience problems which the program's log blames on some backend program, then try to reproduce the problem by the logged backend program arguments.<br />
Whether you succeed with reproducing or not, you may report the logged lines and your own findings to the places mentioned in [[#Burn backend problems]] section.<br />
<br />
==== Special case: medium error / write error ====<br />
<br />
Here are some typical messages about the drive disliking the medium. This can only be solved by using a different drive or a different medium. A different program will hardly help.<br />
<br />
Brasero with backend growisofs:<br />
<br />
BraseroGrowisofs stderr: :-[ WRITE@LBA=0h failed with SK=3h/ASC=0Ch/ACQ=00h]: Input/output error<br />
<br />
Brasero with backend libburn:<br />
<br />
BraseroLibburn Libburn reported an error SCSI error on write(16976,16): [3 0C 00] Write error<br />
<br />
=== BD-R DL 50GB errors on trying to burn second layer ===<br />
<br />
Using ''growisofs'' from {{Pkg|dvd+rw-tools}} for burning 50GB BD-R DL discs might result in a fatal error and damaged media, such as:<br />
<br />
{{hc|$ growisofs -Z /dev/sr0 -J -R -V "label" files|<nowiki><br />
Executing 'mkisofs -J -R -V label files | builtin_dd of=/dev/sr0 obs=32k seek=0'<br />
I: -input-charset not specified, using utf-8 (detected in locale settings)<br />
0.03% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.05% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.08% done, estimate finish Fri Jan 29 19:50:36 2016<br />
/dev/sr0: pre-formatting blank BD-R for 49.8GB...<br />
/dev/sr0: "Current Write Speed" is 8.2x4390KBps.<br />
0.11% done, estimate finish Sat Jan 30 03:29:13 2016<br />
0.13% done, estimate finish Sat Jan 30 02:10:01 2016<br />
...<br />
63.20% done, estimate finish Fri Jan 29 20:43:45 2016<br />
:-[ WRITE@LBA=b6d820h failed with SK=3h/WRITE ERROR]: Input/output error<br />
:-( write failed: Input/output error<br />
/dev/sr0: flushing cache<br />
/dev/sr0: closing track<br />
/dev/sr0: closing session<br />
:-[ CLOSE SESSION failed with SK=5h/INVALID FIELD IN CDB]: Input/output error<br />
/dev/sr0: reloading tray<br />
</nowiki>}}<br />
<br />
This happened at the 25GB boundary when starting to write the second layer. Using ''cdrecord'' from {{Pkg|cdrtools}} works with no problems. Tested with a 'HL-DT-ST BD-RE WH16NS40' LG burner, and Verbatim BD-R DL 6x discs (#96911). {{bug|47797}}<br />
<br />
=== Disc tray autocloses ===<br />
<br />
If after ejecting a cd, either by using the {{ic|eject}} command, or pushing the drive button, the drive disc tray autocloses before being able to remove the disc, try the following command:<br />
<br />
# sysctl -w dev.cdrom.autoclose=0<br />
<br />
If that solves the problem, make the change permanent:<br />
<br />
{{hc|/etc/sysctl.d/60-cdrom-autoclose.conf|2=<br />
dev.cdrom.autoclose = 0<br />
}}<br />
<br />
If the above does not work and as a last resort measure, you can unload the disc module from the kernel via:<br />
<br />
# rmmod sr_mod<br />
<br />
the disc drive should now behave as expected but will not mount disc anymore. After putting a disc into the drive, reactivate the module via:<br />
<br />
# modprobe sr_mod<br />
<br />
the disc should now mount.<br />
<br />
== See also ==<br />
<br />
* In the United States, backup of physically obtained media is allowed under these conditions: [https://www.riaa.com/resources-learning/about-piracy/ About Piracy - RIAA].<br />
* [https://dev.lovelyhq.com/libburnia/web/wiki Main page of the project Libburnia]</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Optical_disc_drive_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=757950Optical disc drive (简体中文)2022-11-25T06:48:45Z<p>InsaneGuo: /* Blu-ray */ // Edit via Wikiplus</p>
<hr />
<div>[[Category:Multimedia (简体中文)]]<br />
[[Category:Optical disc (简体中文)]]<br />
[[en:Optical disc drive]]<br />
[[es:Optical disc drive]]<br />
[[ja:光学ディスクドライブ]]<br />
{{Related articles start}}<br />
{{Related|Codecs}}<br />
{{Related|MPlayer}}<br />
{{Related|dvdbackup}}<br />
{{Related|MEncoder}}<br />
{{Related|Blu-ray}}<br />
{{Related|Convert any Movie to DVD Video}}<br />
{{Related articles end}}<br />
<br />
来自维基百科:<br />
<br />
在计算机领域,Optical disc drive(ODD)是一种光盘驱动器,它使用激光或可见光频谱内或附近的电磁波作为向光盘读写数据过程的一部分。<br />
<br />
== 刻录 ==<br />
<br />
{{Expansion|是否有被 Arch Linux 打包过的命令行工具可以将文件分卷写入碟片中? (像是 GAFFitter 或 cdrkit 的 dirsplit) }}<br />
<br />
{{Warning|有很大数量的光学驱动器和碟片是有很大不同的。通常,在需要可靠性的时候,推荐使用慢速刻录。如果你遇到了未预期的行为时,尝试使用刻录器所支持的最慢速度刻录。}}<br />
<br />
光盘驱动器的刻录过程包括创建或获得一个图像并将其写入光学介质。该镜像原则上可以是任何数据文件。如果你想挂载生成的介质,那么它通常是一个ISO 9660文件系统的镜像文件。音频和多媒体光盘通常是从.bin文件刻录的,在.toc文件或.cue文件的控制下,告诉所需的轨道布局。<br />
<br />
=== 安装刻录工具 ===<br />
<br />
{{Style|Says twice that X is the traditional choice without stating why.}}<br />
<br />
如果你想要使用 GUI 程序,见 [[#Burning CD/DVD/BD with a GUI]]。<br />
<br />
这里列出的程序是面向命令行的。它们是大多数用于CD、DVD和BD的免费GUI程序所使用的后端。当涉及到故障排除或编写刻录活动的脚本时,GUI用户可能会用到它们。<br />
<br />
你至少需要一个创建文件系统镜像的程序和一个能够将数据刻录到你所需要的媒体类型的程序。<br />
<br />
可用于创建ISO9660类型镜像的应用有:<br />
<br />
* {{man|8|mkisofs}} 自 {{Pkg|cdrtools}}<br />
* {{man|1|xorriso}} 和 {{man|1|xorrisofs}} 自 {{Pkg|libisoburn}}<br />
<br />
常见的选择是 ''mkisofs''.<br />
<br />
可用于刻录媒体文件的应用有:<br />
<br />
* {{man|1|cdrdao}} 自 {{Pkg|cdrdao}} (仅 CD, 格式仅 TOC/CUE/BIN)<br />
* {{man|1|cdrecord}} 自 {{Pkg|cdrtools}}<br />
* {{man|1|cdrskin}} 自 {{Pkg|libburn}}<br />
* {{man|1|growisofs}} 自 {{Pkg|dvd+rw-tools}} (仅 DVD 和 BD)<br />
* {{man|1|xorriso}} 和 {{man|1|xorrecord}} 自 {{Pkg|libisoburn}}<br />
<br />
常见的对于 CD 的选择有 ''cdrecord'' 而 对于 DVD 和 BD 的选择有''growisofs'' 。为将 TOC/CUE/BIN 烧录到 CD,安装 {{Pkg|cdrdao}}.<br />
<br />
自由的 GUI 烧录程序至少依赖于一个上述包。<br />
<br />
在这份文档中,''xorrisofs'' 支持 ''mkisofs'' 选项。<br />
<br />
''cdrskin'' 支持 ''cdrecord'' 选项 ; ''xorrecord'' 在不处理音频 CD 时也支持它。<br />
<br />
=== 从已存在的文件构建一个 ISO 镜像 ===<br />
<br />
先将需要的文件拷贝到一个文件夹,是创建一个 ISO 镜像的最简单办法。例如:{{ic|./for.iso}}。<br />
<br />
然后用 ''mkisofs'' 生成这个镜像:<br />
<br />
$ mkisofs -V "''ARCHIVE_2013_07_27''" -J -r -o ''isoimage.iso'' ''./for_iso''<br />
<br />
这些选项在下列的节中被解释。<br />
<br />
==== 基本选项 ====<br />
<br />
;{{ic|-V}}: (分配给)文件系统的名称。ISO 9660 标准限定了 32 字节的长度,同样,这些字符被限制为:"A"-"Z","0"-"9"以及"_"。卷标签可能展示为挂载点,如果这个介质是被自动挂载的。<br />
;{{ic|-J}}: 启用 [[Wikipedia:Joliet (file system)|Joliet]] 扩展, 允许特定空间用 Unicode 存储文件名称。(最高每个文件 64 UTF-16 字符)。<br />
;{{ic|-joliet-long}}: 增加 Joliet 表命名的最大长度,从 64 到 103 字符。 不符合Joliet规范,通常不受支持。<br />
;{{ic|-r}}: Enables [[Wikipedia:Rock Ridge|Rock Ridge]] 扩展,POSIX 文件系统到一个镜像,包括 255 字符长度的文件名和 Unix 风格文件拓展名。<br />
;{{ic|-o}}: 为输出的 ISO 镜像设置文件路径。<br />
<br />
==== 移植点 ====<br />
<br />
可以让 "mkisofs" 查找文件和目录从制定路径<br />
<br />
$ mkisofs -V "''BACKUP_2013_07_27''" -J -r -o ''backup_2013_07_27.iso'' \<br />
-graft-points \<br />
/photos=/home/''user''/photos \<br />
/mail=/home/''user''/mail \<br />
/photos/holidays=/home/''user''/holidays/photos<br />
<br />
{{ic|-graft-points}} 允许识别由ISO文件系统中的目标地址组成的“路径规范” (如 {{ic|/photos}}) 和源地址 (如 {{ic|/home/user/photos}}). 使用 "=" 字符分隔。<br />
<br />
这个例子将 文件夹 {{ic|/home/user/photos}}{{ic|/home/user/mail}} and {{ic|/home/user/holidays/photos}} 分别设为 ISO 镜像中的 {{ic|/photos}}, {{ic|/mail}} and {{ic|/photos/holidays}}。<br />
<br />
''mkisofs'' 和 ''xorrisofs'' 使用相同的参数。使用安全备份,为 ''xorrisofs'' 加上 {{ic|--for_backup}},这将记录事件 ACL 并为每个文件存储 MD5 校验值。<br />
<br />
见 {{man|8|mkisofs}} 和 {{man|1|xorrisofs}} 手册以获得更多关于命令的参数的信息。<br />
<br />
=== 挂载一个 ISO 镜像 ===<br />
<br />
你可以挂载一个 ISO 镜像,如果你想要浏览它的文件。<br />
我们可以使用下面的指令挂载一个 ISO 镜像:<br />
<br />
# mount -t iso9660 -o ro,loop ''/path/to/file.iso'' ''/mount-point''<br />
<br />
浏览完毕后,一定记得卸载:<br />
<br />
# umount /mount-point<br />
<br />
无 Root 用户挂载镜像,见 [[Mounting images as user]]。<br />
<br />
=== 转换 img/ccd 到 iso ===<br />
<br />
转换 {{ic|img}}/{{ic|ccd}} 镜像, 你可使用 {{Pkg|ccd2iso}}:<br />
<br />
$ ccd2iso ''~/image.img'' ''~/image.iso''<br />
<br />
=== 知晓你的设备的名称 ===<br />
<br />
为剩余部分,假定你设的记录设备的节为 {{ic|/dev/sr0}}<br />
<br />
用下面的指令检查<br />
<br />
$ cdrecord dev=''/dev/sr0'' -checkdrive<br />
<br />
这将报告这个设备的 {{ic|Vendor_info}} 和 {{ic|Indentification}}。<br />
<br />
如果没有找到设备,检查一切 {{ic|/dev/sr*}} 是否存在,当他们提供了读写权限 ({{ic|wr-}}) 到你的组。<br />
<br />
如果没有 {{ic|/dev/sr*}} 存在,尝试手动[[Kernel modules|加载]]模块 {{ic|sr_mod}}。<br />
<br />
=== 读取 CD/DVD 的卷名 ===<br />
<br />
如果你想获得名称或标签,使用''dd'':<br />
<br />
$ dd if=''/dev/sr0'' bs=1 skip=32808 count=32<br />
<br />
=== 从 CD, DVD 或 BD 中创建 ISO 镜像 ===<br />
<br />
为从介质中拷贝数据,并不让空块填充它,先确定它的块/扇区数量与大小(多数为每个 2048)。<br />
<br />
{{hc|$ isosize -x /dev/sr0|<br />
sector count: 2041796, sector size: 2048<br />
}}<br />
<br />
或<br />
<br />
{{hc|$ isoinfo -d -i /dev/sr0 {{!}} awk '/block size{{!}}Volume size/'|<br />
Logical block size is: 2048<br />
Volume size is: 2041796<br />
}}<br />
<br />
{{Note|别忘记把{{ic|/dev/sr0}}换成你的光驱。}}<br />
<br />
然后用[[dd]]用获得的数据拷出来:<br />
<br />
$ dd if=/dev/sr0 of=discmage.iso bs=''sector_size'' count=''sector_count'' status=progress<br />
<br />
{{Tip|如果介质坏了,建议用类似于 {{Pkg|ddrescue}} 这样的专门工具,见 [[Disk cloning#Using ddrescue]] 。}}<br />
<br />
如果原介质是可启动的,它的拷贝也将是一个可启动镜像。你可能将它用于虚拟机的虚拟光驱或将它烧录到光学介质,这也将是可启动的。 [https://askubuntu.com/questions/147800/ripping-dvd-to-iso-accurately#874945]<br />
<br />
=== 擦除CD-RW和DVD-RW ===<br />
<br />
使用过的CD-RW介质需要在写上以前记录的数据之前被擦除。这可以通过以下方式完成<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
<br />
清空有两个选项:blank=fast 和 blank=all。完全清空的持续时间与完全写操作一样长。它覆盖了光盘上的有效载荷数据。然而这不应该被认为是安全地使这些数据不可读。为了这个目的,建议用随机数据进行几次全写运行。<br />
<br />
替代命令有:<br />
<br />
$ cdrskin -v dev=''/dev/sr0'' blank=fast<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
擦除 DVD-RW 使用 ''dvd+rw-format'' 工具来自 {{Pkg|dvd+rw-tools}}:<br />
<br />
$ dvd+rw-format -blank=fast ''/dev/sr0''<br />
<br />
替代命令有:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
$ cdrskin -v dev=''/dev/sr0'' blank=deformat_sequential_quickest<br />
$ xorriso -outdev ''/dev/sr0'' -blank deformat_quickest<br />
<br />
这种快速消隐的DVD-RW不适合多时段使用,也不能接受未预知长度的输入流。为此,人们必须使用以下方法之一:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=all<br />
$ dvd+rw-format -blank=full ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=as_needed<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
其他媒体类型要么是一次性写入(CD-R、DVD-R、DVD+R、BD-R),要么是无需擦除的可重写(DVD-RAM、DVD+RW、BD-RE)。<br />
<br />
=== 格式化 DVD-RW ===<br />
<br />
格式化过的 DVD-RW 介质可以在不提前擦除的情况下重写。所以考虑在其生命周期内格式化一次。<br />
<br />
$ dvd+rw-format -force ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=format_if_needed<br />
$ xorriso -outdev ''/dev/sr0'' -format as_needed<br />
<br />
不像 DVD-RAM, DVD+RW 和 BD-RE,格式化的 DVD-RW 无法被用于(低速)硬盘直写,而是需要驱动 ptcdvd。见 {{man|8|pktsetup}}。<br />
<br />
=== 格式化 BD-RE 和 BD-R ===<br />
<br />
BD-RE 需要在使用前格式化。当检测到未格式化状态时,烧录程序会自动完成它。然而,数据存储区域的大小可能会受到上述DVD-RW格式命令的影响。<br />
<br />
BD-R 可以是格式化的或非格式化的。非格式化的写入将会全程普通速度写入,并提供最大的存储空间。格式化的可以在写入操作时检查,坏块会从空闲块中被替换。这可能会把速度降到一半于普通速度。普通的格式化会使存储空间下降 768MiB。<br />
<br />
growisofs 默认会格式化 BD-R,其他的不会。growisofs 可不进行格式化。cdrskin 和 xorriso 可以完全速度写入格式化的 BD-RE 或 BD-R:<br />
<br />
$ growisofs -use-the-force-luke=spare:none ...growisofs.or.mkisofs.options...<br />
$ cdrskin stream_recording=on ...cdrecord.options...<br />
$ xorriso -stream_recording on ...xorriso.commands...<br />
<br />
=== 烧录一个 ISO 镜像到 CD、DVD 或 BD。 ===<br />
<br />
为烧录一个 ISO 镜像文件 {{ic|isoimage.iso}} 到光学介质,<br />
为CD: <br />
<br />
$ cdrecord -v -sao dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
为 DVD 或 BD:<br />
<br />
$ growisofs -dvd-compat -Z ''/dev/sr0''=''isoimage.iso''<br />
<br />
为 CD、BD 或 DVD:<br />
<br />
$ xorriso -as cdrecord -v dev=''/dev/sr0'' -dao ''isoimage.iso''<br />
<br />
{{Note|1=<br /><br />
* 当你准备写入时,确保介质未挂载。当介质包含一个可读的文件系统时,管挂载可能是自动的。在最好的情况下,它会防止烧录程序使用烧录设备。在最坏的情况下,可能会因为读取操作弄坏设备。所以,在不能确定的情况下,{{bc|# umount /dev/sr0}}<br />
* ''growisofs'' 有个关于 BD-R 空白介质的[https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=713016 小 bug]。它会报出一个错误信息在烧录完成后。像 ''k3b'' 这样的程序会认为整个烧录过程失败了。为防止这个问题:<br />
** 这样 {{ic|dvd+rw-format ''/dev/sr0''}} 格式化在使用 ''growisofs'' 之前。<br />
** 或用 ''growisofs'' 选项 {{ic|1= -use-the-force-luke=spare:none}}<br />
}}<br />
<br />
=== 验证烧录的ISO镜像 ===<br />
你可以验证烧录的介质的完整性,以确保它不包含错误。在验证之前一定要弹出介质并重新插入。这将保证任何内核缓存不会被用来读取数据。<br />
<br />
首先计算原始ISO镜像的MD5校验值:<br />
<br />
{{hc|$ md5sum isoimage.iso|<br />
e5643e18e05f5646046bb2e4236986d8 isoimage.iso<br />
}}<br />
<br />
之后在介质上为每个 ISO 文件系统计算 MD5。不过一些类型的介质完全提交给烧录程序相同数量的数据,很多其他的尾随的垃圾也会被读取。所以你需要限制为 ISO 镜像文件读取的大小。<br />
<br />
$ blocks=$(expr $(du -b isoimage.iso | awk '{print $1}') / 2048)<br />
<br />
{{hc|1=$ dd if=/dev/sr0 bs=2048 count=$blocks {{!}} md5sum|2=<br />
43992+0 records in<br />
43992+0 records out<br />
90095616 bytes (90 MB, 86 MiB) copied, 0.359539 s, 251 MB/s<br />
e5643e18e05f5646046bb2e4236986d8 -<br />
}}<br />
<br />
每次执行都需要给出相同的 MD5 校验值(这:{{ic|e5643e18e05f5646046bb2e4236986d8}})。如果没有,你可能会一同获得一个 I/O 错误自 {{ic|dd}} 的运行中。当你感兴趣的时候,[[dmesg]] 可能告诉你 SCSI 错误和块编号。<br />
<br />
=== ISO 9660 和运行时烧录 ===<br />
<br />
没有必要存储一个应急的 ISO 文件系统在硬盘,在它写到光学介质前。在写到一个空设备缓冲区的时候,只有极老的 CD 驱动器在极老的电脑上运行会遭受错误。<br />
<br />
如果你省略了 ''mkisofs'' 的 {{ic|-o}} 选项,它将写一个 ISO 镜像到标准输出。这可被用管道导到烧录程序。<br />
<br />
$ mkisofs -V "ARCHIVE_2013_07_27" -J -r ./for_iso | \<br />
cdrecord -v dev=/dev/sr0 -waiti -<br />
<br />
选项 {{ic|-waiti}} 此处并非必须. 它避免 ''cdrecord'' 在 ''mkisofs'' 在其输出前写入到介质。这将允许 ''mkisofs'' 排除干扰的去读取已开始烧录的介质。见关于多会话的下一节。<br />
<br />
在 DVD 和 BD 中, 你可能让 ''growisofs'' 为你操作 ''mkisofs'' 并在运行烧录它的输出:<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
=== 多会话 ===<br />
<br />
ISO-9960 多会话意味着一个介质使用只读文件系统的同时,依然可以在第一个未被使用的块地址写,并且在这个块上会有新的 ISO 树。这个新树协同于新加的或覆写的文件的数据块。数据的块在旧的 ISO 树中的,无法再被写。<br />
<br />
Linux 和其他操作系统将挂载在介质上的最新的会话上的文件夹树。最新的树也将正常的显示旧会话的文件。<br />
<br />
==== Multi-session by cdrecord ====<br />
<br />
CD-R and CD-RW stay writable (aka "appendable") if cdrecord option {{ic|-multi}} was used<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
Then the medium can be inquired for the parameters of the next session<br />
<br />
$ m=$(cdrecord dev=''/dev/sr0'' -msinfo)<br />
<br />
By help of these parameters and of the readable medium in the drive you can produce the add-on ISO session<br />
<br />
$ mkisofs -M ''/dev/sr0'' -C "$m" \<br />
-V "''ARCHIVE_2013_07_28''" -J -r -o ''session2.iso'' ''./more_for_iso''<br />
<br />
Finally append the session to the medium and keep it appendable again<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''session2.iso''<br />
<br />
Programs ''cdrskin'' and ''xorrecord'' do this too with DVD-R, DVD+R, BD-R and unformatted DVD-RW. Program ''cdrecord'' does multi-session with at least DVD-R and DVD-RW. They all do with CD-R and CD-RW, of course.<br />
<br />
Most re-usable media types do not record a session history that would be recognizable for a mounting kernel. But with ISO 9660 it is possible to achieve the multi-session effect even on those media.<br />
<br />
''growisofs'' and ''xorriso'' can do this and hide most of the complexity.<br />
<br />
==== Multi-session by growisofs ====<br />
<br />
By default, ''growisofs'' uses ''mkisofs'' as a backend for creating ISO images forwards most of its program arguments to . See above examples of ''mkisofs''. It bans option {{ic|-o}} and deprecates option {{ic|-C}}. By default it uses the ''mkisofs''. You may specify to use one of the others compatible backend program by setting environment variable {{ic|MKISOFS}}:<br />
<br />
$ export MKISOFS="xorrisofs"<br />
<br />
The wish to begin with a new ISO file system on the optical medium is expressed by option {{ic|-Z}}<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
The wish to append more files as new session to an existing ISO file system is expressed by option {{ic|-M}}<br />
<br />
$ growisofs -M ''/dev/sr0'' -V "''ARCHIVE_2013_07_28''" -r -J ''./more_for_iso''<br />
<br />
For details see the {{man|1|growisofs}} manual and the manuals of ''mkisofs'' and ''xorrisofs''.<br />
<br />
==== Multi-session by xorriso ====<br />
<br />
''xorriso'' learns the wish to begin with a new ISO file system from the blank state of the medium. So it is appropriate to blank it if it contains data. The command {{ic|-blank as_needed}} applies to all kinds of re-usable media and even to ISO images in data files on hard disk. It does not cause error if applied to a blank write-once medium.<br />
<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed \<br />
-volid "''ARCHIVE_2013_07_27''" -joliet on -add ''./for_iso'' --<br />
<br />
On non-blank writable media ''xorriso'' appends the newly given disc files if command {{ic|-dev}} is used rather than {{ic|-outdev}}. Of course, no command {{ic|-blank}} should be given here<br />
<br />
$ xorriso -dev ''/dev/sr0'' \<br />
-volid "''ARCHIVE_2013_07_28''" -joliet on -add ''./more_for_iso'' --<br />
<br />
For details see the {{man|1|xorriso}} man page and especially its examples.<br />
<br />
=== BD Defect Management ===<br />
<br />
BD-RE and formatted BD-R media are normally written with enabled Defect Management. This feature reads the written blocks while they are still stored in the drive buffer. In case of poor read quality the blocks get written again or redirected to the ''Spare Area'' where the data get stored in replacement blocks.<br />
<br />
This checkreading reduces write speed to at most half of the nominal speed of drive and BD medium. Sometimes it is even worse. Heavy use of the Spare Area causes long delays during read operations. So Defect Management is not always desirable.<br />
<br />
''cdrecord'' does not format BD-R. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''growisofs'' formats BD-R by default. The Defect Management can be prevented by option {{ic|1= -use-the-force-luke=spare:none}}. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''cdrskin'', ''xorriso'' and ''xorrecord'' do not format BD-R by default. They do with {{ic|1= cdrskin blank=format_if_needed}}, resp. {{ic|1= xorriso -format as_needed}}, resp. {{ic|1= xorrecord blank=format_overwrite}}. These three programs can disable Defect Management with BD-RE and already formatted BD-R by {{ic|1= cdrskin stream_recording=on}}, resp. {{ic|1= xorriso -stream_recording on}}, resp. {{ic|1= xorrecord stream_recording=on}}.<br />
<br />
=== Burning an audio CD ===<br />
<br />
Create your audio tracks and store them as uncompressed, 16-bit, 44100-Hz, stereo WAV files. To convert MP3 to WAV, ensure {{Pkg|lame}} is installed, ''cd'' to the directory with your MP3 files, and run:<br />
<br />
$ for i in *.mp3; do lame --decode "$i" "$(basename "$i" .mp3)".wav; done<br />
<br />
In case you get an error when trying to burn WAV files converted with LAME, try decoding with {{Pkg|mpg123}}:<br />
<br />
$ for i in *.mp3; do mpg123 --rate 44100 --stereo --buffer 3072 --resync -w $(basename "$i" .mp3).wav $i; done<br />
<br />
To convert AAC to WAV ensure {{Pkg|faad2}} is installed and run:<br />
$ for i in *.m4a; do faad $i; done<br />
<br />
To fix the bitrate of an already existing WAV file (or many other formats), try using {{Pkg|sox}}:<br />
$ for i in *.wav; do sox "$i" -c 2 -r 44100 "$(basename "$i" .wav)"-ok.wav; done<br />
<br />
Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as {{ic|01.wav}}, {{ic|02.wav}}, {{ic|03.wav}}, etc. Use the following command to simulate burning the WAV files as an audio CD:<br />
<br />
$ cdrecord '''-dummy''' -v -pad speed=1 dev=''/dev/sr0'' -dao -swab *.wav<br />
<br />
If everything worked, you can remove the {{ic|-dummy}} flag to actually burn the CD.<br />
<br />
{{Note|The produced disc may not play in all CD players. For an audio-only disc (discarding some track metadata), add the {{ic|-audio}} flag.}}<br />
<br />
To test the new audio CD, use [[MPlayer]]:<br />
<br />
$ mplayer cdda://<br />
<br />
=== Burning a BIN/CUE ===<br />
<br />
To burn a BIN/CUE image run:<br />
<br />
$ cdrdao write --device ''/dev/sr0'' ''image.cue''<br />
<br />
==== TOC/CUE/BIN for mixed-mode discs ====<br />
<br />
ISO images only store a single data track. If you want to create an image of a mixed-mode disc (data track with multiple audio tracks) then you need to make a TOC/BIN pair:<br />
<br />
$ cdrdao read-cd --read-raw --datafile ''image.bin'' --driver generic-mmc:0x20000 --device ''/dev/cdrom'' ''image.toc''<br />
<br />
Some software only likes CUE/BIN pair, you can make a CUE sheet with ''toc2cue'' (part of {{Pkg|cdrdao}}):<br />
<br />
$ toc2cue ''image.toc'' ''image.cue''<br />
<br />
=== Burn backend problems ===<br />
<br />
If you are experiencing problems, you may ask for advise at mailing list [mailto:cdwrite@other.debian.org cdwrite@other.debian.org], or try to write to the one of support mail addresses if some are listed near the end of the program's man page.<br />
<br />
Tell the command lines you tried, the medium type (如 CD-R, DVD+RW, ...), and the symptoms of failure (program messages, disappointed user expectation, ...). You will possibly get asked to obtain the newest release or development version of the affected program and to make test runs. But the answer might as well be, that your drive dislikes the particular medium.<br />
<br />
=== Burning CD/DVD/BD with a GUI ===<br />
<br />
There are several applications available to burn CDs in a graphical environment.<br />
<br />
See also [[Wikipedia:Comparison of disc authoring software]].<br />
<br />
* {{App|[[Wikipedia:AcetoneISO|AcetoneISO]]|All-in-one ISO tool (supports BIN, MDF, NRG, IMG, DAA, DMG, CDI, B5I, BWI, PDI and ISO).|https://sourceforge.net/projects/acetoneiso|{{AUR|acetoneiso2}}}}<br />
* {{App|BashBurn|Lightweight terminal based menu frontend for CD/DVD burning tools.|http://bashburn.dose.se/|{{Pkg|bashburn}}}}<br />
* {{App|[[Wikipedia:Brasero (software)|Brasero]]|Disc burning application for the GNOME desktop that is designed to be as simple as possible.|https://wiki.gnome.org/Apps/Brasero|{{Pkg|brasero}}}}<br />
* {{App|cdw|Ncurses frontend to ''cdrecord'', ''mkisofs'', ''growisofs'', ''dvd+rw-mediainfo'', ''dvd+rw-format'' and ''xorriso''.|http://cdw.sourceforge.net/|{{AUR|cdw}}}}<br />
* {{App|Graveman|GTK-based CD/DVD burning application. It requires configuration to point to correct devices.|https://graveman.tuxfamily.org/|{{AUR|graveman}}}}<br />
* {{App|isomaster|ISO image editor.|http://littlesvr.ca/isomaster|{{AUR|isomaster}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|[[Wikipedia:X-CD-Roast|X-CD-Roast]]|Lightweight ''cdrtools'' front-end for CD and DVD writing.|http://www.xcdroast.org/|{{AUR|xcdroast}}}}<br />
* {{App|[[Wikipedia:Xfce#Xfburn|Xfburn]]|Simple front-end to the libburnia libraries with support for CD/DVD(-RW), ISO images, and BurnFree.|https://docs.xfce.org/apps/xfburn/start|{{Pkg|xfburn}}}}<br />
* {{App|xorriso-tcltk|Graphical front-end to ISO and CD/DVD/BD burn tool xorriso|https://www.gnu.org/software/xorriso/|{{Pkg|libisoburn}}}}<br />
<br />
== Playback ==<br />
<br />
=== CD ===<br />
<br />
CD的音频播放需要{{Pkg|libcdio}} 软件包。为了使KDE应用程序如Dolphin能够读取CD中的音频,你需要安装{{Pkg|audiocd-kio}}。<br />
<br />
=== DVD ===<br />
<br />
如果你想播放加密的DVD,你必须安装诸如libdvd*软件包。<br />
* {{Pkg|libdvdread}}<br />
* {{Pkg|libdvdcss}}<br />
* {{Pkg|libdvdnav}}<br />
<br />
除此之外,你还需要安装媒体播放器。热门的DVD播放器包括[[MPlayer]], [[Wikipedia:Xine|xine]] 和 [[VLC]]。 参见 [[List of applications/Multimedia#Video players|视频播放]] 上的列表和对于 [[MPlayer#DVD playing|MPlayer]] 的特殊介绍。<br />
<br />
=== Blu-ray ===<br />
<br />
参见 [[Blu-ray#Playback]]。<br />
<br />
== Ripping ==<br />
<br />
[[Wikipedia:Ripping|Ripping]] is the process of copying audio or video content to a hard disk, typically from removable media or media streams.<br />
<br />
=== Audio CD ===<br />
<br />
==== Console ====<br />
<br />
* {{App|abcde|Comprehensive command-line tool for ripping audio CDs.|https://abcde.einval.com/|{{AUR|abcde}}}}<br />
* {{App|cdda2wav|CD-audio extraction program with paranoia support.|http://www.cdda2wav.de/|{{Pkg|cdrtools}}}}<br />
* {{App|[[Wikipedia:cdparanoia|cdparanoia]]|Compact Disc Digital Audio (CDDA) Digital Audio Extraction (DAE) tool.|https://xiph.org/paranoia/index.html|{{Pkg|cdparanoia}}}}<br />
* {{App|cyanrip|Extensive CD ripper with musicbraniz integration, error detection, log generation, many formats, HDCD decoding, covert art automatic download.|https://github.com/cyanreg/cyanrip/|{{AUR|cyanrip}}}}<br />
* {{App|ripright|Minimal CD ripper modeled on autorip.|https://www.mcternan.me.uk/ripright/|{{AUR|ripright}}}}<br />
* {{App|[[Wikipedia:ripit|ripit]]|Command-line ripper that supports MusicBrainz, freeddb and various codecs. |https://www.ripit.pl/|{{AUR|ripit}}}}<br />
* {{App|shnsplit|Splits .wav and .flac files according to a CUE sheet and encodes the resulting pieces. A useful companion to ABCDE.|http://shnutils.freeshell.org/shntool/|{{AUR|shntool}}}}<br />
* {{App|whipper|CD ripper aiming for accuracy over speed. Uses cdparanoia, MusicBrainz, AccurateRip.|https://github.com/whipper-team/whipper|{{Pkg|whipper}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|[[Wikipedia:Asunder (software)|Asunder]]|GTK-based CD ripping program.|http://littlesvr.ca/asunder/|{{Pkg|asunder}}}}<br />
* {{App|Audex|Audio grabber tool for CD-ROM drives based on KDE.|https://userbase.kde.org/Audex|{{Pkg|audex}}}}<br />
* {{App|[[Wikipedia:Fre:ac|fre:ac]]|Audio converter and CD ripper with support for various popular formats and encoders.|https://freac.org/|{{AUR|freac}}}}<br />
* {{App|Goobox|CD player and ripper for GNOME.|https://people.gnome.org/~paobac/goobox/{{Dead link|2022|09|22|status=404}}|{{Pkg|goobox}}}}<br />
* {{App|[[Wikipedia:Grip (software)|Grip]]|Fast and light CD ripper within the GNOME project that resembles [[Wikipedia:Audiograbber|Audiograbber]].|https://sourceforge.net/projects/grip/|{{AUR|grip}}}}.<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|KAudioCreator|KDE program for ripping and encoding Audio-CDs. Unmaintained and [https://bugs.archlinux.org/task/67618 does not start anymore].|https://invent.kde.org/unmaintained/kaudiocreator|{{AUR|kaudiocreator-git}}}}<br />
* {{App|ripperX|GTK program to rip CD audio tracks and encode them to the Ogg, MP3, or FLAC formats.|https://sourceforge.net/projects/ripperx/|{{AUR|ripperx}}}}<br />
* {{App|rubyripper|Audio disc ripper that tries to deliver a secure rip through multiple rippings of the same track and corrections of any differences.|https://github.com/bleskodev/rubyripper|{{AUR|rubyripper}}}}<br />
* {{App|[[Wikipedia:Sound Juicer|Sound Juicer]]|CD ripper for GNOME.|https://wiki.gnome.org/Apps/SoundJuicer|{{Pkg|sound-juicer}}}}<br />
* {{App|1=soundKonverter|2=Front-end to various audio converters.|3=https://www.linux-apps.com/content/show.php?content=29024|4={{Pkg|soundkonverter}}}}<br />
<br />
=== DVD-Video ===<br />
<br />
See also [[Wikipedia:Comparison of DVD ripper software]].<br />
<br />
Often, the process of ripping a DVD can be broken down into two subtasks:<br />
<br />
# '''Data extraction''' — Copying the audio and/or video data to a hard disk,<br />
# [[Wikipedia:Transcode|Transcoding]] — Converting the extracted data into a suitable format.<br />
<br />
Some utilities perform both tasks, whilst others focus on one aspect or the other.<br />
<br />
==== Console ====<br />
<br />
* {{App|[[dvdbackup]]|Tool for pure data extraction which does not transcode. It is useful for creating ''exact'' copies of encrypted DVDs in conjunction with '''libdvdcss''' or for decrypting video for other utilities unable to read encrypted DVDs.|http://dvdbackup.sourceforge.net/|{{Pkg|dvdbackup}}}}<br />
* {{App|[[FFmpeg]]|Complete and free Internet live audio and video broadcasting solution for Linux/Unix, capable to do a direct rip in any format (audio/video) from a DVD-Video ISO image, just select the input as the ISO image and proceed with the desired options. It also allows to downmixing, shrinking, spliting, selecting streams among other features.|https://ffmpeg.org/|{{Pkg|ffmpeg}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake CLI]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping.|https://handbrake.fr/|{{Pkg|handbrake-cli}}}}<br />
* {{App|[[MEncoder]]|Free command line video decoding, encoding and filtering tool. It supports ripping and transcoding DVD-Video.|http://www.mplayerhq.hu/|{{Pkg|mencoder}}}}<br />
* {{App|subtitleripper|Convert DVD subtitles into text format.|http://subtitleripper.sourceforge.net/|{{AUR|subtitleripper}}}}<br />
* {{App|Transcode|Video/DVD ripper and encoder for the terminal/console. It is [https://www.linuxfromscratch.org/blfs/view/8.3/multimedia/transcode.html outdated/no longer actively maintained].||{{Pkg|transcode}}}}<br />
* {{App|Vobcopy|Copies DVD ''.vob'' files to hard disk, decrypting them on the way.|https://github.com/barak/vobcopy|{{AUR|vobcopy}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|dvd::rip|Front-end to {{Pkg|transcode}}, used to extract DVD's to the hard disk and transcode or extract and transcode on-the-fly.|https://www.exit1.org/dvdrip/|{{AUR|dvdrip}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping. GTK version.|https://handbrake.fr/|{{Pkg|handbrake}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|OGMRip|An application and a set of libraries for ripping and encoding DVD into AVI, OGM, MP4, or Matroska files using a wide variety of codecs. It relies on mplayer, mencoder, ogmtools, mkvtoolnix, mp4box, oggenc, lame, and faac to perform its tasks.|http://ogmrip.sourceforge.net/|{{AUR|ogmrip}}}}<br />
<br />
=== DVD-Audio ===<br />
<br />
* {{App|Python Audio Tools|Includes dvda2track, which is easy to use command line tool to extract DVD-Audio tracks to uncompressed wav files.<br />
|http://audiotools.sourceforge.net/|{{AUR|audiotools}}}}<br />
<br />
=== Multi-format ===<br />
<br />
* {{App|Aaru|Software for archival ripping of CDs, DVDs, and harddrives|https://aaru.app|{{AUR|aaru}}}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Brasero fails to normalize audio CD ===<br />
<br />
If you try to burn it may stop at the first step called Normalization.<br />
<br />
As a workaround you can disable the normalization plugin using the ''Edit > Plugins'' menu<br />
<br />
=== VLC: Error "... could not open the disc /dev/dvd" ===<br />
<br />
If you get an error like<br />
<br />
vlc dvdread could not open the disc "/dev/dvd"<br />
<br />
it may be because there is no device node {{ic|/dev/dvd}} on your system. Udev no longer creates {{ic|/dev/dvd}} and instead uses {{ic|/dev/sr0}}. To fix this, edit the VLC configuration file ({{ic|~/.config/vlc/vlcrc}}):<br />
<br />
# DVD device (string)<br />
dvd=/dev/sr0<br />
<br />
=== DVD drive is noisy ===<br />
<br />
If playing DVD videos causes the system to be very loud, it may be because the disc is spinning faster than it needs to. To temporarily change the speed of the drive, run:<br />
<br />
# eject -x 12 /dev/dvd<br />
<br />
Sometimes:<br />
<br />
# hdparm -E12 /dev/dvd<br />
<br />
Any speed that is supported by the drive can be used, or 0 for the maximum speed.<br />
<br />
[https://michal.kosmulski.org/computing/tips/cd-rom-speed.html Setting CD-ROM and DVD-ROM drive speed]<br />
<br />
=== Playback does not work with new computer (new DVD-Drive) ===<br />
<br />
If playback does not work and you have a new computer (new DVD-Drive) the reason might be that the [[Wikipedia:DVD region code|region code]] is not set. You can read and set the region code with the {{AUR|regionset}} package.<br />
<br />
=== None of the above programs are able to rip/encode a DVD to my hard disk! ===<br />
<br />
Make sure the region of your DVD reader is set correctly; otherwise, you will get loads of inexplicable [[Wikipedia:Content Scramble System|CSS]]-related errors. Use the {{AUR|regionset}} package to do so.<br />
<br />
If ripping still does not work with the correct region set, refer to the [https://videolan.videolan.me/libdvdcss/ libdvdcss developer documentation] for enabling log messages and setting other relevant options.<br />
<br />
=== GUI program log indicates problems with backend program ===<br />
<br />
If you use a GUI program and experience problems which the program's log blames on some backend program, then try to reproduce the problem by the logged backend program arguments.<br />
Whether you succeed with reproducing or not, you may report the logged lines and your own findings to the places mentioned in [[#Burn backend problems]] section.<br />
<br />
==== Special case: medium error / write error ====<br />
<br />
Here are some typical messages about the drive disliking the medium. This can only be solved by using a different drive or a different medium. A different program will hardly help.<br />
<br />
Brasero with backend growisofs:<br />
<br />
BraseroGrowisofs stderr: :-[ WRITE@LBA=0h failed with SK=3h/ASC=0Ch/ACQ=00h]: Input/output error<br />
<br />
Brasero with backend libburn:<br />
<br />
BraseroLibburn Libburn reported an error SCSI error on write(16976,16): [3 0C 00] Write error<br />
<br />
=== BD-R DL 50GB errors on trying to burn second layer ===<br />
<br />
Using ''growisofs'' from {{Pkg|dvd+rw-tools}} for burning 50GB BD-R DL discs might result in a fatal error and damaged media, such as:<br />
<br />
{{hc|$ growisofs -Z /dev/sr0 -J -R -V "label" files|<nowiki><br />
Executing 'mkisofs -J -R -V label files | builtin_dd of=/dev/sr0 obs=32k seek=0'<br />
I: -input-charset not specified, using utf-8 (detected in locale settings)<br />
0.03% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.05% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.08% done, estimate finish Fri Jan 29 19:50:36 2016<br />
/dev/sr0: pre-formatting blank BD-R for 49.8GB...<br />
/dev/sr0: "Current Write Speed" is 8.2x4390KBps.<br />
0.11% done, estimate finish Sat Jan 30 03:29:13 2016<br />
0.13% done, estimate finish Sat Jan 30 02:10:01 2016<br />
...<br />
63.20% done, estimate finish Fri Jan 29 20:43:45 2016<br />
:-[ WRITE@LBA=b6d820h failed with SK=3h/WRITE ERROR]: Input/output error<br />
:-( write failed: Input/output error<br />
/dev/sr0: flushing cache<br />
/dev/sr0: closing track<br />
/dev/sr0: closing session<br />
:-[ CLOSE SESSION failed with SK=5h/INVALID FIELD IN CDB]: Input/output error<br />
/dev/sr0: reloading tray<br />
</nowiki>}}<br />
<br />
This happened at the 25GB boundary when starting to write the second layer. Using ''cdrecord'' from {{Pkg|cdrtools}} works with no problems. Tested with a 'HL-DT-ST BD-RE WH16NS40' LG burner, and Verbatim BD-R DL 6x discs (#96911). {{bug|47797}}<br />
<br />
=== Disc tray autocloses ===<br />
<br />
If after ejecting a cd, either by using the {{ic|eject}} command, or pushing the drive button, the drive disc tray autocloses before being able to remove the disc, try the following command:<br />
<br />
# sysctl -w dev.cdrom.autoclose=0<br />
<br />
If that solves the problem, make the change permanent:<br />
<br />
{{hc|/etc/sysctl.d/60-cdrom-autoclose.conf|2=<br />
dev.cdrom.autoclose = 0<br />
}}<br />
<br />
If the above does not work and as a last resort measure, you can unload the disc module from the kernel via:<br />
<br />
# rmmod sr_mod<br />
<br />
the disc drive should now behave as expected but will not mount disc anymore. After putting a disc into the drive, reactivate the module via:<br />
<br />
# modprobe sr_mod<br />
<br />
the disc should now mount.<br />
<br />
== See also ==<br />
<br />
* In the United States, backup of physically obtained media is allowed under these conditions: [https://www.riaa.com/resources-learning/about-piracy/ About Piracy - RIAA].<br />
* [https://dev.lovelyhq.com/libburnia/web/wiki Main page of the project Libburnia]</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Optical_disc_drive_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=757949Optical disc drive (简体中文)2022-11-25T06:48:25Z<p>InsaneGuo: /* DVD */ // Edit via Wikiplus</p>
<hr />
<div>[[Category:Multimedia (简体中文)]]<br />
[[Category:Optical disc (简体中文)]]<br />
[[en:Optical disc drive]]<br />
[[es:Optical disc drive]]<br />
[[ja:光学ディスクドライブ]]<br />
{{Related articles start}}<br />
{{Related|Codecs}}<br />
{{Related|MPlayer}}<br />
{{Related|dvdbackup}}<br />
{{Related|MEncoder}}<br />
{{Related|Blu-ray}}<br />
{{Related|Convert any Movie to DVD Video}}<br />
{{Related articles end}}<br />
<br />
来自维基百科:<br />
<br />
在计算机领域,Optical disc drive(ODD)是一种光盘驱动器,它使用激光或可见光频谱内或附近的电磁波作为向光盘读写数据过程的一部分。<br />
<br />
== 刻录 ==<br />
<br />
{{Expansion|是否有被 Arch Linux 打包过的命令行工具可以将文件分卷写入碟片中? (像是 GAFFitter 或 cdrkit 的 dirsplit) }}<br />
<br />
{{Warning|有很大数量的光学驱动器和碟片是有很大不同的。通常,在需要可靠性的时候,推荐使用慢速刻录。如果你遇到了未预期的行为时,尝试使用刻录器所支持的最慢速度刻录。}}<br />
<br />
光盘驱动器的刻录过程包括创建或获得一个图像并将其写入光学介质。该镜像原则上可以是任何数据文件。如果你想挂载生成的介质,那么它通常是一个ISO 9660文件系统的镜像文件。音频和多媒体光盘通常是从.bin文件刻录的,在.toc文件或.cue文件的控制下,告诉所需的轨道布局。<br />
<br />
=== 安装刻录工具 ===<br />
<br />
{{Style|Says twice that X is the traditional choice without stating why.}}<br />
<br />
如果你想要使用 GUI 程序,见 [[#Burning CD/DVD/BD with a GUI]]。<br />
<br />
这里列出的程序是面向命令行的。它们是大多数用于CD、DVD和BD的免费GUI程序所使用的后端。当涉及到故障排除或编写刻录活动的脚本时,GUI用户可能会用到它们。<br />
<br />
你至少需要一个创建文件系统镜像的程序和一个能够将数据刻录到你所需要的媒体类型的程序。<br />
<br />
可用于创建ISO9660类型镜像的应用有:<br />
<br />
* {{man|8|mkisofs}} 自 {{Pkg|cdrtools}}<br />
* {{man|1|xorriso}} 和 {{man|1|xorrisofs}} 自 {{Pkg|libisoburn}}<br />
<br />
常见的选择是 ''mkisofs''.<br />
<br />
可用于刻录媒体文件的应用有:<br />
<br />
* {{man|1|cdrdao}} 自 {{Pkg|cdrdao}} (仅 CD, 格式仅 TOC/CUE/BIN)<br />
* {{man|1|cdrecord}} 自 {{Pkg|cdrtools}}<br />
* {{man|1|cdrskin}} 自 {{Pkg|libburn}}<br />
* {{man|1|growisofs}} 自 {{Pkg|dvd+rw-tools}} (仅 DVD 和 BD)<br />
* {{man|1|xorriso}} 和 {{man|1|xorrecord}} 自 {{Pkg|libisoburn}}<br />
<br />
常见的对于 CD 的选择有 ''cdrecord'' 而 对于 DVD 和 BD 的选择有''growisofs'' 。为将 TOC/CUE/BIN 烧录到 CD,安装 {{Pkg|cdrdao}}.<br />
<br />
自由的 GUI 烧录程序至少依赖于一个上述包。<br />
<br />
在这份文档中,''xorrisofs'' 支持 ''mkisofs'' 选项。<br />
<br />
''cdrskin'' 支持 ''cdrecord'' 选项 ; ''xorrecord'' 在不处理音频 CD 时也支持它。<br />
<br />
=== 从已存在的文件构建一个 ISO 镜像 ===<br />
<br />
先将需要的文件拷贝到一个文件夹,是创建一个 ISO 镜像的最简单办法。例如:{{ic|./for.iso}}。<br />
<br />
然后用 ''mkisofs'' 生成这个镜像:<br />
<br />
$ mkisofs -V "''ARCHIVE_2013_07_27''" -J -r -o ''isoimage.iso'' ''./for_iso''<br />
<br />
这些选项在下列的节中被解释。<br />
<br />
==== 基本选项 ====<br />
<br />
;{{ic|-V}}: (分配给)文件系统的名称。ISO 9660 标准限定了 32 字节的长度,同样,这些字符被限制为:"A"-"Z","0"-"9"以及"_"。卷标签可能展示为挂载点,如果这个介质是被自动挂载的。<br />
;{{ic|-J}}: 启用 [[Wikipedia:Joliet (file system)|Joliet]] 扩展, 允许特定空间用 Unicode 存储文件名称。(最高每个文件 64 UTF-16 字符)。<br />
;{{ic|-joliet-long}}: 增加 Joliet 表命名的最大长度,从 64 到 103 字符。 不符合Joliet规范,通常不受支持。<br />
;{{ic|-r}}: Enables [[Wikipedia:Rock Ridge|Rock Ridge]] 扩展,POSIX 文件系统到一个镜像,包括 255 字符长度的文件名和 Unix 风格文件拓展名。<br />
;{{ic|-o}}: 为输出的 ISO 镜像设置文件路径。<br />
<br />
==== 移植点 ====<br />
<br />
可以让 "mkisofs" 查找文件和目录从制定路径<br />
<br />
$ mkisofs -V "''BACKUP_2013_07_27''" -J -r -o ''backup_2013_07_27.iso'' \<br />
-graft-points \<br />
/photos=/home/''user''/photos \<br />
/mail=/home/''user''/mail \<br />
/photos/holidays=/home/''user''/holidays/photos<br />
<br />
{{ic|-graft-points}} 允许识别由ISO文件系统中的目标地址组成的“路径规范” (如 {{ic|/photos}}) 和源地址 (如 {{ic|/home/user/photos}}). 使用 "=" 字符分隔。<br />
<br />
这个例子将 文件夹 {{ic|/home/user/photos}}{{ic|/home/user/mail}} and {{ic|/home/user/holidays/photos}} 分别设为 ISO 镜像中的 {{ic|/photos}}, {{ic|/mail}} and {{ic|/photos/holidays}}。<br />
<br />
''mkisofs'' 和 ''xorrisofs'' 使用相同的参数。使用安全备份,为 ''xorrisofs'' 加上 {{ic|--for_backup}},这将记录事件 ACL 并为每个文件存储 MD5 校验值。<br />
<br />
见 {{man|8|mkisofs}} 和 {{man|1|xorrisofs}} 手册以获得更多关于命令的参数的信息。<br />
<br />
=== 挂载一个 ISO 镜像 ===<br />
<br />
你可以挂载一个 ISO 镜像,如果你想要浏览它的文件。<br />
我们可以使用下面的指令挂载一个 ISO 镜像:<br />
<br />
# mount -t iso9660 -o ro,loop ''/path/to/file.iso'' ''/mount-point''<br />
<br />
浏览完毕后,一定记得卸载:<br />
<br />
# umount /mount-point<br />
<br />
无 Root 用户挂载镜像,见 [[Mounting images as user]]。<br />
<br />
=== 转换 img/ccd 到 iso ===<br />
<br />
转换 {{ic|img}}/{{ic|ccd}} 镜像, 你可使用 {{Pkg|ccd2iso}}:<br />
<br />
$ ccd2iso ''~/image.img'' ''~/image.iso''<br />
<br />
=== 知晓你的设备的名称 ===<br />
<br />
为剩余部分,假定你设的记录设备的节为 {{ic|/dev/sr0}}<br />
<br />
用下面的指令检查<br />
<br />
$ cdrecord dev=''/dev/sr0'' -checkdrive<br />
<br />
这将报告这个设备的 {{ic|Vendor_info}} 和 {{ic|Indentification}}。<br />
<br />
如果没有找到设备,检查一切 {{ic|/dev/sr*}} 是否存在,当他们提供了读写权限 ({{ic|wr-}}) 到你的组。<br />
<br />
如果没有 {{ic|/dev/sr*}} 存在,尝试手动[[Kernel modules|加载]]模块 {{ic|sr_mod}}。<br />
<br />
=== 读取 CD/DVD 的卷名 ===<br />
<br />
如果你想获得名称或标签,使用''dd'':<br />
<br />
$ dd if=''/dev/sr0'' bs=1 skip=32808 count=32<br />
<br />
=== 从 CD, DVD 或 BD 中创建 ISO 镜像 ===<br />
<br />
为从介质中拷贝数据,并不让空块填充它,先确定它的块/扇区数量与大小(多数为每个 2048)。<br />
<br />
{{hc|$ isosize -x /dev/sr0|<br />
sector count: 2041796, sector size: 2048<br />
}}<br />
<br />
或<br />
<br />
{{hc|$ isoinfo -d -i /dev/sr0 {{!}} awk '/block size{{!}}Volume size/'|<br />
Logical block size is: 2048<br />
Volume size is: 2041796<br />
}}<br />
<br />
{{Note|别忘记把{{ic|/dev/sr0}}换成你的光驱。}}<br />
<br />
然后用[[dd]]用获得的数据拷出来:<br />
<br />
$ dd if=/dev/sr0 of=discmage.iso bs=''sector_size'' count=''sector_count'' status=progress<br />
<br />
{{Tip|如果介质坏了,建议用类似于 {{Pkg|ddrescue}} 这样的专门工具,见 [[Disk cloning#Using ddrescue]] 。}}<br />
<br />
如果原介质是可启动的,它的拷贝也将是一个可启动镜像。你可能将它用于虚拟机的虚拟光驱或将它烧录到光学介质,这也将是可启动的。 [https://askubuntu.com/questions/147800/ripping-dvd-to-iso-accurately#874945]<br />
<br />
=== 擦除CD-RW和DVD-RW ===<br />
<br />
使用过的CD-RW介质需要在写上以前记录的数据之前被擦除。这可以通过以下方式完成<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
<br />
清空有两个选项:blank=fast 和 blank=all。完全清空的持续时间与完全写操作一样长。它覆盖了光盘上的有效载荷数据。然而这不应该被认为是安全地使这些数据不可读。为了这个目的,建议用随机数据进行几次全写运行。<br />
<br />
替代命令有:<br />
<br />
$ cdrskin -v dev=''/dev/sr0'' blank=fast<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
擦除 DVD-RW 使用 ''dvd+rw-format'' 工具来自 {{Pkg|dvd+rw-tools}}:<br />
<br />
$ dvd+rw-format -blank=fast ''/dev/sr0''<br />
<br />
替代命令有:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
$ cdrskin -v dev=''/dev/sr0'' blank=deformat_sequential_quickest<br />
$ xorriso -outdev ''/dev/sr0'' -blank deformat_quickest<br />
<br />
这种快速消隐的DVD-RW不适合多时段使用,也不能接受未预知长度的输入流。为此,人们必须使用以下方法之一:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=all<br />
$ dvd+rw-format -blank=full ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=as_needed<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
其他媒体类型要么是一次性写入(CD-R、DVD-R、DVD+R、BD-R),要么是无需擦除的可重写(DVD-RAM、DVD+RW、BD-RE)。<br />
<br />
=== 格式化 DVD-RW ===<br />
<br />
格式化过的 DVD-RW 介质可以在不提前擦除的情况下重写。所以考虑在其生命周期内格式化一次。<br />
<br />
$ dvd+rw-format -force ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=format_if_needed<br />
$ xorriso -outdev ''/dev/sr0'' -format as_needed<br />
<br />
不像 DVD-RAM, DVD+RW 和 BD-RE,格式化的 DVD-RW 无法被用于(低速)硬盘直写,而是需要驱动 ptcdvd。见 {{man|8|pktsetup}}。<br />
<br />
=== 格式化 BD-RE 和 BD-R ===<br />
<br />
BD-RE 需要在使用前格式化。当检测到未格式化状态时,烧录程序会自动完成它。然而,数据存储区域的大小可能会受到上述DVD-RW格式命令的影响。<br />
<br />
BD-R 可以是格式化的或非格式化的。非格式化的写入将会全程普通速度写入,并提供最大的存储空间。格式化的可以在写入操作时检查,坏块会从空闲块中被替换。这可能会把速度降到一半于普通速度。普通的格式化会使存储空间下降 768MiB。<br />
<br />
growisofs 默认会格式化 BD-R,其他的不会。growisofs 可不进行格式化。cdrskin 和 xorriso 可以完全速度写入格式化的 BD-RE 或 BD-R:<br />
<br />
$ growisofs -use-the-force-luke=spare:none ...growisofs.or.mkisofs.options...<br />
$ cdrskin stream_recording=on ...cdrecord.options...<br />
$ xorriso -stream_recording on ...xorriso.commands...<br />
<br />
=== 烧录一个 ISO 镜像到 CD、DVD 或 BD。 ===<br />
<br />
为烧录一个 ISO 镜像文件 {{ic|isoimage.iso}} 到光学介质,<br />
为CD: <br />
<br />
$ cdrecord -v -sao dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
为 DVD 或 BD:<br />
<br />
$ growisofs -dvd-compat -Z ''/dev/sr0''=''isoimage.iso''<br />
<br />
为 CD、BD 或 DVD:<br />
<br />
$ xorriso -as cdrecord -v dev=''/dev/sr0'' -dao ''isoimage.iso''<br />
<br />
{{Note|1=<br /><br />
* 当你准备写入时,确保介质未挂载。当介质包含一个可读的文件系统时,管挂载可能是自动的。在最好的情况下,它会防止烧录程序使用烧录设备。在最坏的情况下,可能会因为读取操作弄坏设备。所以,在不能确定的情况下,{{bc|# umount /dev/sr0}}<br />
* ''growisofs'' 有个关于 BD-R 空白介质的[https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=713016 小 bug]。它会报出一个错误信息在烧录完成后。像 ''k3b'' 这样的程序会认为整个烧录过程失败了。为防止这个问题:<br />
** 这样 {{ic|dvd+rw-format ''/dev/sr0''}} 格式化在使用 ''growisofs'' 之前。<br />
** 或用 ''growisofs'' 选项 {{ic|1= -use-the-force-luke=spare:none}}<br />
}}<br />
<br />
=== 验证烧录的ISO镜像 ===<br />
你可以验证烧录的介质的完整性,以确保它不包含错误。在验证之前一定要弹出介质并重新插入。这将保证任何内核缓存不会被用来读取数据。<br />
<br />
首先计算原始ISO镜像的MD5校验值:<br />
<br />
{{hc|$ md5sum isoimage.iso|<br />
e5643e18e05f5646046bb2e4236986d8 isoimage.iso<br />
}}<br />
<br />
之后在介质上为每个 ISO 文件系统计算 MD5。不过一些类型的介质完全提交给烧录程序相同数量的数据,很多其他的尾随的垃圾也会被读取。所以你需要限制为 ISO 镜像文件读取的大小。<br />
<br />
$ blocks=$(expr $(du -b isoimage.iso | awk '{print $1}') / 2048)<br />
<br />
{{hc|1=$ dd if=/dev/sr0 bs=2048 count=$blocks {{!}} md5sum|2=<br />
43992+0 records in<br />
43992+0 records out<br />
90095616 bytes (90 MB, 86 MiB) copied, 0.359539 s, 251 MB/s<br />
e5643e18e05f5646046bb2e4236986d8 -<br />
}}<br />
<br />
每次执行都需要给出相同的 MD5 校验值(这:{{ic|e5643e18e05f5646046bb2e4236986d8}})。如果没有,你可能会一同获得一个 I/O 错误自 {{ic|dd}} 的运行中。当你感兴趣的时候,[[dmesg]] 可能告诉你 SCSI 错误和块编号。<br />
<br />
=== ISO 9660 和运行时烧录 ===<br />
<br />
没有必要存储一个应急的 ISO 文件系统在硬盘,在它写到光学介质前。在写到一个空设备缓冲区的时候,只有极老的 CD 驱动器在极老的电脑上运行会遭受错误。<br />
<br />
如果你省略了 ''mkisofs'' 的 {{ic|-o}} 选项,它将写一个 ISO 镜像到标准输出。这可被用管道导到烧录程序。<br />
<br />
$ mkisofs -V "ARCHIVE_2013_07_27" -J -r ./for_iso | \<br />
cdrecord -v dev=/dev/sr0 -waiti -<br />
<br />
选项 {{ic|-waiti}} 此处并非必须. 它避免 ''cdrecord'' 在 ''mkisofs'' 在其输出前写入到介质。这将允许 ''mkisofs'' 排除干扰的去读取已开始烧录的介质。见关于多会话的下一节。<br />
<br />
在 DVD 和 BD 中, 你可能让 ''growisofs'' 为你操作 ''mkisofs'' 并在运行烧录它的输出:<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
=== 多会话 ===<br />
<br />
ISO-9960 多会话意味着一个介质使用只读文件系统的同时,依然可以在第一个未被使用的块地址写,并且在这个块上会有新的 ISO 树。这个新树协同于新加的或覆写的文件的数据块。数据的块在旧的 ISO 树中的,无法再被写。<br />
<br />
Linux 和其他操作系统将挂载在介质上的最新的会话上的文件夹树。最新的树也将正常的显示旧会话的文件。<br />
<br />
==== Multi-session by cdrecord ====<br />
<br />
CD-R and CD-RW stay writable (aka "appendable") if cdrecord option {{ic|-multi}} was used<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
Then the medium can be inquired for the parameters of the next session<br />
<br />
$ m=$(cdrecord dev=''/dev/sr0'' -msinfo)<br />
<br />
By help of these parameters and of the readable medium in the drive you can produce the add-on ISO session<br />
<br />
$ mkisofs -M ''/dev/sr0'' -C "$m" \<br />
-V "''ARCHIVE_2013_07_28''" -J -r -o ''session2.iso'' ''./more_for_iso''<br />
<br />
Finally append the session to the medium and keep it appendable again<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''session2.iso''<br />
<br />
Programs ''cdrskin'' and ''xorrecord'' do this too with DVD-R, DVD+R, BD-R and unformatted DVD-RW. Program ''cdrecord'' does multi-session with at least DVD-R and DVD-RW. They all do with CD-R and CD-RW, of course.<br />
<br />
Most re-usable media types do not record a session history that would be recognizable for a mounting kernel. But with ISO 9660 it is possible to achieve the multi-session effect even on those media.<br />
<br />
''growisofs'' and ''xorriso'' can do this and hide most of the complexity.<br />
<br />
==== Multi-session by growisofs ====<br />
<br />
By default, ''growisofs'' uses ''mkisofs'' as a backend for creating ISO images forwards most of its program arguments to . See above examples of ''mkisofs''. It bans option {{ic|-o}} and deprecates option {{ic|-C}}. By default it uses the ''mkisofs''. You may specify to use one of the others compatible backend program by setting environment variable {{ic|MKISOFS}}:<br />
<br />
$ export MKISOFS="xorrisofs"<br />
<br />
The wish to begin with a new ISO file system on the optical medium is expressed by option {{ic|-Z}}<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
The wish to append more files as new session to an existing ISO file system is expressed by option {{ic|-M}}<br />
<br />
$ growisofs -M ''/dev/sr0'' -V "''ARCHIVE_2013_07_28''" -r -J ''./more_for_iso''<br />
<br />
For details see the {{man|1|growisofs}} manual and the manuals of ''mkisofs'' and ''xorrisofs''.<br />
<br />
==== Multi-session by xorriso ====<br />
<br />
''xorriso'' learns the wish to begin with a new ISO file system from the blank state of the medium. So it is appropriate to blank it if it contains data. The command {{ic|-blank as_needed}} applies to all kinds of re-usable media and even to ISO images in data files on hard disk. It does not cause error if applied to a blank write-once medium.<br />
<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed \<br />
-volid "''ARCHIVE_2013_07_27''" -joliet on -add ''./for_iso'' --<br />
<br />
On non-blank writable media ''xorriso'' appends the newly given disc files if command {{ic|-dev}} is used rather than {{ic|-outdev}}. Of course, no command {{ic|-blank}} should be given here<br />
<br />
$ xorriso -dev ''/dev/sr0'' \<br />
-volid "''ARCHIVE_2013_07_28''" -joliet on -add ''./more_for_iso'' --<br />
<br />
For details see the {{man|1|xorriso}} man page and especially its examples.<br />
<br />
=== BD Defect Management ===<br />
<br />
BD-RE and formatted BD-R media are normally written with enabled Defect Management. This feature reads the written blocks while they are still stored in the drive buffer. In case of poor read quality the blocks get written again or redirected to the ''Spare Area'' where the data get stored in replacement blocks.<br />
<br />
This checkreading reduces write speed to at most half of the nominal speed of drive and BD medium. Sometimes it is even worse. Heavy use of the Spare Area causes long delays during read operations. So Defect Management is not always desirable.<br />
<br />
''cdrecord'' does not format BD-R. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''growisofs'' formats BD-R by default. The Defect Management can be prevented by option {{ic|1= -use-the-force-luke=spare:none}}. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''cdrskin'', ''xorriso'' and ''xorrecord'' do not format BD-R by default. They do with {{ic|1= cdrskin blank=format_if_needed}}, resp. {{ic|1= xorriso -format as_needed}}, resp. {{ic|1= xorrecord blank=format_overwrite}}. These three programs can disable Defect Management with BD-RE and already formatted BD-R by {{ic|1= cdrskin stream_recording=on}}, resp. {{ic|1= xorriso -stream_recording on}}, resp. {{ic|1= xorrecord stream_recording=on}}.<br />
<br />
=== Burning an audio CD ===<br />
<br />
Create your audio tracks and store them as uncompressed, 16-bit, 44100-Hz, stereo WAV files. To convert MP3 to WAV, ensure {{Pkg|lame}} is installed, ''cd'' to the directory with your MP3 files, and run:<br />
<br />
$ for i in *.mp3; do lame --decode "$i" "$(basename "$i" .mp3)".wav; done<br />
<br />
In case you get an error when trying to burn WAV files converted with LAME, try decoding with {{Pkg|mpg123}}:<br />
<br />
$ for i in *.mp3; do mpg123 --rate 44100 --stereo --buffer 3072 --resync -w $(basename "$i" .mp3).wav $i; done<br />
<br />
To convert AAC to WAV ensure {{Pkg|faad2}} is installed and run:<br />
$ for i in *.m4a; do faad $i; done<br />
<br />
To fix the bitrate of an already existing WAV file (or many other formats), try using {{Pkg|sox}}:<br />
$ for i in *.wav; do sox "$i" -c 2 -r 44100 "$(basename "$i" .wav)"-ok.wav; done<br />
<br />
Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as {{ic|01.wav}}, {{ic|02.wav}}, {{ic|03.wav}}, etc. Use the following command to simulate burning the WAV files as an audio CD:<br />
<br />
$ cdrecord '''-dummy''' -v -pad speed=1 dev=''/dev/sr0'' -dao -swab *.wav<br />
<br />
If everything worked, you can remove the {{ic|-dummy}} flag to actually burn the CD.<br />
<br />
{{Note|The produced disc may not play in all CD players. For an audio-only disc (discarding some track metadata), add the {{ic|-audio}} flag.}}<br />
<br />
To test the new audio CD, use [[MPlayer]]:<br />
<br />
$ mplayer cdda://<br />
<br />
=== Burning a BIN/CUE ===<br />
<br />
To burn a BIN/CUE image run:<br />
<br />
$ cdrdao write --device ''/dev/sr0'' ''image.cue''<br />
<br />
==== TOC/CUE/BIN for mixed-mode discs ====<br />
<br />
ISO images only store a single data track. If you want to create an image of a mixed-mode disc (data track with multiple audio tracks) then you need to make a TOC/BIN pair:<br />
<br />
$ cdrdao read-cd --read-raw --datafile ''image.bin'' --driver generic-mmc:0x20000 --device ''/dev/cdrom'' ''image.toc''<br />
<br />
Some software only likes CUE/BIN pair, you can make a CUE sheet with ''toc2cue'' (part of {{Pkg|cdrdao}}):<br />
<br />
$ toc2cue ''image.toc'' ''image.cue''<br />
<br />
=== Burn backend problems ===<br />
<br />
If you are experiencing problems, you may ask for advise at mailing list [mailto:cdwrite@other.debian.org cdwrite@other.debian.org], or try to write to the one of support mail addresses if some are listed near the end of the program's man page.<br />
<br />
Tell the command lines you tried, the medium type (如 CD-R, DVD+RW, ...), and the symptoms of failure (program messages, disappointed user expectation, ...). You will possibly get asked to obtain the newest release or development version of the affected program and to make test runs. But the answer might as well be, that your drive dislikes the particular medium.<br />
<br />
=== Burning CD/DVD/BD with a GUI ===<br />
<br />
There are several applications available to burn CDs in a graphical environment.<br />
<br />
See also [[Wikipedia:Comparison of disc authoring software]].<br />
<br />
* {{App|[[Wikipedia:AcetoneISO|AcetoneISO]]|All-in-one ISO tool (supports BIN, MDF, NRG, IMG, DAA, DMG, CDI, B5I, BWI, PDI and ISO).|https://sourceforge.net/projects/acetoneiso|{{AUR|acetoneiso2}}}}<br />
* {{App|BashBurn|Lightweight terminal based menu frontend for CD/DVD burning tools.|http://bashburn.dose.se/|{{Pkg|bashburn}}}}<br />
* {{App|[[Wikipedia:Brasero (software)|Brasero]]|Disc burning application for the GNOME desktop that is designed to be as simple as possible.|https://wiki.gnome.org/Apps/Brasero|{{Pkg|brasero}}}}<br />
* {{App|cdw|Ncurses frontend to ''cdrecord'', ''mkisofs'', ''growisofs'', ''dvd+rw-mediainfo'', ''dvd+rw-format'' and ''xorriso''.|http://cdw.sourceforge.net/|{{AUR|cdw}}}}<br />
* {{App|Graveman|GTK-based CD/DVD burning application. It requires configuration to point to correct devices.|https://graveman.tuxfamily.org/|{{AUR|graveman}}}}<br />
* {{App|isomaster|ISO image editor.|http://littlesvr.ca/isomaster|{{AUR|isomaster}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|[[Wikipedia:X-CD-Roast|X-CD-Roast]]|Lightweight ''cdrtools'' front-end for CD and DVD writing.|http://www.xcdroast.org/|{{AUR|xcdroast}}}}<br />
* {{App|[[Wikipedia:Xfce#Xfburn|Xfburn]]|Simple front-end to the libburnia libraries with support for CD/DVD(-RW), ISO images, and BurnFree.|https://docs.xfce.org/apps/xfburn/start|{{Pkg|xfburn}}}}<br />
* {{App|xorriso-tcltk|Graphical front-end to ISO and CD/DVD/BD burn tool xorriso|https://www.gnu.org/software/xorriso/|{{Pkg|libisoburn}}}}<br />
<br />
== Playback ==<br />
<br />
=== CD ===<br />
<br />
CD的音频播放需要{{Pkg|libcdio}} 软件包。为了使KDE应用程序如Dolphin能够读取CD中的音频,你需要安装{{Pkg|audiocd-kio}}。<br />
<br />
=== DVD ===<br />
<br />
如果你想播放加密的DVD,你必须安装诸如libdvd*软件包。<br />
* {{Pkg|libdvdread}}<br />
* {{Pkg|libdvdcss}}<br />
* {{Pkg|libdvdnav}}<br />
<br />
除此之外,你还需要安装媒体播放器。热门的DVD播放器包括[[MPlayer]], [[Wikipedia:Xine|xine]] 和 [[VLC]]。 参见 [[List of applications/Multimedia#Video players|视频播放]] 上的列表和对于 [[MPlayer#DVD playing|MPlayer]] 的特殊介绍。<br />
<br />
=== Blu-ray ===<br />
<br />
See [[Blu-ray#Playback]].<br />
<br />
== Ripping ==<br />
<br />
[[Wikipedia:Ripping|Ripping]] is the process of copying audio or video content to a hard disk, typically from removable media or media streams.<br />
<br />
=== Audio CD ===<br />
<br />
==== Console ====<br />
<br />
* {{App|abcde|Comprehensive command-line tool for ripping audio CDs.|https://abcde.einval.com/|{{AUR|abcde}}}}<br />
* {{App|cdda2wav|CD-audio extraction program with paranoia support.|http://www.cdda2wav.de/|{{Pkg|cdrtools}}}}<br />
* {{App|[[Wikipedia:cdparanoia|cdparanoia]]|Compact Disc Digital Audio (CDDA) Digital Audio Extraction (DAE) tool.|https://xiph.org/paranoia/index.html|{{Pkg|cdparanoia}}}}<br />
* {{App|cyanrip|Extensive CD ripper with musicbraniz integration, error detection, log generation, many formats, HDCD decoding, covert art automatic download.|https://github.com/cyanreg/cyanrip/|{{AUR|cyanrip}}}}<br />
* {{App|ripright|Minimal CD ripper modeled on autorip.|https://www.mcternan.me.uk/ripright/|{{AUR|ripright}}}}<br />
* {{App|[[Wikipedia:ripit|ripit]]|Command-line ripper that supports MusicBrainz, freeddb and various codecs. |https://www.ripit.pl/|{{AUR|ripit}}}}<br />
* {{App|shnsplit|Splits .wav and .flac files according to a CUE sheet and encodes the resulting pieces. A useful companion to ABCDE.|http://shnutils.freeshell.org/shntool/|{{AUR|shntool}}}}<br />
* {{App|whipper|CD ripper aiming for accuracy over speed. Uses cdparanoia, MusicBrainz, AccurateRip.|https://github.com/whipper-team/whipper|{{Pkg|whipper}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|[[Wikipedia:Asunder (software)|Asunder]]|GTK-based CD ripping program.|http://littlesvr.ca/asunder/|{{Pkg|asunder}}}}<br />
* {{App|Audex|Audio grabber tool for CD-ROM drives based on KDE.|https://userbase.kde.org/Audex|{{Pkg|audex}}}}<br />
* {{App|[[Wikipedia:Fre:ac|fre:ac]]|Audio converter and CD ripper with support for various popular formats and encoders.|https://freac.org/|{{AUR|freac}}}}<br />
* {{App|Goobox|CD player and ripper for GNOME.|https://people.gnome.org/~paobac/goobox/{{Dead link|2022|09|22|status=404}}|{{Pkg|goobox}}}}<br />
* {{App|[[Wikipedia:Grip (software)|Grip]]|Fast and light CD ripper within the GNOME project that resembles [[Wikipedia:Audiograbber|Audiograbber]].|https://sourceforge.net/projects/grip/|{{AUR|grip}}}}.<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|KAudioCreator|KDE program for ripping and encoding Audio-CDs. Unmaintained and [https://bugs.archlinux.org/task/67618 does not start anymore].|https://invent.kde.org/unmaintained/kaudiocreator|{{AUR|kaudiocreator-git}}}}<br />
* {{App|ripperX|GTK program to rip CD audio tracks and encode them to the Ogg, MP3, or FLAC formats.|https://sourceforge.net/projects/ripperx/|{{AUR|ripperx}}}}<br />
* {{App|rubyripper|Audio disc ripper that tries to deliver a secure rip through multiple rippings of the same track and corrections of any differences.|https://github.com/bleskodev/rubyripper|{{AUR|rubyripper}}}}<br />
* {{App|[[Wikipedia:Sound Juicer|Sound Juicer]]|CD ripper for GNOME.|https://wiki.gnome.org/Apps/SoundJuicer|{{Pkg|sound-juicer}}}}<br />
* {{App|1=soundKonverter|2=Front-end to various audio converters.|3=https://www.linux-apps.com/content/show.php?content=29024|4={{Pkg|soundkonverter}}}}<br />
<br />
=== DVD-Video ===<br />
<br />
See also [[Wikipedia:Comparison of DVD ripper software]].<br />
<br />
Often, the process of ripping a DVD can be broken down into two subtasks:<br />
<br />
# '''Data extraction''' — Copying the audio and/or video data to a hard disk,<br />
# [[Wikipedia:Transcode|Transcoding]] — Converting the extracted data into a suitable format.<br />
<br />
Some utilities perform both tasks, whilst others focus on one aspect or the other.<br />
<br />
==== Console ====<br />
<br />
* {{App|[[dvdbackup]]|Tool for pure data extraction which does not transcode. It is useful for creating ''exact'' copies of encrypted DVDs in conjunction with '''libdvdcss''' or for decrypting video for other utilities unable to read encrypted DVDs.|http://dvdbackup.sourceforge.net/|{{Pkg|dvdbackup}}}}<br />
* {{App|[[FFmpeg]]|Complete and free Internet live audio and video broadcasting solution for Linux/Unix, capable to do a direct rip in any format (audio/video) from a DVD-Video ISO image, just select the input as the ISO image and proceed with the desired options. It also allows to downmixing, shrinking, spliting, selecting streams among other features.|https://ffmpeg.org/|{{Pkg|ffmpeg}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake CLI]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping.|https://handbrake.fr/|{{Pkg|handbrake-cli}}}}<br />
* {{App|[[MEncoder]]|Free command line video decoding, encoding and filtering tool. It supports ripping and transcoding DVD-Video.|http://www.mplayerhq.hu/|{{Pkg|mencoder}}}}<br />
* {{App|subtitleripper|Convert DVD subtitles into text format.|http://subtitleripper.sourceforge.net/|{{AUR|subtitleripper}}}}<br />
* {{App|Transcode|Video/DVD ripper and encoder for the terminal/console. It is [https://www.linuxfromscratch.org/blfs/view/8.3/multimedia/transcode.html outdated/no longer actively maintained].||{{Pkg|transcode}}}}<br />
* {{App|Vobcopy|Copies DVD ''.vob'' files to hard disk, decrypting them on the way.|https://github.com/barak/vobcopy|{{AUR|vobcopy}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|dvd::rip|Front-end to {{Pkg|transcode}}, used to extract DVD's to the hard disk and transcode or extract and transcode on-the-fly.|https://www.exit1.org/dvdrip/|{{AUR|dvdrip}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping. GTK version.|https://handbrake.fr/|{{Pkg|handbrake}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|OGMRip|An application and a set of libraries for ripping and encoding DVD into AVI, OGM, MP4, or Matroska files using a wide variety of codecs. It relies on mplayer, mencoder, ogmtools, mkvtoolnix, mp4box, oggenc, lame, and faac to perform its tasks.|http://ogmrip.sourceforge.net/|{{AUR|ogmrip}}}}<br />
<br />
=== DVD-Audio ===<br />
<br />
* {{App|Python Audio Tools|Includes dvda2track, which is easy to use command line tool to extract DVD-Audio tracks to uncompressed wav files.<br />
|http://audiotools.sourceforge.net/|{{AUR|audiotools}}}}<br />
<br />
=== Multi-format ===<br />
<br />
* {{App|Aaru|Software for archival ripping of CDs, DVDs, and harddrives|https://aaru.app|{{AUR|aaru}}}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Brasero fails to normalize audio CD ===<br />
<br />
If you try to burn it may stop at the first step called Normalization.<br />
<br />
As a workaround you can disable the normalization plugin using the ''Edit > Plugins'' menu<br />
<br />
=== VLC: Error "... could not open the disc /dev/dvd" ===<br />
<br />
If you get an error like<br />
<br />
vlc dvdread could not open the disc "/dev/dvd"<br />
<br />
it may be because there is no device node {{ic|/dev/dvd}} on your system. Udev no longer creates {{ic|/dev/dvd}} and instead uses {{ic|/dev/sr0}}. To fix this, edit the VLC configuration file ({{ic|~/.config/vlc/vlcrc}}):<br />
<br />
# DVD device (string)<br />
dvd=/dev/sr0<br />
<br />
=== DVD drive is noisy ===<br />
<br />
If playing DVD videos causes the system to be very loud, it may be because the disc is spinning faster than it needs to. To temporarily change the speed of the drive, run:<br />
<br />
# eject -x 12 /dev/dvd<br />
<br />
Sometimes:<br />
<br />
# hdparm -E12 /dev/dvd<br />
<br />
Any speed that is supported by the drive can be used, or 0 for the maximum speed.<br />
<br />
[https://michal.kosmulski.org/computing/tips/cd-rom-speed.html Setting CD-ROM and DVD-ROM drive speed]<br />
<br />
=== Playback does not work with new computer (new DVD-Drive) ===<br />
<br />
If playback does not work and you have a new computer (new DVD-Drive) the reason might be that the [[Wikipedia:DVD region code|region code]] is not set. You can read and set the region code with the {{AUR|regionset}} package.<br />
<br />
=== None of the above programs are able to rip/encode a DVD to my hard disk! ===<br />
<br />
Make sure the region of your DVD reader is set correctly; otherwise, you will get loads of inexplicable [[Wikipedia:Content Scramble System|CSS]]-related errors. Use the {{AUR|regionset}} package to do so.<br />
<br />
If ripping still does not work with the correct region set, refer to the [https://videolan.videolan.me/libdvdcss/ libdvdcss developer documentation] for enabling log messages and setting other relevant options.<br />
<br />
=== GUI program log indicates problems with backend program ===<br />
<br />
If you use a GUI program and experience problems which the program's log blames on some backend program, then try to reproduce the problem by the logged backend program arguments.<br />
Whether you succeed with reproducing or not, you may report the logged lines and your own findings to the places mentioned in [[#Burn backend problems]] section.<br />
<br />
==== Special case: medium error / write error ====<br />
<br />
Here are some typical messages about the drive disliking the medium. This can only be solved by using a different drive or a different medium. A different program will hardly help.<br />
<br />
Brasero with backend growisofs:<br />
<br />
BraseroGrowisofs stderr: :-[ WRITE@LBA=0h failed with SK=3h/ASC=0Ch/ACQ=00h]: Input/output error<br />
<br />
Brasero with backend libburn:<br />
<br />
BraseroLibburn Libburn reported an error SCSI error on write(16976,16): [3 0C 00] Write error<br />
<br />
=== BD-R DL 50GB errors on trying to burn second layer ===<br />
<br />
Using ''growisofs'' from {{Pkg|dvd+rw-tools}} for burning 50GB BD-R DL discs might result in a fatal error and damaged media, such as:<br />
<br />
{{hc|$ growisofs -Z /dev/sr0 -J -R -V "label" files|<nowiki><br />
Executing 'mkisofs -J -R -V label files | builtin_dd of=/dev/sr0 obs=32k seek=0'<br />
I: -input-charset not specified, using utf-8 (detected in locale settings)<br />
0.03% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.05% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.08% done, estimate finish Fri Jan 29 19:50:36 2016<br />
/dev/sr0: pre-formatting blank BD-R for 49.8GB...<br />
/dev/sr0: "Current Write Speed" is 8.2x4390KBps.<br />
0.11% done, estimate finish Sat Jan 30 03:29:13 2016<br />
0.13% done, estimate finish Sat Jan 30 02:10:01 2016<br />
...<br />
63.20% done, estimate finish Fri Jan 29 20:43:45 2016<br />
:-[ WRITE@LBA=b6d820h failed with SK=3h/WRITE ERROR]: Input/output error<br />
:-( write failed: Input/output error<br />
/dev/sr0: flushing cache<br />
/dev/sr0: closing track<br />
/dev/sr0: closing session<br />
:-[ CLOSE SESSION failed with SK=5h/INVALID FIELD IN CDB]: Input/output error<br />
/dev/sr0: reloading tray<br />
</nowiki>}}<br />
<br />
This happened at the 25GB boundary when starting to write the second layer. Using ''cdrecord'' from {{Pkg|cdrtools}} works with no problems. Tested with a 'HL-DT-ST BD-RE WH16NS40' LG burner, and Verbatim BD-R DL 6x discs (#96911). {{bug|47797}}<br />
<br />
=== Disc tray autocloses ===<br />
<br />
If after ejecting a cd, either by using the {{ic|eject}} command, or pushing the drive button, the drive disc tray autocloses before being able to remove the disc, try the following command:<br />
<br />
# sysctl -w dev.cdrom.autoclose=0<br />
<br />
If that solves the problem, make the change permanent:<br />
<br />
{{hc|/etc/sysctl.d/60-cdrom-autoclose.conf|2=<br />
dev.cdrom.autoclose = 0<br />
}}<br />
<br />
If the above does not work and as a last resort measure, you can unload the disc module from the kernel via:<br />
<br />
# rmmod sr_mod<br />
<br />
the disc drive should now behave as expected but will not mount disc anymore. After putting a disc into the drive, reactivate the module via:<br />
<br />
# modprobe sr_mod<br />
<br />
the disc should now mount.<br />
<br />
== See also ==<br />
<br />
* In the United States, backup of physically obtained media is allowed under these conditions: [https://www.riaa.com/resources-learning/about-piracy/ About Piracy - RIAA].<br />
* [https://dev.lovelyhq.com/libburnia/web/wiki Main page of the project Libburnia]</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Optical_disc_drive_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=757948Optical disc drive (简体中文)2022-11-25T06:48:10Z<p>InsaneGuo: /* DVD */ // Edit via Wikiplus</p>
<hr />
<div>[[Category:Multimedia (简体中文)]]<br />
[[Category:Optical disc (简体中文)]]<br />
[[en:Optical disc drive]]<br />
[[es:Optical disc drive]]<br />
[[ja:光学ディスクドライブ]]<br />
{{Related articles start}}<br />
{{Related|Codecs}}<br />
{{Related|MPlayer}}<br />
{{Related|dvdbackup}}<br />
{{Related|MEncoder}}<br />
{{Related|Blu-ray}}<br />
{{Related|Convert any Movie to DVD Video}}<br />
{{Related articles end}}<br />
<br />
来自维基百科:<br />
<br />
在计算机领域,Optical disc drive(ODD)是一种光盘驱动器,它使用激光或可见光频谱内或附近的电磁波作为向光盘读写数据过程的一部分。<br />
<br />
== 刻录 ==<br />
<br />
{{Expansion|是否有被 Arch Linux 打包过的命令行工具可以将文件分卷写入碟片中? (像是 GAFFitter 或 cdrkit 的 dirsplit) }}<br />
<br />
{{Warning|有很大数量的光学驱动器和碟片是有很大不同的。通常,在需要可靠性的时候,推荐使用慢速刻录。如果你遇到了未预期的行为时,尝试使用刻录器所支持的最慢速度刻录。}}<br />
<br />
光盘驱动器的刻录过程包括创建或获得一个图像并将其写入光学介质。该镜像原则上可以是任何数据文件。如果你想挂载生成的介质,那么它通常是一个ISO 9660文件系统的镜像文件。音频和多媒体光盘通常是从.bin文件刻录的,在.toc文件或.cue文件的控制下,告诉所需的轨道布局。<br />
<br />
=== 安装刻录工具 ===<br />
<br />
{{Style|Says twice that X is the traditional choice without stating why.}}<br />
<br />
如果你想要使用 GUI 程序,见 [[#Burning CD/DVD/BD with a GUI]]。<br />
<br />
这里列出的程序是面向命令行的。它们是大多数用于CD、DVD和BD的免费GUI程序所使用的后端。当涉及到故障排除或编写刻录活动的脚本时,GUI用户可能会用到它们。<br />
<br />
你至少需要一个创建文件系统镜像的程序和一个能够将数据刻录到你所需要的媒体类型的程序。<br />
<br />
可用于创建ISO9660类型镜像的应用有:<br />
<br />
* {{man|8|mkisofs}} 自 {{Pkg|cdrtools}}<br />
* {{man|1|xorriso}} 和 {{man|1|xorrisofs}} 自 {{Pkg|libisoburn}}<br />
<br />
常见的选择是 ''mkisofs''.<br />
<br />
可用于刻录媒体文件的应用有:<br />
<br />
* {{man|1|cdrdao}} 自 {{Pkg|cdrdao}} (仅 CD, 格式仅 TOC/CUE/BIN)<br />
* {{man|1|cdrecord}} 自 {{Pkg|cdrtools}}<br />
* {{man|1|cdrskin}} 自 {{Pkg|libburn}}<br />
* {{man|1|growisofs}} 自 {{Pkg|dvd+rw-tools}} (仅 DVD 和 BD)<br />
* {{man|1|xorriso}} 和 {{man|1|xorrecord}} 自 {{Pkg|libisoburn}}<br />
<br />
常见的对于 CD 的选择有 ''cdrecord'' 而 对于 DVD 和 BD 的选择有''growisofs'' 。为将 TOC/CUE/BIN 烧录到 CD,安装 {{Pkg|cdrdao}}.<br />
<br />
自由的 GUI 烧录程序至少依赖于一个上述包。<br />
<br />
在这份文档中,''xorrisofs'' 支持 ''mkisofs'' 选项。<br />
<br />
''cdrskin'' 支持 ''cdrecord'' 选项 ; ''xorrecord'' 在不处理音频 CD 时也支持它。<br />
<br />
=== 从已存在的文件构建一个 ISO 镜像 ===<br />
<br />
先将需要的文件拷贝到一个文件夹,是创建一个 ISO 镜像的最简单办法。例如:{{ic|./for.iso}}。<br />
<br />
然后用 ''mkisofs'' 生成这个镜像:<br />
<br />
$ mkisofs -V "''ARCHIVE_2013_07_27''" -J -r -o ''isoimage.iso'' ''./for_iso''<br />
<br />
这些选项在下列的节中被解释。<br />
<br />
==== 基本选项 ====<br />
<br />
;{{ic|-V}}: (分配给)文件系统的名称。ISO 9660 标准限定了 32 字节的长度,同样,这些字符被限制为:"A"-"Z","0"-"9"以及"_"。卷标签可能展示为挂载点,如果这个介质是被自动挂载的。<br />
;{{ic|-J}}: 启用 [[Wikipedia:Joliet (file system)|Joliet]] 扩展, 允许特定空间用 Unicode 存储文件名称。(最高每个文件 64 UTF-16 字符)。<br />
;{{ic|-joliet-long}}: 增加 Joliet 表命名的最大长度,从 64 到 103 字符。 不符合Joliet规范,通常不受支持。<br />
;{{ic|-r}}: Enables [[Wikipedia:Rock Ridge|Rock Ridge]] 扩展,POSIX 文件系统到一个镜像,包括 255 字符长度的文件名和 Unix 风格文件拓展名。<br />
;{{ic|-o}}: 为输出的 ISO 镜像设置文件路径。<br />
<br />
==== 移植点 ====<br />
<br />
可以让 "mkisofs" 查找文件和目录从制定路径<br />
<br />
$ mkisofs -V "''BACKUP_2013_07_27''" -J -r -o ''backup_2013_07_27.iso'' \<br />
-graft-points \<br />
/photos=/home/''user''/photos \<br />
/mail=/home/''user''/mail \<br />
/photos/holidays=/home/''user''/holidays/photos<br />
<br />
{{ic|-graft-points}} 允许识别由ISO文件系统中的目标地址组成的“路径规范” (如 {{ic|/photos}}) 和源地址 (如 {{ic|/home/user/photos}}). 使用 "=" 字符分隔。<br />
<br />
这个例子将 文件夹 {{ic|/home/user/photos}}{{ic|/home/user/mail}} and {{ic|/home/user/holidays/photos}} 分别设为 ISO 镜像中的 {{ic|/photos}}, {{ic|/mail}} and {{ic|/photos/holidays}}。<br />
<br />
''mkisofs'' 和 ''xorrisofs'' 使用相同的参数。使用安全备份,为 ''xorrisofs'' 加上 {{ic|--for_backup}},这将记录事件 ACL 并为每个文件存储 MD5 校验值。<br />
<br />
见 {{man|8|mkisofs}} 和 {{man|1|xorrisofs}} 手册以获得更多关于命令的参数的信息。<br />
<br />
=== 挂载一个 ISO 镜像 ===<br />
<br />
你可以挂载一个 ISO 镜像,如果你想要浏览它的文件。<br />
我们可以使用下面的指令挂载一个 ISO 镜像:<br />
<br />
# mount -t iso9660 -o ro,loop ''/path/to/file.iso'' ''/mount-point''<br />
<br />
浏览完毕后,一定记得卸载:<br />
<br />
# umount /mount-point<br />
<br />
无 Root 用户挂载镜像,见 [[Mounting images as user]]。<br />
<br />
=== 转换 img/ccd 到 iso ===<br />
<br />
转换 {{ic|img}}/{{ic|ccd}} 镜像, 你可使用 {{Pkg|ccd2iso}}:<br />
<br />
$ ccd2iso ''~/image.img'' ''~/image.iso''<br />
<br />
=== 知晓你的设备的名称 ===<br />
<br />
为剩余部分,假定你设的记录设备的节为 {{ic|/dev/sr0}}<br />
<br />
用下面的指令检查<br />
<br />
$ cdrecord dev=''/dev/sr0'' -checkdrive<br />
<br />
这将报告这个设备的 {{ic|Vendor_info}} 和 {{ic|Indentification}}。<br />
<br />
如果没有找到设备,检查一切 {{ic|/dev/sr*}} 是否存在,当他们提供了读写权限 ({{ic|wr-}}) 到你的组。<br />
<br />
如果没有 {{ic|/dev/sr*}} 存在,尝试手动[[Kernel modules|加载]]模块 {{ic|sr_mod}}。<br />
<br />
=== 读取 CD/DVD 的卷名 ===<br />
<br />
如果你想获得名称或标签,使用''dd'':<br />
<br />
$ dd if=''/dev/sr0'' bs=1 skip=32808 count=32<br />
<br />
=== 从 CD, DVD 或 BD 中创建 ISO 镜像 ===<br />
<br />
为从介质中拷贝数据,并不让空块填充它,先确定它的块/扇区数量与大小(多数为每个 2048)。<br />
<br />
{{hc|$ isosize -x /dev/sr0|<br />
sector count: 2041796, sector size: 2048<br />
}}<br />
<br />
或<br />
<br />
{{hc|$ isoinfo -d -i /dev/sr0 {{!}} awk '/block size{{!}}Volume size/'|<br />
Logical block size is: 2048<br />
Volume size is: 2041796<br />
}}<br />
<br />
{{Note|别忘记把{{ic|/dev/sr0}}换成你的光驱。}}<br />
<br />
然后用[[dd]]用获得的数据拷出来:<br />
<br />
$ dd if=/dev/sr0 of=discmage.iso bs=''sector_size'' count=''sector_count'' status=progress<br />
<br />
{{Tip|如果介质坏了,建议用类似于 {{Pkg|ddrescue}} 这样的专门工具,见 [[Disk cloning#Using ddrescue]] 。}}<br />
<br />
如果原介质是可启动的,它的拷贝也将是一个可启动镜像。你可能将它用于虚拟机的虚拟光驱或将它烧录到光学介质,这也将是可启动的。 [https://askubuntu.com/questions/147800/ripping-dvd-to-iso-accurately#874945]<br />
<br />
=== 擦除CD-RW和DVD-RW ===<br />
<br />
使用过的CD-RW介质需要在写上以前记录的数据之前被擦除。这可以通过以下方式完成<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
<br />
清空有两个选项:blank=fast 和 blank=all。完全清空的持续时间与完全写操作一样长。它覆盖了光盘上的有效载荷数据。然而这不应该被认为是安全地使这些数据不可读。为了这个目的,建议用随机数据进行几次全写运行。<br />
<br />
替代命令有:<br />
<br />
$ cdrskin -v dev=''/dev/sr0'' blank=fast<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
擦除 DVD-RW 使用 ''dvd+rw-format'' 工具来自 {{Pkg|dvd+rw-tools}}:<br />
<br />
$ dvd+rw-format -blank=fast ''/dev/sr0''<br />
<br />
替代命令有:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
$ cdrskin -v dev=''/dev/sr0'' blank=deformat_sequential_quickest<br />
$ xorriso -outdev ''/dev/sr0'' -blank deformat_quickest<br />
<br />
这种快速消隐的DVD-RW不适合多时段使用,也不能接受未预知长度的输入流。为此,人们必须使用以下方法之一:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=all<br />
$ dvd+rw-format -blank=full ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=as_needed<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
其他媒体类型要么是一次性写入(CD-R、DVD-R、DVD+R、BD-R),要么是无需擦除的可重写(DVD-RAM、DVD+RW、BD-RE)。<br />
<br />
=== 格式化 DVD-RW ===<br />
<br />
格式化过的 DVD-RW 介质可以在不提前擦除的情况下重写。所以考虑在其生命周期内格式化一次。<br />
<br />
$ dvd+rw-format -force ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=format_if_needed<br />
$ xorriso -outdev ''/dev/sr0'' -format as_needed<br />
<br />
不像 DVD-RAM, DVD+RW 和 BD-RE,格式化的 DVD-RW 无法被用于(低速)硬盘直写,而是需要驱动 ptcdvd。见 {{man|8|pktsetup}}。<br />
<br />
=== 格式化 BD-RE 和 BD-R ===<br />
<br />
BD-RE 需要在使用前格式化。当检测到未格式化状态时,烧录程序会自动完成它。然而,数据存储区域的大小可能会受到上述DVD-RW格式命令的影响。<br />
<br />
BD-R 可以是格式化的或非格式化的。非格式化的写入将会全程普通速度写入,并提供最大的存储空间。格式化的可以在写入操作时检查,坏块会从空闲块中被替换。这可能会把速度降到一半于普通速度。普通的格式化会使存储空间下降 768MiB。<br />
<br />
growisofs 默认会格式化 BD-R,其他的不会。growisofs 可不进行格式化。cdrskin 和 xorriso 可以完全速度写入格式化的 BD-RE 或 BD-R:<br />
<br />
$ growisofs -use-the-force-luke=spare:none ...growisofs.or.mkisofs.options...<br />
$ cdrskin stream_recording=on ...cdrecord.options...<br />
$ xorriso -stream_recording on ...xorriso.commands...<br />
<br />
=== 烧录一个 ISO 镜像到 CD、DVD 或 BD。 ===<br />
<br />
为烧录一个 ISO 镜像文件 {{ic|isoimage.iso}} 到光学介质,<br />
为CD: <br />
<br />
$ cdrecord -v -sao dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
为 DVD 或 BD:<br />
<br />
$ growisofs -dvd-compat -Z ''/dev/sr0''=''isoimage.iso''<br />
<br />
为 CD、BD 或 DVD:<br />
<br />
$ xorriso -as cdrecord -v dev=''/dev/sr0'' -dao ''isoimage.iso''<br />
<br />
{{Note|1=<br /><br />
* 当你准备写入时,确保介质未挂载。当介质包含一个可读的文件系统时,管挂载可能是自动的。在最好的情况下,它会防止烧录程序使用烧录设备。在最坏的情况下,可能会因为读取操作弄坏设备。所以,在不能确定的情况下,{{bc|# umount /dev/sr0}}<br />
* ''growisofs'' 有个关于 BD-R 空白介质的[https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=713016 小 bug]。它会报出一个错误信息在烧录完成后。像 ''k3b'' 这样的程序会认为整个烧录过程失败了。为防止这个问题:<br />
** 这样 {{ic|dvd+rw-format ''/dev/sr0''}} 格式化在使用 ''growisofs'' 之前。<br />
** 或用 ''growisofs'' 选项 {{ic|1= -use-the-force-luke=spare:none}}<br />
}}<br />
<br />
=== 验证烧录的ISO镜像 ===<br />
你可以验证烧录的介质的完整性,以确保它不包含错误。在验证之前一定要弹出介质并重新插入。这将保证任何内核缓存不会被用来读取数据。<br />
<br />
首先计算原始ISO镜像的MD5校验值:<br />
<br />
{{hc|$ md5sum isoimage.iso|<br />
e5643e18e05f5646046bb2e4236986d8 isoimage.iso<br />
}}<br />
<br />
之后在介质上为每个 ISO 文件系统计算 MD5。不过一些类型的介质完全提交给烧录程序相同数量的数据,很多其他的尾随的垃圾也会被读取。所以你需要限制为 ISO 镜像文件读取的大小。<br />
<br />
$ blocks=$(expr $(du -b isoimage.iso | awk '{print $1}') / 2048)<br />
<br />
{{hc|1=$ dd if=/dev/sr0 bs=2048 count=$blocks {{!}} md5sum|2=<br />
43992+0 records in<br />
43992+0 records out<br />
90095616 bytes (90 MB, 86 MiB) copied, 0.359539 s, 251 MB/s<br />
e5643e18e05f5646046bb2e4236986d8 -<br />
}}<br />
<br />
每次执行都需要给出相同的 MD5 校验值(这:{{ic|e5643e18e05f5646046bb2e4236986d8}})。如果没有,你可能会一同获得一个 I/O 错误自 {{ic|dd}} 的运行中。当你感兴趣的时候,[[dmesg]] 可能告诉你 SCSI 错误和块编号。<br />
<br />
=== ISO 9660 和运行时烧录 ===<br />
<br />
没有必要存储一个应急的 ISO 文件系统在硬盘,在它写到光学介质前。在写到一个空设备缓冲区的时候,只有极老的 CD 驱动器在极老的电脑上运行会遭受错误。<br />
<br />
如果你省略了 ''mkisofs'' 的 {{ic|-o}} 选项,它将写一个 ISO 镜像到标准输出。这可被用管道导到烧录程序。<br />
<br />
$ mkisofs -V "ARCHIVE_2013_07_27" -J -r ./for_iso | \<br />
cdrecord -v dev=/dev/sr0 -waiti -<br />
<br />
选项 {{ic|-waiti}} 此处并非必须. 它避免 ''cdrecord'' 在 ''mkisofs'' 在其输出前写入到介质。这将允许 ''mkisofs'' 排除干扰的去读取已开始烧录的介质。见关于多会话的下一节。<br />
<br />
在 DVD 和 BD 中, 你可能让 ''growisofs'' 为你操作 ''mkisofs'' 并在运行烧录它的输出:<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
=== 多会话 ===<br />
<br />
ISO-9960 多会话意味着一个介质使用只读文件系统的同时,依然可以在第一个未被使用的块地址写,并且在这个块上会有新的 ISO 树。这个新树协同于新加的或覆写的文件的数据块。数据的块在旧的 ISO 树中的,无法再被写。<br />
<br />
Linux 和其他操作系统将挂载在介质上的最新的会话上的文件夹树。最新的树也将正常的显示旧会话的文件。<br />
<br />
==== Multi-session by cdrecord ====<br />
<br />
CD-R and CD-RW stay writable (aka "appendable") if cdrecord option {{ic|-multi}} was used<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
Then the medium can be inquired for the parameters of the next session<br />
<br />
$ m=$(cdrecord dev=''/dev/sr0'' -msinfo)<br />
<br />
By help of these parameters and of the readable medium in the drive you can produce the add-on ISO session<br />
<br />
$ mkisofs -M ''/dev/sr0'' -C "$m" \<br />
-V "''ARCHIVE_2013_07_28''" -J -r -o ''session2.iso'' ''./more_for_iso''<br />
<br />
Finally append the session to the medium and keep it appendable again<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''session2.iso''<br />
<br />
Programs ''cdrskin'' and ''xorrecord'' do this too with DVD-R, DVD+R, BD-R and unformatted DVD-RW. Program ''cdrecord'' does multi-session with at least DVD-R and DVD-RW. They all do with CD-R and CD-RW, of course.<br />
<br />
Most re-usable media types do not record a session history that would be recognizable for a mounting kernel. But with ISO 9660 it is possible to achieve the multi-session effect even on those media.<br />
<br />
''growisofs'' and ''xorriso'' can do this and hide most of the complexity.<br />
<br />
==== Multi-session by growisofs ====<br />
<br />
By default, ''growisofs'' uses ''mkisofs'' as a backend for creating ISO images forwards most of its program arguments to . See above examples of ''mkisofs''. It bans option {{ic|-o}} and deprecates option {{ic|-C}}. By default it uses the ''mkisofs''. You may specify to use one of the others compatible backend program by setting environment variable {{ic|MKISOFS}}:<br />
<br />
$ export MKISOFS="xorrisofs"<br />
<br />
The wish to begin with a new ISO file system on the optical medium is expressed by option {{ic|-Z}}<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
The wish to append more files as new session to an existing ISO file system is expressed by option {{ic|-M}}<br />
<br />
$ growisofs -M ''/dev/sr0'' -V "''ARCHIVE_2013_07_28''" -r -J ''./more_for_iso''<br />
<br />
For details see the {{man|1|growisofs}} manual and the manuals of ''mkisofs'' and ''xorrisofs''.<br />
<br />
==== Multi-session by xorriso ====<br />
<br />
''xorriso'' learns the wish to begin with a new ISO file system from the blank state of the medium. So it is appropriate to blank it if it contains data. The command {{ic|-blank as_needed}} applies to all kinds of re-usable media and even to ISO images in data files on hard disk. It does not cause error if applied to a blank write-once medium.<br />
<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed \<br />
-volid "''ARCHIVE_2013_07_27''" -joliet on -add ''./for_iso'' --<br />
<br />
On non-blank writable media ''xorriso'' appends the newly given disc files if command {{ic|-dev}} is used rather than {{ic|-outdev}}. Of course, no command {{ic|-blank}} should be given here<br />
<br />
$ xorriso -dev ''/dev/sr0'' \<br />
-volid "''ARCHIVE_2013_07_28''" -joliet on -add ''./more_for_iso'' --<br />
<br />
For details see the {{man|1|xorriso}} man page and especially its examples.<br />
<br />
=== BD Defect Management ===<br />
<br />
BD-RE and formatted BD-R media are normally written with enabled Defect Management. This feature reads the written blocks while they are still stored in the drive buffer. In case of poor read quality the blocks get written again or redirected to the ''Spare Area'' where the data get stored in replacement blocks.<br />
<br />
This checkreading reduces write speed to at most half of the nominal speed of drive and BD medium. Sometimes it is even worse. Heavy use of the Spare Area causes long delays during read operations. So Defect Management is not always desirable.<br />
<br />
''cdrecord'' does not format BD-R. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''growisofs'' formats BD-R by default. The Defect Management can be prevented by option {{ic|1= -use-the-force-luke=spare:none}}. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''cdrskin'', ''xorriso'' and ''xorrecord'' do not format BD-R by default. They do with {{ic|1= cdrskin blank=format_if_needed}}, resp. {{ic|1= xorriso -format as_needed}}, resp. {{ic|1= xorrecord blank=format_overwrite}}. These three programs can disable Defect Management with BD-RE and already formatted BD-R by {{ic|1= cdrskin stream_recording=on}}, resp. {{ic|1= xorriso -stream_recording on}}, resp. {{ic|1= xorrecord stream_recording=on}}.<br />
<br />
=== Burning an audio CD ===<br />
<br />
Create your audio tracks and store them as uncompressed, 16-bit, 44100-Hz, stereo WAV files. To convert MP3 to WAV, ensure {{Pkg|lame}} is installed, ''cd'' to the directory with your MP3 files, and run:<br />
<br />
$ for i in *.mp3; do lame --decode "$i" "$(basename "$i" .mp3)".wav; done<br />
<br />
In case you get an error when trying to burn WAV files converted with LAME, try decoding with {{Pkg|mpg123}}:<br />
<br />
$ for i in *.mp3; do mpg123 --rate 44100 --stereo --buffer 3072 --resync -w $(basename "$i" .mp3).wav $i; done<br />
<br />
To convert AAC to WAV ensure {{Pkg|faad2}} is installed and run:<br />
$ for i in *.m4a; do faad $i; done<br />
<br />
To fix the bitrate of an already existing WAV file (or many other formats), try using {{Pkg|sox}}:<br />
$ for i in *.wav; do sox "$i" -c 2 -r 44100 "$(basename "$i" .wav)"-ok.wav; done<br />
<br />
Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as {{ic|01.wav}}, {{ic|02.wav}}, {{ic|03.wav}}, etc. Use the following command to simulate burning the WAV files as an audio CD:<br />
<br />
$ cdrecord '''-dummy''' -v -pad speed=1 dev=''/dev/sr0'' -dao -swab *.wav<br />
<br />
If everything worked, you can remove the {{ic|-dummy}} flag to actually burn the CD.<br />
<br />
{{Note|The produced disc may not play in all CD players. For an audio-only disc (discarding some track metadata), add the {{ic|-audio}} flag.}}<br />
<br />
To test the new audio CD, use [[MPlayer]]:<br />
<br />
$ mplayer cdda://<br />
<br />
=== Burning a BIN/CUE ===<br />
<br />
To burn a BIN/CUE image run:<br />
<br />
$ cdrdao write --device ''/dev/sr0'' ''image.cue''<br />
<br />
==== TOC/CUE/BIN for mixed-mode discs ====<br />
<br />
ISO images only store a single data track. If you want to create an image of a mixed-mode disc (data track with multiple audio tracks) then you need to make a TOC/BIN pair:<br />
<br />
$ cdrdao read-cd --read-raw --datafile ''image.bin'' --driver generic-mmc:0x20000 --device ''/dev/cdrom'' ''image.toc''<br />
<br />
Some software only likes CUE/BIN pair, you can make a CUE sheet with ''toc2cue'' (part of {{Pkg|cdrdao}}):<br />
<br />
$ toc2cue ''image.toc'' ''image.cue''<br />
<br />
=== Burn backend problems ===<br />
<br />
If you are experiencing problems, you may ask for advise at mailing list [mailto:cdwrite@other.debian.org cdwrite@other.debian.org], or try to write to the one of support mail addresses if some are listed near the end of the program's man page.<br />
<br />
Tell the command lines you tried, the medium type (如 CD-R, DVD+RW, ...), and the symptoms of failure (program messages, disappointed user expectation, ...). You will possibly get asked to obtain the newest release or development version of the affected program and to make test runs. But the answer might as well be, that your drive dislikes the particular medium.<br />
<br />
=== Burning CD/DVD/BD with a GUI ===<br />
<br />
There are several applications available to burn CDs in a graphical environment.<br />
<br />
See also [[Wikipedia:Comparison of disc authoring software]].<br />
<br />
* {{App|[[Wikipedia:AcetoneISO|AcetoneISO]]|All-in-one ISO tool (supports BIN, MDF, NRG, IMG, DAA, DMG, CDI, B5I, BWI, PDI and ISO).|https://sourceforge.net/projects/acetoneiso|{{AUR|acetoneiso2}}}}<br />
* {{App|BashBurn|Lightweight terminal based menu frontend for CD/DVD burning tools.|http://bashburn.dose.se/|{{Pkg|bashburn}}}}<br />
* {{App|[[Wikipedia:Brasero (software)|Brasero]]|Disc burning application for the GNOME desktop that is designed to be as simple as possible.|https://wiki.gnome.org/Apps/Brasero|{{Pkg|brasero}}}}<br />
* {{App|cdw|Ncurses frontend to ''cdrecord'', ''mkisofs'', ''growisofs'', ''dvd+rw-mediainfo'', ''dvd+rw-format'' and ''xorriso''.|http://cdw.sourceforge.net/|{{AUR|cdw}}}}<br />
* {{App|Graveman|GTK-based CD/DVD burning application. It requires configuration to point to correct devices.|https://graveman.tuxfamily.org/|{{AUR|graveman}}}}<br />
* {{App|isomaster|ISO image editor.|http://littlesvr.ca/isomaster|{{AUR|isomaster}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|[[Wikipedia:X-CD-Roast|X-CD-Roast]]|Lightweight ''cdrtools'' front-end for CD and DVD writing.|http://www.xcdroast.org/|{{AUR|xcdroast}}}}<br />
* {{App|[[Wikipedia:Xfce#Xfburn|Xfburn]]|Simple front-end to the libburnia libraries with support for CD/DVD(-RW), ISO images, and BurnFree.|https://docs.xfce.org/apps/xfburn/start|{{Pkg|xfburn}}}}<br />
* {{App|xorriso-tcltk|Graphical front-end to ISO and CD/DVD/BD burn tool xorriso|https://www.gnu.org/software/xorriso/|{{Pkg|libisoburn}}}}<br />
<br />
== Playback ==<br />
<br />
=== CD ===<br />
<br />
CD的音频播放需要{{Pkg|libcdio}} 软件包。为了使KDE应用程序如Dolphin能够读取CD中的音频,你需要安装{{Pkg|audiocd-kio}}。<br />
<br />
=== DVD ===<br />
<br />
如果你想播放加密的DVD,你必须安装诸如libdvd*软件包。<br />
* {{Pkg|libdvdread}}<br />
* {{Pkg|libdvdcss}}<br />
* {{Pkg|libdvdnav}}<br />
<br />
除此之外,你还需要安装媒体播放器。热门的DVD播放器包括[[MPlayer]], [[Wikipedia:Xine|xine]] 和 [[VLC]]。 参见 [[List of applications/Multimedia#Video players|视频播放]] 上的列表 和对于 [[MPlayer#DVD playing|MPlayer]]的特殊介绍。<br />
<br />
=== Blu-ray ===<br />
<br />
See [[Blu-ray#Playback]].<br />
<br />
== Ripping ==<br />
<br />
[[Wikipedia:Ripping|Ripping]] is the process of copying audio or video content to a hard disk, typically from removable media or media streams.<br />
<br />
=== Audio CD ===<br />
<br />
==== Console ====<br />
<br />
* {{App|abcde|Comprehensive command-line tool for ripping audio CDs.|https://abcde.einval.com/|{{AUR|abcde}}}}<br />
* {{App|cdda2wav|CD-audio extraction program with paranoia support.|http://www.cdda2wav.de/|{{Pkg|cdrtools}}}}<br />
* {{App|[[Wikipedia:cdparanoia|cdparanoia]]|Compact Disc Digital Audio (CDDA) Digital Audio Extraction (DAE) tool.|https://xiph.org/paranoia/index.html|{{Pkg|cdparanoia}}}}<br />
* {{App|cyanrip|Extensive CD ripper with musicbraniz integration, error detection, log generation, many formats, HDCD decoding, covert art automatic download.|https://github.com/cyanreg/cyanrip/|{{AUR|cyanrip}}}}<br />
* {{App|ripright|Minimal CD ripper modeled on autorip.|https://www.mcternan.me.uk/ripright/|{{AUR|ripright}}}}<br />
* {{App|[[Wikipedia:ripit|ripit]]|Command-line ripper that supports MusicBrainz, freeddb and various codecs. |https://www.ripit.pl/|{{AUR|ripit}}}}<br />
* {{App|shnsplit|Splits .wav and .flac files according to a CUE sheet and encodes the resulting pieces. A useful companion to ABCDE.|http://shnutils.freeshell.org/shntool/|{{AUR|shntool}}}}<br />
* {{App|whipper|CD ripper aiming for accuracy over speed. Uses cdparanoia, MusicBrainz, AccurateRip.|https://github.com/whipper-team/whipper|{{Pkg|whipper}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|[[Wikipedia:Asunder (software)|Asunder]]|GTK-based CD ripping program.|http://littlesvr.ca/asunder/|{{Pkg|asunder}}}}<br />
* {{App|Audex|Audio grabber tool for CD-ROM drives based on KDE.|https://userbase.kde.org/Audex|{{Pkg|audex}}}}<br />
* {{App|[[Wikipedia:Fre:ac|fre:ac]]|Audio converter and CD ripper with support for various popular formats and encoders.|https://freac.org/|{{AUR|freac}}}}<br />
* {{App|Goobox|CD player and ripper for GNOME.|https://people.gnome.org/~paobac/goobox/{{Dead link|2022|09|22|status=404}}|{{Pkg|goobox}}}}<br />
* {{App|[[Wikipedia:Grip (software)|Grip]]|Fast and light CD ripper within the GNOME project that resembles [[Wikipedia:Audiograbber|Audiograbber]].|https://sourceforge.net/projects/grip/|{{AUR|grip}}}}.<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|KAudioCreator|KDE program for ripping and encoding Audio-CDs. Unmaintained and [https://bugs.archlinux.org/task/67618 does not start anymore].|https://invent.kde.org/unmaintained/kaudiocreator|{{AUR|kaudiocreator-git}}}}<br />
* {{App|ripperX|GTK program to rip CD audio tracks and encode them to the Ogg, MP3, or FLAC formats.|https://sourceforge.net/projects/ripperx/|{{AUR|ripperx}}}}<br />
* {{App|rubyripper|Audio disc ripper that tries to deliver a secure rip through multiple rippings of the same track and corrections of any differences.|https://github.com/bleskodev/rubyripper|{{AUR|rubyripper}}}}<br />
* {{App|[[Wikipedia:Sound Juicer|Sound Juicer]]|CD ripper for GNOME.|https://wiki.gnome.org/Apps/SoundJuicer|{{Pkg|sound-juicer}}}}<br />
* {{App|1=soundKonverter|2=Front-end to various audio converters.|3=https://www.linux-apps.com/content/show.php?content=29024|4={{Pkg|soundkonverter}}}}<br />
<br />
=== DVD-Video ===<br />
<br />
See also [[Wikipedia:Comparison of DVD ripper software]].<br />
<br />
Often, the process of ripping a DVD can be broken down into two subtasks:<br />
<br />
# '''Data extraction''' — Copying the audio and/or video data to a hard disk,<br />
# [[Wikipedia:Transcode|Transcoding]] — Converting the extracted data into a suitable format.<br />
<br />
Some utilities perform both tasks, whilst others focus on one aspect or the other.<br />
<br />
==== Console ====<br />
<br />
* {{App|[[dvdbackup]]|Tool for pure data extraction which does not transcode. It is useful for creating ''exact'' copies of encrypted DVDs in conjunction with '''libdvdcss''' or for decrypting video for other utilities unable to read encrypted DVDs.|http://dvdbackup.sourceforge.net/|{{Pkg|dvdbackup}}}}<br />
* {{App|[[FFmpeg]]|Complete and free Internet live audio and video broadcasting solution for Linux/Unix, capable to do a direct rip in any format (audio/video) from a DVD-Video ISO image, just select the input as the ISO image and proceed with the desired options. It also allows to downmixing, shrinking, spliting, selecting streams among other features.|https://ffmpeg.org/|{{Pkg|ffmpeg}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake CLI]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping.|https://handbrake.fr/|{{Pkg|handbrake-cli}}}}<br />
* {{App|[[MEncoder]]|Free command line video decoding, encoding and filtering tool. It supports ripping and transcoding DVD-Video.|http://www.mplayerhq.hu/|{{Pkg|mencoder}}}}<br />
* {{App|subtitleripper|Convert DVD subtitles into text format.|http://subtitleripper.sourceforge.net/|{{AUR|subtitleripper}}}}<br />
* {{App|Transcode|Video/DVD ripper and encoder for the terminal/console. It is [https://www.linuxfromscratch.org/blfs/view/8.3/multimedia/transcode.html outdated/no longer actively maintained].||{{Pkg|transcode}}}}<br />
* {{App|Vobcopy|Copies DVD ''.vob'' files to hard disk, decrypting them on the way.|https://github.com/barak/vobcopy|{{AUR|vobcopy}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|dvd::rip|Front-end to {{Pkg|transcode}}, used to extract DVD's to the hard disk and transcode or extract and transcode on-the-fly.|https://www.exit1.org/dvdrip/|{{AUR|dvdrip}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping. GTK version.|https://handbrake.fr/|{{Pkg|handbrake}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|OGMRip|An application and a set of libraries for ripping and encoding DVD into AVI, OGM, MP4, or Matroska files using a wide variety of codecs. It relies on mplayer, mencoder, ogmtools, mkvtoolnix, mp4box, oggenc, lame, and faac to perform its tasks.|http://ogmrip.sourceforge.net/|{{AUR|ogmrip}}}}<br />
<br />
=== DVD-Audio ===<br />
<br />
* {{App|Python Audio Tools|Includes dvda2track, which is easy to use command line tool to extract DVD-Audio tracks to uncompressed wav files.<br />
|http://audiotools.sourceforge.net/|{{AUR|audiotools}}}}<br />
<br />
=== Multi-format ===<br />
<br />
* {{App|Aaru|Software for archival ripping of CDs, DVDs, and harddrives|https://aaru.app|{{AUR|aaru}}}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Brasero fails to normalize audio CD ===<br />
<br />
If you try to burn it may stop at the first step called Normalization.<br />
<br />
As a workaround you can disable the normalization plugin using the ''Edit > Plugins'' menu<br />
<br />
=== VLC: Error "... could not open the disc /dev/dvd" ===<br />
<br />
If you get an error like<br />
<br />
vlc dvdread could not open the disc "/dev/dvd"<br />
<br />
it may be because there is no device node {{ic|/dev/dvd}} on your system. Udev no longer creates {{ic|/dev/dvd}} and instead uses {{ic|/dev/sr0}}. To fix this, edit the VLC configuration file ({{ic|~/.config/vlc/vlcrc}}):<br />
<br />
# DVD device (string)<br />
dvd=/dev/sr0<br />
<br />
=== DVD drive is noisy ===<br />
<br />
If playing DVD videos causes the system to be very loud, it may be because the disc is spinning faster than it needs to. To temporarily change the speed of the drive, run:<br />
<br />
# eject -x 12 /dev/dvd<br />
<br />
Sometimes:<br />
<br />
# hdparm -E12 /dev/dvd<br />
<br />
Any speed that is supported by the drive can be used, or 0 for the maximum speed.<br />
<br />
[https://michal.kosmulski.org/computing/tips/cd-rom-speed.html Setting CD-ROM and DVD-ROM drive speed]<br />
<br />
=== Playback does not work with new computer (new DVD-Drive) ===<br />
<br />
If playback does not work and you have a new computer (new DVD-Drive) the reason might be that the [[Wikipedia:DVD region code|region code]] is not set. You can read and set the region code with the {{AUR|regionset}} package.<br />
<br />
=== None of the above programs are able to rip/encode a DVD to my hard disk! ===<br />
<br />
Make sure the region of your DVD reader is set correctly; otherwise, you will get loads of inexplicable [[Wikipedia:Content Scramble System|CSS]]-related errors. Use the {{AUR|regionset}} package to do so.<br />
<br />
If ripping still does not work with the correct region set, refer to the [https://videolan.videolan.me/libdvdcss/ libdvdcss developer documentation] for enabling log messages and setting other relevant options.<br />
<br />
=== GUI program log indicates problems with backend program ===<br />
<br />
If you use a GUI program and experience problems which the program's log blames on some backend program, then try to reproduce the problem by the logged backend program arguments.<br />
Whether you succeed with reproducing or not, you may report the logged lines and your own findings to the places mentioned in [[#Burn backend problems]] section.<br />
<br />
==== Special case: medium error / write error ====<br />
<br />
Here are some typical messages about the drive disliking the medium. This can only be solved by using a different drive or a different medium. A different program will hardly help.<br />
<br />
Brasero with backend growisofs:<br />
<br />
BraseroGrowisofs stderr: :-[ WRITE@LBA=0h failed with SK=3h/ASC=0Ch/ACQ=00h]: Input/output error<br />
<br />
Brasero with backend libburn:<br />
<br />
BraseroLibburn Libburn reported an error SCSI error on write(16976,16): [3 0C 00] Write error<br />
<br />
=== BD-R DL 50GB errors on trying to burn second layer ===<br />
<br />
Using ''growisofs'' from {{Pkg|dvd+rw-tools}} for burning 50GB BD-R DL discs might result in a fatal error and damaged media, such as:<br />
<br />
{{hc|$ growisofs -Z /dev/sr0 -J -R -V "label" files|<nowiki><br />
Executing 'mkisofs -J -R -V label files | builtin_dd of=/dev/sr0 obs=32k seek=0'<br />
I: -input-charset not specified, using utf-8 (detected in locale settings)<br />
0.03% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.05% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.08% done, estimate finish Fri Jan 29 19:50:36 2016<br />
/dev/sr0: pre-formatting blank BD-R for 49.8GB...<br />
/dev/sr0: "Current Write Speed" is 8.2x4390KBps.<br />
0.11% done, estimate finish Sat Jan 30 03:29:13 2016<br />
0.13% done, estimate finish Sat Jan 30 02:10:01 2016<br />
...<br />
63.20% done, estimate finish Fri Jan 29 20:43:45 2016<br />
:-[ WRITE@LBA=b6d820h failed with SK=3h/WRITE ERROR]: Input/output error<br />
:-( write failed: Input/output error<br />
/dev/sr0: flushing cache<br />
/dev/sr0: closing track<br />
/dev/sr0: closing session<br />
:-[ CLOSE SESSION failed with SK=5h/INVALID FIELD IN CDB]: Input/output error<br />
/dev/sr0: reloading tray<br />
</nowiki>}}<br />
<br />
This happened at the 25GB boundary when starting to write the second layer. Using ''cdrecord'' from {{Pkg|cdrtools}} works with no problems. Tested with a 'HL-DT-ST BD-RE WH16NS40' LG burner, and Verbatim BD-R DL 6x discs (#96911). {{bug|47797}}<br />
<br />
=== Disc tray autocloses ===<br />
<br />
If after ejecting a cd, either by using the {{ic|eject}} command, or pushing the drive button, the drive disc tray autocloses before being able to remove the disc, try the following command:<br />
<br />
# sysctl -w dev.cdrom.autoclose=0<br />
<br />
If that solves the problem, make the change permanent:<br />
<br />
{{hc|/etc/sysctl.d/60-cdrom-autoclose.conf|2=<br />
dev.cdrom.autoclose = 0<br />
}}<br />
<br />
If the above does not work and as a last resort measure, you can unload the disc module from the kernel via:<br />
<br />
# rmmod sr_mod<br />
<br />
the disc drive should now behave as expected but will not mount disc anymore. After putting a disc into the drive, reactivate the module via:<br />
<br />
# modprobe sr_mod<br />
<br />
the disc should now mount.<br />
<br />
== See also ==<br />
<br />
* In the United States, backup of physically obtained media is allowed under these conditions: [https://www.riaa.com/resources-learning/about-piracy/ About Piracy - RIAA].<br />
* [https://dev.lovelyhq.com/libburnia/web/wiki Main page of the project Libburnia]</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Optical_disc_drive_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=757947Optical disc drive (简体中文)2022-11-25T06:42:45Z<p>InsaneGuo: /* CD */ tra</p>
<hr />
<div>[[Category:Multimedia (简体中文)]]<br />
[[Category:Optical disc (简体中文)]]<br />
[[en:Optical disc drive]]<br />
[[es:Optical disc drive]]<br />
[[ja:光学ディスクドライブ]]<br />
{{Related articles start}}<br />
{{Related|Codecs}}<br />
{{Related|MPlayer}}<br />
{{Related|dvdbackup}}<br />
{{Related|MEncoder}}<br />
{{Related|Blu-ray}}<br />
{{Related|Convert any Movie to DVD Video}}<br />
{{Related articles end}}<br />
<br />
来自维基百科:<br />
<br />
在计算机领域,Optical disc drive(ODD)是一种光盘驱动器,它使用激光或可见光频谱内或附近的电磁波作为向光盘读写数据过程的一部分。<br />
<br />
== 刻录 ==<br />
<br />
{{Expansion|是否有被 Arch Linux 打包过的命令行工具可以将文件分卷写入碟片中? (像是 GAFFitter 或 cdrkit 的 dirsplit) }}<br />
<br />
{{Warning|有很大数量的光学驱动器和碟片是有很大不同的。通常,在需要可靠性的时候,推荐使用慢速刻录。如果你遇到了未预期的行为时,尝试使用刻录器所支持的最慢速度刻录。}}<br />
<br />
光盘驱动器的刻录过程包括创建或获得一个图像并将其写入光学介质。该镜像原则上可以是任何数据文件。如果你想挂载生成的介质,那么它通常是一个ISO 9660文件系统的镜像文件。音频和多媒体光盘通常是从.bin文件刻录的,在.toc文件或.cue文件的控制下,告诉所需的轨道布局。<br />
<br />
=== 安装刻录工具 ===<br />
<br />
{{Style|Says twice that X is the traditional choice without stating why.}}<br />
<br />
如果你想要使用 GUI 程序,见 [[#Burning CD/DVD/BD with a GUI]]。<br />
<br />
这里列出的程序是面向命令行的。它们是大多数用于CD、DVD和BD的免费GUI程序所使用的后端。当涉及到故障排除或编写刻录活动的脚本时,GUI用户可能会用到它们。<br />
<br />
你至少需要一个创建文件系统镜像的程序和一个能够将数据刻录到你所需要的媒体类型的程序。<br />
<br />
可用于创建ISO9660类型镜像的应用有:<br />
<br />
* {{man|8|mkisofs}} 自 {{Pkg|cdrtools}}<br />
* {{man|1|xorriso}} 和 {{man|1|xorrisofs}} 自 {{Pkg|libisoburn}}<br />
<br />
常见的选择是 ''mkisofs''.<br />
<br />
可用于刻录媒体文件的应用有:<br />
<br />
* {{man|1|cdrdao}} 自 {{Pkg|cdrdao}} (仅 CD, 格式仅 TOC/CUE/BIN)<br />
* {{man|1|cdrecord}} 自 {{Pkg|cdrtools}}<br />
* {{man|1|cdrskin}} 自 {{Pkg|libburn}}<br />
* {{man|1|growisofs}} 自 {{Pkg|dvd+rw-tools}} (仅 DVD 和 BD)<br />
* {{man|1|xorriso}} 和 {{man|1|xorrecord}} 自 {{Pkg|libisoburn}}<br />
<br />
常见的对于 CD 的选择有 ''cdrecord'' 而 对于 DVD 和 BD 的选择有''growisofs'' 。为将 TOC/CUE/BIN 烧录到 CD,安装 {{Pkg|cdrdao}}.<br />
<br />
自由的 GUI 烧录程序至少依赖于一个上述包。<br />
<br />
在这份文档中,''xorrisofs'' 支持 ''mkisofs'' 选项。<br />
<br />
''cdrskin'' 支持 ''cdrecord'' 选项 ; ''xorrecord'' 在不处理音频 CD 时也支持它。<br />
<br />
=== 从已存在的文件构建一个 ISO 镜像 ===<br />
<br />
先将需要的文件拷贝到一个文件夹,是创建一个 ISO 镜像的最简单办法。例如:{{ic|./for.iso}}。<br />
<br />
然后用 ''mkisofs'' 生成这个镜像:<br />
<br />
$ mkisofs -V "''ARCHIVE_2013_07_27''" -J -r -o ''isoimage.iso'' ''./for_iso''<br />
<br />
这些选项在下列的节中被解释。<br />
<br />
==== 基本选项 ====<br />
<br />
;{{ic|-V}}: (分配给)文件系统的名称。ISO 9660 标准限定了 32 字节的长度,同样,这些字符被限制为:"A"-"Z","0"-"9"以及"_"。卷标签可能展示为挂载点,如果这个介质是被自动挂载的。<br />
;{{ic|-J}}: 启用 [[Wikipedia:Joliet (file system)|Joliet]] 扩展, 允许特定空间用 Unicode 存储文件名称。(最高每个文件 64 UTF-16 字符)。<br />
;{{ic|-joliet-long}}: 增加 Joliet 表命名的最大长度,从 64 到 103 字符。 不符合Joliet规范,通常不受支持。<br />
;{{ic|-r}}: Enables [[Wikipedia:Rock Ridge|Rock Ridge]] 扩展,POSIX 文件系统到一个镜像,包括 255 字符长度的文件名和 Unix 风格文件拓展名。<br />
;{{ic|-o}}: 为输出的 ISO 镜像设置文件路径。<br />
<br />
==== 移植点 ====<br />
<br />
可以让 "mkisofs" 查找文件和目录从制定路径<br />
<br />
$ mkisofs -V "''BACKUP_2013_07_27''" -J -r -o ''backup_2013_07_27.iso'' \<br />
-graft-points \<br />
/photos=/home/''user''/photos \<br />
/mail=/home/''user''/mail \<br />
/photos/holidays=/home/''user''/holidays/photos<br />
<br />
{{ic|-graft-points}} 允许识别由ISO文件系统中的目标地址组成的“路径规范” (如 {{ic|/photos}}) 和源地址 (如 {{ic|/home/user/photos}}). 使用 "=" 字符分隔。<br />
<br />
这个例子将 文件夹 {{ic|/home/user/photos}}{{ic|/home/user/mail}} and {{ic|/home/user/holidays/photos}} 分别设为 ISO 镜像中的 {{ic|/photos}}, {{ic|/mail}} and {{ic|/photos/holidays}}。<br />
<br />
''mkisofs'' 和 ''xorrisofs'' 使用相同的参数。使用安全备份,为 ''xorrisofs'' 加上 {{ic|--for_backup}},这将记录事件 ACL 并为每个文件存储 MD5 校验值。<br />
<br />
见 {{man|8|mkisofs}} 和 {{man|1|xorrisofs}} 手册以获得更多关于命令的参数的信息。<br />
<br />
=== 挂载一个 ISO 镜像 ===<br />
<br />
你可以挂载一个 ISO 镜像,如果你想要浏览它的文件。<br />
我们可以使用下面的指令挂载一个 ISO 镜像:<br />
<br />
# mount -t iso9660 -o ro,loop ''/path/to/file.iso'' ''/mount-point''<br />
<br />
浏览完毕后,一定记得卸载:<br />
<br />
# umount /mount-point<br />
<br />
无 Root 用户挂载镜像,见 [[Mounting images as user]]。<br />
<br />
=== 转换 img/ccd 到 iso ===<br />
<br />
转换 {{ic|img}}/{{ic|ccd}} 镜像, 你可使用 {{Pkg|ccd2iso}}:<br />
<br />
$ ccd2iso ''~/image.img'' ''~/image.iso''<br />
<br />
=== 知晓你的设备的名称 ===<br />
<br />
为剩余部分,假定你设的记录设备的节为 {{ic|/dev/sr0}}<br />
<br />
用下面的指令检查<br />
<br />
$ cdrecord dev=''/dev/sr0'' -checkdrive<br />
<br />
这将报告这个设备的 {{ic|Vendor_info}} 和 {{ic|Indentification}}。<br />
<br />
如果没有找到设备,检查一切 {{ic|/dev/sr*}} 是否存在,当他们提供了读写权限 ({{ic|wr-}}) 到你的组。<br />
<br />
如果没有 {{ic|/dev/sr*}} 存在,尝试手动[[Kernel modules|加载]]模块 {{ic|sr_mod}}。<br />
<br />
=== 读取 CD/DVD 的卷名 ===<br />
<br />
如果你想获得名称或标签,使用''dd'':<br />
<br />
$ dd if=''/dev/sr0'' bs=1 skip=32808 count=32<br />
<br />
=== 从 CD, DVD 或 BD 中创建 ISO 镜像 ===<br />
<br />
为从介质中拷贝数据,并不让空块填充它,先确定它的块/扇区数量与大小(多数为每个 2048)。<br />
<br />
{{hc|$ isosize -x /dev/sr0|<br />
sector count: 2041796, sector size: 2048<br />
}}<br />
<br />
或<br />
<br />
{{hc|$ isoinfo -d -i /dev/sr0 {{!}} awk '/block size{{!}}Volume size/'|<br />
Logical block size is: 2048<br />
Volume size is: 2041796<br />
}}<br />
<br />
{{Note|别忘记把{{ic|/dev/sr0}}换成你的光驱。}}<br />
<br />
然后用[[dd]]用获得的数据拷出来:<br />
<br />
$ dd if=/dev/sr0 of=discmage.iso bs=''sector_size'' count=''sector_count'' status=progress<br />
<br />
{{Tip|如果介质坏了,建议用类似于 {{Pkg|ddrescue}} 这样的专门工具,见 [[Disk cloning#Using ddrescue]] 。}}<br />
<br />
如果原介质是可启动的,它的拷贝也将是一个可启动镜像。你可能将它用于虚拟机的虚拟光驱或将它烧录到光学介质,这也将是可启动的。 [https://askubuntu.com/questions/147800/ripping-dvd-to-iso-accurately#874945]<br />
<br />
=== 擦除CD-RW和DVD-RW ===<br />
<br />
使用过的CD-RW介质需要在写上以前记录的数据之前被擦除。这可以通过以下方式完成<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
<br />
清空有两个选项:blank=fast 和 blank=all。完全清空的持续时间与完全写操作一样长。它覆盖了光盘上的有效载荷数据。然而这不应该被认为是安全地使这些数据不可读。为了这个目的,建议用随机数据进行几次全写运行。<br />
<br />
替代命令有:<br />
<br />
$ cdrskin -v dev=''/dev/sr0'' blank=fast<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
擦除 DVD-RW 使用 ''dvd+rw-format'' 工具来自 {{Pkg|dvd+rw-tools}}:<br />
<br />
$ dvd+rw-format -blank=fast ''/dev/sr0''<br />
<br />
替代命令有:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
$ cdrskin -v dev=''/dev/sr0'' blank=deformat_sequential_quickest<br />
$ xorriso -outdev ''/dev/sr0'' -blank deformat_quickest<br />
<br />
这种快速消隐的DVD-RW不适合多时段使用,也不能接受未预知长度的输入流。为此,人们必须使用以下方法之一:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=all<br />
$ dvd+rw-format -blank=full ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=as_needed<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
其他媒体类型要么是一次性写入(CD-R、DVD-R、DVD+R、BD-R),要么是无需擦除的可重写(DVD-RAM、DVD+RW、BD-RE)。<br />
<br />
=== 格式化 DVD-RW ===<br />
<br />
格式化过的 DVD-RW 介质可以在不提前擦除的情况下重写。所以考虑在其生命周期内格式化一次。<br />
<br />
$ dvd+rw-format -force ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=format_if_needed<br />
$ xorriso -outdev ''/dev/sr0'' -format as_needed<br />
<br />
不像 DVD-RAM, DVD+RW 和 BD-RE,格式化的 DVD-RW 无法被用于(低速)硬盘直写,而是需要驱动 ptcdvd。见 {{man|8|pktsetup}}。<br />
<br />
=== 格式化 BD-RE 和 BD-R ===<br />
<br />
BD-RE 需要在使用前格式化。当检测到未格式化状态时,烧录程序会自动完成它。然而,数据存储区域的大小可能会受到上述DVD-RW格式命令的影响。<br />
<br />
BD-R 可以是格式化的或非格式化的。非格式化的写入将会全程普通速度写入,并提供最大的存储空间。格式化的可以在写入操作时检查,坏块会从空闲块中被替换。这可能会把速度降到一半于普通速度。普通的格式化会使存储空间下降 768MiB。<br />
<br />
growisofs 默认会格式化 BD-R,其他的不会。growisofs 可不进行格式化。cdrskin 和 xorriso 可以完全速度写入格式化的 BD-RE 或 BD-R:<br />
<br />
$ growisofs -use-the-force-luke=spare:none ...growisofs.or.mkisofs.options...<br />
$ cdrskin stream_recording=on ...cdrecord.options...<br />
$ xorriso -stream_recording on ...xorriso.commands...<br />
<br />
=== 烧录一个 ISO 镜像到 CD、DVD 或 BD。 ===<br />
<br />
为烧录一个 ISO 镜像文件 {{ic|isoimage.iso}} 到光学介质,<br />
为CD: <br />
<br />
$ cdrecord -v -sao dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
为 DVD 或 BD:<br />
<br />
$ growisofs -dvd-compat -Z ''/dev/sr0''=''isoimage.iso''<br />
<br />
为 CD、BD 或 DVD:<br />
<br />
$ xorriso -as cdrecord -v dev=''/dev/sr0'' -dao ''isoimage.iso''<br />
<br />
{{Note|1=<br /><br />
* 当你准备写入时,确保介质未挂载。当介质包含一个可读的文件系统时,管挂载可能是自动的。在最好的情况下,它会防止烧录程序使用烧录设备。在最坏的情况下,可能会因为读取操作弄坏设备。所以,在不能确定的情况下,{{bc|# umount /dev/sr0}}<br />
* ''growisofs'' 有个关于 BD-R 空白介质的[https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=713016 小 bug]。它会报出一个错误信息在烧录完成后。像 ''k3b'' 这样的程序会认为整个烧录过程失败了。为防止这个问题:<br />
** 这样 {{ic|dvd+rw-format ''/dev/sr0''}} 格式化在使用 ''growisofs'' 之前。<br />
** 或用 ''growisofs'' 选项 {{ic|1= -use-the-force-luke=spare:none}}<br />
}}<br />
<br />
=== 验证烧录的ISO镜像 ===<br />
你可以验证烧录的介质的完整性,以确保它不包含错误。在验证之前一定要弹出介质并重新插入。这将保证任何内核缓存不会被用来读取数据。<br />
<br />
首先计算原始ISO镜像的MD5校验值:<br />
<br />
{{hc|$ md5sum isoimage.iso|<br />
e5643e18e05f5646046bb2e4236986d8 isoimage.iso<br />
}}<br />
<br />
之后在介质上为每个 ISO 文件系统计算 MD5。不过一些类型的介质完全提交给烧录程序相同数量的数据,很多其他的尾随的垃圾也会被读取。所以你需要限制为 ISO 镜像文件读取的大小。<br />
<br />
$ blocks=$(expr $(du -b isoimage.iso | awk '{print $1}') / 2048)<br />
<br />
{{hc|1=$ dd if=/dev/sr0 bs=2048 count=$blocks {{!}} md5sum|2=<br />
43992+0 records in<br />
43992+0 records out<br />
90095616 bytes (90 MB, 86 MiB) copied, 0.359539 s, 251 MB/s<br />
e5643e18e05f5646046bb2e4236986d8 -<br />
}}<br />
<br />
每次执行都需要给出相同的 MD5 校验值(这:{{ic|e5643e18e05f5646046bb2e4236986d8}})。如果没有,你可能会一同获得一个 I/O 错误自 {{ic|dd}} 的运行中。当你感兴趣的时候,[[dmesg]] 可能告诉你 SCSI 错误和块编号。<br />
<br />
=== ISO 9660 和运行时烧录 ===<br />
<br />
没有必要存储一个应急的 ISO 文件系统在硬盘,在它写到光学介质前。在写到一个空设备缓冲区的时候,只有极老的 CD 驱动器在极老的电脑上运行会遭受错误。<br />
<br />
如果你省略了 ''mkisofs'' 的 {{ic|-o}} 选项,它将写一个 ISO 镜像到标准输出。这可被用管道导到烧录程序。<br />
<br />
$ mkisofs -V "ARCHIVE_2013_07_27" -J -r ./for_iso | \<br />
cdrecord -v dev=/dev/sr0 -waiti -<br />
<br />
选项 {{ic|-waiti}} 此处并非必须. 它避免 ''cdrecord'' 在 ''mkisofs'' 在其输出前写入到介质。这将允许 ''mkisofs'' 排除干扰的去读取已开始烧录的介质。见关于多会话的下一节。<br />
<br />
在 DVD 和 BD 中, 你可能让 ''growisofs'' 为你操作 ''mkisofs'' 并在运行烧录它的输出:<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
=== 多会话 ===<br />
<br />
ISO-9960 多会话意味着一个介质使用只读文件系统的同时,依然可以在第一个未被使用的块地址写,并且在这个块上会有新的 ISO 树。这个新树协同于新加的或覆写的文件的数据块。数据的块在旧的 ISO 树中的,无法再被写。<br />
<br />
Linux 和其他操作系统将挂载在介质上的最新的会话上的文件夹树。最新的树也将正常的显示旧会话的文件。<br />
<br />
==== Multi-session by cdrecord ====<br />
<br />
CD-R and CD-RW stay writable (aka "appendable") if cdrecord option {{ic|-multi}} was used<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
Then the medium can be inquired for the parameters of the next session<br />
<br />
$ m=$(cdrecord dev=''/dev/sr0'' -msinfo)<br />
<br />
By help of these parameters and of the readable medium in the drive you can produce the add-on ISO session<br />
<br />
$ mkisofs -M ''/dev/sr0'' -C "$m" \<br />
-V "''ARCHIVE_2013_07_28''" -J -r -o ''session2.iso'' ''./more_for_iso''<br />
<br />
Finally append the session to the medium and keep it appendable again<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''session2.iso''<br />
<br />
Programs ''cdrskin'' and ''xorrecord'' do this too with DVD-R, DVD+R, BD-R and unformatted DVD-RW. Program ''cdrecord'' does multi-session with at least DVD-R and DVD-RW. They all do with CD-R and CD-RW, of course.<br />
<br />
Most re-usable media types do not record a session history that would be recognizable for a mounting kernel. But with ISO 9660 it is possible to achieve the multi-session effect even on those media.<br />
<br />
''growisofs'' and ''xorriso'' can do this and hide most of the complexity.<br />
<br />
==== Multi-session by growisofs ====<br />
<br />
By default, ''growisofs'' uses ''mkisofs'' as a backend for creating ISO images forwards most of its program arguments to . See above examples of ''mkisofs''. It bans option {{ic|-o}} and deprecates option {{ic|-C}}. By default it uses the ''mkisofs''. You may specify to use one of the others compatible backend program by setting environment variable {{ic|MKISOFS}}:<br />
<br />
$ export MKISOFS="xorrisofs"<br />
<br />
The wish to begin with a new ISO file system on the optical medium is expressed by option {{ic|-Z}}<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
The wish to append more files as new session to an existing ISO file system is expressed by option {{ic|-M}}<br />
<br />
$ growisofs -M ''/dev/sr0'' -V "''ARCHIVE_2013_07_28''" -r -J ''./more_for_iso''<br />
<br />
For details see the {{man|1|growisofs}} manual and the manuals of ''mkisofs'' and ''xorrisofs''.<br />
<br />
==== Multi-session by xorriso ====<br />
<br />
''xorriso'' learns the wish to begin with a new ISO file system from the blank state of the medium. So it is appropriate to blank it if it contains data. The command {{ic|-blank as_needed}} applies to all kinds of re-usable media and even to ISO images in data files on hard disk. It does not cause error if applied to a blank write-once medium.<br />
<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed \<br />
-volid "''ARCHIVE_2013_07_27''" -joliet on -add ''./for_iso'' --<br />
<br />
On non-blank writable media ''xorriso'' appends the newly given disc files if command {{ic|-dev}} is used rather than {{ic|-outdev}}. Of course, no command {{ic|-blank}} should be given here<br />
<br />
$ xorriso -dev ''/dev/sr0'' \<br />
-volid "''ARCHIVE_2013_07_28''" -joliet on -add ''./more_for_iso'' --<br />
<br />
For details see the {{man|1|xorriso}} man page and especially its examples.<br />
<br />
=== BD Defect Management ===<br />
<br />
BD-RE and formatted BD-R media are normally written with enabled Defect Management. This feature reads the written blocks while they are still stored in the drive buffer. In case of poor read quality the blocks get written again or redirected to the ''Spare Area'' where the data get stored in replacement blocks.<br />
<br />
This checkreading reduces write speed to at most half of the nominal speed of drive and BD medium. Sometimes it is even worse. Heavy use of the Spare Area causes long delays during read operations. So Defect Management is not always desirable.<br />
<br />
''cdrecord'' does not format BD-R. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''growisofs'' formats BD-R by default. The Defect Management can be prevented by option {{ic|1= -use-the-force-luke=spare:none}}. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''cdrskin'', ''xorriso'' and ''xorrecord'' do not format BD-R by default. They do with {{ic|1= cdrskin blank=format_if_needed}}, resp. {{ic|1= xorriso -format as_needed}}, resp. {{ic|1= xorrecord blank=format_overwrite}}. These three programs can disable Defect Management with BD-RE and already formatted BD-R by {{ic|1= cdrskin stream_recording=on}}, resp. {{ic|1= xorriso -stream_recording on}}, resp. {{ic|1= xorrecord stream_recording=on}}.<br />
<br />
=== Burning an audio CD ===<br />
<br />
Create your audio tracks and store them as uncompressed, 16-bit, 44100-Hz, stereo WAV files. To convert MP3 to WAV, ensure {{Pkg|lame}} is installed, ''cd'' to the directory with your MP3 files, and run:<br />
<br />
$ for i in *.mp3; do lame --decode "$i" "$(basename "$i" .mp3)".wav; done<br />
<br />
In case you get an error when trying to burn WAV files converted with LAME, try decoding with {{Pkg|mpg123}}:<br />
<br />
$ for i in *.mp3; do mpg123 --rate 44100 --stereo --buffer 3072 --resync -w $(basename "$i" .mp3).wav $i; done<br />
<br />
To convert AAC to WAV ensure {{Pkg|faad2}} is installed and run:<br />
$ for i in *.m4a; do faad $i; done<br />
<br />
To fix the bitrate of an already existing WAV file (or many other formats), try using {{Pkg|sox}}:<br />
$ for i in *.wav; do sox "$i" -c 2 -r 44100 "$(basename "$i" .wav)"-ok.wav; done<br />
<br />
Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as {{ic|01.wav}}, {{ic|02.wav}}, {{ic|03.wav}}, etc. Use the following command to simulate burning the WAV files as an audio CD:<br />
<br />
$ cdrecord '''-dummy''' -v -pad speed=1 dev=''/dev/sr0'' -dao -swab *.wav<br />
<br />
If everything worked, you can remove the {{ic|-dummy}} flag to actually burn the CD.<br />
<br />
{{Note|The produced disc may not play in all CD players. For an audio-only disc (discarding some track metadata), add the {{ic|-audio}} flag.}}<br />
<br />
To test the new audio CD, use [[MPlayer]]:<br />
<br />
$ mplayer cdda://<br />
<br />
=== Burning a BIN/CUE ===<br />
<br />
To burn a BIN/CUE image run:<br />
<br />
$ cdrdao write --device ''/dev/sr0'' ''image.cue''<br />
<br />
==== TOC/CUE/BIN for mixed-mode discs ====<br />
<br />
ISO images only store a single data track. If you want to create an image of a mixed-mode disc (data track with multiple audio tracks) then you need to make a TOC/BIN pair:<br />
<br />
$ cdrdao read-cd --read-raw --datafile ''image.bin'' --driver generic-mmc:0x20000 --device ''/dev/cdrom'' ''image.toc''<br />
<br />
Some software only likes CUE/BIN pair, you can make a CUE sheet with ''toc2cue'' (part of {{Pkg|cdrdao}}):<br />
<br />
$ toc2cue ''image.toc'' ''image.cue''<br />
<br />
=== Burn backend problems ===<br />
<br />
If you are experiencing problems, you may ask for advise at mailing list [mailto:cdwrite@other.debian.org cdwrite@other.debian.org], or try to write to the one of support mail addresses if some are listed near the end of the program's man page.<br />
<br />
Tell the command lines you tried, the medium type (如 CD-R, DVD+RW, ...), and the symptoms of failure (program messages, disappointed user expectation, ...). You will possibly get asked to obtain the newest release or development version of the affected program and to make test runs. But the answer might as well be, that your drive dislikes the particular medium.<br />
<br />
=== Burning CD/DVD/BD with a GUI ===<br />
<br />
There are several applications available to burn CDs in a graphical environment.<br />
<br />
See also [[Wikipedia:Comparison of disc authoring software]].<br />
<br />
* {{App|[[Wikipedia:AcetoneISO|AcetoneISO]]|All-in-one ISO tool (supports BIN, MDF, NRG, IMG, DAA, DMG, CDI, B5I, BWI, PDI and ISO).|https://sourceforge.net/projects/acetoneiso|{{AUR|acetoneiso2}}}}<br />
* {{App|BashBurn|Lightweight terminal based menu frontend for CD/DVD burning tools.|http://bashburn.dose.se/|{{Pkg|bashburn}}}}<br />
* {{App|[[Wikipedia:Brasero (software)|Brasero]]|Disc burning application for the GNOME desktop that is designed to be as simple as possible.|https://wiki.gnome.org/Apps/Brasero|{{Pkg|brasero}}}}<br />
* {{App|cdw|Ncurses frontend to ''cdrecord'', ''mkisofs'', ''growisofs'', ''dvd+rw-mediainfo'', ''dvd+rw-format'' and ''xorriso''.|http://cdw.sourceforge.net/|{{AUR|cdw}}}}<br />
* {{App|Graveman|GTK-based CD/DVD burning application. It requires configuration to point to correct devices.|https://graveman.tuxfamily.org/|{{AUR|graveman}}}}<br />
* {{App|isomaster|ISO image editor.|http://littlesvr.ca/isomaster|{{AUR|isomaster}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|[[Wikipedia:X-CD-Roast|X-CD-Roast]]|Lightweight ''cdrtools'' front-end for CD and DVD writing.|http://www.xcdroast.org/|{{AUR|xcdroast}}}}<br />
* {{App|[[Wikipedia:Xfce#Xfburn|Xfburn]]|Simple front-end to the libburnia libraries with support for CD/DVD(-RW), ISO images, and BurnFree.|https://docs.xfce.org/apps/xfburn/start|{{Pkg|xfburn}}}}<br />
* {{App|xorriso-tcltk|Graphical front-end to ISO and CD/DVD/BD burn tool xorriso|https://www.gnu.org/software/xorriso/|{{Pkg|libisoburn}}}}<br />
<br />
== Playback ==<br />
<br />
=== CD ===<br />
<br />
CD的音频播放需要{{Pkg|libcdio}} 软件包。为了使KDE应用程序如Dolphin能够读取CD中的音频,你需要安装{{Pkg|audiocd-kio}}。<br />
<br />
=== DVD ===<br />
<br />
If you wish to play encrypted DVDs, you must install the libdvd* packages:<br />
* {{Pkg|libdvdread}}<br />
* {{Pkg|libdvdcss}}<br />
* {{Pkg|libdvdnav}}<br />
<br />
Additionally, you must install player software. Popular DVD players are [[MPlayer]], [[Wikipedia:Xine|xine]] and [[VLC]]. See the [[List of applications/Multimedia#Video players|video players]] list and the specific instructions for [[MPlayer#DVD playing|MPlayer]].<br />
<br />
=== Blu-ray ===<br />
<br />
See [[Blu-ray#Playback]].<br />
<br />
== Ripping ==<br />
<br />
[[Wikipedia:Ripping|Ripping]] is the process of copying audio or video content to a hard disk, typically from removable media or media streams.<br />
<br />
=== Audio CD ===<br />
<br />
==== Console ====<br />
<br />
* {{App|abcde|Comprehensive command-line tool for ripping audio CDs.|https://abcde.einval.com/|{{AUR|abcde}}}}<br />
* {{App|cdda2wav|CD-audio extraction program with paranoia support.|http://www.cdda2wav.de/|{{Pkg|cdrtools}}}}<br />
* {{App|[[Wikipedia:cdparanoia|cdparanoia]]|Compact Disc Digital Audio (CDDA) Digital Audio Extraction (DAE) tool.|https://xiph.org/paranoia/index.html|{{Pkg|cdparanoia}}}}<br />
* {{App|cyanrip|Extensive CD ripper with musicbraniz integration, error detection, log generation, many formats, HDCD decoding, covert art automatic download.|https://github.com/cyanreg/cyanrip/|{{AUR|cyanrip}}}}<br />
* {{App|ripright|Minimal CD ripper modeled on autorip.|https://www.mcternan.me.uk/ripright/|{{AUR|ripright}}}}<br />
* {{App|[[Wikipedia:ripit|ripit]]|Command-line ripper that supports MusicBrainz, freeddb and various codecs. |https://www.ripit.pl/|{{AUR|ripit}}}}<br />
* {{App|shnsplit|Splits .wav and .flac files according to a CUE sheet and encodes the resulting pieces. A useful companion to ABCDE.|http://shnutils.freeshell.org/shntool/|{{AUR|shntool}}}}<br />
* {{App|whipper|CD ripper aiming for accuracy over speed. Uses cdparanoia, MusicBrainz, AccurateRip.|https://github.com/whipper-team/whipper|{{Pkg|whipper}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|[[Wikipedia:Asunder (software)|Asunder]]|GTK-based CD ripping program.|http://littlesvr.ca/asunder/|{{Pkg|asunder}}}}<br />
* {{App|Audex|Audio grabber tool for CD-ROM drives based on KDE.|https://userbase.kde.org/Audex|{{Pkg|audex}}}}<br />
* {{App|[[Wikipedia:Fre:ac|fre:ac]]|Audio converter and CD ripper with support for various popular formats and encoders.|https://freac.org/|{{AUR|freac}}}}<br />
* {{App|Goobox|CD player and ripper for GNOME.|https://people.gnome.org/~paobac/goobox/{{Dead link|2022|09|22|status=404}}|{{Pkg|goobox}}}}<br />
* {{App|[[Wikipedia:Grip (software)|Grip]]|Fast and light CD ripper within the GNOME project that resembles [[Wikipedia:Audiograbber|Audiograbber]].|https://sourceforge.net/projects/grip/|{{AUR|grip}}}}.<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|KAudioCreator|KDE program for ripping and encoding Audio-CDs. Unmaintained and [https://bugs.archlinux.org/task/67618 does not start anymore].|https://invent.kde.org/unmaintained/kaudiocreator|{{AUR|kaudiocreator-git}}}}<br />
* {{App|ripperX|GTK program to rip CD audio tracks and encode them to the Ogg, MP3, or FLAC formats.|https://sourceforge.net/projects/ripperx/|{{AUR|ripperx}}}}<br />
* {{App|rubyripper|Audio disc ripper that tries to deliver a secure rip through multiple rippings of the same track and corrections of any differences.|https://github.com/bleskodev/rubyripper|{{AUR|rubyripper}}}}<br />
* {{App|[[Wikipedia:Sound Juicer|Sound Juicer]]|CD ripper for GNOME.|https://wiki.gnome.org/Apps/SoundJuicer|{{Pkg|sound-juicer}}}}<br />
* {{App|1=soundKonverter|2=Front-end to various audio converters.|3=https://www.linux-apps.com/content/show.php?content=29024|4={{Pkg|soundkonverter}}}}<br />
<br />
=== DVD-Video ===<br />
<br />
See also [[Wikipedia:Comparison of DVD ripper software]].<br />
<br />
Often, the process of ripping a DVD can be broken down into two subtasks:<br />
<br />
# '''Data extraction''' — Copying the audio and/or video data to a hard disk,<br />
# [[Wikipedia:Transcode|Transcoding]] — Converting the extracted data into a suitable format.<br />
<br />
Some utilities perform both tasks, whilst others focus on one aspect or the other.<br />
<br />
==== Console ====<br />
<br />
* {{App|[[dvdbackup]]|Tool for pure data extraction which does not transcode. It is useful for creating ''exact'' copies of encrypted DVDs in conjunction with '''libdvdcss''' or for decrypting video for other utilities unable to read encrypted DVDs.|http://dvdbackup.sourceforge.net/|{{Pkg|dvdbackup}}}}<br />
* {{App|[[FFmpeg]]|Complete and free Internet live audio and video broadcasting solution for Linux/Unix, capable to do a direct rip in any format (audio/video) from a DVD-Video ISO image, just select the input as the ISO image and proceed with the desired options. It also allows to downmixing, shrinking, spliting, selecting streams among other features.|https://ffmpeg.org/|{{Pkg|ffmpeg}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake CLI]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping.|https://handbrake.fr/|{{Pkg|handbrake-cli}}}}<br />
* {{App|[[MEncoder]]|Free command line video decoding, encoding and filtering tool. It supports ripping and transcoding DVD-Video.|http://www.mplayerhq.hu/|{{Pkg|mencoder}}}}<br />
* {{App|subtitleripper|Convert DVD subtitles into text format.|http://subtitleripper.sourceforge.net/|{{AUR|subtitleripper}}}}<br />
* {{App|Transcode|Video/DVD ripper and encoder for the terminal/console. It is [https://www.linuxfromscratch.org/blfs/view/8.3/multimedia/transcode.html outdated/no longer actively maintained].||{{Pkg|transcode}}}}<br />
* {{App|Vobcopy|Copies DVD ''.vob'' files to hard disk, decrypting them on the way.|https://github.com/barak/vobcopy|{{AUR|vobcopy}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|dvd::rip|Front-end to {{Pkg|transcode}}, used to extract DVD's to the hard disk and transcode or extract and transcode on-the-fly.|https://www.exit1.org/dvdrip/|{{AUR|dvdrip}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping. GTK version.|https://handbrake.fr/|{{Pkg|handbrake}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|OGMRip|An application and a set of libraries for ripping and encoding DVD into AVI, OGM, MP4, or Matroska files using a wide variety of codecs. It relies on mplayer, mencoder, ogmtools, mkvtoolnix, mp4box, oggenc, lame, and faac to perform its tasks.|http://ogmrip.sourceforge.net/|{{AUR|ogmrip}}}}<br />
<br />
=== DVD-Audio ===<br />
<br />
* {{App|Python Audio Tools|Includes dvda2track, which is easy to use command line tool to extract DVD-Audio tracks to uncompressed wav files.<br />
|http://audiotools.sourceforge.net/|{{AUR|audiotools}}}}<br />
<br />
=== Multi-format ===<br />
<br />
* {{App|Aaru|Software for archival ripping of CDs, DVDs, and harddrives|https://aaru.app|{{AUR|aaru}}}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Brasero fails to normalize audio CD ===<br />
<br />
If you try to burn it may stop at the first step called Normalization.<br />
<br />
As a workaround you can disable the normalization plugin using the ''Edit > Plugins'' menu<br />
<br />
=== VLC: Error "... could not open the disc /dev/dvd" ===<br />
<br />
If you get an error like<br />
<br />
vlc dvdread could not open the disc "/dev/dvd"<br />
<br />
it may be because there is no device node {{ic|/dev/dvd}} on your system. Udev no longer creates {{ic|/dev/dvd}} and instead uses {{ic|/dev/sr0}}. To fix this, edit the VLC configuration file ({{ic|~/.config/vlc/vlcrc}}):<br />
<br />
# DVD device (string)<br />
dvd=/dev/sr0<br />
<br />
=== DVD drive is noisy ===<br />
<br />
If playing DVD videos causes the system to be very loud, it may be because the disc is spinning faster than it needs to. To temporarily change the speed of the drive, run:<br />
<br />
# eject -x 12 /dev/dvd<br />
<br />
Sometimes:<br />
<br />
# hdparm -E12 /dev/dvd<br />
<br />
Any speed that is supported by the drive can be used, or 0 for the maximum speed.<br />
<br />
[https://michal.kosmulski.org/computing/tips/cd-rom-speed.html Setting CD-ROM and DVD-ROM drive speed]<br />
<br />
=== Playback does not work with new computer (new DVD-Drive) ===<br />
<br />
If playback does not work and you have a new computer (new DVD-Drive) the reason might be that the [[Wikipedia:DVD region code|region code]] is not set. You can read and set the region code with the {{AUR|regionset}} package.<br />
<br />
=== None of the above programs are able to rip/encode a DVD to my hard disk! ===<br />
<br />
Make sure the region of your DVD reader is set correctly; otherwise, you will get loads of inexplicable [[Wikipedia:Content Scramble System|CSS]]-related errors. Use the {{AUR|regionset}} package to do so.<br />
<br />
If ripping still does not work with the correct region set, refer to the [https://videolan.videolan.me/libdvdcss/ libdvdcss developer documentation] for enabling log messages and setting other relevant options.<br />
<br />
=== GUI program log indicates problems with backend program ===<br />
<br />
If you use a GUI program and experience problems which the program's log blames on some backend program, then try to reproduce the problem by the logged backend program arguments.<br />
Whether you succeed with reproducing or not, you may report the logged lines and your own findings to the places mentioned in [[#Burn backend problems]] section.<br />
<br />
==== Special case: medium error / write error ====<br />
<br />
Here are some typical messages about the drive disliking the medium. This can only be solved by using a different drive or a different medium. A different program will hardly help.<br />
<br />
Brasero with backend growisofs:<br />
<br />
BraseroGrowisofs stderr: :-[ WRITE@LBA=0h failed with SK=3h/ASC=0Ch/ACQ=00h]: Input/output error<br />
<br />
Brasero with backend libburn:<br />
<br />
BraseroLibburn Libburn reported an error SCSI error on write(16976,16): [3 0C 00] Write error<br />
<br />
=== BD-R DL 50GB errors on trying to burn second layer ===<br />
<br />
Using ''growisofs'' from {{Pkg|dvd+rw-tools}} for burning 50GB BD-R DL discs might result in a fatal error and damaged media, such as:<br />
<br />
{{hc|$ growisofs -Z /dev/sr0 -J -R -V "label" files|<nowiki><br />
Executing 'mkisofs -J -R -V label files | builtin_dd of=/dev/sr0 obs=32k seek=0'<br />
I: -input-charset not specified, using utf-8 (detected in locale settings)<br />
0.03% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.05% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.08% done, estimate finish Fri Jan 29 19:50:36 2016<br />
/dev/sr0: pre-formatting blank BD-R for 49.8GB...<br />
/dev/sr0: "Current Write Speed" is 8.2x4390KBps.<br />
0.11% done, estimate finish Sat Jan 30 03:29:13 2016<br />
0.13% done, estimate finish Sat Jan 30 02:10:01 2016<br />
...<br />
63.20% done, estimate finish Fri Jan 29 20:43:45 2016<br />
:-[ WRITE@LBA=b6d820h failed with SK=3h/WRITE ERROR]: Input/output error<br />
:-( write failed: Input/output error<br />
/dev/sr0: flushing cache<br />
/dev/sr0: closing track<br />
/dev/sr0: closing session<br />
:-[ CLOSE SESSION failed with SK=5h/INVALID FIELD IN CDB]: Input/output error<br />
/dev/sr0: reloading tray<br />
</nowiki>}}<br />
<br />
This happened at the 25GB boundary when starting to write the second layer. Using ''cdrecord'' from {{Pkg|cdrtools}} works with no problems. Tested with a 'HL-DT-ST BD-RE WH16NS40' LG burner, and Verbatim BD-R DL 6x discs (#96911). {{bug|47797}}<br />
<br />
=== Disc tray autocloses ===<br />
<br />
If after ejecting a cd, either by using the {{ic|eject}} command, or pushing the drive button, the drive disc tray autocloses before being able to remove the disc, try the following command:<br />
<br />
# sysctl -w dev.cdrom.autoclose=0<br />
<br />
If that solves the problem, make the change permanent:<br />
<br />
{{hc|/etc/sysctl.d/60-cdrom-autoclose.conf|2=<br />
dev.cdrom.autoclose = 0<br />
}}<br />
<br />
If the above does not work and as a last resort measure, you can unload the disc module from the kernel via:<br />
<br />
# rmmod sr_mod<br />
<br />
the disc drive should now behave as expected but will not mount disc anymore. After putting a disc into the drive, reactivate the module via:<br />
<br />
# modprobe sr_mod<br />
<br />
the disc should now mount.<br />
<br />
== See also ==<br />
<br />
* In the United States, backup of physically obtained media is allowed under these conditions: [https://www.riaa.com/resources-learning/about-piracy/ About Piracy - RIAA].<br />
* [https://dev.lovelyhq.com/libburnia/web/wiki Main page of the project Libburnia]</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Optical_disc_drive_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=756032Optical disc drive (简体中文)2022-11-06T08:43:40Z<p>InsaneGuo: /* Verifying the burnt ISO image */ // Edit via Wikiplus</p>
<hr />
<div>[[Category:Multimedia (简体中文)]]<br />
[[Category:Optical disc (简体中文)]]<br />
[[es:Optical disc drive]]<br />
[[ja:光学ディスクドライブ]]<br />
{{Related articles start}}<br />
{{Related|Codecs}}<br />
{{Related|MPlayer}}<br />
{{Related|dvdbackup}}<br />
{{Related|MEncoder}}<br />
{{Related|Blu-ray}}<br />
{{Related|Convert any Movie to DVD Video}}<br />
{{Related articles end}}<br />
<br />
来自维基百科:<br />
<br />
在计算机领域,Optical disc drive(ODD)是一种光盘驱动器,它使用激光或可见光频谱内或附近的电磁波作为向光盘读写数据过程的一部分。<br />
<br />
== 刻录 ==<br />
<br />
{{Expansion|Are any command-line tools to arrange files into volumes to fit on a disc (like GAFFitter or cdrkit's dirsplit) packaged for Arch Linux?}}<br />
<br />
{{Warning|The quality of optical drives and the discs themselves varies greatly. Generally, using a slow burn speed is recommended for reliable burns. If you are experiencing unexpected behaviour from the disc, try burning at the lowest speed supported by your burner.}}<br />
<br />
光盘驱动器的刻录过程包括创建或获得一个图像并将其写入光学介质。该镜像原则上可以是任何数据文件。如果你想挂载生成的介质,那么它通常是一个ISO 9660文件系统的镜像文件。音频和多媒体光盘通常是从.bin文件刻录的,在.toc文件或.cue文件的控制下,告诉所需的轨道布局。<br />
<br />
=== 安装刻录工具 ===<br />
<br />
{{Style|Says twice that X is the traditional choice without stating why.}}<br />
<br />
如果你想要使用 GUI 程序,见 [[#Burning CD/DVD/BD with a GUI]]。<br />
<br />
这里列出的程序是面向命令行的。它们是大多数用于CD、DVD和BD的免费GUI程序所使用的后端。当涉及到故障排除或编写刻录活动的脚本时,GUI用户可能会用到它们。<br />
<br />
你至少需要一个创建文件系统镜像的程序和一个能够将数据刻录到你所需要的媒体类型的程序。<br />
<br />
可用于创建ISO9660类型镜像的应用有:<br />
<br />
* {{man|8|mkisofs}} from {{Pkg|cdrtools}}<br />
* {{man|1|xorriso}} and {{man|1|xorrisofs}} from {{Pkg|libisoburn}}<br />
<br />
常见的选择是 ''mkisofs''.<br />
<br />
可用于刻录媒体文件的应用有:<br />
<br />
* {{man|1|cdrdao}} from {{Pkg|cdrdao}} (CD only, TOC/CUE/BIN only)<br />
* {{man|1|cdrecord}} from {{Pkg|cdrtools}}<br />
* {{man|1|cdrskin}} from {{Pkg|libburn}}<br />
* {{man|1|growisofs}} from {{Pkg|dvd+rw-tools}} (DVD and BD only)<br />
* {{man|1|xorriso}} and {{man|1|xorrecord}} from {{Pkg|libisoburn}}<br />
<br />
常见的对于 CD的选择有 ''cdrecord'' 而 对于 DVD 和 Blu-ray Disc的选择有''growisofs'' . For writing TOC/CUE/BIN files to CD, install {{Pkg|cdrdao}}.<br />
<br />
免费的GUI程序至少依赖于一个上述包。<br />
<br />
在这份文档中,''xorrisofs'' 支持 ''mkisofs'' 选项。<br />
<br />
''cdrskin'' 支持 ''cdrecord'' 选项 ; ''xorrecord'' 在不处理音频 CD 时也支持它。<br />
<br />
=== 从已存在的文件构建一个 ISO 镜像 ===<br />
<br />
先将需要的文件拷贝到一个文件夹,是创建一个 ISO 镜像的最简单办法。例如:{{ic|./for.iso}}。<br />
<br />
然后用 ''mkisofs'' 生成这个镜像:<br />
<br />
$ mkisofs -V "''ARCHIVE_2013_07_27''" -J -r -o ''isoimage.iso'' ''./for_iso''<br />
<br />
这些选项在下列的节中被解释。<br />
<br />
==== Basic options ====<br />
<br />
;{{ic|-V}}: (分配给)文件系统的名称。ISO 9660 标准限定了 32 字节的长度,同样,这些字符被限制为:"A"-"Z","0"-"9"以及"_"。卷标签可能展示为挂载点,如果这个介质是被自动挂载的。<br />
;{{ic|-J}}: 启用 [[Wikipedia:Joliet (file system)|Joliet]] 扩展, 允许特定空间用 Unicode 存储文件名称。(最高每个文件 64 UTF-16 字符)。<br />
;{{ic|-joliet-long}}: 增加 Joliet 表命名的最大长度,从 64 到 103 字符。 不符合Joliet规范,通常不受支持。<br />
;{{ic|-r}}: Enables [[Wikipedia:Rock Ridge|Rock Ridge]] 扩展,POSIX 文件系统到一个镜像,包括 255 字符长度的文件名和 Unix 风格文件拓展名。<br />
;{{ic|-o}}: 为输出的 ISO 镜像设置文件路径。<br />
<br />
==== 移植点 ====<br />
<br />
可以让 "mkisofs" 查找文件和目录从制定路径<br />
<br />
$ mkisofs -V "''BACKUP_2013_07_27''" -J -r -o ''backup_2013_07_27.iso'' \<br />
-graft-points \<br />
/photos=/home/''user''/photos \<br />
/mail=/home/''user''/mail \<br />
/photos/holidays=/home/''user''/holidays/photos<br />
<br />
{{ic|-graft-points}} 允许识别由ISO文件系统中的目标地址组成的“路径规范” (如 {{ic|/photos}}) 和源地址 (如 {{ic|/home/user/photos}}). 使用 "=" 字符分隔。<br />
<br />
So this example puts the directories {{ic|/home/user/photos}}, {{ic|/home/user/mail}} and {{ic|/home/user/holidays/photos}}, respectively in the ISO image as {{ic|/photos}}, {{ic|/mail}} and {{ic|/photos/holidays}}.<br />
<br />
Programs ''mkisofs'' and ''xorrisofs'' accept the same options. For secure backups, consider using ''xorrisofs'' with option {{ic|--for_backup}}, which records eventual ACLs and stores an MD5 checksum for each data file.<br />
<br />
See the {{man|8|mkisofs}} and {{man|1|xorrisofs}} man pages for more info about their options.<br />
<br />
=== 挂载一个 ISO 镜像 ===<br />
<br />
你可以挂载一个 ISO 镜像,如果你想要浏览它的文件。<br />
我们可以使用下面的指令挂载一个 ISO 镜像:<br />
<br />
# mount -t iso9660 -o ro,loop ''/path/to/file.iso'' ''/mount-point''<br />
<br />
浏览完毕后,一定记得卸载:<br />
<br />
# umount /mount-point<br />
<br />
无 Root 用户挂载镜像,见 [[Mounting images as user]]。<br />
<br />
=== 转换 img/ccd 到 iso ===<br />
<br />
转换 {{ic|img}}/{{ic|ccd}} 镜像, 你可使用 {{Pkg|ccd2iso}}:<br />
<br />
$ ccd2iso ''~/image.img'' ''~/image.iso''<br />
<br />
=== 知晓你的设备的名称 ===<br />
<br />
为剩余部分,假定你设的记录设备的节为 {{ic|/dev/sr0}}<br />
<br />
用下面的指令检查<br />
<br />
$ cdrecord dev=''/dev/sr0'' -checkdrive<br />
<br />
这将报告这个设备的 {{ic|Vendor_info}} 和 {{ic|Indentification}}。<br />
<br />
如果没有找到设备,检查一切 {{ic|/dev/sr*}} 是否存在,当他们提供了读写权限 ({{ic|wr-}}) 到你的组。<br />
<br />
如果没有 {{ic|/dev/sr*}} 存在,尝试手动[[Kernel modules|加载]]模块 {{ic|sr_mod}}。<br />
<br />
=== 读取 CD/DVD 的卷名 ===<br />
<br />
如果你想获得名称或标签,使用''dd'':<br />
<br />
$ dd if=''/dev/sr0'' bs=1 skip=32808 count=32<br />
<br />
=== Creating an ISO image from a CD, DVD, or BD ===<br />
<br />
In order to only copy actual data from the disc and not the empty blocks filling it up, first retrieve its block/sector count and size (2048 most of the time):<br />
<br />
{{hc|$ isosize -x /dev/sr0|<br />
sector count: 2041796, sector size: 2048<br />
}}<br />
<br />
or alternatively:<br />
<br />
{{hc|$ isoinfo -d -i /dev/sr0 {{!}} awk '/block size{{!}}Volume size/'|<br />
Logical block size is: 2048<br />
Volume size is: 2041796<br />
}}<br />
<br />
{{Note|Do not forget to replace {{ic|/dev/sr0}} with your optical drive device name.}}<br />
<br />
Then use [[dd]] to copy the data using the obtained values:<br />
<br />
$ dd if=/dev/sr0 of=discmage.iso bs=''sector_size'' count=''sector_count'' status=progress<br />
<br />
{{Tip|If the medium is damaged, it is preferable to use a dedicated utility such as {{Pkg|ddrescue}}. See [[Disk cloning#Using ddrescue]].}}<br />
<br />
If the original medium was bootable, then the copy will be a bootable image. You may use it as a pseudo CD for a virtual machine or burn it onto an optical medium which should then become bootable. [https://askubuntu.com/questions/147800/ripping-dvd-to-iso-accurately#874945]<br />
<br />
=== 擦除CD-RW和DVD-RW ===<br />
<br />
使用过的CD-RW介质需要在写上以前记录的数据之前被擦除。这可以通过以下方式完成<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
<br />
清空有两个选项:blank=fast 和 blank=all。完全清空的持续时间与完全写操作一样长。它覆盖了光盘上的有效载荷数据。然而这不应该被认为是安全地使这些数据不可读。为了这个目的,建议用随机数据进行几次全写运行。<br />
<br />
替代命令有:<br />
<br />
$ cdrskin -v dev=''/dev/sr0'' blank=fast<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
擦除 DVD-RW 使用 ''dvd+rw-format'' 工具来自 {{Pkg|dvd+rw-tools}}:<br />
<br />
$ dvd+rw-format -blank=fast ''/dev/sr0''<br />
<br />
替代命令有:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
$ cdrskin -v dev=''/dev/sr0'' blank=deformat_sequential_quickest<br />
$ xorriso -outdev ''/dev/sr0'' -blank deformat_quickest<br />
<br />
这种快速消隐的DVD-RW不适合多时段使用,也不能接受未预知长度的输入流。为此,人们必须使用以下方法之一:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=all<br />
$ dvd+rw-format -blank=full ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=as_needed<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
其他媒体类型要么是一次性写入(CD-R、DVD-R、DVD+R、BD-R),要么是无需擦除的可重写(DVD-RAM、DVD+RW、BD-RE)。<br />
<br />
=== Formatting DVD-RW ===<br />
<br />
Formatted DVD-RW media can be overwritten without previous erasure. So consider to apply once in their life time<br />
<br />
$ dvd+rw-format -force ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=format_if_needed<br />
$ xorriso -outdev ''/dev/sr0'' -format as_needed<br />
<br />
Unlike DVD-RAM, DVD+RW, and BD-RE, formatted DVD-RW cannot be used as (slow) hard disk directly, but rather need the mediation of driver pktcdvd. See {{man|8|pktsetup}}.<br />
<br />
=== Formatting BD-RE and BD-R ===<br />
<br />
BD-RE need formatting before first use. This is done automatically by the burn programs when they detect the unformatted state. Nevertheless the size of the payload area can be influenced by expert versions of the format commands shown above for DVD-RW.<br />
<br />
BD-R can be used unformatted or formatted. Unformatted they are written with full nominal speed and offer maximum storage capacity. Formatted they get checkread during write operations and bad blocks get replaced by blocks from the Spare Area. This reduces write speed to a half or less of nominal speed. The default sized Spare Area reduces the storage capacity by 768 MiB.<br />
<br />
growisofs formats BD-R by default. The others do not. growisofs can be kept from formatting. cdrskin and xorriso can write with full nominal speed on formatted BD-RE or BD-R:<br />
<br />
$ growisofs -use-the-force-luke=spare:none ...growisofs.or.mkisofs.options...<br />
$ cdrskin stream_recording=on ...cdrecord.options...<br />
$ xorriso -stream_recording on ...xorriso.commands...<br />
<br />
=== Burning an ISO image to CD, DVD, or BD ===<br />
<br />
To burn a readily prepared ISO image file {{ic|isoimage.iso}} onto an optical medium, run for CD:<br />
<br />
$ cdrecord -v -sao dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
and for DVD or BD:<br />
<br />
$ growisofs -dvd-compat -Z ''/dev/sr0''=''isoimage.iso''<br />
<br />
for CD, DVD, BD:<br />
<br />
$ xorriso -as cdrecord -v dev=''/dev/sr0'' -dao ''isoimage.iso''<br />
<br />
{{Note|1=<br /><br />
* Make sure that the medium is not mounted when you begin to write to it. Mounting may happen automatically if the medium contains a readable file system. In the best case, it will prevent the burn programs from using the burner device. In the worst case, there will be misburns because read operations disturbed the drive. So if in doubt, do: {{bc|# umount /dev/sr0}}<br />
* ''growisofs'' has a [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=713016 small bug] with blank BD-R media. It issues an error message after the burning is complete. Programs like ''k3b'' then believe the whole burn run failed. To prevent this, either<br />
** format the blank BD-R by {{ic|dvd+rw-format ''/dev/sr0''}} before submitting it to ''growisofs''<br />
** or use ''growisofs'' option {{ic|1= -use-the-force-luke=spare:none}}<br />
}}<br />
<br />
=== 验证烧录的ISO镜像 ===<br />
你可以验证烧录的介质的完整性,以确保它不包含错误。在验证之前一定要弹出介质并重新插入。这将保证任何内核缓存不会被用来读取数据。<br />
<br />
首先计算原始ISO镜像的MD5校验值:<br />
<br />
{{hc|$ md5sum isoimage.iso|<br />
e5643e18e05f5646046bb2e4236986d8 isoimage.iso<br />
}}<br />
<br />
Next calculate the MD5 checksum of the ISO file system on the medium.<br />
Although some media types deliver exactly the same amount of data as have been submitted to the burn program, many others append trailing garbage when being read. So you should restrict reading to the size of the ISO image file.<br />
<br />
$ blocks=$(expr $(du -b isoimage.iso | awk '{print $1}') / 2048)<br />
<br />
{{hc|1=$ dd if=/dev/sr0 bs=2048 count=$blocks {{!}} md5sum|2=<br />
43992+0 records in<br />
43992+0 records out<br />
90095616 bytes (90 MB, 86 MiB) copied, 0.359539 s, 251 MB/s<br />
e5643e18e05f5646046bb2e4236986d8 -<br />
}}<br />
<br />
Both runs should yield the same MD5 checksum (here: {{ic|e5643e18e05f5646046bb2e4236986d8}}). If they do not, you will probably also get an I/O error message from the {{ic|dd}} run. [[dmesg]] might then tell about SCSI errors and block numbers, if you are interested.<br />
<br />
=== ISO 9660 and burning on-the-fly ===<br />
<br />
It is not necessary to store an emerging ISO file system on hard disk before writing it to optical media. Only very old CD drives in very old computers could suffer failed burns due to an empty drive buffer.<br />
<br />
If you omit option {{ic|-o}} from ''mkisofs'' then it writes the ISO image to standard output. This can be piped into the standard input of burn programs.<br />
<br />
$ mkisofs -V "ARCHIVE_2013_07_27" -J -r ./for_iso | \<br />
cdrecord -v dev=/dev/sr0 -waiti -<br />
<br />
Option {{ic|-waiti}} is not really needed here. It prevents ''cdrecord'' from writing to the medium before ''mkisofs'' starts its output. This would allow ''mkisofs'' to read the medium without disturbing an already started burn run. See next section about multi-session.<br />
<br />
On DVD and BD, you may let ''growisofs'' operate ''mkisofs'' for you and burn its output on-the-fly:<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
=== Multi-session ===<br />
<br />
ISO 9660 multi-session means that a medium with readable file system is still writable at its first unused block address, and that a new ISO directory tree gets written to this unused part. The new tree is accompanied by the content blocks of newly added or overwritten data files. The blocks of data files, which shall stay as in the old ISO tree, will not be written again.<br />
<br />
Linux and many other operating systems will mount the directory tree in the last session on the medium. This youngest tree will normally show the files of the older sessions, too.<br />
<br />
==== Multi-session by cdrecord ====<br />
<br />
CD-R and CD-RW stay writable (aka "appendable") if cdrecord option {{ic|-multi}} was used<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
Then the medium can be inquired for the parameters of the next session<br />
<br />
$ m=$(cdrecord dev=''/dev/sr0'' -msinfo)<br />
<br />
By help of these parameters and of the readable medium in the drive you can produce the add-on ISO session<br />
<br />
$ mkisofs -M ''/dev/sr0'' -C "$m" \<br />
-V "''ARCHIVE_2013_07_28''" -J -r -o ''session2.iso'' ''./more_for_iso''<br />
<br />
Finally append the session to the medium and keep it appendable again<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''session2.iso''<br />
<br />
Programs ''cdrskin'' and ''xorrecord'' do this too with DVD-R, DVD+R, BD-R and unformatted DVD-RW. Program ''cdrecord'' does multi-session with at least DVD-R and DVD-RW. They all do with CD-R and CD-RW, of course.<br />
<br />
Most re-usable media types do not record a session history that would be recognizable for a mounting kernel. But with ISO 9660 it is possible to achieve the multi-session effect even on those media.<br />
<br />
''growisofs'' and ''xorriso'' can do this and hide most of the complexity.<br />
<br />
==== Multi-session by growisofs ====<br />
<br />
By default, ''growisofs'' uses ''mkisofs'' as a backend for creating ISO images forwards most of its program arguments to . See above examples of ''mkisofs''. It bans option {{ic|-o}} and deprecates option {{ic|-C}}. By default it uses the ''mkisofs''. You may specify to use one of the others compatible backend program by setting environment variable {{ic|MKISOFS}}:<br />
<br />
$ export MKISOFS="xorrisofs"<br />
<br />
The wish to begin with a new ISO file system on the optical medium is expressed by option {{ic|-Z}}<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
The wish to append more files as new session to an existing ISO file system is expressed by option {{ic|-M}}<br />
<br />
$ growisofs -M ''/dev/sr0'' -V "''ARCHIVE_2013_07_28''" -r -J ''./more_for_iso''<br />
<br />
For details see the {{man|1|growisofs}} manual and the manuals of ''mkisofs'' and ''xorrisofs''.<br />
<br />
==== Multi-session by xorriso ====<br />
<br />
''xorriso'' learns the wish to begin with a new ISO file system from the blank state of the medium. So it is appropriate to blank it if it contains data. The command {{ic|-blank as_needed}} applies to all kinds of re-usable media and even to ISO images in data files on hard disk. It does not cause error if applied to a blank write-once medium.<br />
<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed \<br />
-volid "''ARCHIVE_2013_07_27''" -joliet on -add ''./for_iso'' --<br />
<br />
On non-blank writable media ''xorriso'' appends the newly given disc files if command {{ic|-dev}} is used rather than {{ic|-outdev}}. Of course, no command {{ic|-blank}} should be given here<br />
<br />
$ xorriso -dev ''/dev/sr0'' \<br />
-volid "''ARCHIVE_2013_07_28''" -joliet on -add ''./more_for_iso'' --<br />
<br />
For details see the {{man|1|xorriso}} man page and especially its examples.<br />
<br />
=== BD Defect Management ===<br />
<br />
BD-RE and formatted BD-R media are normally written with enabled Defect Management. This feature reads the written blocks while they are still stored in the drive buffer. In case of poor read quality the blocks get written again or redirected to the ''Spare Area'' where the data get stored in replacement blocks.<br />
<br />
This checkreading reduces write speed to at most half of the nominal speed of drive and BD medium. Sometimes it is even worse. Heavy use of the Spare Area causes long delays during read operations. So Defect Management is not always desirable.<br />
<br />
''cdrecord'' does not format BD-R. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''growisofs'' formats BD-R by default. The Defect Management can be prevented by option {{ic|1= -use-the-force-luke=spare:none}}. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''cdrskin'', ''xorriso'' and ''xorrecord'' do not format BD-R by default. They do with {{ic|1= cdrskin blank=format_if_needed}}, resp. {{ic|1= xorriso -format as_needed}}, resp. {{ic|1= xorrecord blank=format_overwrite}}. These three programs can disable Defect Management with BD-RE and already formatted BD-R by {{ic|1= cdrskin stream_recording=on}}, resp. {{ic|1= xorriso -stream_recording on}}, resp. {{ic|1= xorrecord stream_recording=on}}.<br />
<br />
=== Burning an audio CD ===<br />
<br />
Create your audio tracks and store them as uncompressed, 16-bit, 44100-Hz, stereo WAV files. To convert MP3 to WAV, ensure {{Pkg|lame}} is installed, ''cd'' to the directory with your MP3 files, and run:<br />
<br />
$ for i in *.mp3; do lame --decode "$i" "$(basename "$i" .mp3)".wav; done<br />
<br />
In case you get an error when trying to burn WAV files converted with LAME, try decoding with {{Pkg|mpg123}}:<br />
<br />
$ for i in *.mp3; do mpg123 --rate 44100 --stereo --buffer 3072 --resync -w $(basename "$i" .mp3).wav $i; done<br />
<br />
To convert AAC to WAV ensure {{Pkg|faad2}} is installed and run:<br />
$ for i in *.m4a; do faad $i; done<br />
<br />
To fix the bitrate of an already existing WAV file (or many other formats), try using {{Pkg|sox}}:<br />
$ for i in *.wav; do sox "$i" -c 2 -r 44100 "$(basename "$i" .wav)"-ok.wav; done<br />
<br />
Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as {{ic|01.wav}}, {{ic|02.wav}}, {{ic|03.wav}}, etc. Use the following command to simulate burning the WAV files as an audio CD:<br />
<br />
$ cdrecord '''-dummy''' -v -pad speed=1 dev=''/dev/sr0'' -dao -swab *.wav<br />
<br />
If everything worked, you can remove the {{ic|-dummy}} flag to actually burn the CD.<br />
<br />
{{Note|The produced disc may not play in all CD players. For an audio-only disc (discarding some track metadata), add the {{ic|-audio}} flag.}}<br />
<br />
To test the new audio CD, use [[MPlayer]]:<br />
<br />
$ mplayer cdda://<br />
<br />
=== Burning a BIN/CUE ===<br />
<br />
To burn a BIN/CUE image run:<br />
<br />
$ cdrdao write --device ''/dev/sr0'' ''image.cue''<br />
<br />
==== TOC/CUE/BIN for mixed-mode discs ====<br />
<br />
ISO images only store a single data track. If you want to create an image of a mixed-mode disc (data track with multiple audio tracks) then you need to make a TOC/BIN pair:<br />
<br />
$ cdrdao read-cd --read-raw --datafile ''image.bin'' --driver generic-mmc:0x20000 --device ''/dev/cdrom'' ''image.toc''<br />
<br />
Some software only likes CUE/BIN pair, you can make a CUE sheet with ''toc2cue'' (part of {{Pkg|cdrdao}}):<br />
<br />
$ toc2cue ''image.toc'' ''image.cue''<br />
<br />
=== Burn backend problems ===<br />
<br />
If you are experiencing problems, you may ask for advise at mailing list [mailto:cdwrite@other.debian.org cdwrite@other.debian.org], or try to write to the one of support mail addresses if some are listed near the end of the program's man page.<br />
<br />
Tell the command lines you tried, the medium type (如 CD-R, DVD+RW, ...), and the symptoms of failure (program messages, disappointed user expectation, ...). You will possibly get asked to obtain the newest release or development version of the affected program and to make test runs. But the answer might as well be, that your drive dislikes the particular medium.<br />
<br />
=== Burning CD/DVD/BD with a GUI ===<br />
<br />
There are several applications available to burn CDs in a graphical environment.<br />
<br />
See also [[Wikipedia:Comparison of disc authoring software]].<br />
<br />
* {{App|[[Wikipedia:AcetoneISO|AcetoneISO]]|All-in-one ISO tool (supports BIN, MDF, NRG, IMG, DAA, DMG, CDI, B5I, BWI, PDI and ISO).|https://sourceforge.net/projects/acetoneiso|{{Pkg|acetoneiso2}}}}<br />
* {{App|BashBurn|Lightweight terminal based menu frontend for CD/DVD burning tools.|http://bashburn.dose.se/|{{Pkg|bashburn}}}}<br />
* {{App|[[Wikipedia:Brasero (software)|Brasero]]|Disc burning application for the GNOME desktop that is designed to be as simple as possible.|https://wiki.gnome.org/Apps/Brasero|{{Pkg|brasero}}}}<br />
* {{App|cdw|Ncurses frontend to ''cdrecord'', ''mkisofs'', ''growisofs'', ''dvd+rw-mediainfo'', ''dvd+rw-format'' and ''xorriso''.|http://cdw.sourceforge.net/|{{AUR|cdw}}}}<br />
* {{App|Graveman|GTK-based CD/DVD burning application. It requires configuration to point to correct devices.|https://graveman.tuxfamily.org/|{{AUR|graveman}}}}<br />
* {{App|isomaster|ISO image editor.|http://littlesvr.ca/isomaster|{{AUR|isomaster}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|[[Wikipedia:X-CD-Roast|X-CD-Roast]]|Lightweight ''cdrtools'' front-end for CD and DVD writing.|http://www.xcdroast.org/|{{AUR|xcdroast}}}}<br />
* {{App|[[Wikipedia:Xfce#Xfburn|Xfburn]]|Simple front-end to the libburnia libraries with support for CD/DVD(-RW), ISO images, and BurnFree.|https://docs.xfce.org/apps/xfburn/start|{{Pkg|xfburn}}}}<br />
* {{App|xorriso-tcltk|Graphical front-end to ISO and CD/DVD/BD burn tool xorriso|https://www.gnu.org/software/xorriso/|{{Pkg|libisoburn}}}}<br />
<br />
== Playback ==<br />
<br />
=== CD ===<br />
<br />
Playback of audio CDs requires the {{Pkg|libcdio}} package. To enable KDE Applications like Dolphin to read audio CDs install {{Pkg|audiocd-kio}}.<br />
<br />
=== DVD ===<br />
<br />
If you wish to play encrypted DVDs, you must install the libdvd* packages:<br />
* {{Pkg|libdvdread}}<br />
* {{Pkg|libdvdcss}}<br />
* {{Pkg|libdvdnav}}<br />
<br />
Additionally, you must install player software. Popular DVD players are [[MPlayer]], [[Wikipedia:Xine|xine]] and [[VLC]]. See the [[List of applications/Multimedia#Video players|video players]] list and the specific instructions for [[MPlayer#DVD playing|MPlayer]].<br />
<br />
=== Blu-ray ===<br />
<br />
See [[Blu-ray#Playback]].<br />
<br />
== Ripping ==<br />
<br />
[[Wikipedia:Ripping|Ripping]] is the process of copying audio or video content to a hard disk, typically from removable media or media streams.<br />
<br />
=== Audio CD ===<br />
<br />
==== Console ====<br />
<br />
* {{App|abcde|Comprehensive command-line tool for ripping audio CDs.|https://abcde.einval.com/|{{AUR|abcde}}}}<br />
* {{App|cdda2wav|CD-audio extraction program with paranoia support.|http://www.cdda2wav.de/|{{Pkg|cdrtools}}}}<br />
* {{App|[[Wikipedia:cdparanoia|cdparanoia]]|Compact Disc Digital Audio (CDDA) Digital Audio Extraction (DAE) tool.|https://xiph.org/paranoia/index.html|{{Pkg|cdparanoia}}}}<br />
* {{App|cyanrip|Extensive CD ripper with musicbraniz integration, error detection, log generation, many formats, HDCD decoding, covert art automatic download.|https://github.com/cyanreg/cyanrip/|{{AUR|cyanrip}}}}<br />
* {{App|ripright|Minimal CD ripper modeled on autorip.|https://www.mcternan.me.uk/ripright/|{{AUR|ripright}}}}<br />
* {{App|[[Wikipedia:ripit|ripit]]|Command-line ripper that supports MusicBrainz, freeddb and various codecs. |https://www.ripit.pl/|{{AUR|ripit}}}}<br />
* {{App|shnsplit|Splits .wav and .flac files according to a CUE sheet and encodes the resulting pieces. A useful companion to ABCDE.|http://shnutils.freeshell.org/shntool/|{{AUR|shntool}}}}<br />
* {{App|whipper|CD ripper aiming for accuracy over speed. Uses cdparanoia, MusicBrainz, AccurateRip.|https://github.com/whipper-team/whipper|{{Pkg|whipper}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|[[Wikipedia:Asunder (software)|Asunder]]|GTK-based CD ripping program.|http://littlesvr.ca/asunder/|{{Pkg|asunder}}}}<br />
* {{App|Audex|Audio grabber tool for CD-ROM drives based on KDE.|https://userbase.kde.org/Audex|{{Pkg|audex}}}}<br />
* {{App|[[Wikipedia:Fre:ac|fre:ac]]|Audio converter and CD ripper with support for various popular formats and encoders.|https://freac.org/|{{AUR|freac}}}}<br />
* {{App|Goobox|CD player and ripper for GNOME.|https://people.gnome.org/~paobac/goobox/{{Dead link|2022|09|22|status=404}}|{{Pkg|goobox}}}}<br />
* {{App|[[Wikipedia:Grip (software)|Grip]]|Fast and light CD ripper within the GNOME project that resembles [[Wikipedia:Audiograbber|Audiograbber]].|https://sourceforge.net/projects/grip/|{{AUR|grip}}}}.<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|KAudioCreator|KDE program for ripping and encoding Audio-CDs. Unmaintained and [https://bugs.archlinux.org/task/67618 does not start anymore].|https://invent.kde.org/unmaintained/kaudiocreator|{{AUR|kaudiocreator-git}}}}<br />
* {{App|ripperX|GTK program to rip CD audio tracks and encode them to the Ogg, MP3, or FLAC formats.|https://sourceforge.net/projects/ripperx/|{{AUR|ripperx}}}}<br />
* {{App|rubyripper|Audio disc ripper that tries to deliver a secure rip through multiple rippings of the same track and corrections of any differences.|https://github.com/bleskodev/rubyripper|{{AUR|rubyripper}}}}<br />
* {{App|[[Wikipedia:Sound Juicer|Sound Juicer]]|CD ripper for GNOME.|https://wiki.gnome.org/Apps/SoundJuicer|{{Pkg|sound-juicer}}}}<br />
* {{App|1=soundKonverter|2=Front-end to various audio converters.|3=https://www.linux-apps.com/content/show.php?content=29024|4={{Pkg|soundkonverter}}}}<br />
<br />
=== DVD-Video ===<br />
<br />
See also [[Wikipedia:Comparison of DVD ripper software]].<br />
<br />
Often, the process of ripping a DVD can be broken down into two subtasks:<br />
<br />
# '''Data extraction''' — Copying the audio and/or video data to a hard disk,<br />
# [[Wikipedia:Transcode|Transcoding]] — Converting the extracted data into a suitable format.<br />
<br />
Some utilities perform both tasks, whilst others focus on one aspect or the other.<br />
<br />
==== Console ====<br />
<br />
* {{App|[[dvdbackup]]|Tool for pure data extraction which does not transcode. It is useful for creating ''exact'' copies of encrypted DVDs in conjunction with '''libdvdcss''' or for decrypting video for other utilities unable to read encrypted DVDs.|http://dvdbackup.sourceforge.net/|{{Pkg|dvdbackup}}}}<br />
* {{App|[[FFmpeg]]|Complete and free Internet live audio and video broadcasting solution for Linux/Unix, capable to do a direct rip in any format (audio/video) from a DVD-Video ISO image, just select the input as the ISO image and proceed with the desired options. It also allows to downmixing, shrinking, spliting, selecting streams among other features.|https://ffmpeg.org/|{{Pkg|ffmpeg}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake CLI]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping.|https://handbrake.fr/|{{Pkg|handbrake-cli}}}}<br />
* {{App|[[MEncoder]]|Free command line video decoding, encoding and filtering tool. It supports ripping and transcoding DVD-Video.|http://www.mplayerhq.hu/|{{Pkg|mencoder}}}}<br />
* {{App|subtitleripper|Convert DVD subtitles into text format.|http://subtitleripper.sourceforge.net/|{{AUR|subtitleripper}}}}<br />
* {{App|Transcode|Video/DVD ripper and encoder for the terminal/console. It is [https://www.linuxfromscratch.org/blfs/view/8.3/multimedia/transcode.html outdated/no longer actively maintained].||{{Pkg|transcode}}}}<br />
* {{App|Vobcopy|Copies DVD ''.vob'' files to hard disk, decrypting them on the way.|https://github.com/barak/vobcopy|{{AUR|vobcopy}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|dvd::rip|Front-end to {{Pkg|transcode}}, used to extract DVD's to the hard disk and transcode or extract and transcode on-the-fly.|https://www.exit1.org/dvdrip/|{{AUR|dvdrip}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping. GTK version.|https://handbrake.fr/|{{Pkg|handbrake}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|OGMRip|An application and a set of libraries for ripping and encoding DVD into AVI, OGM, MP4, or Matroska files using a wide variety of codecs. It relies on mplayer, mencoder, ogmtools, mkvtoolnix, mp4box, oggenc, lame, and faac to perform its tasks.|http://ogmrip.sourceforge.net/|{{AUR|ogmrip}}}}<br />
<br />
=== DVD-Audio ===<br />
<br />
* {{App|Python Audio Tools|Includes dvda2track, which is easy to use command line tool to extract DVD-Audio tracks to uncompressed wav files.<br />
|http://audiotools.sourceforge.net/|{{AUR|audiotools}}}}<br />
<br />
=== Multi-format ===<br />
<br />
* {{App|Aaru|Software for archival ripping of CDs, DVDs, and harddrives|https://aaru.app|{{AUR|aaru}}}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Brasero fails to normalize audio CD ===<br />
<br />
If you try to burn it may stop at the first step called Normalization.<br />
<br />
As a workaround you can disable the normalization plugin using the ''Edit > Plugins'' menu<br />
<br />
=== VLC: Error "... could not open the disc /dev/dvd" ===<br />
<br />
If you get an error like<br />
<br />
vlc dvdread could not open the disc "/dev/dvd"<br />
<br />
it may be because there is no device node {{ic|/dev/dvd}} on your system. Udev no longer creates {{ic|/dev/dvd}} and instead uses {{ic|/dev/sr0}}. To fix this, edit the VLC configuration file ({{ic|~/.config/vlc/vlcrc}}):<br />
<br />
# DVD device (string)<br />
dvd=/dev/sr0<br />
<br />
=== DVD drive is noisy ===<br />
<br />
If playing DVD videos causes the system to be very loud, it may be because the disc is spinning faster than it needs to. To temporarily change the speed of the drive, run:<br />
<br />
# eject -x 12 /dev/dvd<br />
<br />
Sometimes:<br />
<br />
# hdparm -E12 /dev/dvd<br />
<br />
Any speed that is supported by the drive can be used, or 0 for the maximum speed.<br />
<br />
[https://michal.kosmulski.org/computing/tips/cd-rom-speed.html Setting CD-ROM and DVD-ROM drive speed]<br />
<br />
=== Playback does not work with new computer (new DVD-Drive) ===<br />
<br />
If playback does not work and you have a new computer (new DVD-Drive) the reason might be that the [[Wikipedia:DVD region code|region code]] is not set. You can read and set the region code with the {{AUR|regionset}} package.<br />
<br />
=== None of the above programs are able to rip/encode a DVD to my hard disk! ===<br />
<br />
Make sure the region of your DVD reader is set correctly; otherwise, you will get loads of inexplicable [[Wikipedia:Content Scramble System|CSS]]-related errors. Use the {{AUR|regionset}} package to do so.<br />
<br />
If ripping still does not work with the correct region set, refer to the [https://videolan.videolan.me/libdvdcss/ libdvdcss developer documentation] for enabling log messages and setting other relevant options.<br />
<br />
=== GUI program log indicates problems with backend program ===<br />
<br />
If you use a GUI program and experience problems which the program's log blames on some backend program, then try to reproduce the problem by the logged backend program arguments.<br />
Whether you succeed with reproducing or not, you may report the logged lines and your own findings to the places mentioned in [[#Burn backend problems]] section.<br />
<br />
==== Special case: medium error / write error ====<br />
<br />
Here are some typical messages about the drive disliking the medium. This can only be solved by using a different drive or a different medium. A different program will hardly help.<br />
<br />
Brasero with backend growisofs:<br />
<br />
BraseroGrowisofs stderr: :-[ WRITE@LBA=0h failed with SK=3h/ASC=0Ch/ACQ=00h]: Input/output error<br />
<br />
Brasero with backend libburn:<br />
<br />
BraseroLibburn Libburn reported an error SCSI error on write(16976,16): [3 0C 00] Write error<br />
<br />
=== BD-R DL 50GB errors on trying to burn second layer ===<br />
<br />
Using ''growisofs'' from {{Pkg|dvd+rw-tools}} for burning 50GB BD-R DL discs might result in a fatal error and damaged media, such as:<br />
<br />
{{hc|$ growisofs -Z /dev/sr0 -J -R -V "label" files|<nowiki><br />
Executing 'mkisofs -J -R -V label files | builtin_dd of=/dev/sr0 obs=32k seek=0'<br />
I: -input-charset not specified, using utf-8 (detected in locale settings)<br />
0.03% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.05% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.08% done, estimate finish Fri Jan 29 19:50:36 2016<br />
/dev/sr0: pre-formatting blank BD-R for 49.8GB...<br />
/dev/sr0: "Current Write Speed" is 8.2x4390KBps.<br />
0.11% done, estimate finish Sat Jan 30 03:29:13 2016<br />
0.13% done, estimate finish Sat Jan 30 02:10:01 2016<br />
...<br />
63.20% done, estimate finish Fri Jan 29 20:43:45 2016<br />
:-[ WRITE@LBA=b6d820h failed with SK=3h/WRITE ERROR]: Input/output error<br />
:-( write failed: Input/output error<br />
/dev/sr0: flushing cache<br />
/dev/sr0: closing track<br />
/dev/sr0: closing session<br />
:-[ CLOSE SESSION failed with SK=5h/INVALID FIELD IN CDB]: Input/output error<br />
/dev/sr0: reloading tray<br />
</nowiki>}}<br />
<br />
This happened at the 25GB boundary when starting to write the second layer. Using ''cdrecord'' from {{Pkg|cdrtools}} works with no problems. Tested with a 'HL-DT-ST BD-RE WH16NS40' LG burner, and Verbatim BD-R DL 6x discs (#96911). {{bug|47797}}<br />
<br />
=== Disc tray autocloses ===<br />
<br />
If after ejecting a cd, either by using the {{ic|eject}} command, or pushing the drive button, the drive disc tray autocloses before being able to remove the disc, try the following command:<br />
<br />
# sysctl -w dev.cdrom.autoclose=0<br />
<br />
If that solves the problem, make the change permanent:<br />
<br />
{{hc|/etc/sysctl.d/60-cdrom-autoclose.conf|2=<br />
dev.cdrom.autoclose = 0<br />
}}<br />
<br />
If the above does not work and as a last resort measure, you can unload the disc module from the kernel via:<br />
<br />
# rmmod sr_mod<br />
<br />
the disc drive should now behave as expected but will not mount disc anymore. After putting a disc into the drive, reactivate the module via:<br />
<br />
# modprobe sr_mod<br />
<br />
the disc should now mount.<br />
<br />
== See also ==<br />
<br />
* In the United States, backup of physically obtained media is allowed under these conditions: [https://www.riaa.com/resources-learning/about-piracy/ About Piracy - RIAA].<br />
* [https://dev.lovelyhq.com/libburnia/web/wiki Main page of the project Libburnia]</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Optical_disc_drive_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=756031Optical disc drive (简体中文)2022-11-06T08:42:37Z<p>InsaneGuo: /* 擦除CD-RW和DVD-RW */ // Edit via Wikiplus</p>
<hr />
<div>[[Category:Multimedia (简体中文)]]<br />
[[Category:Optical disc (简体中文)]]<br />
[[es:Optical disc drive]]<br />
[[ja:光学ディスクドライブ]]<br />
{{Related articles start}}<br />
{{Related|Codecs}}<br />
{{Related|MPlayer}}<br />
{{Related|dvdbackup}}<br />
{{Related|MEncoder}}<br />
{{Related|Blu-ray}}<br />
{{Related|Convert any Movie to DVD Video}}<br />
{{Related articles end}}<br />
<br />
来自维基百科:<br />
<br />
在计算机领域,Optical disc drive(ODD)是一种光盘驱动器,它使用激光或可见光频谱内或附近的电磁波作为向光盘读写数据过程的一部分。<br />
<br />
== 刻录 ==<br />
<br />
{{Expansion|Are any command-line tools to arrange files into volumes to fit on a disc (like GAFFitter or cdrkit's dirsplit) packaged for Arch Linux?}}<br />
<br />
{{Warning|The quality of optical drives and the discs themselves varies greatly. Generally, using a slow burn speed is recommended for reliable burns. If you are experiencing unexpected behaviour from the disc, try burning at the lowest speed supported by your burner.}}<br />
<br />
光盘驱动器的刻录过程包括创建或获得一个图像并将其写入光学介质。该镜像原则上可以是任何数据文件。如果你想挂载生成的介质,那么它通常是一个ISO 9660文件系统的镜像文件。音频和多媒体光盘通常是从.bin文件刻录的,在.toc文件或.cue文件的控制下,告诉所需的轨道布局。<br />
<br />
=== 安装刻录工具 ===<br />
<br />
{{Style|Says twice that X is the traditional choice without stating why.}}<br />
<br />
如果你想要使用 GUI 程序,见 [[#Burning CD/DVD/BD with a GUI]]。<br />
<br />
这里列出的程序是面向命令行的。它们是大多数用于CD、DVD和BD的免费GUI程序所使用的后端。当涉及到故障排除或编写刻录活动的脚本时,GUI用户可能会用到它们。<br />
<br />
你至少需要一个创建文件系统镜像的程序和一个能够将数据刻录到你所需要的媒体类型的程序。<br />
<br />
可用于创建ISO9660类型镜像的应用有:<br />
<br />
* {{man|8|mkisofs}} from {{Pkg|cdrtools}}<br />
* {{man|1|xorriso}} and {{man|1|xorrisofs}} from {{Pkg|libisoburn}}<br />
<br />
常见的选择是 ''mkisofs''.<br />
<br />
可用于刻录媒体文件的应用有:<br />
<br />
* {{man|1|cdrdao}} from {{Pkg|cdrdao}} (CD only, TOC/CUE/BIN only)<br />
* {{man|1|cdrecord}} from {{Pkg|cdrtools}}<br />
* {{man|1|cdrskin}} from {{Pkg|libburn}}<br />
* {{man|1|growisofs}} from {{Pkg|dvd+rw-tools}} (DVD and BD only)<br />
* {{man|1|xorriso}} and {{man|1|xorrecord}} from {{Pkg|libisoburn}}<br />
<br />
常见的对于 CD的选择有 ''cdrecord'' 而 对于 DVD 和 Blu-ray Disc的选择有''growisofs'' . For writing TOC/CUE/BIN files to CD, install {{Pkg|cdrdao}}.<br />
<br />
免费的GUI程序至少依赖于一个上述包。<br />
<br />
在这份文档中,''xorrisofs'' 支持 ''mkisofs'' 选项。<br />
<br />
''cdrskin'' 支持 ''cdrecord'' 选项 ; ''xorrecord'' 在不处理音频 CD 时也支持它。<br />
<br />
=== 从已存在的文件构建一个 ISO 镜像 ===<br />
<br />
先将需要的文件拷贝到一个文件夹,是创建一个 ISO 镜像的最简单办法。例如:{{ic|./for.iso}}。<br />
<br />
然后用 ''mkisofs'' 生成这个镜像:<br />
<br />
$ mkisofs -V "''ARCHIVE_2013_07_27''" -J -r -o ''isoimage.iso'' ''./for_iso''<br />
<br />
这些选项在下列的节中被解释。<br />
<br />
==== Basic options ====<br />
<br />
;{{ic|-V}}: (分配给)文件系统的名称。ISO 9660 标准限定了 32 字节的长度,同样,这些字符被限制为:"A"-"Z","0"-"9"以及"_"。卷标签可能展示为挂载点,如果这个介质是被自动挂载的。<br />
;{{ic|-J}}: 启用 [[Wikipedia:Joliet (file system)|Joliet]] 扩展, 允许特定空间用 Unicode 存储文件名称。(最高每个文件 64 UTF-16 字符)。<br />
;{{ic|-joliet-long}}: 增加 Joliet 表命名的最大长度,从 64 到 103 字符。 不符合Joliet规范,通常不受支持。<br />
;{{ic|-r}}: Enables [[Wikipedia:Rock Ridge|Rock Ridge]] 扩展,POSIX 文件系统到一个镜像,包括 255 字符长度的文件名和 Unix 风格文件拓展名。<br />
;{{ic|-o}}: 为输出的 ISO 镜像设置文件路径。<br />
<br />
==== 移植点 ====<br />
<br />
可以让 "mkisofs" 查找文件和目录从制定路径<br />
<br />
$ mkisofs -V "''BACKUP_2013_07_27''" -J -r -o ''backup_2013_07_27.iso'' \<br />
-graft-points \<br />
/photos=/home/''user''/photos \<br />
/mail=/home/''user''/mail \<br />
/photos/holidays=/home/''user''/holidays/photos<br />
<br />
{{ic|-graft-points}} 允许识别由ISO文件系统中的目标地址组成的“路径规范” (如 {{ic|/photos}}) 和源地址 (如 {{ic|/home/user/photos}}). 使用 "=" 字符分隔。<br />
<br />
So this example puts the directories {{ic|/home/user/photos}}, {{ic|/home/user/mail}} and {{ic|/home/user/holidays/photos}}, respectively in the ISO image as {{ic|/photos}}, {{ic|/mail}} and {{ic|/photos/holidays}}.<br />
<br />
Programs ''mkisofs'' and ''xorrisofs'' accept the same options. For secure backups, consider using ''xorrisofs'' with option {{ic|--for_backup}}, which records eventual ACLs and stores an MD5 checksum for each data file.<br />
<br />
See the {{man|8|mkisofs}} and {{man|1|xorrisofs}} man pages for more info about their options.<br />
<br />
=== 挂载一个 ISO 镜像 ===<br />
<br />
你可以挂载一个 ISO 镜像,如果你想要浏览它的文件。<br />
我们可以使用下面的指令挂载一个 ISO 镜像:<br />
<br />
# mount -t iso9660 -o ro,loop ''/path/to/file.iso'' ''/mount-point''<br />
<br />
浏览完毕后,一定记得卸载:<br />
<br />
# umount /mount-point<br />
<br />
无 Root 用户挂载镜像,见 [[Mounting images as user]]。<br />
<br />
=== 转换 img/ccd 到 iso ===<br />
<br />
转换 {{ic|img}}/{{ic|ccd}} 镜像, 你可使用 {{Pkg|ccd2iso}}:<br />
<br />
$ ccd2iso ''~/image.img'' ''~/image.iso''<br />
<br />
=== 知晓你的设备的名称 ===<br />
<br />
为剩余部分,假定你设的记录设备的节为 {{ic|/dev/sr0}}<br />
<br />
用下面的指令检查<br />
<br />
$ cdrecord dev=''/dev/sr0'' -checkdrive<br />
<br />
这将报告这个设备的 {{ic|Vendor_info}} 和 {{ic|Indentification}}。<br />
<br />
如果没有找到设备,检查一切 {{ic|/dev/sr*}} 是否存在,当他们提供了读写权限 ({{ic|wr-}}) 到你的组。<br />
<br />
如果没有 {{ic|/dev/sr*}} 存在,尝试手动[[Kernel modules|加载]]模块 {{ic|sr_mod}}。<br />
<br />
=== 读取 CD/DVD 的卷名 ===<br />
<br />
如果你想获得名称或标签,使用''dd'':<br />
<br />
$ dd if=''/dev/sr0'' bs=1 skip=32808 count=32<br />
<br />
=== Creating an ISO image from a CD, DVD, or BD ===<br />
<br />
In order to only copy actual data from the disc and not the empty blocks filling it up, first retrieve its block/sector count and size (2048 most of the time):<br />
<br />
{{hc|$ isosize -x /dev/sr0|<br />
sector count: 2041796, sector size: 2048<br />
}}<br />
<br />
or alternatively:<br />
<br />
{{hc|$ isoinfo -d -i /dev/sr0 {{!}} awk '/block size{{!}}Volume size/'|<br />
Logical block size is: 2048<br />
Volume size is: 2041796<br />
}}<br />
<br />
{{Note|Do not forget to replace {{ic|/dev/sr0}} with your optical drive device name.}}<br />
<br />
Then use [[dd]] to copy the data using the obtained values:<br />
<br />
$ dd if=/dev/sr0 of=discmage.iso bs=''sector_size'' count=''sector_count'' status=progress<br />
<br />
{{Tip|If the medium is damaged, it is preferable to use a dedicated utility such as {{Pkg|ddrescue}}. See [[Disk cloning#Using ddrescue]].}}<br />
<br />
If the original medium was bootable, then the copy will be a bootable image. You may use it as a pseudo CD for a virtual machine or burn it onto an optical medium which should then become bootable. [https://askubuntu.com/questions/147800/ripping-dvd-to-iso-accurately#874945]<br />
<br />
=== 擦除CD-RW和DVD-RW ===<br />
<br />
使用过的CD-RW介质需要在写上以前记录的数据之前被擦除。这可以通过以下方式完成<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
<br />
清空有两个选项:blank=fast 和 blank=all。完全清空的持续时间与完全写操作一样长。它覆盖了光盘上的有效载荷数据。然而这不应该被认为是安全地使这些数据不可读。为了这个目的,建议用随机数据进行几次全写运行。<br />
<br />
替代命令有:<br />
<br />
$ cdrskin -v dev=''/dev/sr0'' blank=fast<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
擦除 DVD-RW 使用 ''dvd+rw-format'' 工具来自 {{Pkg|dvd+rw-tools}}:<br />
<br />
$ dvd+rw-format -blank=fast ''/dev/sr0''<br />
<br />
替代命令有:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
$ cdrskin -v dev=''/dev/sr0'' blank=deformat_sequential_quickest<br />
$ xorriso -outdev ''/dev/sr0'' -blank deformat_quickest<br />
<br />
这种快速消隐的DVD-RW不适合多时段使用,也不能接受未预知长度的输入流。为此,人们必须使用以下方法之一:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=all<br />
$ dvd+rw-format -blank=full ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=as_needed<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
其他媒体类型要么是一次性写入(CD-R、DVD-R、DVD+R、BD-R),要么是无需擦除的可重写(DVD-RAM、DVD+RW、BD-RE)。<br />
<br />
=== Formatting DVD-RW ===<br />
<br />
Formatted DVD-RW media can be overwritten without previous erasure. So consider to apply once in their life time<br />
<br />
$ dvd+rw-format -force ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=format_if_needed<br />
$ xorriso -outdev ''/dev/sr0'' -format as_needed<br />
<br />
Unlike DVD-RAM, DVD+RW, and BD-RE, formatted DVD-RW cannot be used as (slow) hard disk directly, but rather need the mediation of driver pktcdvd. See {{man|8|pktsetup}}.<br />
<br />
=== Formatting BD-RE and BD-R ===<br />
<br />
BD-RE need formatting before first use. This is done automatically by the burn programs when they detect the unformatted state. Nevertheless the size of the payload area can be influenced by expert versions of the format commands shown above for DVD-RW.<br />
<br />
BD-R can be used unformatted or formatted. Unformatted they are written with full nominal speed and offer maximum storage capacity. Formatted they get checkread during write operations and bad blocks get replaced by blocks from the Spare Area. This reduces write speed to a half or less of nominal speed. The default sized Spare Area reduces the storage capacity by 768 MiB.<br />
<br />
growisofs formats BD-R by default. The others do not. growisofs can be kept from formatting. cdrskin and xorriso can write with full nominal speed on formatted BD-RE or BD-R:<br />
<br />
$ growisofs -use-the-force-luke=spare:none ...growisofs.or.mkisofs.options...<br />
$ cdrskin stream_recording=on ...cdrecord.options...<br />
$ xorriso -stream_recording on ...xorriso.commands...<br />
<br />
=== Burning an ISO image to CD, DVD, or BD ===<br />
<br />
To burn a readily prepared ISO image file {{ic|isoimage.iso}} onto an optical medium, run for CD:<br />
<br />
$ cdrecord -v -sao dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
and for DVD or BD:<br />
<br />
$ growisofs -dvd-compat -Z ''/dev/sr0''=''isoimage.iso''<br />
<br />
for CD, DVD, BD:<br />
<br />
$ xorriso -as cdrecord -v dev=''/dev/sr0'' -dao ''isoimage.iso''<br />
<br />
{{Note|1=<br /><br />
* Make sure that the medium is not mounted when you begin to write to it. Mounting may happen automatically if the medium contains a readable file system. In the best case, it will prevent the burn programs from using the burner device. In the worst case, there will be misburns because read operations disturbed the drive. So if in doubt, do: {{bc|# umount /dev/sr0}}<br />
* ''growisofs'' has a [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=713016 small bug] with blank BD-R media. It issues an error message after the burning is complete. Programs like ''k3b'' then believe the whole burn run failed. To prevent this, either<br />
** format the blank BD-R by {{ic|dvd+rw-format ''/dev/sr0''}} before submitting it to ''growisofs''<br />
** or use ''growisofs'' option {{ic|1= -use-the-force-luke=spare:none}}<br />
}}<br />
<br />
=== Verifying the burnt ISO image ===<br />
<br />
You can verify the integrity of the burnt medium to make sure it contains no errors. Always eject the medium and reinsert it before verifying. It will guarantee that any kernel cache will not be used to read the data.<br />
<br />
First calculate the MD5 checksum of the original ISO image:<br />
<br />
{{hc|$ md5sum isoimage.iso|<br />
e5643e18e05f5646046bb2e4236986d8 isoimage.iso<br />
}}<br />
<br />
Next calculate the MD5 checksum of the ISO file system on the medium.<br />
Although some media types deliver exactly the same amount of data as have been submitted to the burn program, many others append trailing garbage when being read. So you should restrict reading to the size of the ISO image file.<br />
<br />
$ blocks=$(expr $(du -b isoimage.iso | awk '{print $1}') / 2048)<br />
<br />
{{hc|1=$ dd if=/dev/sr0 bs=2048 count=$blocks {{!}} md5sum|2=<br />
43992+0 records in<br />
43992+0 records out<br />
90095616 bytes (90 MB, 86 MiB) copied, 0.359539 s, 251 MB/s<br />
e5643e18e05f5646046bb2e4236986d8 -<br />
}}<br />
<br />
Both runs should yield the same MD5 checksum (here: {{ic|e5643e18e05f5646046bb2e4236986d8}}). If they do not, you will probably also get an I/O error message from the {{ic|dd}} run. [[dmesg]] might then tell about SCSI errors and block numbers, if you are interested.<br />
<br />
=== ISO 9660 and burning on-the-fly ===<br />
<br />
It is not necessary to store an emerging ISO file system on hard disk before writing it to optical media. Only very old CD drives in very old computers could suffer failed burns due to an empty drive buffer.<br />
<br />
If you omit option {{ic|-o}} from ''mkisofs'' then it writes the ISO image to standard output. This can be piped into the standard input of burn programs.<br />
<br />
$ mkisofs -V "ARCHIVE_2013_07_27" -J -r ./for_iso | \<br />
cdrecord -v dev=/dev/sr0 -waiti -<br />
<br />
Option {{ic|-waiti}} is not really needed here. It prevents ''cdrecord'' from writing to the medium before ''mkisofs'' starts its output. This would allow ''mkisofs'' to read the medium without disturbing an already started burn run. See next section about multi-session.<br />
<br />
On DVD and BD, you may let ''growisofs'' operate ''mkisofs'' for you and burn its output on-the-fly:<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
=== Multi-session ===<br />
<br />
ISO 9660 multi-session means that a medium with readable file system is still writable at its first unused block address, and that a new ISO directory tree gets written to this unused part. The new tree is accompanied by the content blocks of newly added or overwritten data files. The blocks of data files, which shall stay as in the old ISO tree, will not be written again.<br />
<br />
Linux and many other operating systems will mount the directory tree in the last session on the medium. This youngest tree will normally show the files of the older sessions, too.<br />
<br />
==== Multi-session by cdrecord ====<br />
<br />
CD-R and CD-RW stay writable (aka "appendable") if cdrecord option {{ic|-multi}} was used<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
Then the medium can be inquired for the parameters of the next session<br />
<br />
$ m=$(cdrecord dev=''/dev/sr0'' -msinfo)<br />
<br />
By help of these parameters and of the readable medium in the drive you can produce the add-on ISO session<br />
<br />
$ mkisofs -M ''/dev/sr0'' -C "$m" \<br />
-V "''ARCHIVE_2013_07_28''" -J -r -o ''session2.iso'' ''./more_for_iso''<br />
<br />
Finally append the session to the medium and keep it appendable again<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''session2.iso''<br />
<br />
Programs ''cdrskin'' and ''xorrecord'' do this too with DVD-R, DVD+R, BD-R and unformatted DVD-RW. Program ''cdrecord'' does multi-session with at least DVD-R and DVD-RW. They all do with CD-R and CD-RW, of course.<br />
<br />
Most re-usable media types do not record a session history that would be recognizable for a mounting kernel. But with ISO 9660 it is possible to achieve the multi-session effect even on those media.<br />
<br />
''growisofs'' and ''xorriso'' can do this and hide most of the complexity.<br />
<br />
==== Multi-session by growisofs ====<br />
<br />
By default, ''growisofs'' uses ''mkisofs'' as a backend for creating ISO images forwards most of its program arguments to . See above examples of ''mkisofs''. It bans option {{ic|-o}} and deprecates option {{ic|-C}}. By default it uses the ''mkisofs''. You may specify to use one of the others compatible backend program by setting environment variable {{ic|MKISOFS}}:<br />
<br />
$ export MKISOFS="xorrisofs"<br />
<br />
The wish to begin with a new ISO file system on the optical medium is expressed by option {{ic|-Z}}<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
The wish to append more files as new session to an existing ISO file system is expressed by option {{ic|-M}}<br />
<br />
$ growisofs -M ''/dev/sr0'' -V "''ARCHIVE_2013_07_28''" -r -J ''./more_for_iso''<br />
<br />
For details see the {{man|1|growisofs}} manual and the manuals of ''mkisofs'' and ''xorrisofs''.<br />
<br />
==== Multi-session by xorriso ====<br />
<br />
''xorriso'' learns the wish to begin with a new ISO file system from the blank state of the medium. So it is appropriate to blank it if it contains data. The command {{ic|-blank as_needed}} applies to all kinds of re-usable media and even to ISO images in data files on hard disk. It does not cause error if applied to a blank write-once medium.<br />
<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed \<br />
-volid "''ARCHIVE_2013_07_27''" -joliet on -add ''./for_iso'' --<br />
<br />
On non-blank writable media ''xorriso'' appends the newly given disc files if command {{ic|-dev}} is used rather than {{ic|-outdev}}. Of course, no command {{ic|-blank}} should be given here<br />
<br />
$ xorriso -dev ''/dev/sr0'' \<br />
-volid "''ARCHIVE_2013_07_28''" -joliet on -add ''./more_for_iso'' --<br />
<br />
For details see the {{man|1|xorriso}} man page and especially its examples.<br />
<br />
=== BD Defect Management ===<br />
<br />
BD-RE and formatted BD-R media are normally written with enabled Defect Management. This feature reads the written blocks while they are still stored in the drive buffer. In case of poor read quality the blocks get written again or redirected to the ''Spare Area'' where the data get stored in replacement blocks.<br />
<br />
This checkreading reduces write speed to at most half of the nominal speed of drive and BD medium. Sometimes it is even worse. Heavy use of the Spare Area causes long delays during read operations. So Defect Management is not always desirable.<br />
<br />
''cdrecord'' does not format BD-R. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''growisofs'' formats BD-R by default. The Defect Management can be prevented by option {{ic|1= -use-the-force-luke=spare:none}}. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''cdrskin'', ''xorriso'' and ''xorrecord'' do not format BD-R by default. They do with {{ic|1= cdrskin blank=format_if_needed}}, resp. {{ic|1= xorriso -format as_needed}}, resp. {{ic|1= xorrecord blank=format_overwrite}}. These three programs can disable Defect Management with BD-RE and already formatted BD-R by {{ic|1= cdrskin stream_recording=on}}, resp. {{ic|1= xorriso -stream_recording on}}, resp. {{ic|1= xorrecord stream_recording=on}}.<br />
<br />
=== Burning an audio CD ===<br />
<br />
Create your audio tracks and store them as uncompressed, 16-bit, 44100-Hz, stereo WAV files. To convert MP3 to WAV, ensure {{Pkg|lame}} is installed, ''cd'' to the directory with your MP3 files, and run:<br />
<br />
$ for i in *.mp3; do lame --decode "$i" "$(basename "$i" .mp3)".wav; done<br />
<br />
In case you get an error when trying to burn WAV files converted with LAME, try decoding with {{Pkg|mpg123}}:<br />
<br />
$ for i in *.mp3; do mpg123 --rate 44100 --stereo --buffer 3072 --resync -w $(basename "$i" .mp3).wav $i; done<br />
<br />
To convert AAC to WAV ensure {{Pkg|faad2}} is installed and run:<br />
$ for i in *.m4a; do faad $i; done<br />
<br />
To fix the bitrate of an already existing WAV file (or many other formats), try using {{Pkg|sox}}:<br />
$ for i in *.wav; do sox "$i" -c 2 -r 44100 "$(basename "$i" .wav)"-ok.wav; done<br />
<br />
Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as {{ic|01.wav}}, {{ic|02.wav}}, {{ic|03.wav}}, etc. Use the following command to simulate burning the WAV files as an audio CD:<br />
<br />
$ cdrecord '''-dummy''' -v -pad speed=1 dev=''/dev/sr0'' -dao -swab *.wav<br />
<br />
If everything worked, you can remove the {{ic|-dummy}} flag to actually burn the CD.<br />
<br />
{{Note|The produced disc may not play in all CD players. For an audio-only disc (discarding some track metadata), add the {{ic|-audio}} flag.}}<br />
<br />
To test the new audio CD, use [[MPlayer]]:<br />
<br />
$ mplayer cdda://<br />
<br />
=== Burning a BIN/CUE ===<br />
<br />
To burn a BIN/CUE image run:<br />
<br />
$ cdrdao write --device ''/dev/sr0'' ''image.cue''<br />
<br />
==== TOC/CUE/BIN for mixed-mode discs ====<br />
<br />
ISO images only store a single data track. If you want to create an image of a mixed-mode disc (data track with multiple audio tracks) then you need to make a TOC/BIN pair:<br />
<br />
$ cdrdao read-cd --read-raw --datafile ''image.bin'' --driver generic-mmc:0x20000 --device ''/dev/cdrom'' ''image.toc''<br />
<br />
Some software only likes CUE/BIN pair, you can make a CUE sheet with ''toc2cue'' (part of {{Pkg|cdrdao}}):<br />
<br />
$ toc2cue ''image.toc'' ''image.cue''<br />
<br />
=== Burn backend problems ===<br />
<br />
If you are experiencing problems, you may ask for advise at mailing list [mailto:cdwrite@other.debian.org cdwrite@other.debian.org], or try to write to the one of support mail addresses if some are listed near the end of the program's man page.<br />
<br />
Tell the command lines you tried, the medium type (如 CD-R, DVD+RW, ...), and the symptoms of failure (program messages, disappointed user expectation, ...). You will possibly get asked to obtain the newest release or development version of the affected program and to make test runs. But the answer might as well be, that your drive dislikes the particular medium.<br />
<br />
=== Burning CD/DVD/BD with a GUI ===<br />
<br />
There are several applications available to burn CDs in a graphical environment.<br />
<br />
See also [[Wikipedia:Comparison of disc authoring software]].<br />
<br />
* {{App|[[Wikipedia:AcetoneISO|AcetoneISO]]|All-in-one ISO tool (supports BIN, MDF, NRG, IMG, DAA, DMG, CDI, B5I, BWI, PDI and ISO).|https://sourceforge.net/projects/acetoneiso|{{Pkg|acetoneiso2}}}}<br />
* {{App|BashBurn|Lightweight terminal based menu frontend for CD/DVD burning tools.|http://bashburn.dose.se/|{{Pkg|bashburn}}}}<br />
* {{App|[[Wikipedia:Brasero (software)|Brasero]]|Disc burning application for the GNOME desktop that is designed to be as simple as possible.|https://wiki.gnome.org/Apps/Brasero|{{Pkg|brasero}}}}<br />
* {{App|cdw|Ncurses frontend to ''cdrecord'', ''mkisofs'', ''growisofs'', ''dvd+rw-mediainfo'', ''dvd+rw-format'' and ''xorriso''.|http://cdw.sourceforge.net/|{{AUR|cdw}}}}<br />
* {{App|Graveman|GTK-based CD/DVD burning application. It requires configuration to point to correct devices.|https://graveman.tuxfamily.org/|{{AUR|graveman}}}}<br />
* {{App|isomaster|ISO image editor.|http://littlesvr.ca/isomaster|{{AUR|isomaster}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|[[Wikipedia:X-CD-Roast|X-CD-Roast]]|Lightweight ''cdrtools'' front-end for CD and DVD writing.|http://www.xcdroast.org/|{{AUR|xcdroast}}}}<br />
* {{App|[[Wikipedia:Xfce#Xfburn|Xfburn]]|Simple front-end to the libburnia libraries with support for CD/DVD(-RW), ISO images, and BurnFree.|https://docs.xfce.org/apps/xfburn/start|{{Pkg|xfburn}}}}<br />
* {{App|xorriso-tcltk|Graphical front-end to ISO and CD/DVD/BD burn tool xorriso|https://www.gnu.org/software/xorriso/|{{Pkg|libisoburn}}}}<br />
<br />
== Playback ==<br />
<br />
=== CD ===<br />
<br />
Playback of audio CDs requires the {{Pkg|libcdio}} package. To enable KDE Applications like Dolphin to read audio CDs install {{Pkg|audiocd-kio}}.<br />
<br />
=== DVD ===<br />
<br />
If you wish to play encrypted DVDs, you must install the libdvd* packages:<br />
* {{Pkg|libdvdread}}<br />
* {{Pkg|libdvdcss}}<br />
* {{Pkg|libdvdnav}}<br />
<br />
Additionally, you must install player software. Popular DVD players are [[MPlayer]], [[Wikipedia:Xine|xine]] and [[VLC]]. See the [[List of applications/Multimedia#Video players|video players]] list and the specific instructions for [[MPlayer#DVD playing|MPlayer]].<br />
<br />
=== Blu-ray ===<br />
<br />
See [[Blu-ray#Playback]].<br />
<br />
== Ripping ==<br />
<br />
[[Wikipedia:Ripping|Ripping]] is the process of copying audio or video content to a hard disk, typically from removable media or media streams.<br />
<br />
=== Audio CD ===<br />
<br />
==== Console ====<br />
<br />
* {{App|abcde|Comprehensive command-line tool for ripping audio CDs.|https://abcde.einval.com/|{{AUR|abcde}}}}<br />
* {{App|cdda2wav|CD-audio extraction program with paranoia support.|http://www.cdda2wav.de/|{{Pkg|cdrtools}}}}<br />
* {{App|[[Wikipedia:cdparanoia|cdparanoia]]|Compact Disc Digital Audio (CDDA) Digital Audio Extraction (DAE) tool.|https://xiph.org/paranoia/index.html|{{Pkg|cdparanoia}}}}<br />
* {{App|cyanrip|Extensive CD ripper with musicbraniz integration, error detection, log generation, many formats, HDCD decoding, covert art automatic download.|https://github.com/cyanreg/cyanrip/|{{AUR|cyanrip}}}}<br />
* {{App|ripright|Minimal CD ripper modeled on autorip.|https://www.mcternan.me.uk/ripright/|{{AUR|ripright}}}}<br />
* {{App|[[Wikipedia:ripit|ripit]]|Command-line ripper that supports MusicBrainz, freeddb and various codecs. |https://www.ripit.pl/|{{AUR|ripit}}}}<br />
* {{App|shnsplit|Splits .wav and .flac files according to a CUE sheet and encodes the resulting pieces. A useful companion to ABCDE.|http://shnutils.freeshell.org/shntool/|{{AUR|shntool}}}}<br />
* {{App|whipper|CD ripper aiming for accuracy over speed. Uses cdparanoia, MusicBrainz, AccurateRip.|https://github.com/whipper-team/whipper|{{Pkg|whipper}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|[[Wikipedia:Asunder (software)|Asunder]]|GTK-based CD ripping program.|http://littlesvr.ca/asunder/|{{Pkg|asunder}}}}<br />
* {{App|Audex|Audio grabber tool for CD-ROM drives based on KDE.|https://userbase.kde.org/Audex|{{Pkg|audex}}}}<br />
* {{App|[[Wikipedia:Fre:ac|fre:ac]]|Audio converter and CD ripper with support for various popular formats and encoders.|https://freac.org/|{{AUR|freac}}}}<br />
* {{App|Goobox|CD player and ripper for GNOME.|https://people.gnome.org/~paobac/goobox/{{Dead link|2022|09|22|status=404}}|{{Pkg|goobox}}}}<br />
* {{App|[[Wikipedia:Grip (software)|Grip]]|Fast and light CD ripper within the GNOME project that resembles [[Wikipedia:Audiograbber|Audiograbber]].|https://sourceforge.net/projects/grip/|{{AUR|grip}}}}.<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|KAudioCreator|KDE program for ripping and encoding Audio-CDs. Unmaintained and [https://bugs.archlinux.org/task/67618 does not start anymore].|https://invent.kde.org/unmaintained/kaudiocreator|{{AUR|kaudiocreator-git}}}}<br />
* {{App|ripperX|GTK program to rip CD audio tracks and encode them to the Ogg, MP3, or FLAC formats.|https://sourceforge.net/projects/ripperx/|{{AUR|ripperx}}}}<br />
* {{App|rubyripper|Audio disc ripper that tries to deliver a secure rip through multiple rippings of the same track and corrections of any differences.|https://github.com/bleskodev/rubyripper|{{AUR|rubyripper}}}}<br />
* {{App|[[Wikipedia:Sound Juicer|Sound Juicer]]|CD ripper for GNOME.|https://wiki.gnome.org/Apps/SoundJuicer|{{Pkg|sound-juicer}}}}<br />
* {{App|1=soundKonverter|2=Front-end to various audio converters.|3=https://www.linux-apps.com/content/show.php?content=29024|4={{Pkg|soundkonverter}}}}<br />
<br />
=== DVD-Video ===<br />
<br />
See also [[Wikipedia:Comparison of DVD ripper software]].<br />
<br />
Often, the process of ripping a DVD can be broken down into two subtasks:<br />
<br />
# '''Data extraction''' — Copying the audio and/or video data to a hard disk,<br />
# [[Wikipedia:Transcode|Transcoding]] — Converting the extracted data into a suitable format.<br />
<br />
Some utilities perform both tasks, whilst others focus on one aspect or the other.<br />
<br />
==== Console ====<br />
<br />
* {{App|[[dvdbackup]]|Tool for pure data extraction which does not transcode. It is useful for creating ''exact'' copies of encrypted DVDs in conjunction with '''libdvdcss''' or for decrypting video for other utilities unable to read encrypted DVDs.|http://dvdbackup.sourceforge.net/|{{Pkg|dvdbackup}}}}<br />
* {{App|[[FFmpeg]]|Complete and free Internet live audio and video broadcasting solution for Linux/Unix, capable to do a direct rip in any format (audio/video) from a DVD-Video ISO image, just select the input as the ISO image and proceed with the desired options. It also allows to downmixing, shrinking, spliting, selecting streams among other features.|https://ffmpeg.org/|{{Pkg|ffmpeg}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake CLI]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping.|https://handbrake.fr/|{{Pkg|handbrake-cli}}}}<br />
* {{App|[[MEncoder]]|Free command line video decoding, encoding and filtering tool. It supports ripping and transcoding DVD-Video.|http://www.mplayerhq.hu/|{{Pkg|mencoder}}}}<br />
* {{App|subtitleripper|Convert DVD subtitles into text format.|http://subtitleripper.sourceforge.net/|{{AUR|subtitleripper}}}}<br />
* {{App|Transcode|Video/DVD ripper and encoder for the terminal/console. It is [https://www.linuxfromscratch.org/blfs/view/8.3/multimedia/transcode.html outdated/no longer actively maintained].||{{Pkg|transcode}}}}<br />
* {{App|Vobcopy|Copies DVD ''.vob'' files to hard disk, decrypting them on the way.|https://github.com/barak/vobcopy|{{AUR|vobcopy}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|dvd::rip|Front-end to {{Pkg|transcode}}, used to extract DVD's to the hard disk and transcode or extract and transcode on-the-fly.|https://www.exit1.org/dvdrip/|{{AUR|dvdrip}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping. GTK version.|https://handbrake.fr/|{{Pkg|handbrake}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|OGMRip|An application and a set of libraries for ripping and encoding DVD into AVI, OGM, MP4, or Matroska files using a wide variety of codecs. It relies on mplayer, mencoder, ogmtools, mkvtoolnix, mp4box, oggenc, lame, and faac to perform its tasks.|http://ogmrip.sourceforge.net/|{{AUR|ogmrip}}}}<br />
<br />
=== DVD-Audio ===<br />
<br />
* {{App|Python Audio Tools|Includes dvda2track, which is easy to use command line tool to extract DVD-Audio tracks to uncompressed wav files.<br />
|http://audiotools.sourceforge.net/|{{AUR|audiotools}}}}<br />
<br />
=== Multi-format ===<br />
<br />
* {{App|Aaru|Software for archival ripping of CDs, DVDs, and harddrives|https://aaru.app|{{AUR|aaru}}}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Brasero fails to normalize audio CD ===<br />
<br />
If you try to burn it may stop at the first step called Normalization.<br />
<br />
As a workaround you can disable the normalization plugin using the ''Edit > Plugins'' menu<br />
<br />
=== VLC: Error "... could not open the disc /dev/dvd" ===<br />
<br />
If you get an error like<br />
<br />
vlc dvdread could not open the disc "/dev/dvd"<br />
<br />
it may be because there is no device node {{ic|/dev/dvd}} on your system. Udev no longer creates {{ic|/dev/dvd}} and instead uses {{ic|/dev/sr0}}. To fix this, edit the VLC configuration file ({{ic|~/.config/vlc/vlcrc}}):<br />
<br />
# DVD device (string)<br />
dvd=/dev/sr0<br />
<br />
=== DVD drive is noisy ===<br />
<br />
If playing DVD videos causes the system to be very loud, it may be because the disc is spinning faster than it needs to. To temporarily change the speed of the drive, run:<br />
<br />
# eject -x 12 /dev/dvd<br />
<br />
Sometimes:<br />
<br />
# hdparm -E12 /dev/dvd<br />
<br />
Any speed that is supported by the drive can be used, or 0 for the maximum speed.<br />
<br />
[https://michal.kosmulski.org/computing/tips/cd-rom-speed.html Setting CD-ROM and DVD-ROM drive speed]<br />
<br />
=== Playback does not work with new computer (new DVD-Drive) ===<br />
<br />
If playback does not work and you have a new computer (new DVD-Drive) the reason might be that the [[Wikipedia:DVD region code|region code]] is not set. You can read and set the region code with the {{AUR|regionset}} package.<br />
<br />
=== None of the above programs are able to rip/encode a DVD to my hard disk! ===<br />
<br />
Make sure the region of your DVD reader is set correctly; otherwise, you will get loads of inexplicable [[Wikipedia:Content Scramble System|CSS]]-related errors. Use the {{AUR|regionset}} package to do so.<br />
<br />
If ripping still does not work with the correct region set, refer to the [https://videolan.videolan.me/libdvdcss/ libdvdcss developer documentation] for enabling log messages and setting other relevant options.<br />
<br />
=== GUI program log indicates problems with backend program ===<br />
<br />
If you use a GUI program and experience problems which the program's log blames on some backend program, then try to reproduce the problem by the logged backend program arguments.<br />
Whether you succeed with reproducing or not, you may report the logged lines and your own findings to the places mentioned in [[#Burn backend problems]] section.<br />
<br />
==== Special case: medium error / write error ====<br />
<br />
Here are some typical messages about the drive disliking the medium. This can only be solved by using a different drive or a different medium. A different program will hardly help.<br />
<br />
Brasero with backend growisofs:<br />
<br />
BraseroGrowisofs stderr: :-[ WRITE@LBA=0h failed with SK=3h/ASC=0Ch/ACQ=00h]: Input/output error<br />
<br />
Brasero with backend libburn:<br />
<br />
BraseroLibburn Libburn reported an error SCSI error on write(16976,16): [3 0C 00] Write error<br />
<br />
=== BD-R DL 50GB errors on trying to burn second layer ===<br />
<br />
Using ''growisofs'' from {{Pkg|dvd+rw-tools}} for burning 50GB BD-R DL discs might result in a fatal error and damaged media, such as:<br />
<br />
{{hc|$ growisofs -Z /dev/sr0 -J -R -V "label" files|<nowiki><br />
Executing 'mkisofs -J -R -V label files | builtin_dd of=/dev/sr0 obs=32k seek=0'<br />
I: -input-charset not specified, using utf-8 (detected in locale settings)<br />
0.03% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.05% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.08% done, estimate finish Fri Jan 29 19:50:36 2016<br />
/dev/sr0: pre-formatting blank BD-R for 49.8GB...<br />
/dev/sr0: "Current Write Speed" is 8.2x4390KBps.<br />
0.11% done, estimate finish Sat Jan 30 03:29:13 2016<br />
0.13% done, estimate finish Sat Jan 30 02:10:01 2016<br />
...<br />
63.20% done, estimate finish Fri Jan 29 20:43:45 2016<br />
:-[ WRITE@LBA=b6d820h failed with SK=3h/WRITE ERROR]: Input/output error<br />
:-( write failed: Input/output error<br />
/dev/sr0: flushing cache<br />
/dev/sr0: closing track<br />
/dev/sr0: closing session<br />
:-[ CLOSE SESSION failed with SK=5h/INVALID FIELD IN CDB]: Input/output error<br />
/dev/sr0: reloading tray<br />
</nowiki>}}<br />
<br />
This happened at the 25GB boundary when starting to write the second layer. Using ''cdrecord'' from {{Pkg|cdrtools}} works with no problems. Tested with a 'HL-DT-ST BD-RE WH16NS40' LG burner, and Verbatim BD-R DL 6x discs (#96911). {{bug|47797}}<br />
<br />
=== Disc tray autocloses ===<br />
<br />
If after ejecting a cd, either by using the {{ic|eject}} command, or pushing the drive button, the drive disc tray autocloses before being able to remove the disc, try the following command:<br />
<br />
# sysctl -w dev.cdrom.autoclose=0<br />
<br />
If that solves the problem, make the change permanent:<br />
<br />
{{hc|/etc/sysctl.d/60-cdrom-autoclose.conf|2=<br />
dev.cdrom.autoclose = 0<br />
}}<br />
<br />
If the above does not work and as a last resort measure, you can unload the disc module from the kernel via:<br />
<br />
# rmmod sr_mod<br />
<br />
the disc drive should now behave as expected but will not mount disc anymore. After putting a disc into the drive, reactivate the module via:<br />
<br />
# modprobe sr_mod<br />
<br />
the disc should now mount.<br />
<br />
== See also ==<br />
<br />
* In the United States, backup of physically obtained media is allowed under these conditions: [https://www.riaa.com/resources-learning/about-piracy/ About Piracy - RIAA].<br />
* [https://dev.lovelyhq.com/libburnia/web/wiki Main page of the project Libburnia]</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Optical_disc_drive_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=756030Optical disc drive (简体中文)2022-11-06T08:41:45Z<p>InsaneGuo: /* Erasing CD-RW and DVD-RW */ // Edit via Wikiplus</p>
<hr />
<div>[[Category:Multimedia (简体中文)]]<br />
[[Category:Optical disc (简体中文)]]<br />
[[es:Optical disc drive]]<br />
[[ja:光学ディスクドライブ]]<br />
{{Related articles start}}<br />
{{Related|Codecs}}<br />
{{Related|MPlayer}}<br />
{{Related|dvdbackup}}<br />
{{Related|MEncoder}}<br />
{{Related|Blu-ray}}<br />
{{Related|Convert any Movie to DVD Video}}<br />
{{Related articles end}}<br />
<br />
来自维基百科:<br />
<br />
在计算机领域,Optical disc drive(ODD)是一种光盘驱动器,它使用激光或可见光频谱内或附近的电磁波作为向光盘读写数据过程的一部分。<br />
<br />
== 刻录 ==<br />
<br />
{{Expansion|Are any command-line tools to arrange files into volumes to fit on a disc (like GAFFitter or cdrkit's dirsplit) packaged for Arch Linux?}}<br />
<br />
{{Warning|The quality of optical drives and the discs themselves varies greatly. Generally, using a slow burn speed is recommended for reliable burns. If you are experiencing unexpected behaviour from the disc, try burning at the lowest speed supported by your burner.}}<br />
<br />
光盘驱动器的刻录过程包括创建或获得一个图像并将其写入光学介质。该镜像原则上可以是任何数据文件。如果你想挂载生成的介质,那么它通常是一个ISO 9660文件系统的镜像文件。音频和多媒体光盘通常是从.bin文件刻录的,在.toc文件或.cue文件的控制下,告诉所需的轨道布局。<br />
<br />
=== 安装刻录工具 ===<br />
<br />
{{Style|Says twice that X is the traditional choice without stating why.}}<br />
<br />
如果你想要使用 GUI 程序,见 [[#Burning CD/DVD/BD with a GUI]]。<br />
<br />
这里列出的程序是面向命令行的。它们是大多数用于CD、DVD和BD的免费GUI程序所使用的后端。当涉及到故障排除或编写刻录活动的脚本时,GUI用户可能会用到它们。<br />
<br />
你至少需要一个创建文件系统镜像的程序和一个能够将数据刻录到你所需要的媒体类型的程序。<br />
<br />
可用于创建ISO9660类型镜像的应用有:<br />
<br />
* {{man|8|mkisofs}} from {{Pkg|cdrtools}}<br />
* {{man|1|xorriso}} and {{man|1|xorrisofs}} from {{Pkg|libisoburn}}<br />
<br />
常见的选择是 ''mkisofs''.<br />
<br />
可用于刻录媒体文件的应用有:<br />
<br />
* {{man|1|cdrdao}} from {{Pkg|cdrdao}} (CD only, TOC/CUE/BIN only)<br />
* {{man|1|cdrecord}} from {{Pkg|cdrtools}}<br />
* {{man|1|cdrskin}} from {{Pkg|libburn}}<br />
* {{man|1|growisofs}} from {{Pkg|dvd+rw-tools}} (DVD and BD only)<br />
* {{man|1|xorriso}} and {{man|1|xorrecord}} from {{Pkg|libisoburn}}<br />
<br />
常见的对于 CD的选择有 ''cdrecord'' 而 对于 DVD 和 Blu-ray Disc的选择有''growisofs'' . For writing TOC/CUE/BIN files to CD, install {{Pkg|cdrdao}}.<br />
<br />
免费的GUI程序至少依赖于一个上述包。<br />
<br />
在这份文档中,''xorrisofs'' 支持 ''mkisofs'' 选项。<br />
<br />
''cdrskin'' 支持 ''cdrecord'' 选项 ; ''xorrecord'' 在不处理音频 CD 时也支持它。<br />
<br />
=== 从已存在的文件构建一个 ISO 镜像 ===<br />
<br />
先将需要的文件拷贝到一个文件夹,是创建一个 ISO 镜像的最简单办法。例如:{{ic|./for.iso}}。<br />
<br />
然后用 ''mkisofs'' 生成这个镜像:<br />
<br />
$ mkisofs -V "''ARCHIVE_2013_07_27''" -J -r -o ''isoimage.iso'' ''./for_iso''<br />
<br />
这些选项在下列的节中被解释。<br />
<br />
==== Basic options ====<br />
<br />
;{{ic|-V}}: (分配给)文件系统的名称。ISO 9660 标准限定了 32 字节的长度,同样,这些字符被限制为:"A"-"Z","0"-"9"以及"_"。卷标签可能展示为挂载点,如果这个介质是被自动挂载的。<br />
;{{ic|-J}}: 启用 [[Wikipedia:Joliet (file system)|Joliet]] 扩展, 允许特定空间用 Unicode 存储文件名称。(最高每个文件 64 UTF-16 字符)。<br />
;{{ic|-joliet-long}}: 增加 Joliet 表命名的最大长度,从 64 到 103 字符。 不符合Joliet规范,通常不受支持。<br />
;{{ic|-r}}: Enables [[Wikipedia:Rock Ridge|Rock Ridge]] 扩展,POSIX 文件系统到一个镜像,包括 255 字符长度的文件名和 Unix 风格文件拓展名。<br />
;{{ic|-o}}: 为输出的 ISO 镜像设置文件路径。<br />
<br />
==== 移植点 ====<br />
<br />
可以让 "mkisofs" 查找文件和目录从制定路径<br />
<br />
$ mkisofs -V "''BACKUP_2013_07_27''" -J -r -o ''backup_2013_07_27.iso'' \<br />
-graft-points \<br />
/photos=/home/''user''/photos \<br />
/mail=/home/''user''/mail \<br />
/photos/holidays=/home/''user''/holidays/photos<br />
<br />
{{ic|-graft-points}} 允许识别由ISO文件系统中的目标地址组成的“路径规范” (如 {{ic|/photos}}) 和源地址 (如 {{ic|/home/user/photos}}). 使用 "=" 字符分隔。<br />
<br />
So this example puts the directories {{ic|/home/user/photos}}, {{ic|/home/user/mail}} and {{ic|/home/user/holidays/photos}}, respectively in the ISO image as {{ic|/photos}}, {{ic|/mail}} and {{ic|/photos/holidays}}.<br />
<br />
Programs ''mkisofs'' and ''xorrisofs'' accept the same options. For secure backups, consider using ''xorrisofs'' with option {{ic|--for_backup}}, which records eventual ACLs and stores an MD5 checksum for each data file.<br />
<br />
See the {{man|8|mkisofs}} and {{man|1|xorrisofs}} man pages for more info about their options.<br />
<br />
=== 挂载一个 ISO 镜像 ===<br />
<br />
你可以挂载一个 ISO 镜像,如果你想要浏览它的文件。<br />
我们可以使用下面的指令挂载一个 ISO 镜像:<br />
<br />
# mount -t iso9660 -o ro,loop ''/path/to/file.iso'' ''/mount-point''<br />
<br />
浏览完毕后,一定记得卸载:<br />
<br />
# umount /mount-point<br />
<br />
无 Root 用户挂载镜像,见 [[Mounting images as user]]。<br />
<br />
=== 转换 img/ccd 到 iso ===<br />
<br />
转换 {{ic|img}}/{{ic|ccd}} 镜像, 你可使用 {{Pkg|ccd2iso}}:<br />
<br />
$ ccd2iso ''~/image.img'' ''~/image.iso''<br />
<br />
=== 知晓你的设备的名称 ===<br />
<br />
为剩余部分,假定你设的记录设备的节为 {{ic|/dev/sr0}}<br />
<br />
用下面的指令检查<br />
<br />
$ cdrecord dev=''/dev/sr0'' -checkdrive<br />
<br />
这将报告这个设备的 {{ic|Vendor_info}} 和 {{ic|Indentification}}。<br />
<br />
如果没有找到设备,检查一切 {{ic|/dev/sr*}} 是否存在,当他们提供了读写权限 ({{ic|wr-}}) 到你的组。<br />
<br />
如果没有 {{ic|/dev/sr*}} 存在,尝试手动[[Kernel modules|加载]]模块 {{ic|sr_mod}}。<br />
<br />
=== 读取 CD/DVD 的卷名 ===<br />
<br />
如果你想获得名称或标签,使用''dd'':<br />
<br />
$ dd if=''/dev/sr0'' bs=1 skip=32808 count=32<br />
<br />
=== Creating an ISO image from a CD, DVD, or BD ===<br />
<br />
In order to only copy actual data from the disc and not the empty blocks filling it up, first retrieve its block/sector count and size (2048 most of the time):<br />
<br />
{{hc|$ isosize -x /dev/sr0|<br />
sector count: 2041796, sector size: 2048<br />
}}<br />
<br />
or alternatively:<br />
<br />
{{hc|$ isoinfo -d -i /dev/sr0 {{!}} awk '/block size{{!}}Volume size/'|<br />
Logical block size is: 2048<br />
Volume size is: 2041796<br />
}}<br />
<br />
{{Note|Do not forget to replace {{ic|/dev/sr0}} with your optical drive device name.}}<br />
<br />
Then use [[dd]] to copy the data using the obtained values:<br />
<br />
$ dd if=/dev/sr0 of=discmage.iso bs=''sector_size'' count=''sector_count'' status=progress<br />
<br />
{{Tip|If the medium is damaged, it is preferable to use a dedicated utility such as {{Pkg|ddrescue}}. See [[Disk cloning#Using ddrescue]].}}<br />
<br />
If the original medium was bootable, then the copy will be a bootable image. You may use it as a pseudo CD for a virtual machine or burn it onto an optical medium which should then become bootable. [https://askubuntu.com/questions/147800/ripping-dvd-to-iso-accurately#874945]<br />
<br />
=== 擦除CD-RW和DVD-RW ===<br />
<br />
使用过的CD-RW介质需要在写上以前记录的数据之前被擦除。这可以通过以下方式完成<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
<br />
清空有两个选项:blank=fast 和 blank=all。完全清空的持续时间与完全写操作一样长。它覆盖了光盘上的有效载荷数据。然而这不应该被认为是安全地使这些数据不可读。为了这个目的,建议用随机数据进行几次全写运行。<br />
<br />
替代命令有:<br />
<br />
$ cdrskin -v dev=''/dev/sr0'' blank=fast<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
擦除 DVD-RW 使用 ''dvd+rw-format'' 工具来自 {{Pkg|dvd+rw-tools}}:<br />
<br />
$ dvd+rw-format -blank=fast ''/dev/sr0''<br />
<br />
Alternative commands are:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
$ cdrskin -v dev=''/dev/sr0'' blank=deformat_sequential_quickest<br />
$ xorriso -outdev ''/dev/sr0'' -blank deformat_quickest<br />
<br />
Such fastly blanked DVD-RW are not suitable for multi-session and cannot take input streams of unpredicted length. For that purpose one has to use one of:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=all<br />
$ dvd+rw-format -blank=full ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=as_needed<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
The other media types are either write-once (CD-R, DVD-R, DVD+R, BD-R) or are overwritable without the need for erasing (DVD-RAM, DVD+RW, BD-RE).<br />
<br />
=== Formatting DVD-RW ===<br />
<br />
Formatted DVD-RW media can be overwritten without previous erasure. So consider to apply once in their life time<br />
<br />
$ dvd+rw-format -force ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=format_if_needed<br />
$ xorriso -outdev ''/dev/sr0'' -format as_needed<br />
<br />
Unlike DVD-RAM, DVD+RW, and BD-RE, formatted DVD-RW cannot be used as (slow) hard disk directly, but rather need the mediation of driver pktcdvd. See {{man|8|pktsetup}}.<br />
<br />
=== Formatting BD-RE and BD-R ===<br />
<br />
BD-RE need formatting before first use. This is done automatically by the burn programs when they detect the unformatted state. Nevertheless the size of the payload area can be influenced by expert versions of the format commands shown above for DVD-RW.<br />
<br />
BD-R can be used unformatted or formatted. Unformatted they are written with full nominal speed and offer maximum storage capacity. Formatted they get checkread during write operations and bad blocks get replaced by blocks from the Spare Area. This reduces write speed to a half or less of nominal speed. The default sized Spare Area reduces the storage capacity by 768 MiB.<br />
<br />
growisofs formats BD-R by default. The others do not. growisofs can be kept from formatting. cdrskin and xorriso can write with full nominal speed on formatted BD-RE or BD-R:<br />
<br />
$ growisofs -use-the-force-luke=spare:none ...growisofs.or.mkisofs.options...<br />
$ cdrskin stream_recording=on ...cdrecord.options...<br />
$ xorriso -stream_recording on ...xorriso.commands...<br />
<br />
=== Burning an ISO image to CD, DVD, or BD ===<br />
<br />
To burn a readily prepared ISO image file {{ic|isoimage.iso}} onto an optical medium, run for CD:<br />
<br />
$ cdrecord -v -sao dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
and for DVD or BD:<br />
<br />
$ growisofs -dvd-compat -Z ''/dev/sr0''=''isoimage.iso''<br />
<br />
for CD, DVD, BD:<br />
<br />
$ xorriso -as cdrecord -v dev=''/dev/sr0'' -dao ''isoimage.iso''<br />
<br />
{{Note|1=<br /><br />
* Make sure that the medium is not mounted when you begin to write to it. Mounting may happen automatically if the medium contains a readable file system. In the best case, it will prevent the burn programs from using the burner device. In the worst case, there will be misburns because read operations disturbed the drive. So if in doubt, do: {{bc|# umount /dev/sr0}}<br />
* ''growisofs'' has a [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=713016 small bug] with blank BD-R media. It issues an error message after the burning is complete. Programs like ''k3b'' then believe the whole burn run failed. To prevent this, either<br />
** format the blank BD-R by {{ic|dvd+rw-format ''/dev/sr0''}} before submitting it to ''growisofs''<br />
** or use ''growisofs'' option {{ic|1= -use-the-force-luke=spare:none}}<br />
}}<br />
<br />
=== Verifying the burnt ISO image ===<br />
<br />
You can verify the integrity of the burnt medium to make sure it contains no errors. Always eject the medium and reinsert it before verifying. It will guarantee that any kernel cache will not be used to read the data.<br />
<br />
First calculate the MD5 checksum of the original ISO image:<br />
<br />
{{hc|$ md5sum isoimage.iso|<br />
e5643e18e05f5646046bb2e4236986d8 isoimage.iso<br />
}}<br />
<br />
Next calculate the MD5 checksum of the ISO file system on the medium.<br />
Although some media types deliver exactly the same amount of data as have been submitted to the burn program, many others append trailing garbage when being read. So you should restrict reading to the size of the ISO image file.<br />
<br />
$ blocks=$(expr $(du -b isoimage.iso | awk '{print $1}') / 2048)<br />
<br />
{{hc|1=$ dd if=/dev/sr0 bs=2048 count=$blocks {{!}} md5sum|2=<br />
43992+0 records in<br />
43992+0 records out<br />
90095616 bytes (90 MB, 86 MiB) copied, 0.359539 s, 251 MB/s<br />
e5643e18e05f5646046bb2e4236986d8 -<br />
}}<br />
<br />
Both runs should yield the same MD5 checksum (here: {{ic|e5643e18e05f5646046bb2e4236986d8}}). If they do not, you will probably also get an I/O error message from the {{ic|dd}} run. [[dmesg]] might then tell about SCSI errors and block numbers, if you are interested.<br />
<br />
=== ISO 9660 and burning on-the-fly ===<br />
<br />
It is not necessary to store an emerging ISO file system on hard disk before writing it to optical media. Only very old CD drives in very old computers could suffer failed burns due to an empty drive buffer.<br />
<br />
If you omit option {{ic|-o}} from ''mkisofs'' then it writes the ISO image to standard output. This can be piped into the standard input of burn programs.<br />
<br />
$ mkisofs -V "ARCHIVE_2013_07_27" -J -r ./for_iso | \<br />
cdrecord -v dev=/dev/sr0 -waiti -<br />
<br />
Option {{ic|-waiti}} is not really needed here. It prevents ''cdrecord'' from writing to the medium before ''mkisofs'' starts its output. This would allow ''mkisofs'' to read the medium without disturbing an already started burn run. See next section about multi-session.<br />
<br />
On DVD and BD, you may let ''growisofs'' operate ''mkisofs'' for you and burn its output on-the-fly:<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
=== Multi-session ===<br />
<br />
ISO 9660 multi-session means that a medium with readable file system is still writable at its first unused block address, and that a new ISO directory tree gets written to this unused part. The new tree is accompanied by the content blocks of newly added or overwritten data files. The blocks of data files, which shall stay as in the old ISO tree, will not be written again.<br />
<br />
Linux and many other operating systems will mount the directory tree in the last session on the medium. This youngest tree will normally show the files of the older sessions, too.<br />
<br />
==== Multi-session by cdrecord ====<br />
<br />
CD-R and CD-RW stay writable (aka "appendable") if cdrecord option {{ic|-multi}} was used<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
Then the medium can be inquired for the parameters of the next session<br />
<br />
$ m=$(cdrecord dev=''/dev/sr0'' -msinfo)<br />
<br />
By help of these parameters and of the readable medium in the drive you can produce the add-on ISO session<br />
<br />
$ mkisofs -M ''/dev/sr0'' -C "$m" \<br />
-V "''ARCHIVE_2013_07_28''" -J -r -o ''session2.iso'' ''./more_for_iso''<br />
<br />
Finally append the session to the medium and keep it appendable again<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''session2.iso''<br />
<br />
Programs ''cdrskin'' and ''xorrecord'' do this too with DVD-R, DVD+R, BD-R and unformatted DVD-RW. Program ''cdrecord'' does multi-session with at least DVD-R and DVD-RW. They all do with CD-R and CD-RW, of course.<br />
<br />
Most re-usable media types do not record a session history that would be recognizable for a mounting kernel. But with ISO 9660 it is possible to achieve the multi-session effect even on those media.<br />
<br />
''growisofs'' and ''xorriso'' can do this and hide most of the complexity.<br />
<br />
==== Multi-session by growisofs ====<br />
<br />
By default, ''growisofs'' uses ''mkisofs'' as a backend for creating ISO images forwards most of its program arguments to . See above examples of ''mkisofs''. It bans option {{ic|-o}} and deprecates option {{ic|-C}}. By default it uses the ''mkisofs''. You may specify to use one of the others compatible backend program by setting environment variable {{ic|MKISOFS}}:<br />
<br />
$ export MKISOFS="xorrisofs"<br />
<br />
The wish to begin with a new ISO file system on the optical medium is expressed by option {{ic|-Z}}<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
The wish to append more files as new session to an existing ISO file system is expressed by option {{ic|-M}}<br />
<br />
$ growisofs -M ''/dev/sr0'' -V "''ARCHIVE_2013_07_28''" -r -J ''./more_for_iso''<br />
<br />
For details see the {{man|1|growisofs}} manual and the manuals of ''mkisofs'' and ''xorrisofs''.<br />
<br />
==== Multi-session by xorriso ====<br />
<br />
''xorriso'' learns the wish to begin with a new ISO file system from the blank state of the medium. So it is appropriate to blank it if it contains data. The command {{ic|-blank as_needed}} applies to all kinds of re-usable media and even to ISO images in data files on hard disk. It does not cause error if applied to a blank write-once medium.<br />
<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed \<br />
-volid "''ARCHIVE_2013_07_27''" -joliet on -add ''./for_iso'' --<br />
<br />
On non-blank writable media ''xorriso'' appends the newly given disc files if command {{ic|-dev}} is used rather than {{ic|-outdev}}. Of course, no command {{ic|-blank}} should be given here<br />
<br />
$ xorriso -dev ''/dev/sr0'' \<br />
-volid "''ARCHIVE_2013_07_28''" -joliet on -add ''./more_for_iso'' --<br />
<br />
For details see the {{man|1|xorriso}} man page and especially its examples.<br />
<br />
=== BD Defect Management ===<br />
<br />
BD-RE and formatted BD-R media are normally written with enabled Defect Management. This feature reads the written blocks while they are still stored in the drive buffer. In case of poor read quality the blocks get written again or redirected to the ''Spare Area'' where the data get stored in replacement blocks.<br />
<br />
This checkreading reduces write speed to at most half of the nominal speed of drive and BD medium. Sometimes it is even worse. Heavy use of the Spare Area causes long delays during read operations. So Defect Management is not always desirable.<br />
<br />
''cdrecord'' does not format BD-R. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''growisofs'' formats BD-R by default. The Defect Management can be prevented by option {{ic|1= -use-the-force-luke=spare:none}}. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''cdrskin'', ''xorriso'' and ''xorrecord'' do not format BD-R by default. They do with {{ic|1= cdrskin blank=format_if_needed}}, resp. {{ic|1= xorriso -format as_needed}}, resp. {{ic|1= xorrecord blank=format_overwrite}}. These three programs can disable Defect Management with BD-RE and already formatted BD-R by {{ic|1= cdrskin stream_recording=on}}, resp. {{ic|1= xorriso -stream_recording on}}, resp. {{ic|1= xorrecord stream_recording=on}}.<br />
<br />
=== Burning an audio CD ===<br />
<br />
Create your audio tracks and store them as uncompressed, 16-bit, 44100-Hz, stereo WAV files. To convert MP3 to WAV, ensure {{Pkg|lame}} is installed, ''cd'' to the directory with your MP3 files, and run:<br />
<br />
$ for i in *.mp3; do lame --decode "$i" "$(basename "$i" .mp3)".wav; done<br />
<br />
In case you get an error when trying to burn WAV files converted with LAME, try decoding with {{Pkg|mpg123}}:<br />
<br />
$ for i in *.mp3; do mpg123 --rate 44100 --stereo --buffer 3072 --resync -w $(basename "$i" .mp3).wav $i; done<br />
<br />
To convert AAC to WAV ensure {{Pkg|faad2}} is installed and run:<br />
$ for i in *.m4a; do faad $i; done<br />
<br />
To fix the bitrate of an already existing WAV file (or many other formats), try using {{Pkg|sox}}:<br />
$ for i in *.wav; do sox "$i" -c 2 -r 44100 "$(basename "$i" .wav)"-ok.wav; done<br />
<br />
Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as {{ic|01.wav}}, {{ic|02.wav}}, {{ic|03.wav}}, etc. Use the following command to simulate burning the WAV files as an audio CD:<br />
<br />
$ cdrecord '''-dummy''' -v -pad speed=1 dev=''/dev/sr0'' -dao -swab *.wav<br />
<br />
If everything worked, you can remove the {{ic|-dummy}} flag to actually burn the CD.<br />
<br />
{{Note|The produced disc may not play in all CD players. For an audio-only disc (discarding some track metadata), add the {{ic|-audio}} flag.}}<br />
<br />
To test the new audio CD, use [[MPlayer]]:<br />
<br />
$ mplayer cdda://<br />
<br />
=== Burning a BIN/CUE ===<br />
<br />
To burn a BIN/CUE image run:<br />
<br />
$ cdrdao write --device ''/dev/sr0'' ''image.cue''<br />
<br />
==== TOC/CUE/BIN for mixed-mode discs ====<br />
<br />
ISO images only store a single data track. If you want to create an image of a mixed-mode disc (data track with multiple audio tracks) then you need to make a TOC/BIN pair:<br />
<br />
$ cdrdao read-cd --read-raw --datafile ''image.bin'' --driver generic-mmc:0x20000 --device ''/dev/cdrom'' ''image.toc''<br />
<br />
Some software only likes CUE/BIN pair, you can make a CUE sheet with ''toc2cue'' (part of {{Pkg|cdrdao}}):<br />
<br />
$ toc2cue ''image.toc'' ''image.cue''<br />
<br />
=== Burn backend problems ===<br />
<br />
If you are experiencing problems, you may ask for advise at mailing list [mailto:cdwrite@other.debian.org cdwrite@other.debian.org], or try to write to the one of support mail addresses if some are listed near the end of the program's man page.<br />
<br />
Tell the command lines you tried, the medium type (如 CD-R, DVD+RW, ...), and the symptoms of failure (program messages, disappointed user expectation, ...). You will possibly get asked to obtain the newest release or development version of the affected program and to make test runs. But the answer might as well be, that your drive dislikes the particular medium.<br />
<br />
=== Burning CD/DVD/BD with a GUI ===<br />
<br />
There are several applications available to burn CDs in a graphical environment.<br />
<br />
See also [[Wikipedia:Comparison of disc authoring software]].<br />
<br />
* {{App|[[Wikipedia:AcetoneISO|AcetoneISO]]|All-in-one ISO tool (supports BIN, MDF, NRG, IMG, DAA, DMG, CDI, B5I, BWI, PDI and ISO).|https://sourceforge.net/projects/acetoneiso|{{Pkg|acetoneiso2}}}}<br />
* {{App|BashBurn|Lightweight terminal based menu frontend for CD/DVD burning tools.|http://bashburn.dose.se/|{{Pkg|bashburn}}}}<br />
* {{App|[[Wikipedia:Brasero (software)|Brasero]]|Disc burning application for the GNOME desktop that is designed to be as simple as possible.|https://wiki.gnome.org/Apps/Brasero|{{Pkg|brasero}}}}<br />
* {{App|cdw|Ncurses frontend to ''cdrecord'', ''mkisofs'', ''growisofs'', ''dvd+rw-mediainfo'', ''dvd+rw-format'' and ''xorriso''.|http://cdw.sourceforge.net/|{{AUR|cdw}}}}<br />
* {{App|Graveman|GTK-based CD/DVD burning application. It requires configuration to point to correct devices.|https://graveman.tuxfamily.org/|{{AUR|graveman}}}}<br />
* {{App|isomaster|ISO image editor.|http://littlesvr.ca/isomaster|{{AUR|isomaster}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|[[Wikipedia:X-CD-Roast|X-CD-Roast]]|Lightweight ''cdrtools'' front-end for CD and DVD writing.|http://www.xcdroast.org/|{{AUR|xcdroast}}}}<br />
* {{App|[[Wikipedia:Xfce#Xfburn|Xfburn]]|Simple front-end to the libburnia libraries with support for CD/DVD(-RW), ISO images, and BurnFree.|https://docs.xfce.org/apps/xfburn/start|{{Pkg|xfburn}}}}<br />
* {{App|xorriso-tcltk|Graphical front-end to ISO and CD/DVD/BD burn tool xorriso|https://www.gnu.org/software/xorriso/|{{Pkg|libisoburn}}}}<br />
<br />
== Playback ==<br />
<br />
=== CD ===<br />
<br />
Playback of audio CDs requires the {{Pkg|libcdio}} package. To enable KDE Applications like Dolphin to read audio CDs install {{Pkg|audiocd-kio}}.<br />
<br />
=== DVD ===<br />
<br />
If you wish to play encrypted DVDs, you must install the libdvd* packages:<br />
* {{Pkg|libdvdread}}<br />
* {{Pkg|libdvdcss}}<br />
* {{Pkg|libdvdnav}}<br />
<br />
Additionally, you must install player software. Popular DVD players are [[MPlayer]], [[Wikipedia:Xine|xine]] and [[VLC]]. See the [[List of applications/Multimedia#Video players|video players]] list and the specific instructions for [[MPlayer#DVD playing|MPlayer]].<br />
<br />
=== Blu-ray ===<br />
<br />
See [[Blu-ray#Playback]].<br />
<br />
== Ripping ==<br />
<br />
[[Wikipedia:Ripping|Ripping]] is the process of copying audio or video content to a hard disk, typically from removable media or media streams.<br />
<br />
=== Audio CD ===<br />
<br />
==== Console ====<br />
<br />
* {{App|abcde|Comprehensive command-line tool for ripping audio CDs.|https://abcde.einval.com/|{{AUR|abcde}}}}<br />
* {{App|cdda2wav|CD-audio extraction program with paranoia support.|http://www.cdda2wav.de/|{{Pkg|cdrtools}}}}<br />
* {{App|[[Wikipedia:cdparanoia|cdparanoia]]|Compact Disc Digital Audio (CDDA) Digital Audio Extraction (DAE) tool.|https://xiph.org/paranoia/index.html|{{Pkg|cdparanoia}}}}<br />
* {{App|cyanrip|Extensive CD ripper with musicbraniz integration, error detection, log generation, many formats, HDCD decoding, covert art automatic download.|https://github.com/cyanreg/cyanrip/|{{AUR|cyanrip}}}}<br />
* {{App|ripright|Minimal CD ripper modeled on autorip.|https://www.mcternan.me.uk/ripright/|{{AUR|ripright}}}}<br />
* {{App|[[Wikipedia:ripit|ripit]]|Command-line ripper that supports MusicBrainz, freeddb and various codecs. |https://www.ripit.pl/|{{AUR|ripit}}}}<br />
* {{App|shnsplit|Splits .wav and .flac files according to a CUE sheet and encodes the resulting pieces. A useful companion to ABCDE.|http://shnutils.freeshell.org/shntool/|{{AUR|shntool}}}}<br />
* {{App|whipper|CD ripper aiming for accuracy over speed. Uses cdparanoia, MusicBrainz, AccurateRip.|https://github.com/whipper-team/whipper|{{Pkg|whipper}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|[[Wikipedia:Asunder (software)|Asunder]]|GTK-based CD ripping program.|http://littlesvr.ca/asunder/|{{Pkg|asunder}}}}<br />
* {{App|Audex|Audio grabber tool for CD-ROM drives based on KDE.|https://userbase.kde.org/Audex|{{Pkg|audex}}}}<br />
* {{App|[[Wikipedia:Fre:ac|fre:ac]]|Audio converter and CD ripper with support for various popular formats and encoders.|https://freac.org/|{{AUR|freac}}}}<br />
* {{App|Goobox|CD player and ripper for GNOME.|https://people.gnome.org/~paobac/goobox/{{Dead link|2022|09|22|status=404}}|{{Pkg|goobox}}}}<br />
* {{App|[[Wikipedia:Grip (software)|Grip]]|Fast and light CD ripper within the GNOME project that resembles [[Wikipedia:Audiograbber|Audiograbber]].|https://sourceforge.net/projects/grip/|{{AUR|grip}}}}.<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|KAudioCreator|KDE program for ripping and encoding Audio-CDs. Unmaintained and [https://bugs.archlinux.org/task/67618 does not start anymore].|https://invent.kde.org/unmaintained/kaudiocreator|{{AUR|kaudiocreator-git}}}}<br />
* {{App|ripperX|GTK program to rip CD audio tracks and encode them to the Ogg, MP3, or FLAC formats.|https://sourceforge.net/projects/ripperx/|{{AUR|ripperx}}}}<br />
* {{App|rubyripper|Audio disc ripper that tries to deliver a secure rip through multiple rippings of the same track and corrections of any differences.|https://github.com/bleskodev/rubyripper|{{AUR|rubyripper}}}}<br />
* {{App|[[Wikipedia:Sound Juicer|Sound Juicer]]|CD ripper for GNOME.|https://wiki.gnome.org/Apps/SoundJuicer|{{Pkg|sound-juicer}}}}<br />
* {{App|1=soundKonverter|2=Front-end to various audio converters.|3=https://www.linux-apps.com/content/show.php?content=29024|4={{Pkg|soundkonverter}}}}<br />
<br />
=== DVD-Video ===<br />
<br />
See also [[Wikipedia:Comparison of DVD ripper software]].<br />
<br />
Often, the process of ripping a DVD can be broken down into two subtasks:<br />
<br />
# '''Data extraction''' — Copying the audio and/or video data to a hard disk,<br />
# [[Wikipedia:Transcode|Transcoding]] — Converting the extracted data into a suitable format.<br />
<br />
Some utilities perform both tasks, whilst others focus on one aspect or the other.<br />
<br />
==== Console ====<br />
<br />
* {{App|[[dvdbackup]]|Tool for pure data extraction which does not transcode. It is useful for creating ''exact'' copies of encrypted DVDs in conjunction with '''libdvdcss''' or for decrypting video for other utilities unable to read encrypted DVDs.|http://dvdbackup.sourceforge.net/|{{Pkg|dvdbackup}}}}<br />
* {{App|[[FFmpeg]]|Complete and free Internet live audio and video broadcasting solution for Linux/Unix, capable to do a direct rip in any format (audio/video) from a DVD-Video ISO image, just select the input as the ISO image and proceed with the desired options. It also allows to downmixing, shrinking, spliting, selecting streams among other features.|https://ffmpeg.org/|{{Pkg|ffmpeg}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake CLI]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping.|https://handbrake.fr/|{{Pkg|handbrake-cli}}}}<br />
* {{App|[[MEncoder]]|Free command line video decoding, encoding and filtering tool. It supports ripping and transcoding DVD-Video.|http://www.mplayerhq.hu/|{{Pkg|mencoder}}}}<br />
* {{App|subtitleripper|Convert DVD subtitles into text format.|http://subtitleripper.sourceforge.net/|{{AUR|subtitleripper}}}}<br />
* {{App|Transcode|Video/DVD ripper and encoder for the terminal/console. It is [https://www.linuxfromscratch.org/blfs/view/8.3/multimedia/transcode.html outdated/no longer actively maintained].||{{Pkg|transcode}}}}<br />
* {{App|Vobcopy|Copies DVD ''.vob'' files to hard disk, decrypting them on the way.|https://github.com/barak/vobcopy|{{AUR|vobcopy}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|dvd::rip|Front-end to {{Pkg|transcode}}, used to extract DVD's to the hard disk and transcode or extract and transcode on-the-fly.|https://www.exit1.org/dvdrip/|{{AUR|dvdrip}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping. GTK version.|https://handbrake.fr/|{{Pkg|handbrake}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|OGMRip|An application and a set of libraries for ripping and encoding DVD into AVI, OGM, MP4, or Matroska files using a wide variety of codecs. It relies on mplayer, mencoder, ogmtools, mkvtoolnix, mp4box, oggenc, lame, and faac to perform its tasks.|http://ogmrip.sourceforge.net/|{{AUR|ogmrip}}}}<br />
<br />
=== DVD-Audio ===<br />
<br />
* {{App|Python Audio Tools|Includes dvda2track, which is easy to use command line tool to extract DVD-Audio tracks to uncompressed wav files.<br />
|http://audiotools.sourceforge.net/|{{AUR|audiotools}}}}<br />
<br />
=== Multi-format ===<br />
<br />
* {{App|Aaru|Software for archival ripping of CDs, DVDs, and harddrives|https://aaru.app|{{AUR|aaru}}}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Brasero fails to normalize audio CD ===<br />
<br />
If you try to burn it may stop at the first step called Normalization.<br />
<br />
As a workaround you can disable the normalization plugin using the ''Edit > Plugins'' menu<br />
<br />
=== VLC: Error "... could not open the disc /dev/dvd" ===<br />
<br />
If you get an error like<br />
<br />
vlc dvdread could not open the disc "/dev/dvd"<br />
<br />
it may be because there is no device node {{ic|/dev/dvd}} on your system. Udev no longer creates {{ic|/dev/dvd}} and instead uses {{ic|/dev/sr0}}. To fix this, edit the VLC configuration file ({{ic|~/.config/vlc/vlcrc}}):<br />
<br />
# DVD device (string)<br />
dvd=/dev/sr0<br />
<br />
=== DVD drive is noisy ===<br />
<br />
If playing DVD videos causes the system to be very loud, it may be because the disc is spinning faster than it needs to. To temporarily change the speed of the drive, run:<br />
<br />
# eject -x 12 /dev/dvd<br />
<br />
Sometimes:<br />
<br />
# hdparm -E12 /dev/dvd<br />
<br />
Any speed that is supported by the drive can be used, or 0 for the maximum speed.<br />
<br />
[https://michal.kosmulski.org/computing/tips/cd-rom-speed.html Setting CD-ROM and DVD-ROM drive speed]<br />
<br />
=== Playback does not work with new computer (new DVD-Drive) ===<br />
<br />
If playback does not work and you have a new computer (new DVD-Drive) the reason might be that the [[Wikipedia:DVD region code|region code]] is not set. You can read and set the region code with the {{AUR|regionset}} package.<br />
<br />
=== None of the above programs are able to rip/encode a DVD to my hard disk! ===<br />
<br />
Make sure the region of your DVD reader is set correctly; otherwise, you will get loads of inexplicable [[Wikipedia:Content Scramble System|CSS]]-related errors. Use the {{AUR|regionset}} package to do so.<br />
<br />
If ripping still does not work with the correct region set, refer to the [https://videolan.videolan.me/libdvdcss/ libdvdcss developer documentation] for enabling log messages and setting other relevant options.<br />
<br />
=== GUI program log indicates problems with backend program ===<br />
<br />
If you use a GUI program and experience problems which the program's log blames on some backend program, then try to reproduce the problem by the logged backend program arguments.<br />
Whether you succeed with reproducing or not, you may report the logged lines and your own findings to the places mentioned in [[#Burn backend problems]] section.<br />
<br />
==== Special case: medium error / write error ====<br />
<br />
Here are some typical messages about the drive disliking the medium. This can only be solved by using a different drive or a different medium. A different program will hardly help.<br />
<br />
Brasero with backend growisofs:<br />
<br />
BraseroGrowisofs stderr: :-[ WRITE@LBA=0h failed with SK=3h/ASC=0Ch/ACQ=00h]: Input/output error<br />
<br />
Brasero with backend libburn:<br />
<br />
BraseroLibburn Libburn reported an error SCSI error on write(16976,16): [3 0C 00] Write error<br />
<br />
=== BD-R DL 50GB errors on trying to burn second layer ===<br />
<br />
Using ''growisofs'' from {{Pkg|dvd+rw-tools}} for burning 50GB BD-R DL discs might result in a fatal error and damaged media, such as:<br />
<br />
{{hc|$ growisofs -Z /dev/sr0 -J -R -V "label" files|<nowiki><br />
Executing 'mkisofs -J -R -V label files | builtin_dd of=/dev/sr0 obs=32k seek=0'<br />
I: -input-charset not specified, using utf-8 (detected in locale settings)<br />
0.03% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.05% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.08% done, estimate finish Fri Jan 29 19:50:36 2016<br />
/dev/sr0: pre-formatting blank BD-R for 49.8GB...<br />
/dev/sr0: "Current Write Speed" is 8.2x4390KBps.<br />
0.11% done, estimate finish Sat Jan 30 03:29:13 2016<br />
0.13% done, estimate finish Sat Jan 30 02:10:01 2016<br />
...<br />
63.20% done, estimate finish Fri Jan 29 20:43:45 2016<br />
:-[ WRITE@LBA=b6d820h failed with SK=3h/WRITE ERROR]: Input/output error<br />
:-( write failed: Input/output error<br />
/dev/sr0: flushing cache<br />
/dev/sr0: closing track<br />
/dev/sr0: closing session<br />
:-[ CLOSE SESSION failed with SK=5h/INVALID FIELD IN CDB]: Input/output error<br />
/dev/sr0: reloading tray<br />
</nowiki>}}<br />
<br />
This happened at the 25GB boundary when starting to write the second layer. Using ''cdrecord'' from {{Pkg|cdrtools}} works with no problems. Tested with a 'HL-DT-ST BD-RE WH16NS40' LG burner, and Verbatim BD-R DL 6x discs (#96911). {{bug|47797}}<br />
<br />
=== Disc tray autocloses ===<br />
<br />
If after ejecting a cd, either by using the {{ic|eject}} command, or pushing the drive button, the drive disc tray autocloses before being able to remove the disc, try the following command:<br />
<br />
# sysctl -w dev.cdrom.autoclose=0<br />
<br />
If that solves the problem, make the change permanent:<br />
<br />
{{hc|/etc/sysctl.d/60-cdrom-autoclose.conf|2=<br />
dev.cdrom.autoclose = 0<br />
}}<br />
<br />
If the above does not work and as a last resort measure, you can unload the disc module from the kernel via:<br />
<br />
# rmmod sr_mod<br />
<br />
the disc drive should now behave as expected but will not mount disc anymore. After putting a disc into the drive, reactivate the module via:<br />
<br />
# modprobe sr_mod<br />
<br />
the disc should now mount.<br />
<br />
== See also ==<br />
<br />
* In the United States, backup of physically obtained media is allowed under these conditions: [https://www.riaa.com/resources-learning/about-piracy/ About Piracy - RIAA].<br />
* [https://dev.lovelyhq.com/libburnia/web/wiki Main page of the project Libburnia]</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=User:InsaneGuo/common.js&diff=755957User:InsaneGuo/common.js2022-11-05T14:37:41Z<p>InsaneGuo: Created page with "mw.loader.load('https://cdn.jsdelivr.net/npm/wikiplus-core@latest/dist/Main.js');"</p>
<hr />
<div>mw.loader.load('https://cdn.jsdelivr.net/npm/wikiplus-core@latest/dist/Main.js');</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Optical_disc_drive_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=755912Optical disc drive (简体中文)2022-11-05T08:26:53Z<p>InsaneGuo: /* 安装刻录工具 */ 1</p>
<hr />
<div>[[Category:Multimedia]]<br />
[[Category:Optical disc]]<br />
[[es:Optical disc drive]]<br />
[[ja:光学ディスクドライブ]]<br />
{{Related articles start}}<br />
{{Related|Codecs}}<br />
{{Related|MPlayer}}<br />
{{Related|dvdbackup}}<br />
{{Related|MEncoder}}<br />
{{Related|Blu-ray}}<br />
{{Related|Convert any Movie to DVD Video}}<br />
{{Related articles end}}<br />
<br />
来自维基百科:<br />
<br />
在计算机领域,Optical disc drive(ODD)是一种光盘驱动器,它使用激光或可见光频谱内或附近的电磁波作为向光盘读写数据过程的一部分。<br />
<br />
== 刻录 ==<br />
<br />
{{Expansion|Are any command-line tools to arrange files into volumes to fit on a disc (like GAFFitter or cdrkit's dirsplit) packaged for Arch Linux?}}<br />
<br />
{{Warning|The quality of optical drives and the discs themselves varies greatly. Generally, using a slow burn speed is recommended for reliable burns. If you are experiencing unexpected behaviour from the disc, try burning at the lowest speed supported by your burner.}}<br />
<br />
光盘驱动器的刻录过程包括创建或获得一个图像并将其写入光学介质。该镜像原则上可以是任何数据文件。如果你想挂载生成的介质,那么它通常是一个ISO 9660文件系统的镜像文件。音频和多媒体光盘通常是从.bin文件刻录的,在.toc文件或.cue文件的控制下,告诉所需的轨道布局。<br />
<br />
=== 安装刻录工具 ===<br />
<br />
{{Style|Says twice that X is the traditional choice without stating why.}}<br />
<br />
If you want to use programs with graphical user interface, then follow [[#Burning CD/DVD/BD with a GUI]].<br />
<br />
这里列出的程序是面向命令行的。它们是大多数用于CD、DVD和BD的免费GUI程序所使用的后端。当涉及到故障排除或编写刻录活动的脚本时,GUI用户可能会用到它们。<br />
<br />
你至少需要一个创建文件系统镜像的程序和一个能够将数据刻录到你所需要的媒体类型的程序。<br />
<br />
可用于创建ISO9660类型镜像的应用有:<br />
<br />
* {{man|8|mkisofs}} from {{Pkg|cdrtools}}<br />
* {{man|1|xorriso}} and {{man|1|xorrisofs}} from {{Pkg|libisoburn}}<br />
<br />
常见的选择是 ''mkisofs''.<br />
<br />
可用于刻录媒体文件的应用有:<br />
<br />
* {{man|1|cdrdao}} from {{Pkg|cdrdao}} (CD only, TOC/CUE/BIN only)<br />
* {{man|1|cdrecord}} from {{Pkg|cdrtools}}<br />
* {{man|1|cdrskin}} from {{Pkg|libburn}}<br />
* {{man|1|growisofs}} from {{Pkg|dvd+rw-tools}} (DVD and BD only)<br />
* {{man|1|xorriso}} and {{man|1|xorrecord}} from {{Pkg|libisoburn}}<br />
<br />
常见的对于 CD的选择有 ''cdrecord'' 而 对于 DVD 和 Blu-ray Disc的选择有''growisofs'' . For writing TOC/CUE/BIN files to CD, install {{Pkg|cdrdao}}.<br />
<br />
免费的GUI程序至少依赖于一个上述包。<br />
<br />
''xorrisofs'' supports the ''mkisofs'' options which are shown in this document.<br />
<br />
''cdrskin'' supports the shown ''cdrecord'' options; ''xorrecord'' also supports those which do not deal with audio CD.<br />
<br />
=== Making an ISO image from existing files ===<br />
<br />
The simplest way to create an ISO image is to first copy the needed files to one directory, for example: {{ic|./for_iso}}.<br />
<br />
Then generate the image file with ''mkisofs'':<br />
<br />
$ mkisofs -V "''ARCHIVE_2013_07_27''" -J -r -o ''isoimage.iso'' ''./for_iso''<br />
<br />
Each of those options are explained in the following sections.<br />
<br />
==== Basic options ====<br />
<br />
;{{ic|-V}}: Specifies the name (that is assigned to) of the file system. The ISO 9660 standard specs impose the limitations of 32-character string length, as well as limiting the characters allowed to sets of: "A" to "Z", "0" to "9", and "_". This volume label will probably show up as mount point if the medium is mounted automatically.<br />
;{{ic|-J}}: Enables [[Wikipedia:Joliet (file system)|Joliet]] extension, which allocates special space to store file names in Unicode (up to 64 UTF-16 characters for each file).<br />
;{{ic|-joliet-long}}: Increases maximum length of file names from 64 to 103 UTF-16 characters in Joliet table. Non-compliant to Joliet specs and not commonly supported.<br />
;{{ic|-r}}: Enables [[Wikipedia:Rock Ridge|Rock Ridge]] extension, which adds POSIX file system semantics to an image, including support of long 255-character filenames and Unix-style file permissions.<br />
;{{ic|-o}}: Sets the file path for the resulting ISO image.<br />
<br />
==== graft-points ====<br />
<br />
It is also possible to let ''mkisofs'' to collect files and directories from various paths<br />
<br />
$ mkisofs -V "''BACKUP_2013_07_27''" -J -r -o ''backup_2013_07_27.iso'' \<br />
-graft-points \<br />
/photos=/home/''user''/photos \<br />
/mail=/home/''user''/mail \<br />
/photos/holidays=/home/''user''/holidays/photos<br />
<br />
{{ic|-graft-points}} enables the recognition of ''pathspecs'' which consist of a target address in the ISO file system (e.g. {{ic|/photos}}) and a source address (e.g. {{ic|/home/user/photos}}). Both are separated by a "=" character.<br />
<br />
So this example puts the directories {{ic|/home/user/photos}}, {{ic|/home/user/mail}} and {{ic|/home/user/holidays/photos}}, respectively in the ISO image as {{ic|/photos}}, {{ic|/mail}} and {{ic|/photos/holidays}}.<br />
<br />
Programs ''mkisofs'' and ''xorrisofs'' accept the same options. For secure backups, consider using ''xorrisofs'' with option {{ic|--for_backup}}, which records eventual ACLs and stores an MD5 checksum for each data file.<br />
<br />
See the {{man|8|mkisofs}} and {{man|1|xorrisofs}} man pages for more info about their options.<br />
<br />
=== Mounting an ISO image ===<br />
<br />
You can mount an ISO image if you want to browse its files.<br />
To mount the ISO image, we can use:<br />
<br />
# mount -t iso9660 -o ro,loop ''/path/to/file.iso'' ''/mount-point''<br />
<br />
Do not forget to unmount the image when your inspection of the image is done:<br />
<br />
# umount /mount-point<br />
<br />
See also [[Mounting images as user]] for mounting without root privileges.<br />
<br />
=== Converting img/ccd to an ISO image ===<br />
<br />
To convert an {{ic|img}}/{{ic|ccd}} image, you can use {{Pkg|ccd2iso}}:<br />
<br />
$ ccd2iso ''~/image.img'' ''~/image.iso''<br />
<br />
=== Learning the name of your optical drive ===<br />
<br />
For the remainder of this section the name of your recording device is assumed to be {{ic|/dev/sr0}}.<br />
<br />
Check this by<br />
<br />
$ cdrecord dev=''/dev/sr0'' -checkdrive<br />
<br />
which should report {{ic|Vendor_info}} and {{ic|Identification}} fields of the drive.<br />
<br />
If no drive is found, check whether any {{ic|/dev/sr*}} exist and whether they offer read/write permission ({{ic|wr-}}) to you or your group.<br />
If no {{ic|/dev/sr*}} exists then try [[Kernel modules|loading]] module {{ic|sr_mod}} manually.<br />
<br />
=== Reading the volume label of a CD or DVD ===<br />
<br />
If you want to get the name/label of the media, use ''dd'':<br />
<br />
$ dd if=''/dev/sr0'' bs=1 skip=32808 count=32<br />
<br />
=== Creating an ISO image from a CD, DVD, or BD ===<br />
<br />
In order to only copy actual data from the disc and not the empty blocks filling it up, first retrieve its block/sector count and size (2048 most of the time):<br />
<br />
{{hc|$ isosize -x /dev/sr0|<br />
sector count: 2041796, sector size: 2048<br />
}}<br />
<br />
or alternatively:<br />
<br />
{{hc|$ isoinfo -d -i /dev/sr0 {{!}} awk '/block size{{!}}Volume size/'|<br />
Logical block size is: 2048<br />
Volume size is: 2041796<br />
}}<br />
<br />
{{Note|Do not forget to replace {{ic|/dev/sr0}} with your optical drive device name.}}<br />
<br />
Then use [[dd]] to copy the data using the obtained values:<br />
<br />
$ dd if=/dev/sr0 of=discmage.iso bs=''sector_size'' count=''sector_count'' status=progress<br />
<br />
{{Tip|If the medium is damaged, it is preferable to use a dedicated utility such as {{Pkg|ddrescue}}. See [[Disk cloning#Using ddrescue]].}}<br />
<br />
If the original medium was bootable, then the copy will be a bootable image. You may use it as a pseudo CD for a virtual machine or burn it onto an optical medium which should then become bootable. [https://askubuntu.com/questions/147800/ripping-dvd-to-iso-accurately#874945]<br />
<br />
=== Erasing CD-RW and DVD-RW ===<br />
<br />
Used CD-RW media need to be erased before you can write over the previously recorded data. This is done by<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
<br />
There are two options for blanking: {{ic|1=blank=fast}} and {{ic|1=blank=all}}. Full blanking lasts as long as a full write run. It overwrites the payload data on the CD. Nevertheless this should not be considered as securely making those data unreadable. For that purpose, several full write runs with random data are advised.<br />
<br />
Alternative commands are:<br />
<br />
$ cdrskin -v dev=''/dev/sr0'' blank=fast<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
To erase the DVD-RW use the ''dvd+rw-format'' utility from {{Pkg|dvd+rw-tools}}:<br />
<br />
$ dvd+rw-format -blank=fast ''/dev/sr0''<br />
<br />
Alternative commands are:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
$ cdrskin -v dev=''/dev/sr0'' blank=deformat_sequential_quickest<br />
$ xorriso -outdev ''/dev/sr0'' -blank deformat_quickest<br />
<br />
Such fastly blanked DVD-RW are not suitable for multi-session and cannot take input streams of unpredicted length. For that purpose one has to use one of:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=all<br />
$ dvd+rw-format -blank=full ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=as_needed<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
The other media types are either write-once (CD-R, DVD-R, DVD+R, BD-R) or are overwritable without the need for erasing (DVD-RAM, DVD+RW, BD-RE).<br />
<br />
=== Formatting DVD-RW ===<br />
<br />
Formatted DVD-RW media can be overwritten without previous erasure. So consider to apply once in their life time<br />
<br />
$ dvd+rw-format -force ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=format_if_needed<br />
$ xorriso -outdev ''/dev/sr0'' -format as_needed<br />
<br />
Unlike DVD-RAM, DVD+RW, and BD-RE, formatted DVD-RW cannot be used as (slow) hard disk directly, but rather need the mediation of driver pktcdvd. See {{man|8|pktsetup}}.<br />
<br />
=== Formatting BD-RE and BD-R ===<br />
<br />
BD-RE need formatting before first use. This is done automatically by the burn programs when they detect the unformatted state. Nevertheless the size of the payload area can be influenced by expert versions of the format commands shown above for DVD-RW.<br />
<br />
BD-R can be used unformatted or formatted. Unformatted they are written with full nominal speed and offer maximum storage capacity. Formatted they get checkread during write operations and bad blocks get replaced by blocks from the Spare Area. This reduces write speed to a half or less of nominal speed. The default sized Spare Area reduces the storage capacity by 768 MiB.<br />
<br />
growisofs formats BD-R by default. The others do not. growisofs can be kept from formatting. cdrskin and xorriso can write with full nominal speed on formatted BD-RE or BD-R:<br />
<br />
$ growisofs -use-the-force-luke=spare:none ...growisofs.or.mkisofs.options...<br />
$ cdrskin stream_recording=on ...cdrecord.options...<br />
$ xorriso -stream_recording on ...xorriso.commands...<br />
<br />
=== Burning an ISO image to CD, DVD, or BD ===<br />
<br />
To burn a readily prepared ISO image file {{ic|isoimage.iso}} onto an optical medium, run for CD:<br />
<br />
$ cdrecord -v -sao dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
and for DVD or BD:<br />
<br />
$ growisofs -dvd-compat -Z ''/dev/sr0''=''isoimage.iso''<br />
<br />
for CD, DVD, BD:<br />
<br />
$ xorriso -as cdrecord -v dev=''/dev/sr0'' -dao ''isoimage.iso''<br />
<br />
{{Note|1=<br /><br />
* Make sure that the medium is not mounted when you begin to write to it. Mounting may happen automatically if the medium contains a readable file system. In the best case, it will prevent the burn programs from using the burner device. In the worst case, there will be misburns because read operations disturbed the drive. So if in doubt, do: {{bc|# umount /dev/sr0}}<br />
* ''growisofs'' has a [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=713016 small bug] with blank BD-R media. It issues an error message after the burning is complete. Programs like ''k3b'' then believe the whole burn run failed. To prevent this, either<br />
** format the blank BD-R by {{ic|dvd+rw-format ''/dev/sr0''}} before submitting it to ''growisofs''<br />
** or use ''growisofs'' option {{ic|1= -use-the-force-luke=spare:none}}<br />
}}<br />
<br />
=== Verifying the burnt ISO image ===<br />
<br />
You can verify the integrity of the burnt medium to make sure it contains no errors. Always eject the medium and reinsert it before verifying. It will guarantee that any kernel cache will not be used to read the data.<br />
<br />
First calculate the MD5 checksum of the original ISO image:<br />
<br />
{{hc|$ md5sum isoimage.iso|<br />
e5643e18e05f5646046bb2e4236986d8 isoimage.iso<br />
}}<br />
<br />
Next calculate the MD5 checksum of the ISO file system on the medium.<br />
Although some media types deliver exactly the same amount of data as have been submitted to the burn program, many others append trailing garbage when being read. So you should restrict reading to the size of the ISO image file.<br />
<br />
$ blocks=$(expr $(du -b isoimage.iso | awk '{print $1}') / 2048)<br />
<br />
{{hc|1=$ dd if=/dev/sr0 bs=2048 count=$blocks {{!}} md5sum|2=<br />
43992+0 records in<br />
43992+0 records out<br />
90095616 bytes (90 MB, 86 MiB) copied, 0.359539 s, 251 MB/s<br />
e5643e18e05f5646046bb2e4236986d8 -<br />
}}<br />
<br />
Both runs should yield the same MD5 checksum (here: {{ic|e5643e18e05f5646046bb2e4236986d8}}). If they do not, you will probably also get an I/O error message from the {{ic|dd}} run. [[dmesg]] might then tell about SCSI errors and block numbers, if you are interested.<br />
<br />
=== ISO 9660 and burning on-the-fly ===<br />
<br />
It is not necessary to store an emerging ISO file system on hard disk before writing it to optical media. Only very old CD drives in very old computers could suffer failed burns due to an empty drive buffer.<br />
<br />
If you omit option {{ic|-o}} from ''mkisofs'' then it writes the ISO image to standard output. This can be piped into the standard input of burn programs.<br />
<br />
$ mkisofs -V "ARCHIVE_2013_07_27" -J -r ./for_iso | \<br />
cdrecord -v dev=/dev/sr0 -waiti -<br />
<br />
Option {{ic|-waiti}} is not really needed here. It prevents ''cdrecord'' from writing to the medium before ''mkisofs'' starts its output. This would allow ''mkisofs'' to read the medium without disturbing an already started burn run. See next section about multi-session.<br />
<br />
On DVD and BD, you may let ''growisofs'' operate ''mkisofs'' for you and burn its output on-the-fly:<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
=== Multi-session ===<br />
<br />
ISO 9660 multi-session means that a medium with readable file system is still writable at its first unused block address, and that a new ISO directory tree gets written to this unused part. The new tree is accompanied by the content blocks of newly added or overwritten data files. The blocks of data files, which shall stay as in the old ISO tree, will not be written again.<br />
<br />
Linux and many other operating systems will mount the directory tree in the last session on the medium. This youngest tree will normally show the files of the older sessions, too.<br />
<br />
==== Multi-session by cdrecord ====<br />
<br />
CD-R and CD-RW stay writable (aka "appendable") if cdrecord option {{ic|-multi}} was used<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
Then the medium can be inquired for the parameters of the next session<br />
<br />
$ m=$(cdrecord dev=''/dev/sr0'' -msinfo)<br />
<br />
By help of these parameters and of the readable medium in the drive you can produce the add-on ISO session<br />
<br />
$ mkisofs -M ''/dev/sr0'' -C "$m" \<br />
-V "''ARCHIVE_2013_07_28''" -J -r -o ''session2.iso'' ''./more_for_iso''<br />
<br />
Finally append the session to the medium and keep it appendable again<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''session2.iso''<br />
<br />
Programs ''cdrskin'' and ''xorrecord'' do this too with DVD-R, DVD+R, BD-R and unformatted DVD-RW. Program ''cdrecord'' does multi-session with at least DVD-R and DVD-RW. They all do with CD-R and CD-RW, of course.<br />
<br />
Most re-usable media types do not record a session history that would be recognizable for a mounting kernel. But with ISO 9660 it is possible to achieve the multi-session effect even on those media.<br />
<br />
''growisofs'' and ''xorriso'' can do this and hide most of the complexity.<br />
<br />
==== Multi-session by growisofs ====<br />
<br />
By default, ''growisofs'' uses ''mkisofs'' as a backend for creating ISO images forwards most of its program arguments to . See above examples of ''mkisofs''. It bans option {{ic|-o}} and deprecates option {{ic|-C}}. By default it uses the ''mkisofs''. You may specify to use one of the others compatible backend program by setting environment variable {{ic|MKISOFS}}:<br />
<br />
$ export MKISOFS="xorrisofs"<br />
<br />
The wish to begin with a new ISO file system on the optical medium is expressed by option {{ic|-Z}}<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
The wish to append more files as new session to an existing ISO file system is expressed by option {{ic|-M}}<br />
<br />
$ growisofs -M ''/dev/sr0'' -V "''ARCHIVE_2013_07_28''" -r -J ''./more_for_iso''<br />
<br />
For details see the {{man|1|growisofs}} manual and the manuals of ''mkisofs'' and ''xorrisofs''.<br />
<br />
==== Multi-session by xorriso ====<br />
<br />
''xorriso'' learns the wish to begin with a new ISO file system from the blank state of the medium. So it is appropriate to blank it if it contains data. The command {{ic|-blank as_needed}} applies to all kinds of re-usable media and even to ISO images in data files on hard disk. It does not cause error if applied to a blank write-once medium.<br />
<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed \<br />
-volid "''ARCHIVE_2013_07_27''" -joliet on -add ''./for_iso'' --<br />
<br />
On non-blank writable media ''xorriso'' appends the newly given disc files if command {{ic|-dev}} is used rather than {{ic|-outdev}}. Of course, no command {{ic|-blank}} should be given here<br />
<br />
$ xorriso -dev ''/dev/sr0'' \<br />
-volid "''ARCHIVE_2013_07_28''" -joliet on -add ''./more_for_iso'' --<br />
<br />
For details see the {{man|1|xorriso}} man page and especially its examples.<br />
<br />
=== BD Defect Management ===<br />
<br />
BD-RE and formatted BD-R media are normally written with enabled Defect Management. This feature reads the written blocks while they are still stored in the drive buffer. In case of poor read quality the blocks get written again or redirected to the ''Spare Area'' where the data get stored in replacement blocks.<br />
<br />
This checkreading reduces write speed to at most half of the nominal speed of drive and BD medium. Sometimes it is even worse. Heavy use of the Spare Area causes long delays during read operations. So Defect Management is not always desirable.<br />
<br />
''cdrecord'' does not format BD-R. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''growisofs'' formats BD-R by default. The Defect Management can be prevented by option {{ic|1= -use-the-force-luke=spare:none}}. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''cdrskin'', ''xorriso'' and ''xorrecord'' do not format BD-R by default. They do with {{ic|1= cdrskin blank=format_if_needed}}, resp. {{ic|1= xorriso -format as_needed}}, resp. {{ic|1= xorrecord blank=format_overwrite}}. These three programs can disable Defect Management with BD-RE and already formatted BD-R by {{ic|1= cdrskin stream_recording=on}}, resp. {{ic|1= xorriso -stream_recording on}}, resp. {{ic|1= xorrecord stream_recording=on}}.<br />
<br />
=== Burning an audio CD ===<br />
<br />
Create your audio tracks and store them as uncompressed, 16-bit, 44100-Hz, stereo WAV files. To convert MP3 to WAV, ensure {{Pkg|lame}} is installed, ''cd'' to the directory with your MP3 files, and run:<br />
<br />
$ for i in *.mp3; do lame --decode "$i" "$(basename "$i" .mp3)".wav; done<br />
<br />
In case you get an error when trying to burn WAV files converted with LAME, try decoding with {{Pkg|mpg123}}:<br />
<br />
$ for i in *.mp3; do mpg123 --rate 44100 --stereo --buffer 3072 --resync -w $(basename "$i" .mp3).wav $i; done<br />
<br />
To convert AAC to WAV ensure {{Pkg|faad2}} is installed and run:<br />
$ for i in *.m4a; do faad $i; done<br />
<br />
To fix the bitrate of an already existing WAV file (or many other formats), try using {{Pkg|sox}}:<br />
$ for i in *.wav; do sox "$i" -c 2 -r 44100 "$(basename "$i" .wav)"-ok.wav; done<br />
<br />
Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as {{ic|01.wav}}, {{ic|02.wav}}, {{ic|03.wav}}, etc. Use the following command to simulate burning the WAV files as an audio CD:<br />
<br />
$ cdrecord '''-dummy''' -v -pad speed=1 dev=''/dev/sr0'' -dao -swab *.wav<br />
<br />
If everything worked, you can remove the {{ic|-dummy}} flag to actually burn the CD. <br />
<br />
{{Note|The produced disc may not play in all CD players. For an audio-only disc (discarding some track metadata), add the {{ic|-audio}} flag.}}<br />
<br />
To test the new audio CD, use [[MPlayer]]:<br />
<br />
$ mplayer cdda://<br />
<br />
=== Burning a BIN/CUE ===<br />
<br />
To burn a BIN/CUE image run:<br />
<br />
$ cdrdao write --device ''/dev/sr0'' ''image.cue''<br />
<br />
==== TOC/CUE/BIN for mixed-mode discs ====<br />
<br />
ISO images only store a single data track. If you want to create an image of a mixed-mode disc (data track with multiple audio tracks) then you need to make a TOC/BIN pair:<br />
<br />
$ cdrdao read-cd --read-raw --datafile ''image.bin'' --driver generic-mmc:0x20000 --device ''/dev/cdrom'' ''image.toc''<br />
<br />
Some software only likes CUE/BIN pair, you can make a CUE sheet with ''toc2cue'' (part of {{Pkg|cdrdao}}):<br />
<br />
$ toc2cue ''image.toc'' ''image.cue''<br />
<br />
=== Burn backend problems ===<br />
<br />
If you are experiencing problems, you may ask for advise at mailing list [mailto:cdwrite@other.debian.org cdwrite@other.debian.org], or try to write to the one of support mail addresses if some are listed near the end of the program's man page.<br />
<br />
Tell the command lines you tried, the medium type (e.g. CD-R, DVD+RW, ...), and the symptoms of failure (program messages, disappointed user expectation, ...). You will possibly get asked to obtain the newest release or development version of the affected program and to make test runs. But the answer might as well be, that your drive dislikes the particular medium.<br />
<br />
=== Burning CD/DVD/BD with a GUI ===<br />
<br />
There are several applications available to burn CDs in a graphical environment.<br />
<br />
See also [[Wikipedia:Comparison of disc authoring software]].<br />
<br />
* {{App|[[Wikipedia:AcetoneISO|AcetoneISO]]|All-in-one ISO tool (supports BIN, MDF, NRG, IMG, DAA, DMG, CDI, B5I, BWI, PDI and ISO).|https://sourceforge.net/projects/acetoneiso|{{Pkg|acetoneiso2}}}}<br />
* {{App|BashBurn|Lightweight terminal based menu frontend for CD/DVD burning tools.|http://bashburn.dose.se/|{{Pkg|bashburn}}}}<br />
* {{App|[[Wikipedia:Brasero (software)|Brasero]]|Disc burning application for the GNOME desktop that is designed to be as simple as possible.|https://wiki.gnome.org/Apps/Brasero|{{Pkg|brasero}}}}<br />
* {{App|cdw|Ncurses frontend to ''cdrecord'', ''mkisofs'', ''growisofs'', ''dvd+rw-mediainfo'', ''dvd+rw-format'' and ''xorriso''.|http://cdw.sourceforge.net/|{{AUR|cdw}}}}<br />
* {{App|Graveman|GTK-based CD/DVD burning application. It requires configuration to point to correct devices.|https://graveman.tuxfamily.org/|{{AUR|graveman}}}}<br />
* {{App|isomaster|ISO image editor.|http://littlesvr.ca/isomaster|{{AUR|isomaster}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|[[Wikipedia:X-CD-Roast|X-CD-Roast]]|Lightweight ''cdrtools'' front-end for CD and DVD writing.|http://www.xcdroast.org/|{{AUR|xcdroast}}}}<br />
* {{App|[[Wikipedia:Xfce#Xfburn|Xfburn]]|Simple front-end to the libburnia libraries with support for CD/DVD(-RW), ISO images, and BurnFree.|https://docs.xfce.org/apps/xfburn/start|{{Pkg|xfburn}}}}<br />
* {{App|xorriso-tcltk|Graphical front-end to ISO and CD/DVD/BD burn tool xorriso|https://www.gnu.org/software/xorriso/|{{Pkg|libisoburn}}}}<br />
<br />
== Playback ==<br />
<br />
=== CD ===<br />
<br />
Playback of audio CDs requires the {{Pkg|libcdio}} package. To enable KDE Applications like Dolphin to read audio CDs install {{Pkg|audiocd-kio}}.<br />
<br />
=== DVD ===<br />
<br />
If you wish to play encrypted DVDs, you must install the libdvd* packages:<br />
* {{Pkg|libdvdread}}<br />
* {{Pkg|libdvdcss}}<br />
* {{Pkg|libdvdnav}}<br />
<br />
Additionally, you must install player software. Popular DVD players are [[MPlayer]], [[Wikipedia:Xine|xine]] and [[VLC]]. See the [[List of applications/Multimedia#Video players|video players]] list and the specific instructions for [[MPlayer#DVD playing|MPlayer]].<br />
<br />
=== Blu-ray ===<br />
<br />
See [[Blu-ray#Playback]].<br />
<br />
== Ripping ==<br />
<br />
[[Wikipedia:Ripping|Ripping]] is the process of copying audio or video content to a hard disk, typically from removable media or media streams.<br />
<br />
=== Audio CD ===<br />
<br />
==== Console ====<br />
<br />
* {{App|abcde|Comprehensive command-line tool for ripping audio CDs.|https://abcde.einval.com/|{{AUR|abcde}}}}<br />
* {{App|cdda2wav|CD-audio extraction program with paranoia support.|http://www.cdda2wav.de/|{{Pkg|cdrtools}}}}<br />
* {{App|[[Wikipedia:cdparanoia|cdparanoia]]|Compact Disc Digital Audio (CDDA) Digital Audio Extraction (DAE) tool.|https://xiph.org/paranoia/index.html|{{Pkg|cdparanoia}}}}<br />
* {{App|cyanrip|Extensive CD ripper with musicbraniz integration, error detection, log generation, many formats, HDCD decoding, covert art automatic download.|https://github.com/cyanreg/cyanrip/|{{AUR|cyanrip}}}}<br />
* {{App|ripright|Minimal CD ripper modeled on autorip.|https://www.mcternan.me.uk/ripright/|{{AUR|ripright}}}}<br />
* {{App|[[Wikipedia:ripit|ripit]]|Command-line ripper that supports MusicBrainz, freeddb and various codecs. |https://www.ripit.pl/|{{AUR|ripit}}}}<br />
* {{App|shnsplit|Splits .wav and .flac files according to a CUE sheet and encodes the resulting pieces. A useful companion to ABCDE.|http://shnutils.freeshell.org/shntool/|{{AUR|shntool}}}}<br />
* {{App|whipper|CD ripper aiming for accuracy over speed. Uses cdparanoia, MusicBrainz, AccurateRip.|https://github.com/whipper-team/whipper|{{Pkg|whipper}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|[[Wikipedia:Asunder (software)|Asunder]]|GTK-based CD ripping program.|http://littlesvr.ca/asunder/|{{Pkg|asunder}}}}<br />
* {{App|Audex|Audio grabber tool for CD-ROM drives based on KDE.|https://userbase.kde.org/Audex|{{Pkg|audex}}}}<br />
* {{App|[[Wikipedia:Fre:ac|fre:ac]]|Audio converter and CD ripper with support for various popular formats and encoders.|https://freac.org/|{{AUR|freac}}}}<br />
* {{App|Goobox|CD player and ripper for GNOME.|https://people.gnome.org/~paobac/goobox/{{Dead link|2022|09|22|status=404}}|{{Pkg|goobox}}}}<br />
* {{App|[[Wikipedia:Grip (software)|Grip]]|Fast and light CD ripper within the GNOME project that resembles [[Wikipedia:Audiograbber|Audiograbber]].|https://sourceforge.net/projects/grip/|{{AUR|grip}}}}.<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|KAudioCreator|KDE program for ripping and encoding Audio-CDs. Unmaintained and [https://bugs.archlinux.org/task/67618 does not start anymore].|https://invent.kde.org/unmaintained/kaudiocreator|{{AUR|kaudiocreator-git}}}}<br />
* {{App|ripperX|GTK program to rip CD audio tracks and encode them to the Ogg, MP3, or FLAC formats.|https://sourceforge.net/projects/ripperx/|{{AUR|ripperx}}}}<br />
* {{App|rubyripper|Audio disc ripper that tries to deliver a secure rip through multiple rippings of the same track and corrections of any differences.|https://github.com/bleskodev/rubyripper|{{AUR|rubyripper}}}}<br />
* {{App|[[Wikipedia:Sound Juicer|Sound Juicer]]|CD ripper for GNOME.|https://wiki.gnome.org/Apps/SoundJuicer|{{Pkg|sound-juicer}}}}<br />
* {{App|1=soundKonverter|2=Front-end to various audio converters.|3=https://www.linux-apps.com/content/show.php?content=29024|4={{Pkg|soundkonverter}}}}<br />
<br />
=== DVD-Video ===<br />
<br />
See also [[Wikipedia:Comparison of DVD ripper software]].<br />
<br />
Often, the process of ripping a DVD can be broken down into two subtasks:<br />
<br />
# '''Data extraction''' — Copying the audio and/or video data to a hard disk,<br />
# [[Wikipedia:Transcode|Transcoding]] — Converting the extracted data into a suitable format.<br />
<br />
Some utilities perform both tasks, whilst others focus on one aspect or the other.<br />
<br />
==== Console ====<br />
<br />
* {{App|[[dvdbackup]]|Tool for pure data extraction which does not transcode. It is useful for creating ''exact'' copies of encrypted DVDs in conjunction with '''libdvdcss''' or for decrypting video for other utilities unable to read encrypted DVDs.|http://dvdbackup.sourceforge.net/|{{Pkg|dvdbackup}}}}<br />
* {{App|[[FFmpeg]]|Complete and free Internet live audio and video broadcasting solution for Linux/Unix, capable to do a direct rip in any format (audio/video) from a DVD-Video ISO image, just select the input as the ISO image and proceed with the desired options. It also allows to downmixing, shrinking, spliting, selecting streams among other features.|https://ffmpeg.org/|{{Pkg|ffmpeg}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake CLI]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping.|https://handbrake.fr/|{{Pkg|handbrake-cli}}}}<br />
* {{App|[[MEncoder]]|Free command line video decoding, encoding and filtering tool. It supports ripping and transcoding DVD-Video.|http://www.mplayerhq.hu/|{{Pkg|mencoder}}}}<br />
* {{App|subtitleripper|Convert DVD subtitles into text format.|http://subtitleripper.sourceforge.net/|{{AUR|subtitleripper}}}}<br />
* {{App|Transcode|Video/DVD ripper and encoder for the terminal/console. It is [https://www.linuxfromscratch.org/blfs/view/8.3/multimedia/transcode.html outdated/no longer actively maintained].||{{Pkg|transcode}}}}<br />
* {{App|Vobcopy|Copies DVD ''.vob'' files to hard disk, decrypting them on the way.|https://github.com/barak/vobcopy|{{AUR|vobcopy}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|dvd::rip|Front-end to {{Pkg|transcode}}, used to extract DVD's to the hard disk and transcode or extract and transcode on-the-fly.|https://www.exit1.org/dvdrip/|{{AUR|dvdrip}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping. GTK version.|https://handbrake.fr/|{{Pkg|handbrake}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|OGMRip|An application and a set of libraries for ripping and encoding DVD into AVI, OGM, MP4, or Matroska files using a wide variety of codecs. It relies on mplayer, mencoder, ogmtools, mkvtoolnix, mp4box, oggenc, lame, and faac to perform its tasks.|http://ogmrip.sourceforge.net/|{{AUR|ogmrip}}}}<br />
<br />
=== DVD-Audio ===<br />
<br />
* {{App|Python Audio Tools|Includes dvda2track, which is easy to use command line tool to extract DVD-Audio tracks to uncompressed wav files.<br />
|http://audiotools.sourceforge.net/|{{AUR|audiotools}}}}<br />
<br />
=== Multi-format ===<br />
<br />
* {{App|Aaru|Software for archival ripping of CDs, DVDs, and harddrives|https://aaru.app|{{AUR|aaru}}}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Brasero fails to normalize audio CD ===<br />
<br />
If you try to burn it may stop at the first step called Normalization.<br />
<br />
As a workaround you can disable the normalization plugin using the ''Edit > Plugins'' menu<br />
<br />
=== VLC: Error "... could not open the disc /dev/dvd" ===<br />
<br />
If you get an error like<br />
<br />
vlc dvdread could not open the disc "/dev/dvd"<br />
<br />
it may be because there is no device node {{ic|/dev/dvd}} on your system. Udev no longer creates {{ic|/dev/dvd}} and instead uses {{ic|/dev/sr0}}. To fix this, edit the VLC configuration file ({{ic|~/.config/vlc/vlcrc}}):<br />
<br />
# DVD device (string)<br />
dvd=/dev/sr0<br />
<br />
=== DVD drive is noisy ===<br />
<br />
If playing DVD videos causes the system to be very loud, it may be because the disc is spinning faster than it needs to. To temporarily change the speed of the drive, run:<br />
<br />
# eject -x 12 /dev/dvd<br />
<br />
Sometimes:<br />
<br />
# hdparm -E12 /dev/dvd<br />
<br />
Any speed that is supported by the drive can be used, or 0 for the maximum speed.<br />
<br />
[https://michal.kosmulski.org/computing/tips/cd-rom-speed.html Setting CD-ROM and DVD-ROM drive speed]<br />
<br />
=== Playback does not work with new computer (new DVD-Drive) ===<br />
<br />
If playback does not work and you have a new computer (new DVD-Drive) the reason might be that the [[Wikipedia:DVD region code|region code]] is not set. You can read and set the region code with the {{AUR|regionset}} package.<br />
<br />
=== None of the above programs are able to rip/encode a DVD to my hard disk! ===<br />
<br />
Make sure the region of your DVD reader is set correctly; otherwise, you will get loads of inexplicable [[Wikipedia:Content Scramble System|CSS]]-related errors. Use the {{AUR|regionset}} package to do so.<br />
<br />
If ripping still does not work with the correct region set, refer to the [https://videolan.videolan.me/libdvdcss/ libdvdcss developer documentation] for enabling log messages and setting other relevant options.<br />
<br />
=== GUI program log indicates problems with backend program ===<br />
<br />
If you use a GUI program and experience problems which the program's log blames on some backend program, then try to reproduce the problem by the logged backend program arguments.<br />
Whether you succeed with reproducing or not, you may report the logged lines and your own findings to the places mentioned in [[#Burn backend problems]] section.<br />
<br />
==== Special case: medium error / write error ====<br />
<br />
Here are some typical messages about the drive disliking the medium. This can only be solved by using a different drive or a different medium. A different program will hardly help.<br />
<br />
Brasero with backend growisofs:<br />
<br />
BraseroGrowisofs stderr: :-[ WRITE@LBA=0h failed with SK=3h/ASC=0Ch/ACQ=00h]: Input/output error<br />
<br />
Brasero with backend libburn:<br />
<br />
BraseroLibburn Libburn reported an error SCSI error on write(16976,16): [3 0C 00] Write error<br />
<br />
=== BD-R DL 50GB errors on trying to burn second layer ===<br />
<br />
Using ''growisofs'' from {{Pkg|dvd+rw-tools}} for burning 50GB BD-R DL discs might result in a fatal error and damaged media, such as:<br />
<br />
{{hc|$ growisofs -Z /dev/sr0 -J -R -V "label" files|<nowiki><br />
Executing 'mkisofs -J -R -V label files | builtin_dd of=/dev/sr0 obs=32k seek=0'<br />
I: -input-charset not specified, using utf-8 (detected in locale settings)<br />
0.03% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.05% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.08% done, estimate finish Fri Jan 29 19:50:36 2016<br />
/dev/sr0: pre-formatting blank BD-R for 49.8GB...<br />
/dev/sr0: "Current Write Speed" is 8.2x4390KBps.<br />
0.11% done, estimate finish Sat Jan 30 03:29:13 2016<br />
0.13% done, estimate finish Sat Jan 30 02:10:01 2016<br />
...<br />
63.20% done, estimate finish Fri Jan 29 20:43:45 2016<br />
:-[ WRITE@LBA=b6d820h failed with SK=3h/WRITE ERROR]: Input/output error<br />
:-( write failed: Input/output error<br />
/dev/sr0: flushing cache<br />
/dev/sr0: closing track<br />
/dev/sr0: closing session<br />
:-[ CLOSE SESSION failed with SK=5h/INVALID FIELD IN CDB]: Input/output error<br />
/dev/sr0: reloading tray<br />
</nowiki>}}<br />
<br />
This happened at the 25GB boundary when starting to write the second layer. Using ''cdrecord'' from {{Pkg|cdrtools}} works with no problems. Tested with a 'HL-DT-ST BD-RE WH16NS40' LG burner, and Verbatim BD-R DL 6x discs (#96911). {{bug|47797}}<br />
<br />
=== Disc tray autocloses ===<br />
<br />
If after ejecting a cd, either by using the {{ic|eject}} command, or pushing the drive button, the drive disc tray autocloses before being able to remove the disc, try the following command:<br />
<br />
# sysctl -w dev.cdrom.autoclose=0<br />
<br />
If that solves the problem, make the change permanent:<br />
<br />
{{hc|/etc/sysctl.d/60-cdrom-autoclose.conf|2=<br />
dev.cdrom.autoclose = 0<br />
}}<br />
<br />
If the above does not work and as a last resort measure, you can unload the disc module from the kernel via:<br />
<br />
# rmmod sr_mod<br />
<br />
the disc drive should now behave as expected but will not mount disc anymore. After putting a disc into the drive, reactivate the module via:<br />
<br />
# modprobe sr_mod<br />
<br />
the disc should now mount.<br />
<br />
== See also ==<br />
<br />
* In the United States, backup of physically obtained media is allowed under these conditions: [https://www.riaa.com/resources-learning/about-piracy/ About Piracy - RIAA].<br />
* [https://dev.lovelyhq.com/libburnia/web/wiki Main page of the project Libburnia]</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Optical_disc_drive_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=755911Optical disc drive (简体中文)2022-11-05T08:25:36Z<p>InsaneGuo: /* Install burning utilities */ 1</p>
<hr />
<div>[[Category:Multimedia]]<br />
[[Category:Optical disc]]<br />
[[es:Optical disc drive]]<br />
[[ja:光学ディスクドライブ]]<br />
{{Related articles start}}<br />
{{Related|Codecs}}<br />
{{Related|MPlayer}}<br />
{{Related|dvdbackup}}<br />
{{Related|MEncoder}}<br />
{{Related|Blu-ray}}<br />
{{Related|Convert any Movie to DVD Video}}<br />
{{Related articles end}}<br />
<br />
来自维基百科:<br />
<br />
在计算机领域,Optical disc drive(ODD)是一种光盘驱动器,它使用激光或可见光频谱内或附近的电磁波作为向光盘读写数据过程的一部分。<br />
<br />
== 刻录 ==<br />
<br />
{{Expansion|Are any command-line tools to arrange files into volumes to fit on a disc (like GAFFitter or cdrkit's dirsplit) packaged for Arch Linux?}}<br />
<br />
{{Warning|The quality of optical drives and the discs themselves varies greatly. Generally, using a slow burn speed is recommended for reliable burns. If you are experiencing unexpected behaviour from the disc, try burning at the lowest speed supported by your burner.}}<br />
<br />
光盘驱动器的刻录过程包括创建或获得一个图像并将其写入光学介质。该镜像原则上可以是任何数据文件。如果你想挂载生成的介质,那么它通常是一个ISO 9660文件系统的镜像文件。音频和多媒体光盘通常是从.bin文件刻录的,在.toc文件或.cue文件的控制下,告诉所需的轨道布局。<br />
<br />
=== 安装刻录工具 ===<br />
<br />
{{Style|Says twice that X is the traditional choice without stating why.}}<br />
<br />
If you want to use programs with graphical user interface, then follow [[#Burning CD/DVD/BD with a GUI]].<br />
<br />
这里列出的程序是面向命令行的。它们是大多数用于CD、DVD和BD的免费GUI程序所使用的后端。当涉及到故障排除或编写刻录活动的脚本时,GUI用户可能会用到它们。<br />
<br />
你至少需要一个创建文件系统镜像的程序和一个能够将数据刻录到你所需要的媒体类型的程序。<br />
<br />
可用于创建ISO9660类型镜像的应用有:<br />
<br />
* {{man|8|mkisofs}} from {{Pkg|cdrtools}}<br />
* {{man|1|xorriso}} and {{man|1|xorrisofs}} from {{Pkg|libisoburn}}<br />
<br />
常见的选择是 ''mkisofs''.<br />
<br />
可用于刻录媒体文件的应用有:<br />
<br />
* {{man|1|cdrdao}} from {{Pkg|cdrdao}} (CD only, TOC/CUE/BIN only)<br />
* {{man|1|cdrecord}} from {{Pkg|cdrtools}}<br />
* {{man|1|cdrskin}} from {{Pkg|libburn}}<br />
* {{man|1|growisofs}} from {{Pkg|dvd+rw-tools}} (DVD and BD only)<br />
* {{man|1|xorriso}} and {{man|1|xorrecord}} from {{Pkg|libisoburn}}<br />
<br />
常见的对于 CD的选择有 ''cdrecord'' 而 对于 DVD 和 Blu-ray Disc的选择有''growisofs'' . For writing TOC/CUE/BIN files to CD, install {{Pkg|cdrdao}}.<br />
<br />
The free GUI programs for CD, DVD, and BD burning depend on at least one of the above packages.<br />
<br />
''xorrisofs'' supports the ''mkisofs'' options which are shown in this document.<br />
<br />
''cdrskin'' supports the shown ''cdrecord'' options; ''xorrecord'' also supports those which do not deal with audio CD.<br />
<br />
=== Making an ISO image from existing files ===<br />
<br />
The simplest way to create an ISO image is to first copy the needed files to one directory, for example: {{ic|./for_iso}}.<br />
<br />
Then generate the image file with ''mkisofs'':<br />
<br />
$ mkisofs -V "''ARCHIVE_2013_07_27''" -J -r -o ''isoimage.iso'' ''./for_iso''<br />
<br />
Each of those options are explained in the following sections.<br />
<br />
==== Basic options ====<br />
<br />
;{{ic|-V}}: Specifies the name (that is assigned to) of the file system. The ISO 9660 standard specs impose the limitations of 32-character string length, as well as limiting the characters allowed to sets of: "A" to "Z", "0" to "9", and "_". This volume label will probably show up as mount point if the medium is mounted automatically.<br />
;{{ic|-J}}: Enables [[Wikipedia:Joliet (file system)|Joliet]] extension, which allocates special space to store file names in Unicode (up to 64 UTF-16 characters for each file).<br />
;{{ic|-joliet-long}}: Increases maximum length of file names from 64 to 103 UTF-16 characters in Joliet table. Non-compliant to Joliet specs and not commonly supported.<br />
;{{ic|-r}}: Enables [[Wikipedia:Rock Ridge|Rock Ridge]] extension, which adds POSIX file system semantics to an image, including support of long 255-character filenames and Unix-style file permissions.<br />
;{{ic|-o}}: Sets the file path for the resulting ISO image.<br />
<br />
==== graft-points ====<br />
<br />
It is also possible to let ''mkisofs'' to collect files and directories from various paths<br />
<br />
$ mkisofs -V "''BACKUP_2013_07_27''" -J -r -o ''backup_2013_07_27.iso'' \<br />
-graft-points \<br />
/photos=/home/''user''/photos \<br />
/mail=/home/''user''/mail \<br />
/photos/holidays=/home/''user''/holidays/photos<br />
<br />
{{ic|-graft-points}} enables the recognition of ''pathspecs'' which consist of a target address in the ISO file system (e.g. {{ic|/photos}}) and a source address (e.g. {{ic|/home/user/photos}}). Both are separated by a "=" character.<br />
<br />
So this example puts the directories {{ic|/home/user/photos}}, {{ic|/home/user/mail}} and {{ic|/home/user/holidays/photos}}, respectively in the ISO image as {{ic|/photos}}, {{ic|/mail}} and {{ic|/photos/holidays}}.<br />
<br />
Programs ''mkisofs'' and ''xorrisofs'' accept the same options. For secure backups, consider using ''xorrisofs'' with option {{ic|--for_backup}}, which records eventual ACLs and stores an MD5 checksum for each data file.<br />
<br />
See the {{man|8|mkisofs}} and {{man|1|xorrisofs}} man pages for more info about their options.<br />
<br />
=== Mounting an ISO image ===<br />
<br />
You can mount an ISO image if you want to browse its files.<br />
To mount the ISO image, we can use:<br />
<br />
# mount -t iso9660 -o ro,loop ''/path/to/file.iso'' ''/mount-point''<br />
<br />
Do not forget to unmount the image when your inspection of the image is done:<br />
<br />
# umount /mount-point<br />
<br />
See also [[Mounting images as user]] for mounting without root privileges.<br />
<br />
=== Converting img/ccd to an ISO image ===<br />
<br />
To convert an {{ic|img}}/{{ic|ccd}} image, you can use {{Pkg|ccd2iso}}:<br />
<br />
$ ccd2iso ''~/image.img'' ''~/image.iso''<br />
<br />
=== Learning the name of your optical drive ===<br />
<br />
For the remainder of this section the name of your recording device is assumed to be {{ic|/dev/sr0}}.<br />
<br />
Check this by<br />
<br />
$ cdrecord dev=''/dev/sr0'' -checkdrive<br />
<br />
which should report {{ic|Vendor_info}} and {{ic|Identification}} fields of the drive.<br />
<br />
If no drive is found, check whether any {{ic|/dev/sr*}} exist and whether they offer read/write permission ({{ic|wr-}}) to you or your group.<br />
If no {{ic|/dev/sr*}} exists then try [[Kernel modules|loading]] module {{ic|sr_mod}} manually.<br />
<br />
=== Reading the volume label of a CD or DVD ===<br />
<br />
If you want to get the name/label of the media, use ''dd'':<br />
<br />
$ dd if=''/dev/sr0'' bs=1 skip=32808 count=32<br />
<br />
=== Creating an ISO image from a CD, DVD, or BD ===<br />
<br />
In order to only copy actual data from the disc and not the empty blocks filling it up, first retrieve its block/sector count and size (2048 most of the time):<br />
<br />
{{hc|$ isosize -x /dev/sr0|<br />
sector count: 2041796, sector size: 2048<br />
}}<br />
<br />
or alternatively:<br />
<br />
{{hc|$ isoinfo -d -i /dev/sr0 {{!}} awk '/block size{{!}}Volume size/'|<br />
Logical block size is: 2048<br />
Volume size is: 2041796<br />
}}<br />
<br />
{{Note|Do not forget to replace {{ic|/dev/sr0}} with your optical drive device name.}}<br />
<br />
Then use [[dd]] to copy the data using the obtained values:<br />
<br />
$ dd if=/dev/sr0 of=discmage.iso bs=''sector_size'' count=''sector_count'' status=progress<br />
<br />
{{Tip|If the medium is damaged, it is preferable to use a dedicated utility such as {{Pkg|ddrescue}}. See [[Disk cloning#Using ddrescue]].}}<br />
<br />
If the original medium was bootable, then the copy will be a bootable image. You may use it as a pseudo CD for a virtual machine or burn it onto an optical medium which should then become bootable. [https://askubuntu.com/questions/147800/ripping-dvd-to-iso-accurately#874945]<br />
<br />
=== Erasing CD-RW and DVD-RW ===<br />
<br />
Used CD-RW media need to be erased before you can write over the previously recorded data. This is done by<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
<br />
There are two options for blanking: {{ic|1=blank=fast}} and {{ic|1=blank=all}}. Full blanking lasts as long as a full write run. It overwrites the payload data on the CD. Nevertheless this should not be considered as securely making those data unreadable. For that purpose, several full write runs with random data are advised.<br />
<br />
Alternative commands are:<br />
<br />
$ cdrskin -v dev=''/dev/sr0'' blank=fast<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
To erase the DVD-RW use the ''dvd+rw-format'' utility from {{Pkg|dvd+rw-tools}}:<br />
<br />
$ dvd+rw-format -blank=fast ''/dev/sr0''<br />
<br />
Alternative commands are:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
$ cdrskin -v dev=''/dev/sr0'' blank=deformat_sequential_quickest<br />
$ xorriso -outdev ''/dev/sr0'' -blank deformat_quickest<br />
<br />
Such fastly blanked DVD-RW are not suitable for multi-session and cannot take input streams of unpredicted length. For that purpose one has to use one of:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=all<br />
$ dvd+rw-format -blank=full ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=as_needed<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
The other media types are either write-once (CD-R, DVD-R, DVD+R, BD-R) or are overwritable without the need for erasing (DVD-RAM, DVD+RW, BD-RE).<br />
<br />
=== Formatting DVD-RW ===<br />
<br />
Formatted DVD-RW media can be overwritten without previous erasure. So consider to apply once in their life time<br />
<br />
$ dvd+rw-format -force ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=format_if_needed<br />
$ xorriso -outdev ''/dev/sr0'' -format as_needed<br />
<br />
Unlike DVD-RAM, DVD+RW, and BD-RE, formatted DVD-RW cannot be used as (slow) hard disk directly, but rather need the mediation of driver pktcdvd. See {{man|8|pktsetup}}.<br />
<br />
=== Formatting BD-RE and BD-R ===<br />
<br />
BD-RE need formatting before first use. This is done automatically by the burn programs when they detect the unformatted state. Nevertheless the size of the payload area can be influenced by expert versions of the format commands shown above for DVD-RW.<br />
<br />
BD-R can be used unformatted or formatted. Unformatted they are written with full nominal speed and offer maximum storage capacity. Formatted they get checkread during write operations and bad blocks get replaced by blocks from the Spare Area. This reduces write speed to a half or less of nominal speed. The default sized Spare Area reduces the storage capacity by 768 MiB.<br />
<br />
growisofs formats BD-R by default. The others do not. growisofs can be kept from formatting. cdrskin and xorriso can write with full nominal speed on formatted BD-RE or BD-R:<br />
<br />
$ growisofs -use-the-force-luke=spare:none ...growisofs.or.mkisofs.options...<br />
$ cdrskin stream_recording=on ...cdrecord.options...<br />
$ xorriso -stream_recording on ...xorriso.commands...<br />
<br />
=== Burning an ISO image to CD, DVD, or BD ===<br />
<br />
To burn a readily prepared ISO image file {{ic|isoimage.iso}} onto an optical medium, run for CD:<br />
<br />
$ cdrecord -v -sao dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
and for DVD or BD:<br />
<br />
$ growisofs -dvd-compat -Z ''/dev/sr0''=''isoimage.iso''<br />
<br />
for CD, DVD, BD:<br />
<br />
$ xorriso -as cdrecord -v dev=''/dev/sr0'' -dao ''isoimage.iso''<br />
<br />
{{Note|1=<br /><br />
* Make sure that the medium is not mounted when you begin to write to it. Mounting may happen automatically if the medium contains a readable file system. In the best case, it will prevent the burn programs from using the burner device. In the worst case, there will be misburns because read operations disturbed the drive. So if in doubt, do: {{bc|# umount /dev/sr0}}<br />
* ''growisofs'' has a [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=713016 small bug] with blank BD-R media. It issues an error message after the burning is complete. Programs like ''k3b'' then believe the whole burn run failed. To prevent this, either<br />
** format the blank BD-R by {{ic|dvd+rw-format ''/dev/sr0''}} before submitting it to ''growisofs''<br />
** or use ''growisofs'' option {{ic|1= -use-the-force-luke=spare:none}}<br />
}}<br />
<br />
=== Verifying the burnt ISO image ===<br />
<br />
You can verify the integrity of the burnt medium to make sure it contains no errors. Always eject the medium and reinsert it before verifying. It will guarantee that any kernel cache will not be used to read the data.<br />
<br />
First calculate the MD5 checksum of the original ISO image:<br />
<br />
{{hc|$ md5sum isoimage.iso|<br />
e5643e18e05f5646046bb2e4236986d8 isoimage.iso<br />
}}<br />
<br />
Next calculate the MD5 checksum of the ISO file system on the medium.<br />
Although some media types deliver exactly the same amount of data as have been submitted to the burn program, many others append trailing garbage when being read. So you should restrict reading to the size of the ISO image file.<br />
<br />
$ blocks=$(expr $(du -b isoimage.iso | awk '{print $1}') / 2048)<br />
<br />
{{hc|1=$ dd if=/dev/sr0 bs=2048 count=$blocks {{!}} md5sum|2=<br />
43992+0 records in<br />
43992+0 records out<br />
90095616 bytes (90 MB, 86 MiB) copied, 0.359539 s, 251 MB/s<br />
e5643e18e05f5646046bb2e4236986d8 -<br />
}}<br />
<br />
Both runs should yield the same MD5 checksum (here: {{ic|e5643e18e05f5646046bb2e4236986d8}}). If they do not, you will probably also get an I/O error message from the {{ic|dd}} run. [[dmesg]] might then tell about SCSI errors and block numbers, if you are interested.<br />
<br />
=== ISO 9660 and burning on-the-fly ===<br />
<br />
It is not necessary to store an emerging ISO file system on hard disk before writing it to optical media. Only very old CD drives in very old computers could suffer failed burns due to an empty drive buffer.<br />
<br />
If you omit option {{ic|-o}} from ''mkisofs'' then it writes the ISO image to standard output. This can be piped into the standard input of burn programs.<br />
<br />
$ mkisofs -V "ARCHIVE_2013_07_27" -J -r ./for_iso | \<br />
cdrecord -v dev=/dev/sr0 -waiti -<br />
<br />
Option {{ic|-waiti}} is not really needed here. It prevents ''cdrecord'' from writing to the medium before ''mkisofs'' starts its output. This would allow ''mkisofs'' to read the medium without disturbing an already started burn run. See next section about multi-session.<br />
<br />
On DVD and BD, you may let ''growisofs'' operate ''mkisofs'' for you and burn its output on-the-fly:<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
=== Multi-session ===<br />
<br />
ISO 9660 multi-session means that a medium with readable file system is still writable at its first unused block address, and that a new ISO directory tree gets written to this unused part. The new tree is accompanied by the content blocks of newly added or overwritten data files. The blocks of data files, which shall stay as in the old ISO tree, will not be written again.<br />
<br />
Linux and many other operating systems will mount the directory tree in the last session on the medium. This youngest tree will normally show the files of the older sessions, too.<br />
<br />
==== Multi-session by cdrecord ====<br />
<br />
CD-R and CD-RW stay writable (aka "appendable") if cdrecord option {{ic|-multi}} was used<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
Then the medium can be inquired for the parameters of the next session<br />
<br />
$ m=$(cdrecord dev=''/dev/sr0'' -msinfo)<br />
<br />
By help of these parameters and of the readable medium in the drive you can produce the add-on ISO session<br />
<br />
$ mkisofs -M ''/dev/sr0'' -C "$m" \<br />
-V "''ARCHIVE_2013_07_28''" -J -r -o ''session2.iso'' ''./more_for_iso''<br />
<br />
Finally append the session to the medium and keep it appendable again<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''session2.iso''<br />
<br />
Programs ''cdrskin'' and ''xorrecord'' do this too with DVD-R, DVD+R, BD-R and unformatted DVD-RW. Program ''cdrecord'' does multi-session with at least DVD-R and DVD-RW. They all do with CD-R and CD-RW, of course.<br />
<br />
Most re-usable media types do not record a session history that would be recognizable for a mounting kernel. But with ISO 9660 it is possible to achieve the multi-session effect even on those media.<br />
<br />
''growisofs'' and ''xorriso'' can do this and hide most of the complexity.<br />
<br />
==== Multi-session by growisofs ====<br />
<br />
By default, ''growisofs'' uses ''mkisofs'' as a backend for creating ISO images forwards most of its program arguments to . See above examples of ''mkisofs''. It bans option {{ic|-o}} and deprecates option {{ic|-C}}. By default it uses the ''mkisofs''. You may specify to use one of the others compatible backend program by setting environment variable {{ic|MKISOFS}}:<br />
<br />
$ export MKISOFS="xorrisofs"<br />
<br />
The wish to begin with a new ISO file system on the optical medium is expressed by option {{ic|-Z}}<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
The wish to append more files as new session to an existing ISO file system is expressed by option {{ic|-M}}<br />
<br />
$ growisofs -M ''/dev/sr0'' -V "''ARCHIVE_2013_07_28''" -r -J ''./more_for_iso''<br />
<br />
For details see the {{man|1|growisofs}} manual and the manuals of ''mkisofs'' and ''xorrisofs''.<br />
<br />
==== Multi-session by xorriso ====<br />
<br />
''xorriso'' learns the wish to begin with a new ISO file system from the blank state of the medium. So it is appropriate to blank it if it contains data. The command {{ic|-blank as_needed}} applies to all kinds of re-usable media and even to ISO images in data files on hard disk. It does not cause error if applied to a blank write-once medium.<br />
<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed \<br />
-volid "''ARCHIVE_2013_07_27''" -joliet on -add ''./for_iso'' --<br />
<br />
On non-blank writable media ''xorriso'' appends the newly given disc files if command {{ic|-dev}} is used rather than {{ic|-outdev}}. Of course, no command {{ic|-blank}} should be given here<br />
<br />
$ xorriso -dev ''/dev/sr0'' \<br />
-volid "''ARCHIVE_2013_07_28''" -joliet on -add ''./more_for_iso'' --<br />
<br />
For details see the {{man|1|xorriso}} man page and especially its examples.<br />
<br />
=== BD Defect Management ===<br />
<br />
BD-RE and formatted BD-R media are normally written with enabled Defect Management. This feature reads the written blocks while they are still stored in the drive buffer. In case of poor read quality the blocks get written again or redirected to the ''Spare Area'' where the data get stored in replacement blocks.<br />
<br />
This checkreading reduces write speed to at most half of the nominal speed of drive and BD medium. Sometimes it is even worse. Heavy use of the Spare Area causes long delays during read operations. So Defect Management is not always desirable.<br />
<br />
''cdrecord'' does not format BD-R. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''growisofs'' formats BD-R by default. The Defect Management can be prevented by option {{ic|1= -use-the-force-luke=spare:none}}. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''cdrskin'', ''xorriso'' and ''xorrecord'' do not format BD-R by default. They do with {{ic|1= cdrskin blank=format_if_needed}}, resp. {{ic|1= xorriso -format as_needed}}, resp. {{ic|1= xorrecord blank=format_overwrite}}. These three programs can disable Defect Management with BD-RE and already formatted BD-R by {{ic|1= cdrskin stream_recording=on}}, resp. {{ic|1= xorriso -stream_recording on}}, resp. {{ic|1= xorrecord stream_recording=on}}.<br />
<br />
=== Burning an audio CD ===<br />
<br />
Create your audio tracks and store them as uncompressed, 16-bit, 44100-Hz, stereo WAV files. To convert MP3 to WAV, ensure {{Pkg|lame}} is installed, ''cd'' to the directory with your MP3 files, and run:<br />
<br />
$ for i in *.mp3; do lame --decode "$i" "$(basename "$i" .mp3)".wav; done<br />
<br />
In case you get an error when trying to burn WAV files converted with LAME, try decoding with {{Pkg|mpg123}}:<br />
<br />
$ for i in *.mp3; do mpg123 --rate 44100 --stereo --buffer 3072 --resync -w $(basename "$i" .mp3).wav $i; done<br />
<br />
To convert AAC to WAV ensure {{Pkg|faad2}} is installed and run:<br />
$ for i in *.m4a; do faad $i; done<br />
<br />
To fix the bitrate of an already existing WAV file (or many other formats), try using {{Pkg|sox}}:<br />
$ for i in *.wav; do sox "$i" -c 2 -r 44100 "$(basename "$i" .wav)"-ok.wav; done<br />
<br />
Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as {{ic|01.wav}}, {{ic|02.wav}}, {{ic|03.wav}}, etc. Use the following command to simulate burning the WAV files as an audio CD:<br />
<br />
$ cdrecord '''-dummy''' -v -pad speed=1 dev=''/dev/sr0'' -dao -swab *.wav<br />
<br />
If everything worked, you can remove the {{ic|-dummy}} flag to actually burn the CD. <br />
<br />
{{Note|The produced disc may not play in all CD players. For an audio-only disc (discarding some track metadata), add the {{ic|-audio}} flag.}}<br />
<br />
To test the new audio CD, use [[MPlayer]]:<br />
<br />
$ mplayer cdda://<br />
<br />
=== Burning a BIN/CUE ===<br />
<br />
To burn a BIN/CUE image run:<br />
<br />
$ cdrdao write --device ''/dev/sr0'' ''image.cue''<br />
<br />
==== TOC/CUE/BIN for mixed-mode discs ====<br />
<br />
ISO images only store a single data track. If you want to create an image of a mixed-mode disc (data track with multiple audio tracks) then you need to make a TOC/BIN pair:<br />
<br />
$ cdrdao read-cd --read-raw --datafile ''image.bin'' --driver generic-mmc:0x20000 --device ''/dev/cdrom'' ''image.toc''<br />
<br />
Some software only likes CUE/BIN pair, you can make a CUE sheet with ''toc2cue'' (part of {{Pkg|cdrdao}}):<br />
<br />
$ toc2cue ''image.toc'' ''image.cue''<br />
<br />
=== Burn backend problems ===<br />
<br />
If you are experiencing problems, you may ask for advise at mailing list [mailto:cdwrite@other.debian.org cdwrite@other.debian.org], or try to write to the one of support mail addresses if some are listed near the end of the program's man page.<br />
<br />
Tell the command lines you tried, the medium type (e.g. CD-R, DVD+RW, ...), and the symptoms of failure (program messages, disappointed user expectation, ...). You will possibly get asked to obtain the newest release or development version of the affected program and to make test runs. But the answer might as well be, that your drive dislikes the particular medium.<br />
<br />
=== Burning CD/DVD/BD with a GUI ===<br />
<br />
There are several applications available to burn CDs in a graphical environment.<br />
<br />
See also [[Wikipedia:Comparison of disc authoring software]].<br />
<br />
* {{App|[[Wikipedia:AcetoneISO|AcetoneISO]]|All-in-one ISO tool (supports BIN, MDF, NRG, IMG, DAA, DMG, CDI, B5I, BWI, PDI and ISO).|https://sourceforge.net/projects/acetoneiso|{{Pkg|acetoneiso2}}}}<br />
* {{App|BashBurn|Lightweight terminal based menu frontend for CD/DVD burning tools.|http://bashburn.dose.se/|{{Pkg|bashburn}}}}<br />
* {{App|[[Wikipedia:Brasero (software)|Brasero]]|Disc burning application for the GNOME desktop that is designed to be as simple as possible.|https://wiki.gnome.org/Apps/Brasero|{{Pkg|brasero}}}}<br />
* {{App|cdw|Ncurses frontend to ''cdrecord'', ''mkisofs'', ''growisofs'', ''dvd+rw-mediainfo'', ''dvd+rw-format'' and ''xorriso''.|http://cdw.sourceforge.net/|{{AUR|cdw}}}}<br />
* {{App|Graveman|GTK-based CD/DVD burning application. It requires configuration to point to correct devices.|https://graveman.tuxfamily.org/|{{AUR|graveman}}}}<br />
* {{App|isomaster|ISO image editor.|http://littlesvr.ca/isomaster|{{AUR|isomaster}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|[[Wikipedia:X-CD-Roast|X-CD-Roast]]|Lightweight ''cdrtools'' front-end for CD and DVD writing.|http://www.xcdroast.org/|{{AUR|xcdroast}}}}<br />
* {{App|[[Wikipedia:Xfce#Xfburn|Xfburn]]|Simple front-end to the libburnia libraries with support for CD/DVD(-RW), ISO images, and BurnFree.|https://docs.xfce.org/apps/xfburn/start|{{Pkg|xfburn}}}}<br />
* {{App|xorriso-tcltk|Graphical front-end to ISO and CD/DVD/BD burn tool xorriso|https://www.gnu.org/software/xorriso/|{{Pkg|libisoburn}}}}<br />
<br />
== Playback ==<br />
<br />
=== CD ===<br />
<br />
Playback of audio CDs requires the {{Pkg|libcdio}} package. To enable KDE Applications like Dolphin to read audio CDs install {{Pkg|audiocd-kio}}.<br />
<br />
=== DVD ===<br />
<br />
If you wish to play encrypted DVDs, you must install the libdvd* packages:<br />
* {{Pkg|libdvdread}}<br />
* {{Pkg|libdvdcss}}<br />
* {{Pkg|libdvdnav}}<br />
<br />
Additionally, you must install player software. Popular DVD players are [[MPlayer]], [[Wikipedia:Xine|xine]] and [[VLC]]. See the [[List of applications/Multimedia#Video players|video players]] list and the specific instructions for [[MPlayer#DVD playing|MPlayer]].<br />
<br />
=== Blu-ray ===<br />
<br />
See [[Blu-ray#Playback]].<br />
<br />
== Ripping ==<br />
<br />
[[Wikipedia:Ripping|Ripping]] is the process of copying audio or video content to a hard disk, typically from removable media or media streams.<br />
<br />
=== Audio CD ===<br />
<br />
==== Console ====<br />
<br />
* {{App|abcde|Comprehensive command-line tool for ripping audio CDs.|https://abcde.einval.com/|{{AUR|abcde}}}}<br />
* {{App|cdda2wav|CD-audio extraction program with paranoia support.|http://www.cdda2wav.de/|{{Pkg|cdrtools}}}}<br />
* {{App|[[Wikipedia:cdparanoia|cdparanoia]]|Compact Disc Digital Audio (CDDA) Digital Audio Extraction (DAE) tool.|https://xiph.org/paranoia/index.html|{{Pkg|cdparanoia}}}}<br />
* {{App|cyanrip|Extensive CD ripper with musicbraniz integration, error detection, log generation, many formats, HDCD decoding, covert art automatic download.|https://github.com/cyanreg/cyanrip/|{{AUR|cyanrip}}}}<br />
* {{App|ripright|Minimal CD ripper modeled on autorip.|https://www.mcternan.me.uk/ripright/|{{AUR|ripright}}}}<br />
* {{App|[[Wikipedia:ripit|ripit]]|Command-line ripper that supports MusicBrainz, freeddb and various codecs. |https://www.ripit.pl/|{{AUR|ripit}}}}<br />
* {{App|shnsplit|Splits .wav and .flac files according to a CUE sheet and encodes the resulting pieces. A useful companion to ABCDE.|http://shnutils.freeshell.org/shntool/|{{AUR|shntool}}}}<br />
* {{App|whipper|CD ripper aiming for accuracy over speed. Uses cdparanoia, MusicBrainz, AccurateRip.|https://github.com/whipper-team/whipper|{{Pkg|whipper}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|[[Wikipedia:Asunder (software)|Asunder]]|GTK-based CD ripping program.|http://littlesvr.ca/asunder/|{{Pkg|asunder}}}}<br />
* {{App|Audex|Audio grabber tool for CD-ROM drives based on KDE.|https://userbase.kde.org/Audex|{{Pkg|audex}}}}<br />
* {{App|[[Wikipedia:Fre:ac|fre:ac]]|Audio converter and CD ripper with support for various popular formats and encoders.|https://freac.org/|{{AUR|freac}}}}<br />
* {{App|Goobox|CD player and ripper for GNOME.|https://people.gnome.org/~paobac/goobox/{{Dead link|2022|09|22|status=404}}|{{Pkg|goobox}}}}<br />
* {{App|[[Wikipedia:Grip (software)|Grip]]|Fast and light CD ripper within the GNOME project that resembles [[Wikipedia:Audiograbber|Audiograbber]].|https://sourceforge.net/projects/grip/|{{AUR|grip}}}}.<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|KAudioCreator|KDE program for ripping and encoding Audio-CDs. Unmaintained and [https://bugs.archlinux.org/task/67618 does not start anymore].|https://invent.kde.org/unmaintained/kaudiocreator|{{AUR|kaudiocreator-git}}}}<br />
* {{App|ripperX|GTK program to rip CD audio tracks and encode them to the Ogg, MP3, or FLAC formats.|https://sourceforge.net/projects/ripperx/|{{AUR|ripperx}}}}<br />
* {{App|rubyripper|Audio disc ripper that tries to deliver a secure rip through multiple rippings of the same track and corrections of any differences.|https://github.com/bleskodev/rubyripper|{{AUR|rubyripper}}}}<br />
* {{App|[[Wikipedia:Sound Juicer|Sound Juicer]]|CD ripper for GNOME.|https://wiki.gnome.org/Apps/SoundJuicer|{{Pkg|sound-juicer}}}}<br />
* {{App|1=soundKonverter|2=Front-end to various audio converters.|3=https://www.linux-apps.com/content/show.php?content=29024|4={{Pkg|soundkonverter}}}}<br />
<br />
=== DVD-Video ===<br />
<br />
See also [[Wikipedia:Comparison of DVD ripper software]].<br />
<br />
Often, the process of ripping a DVD can be broken down into two subtasks:<br />
<br />
# '''Data extraction''' — Copying the audio and/or video data to a hard disk,<br />
# [[Wikipedia:Transcode|Transcoding]] — Converting the extracted data into a suitable format.<br />
<br />
Some utilities perform both tasks, whilst others focus on one aspect or the other.<br />
<br />
==== Console ====<br />
<br />
* {{App|[[dvdbackup]]|Tool for pure data extraction which does not transcode. It is useful for creating ''exact'' copies of encrypted DVDs in conjunction with '''libdvdcss''' or for decrypting video for other utilities unable to read encrypted DVDs.|http://dvdbackup.sourceforge.net/|{{Pkg|dvdbackup}}}}<br />
* {{App|[[FFmpeg]]|Complete and free Internet live audio and video broadcasting solution for Linux/Unix, capable to do a direct rip in any format (audio/video) from a DVD-Video ISO image, just select the input as the ISO image and proceed with the desired options. It also allows to downmixing, shrinking, spliting, selecting streams among other features.|https://ffmpeg.org/|{{Pkg|ffmpeg}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake CLI]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping.|https://handbrake.fr/|{{Pkg|handbrake-cli}}}}<br />
* {{App|[[MEncoder]]|Free command line video decoding, encoding and filtering tool. It supports ripping and transcoding DVD-Video.|http://www.mplayerhq.hu/|{{Pkg|mencoder}}}}<br />
* {{App|subtitleripper|Convert DVD subtitles into text format.|http://subtitleripper.sourceforge.net/|{{AUR|subtitleripper}}}}<br />
* {{App|Transcode|Video/DVD ripper and encoder for the terminal/console. It is [https://www.linuxfromscratch.org/blfs/view/8.3/multimedia/transcode.html outdated/no longer actively maintained].||{{Pkg|transcode}}}}<br />
* {{App|Vobcopy|Copies DVD ''.vob'' files to hard disk, decrypting them on the way.|https://github.com/barak/vobcopy|{{AUR|vobcopy}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|dvd::rip|Front-end to {{Pkg|transcode}}, used to extract DVD's to the hard disk and transcode or extract and transcode on-the-fly.|https://www.exit1.org/dvdrip/|{{AUR|dvdrip}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping. GTK version.|https://handbrake.fr/|{{Pkg|handbrake}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|OGMRip|An application and a set of libraries for ripping and encoding DVD into AVI, OGM, MP4, or Matroska files using a wide variety of codecs. It relies on mplayer, mencoder, ogmtools, mkvtoolnix, mp4box, oggenc, lame, and faac to perform its tasks.|http://ogmrip.sourceforge.net/|{{AUR|ogmrip}}}}<br />
<br />
=== DVD-Audio ===<br />
<br />
* {{App|Python Audio Tools|Includes dvda2track, which is easy to use command line tool to extract DVD-Audio tracks to uncompressed wav files.<br />
|http://audiotools.sourceforge.net/|{{AUR|audiotools}}}}<br />
<br />
=== Multi-format ===<br />
<br />
* {{App|Aaru|Software for archival ripping of CDs, DVDs, and harddrives|https://aaru.app|{{AUR|aaru}}}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Brasero fails to normalize audio CD ===<br />
<br />
If you try to burn it may stop at the first step called Normalization.<br />
<br />
As a workaround you can disable the normalization plugin using the ''Edit > Plugins'' menu<br />
<br />
=== VLC: Error "... could not open the disc /dev/dvd" ===<br />
<br />
If you get an error like<br />
<br />
vlc dvdread could not open the disc "/dev/dvd"<br />
<br />
it may be because there is no device node {{ic|/dev/dvd}} on your system. Udev no longer creates {{ic|/dev/dvd}} and instead uses {{ic|/dev/sr0}}. To fix this, edit the VLC configuration file ({{ic|~/.config/vlc/vlcrc}}):<br />
<br />
# DVD device (string)<br />
dvd=/dev/sr0<br />
<br />
=== DVD drive is noisy ===<br />
<br />
If playing DVD videos causes the system to be very loud, it may be because the disc is spinning faster than it needs to. To temporarily change the speed of the drive, run:<br />
<br />
# eject -x 12 /dev/dvd<br />
<br />
Sometimes:<br />
<br />
# hdparm -E12 /dev/dvd<br />
<br />
Any speed that is supported by the drive can be used, or 0 for the maximum speed.<br />
<br />
[https://michal.kosmulski.org/computing/tips/cd-rom-speed.html Setting CD-ROM and DVD-ROM drive speed]<br />
<br />
=== Playback does not work with new computer (new DVD-Drive) ===<br />
<br />
If playback does not work and you have a new computer (new DVD-Drive) the reason might be that the [[Wikipedia:DVD region code|region code]] is not set. You can read and set the region code with the {{AUR|regionset}} package.<br />
<br />
=== None of the above programs are able to rip/encode a DVD to my hard disk! ===<br />
<br />
Make sure the region of your DVD reader is set correctly; otherwise, you will get loads of inexplicable [[Wikipedia:Content Scramble System|CSS]]-related errors. Use the {{AUR|regionset}} package to do so.<br />
<br />
If ripping still does not work with the correct region set, refer to the [https://videolan.videolan.me/libdvdcss/ libdvdcss developer documentation] for enabling log messages and setting other relevant options.<br />
<br />
=== GUI program log indicates problems with backend program ===<br />
<br />
If you use a GUI program and experience problems which the program's log blames on some backend program, then try to reproduce the problem by the logged backend program arguments.<br />
Whether you succeed with reproducing or not, you may report the logged lines and your own findings to the places mentioned in [[#Burn backend problems]] section.<br />
<br />
==== Special case: medium error / write error ====<br />
<br />
Here are some typical messages about the drive disliking the medium. This can only be solved by using a different drive or a different medium. A different program will hardly help.<br />
<br />
Brasero with backend growisofs:<br />
<br />
BraseroGrowisofs stderr: :-[ WRITE@LBA=0h failed with SK=3h/ASC=0Ch/ACQ=00h]: Input/output error<br />
<br />
Brasero with backend libburn:<br />
<br />
BraseroLibburn Libburn reported an error SCSI error on write(16976,16): [3 0C 00] Write error<br />
<br />
=== BD-R DL 50GB errors on trying to burn second layer ===<br />
<br />
Using ''growisofs'' from {{Pkg|dvd+rw-tools}} for burning 50GB BD-R DL discs might result in a fatal error and damaged media, such as:<br />
<br />
{{hc|$ growisofs -Z /dev/sr0 -J -R -V "label" files|<nowiki><br />
Executing 'mkisofs -J -R -V label files | builtin_dd of=/dev/sr0 obs=32k seek=0'<br />
I: -input-charset not specified, using utf-8 (detected in locale settings)<br />
0.03% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.05% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.08% done, estimate finish Fri Jan 29 19:50:36 2016<br />
/dev/sr0: pre-formatting blank BD-R for 49.8GB...<br />
/dev/sr0: "Current Write Speed" is 8.2x4390KBps.<br />
0.11% done, estimate finish Sat Jan 30 03:29:13 2016<br />
0.13% done, estimate finish Sat Jan 30 02:10:01 2016<br />
...<br />
63.20% done, estimate finish Fri Jan 29 20:43:45 2016<br />
:-[ WRITE@LBA=b6d820h failed with SK=3h/WRITE ERROR]: Input/output error<br />
:-( write failed: Input/output error<br />
/dev/sr0: flushing cache<br />
/dev/sr0: closing track<br />
/dev/sr0: closing session<br />
:-[ CLOSE SESSION failed with SK=5h/INVALID FIELD IN CDB]: Input/output error<br />
/dev/sr0: reloading tray<br />
</nowiki>}}<br />
<br />
This happened at the 25GB boundary when starting to write the second layer. Using ''cdrecord'' from {{Pkg|cdrtools}} works with no problems. Tested with a 'HL-DT-ST BD-RE WH16NS40' LG burner, and Verbatim BD-R DL 6x discs (#96911). {{bug|47797}}<br />
<br />
=== Disc tray autocloses ===<br />
<br />
If after ejecting a cd, either by using the {{ic|eject}} command, or pushing the drive button, the drive disc tray autocloses before being able to remove the disc, try the following command:<br />
<br />
# sysctl -w dev.cdrom.autoclose=0<br />
<br />
If that solves the problem, make the change permanent:<br />
<br />
{{hc|/etc/sysctl.d/60-cdrom-autoclose.conf|2=<br />
dev.cdrom.autoclose = 0<br />
}}<br />
<br />
If the above does not work and as a last resort measure, you can unload the disc module from the kernel via:<br />
<br />
# rmmod sr_mod<br />
<br />
the disc drive should now behave as expected but will not mount disc anymore. After putting a disc into the drive, reactivate the module via:<br />
<br />
# modprobe sr_mod<br />
<br />
the disc should now mount.<br />
<br />
== See also ==<br />
<br />
* In the United States, backup of physically obtained media is allowed under these conditions: [https://www.riaa.com/resources-learning/about-piracy/ About Piracy - RIAA].<br />
* [https://dev.lovelyhq.com/libburnia/web/wiki Main page of the project Libburnia]</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Optical_disc_drive_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=755910Optical disc drive (简体中文)2022-11-05T08:20:46Z<p>InsaneGuo: /* Burning */ 翻译1</p>
<hr />
<div>[[Category:Multimedia]]<br />
[[Category:Optical disc]]<br />
[[es:Optical disc drive]]<br />
[[ja:光学ディスクドライブ]]<br />
{{Related articles start}}<br />
{{Related|Codecs}}<br />
{{Related|MPlayer}}<br />
{{Related|dvdbackup}}<br />
{{Related|MEncoder}}<br />
{{Related|Blu-ray}}<br />
{{Related|Convert any Movie to DVD Video}}<br />
{{Related articles end}}<br />
<br />
来自维基百科:<br />
<br />
在计算机领域,Optical disc drive(ODD)是一种光盘驱动器,它使用激光或可见光频谱内或附近的电磁波作为向光盘读写数据过程的一部分。<br />
<br />
== 刻录 ==<br />
<br />
{{Expansion|Are any command-line tools to arrange files into volumes to fit on a disc (like GAFFitter or cdrkit's dirsplit) packaged for Arch Linux?}}<br />
<br />
{{Warning|The quality of optical drives and the discs themselves varies greatly. Generally, using a slow burn speed is recommended for reliable burns. If you are experiencing unexpected behaviour from the disc, try burning at the lowest speed supported by your burner.}}<br />
<br />
光盘驱动器的刻录过程包括创建或获得一个图像并将其写入光学介质。该镜像原则上可以是任何数据文件。如果你想挂载生成的介质,那么它通常是一个ISO 9660文件系统的镜像文件。音频和多媒体光盘通常是从.bin文件刻录的,在.toc文件或.cue文件的控制下,告诉所需的轨道布局。<br />
<br />
=== Install burning utilities ===<br />
<br />
{{Style|Says twice that X is the traditional choice without stating why.}}<br />
<br />
If you want to use programs with graphical user interface, then follow [[#Burning CD/DVD/BD with a GUI]].<br />
<br />
The programs listed here are command line oriented. They are the back ends which are used by most free GUI programs for CD, DVD, and BD. GUI users might get to them when it comes to troubleshooting or to scripting of burn activities.<br />
<br />
You need at least one program for creation of file system images and one program that is able to burn data onto your desired media type.<br />
<br />
Available programs for ISO 9660 image creation are:<br />
<br />
* {{man|8|mkisofs}} from {{Pkg|cdrtools}}<br />
* {{man|1|xorriso}} and {{man|1|xorrisofs}} from {{Pkg|libisoburn}}<br />
<br />
The traditional choice is ''mkisofs''.<br />
<br />
Available programs for burning to media are:<br />
<br />
* {{man|1|cdrdao}} from {{Pkg|cdrdao}} (CD only, TOC/CUE/BIN only)<br />
* {{man|1|cdrecord}} from {{Pkg|cdrtools}}<br />
* {{man|1|cdrskin}} from {{Pkg|libburn}}<br />
* {{man|1|growisofs}} from {{Pkg|dvd+rw-tools}} (DVD and BD only)<br />
* {{man|1|xorriso}} and {{man|1|xorrecord}} from {{Pkg|libisoburn}}<br />
<br />
The traditional choices are ''cdrecord'' for CD and ''growisofs'' for DVD and Blu-ray Disc. For writing TOC/CUE/BIN files to CD, install {{Pkg|cdrdao}}.<br />
<br />
The free GUI programs for CD, DVD, and BD burning depend on at least one of the above packages.<br />
<br />
''xorrisofs'' supports the ''mkisofs'' options which are shown in this document.<br />
<br />
''cdrskin'' supports the shown ''cdrecord'' options; ''xorrecord'' also supports those which do not deal with audio CD.<br />
<br />
=== Making an ISO image from existing files ===<br />
<br />
The simplest way to create an ISO image is to first copy the needed files to one directory, for example: {{ic|./for_iso}}.<br />
<br />
Then generate the image file with ''mkisofs'':<br />
<br />
$ mkisofs -V "''ARCHIVE_2013_07_27''" -J -r -o ''isoimage.iso'' ''./for_iso''<br />
<br />
Each of those options are explained in the following sections.<br />
<br />
==== Basic options ====<br />
<br />
;{{ic|-V}}: Specifies the name (that is assigned to) of the file system. The ISO 9660 standard specs impose the limitations of 32-character string length, as well as limiting the characters allowed to sets of: "A" to "Z", "0" to "9", and "_". This volume label will probably show up as mount point if the medium is mounted automatically.<br />
;{{ic|-J}}: Enables [[Wikipedia:Joliet (file system)|Joliet]] extension, which allocates special space to store file names in Unicode (up to 64 UTF-16 characters for each file).<br />
;{{ic|-joliet-long}}: Increases maximum length of file names from 64 to 103 UTF-16 characters in Joliet table. Non-compliant to Joliet specs and not commonly supported.<br />
;{{ic|-r}}: Enables [[Wikipedia:Rock Ridge|Rock Ridge]] extension, which adds POSIX file system semantics to an image, including support of long 255-character filenames and Unix-style file permissions.<br />
;{{ic|-o}}: Sets the file path for the resulting ISO image.<br />
<br />
==== graft-points ====<br />
<br />
It is also possible to let ''mkisofs'' to collect files and directories from various paths<br />
<br />
$ mkisofs -V "''BACKUP_2013_07_27''" -J -r -o ''backup_2013_07_27.iso'' \<br />
-graft-points \<br />
/photos=/home/''user''/photos \<br />
/mail=/home/''user''/mail \<br />
/photos/holidays=/home/''user''/holidays/photos<br />
<br />
{{ic|-graft-points}} enables the recognition of ''pathspecs'' which consist of a target address in the ISO file system (e.g. {{ic|/photos}}) and a source address (e.g. {{ic|/home/user/photos}}). Both are separated by a "=" character.<br />
<br />
So this example puts the directories {{ic|/home/user/photos}}, {{ic|/home/user/mail}} and {{ic|/home/user/holidays/photos}}, respectively in the ISO image as {{ic|/photos}}, {{ic|/mail}} and {{ic|/photos/holidays}}.<br />
<br />
Programs ''mkisofs'' and ''xorrisofs'' accept the same options. For secure backups, consider using ''xorrisofs'' with option {{ic|--for_backup}}, which records eventual ACLs and stores an MD5 checksum for each data file.<br />
<br />
See the {{man|8|mkisofs}} and {{man|1|xorrisofs}} man pages for more info about their options.<br />
<br />
=== Mounting an ISO image ===<br />
<br />
You can mount an ISO image if you want to browse its files.<br />
To mount the ISO image, we can use:<br />
<br />
# mount -t iso9660 -o ro,loop ''/path/to/file.iso'' ''/mount-point''<br />
<br />
Do not forget to unmount the image when your inspection of the image is done:<br />
<br />
# umount /mount-point<br />
<br />
See also [[Mounting images as user]] for mounting without root privileges.<br />
<br />
=== Converting img/ccd to an ISO image ===<br />
<br />
To convert an {{ic|img}}/{{ic|ccd}} image, you can use {{Pkg|ccd2iso}}:<br />
<br />
$ ccd2iso ''~/image.img'' ''~/image.iso''<br />
<br />
=== Learning the name of your optical drive ===<br />
<br />
For the remainder of this section the name of your recording device is assumed to be {{ic|/dev/sr0}}.<br />
<br />
Check this by<br />
<br />
$ cdrecord dev=''/dev/sr0'' -checkdrive<br />
<br />
which should report {{ic|Vendor_info}} and {{ic|Identification}} fields of the drive.<br />
<br />
If no drive is found, check whether any {{ic|/dev/sr*}} exist and whether they offer read/write permission ({{ic|wr-}}) to you or your group.<br />
If no {{ic|/dev/sr*}} exists then try [[Kernel modules|loading]] module {{ic|sr_mod}} manually.<br />
<br />
=== Reading the volume label of a CD or DVD ===<br />
<br />
If you want to get the name/label of the media, use ''dd'':<br />
<br />
$ dd if=''/dev/sr0'' bs=1 skip=32808 count=32<br />
<br />
=== Creating an ISO image from a CD, DVD, or BD ===<br />
<br />
In order to only copy actual data from the disc and not the empty blocks filling it up, first retrieve its block/sector count and size (2048 most of the time):<br />
<br />
{{hc|$ isosize -x /dev/sr0|<br />
sector count: 2041796, sector size: 2048<br />
}}<br />
<br />
or alternatively:<br />
<br />
{{hc|$ isoinfo -d -i /dev/sr0 {{!}} awk '/block size{{!}}Volume size/'|<br />
Logical block size is: 2048<br />
Volume size is: 2041796<br />
}}<br />
<br />
{{Note|Do not forget to replace {{ic|/dev/sr0}} with your optical drive device name.}}<br />
<br />
Then use [[dd]] to copy the data using the obtained values:<br />
<br />
$ dd if=/dev/sr0 of=discmage.iso bs=''sector_size'' count=''sector_count'' status=progress<br />
<br />
{{Tip|If the medium is damaged, it is preferable to use a dedicated utility such as {{Pkg|ddrescue}}. See [[Disk cloning#Using ddrescue]].}}<br />
<br />
If the original medium was bootable, then the copy will be a bootable image. You may use it as a pseudo CD for a virtual machine or burn it onto an optical medium which should then become bootable. [https://askubuntu.com/questions/147800/ripping-dvd-to-iso-accurately#874945]<br />
<br />
=== Erasing CD-RW and DVD-RW ===<br />
<br />
Used CD-RW media need to be erased before you can write over the previously recorded data. This is done by<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
<br />
There are two options for blanking: {{ic|1=blank=fast}} and {{ic|1=blank=all}}. Full blanking lasts as long as a full write run. It overwrites the payload data on the CD. Nevertheless this should not be considered as securely making those data unreadable. For that purpose, several full write runs with random data are advised.<br />
<br />
Alternative commands are:<br />
<br />
$ cdrskin -v dev=''/dev/sr0'' blank=fast<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
To erase the DVD-RW use the ''dvd+rw-format'' utility from {{Pkg|dvd+rw-tools}}:<br />
<br />
$ dvd+rw-format -blank=fast ''/dev/sr0''<br />
<br />
Alternative commands are:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
$ cdrskin -v dev=''/dev/sr0'' blank=deformat_sequential_quickest<br />
$ xorriso -outdev ''/dev/sr0'' -blank deformat_quickest<br />
<br />
Such fastly blanked DVD-RW are not suitable for multi-session and cannot take input streams of unpredicted length. For that purpose one has to use one of:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=all<br />
$ dvd+rw-format -blank=full ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=as_needed<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
The other media types are either write-once (CD-R, DVD-R, DVD+R, BD-R) or are overwritable without the need for erasing (DVD-RAM, DVD+RW, BD-RE).<br />
<br />
=== Formatting DVD-RW ===<br />
<br />
Formatted DVD-RW media can be overwritten without previous erasure. So consider to apply once in their life time<br />
<br />
$ dvd+rw-format -force ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=format_if_needed<br />
$ xorriso -outdev ''/dev/sr0'' -format as_needed<br />
<br />
Unlike DVD-RAM, DVD+RW, and BD-RE, formatted DVD-RW cannot be used as (slow) hard disk directly, but rather need the mediation of driver pktcdvd. See {{man|8|pktsetup}}.<br />
<br />
=== Formatting BD-RE and BD-R ===<br />
<br />
BD-RE need formatting before first use. This is done automatically by the burn programs when they detect the unformatted state. Nevertheless the size of the payload area can be influenced by expert versions of the format commands shown above for DVD-RW.<br />
<br />
BD-R can be used unformatted or formatted. Unformatted they are written with full nominal speed and offer maximum storage capacity. Formatted they get checkread during write operations and bad blocks get replaced by blocks from the Spare Area. This reduces write speed to a half or less of nominal speed. The default sized Spare Area reduces the storage capacity by 768 MiB.<br />
<br />
growisofs formats BD-R by default. The others do not. growisofs can be kept from formatting. cdrskin and xorriso can write with full nominal speed on formatted BD-RE or BD-R:<br />
<br />
$ growisofs -use-the-force-luke=spare:none ...growisofs.or.mkisofs.options...<br />
$ cdrskin stream_recording=on ...cdrecord.options...<br />
$ xorriso -stream_recording on ...xorriso.commands...<br />
<br />
=== Burning an ISO image to CD, DVD, or BD ===<br />
<br />
To burn a readily prepared ISO image file {{ic|isoimage.iso}} onto an optical medium, run for CD:<br />
<br />
$ cdrecord -v -sao dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
and for DVD or BD:<br />
<br />
$ growisofs -dvd-compat -Z ''/dev/sr0''=''isoimage.iso''<br />
<br />
for CD, DVD, BD:<br />
<br />
$ xorriso -as cdrecord -v dev=''/dev/sr0'' -dao ''isoimage.iso''<br />
<br />
{{Note|1=<br /><br />
* Make sure that the medium is not mounted when you begin to write to it. Mounting may happen automatically if the medium contains a readable file system. In the best case, it will prevent the burn programs from using the burner device. In the worst case, there will be misburns because read operations disturbed the drive. So if in doubt, do: {{bc|# umount /dev/sr0}}<br />
* ''growisofs'' has a [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=713016 small bug] with blank BD-R media. It issues an error message after the burning is complete. Programs like ''k3b'' then believe the whole burn run failed. To prevent this, either<br />
** format the blank BD-R by {{ic|dvd+rw-format ''/dev/sr0''}} before submitting it to ''growisofs''<br />
** or use ''growisofs'' option {{ic|1= -use-the-force-luke=spare:none}}<br />
}}<br />
<br />
=== Verifying the burnt ISO image ===<br />
<br />
You can verify the integrity of the burnt medium to make sure it contains no errors. Always eject the medium and reinsert it before verifying. It will guarantee that any kernel cache will not be used to read the data.<br />
<br />
First calculate the MD5 checksum of the original ISO image:<br />
<br />
{{hc|$ md5sum isoimage.iso|<br />
e5643e18e05f5646046bb2e4236986d8 isoimage.iso<br />
}}<br />
<br />
Next calculate the MD5 checksum of the ISO file system on the medium.<br />
Although some media types deliver exactly the same amount of data as have been submitted to the burn program, many others append trailing garbage when being read. So you should restrict reading to the size of the ISO image file.<br />
<br />
$ blocks=$(expr $(du -b isoimage.iso | awk '{print $1}') / 2048)<br />
<br />
{{hc|1=$ dd if=/dev/sr0 bs=2048 count=$blocks {{!}} md5sum|2=<br />
43992+0 records in<br />
43992+0 records out<br />
90095616 bytes (90 MB, 86 MiB) copied, 0.359539 s, 251 MB/s<br />
e5643e18e05f5646046bb2e4236986d8 -<br />
}}<br />
<br />
Both runs should yield the same MD5 checksum (here: {{ic|e5643e18e05f5646046bb2e4236986d8}}). If they do not, you will probably also get an I/O error message from the {{ic|dd}} run. [[dmesg]] might then tell about SCSI errors and block numbers, if you are interested.<br />
<br />
=== ISO 9660 and burning on-the-fly ===<br />
<br />
It is not necessary to store an emerging ISO file system on hard disk before writing it to optical media. Only very old CD drives in very old computers could suffer failed burns due to an empty drive buffer.<br />
<br />
If you omit option {{ic|-o}} from ''mkisofs'' then it writes the ISO image to standard output. This can be piped into the standard input of burn programs.<br />
<br />
$ mkisofs -V "ARCHIVE_2013_07_27" -J -r ./for_iso | \<br />
cdrecord -v dev=/dev/sr0 -waiti -<br />
<br />
Option {{ic|-waiti}} is not really needed here. It prevents ''cdrecord'' from writing to the medium before ''mkisofs'' starts its output. This would allow ''mkisofs'' to read the medium without disturbing an already started burn run. See next section about multi-session.<br />
<br />
On DVD and BD, you may let ''growisofs'' operate ''mkisofs'' for you and burn its output on-the-fly:<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
=== Multi-session ===<br />
<br />
ISO 9660 multi-session means that a medium with readable file system is still writable at its first unused block address, and that a new ISO directory tree gets written to this unused part. The new tree is accompanied by the content blocks of newly added or overwritten data files. The blocks of data files, which shall stay as in the old ISO tree, will not be written again.<br />
<br />
Linux and many other operating systems will mount the directory tree in the last session on the medium. This youngest tree will normally show the files of the older sessions, too.<br />
<br />
==== Multi-session by cdrecord ====<br />
<br />
CD-R and CD-RW stay writable (aka "appendable") if cdrecord option {{ic|-multi}} was used<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
Then the medium can be inquired for the parameters of the next session<br />
<br />
$ m=$(cdrecord dev=''/dev/sr0'' -msinfo)<br />
<br />
By help of these parameters and of the readable medium in the drive you can produce the add-on ISO session<br />
<br />
$ mkisofs -M ''/dev/sr0'' -C "$m" \<br />
-V "''ARCHIVE_2013_07_28''" -J -r -o ''session2.iso'' ''./more_for_iso''<br />
<br />
Finally append the session to the medium and keep it appendable again<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''session2.iso''<br />
<br />
Programs ''cdrskin'' and ''xorrecord'' do this too with DVD-R, DVD+R, BD-R and unformatted DVD-RW. Program ''cdrecord'' does multi-session with at least DVD-R and DVD-RW. They all do with CD-R and CD-RW, of course.<br />
<br />
Most re-usable media types do not record a session history that would be recognizable for a mounting kernel. But with ISO 9660 it is possible to achieve the multi-session effect even on those media.<br />
<br />
''growisofs'' and ''xorriso'' can do this and hide most of the complexity.<br />
<br />
==== Multi-session by growisofs ====<br />
<br />
By default, ''growisofs'' uses ''mkisofs'' as a backend for creating ISO images forwards most of its program arguments to . See above examples of ''mkisofs''. It bans option {{ic|-o}} and deprecates option {{ic|-C}}. By default it uses the ''mkisofs''. You may specify to use one of the others compatible backend program by setting environment variable {{ic|MKISOFS}}:<br />
<br />
$ export MKISOFS="xorrisofs"<br />
<br />
The wish to begin with a new ISO file system on the optical medium is expressed by option {{ic|-Z}}<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
The wish to append more files as new session to an existing ISO file system is expressed by option {{ic|-M}}<br />
<br />
$ growisofs -M ''/dev/sr0'' -V "''ARCHIVE_2013_07_28''" -r -J ''./more_for_iso''<br />
<br />
For details see the {{man|1|growisofs}} manual and the manuals of ''mkisofs'' and ''xorrisofs''.<br />
<br />
==== Multi-session by xorriso ====<br />
<br />
''xorriso'' learns the wish to begin with a new ISO file system from the blank state of the medium. So it is appropriate to blank it if it contains data. The command {{ic|-blank as_needed}} applies to all kinds of re-usable media and even to ISO images in data files on hard disk. It does not cause error if applied to a blank write-once medium.<br />
<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed \<br />
-volid "''ARCHIVE_2013_07_27''" -joliet on -add ''./for_iso'' --<br />
<br />
On non-blank writable media ''xorriso'' appends the newly given disc files if command {{ic|-dev}} is used rather than {{ic|-outdev}}. Of course, no command {{ic|-blank}} should be given here<br />
<br />
$ xorriso -dev ''/dev/sr0'' \<br />
-volid "''ARCHIVE_2013_07_28''" -joliet on -add ''./more_for_iso'' --<br />
<br />
For details see the {{man|1|xorriso}} man page and especially its examples.<br />
<br />
=== BD Defect Management ===<br />
<br />
BD-RE and formatted BD-R media are normally written with enabled Defect Management. This feature reads the written blocks while they are still stored in the drive buffer. In case of poor read quality the blocks get written again or redirected to the ''Spare Area'' where the data get stored in replacement blocks.<br />
<br />
This checkreading reduces write speed to at most half of the nominal speed of drive and BD medium. Sometimes it is even worse. Heavy use of the Spare Area causes long delays during read operations. So Defect Management is not always desirable.<br />
<br />
''cdrecord'' does not format BD-R. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''growisofs'' formats BD-R by default. The Defect Management can be prevented by option {{ic|1= -use-the-force-luke=spare:none}}. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''cdrskin'', ''xorriso'' and ''xorrecord'' do not format BD-R by default. They do with {{ic|1= cdrskin blank=format_if_needed}}, resp. {{ic|1= xorriso -format as_needed}}, resp. {{ic|1= xorrecord blank=format_overwrite}}. These three programs can disable Defect Management with BD-RE and already formatted BD-R by {{ic|1= cdrskin stream_recording=on}}, resp. {{ic|1= xorriso -stream_recording on}}, resp. {{ic|1= xorrecord stream_recording=on}}.<br />
<br />
=== Burning an audio CD ===<br />
<br />
Create your audio tracks and store them as uncompressed, 16-bit, 44100-Hz, stereo WAV files. To convert MP3 to WAV, ensure {{Pkg|lame}} is installed, ''cd'' to the directory with your MP3 files, and run:<br />
<br />
$ for i in *.mp3; do lame --decode "$i" "$(basename "$i" .mp3)".wav; done<br />
<br />
In case you get an error when trying to burn WAV files converted with LAME, try decoding with {{Pkg|mpg123}}:<br />
<br />
$ for i in *.mp3; do mpg123 --rate 44100 --stereo --buffer 3072 --resync -w $(basename "$i" .mp3).wav $i; done<br />
<br />
To convert AAC to WAV ensure {{Pkg|faad2}} is installed and run:<br />
$ for i in *.m4a; do faad $i; done<br />
<br />
To fix the bitrate of an already existing WAV file (or many other formats), try using {{Pkg|sox}}:<br />
$ for i in *.wav; do sox "$i" -c 2 -r 44100 "$(basename "$i" .wav)"-ok.wav; done<br />
<br />
Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as {{ic|01.wav}}, {{ic|02.wav}}, {{ic|03.wav}}, etc. Use the following command to simulate burning the WAV files as an audio CD:<br />
<br />
$ cdrecord '''-dummy''' -v -pad speed=1 dev=''/dev/sr0'' -dao -swab *.wav<br />
<br />
If everything worked, you can remove the {{ic|-dummy}} flag to actually burn the CD. <br />
<br />
{{Note|The produced disc may not play in all CD players. For an audio-only disc (discarding some track metadata), add the {{ic|-audio}} flag.}}<br />
<br />
To test the new audio CD, use [[MPlayer]]:<br />
<br />
$ mplayer cdda://<br />
<br />
=== Burning a BIN/CUE ===<br />
<br />
To burn a BIN/CUE image run:<br />
<br />
$ cdrdao write --device ''/dev/sr0'' ''image.cue''<br />
<br />
==== TOC/CUE/BIN for mixed-mode discs ====<br />
<br />
ISO images only store a single data track. If you want to create an image of a mixed-mode disc (data track with multiple audio tracks) then you need to make a TOC/BIN pair:<br />
<br />
$ cdrdao read-cd --read-raw --datafile ''image.bin'' --driver generic-mmc:0x20000 --device ''/dev/cdrom'' ''image.toc''<br />
<br />
Some software only likes CUE/BIN pair, you can make a CUE sheet with ''toc2cue'' (part of {{Pkg|cdrdao}}):<br />
<br />
$ toc2cue ''image.toc'' ''image.cue''<br />
<br />
=== Burn backend problems ===<br />
<br />
If you are experiencing problems, you may ask for advise at mailing list [mailto:cdwrite@other.debian.org cdwrite@other.debian.org], or try to write to the one of support mail addresses if some are listed near the end of the program's man page.<br />
<br />
Tell the command lines you tried, the medium type (e.g. CD-R, DVD+RW, ...), and the symptoms of failure (program messages, disappointed user expectation, ...). You will possibly get asked to obtain the newest release or development version of the affected program and to make test runs. But the answer might as well be, that your drive dislikes the particular medium.<br />
<br />
=== Burning CD/DVD/BD with a GUI ===<br />
<br />
There are several applications available to burn CDs in a graphical environment.<br />
<br />
See also [[Wikipedia:Comparison of disc authoring software]].<br />
<br />
* {{App|[[Wikipedia:AcetoneISO|AcetoneISO]]|All-in-one ISO tool (supports BIN, MDF, NRG, IMG, DAA, DMG, CDI, B5I, BWI, PDI and ISO).|https://sourceforge.net/projects/acetoneiso|{{Pkg|acetoneiso2}}}}<br />
* {{App|BashBurn|Lightweight terminal based menu frontend for CD/DVD burning tools.|http://bashburn.dose.se/|{{Pkg|bashburn}}}}<br />
* {{App|[[Wikipedia:Brasero (software)|Brasero]]|Disc burning application for the GNOME desktop that is designed to be as simple as possible.|https://wiki.gnome.org/Apps/Brasero|{{Pkg|brasero}}}}<br />
* {{App|cdw|Ncurses frontend to ''cdrecord'', ''mkisofs'', ''growisofs'', ''dvd+rw-mediainfo'', ''dvd+rw-format'' and ''xorriso''.|http://cdw.sourceforge.net/|{{AUR|cdw}}}}<br />
* {{App|Graveman|GTK-based CD/DVD burning application. It requires configuration to point to correct devices.|https://graveman.tuxfamily.org/|{{AUR|graveman}}}}<br />
* {{App|isomaster|ISO image editor.|http://littlesvr.ca/isomaster|{{AUR|isomaster}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|[[Wikipedia:X-CD-Roast|X-CD-Roast]]|Lightweight ''cdrtools'' front-end for CD and DVD writing.|http://www.xcdroast.org/|{{AUR|xcdroast}}}}<br />
* {{App|[[Wikipedia:Xfce#Xfburn|Xfburn]]|Simple front-end to the libburnia libraries with support for CD/DVD(-RW), ISO images, and BurnFree.|https://docs.xfce.org/apps/xfburn/start|{{Pkg|xfburn}}}}<br />
* {{App|xorriso-tcltk|Graphical front-end to ISO and CD/DVD/BD burn tool xorriso|https://www.gnu.org/software/xorriso/|{{Pkg|libisoburn}}}}<br />
<br />
== Playback ==<br />
<br />
=== CD ===<br />
<br />
Playback of audio CDs requires the {{Pkg|libcdio}} package. To enable KDE Applications like Dolphin to read audio CDs install {{Pkg|audiocd-kio}}.<br />
<br />
=== DVD ===<br />
<br />
If you wish to play encrypted DVDs, you must install the libdvd* packages:<br />
* {{Pkg|libdvdread}}<br />
* {{Pkg|libdvdcss}}<br />
* {{Pkg|libdvdnav}}<br />
<br />
Additionally, you must install player software. Popular DVD players are [[MPlayer]], [[Wikipedia:Xine|xine]] and [[VLC]]. See the [[List of applications/Multimedia#Video players|video players]] list and the specific instructions for [[MPlayer#DVD playing|MPlayer]].<br />
<br />
=== Blu-ray ===<br />
<br />
See [[Blu-ray#Playback]].<br />
<br />
== Ripping ==<br />
<br />
[[Wikipedia:Ripping|Ripping]] is the process of copying audio or video content to a hard disk, typically from removable media or media streams.<br />
<br />
=== Audio CD ===<br />
<br />
==== Console ====<br />
<br />
* {{App|abcde|Comprehensive command-line tool for ripping audio CDs.|https://abcde.einval.com/|{{AUR|abcde}}}}<br />
* {{App|cdda2wav|CD-audio extraction program with paranoia support.|http://www.cdda2wav.de/|{{Pkg|cdrtools}}}}<br />
* {{App|[[Wikipedia:cdparanoia|cdparanoia]]|Compact Disc Digital Audio (CDDA) Digital Audio Extraction (DAE) tool.|https://xiph.org/paranoia/index.html|{{Pkg|cdparanoia}}}}<br />
* {{App|cyanrip|Extensive CD ripper with musicbraniz integration, error detection, log generation, many formats, HDCD decoding, covert art automatic download.|https://github.com/cyanreg/cyanrip/|{{AUR|cyanrip}}}}<br />
* {{App|ripright|Minimal CD ripper modeled on autorip.|https://www.mcternan.me.uk/ripright/|{{AUR|ripright}}}}<br />
* {{App|[[Wikipedia:ripit|ripit]]|Command-line ripper that supports MusicBrainz, freeddb and various codecs. |https://www.ripit.pl/|{{AUR|ripit}}}}<br />
* {{App|shnsplit|Splits .wav and .flac files according to a CUE sheet and encodes the resulting pieces. A useful companion to ABCDE.|http://shnutils.freeshell.org/shntool/|{{AUR|shntool}}}}<br />
* {{App|whipper|CD ripper aiming for accuracy over speed. Uses cdparanoia, MusicBrainz, AccurateRip.|https://github.com/whipper-team/whipper|{{Pkg|whipper}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|[[Wikipedia:Asunder (software)|Asunder]]|GTK-based CD ripping program.|http://littlesvr.ca/asunder/|{{Pkg|asunder}}}}<br />
* {{App|Audex|Audio grabber tool for CD-ROM drives based on KDE.|https://userbase.kde.org/Audex|{{Pkg|audex}}}}<br />
* {{App|[[Wikipedia:Fre:ac|fre:ac]]|Audio converter and CD ripper with support for various popular formats and encoders.|https://freac.org/|{{AUR|freac}}}}<br />
* {{App|Goobox|CD player and ripper for GNOME.|https://people.gnome.org/~paobac/goobox/{{Dead link|2022|09|22|status=404}}|{{Pkg|goobox}}}}<br />
* {{App|[[Wikipedia:Grip (software)|Grip]]|Fast and light CD ripper within the GNOME project that resembles [[Wikipedia:Audiograbber|Audiograbber]].|https://sourceforge.net/projects/grip/|{{AUR|grip}}}}.<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|KAudioCreator|KDE program for ripping and encoding Audio-CDs. Unmaintained and [https://bugs.archlinux.org/task/67618 does not start anymore].|https://invent.kde.org/unmaintained/kaudiocreator|{{AUR|kaudiocreator-git}}}}<br />
* {{App|ripperX|GTK program to rip CD audio tracks and encode them to the Ogg, MP3, or FLAC formats.|https://sourceforge.net/projects/ripperx/|{{AUR|ripperx}}}}<br />
* {{App|rubyripper|Audio disc ripper that tries to deliver a secure rip through multiple rippings of the same track and corrections of any differences.|https://github.com/bleskodev/rubyripper|{{AUR|rubyripper}}}}<br />
* {{App|[[Wikipedia:Sound Juicer|Sound Juicer]]|CD ripper for GNOME.|https://wiki.gnome.org/Apps/SoundJuicer|{{Pkg|sound-juicer}}}}<br />
* {{App|1=soundKonverter|2=Front-end to various audio converters.|3=https://www.linux-apps.com/content/show.php?content=29024|4={{Pkg|soundkonverter}}}}<br />
<br />
=== DVD-Video ===<br />
<br />
See also [[Wikipedia:Comparison of DVD ripper software]].<br />
<br />
Often, the process of ripping a DVD can be broken down into two subtasks:<br />
<br />
# '''Data extraction''' — Copying the audio and/or video data to a hard disk,<br />
# [[Wikipedia:Transcode|Transcoding]] — Converting the extracted data into a suitable format.<br />
<br />
Some utilities perform both tasks, whilst others focus on one aspect or the other.<br />
<br />
==== Console ====<br />
<br />
* {{App|[[dvdbackup]]|Tool for pure data extraction which does not transcode. It is useful for creating ''exact'' copies of encrypted DVDs in conjunction with '''libdvdcss''' or for decrypting video for other utilities unable to read encrypted DVDs.|http://dvdbackup.sourceforge.net/|{{Pkg|dvdbackup}}}}<br />
* {{App|[[FFmpeg]]|Complete and free Internet live audio and video broadcasting solution for Linux/Unix, capable to do a direct rip in any format (audio/video) from a DVD-Video ISO image, just select the input as the ISO image and proceed with the desired options. It also allows to downmixing, shrinking, spliting, selecting streams among other features.|https://ffmpeg.org/|{{Pkg|ffmpeg}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake CLI]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping.|https://handbrake.fr/|{{Pkg|handbrake-cli}}}}<br />
* {{App|[[MEncoder]]|Free command line video decoding, encoding and filtering tool. It supports ripping and transcoding DVD-Video.|http://www.mplayerhq.hu/|{{Pkg|mencoder}}}}<br />
* {{App|subtitleripper|Convert DVD subtitles into text format.|http://subtitleripper.sourceforge.net/|{{AUR|subtitleripper}}}}<br />
* {{App|Transcode|Video/DVD ripper and encoder for the terminal/console. It is [https://www.linuxfromscratch.org/blfs/view/8.3/multimedia/transcode.html outdated/no longer actively maintained].||{{Pkg|transcode}}}}<br />
* {{App|Vobcopy|Copies DVD ''.vob'' files to hard disk, decrypting them on the way.|https://github.com/barak/vobcopy|{{AUR|vobcopy}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|dvd::rip|Front-end to {{Pkg|transcode}}, used to extract DVD's to the hard disk and transcode or extract and transcode on-the-fly.|https://www.exit1.org/dvdrip/|{{AUR|dvdrip}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping. GTK version.|https://handbrake.fr/|{{Pkg|handbrake}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|OGMRip|An application and a set of libraries for ripping and encoding DVD into AVI, OGM, MP4, or Matroska files using a wide variety of codecs. It relies on mplayer, mencoder, ogmtools, mkvtoolnix, mp4box, oggenc, lame, and faac to perform its tasks.|http://ogmrip.sourceforge.net/|{{AUR|ogmrip}}}}<br />
<br />
=== DVD-Audio ===<br />
<br />
* {{App|Python Audio Tools|Includes dvda2track, which is easy to use command line tool to extract DVD-Audio tracks to uncompressed wav files.<br />
|http://audiotools.sourceforge.net/|{{AUR|audiotools}}}}<br />
<br />
=== Multi-format ===<br />
<br />
* {{App|Aaru|Software for archival ripping of CDs, DVDs, and harddrives|https://aaru.app|{{AUR|aaru}}}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Brasero fails to normalize audio CD ===<br />
<br />
If you try to burn it may stop at the first step called Normalization.<br />
<br />
As a workaround you can disable the normalization plugin using the ''Edit > Plugins'' menu<br />
<br />
=== VLC: Error "... could not open the disc /dev/dvd" ===<br />
<br />
If you get an error like<br />
<br />
vlc dvdread could not open the disc "/dev/dvd"<br />
<br />
it may be because there is no device node {{ic|/dev/dvd}} on your system. Udev no longer creates {{ic|/dev/dvd}} and instead uses {{ic|/dev/sr0}}. To fix this, edit the VLC configuration file ({{ic|~/.config/vlc/vlcrc}}):<br />
<br />
# DVD device (string)<br />
dvd=/dev/sr0<br />
<br />
=== DVD drive is noisy ===<br />
<br />
If playing DVD videos causes the system to be very loud, it may be because the disc is spinning faster than it needs to. To temporarily change the speed of the drive, run:<br />
<br />
# eject -x 12 /dev/dvd<br />
<br />
Sometimes:<br />
<br />
# hdparm -E12 /dev/dvd<br />
<br />
Any speed that is supported by the drive can be used, or 0 for the maximum speed.<br />
<br />
[https://michal.kosmulski.org/computing/tips/cd-rom-speed.html Setting CD-ROM and DVD-ROM drive speed]<br />
<br />
=== Playback does not work with new computer (new DVD-Drive) ===<br />
<br />
If playback does not work and you have a new computer (new DVD-Drive) the reason might be that the [[Wikipedia:DVD region code|region code]] is not set. You can read and set the region code with the {{AUR|regionset}} package.<br />
<br />
=== None of the above programs are able to rip/encode a DVD to my hard disk! ===<br />
<br />
Make sure the region of your DVD reader is set correctly; otherwise, you will get loads of inexplicable [[Wikipedia:Content Scramble System|CSS]]-related errors. Use the {{AUR|regionset}} package to do so.<br />
<br />
If ripping still does not work with the correct region set, refer to the [https://videolan.videolan.me/libdvdcss/ libdvdcss developer documentation] for enabling log messages and setting other relevant options.<br />
<br />
=== GUI program log indicates problems with backend program ===<br />
<br />
If you use a GUI program and experience problems which the program's log blames on some backend program, then try to reproduce the problem by the logged backend program arguments.<br />
Whether you succeed with reproducing or not, you may report the logged lines and your own findings to the places mentioned in [[#Burn backend problems]] section.<br />
<br />
==== Special case: medium error / write error ====<br />
<br />
Here are some typical messages about the drive disliking the medium. This can only be solved by using a different drive or a different medium. A different program will hardly help.<br />
<br />
Brasero with backend growisofs:<br />
<br />
BraseroGrowisofs stderr: :-[ WRITE@LBA=0h failed with SK=3h/ASC=0Ch/ACQ=00h]: Input/output error<br />
<br />
Brasero with backend libburn:<br />
<br />
BraseroLibburn Libburn reported an error SCSI error on write(16976,16): [3 0C 00] Write error<br />
<br />
=== BD-R DL 50GB errors on trying to burn second layer ===<br />
<br />
Using ''growisofs'' from {{Pkg|dvd+rw-tools}} for burning 50GB BD-R DL discs might result in a fatal error and damaged media, such as:<br />
<br />
{{hc|$ growisofs -Z /dev/sr0 -J -R -V "label" files|<nowiki><br />
Executing 'mkisofs -J -R -V label files | builtin_dd of=/dev/sr0 obs=32k seek=0'<br />
I: -input-charset not specified, using utf-8 (detected in locale settings)<br />
0.03% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.05% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.08% done, estimate finish Fri Jan 29 19:50:36 2016<br />
/dev/sr0: pre-formatting blank BD-R for 49.8GB...<br />
/dev/sr0: "Current Write Speed" is 8.2x4390KBps.<br />
0.11% done, estimate finish Sat Jan 30 03:29:13 2016<br />
0.13% done, estimate finish Sat Jan 30 02:10:01 2016<br />
...<br />
63.20% done, estimate finish Fri Jan 29 20:43:45 2016<br />
:-[ WRITE@LBA=b6d820h failed with SK=3h/WRITE ERROR]: Input/output error<br />
:-( write failed: Input/output error<br />
/dev/sr0: flushing cache<br />
/dev/sr0: closing track<br />
/dev/sr0: closing session<br />
:-[ CLOSE SESSION failed with SK=5h/INVALID FIELD IN CDB]: Input/output error<br />
/dev/sr0: reloading tray<br />
</nowiki>}}<br />
<br />
This happened at the 25GB boundary when starting to write the second layer. Using ''cdrecord'' from {{Pkg|cdrtools}} works with no problems. Tested with a 'HL-DT-ST BD-RE WH16NS40' LG burner, and Verbatim BD-R DL 6x discs (#96911). {{bug|47797}}<br />
<br />
=== Disc tray autocloses ===<br />
<br />
If after ejecting a cd, either by using the {{ic|eject}} command, or pushing the drive button, the drive disc tray autocloses before being able to remove the disc, try the following command:<br />
<br />
# sysctl -w dev.cdrom.autoclose=0<br />
<br />
If that solves the problem, make the change permanent:<br />
<br />
{{hc|/etc/sysctl.d/60-cdrom-autoclose.conf|2=<br />
dev.cdrom.autoclose = 0<br />
}}<br />
<br />
If the above does not work and as a last resort measure, you can unload the disc module from the kernel via:<br />
<br />
# rmmod sr_mod<br />
<br />
the disc drive should now behave as expected but will not mount disc anymore. After putting a disc into the drive, reactivate the module via:<br />
<br />
# modprobe sr_mod<br />
<br />
the disc should now mount.<br />
<br />
== See also ==<br />
<br />
* In the United States, backup of physically obtained media is allowed under these conditions: [https://www.riaa.com/resources-learning/about-piracy/ About Piracy - RIAA].<br />
* [https://dev.lovelyhq.com/libburnia/web/wiki Main page of the project Libburnia]</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Optical_disc_drive_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=755909Optical disc drive (简体中文)2022-11-05T08:19:49Z<p>InsaneGuo: 1</p>
<hr />
<div>[[Category:Multimedia]]<br />
[[Category:Optical disc]]<br />
[[es:Optical disc drive]]<br />
[[ja:光学ディスクドライブ]]<br />
{{Related articles start}}<br />
{{Related|Codecs}}<br />
{{Related|MPlayer}}<br />
{{Related|dvdbackup}}<br />
{{Related|MEncoder}}<br />
{{Related|Blu-ray}}<br />
{{Related|Convert any Movie to DVD Video}}<br />
{{Related articles end}}<br />
<br />
来自维基百科:<br />
<br />
在计算机领域,Optical disc drive(ODD)是一种光盘驱动器,它使用激光或可见光频谱内或附近的电磁波作为向光盘读写数据过程的一部分。<br />
<br />
== Burning ==<br />
<br />
{{Expansion|Are any command-line tools to arrange files into volumes to fit on a disc (like GAFFitter or cdrkit's dirsplit) packaged for Arch Linux?}}<br />
<br />
{{Warning|The quality of optical drives and the discs themselves varies greatly. Generally, using a slow burn speed is recommended for reliable burns. If you are experiencing unexpected behaviour from the disc, try burning at the lowest speed supported by your burner.}}<br />
<br />
The burning process of optical disc drives consists of creating or obtaining an image and writing it to an optical medium. The image may in principle be any data file. If you want to mount the resulting medium, then it is usually an ISO 9660 file system image file. Audio and multi-media CDs are often burned from a ''.bin'' file, under control of a ''.toc'' file or a ''.cue'' file which tell the desired track layout.<br />
<br />
=== Install burning utilities ===<br />
<br />
{{Style|Says twice that X is the traditional choice without stating why.}}<br />
<br />
If you want to use programs with graphical user interface, then follow [[#Burning CD/DVD/BD with a GUI]].<br />
<br />
The programs listed here are command line oriented. They are the back ends which are used by most free GUI programs for CD, DVD, and BD. GUI users might get to them when it comes to troubleshooting or to scripting of burn activities.<br />
<br />
You need at least one program for creation of file system images and one program that is able to burn data onto your desired media type.<br />
<br />
Available programs for ISO 9660 image creation are:<br />
<br />
* {{man|8|mkisofs}} from {{Pkg|cdrtools}}<br />
* {{man|1|xorriso}} and {{man|1|xorrisofs}} from {{Pkg|libisoburn}}<br />
<br />
The traditional choice is ''mkisofs''.<br />
<br />
Available programs for burning to media are:<br />
<br />
* {{man|1|cdrdao}} from {{Pkg|cdrdao}} (CD only, TOC/CUE/BIN only)<br />
* {{man|1|cdrecord}} from {{Pkg|cdrtools}}<br />
* {{man|1|cdrskin}} from {{Pkg|libburn}}<br />
* {{man|1|growisofs}} from {{Pkg|dvd+rw-tools}} (DVD and BD only)<br />
* {{man|1|xorriso}} and {{man|1|xorrecord}} from {{Pkg|libisoburn}}<br />
<br />
The traditional choices are ''cdrecord'' for CD and ''growisofs'' for DVD and Blu-ray Disc. For writing TOC/CUE/BIN files to CD, install {{Pkg|cdrdao}}.<br />
<br />
The free GUI programs for CD, DVD, and BD burning depend on at least one of the above packages.<br />
<br />
''xorrisofs'' supports the ''mkisofs'' options which are shown in this document.<br />
<br />
''cdrskin'' supports the shown ''cdrecord'' options; ''xorrecord'' also supports those which do not deal with audio CD.<br />
<br />
=== Making an ISO image from existing files ===<br />
<br />
The simplest way to create an ISO image is to first copy the needed files to one directory, for example: {{ic|./for_iso}}.<br />
<br />
Then generate the image file with ''mkisofs'':<br />
<br />
$ mkisofs -V "''ARCHIVE_2013_07_27''" -J -r -o ''isoimage.iso'' ''./for_iso''<br />
<br />
Each of those options are explained in the following sections.<br />
<br />
==== Basic options ====<br />
<br />
;{{ic|-V}}: Specifies the name (that is assigned to) of the file system. The ISO 9660 standard specs impose the limitations of 32-character string length, as well as limiting the characters allowed to sets of: "A" to "Z", "0" to "9", and "_". This volume label will probably show up as mount point if the medium is mounted automatically.<br />
;{{ic|-J}}: Enables [[Wikipedia:Joliet (file system)|Joliet]] extension, which allocates special space to store file names in Unicode (up to 64 UTF-16 characters for each file).<br />
;{{ic|-joliet-long}}: Increases maximum length of file names from 64 to 103 UTF-16 characters in Joliet table. Non-compliant to Joliet specs and not commonly supported.<br />
;{{ic|-r}}: Enables [[Wikipedia:Rock Ridge|Rock Ridge]] extension, which adds POSIX file system semantics to an image, including support of long 255-character filenames and Unix-style file permissions.<br />
;{{ic|-o}}: Sets the file path for the resulting ISO image.<br />
<br />
==== graft-points ====<br />
<br />
It is also possible to let ''mkisofs'' to collect files and directories from various paths<br />
<br />
$ mkisofs -V "''BACKUP_2013_07_27''" -J -r -o ''backup_2013_07_27.iso'' \<br />
-graft-points \<br />
/photos=/home/''user''/photos \<br />
/mail=/home/''user''/mail \<br />
/photos/holidays=/home/''user''/holidays/photos<br />
<br />
{{ic|-graft-points}} enables the recognition of ''pathspecs'' which consist of a target address in the ISO file system (e.g. {{ic|/photos}}) and a source address (e.g. {{ic|/home/user/photos}}). Both are separated by a "=" character.<br />
<br />
So this example puts the directories {{ic|/home/user/photos}}, {{ic|/home/user/mail}} and {{ic|/home/user/holidays/photos}}, respectively in the ISO image as {{ic|/photos}}, {{ic|/mail}} and {{ic|/photos/holidays}}.<br />
<br />
Programs ''mkisofs'' and ''xorrisofs'' accept the same options. For secure backups, consider using ''xorrisofs'' with option {{ic|--for_backup}}, which records eventual ACLs and stores an MD5 checksum for each data file.<br />
<br />
See the {{man|8|mkisofs}} and {{man|1|xorrisofs}} man pages for more info about their options.<br />
<br />
=== Mounting an ISO image ===<br />
<br />
You can mount an ISO image if you want to browse its files.<br />
To mount the ISO image, we can use:<br />
<br />
# mount -t iso9660 -o ro,loop ''/path/to/file.iso'' ''/mount-point''<br />
<br />
Do not forget to unmount the image when your inspection of the image is done:<br />
<br />
# umount /mount-point<br />
<br />
See also [[Mounting images as user]] for mounting without root privileges.<br />
<br />
=== Converting img/ccd to an ISO image ===<br />
<br />
To convert an {{ic|img}}/{{ic|ccd}} image, you can use {{Pkg|ccd2iso}}:<br />
<br />
$ ccd2iso ''~/image.img'' ''~/image.iso''<br />
<br />
=== Learning the name of your optical drive ===<br />
<br />
For the remainder of this section the name of your recording device is assumed to be {{ic|/dev/sr0}}.<br />
<br />
Check this by<br />
<br />
$ cdrecord dev=''/dev/sr0'' -checkdrive<br />
<br />
which should report {{ic|Vendor_info}} and {{ic|Identification}} fields of the drive.<br />
<br />
If no drive is found, check whether any {{ic|/dev/sr*}} exist and whether they offer read/write permission ({{ic|wr-}}) to you or your group.<br />
If no {{ic|/dev/sr*}} exists then try [[Kernel modules|loading]] module {{ic|sr_mod}} manually.<br />
<br />
=== Reading the volume label of a CD or DVD ===<br />
<br />
If you want to get the name/label of the media, use ''dd'':<br />
<br />
$ dd if=''/dev/sr0'' bs=1 skip=32808 count=32<br />
<br />
=== Creating an ISO image from a CD, DVD, or BD ===<br />
<br />
In order to only copy actual data from the disc and not the empty blocks filling it up, first retrieve its block/sector count and size (2048 most of the time):<br />
<br />
{{hc|$ isosize -x /dev/sr0|<br />
sector count: 2041796, sector size: 2048<br />
}}<br />
<br />
or alternatively:<br />
<br />
{{hc|$ isoinfo -d -i /dev/sr0 {{!}} awk '/block size{{!}}Volume size/'|<br />
Logical block size is: 2048<br />
Volume size is: 2041796<br />
}}<br />
<br />
{{Note|Do not forget to replace {{ic|/dev/sr0}} with your optical drive device name.}}<br />
<br />
Then use [[dd]] to copy the data using the obtained values:<br />
<br />
$ dd if=/dev/sr0 of=discmage.iso bs=''sector_size'' count=''sector_count'' status=progress<br />
<br />
{{Tip|If the medium is damaged, it is preferable to use a dedicated utility such as {{Pkg|ddrescue}}. See [[Disk cloning#Using ddrescue]].}}<br />
<br />
If the original medium was bootable, then the copy will be a bootable image. You may use it as a pseudo CD for a virtual machine or burn it onto an optical medium which should then become bootable. [https://askubuntu.com/questions/147800/ripping-dvd-to-iso-accurately#874945]<br />
<br />
=== Erasing CD-RW and DVD-RW ===<br />
<br />
Used CD-RW media need to be erased before you can write over the previously recorded data. This is done by<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
<br />
There are two options for blanking: {{ic|1=blank=fast}} and {{ic|1=blank=all}}. Full blanking lasts as long as a full write run. It overwrites the payload data on the CD. Nevertheless this should not be considered as securely making those data unreadable. For that purpose, several full write runs with random data are advised.<br />
<br />
Alternative commands are:<br />
<br />
$ cdrskin -v dev=''/dev/sr0'' blank=fast<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
To erase the DVD-RW use the ''dvd+rw-format'' utility from {{Pkg|dvd+rw-tools}}:<br />
<br />
$ dvd+rw-format -blank=fast ''/dev/sr0''<br />
<br />
Alternative commands are:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
$ cdrskin -v dev=''/dev/sr0'' blank=deformat_sequential_quickest<br />
$ xorriso -outdev ''/dev/sr0'' -blank deformat_quickest<br />
<br />
Such fastly blanked DVD-RW are not suitable for multi-session and cannot take input streams of unpredicted length. For that purpose one has to use one of:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=all<br />
$ dvd+rw-format -blank=full ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=as_needed<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
The other media types are either write-once (CD-R, DVD-R, DVD+R, BD-R) or are overwritable without the need for erasing (DVD-RAM, DVD+RW, BD-RE).<br />
<br />
=== Formatting DVD-RW ===<br />
<br />
Formatted DVD-RW media can be overwritten without previous erasure. So consider to apply once in their life time<br />
<br />
$ dvd+rw-format -force ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=format_if_needed<br />
$ xorriso -outdev ''/dev/sr0'' -format as_needed<br />
<br />
Unlike DVD-RAM, DVD+RW, and BD-RE, formatted DVD-RW cannot be used as (slow) hard disk directly, but rather need the mediation of driver pktcdvd. See {{man|8|pktsetup}}.<br />
<br />
=== Formatting BD-RE and BD-R ===<br />
<br />
BD-RE need formatting before first use. This is done automatically by the burn programs when they detect the unformatted state. Nevertheless the size of the payload area can be influenced by expert versions of the format commands shown above for DVD-RW.<br />
<br />
BD-R can be used unformatted or formatted. Unformatted they are written with full nominal speed and offer maximum storage capacity. Formatted they get checkread during write operations and bad blocks get replaced by blocks from the Spare Area. This reduces write speed to a half or less of nominal speed. The default sized Spare Area reduces the storage capacity by 768 MiB.<br />
<br />
growisofs formats BD-R by default. The others do not. growisofs can be kept from formatting. cdrskin and xorriso can write with full nominal speed on formatted BD-RE or BD-R:<br />
<br />
$ growisofs -use-the-force-luke=spare:none ...growisofs.or.mkisofs.options...<br />
$ cdrskin stream_recording=on ...cdrecord.options...<br />
$ xorriso -stream_recording on ...xorriso.commands...<br />
<br />
=== Burning an ISO image to CD, DVD, or BD ===<br />
<br />
To burn a readily prepared ISO image file {{ic|isoimage.iso}} onto an optical medium, run for CD:<br />
<br />
$ cdrecord -v -sao dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
and for DVD or BD:<br />
<br />
$ growisofs -dvd-compat -Z ''/dev/sr0''=''isoimage.iso''<br />
<br />
for CD, DVD, BD:<br />
<br />
$ xorriso -as cdrecord -v dev=''/dev/sr0'' -dao ''isoimage.iso''<br />
<br />
{{Note|1=<br /><br />
* Make sure that the medium is not mounted when you begin to write to it. Mounting may happen automatically if the medium contains a readable file system. In the best case, it will prevent the burn programs from using the burner device. In the worst case, there will be misburns because read operations disturbed the drive. So if in doubt, do: {{bc|# umount /dev/sr0}}<br />
* ''growisofs'' has a [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=713016 small bug] with blank BD-R media. It issues an error message after the burning is complete. Programs like ''k3b'' then believe the whole burn run failed. To prevent this, either<br />
** format the blank BD-R by {{ic|dvd+rw-format ''/dev/sr0''}} before submitting it to ''growisofs''<br />
** or use ''growisofs'' option {{ic|1= -use-the-force-luke=spare:none}}<br />
}}<br />
<br />
=== Verifying the burnt ISO image ===<br />
<br />
You can verify the integrity of the burnt medium to make sure it contains no errors. Always eject the medium and reinsert it before verifying. It will guarantee that any kernel cache will not be used to read the data.<br />
<br />
First calculate the MD5 checksum of the original ISO image:<br />
<br />
{{hc|$ md5sum isoimage.iso|<br />
e5643e18e05f5646046bb2e4236986d8 isoimage.iso<br />
}}<br />
<br />
Next calculate the MD5 checksum of the ISO file system on the medium.<br />
Although some media types deliver exactly the same amount of data as have been submitted to the burn program, many others append trailing garbage when being read. So you should restrict reading to the size of the ISO image file.<br />
<br />
$ blocks=$(expr $(du -b isoimage.iso | awk '{print $1}') / 2048)<br />
<br />
{{hc|1=$ dd if=/dev/sr0 bs=2048 count=$blocks {{!}} md5sum|2=<br />
43992+0 records in<br />
43992+0 records out<br />
90095616 bytes (90 MB, 86 MiB) copied, 0.359539 s, 251 MB/s<br />
e5643e18e05f5646046bb2e4236986d8 -<br />
}}<br />
<br />
Both runs should yield the same MD5 checksum (here: {{ic|e5643e18e05f5646046bb2e4236986d8}}). If they do not, you will probably also get an I/O error message from the {{ic|dd}} run. [[dmesg]] might then tell about SCSI errors and block numbers, if you are interested.<br />
<br />
=== ISO 9660 and burning on-the-fly ===<br />
<br />
It is not necessary to store an emerging ISO file system on hard disk before writing it to optical media. Only very old CD drives in very old computers could suffer failed burns due to an empty drive buffer.<br />
<br />
If you omit option {{ic|-o}} from ''mkisofs'' then it writes the ISO image to standard output. This can be piped into the standard input of burn programs.<br />
<br />
$ mkisofs -V "ARCHIVE_2013_07_27" -J -r ./for_iso | \<br />
cdrecord -v dev=/dev/sr0 -waiti -<br />
<br />
Option {{ic|-waiti}} is not really needed here. It prevents ''cdrecord'' from writing to the medium before ''mkisofs'' starts its output. This would allow ''mkisofs'' to read the medium without disturbing an already started burn run. See next section about multi-session.<br />
<br />
On DVD and BD, you may let ''growisofs'' operate ''mkisofs'' for you and burn its output on-the-fly:<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
=== Multi-session ===<br />
<br />
ISO 9660 multi-session means that a medium with readable file system is still writable at its first unused block address, and that a new ISO directory tree gets written to this unused part. The new tree is accompanied by the content blocks of newly added or overwritten data files. The blocks of data files, which shall stay as in the old ISO tree, will not be written again.<br />
<br />
Linux and many other operating systems will mount the directory tree in the last session on the medium. This youngest tree will normally show the files of the older sessions, too.<br />
<br />
==== Multi-session by cdrecord ====<br />
<br />
CD-R and CD-RW stay writable (aka "appendable") if cdrecord option {{ic|-multi}} was used<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
Then the medium can be inquired for the parameters of the next session<br />
<br />
$ m=$(cdrecord dev=''/dev/sr0'' -msinfo)<br />
<br />
By help of these parameters and of the readable medium in the drive you can produce the add-on ISO session<br />
<br />
$ mkisofs -M ''/dev/sr0'' -C "$m" \<br />
-V "''ARCHIVE_2013_07_28''" -J -r -o ''session2.iso'' ''./more_for_iso''<br />
<br />
Finally append the session to the medium and keep it appendable again<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''session2.iso''<br />
<br />
Programs ''cdrskin'' and ''xorrecord'' do this too with DVD-R, DVD+R, BD-R and unformatted DVD-RW. Program ''cdrecord'' does multi-session with at least DVD-R and DVD-RW. They all do with CD-R and CD-RW, of course.<br />
<br />
Most re-usable media types do not record a session history that would be recognizable for a mounting kernel. But with ISO 9660 it is possible to achieve the multi-session effect even on those media.<br />
<br />
''growisofs'' and ''xorriso'' can do this and hide most of the complexity.<br />
<br />
==== Multi-session by growisofs ====<br />
<br />
By default, ''growisofs'' uses ''mkisofs'' as a backend for creating ISO images forwards most of its program arguments to . See above examples of ''mkisofs''. It bans option {{ic|-o}} and deprecates option {{ic|-C}}. By default it uses the ''mkisofs''. You may specify to use one of the others compatible backend program by setting environment variable {{ic|MKISOFS}}:<br />
<br />
$ export MKISOFS="xorrisofs"<br />
<br />
The wish to begin with a new ISO file system on the optical medium is expressed by option {{ic|-Z}}<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
The wish to append more files as new session to an existing ISO file system is expressed by option {{ic|-M}}<br />
<br />
$ growisofs -M ''/dev/sr0'' -V "''ARCHIVE_2013_07_28''" -r -J ''./more_for_iso''<br />
<br />
For details see the {{man|1|growisofs}} manual and the manuals of ''mkisofs'' and ''xorrisofs''.<br />
<br />
==== Multi-session by xorriso ====<br />
<br />
''xorriso'' learns the wish to begin with a new ISO file system from the blank state of the medium. So it is appropriate to blank it if it contains data. The command {{ic|-blank as_needed}} applies to all kinds of re-usable media and even to ISO images in data files on hard disk. It does not cause error if applied to a blank write-once medium.<br />
<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed \<br />
-volid "''ARCHIVE_2013_07_27''" -joliet on -add ''./for_iso'' --<br />
<br />
On non-blank writable media ''xorriso'' appends the newly given disc files if command {{ic|-dev}} is used rather than {{ic|-outdev}}. Of course, no command {{ic|-blank}} should be given here<br />
<br />
$ xorriso -dev ''/dev/sr0'' \<br />
-volid "''ARCHIVE_2013_07_28''" -joliet on -add ''./more_for_iso'' --<br />
<br />
For details see the {{man|1|xorriso}} man page and especially its examples.<br />
<br />
=== BD Defect Management ===<br />
<br />
BD-RE and formatted BD-R media are normally written with enabled Defect Management. This feature reads the written blocks while they are still stored in the drive buffer. In case of poor read quality the blocks get written again or redirected to the ''Spare Area'' where the data get stored in replacement blocks.<br />
<br />
This checkreading reduces write speed to at most half of the nominal speed of drive and BD medium. Sometimes it is even worse. Heavy use of the Spare Area causes long delays during read operations. So Defect Management is not always desirable.<br />
<br />
''cdrecord'' does not format BD-R. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''growisofs'' formats BD-R by default. The Defect Management can be prevented by option {{ic|1= -use-the-force-luke=spare:none}}. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''cdrskin'', ''xorriso'' and ''xorrecord'' do not format BD-R by default. They do with {{ic|1= cdrskin blank=format_if_needed}}, resp. {{ic|1= xorriso -format as_needed}}, resp. {{ic|1= xorrecord blank=format_overwrite}}. These three programs can disable Defect Management with BD-RE and already formatted BD-R by {{ic|1= cdrskin stream_recording=on}}, resp. {{ic|1= xorriso -stream_recording on}}, resp. {{ic|1= xorrecord stream_recording=on}}.<br />
<br />
=== Burning an audio CD ===<br />
<br />
Create your audio tracks and store them as uncompressed, 16-bit, 44100-Hz, stereo WAV files. To convert MP3 to WAV, ensure {{Pkg|lame}} is installed, ''cd'' to the directory with your MP3 files, and run:<br />
<br />
$ for i in *.mp3; do lame --decode "$i" "$(basename "$i" .mp3)".wav; done<br />
<br />
In case you get an error when trying to burn WAV files converted with LAME, try decoding with {{Pkg|mpg123}}:<br />
<br />
$ for i in *.mp3; do mpg123 --rate 44100 --stereo --buffer 3072 --resync -w $(basename "$i" .mp3).wav $i; done<br />
<br />
To convert AAC to WAV ensure {{Pkg|faad2}} is installed and run:<br />
$ for i in *.m4a; do faad $i; done<br />
<br />
To fix the bitrate of an already existing WAV file (or many other formats), try using {{Pkg|sox}}:<br />
$ for i in *.wav; do sox "$i" -c 2 -r 44100 "$(basename "$i" .wav)"-ok.wav; done<br />
<br />
Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as {{ic|01.wav}}, {{ic|02.wav}}, {{ic|03.wav}}, etc. Use the following command to simulate burning the WAV files as an audio CD:<br />
<br />
$ cdrecord '''-dummy''' -v -pad speed=1 dev=''/dev/sr0'' -dao -swab *.wav<br />
<br />
If everything worked, you can remove the {{ic|-dummy}} flag to actually burn the CD. <br />
<br />
{{Note|The produced disc may not play in all CD players. For an audio-only disc (discarding some track metadata), add the {{ic|-audio}} flag.}}<br />
<br />
To test the new audio CD, use [[MPlayer]]:<br />
<br />
$ mplayer cdda://<br />
<br />
=== Burning a BIN/CUE ===<br />
<br />
To burn a BIN/CUE image run:<br />
<br />
$ cdrdao write --device ''/dev/sr0'' ''image.cue''<br />
<br />
==== TOC/CUE/BIN for mixed-mode discs ====<br />
<br />
ISO images only store a single data track. If you want to create an image of a mixed-mode disc (data track with multiple audio tracks) then you need to make a TOC/BIN pair:<br />
<br />
$ cdrdao read-cd --read-raw --datafile ''image.bin'' --driver generic-mmc:0x20000 --device ''/dev/cdrom'' ''image.toc''<br />
<br />
Some software only likes CUE/BIN pair, you can make a CUE sheet with ''toc2cue'' (part of {{Pkg|cdrdao}}):<br />
<br />
$ toc2cue ''image.toc'' ''image.cue''<br />
<br />
=== Burn backend problems ===<br />
<br />
If you are experiencing problems, you may ask for advise at mailing list [mailto:cdwrite@other.debian.org cdwrite@other.debian.org], or try to write to the one of support mail addresses if some are listed near the end of the program's man page.<br />
<br />
Tell the command lines you tried, the medium type (e.g. CD-R, DVD+RW, ...), and the symptoms of failure (program messages, disappointed user expectation, ...). You will possibly get asked to obtain the newest release or development version of the affected program and to make test runs. But the answer might as well be, that your drive dislikes the particular medium.<br />
<br />
=== Burning CD/DVD/BD with a GUI ===<br />
<br />
There are several applications available to burn CDs in a graphical environment.<br />
<br />
See also [[Wikipedia:Comparison of disc authoring software]].<br />
<br />
* {{App|[[Wikipedia:AcetoneISO|AcetoneISO]]|All-in-one ISO tool (supports BIN, MDF, NRG, IMG, DAA, DMG, CDI, B5I, BWI, PDI and ISO).|https://sourceforge.net/projects/acetoneiso|{{Pkg|acetoneiso2}}}}<br />
* {{App|BashBurn|Lightweight terminal based menu frontend for CD/DVD burning tools.|http://bashburn.dose.se/|{{Pkg|bashburn}}}}<br />
* {{App|[[Wikipedia:Brasero (software)|Brasero]]|Disc burning application for the GNOME desktop that is designed to be as simple as possible.|https://wiki.gnome.org/Apps/Brasero|{{Pkg|brasero}}}}<br />
* {{App|cdw|Ncurses frontend to ''cdrecord'', ''mkisofs'', ''growisofs'', ''dvd+rw-mediainfo'', ''dvd+rw-format'' and ''xorriso''.|http://cdw.sourceforge.net/|{{AUR|cdw}}}}<br />
* {{App|Graveman|GTK-based CD/DVD burning application. It requires configuration to point to correct devices.|https://graveman.tuxfamily.org/|{{AUR|graveman}}}}<br />
* {{App|isomaster|ISO image editor.|http://littlesvr.ca/isomaster|{{AUR|isomaster}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|[[Wikipedia:X-CD-Roast|X-CD-Roast]]|Lightweight ''cdrtools'' front-end for CD and DVD writing.|http://www.xcdroast.org/|{{AUR|xcdroast}}}}<br />
* {{App|[[Wikipedia:Xfce#Xfburn|Xfburn]]|Simple front-end to the libburnia libraries with support for CD/DVD(-RW), ISO images, and BurnFree.|https://docs.xfce.org/apps/xfburn/start|{{Pkg|xfburn}}}}<br />
* {{App|xorriso-tcltk|Graphical front-end to ISO and CD/DVD/BD burn tool xorriso|https://www.gnu.org/software/xorriso/|{{Pkg|libisoburn}}}}<br />
<br />
== Playback ==<br />
<br />
=== CD ===<br />
<br />
Playback of audio CDs requires the {{Pkg|libcdio}} package. To enable KDE Applications like Dolphin to read audio CDs install {{Pkg|audiocd-kio}}.<br />
<br />
=== DVD ===<br />
<br />
If you wish to play encrypted DVDs, you must install the libdvd* packages:<br />
* {{Pkg|libdvdread}}<br />
* {{Pkg|libdvdcss}}<br />
* {{Pkg|libdvdnav}}<br />
<br />
Additionally, you must install player software. Popular DVD players are [[MPlayer]], [[Wikipedia:Xine|xine]] and [[VLC]]. See the [[List of applications/Multimedia#Video players|video players]] list and the specific instructions for [[MPlayer#DVD playing|MPlayer]].<br />
<br />
=== Blu-ray ===<br />
<br />
See [[Blu-ray#Playback]].<br />
<br />
== Ripping ==<br />
<br />
[[Wikipedia:Ripping|Ripping]] is the process of copying audio or video content to a hard disk, typically from removable media or media streams.<br />
<br />
=== Audio CD ===<br />
<br />
==== Console ====<br />
<br />
* {{App|abcde|Comprehensive command-line tool for ripping audio CDs.|https://abcde.einval.com/|{{AUR|abcde}}}}<br />
* {{App|cdda2wav|CD-audio extraction program with paranoia support.|http://www.cdda2wav.de/|{{Pkg|cdrtools}}}}<br />
* {{App|[[Wikipedia:cdparanoia|cdparanoia]]|Compact Disc Digital Audio (CDDA) Digital Audio Extraction (DAE) tool.|https://xiph.org/paranoia/index.html|{{Pkg|cdparanoia}}}}<br />
* {{App|cyanrip|Extensive CD ripper with musicbraniz integration, error detection, log generation, many formats, HDCD decoding, covert art automatic download.|https://github.com/cyanreg/cyanrip/|{{AUR|cyanrip}}}}<br />
* {{App|ripright|Minimal CD ripper modeled on autorip.|https://www.mcternan.me.uk/ripright/|{{AUR|ripright}}}}<br />
* {{App|[[Wikipedia:ripit|ripit]]|Command-line ripper that supports MusicBrainz, freeddb and various codecs. |https://www.ripit.pl/|{{AUR|ripit}}}}<br />
* {{App|shnsplit|Splits .wav and .flac files according to a CUE sheet and encodes the resulting pieces. A useful companion to ABCDE.|http://shnutils.freeshell.org/shntool/|{{AUR|shntool}}}}<br />
* {{App|whipper|CD ripper aiming for accuracy over speed. Uses cdparanoia, MusicBrainz, AccurateRip.|https://github.com/whipper-team/whipper|{{Pkg|whipper}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|[[Wikipedia:Asunder (software)|Asunder]]|GTK-based CD ripping program.|http://littlesvr.ca/asunder/|{{Pkg|asunder}}}}<br />
* {{App|Audex|Audio grabber tool for CD-ROM drives based on KDE.|https://userbase.kde.org/Audex|{{Pkg|audex}}}}<br />
* {{App|[[Wikipedia:Fre:ac|fre:ac]]|Audio converter and CD ripper with support for various popular formats and encoders.|https://freac.org/|{{AUR|freac}}}}<br />
* {{App|Goobox|CD player and ripper for GNOME.|https://people.gnome.org/~paobac/goobox/{{Dead link|2022|09|22|status=404}}|{{Pkg|goobox}}}}<br />
* {{App|[[Wikipedia:Grip (software)|Grip]]|Fast and light CD ripper within the GNOME project that resembles [[Wikipedia:Audiograbber|Audiograbber]].|https://sourceforge.net/projects/grip/|{{AUR|grip}}}}.<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|KAudioCreator|KDE program for ripping and encoding Audio-CDs. Unmaintained and [https://bugs.archlinux.org/task/67618 does not start anymore].|https://invent.kde.org/unmaintained/kaudiocreator|{{AUR|kaudiocreator-git}}}}<br />
* {{App|ripperX|GTK program to rip CD audio tracks and encode them to the Ogg, MP3, or FLAC formats.|https://sourceforge.net/projects/ripperx/|{{AUR|ripperx}}}}<br />
* {{App|rubyripper|Audio disc ripper that tries to deliver a secure rip through multiple rippings of the same track and corrections of any differences.|https://github.com/bleskodev/rubyripper|{{AUR|rubyripper}}}}<br />
* {{App|[[Wikipedia:Sound Juicer|Sound Juicer]]|CD ripper for GNOME.|https://wiki.gnome.org/Apps/SoundJuicer|{{Pkg|sound-juicer}}}}<br />
* {{App|1=soundKonverter|2=Front-end to various audio converters.|3=https://www.linux-apps.com/content/show.php?content=29024|4={{Pkg|soundkonverter}}}}<br />
<br />
=== DVD-Video ===<br />
<br />
See also [[Wikipedia:Comparison of DVD ripper software]].<br />
<br />
Often, the process of ripping a DVD can be broken down into two subtasks:<br />
<br />
# '''Data extraction''' — Copying the audio and/or video data to a hard disk,<br />
# [[Wikipedia:Transcode|Transcoding]] — Converting the extracted data into a suitable format.<br />
<br />
Some utilities perform both tasks, whilst others focus on one aspect or the other.<br />
<br />
==== Console ====<br />
<br />
* {{App|[[dvdbackup]]|Tool for pure data extraction which does not transcode. It is useful for creating ''exact'' copies of encrypted DVDs in conjunction with '''libdvdcss''' or for decrypting video for other utilities unable to read encrypted DVDs.|http://dvdbackup.sourceforge.net/|{{Pkg|dvdbackup}}}}<br />
* {{App|[[FFmpeg]]|Complete and free Internet live audio and video broadcasting solution for Linux/Unix, capable to do a direct rip in any format (audio/video) from a DVD-Video ISO image, just select the input as the ISO image and proceed with the desired options. It also allows to downmixing, shrinking, spliting, selecting streams among other features.|https://ffmpeg.org/|{{Pkg|ffmpeg}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake CLI]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping.|https://handbrake.fr/|{{Pkg|handbrake-cli}}}}<br />
* {{App|[[MEncoder]]|Free command line video decoding, encoding and filtering tool. It supports ripping and transcoding DVD-Video.|http://www.mplayerhq.hu/|{{Pkg|mencoder}}}}<br />
* {{App|subtitleripper|Convert DVD subtitles into text format.|http://subtitleripper.sourceforge.net/|{{AUR|subtitleripper}}}}<br />
* {{App|Transcode|Video/DVD ripper and encoder for the terminal/console. It is [https://www.linuxfromscratch.org/blfs/view/8.3/multimedia/transcode.html outdated/no longer actively maintained].||{{Pkg|transcode}}}}<br />
* {{App|Vobcopy|Copies DVD ''.vob'' files to hard disk, decrypting them on the way.|https://github.com/barak/vobcopy|{{AUR|vobcopy}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|dvd::rip|Front-end to {{Pkg|transcode}}, used to extract DVD's to the hard disk and transcode or extract and transcode on-the-fly.|https://www.exit1.org/dvdrip/|{{AUR|dvdrip}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping. GTK version.|https://handbrake.fr/|{{Pkg|handbrake}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|OGMRip|An application and a set of libraries for ripping and encoding DVD into AVI, OGM, MP4, or Matroska files using a wide variety of codecs. It relies on mplayer, mencoder, ogmtools, mkvtoolnix, mp4box, oggenc, lame, and faac to perform its tasks.|http://ogmrip.sourceforge.net/|{{AUR|ogmrip}}}}<br />
<br />
=== DVD-Audio ===<br />
<br />
* {{App|Python Audio Tools|Includes dvda2track, which is easy to use command line tool to extract DVD-Audio tracks to uncompressed wav files.<br />
|http://audiotools.sourceforge.net/|{{AUR|audiotools}}}}<br />
<br />
=== Multi-format ===<br />
<br />
* {{App|Aaru|Software for archival ripping of CDs, DVDs, and harddrives|https://aaru.app|{{AUR|aaru}}}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Brasero fails to normalize audio CD ===<br />
<br />
If you try to burn it may stop at the first step called Normalization.<br />
<br />
As a workaround you can disable the normalization plugin using the ''Edit > Plugins'' menu<br />
<br />
=== VLC: Error "... could not open the disc /dev/dvd" ===<br />
<br />
If you get an error like<br />
<br />
vlc dvdread could not open the disc "/dev/dvd"<br />
<br />
it may be because there is no device node {{ic|/dev/dvd}} on your system. Udev no longer creates {{ic|/dev/dvd}} and instead uses {{ic|/dev/sr0}}. To fix this, edit the VLC configuration file ({{ic|~/.config/vlc/vlcrc}}):<br />
<br />
# DVD device (string)<br />
dvd=/dev/sr0<br />
<br />
=== DVD drive is noisy ===<br />
<br />
If playing DVD videos causes the system to be very loud, it may be because the disc is spinning faster than it needs to. To temporarily change the speed of the drive, run:<br />
<br />
# eject -x 12 /dev/dvd<br />
<br />
Sometimes:<br />
<br />
# hdparm -E12 /dev/dvd<br />
<br />
Any speed that is supported by the drive can be used, or 0 for the maximum speed.<br />
<br />
[https://michal.kosmulski.org/computing/tips/cd-rom-speed.html Setting CD-ROM and DVD-ROM drive speed]<br />
<br />
=== Playback does not work with new computer (new DVD-Drive) ===<br />
<br />
If playback does not work and you have a new computer (new DVD-Drive) the reason might be that the [[Wikipedia:DVD region code|region code]] is not set. You can read and set the region code with the {{AUR|regionset}} package.<br />
<br />
=== None of the above programs are able to rip/encode a DVD to my hard disk! ===<br />
<br />
Make sure the region of your DVD reader is set correctly; otherwise, you will get loads of inexplicable [[Wikipedia:Content Scramble System|CSS]]-related errors. Use the {{AUR|regionset}} package to do so.<br />
<br />
If ripping still does not work with the correct region set, refer to the [https://videolan.videolan.me/libdvdcss/ libdvdcss developer documentation] for enabling log messages and setting other relevant options.<br />
<br />
=== GUI program log indicates problems with backend program ===<br />
<br />
If you use a GUI program and experience problems which the program's log blames on some backend program, then try to reproduce the problem by the logged backend program arguments.<br />
Whether you succeed with reproducing or not, you may report the logged lines and your own findings to the places mentioned in [[#Burn backend problems]] section.<br />
<br />
==== Special case: medium error / write error ====<br />
<br />
Here are some typical messages about the drive disliking the medium. This can only be solved by using a different drive or a different medium. A different program will hardly help.<br />
<br />
Brasero with backend growisofs:<br />
<br />
BraseroGrowisofs stderr: :-[ WRITE@LBA=0h failed with SK=3h/ASC=0Ch/ACQ=00h]: Input/output error<br />
<br />
Brasero with backend libburn:<br />
<br />
BraseroLibburn Libburn reported an error SCSI error on write(16976,16): [3 0C 00] Write error<br />
<br />
=== BD-R DL 50GB errors on trying to burn second layer ===<br />
<br />
Using ''growisofs'' from {{Pkg|dvd+rw-tools}} for burning 50GB BD-R DL discs might result in a fatal error and damaged media, such as:<br />
<br />
{{hc|$ growisofs -Z /dev/sr0 -J -R -V "label" files|<nowiki><br />
Executing 'mkisofs -J -R -V label files | builtin_dd of=/dev/sr0 obs=32k seek=0'<br />
I: -input-charset not specified, using utf-8 (detected in locale settings)<br />
0.03% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.05% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.08% done, estimate finish Fri Jan 29 19:50:36 2016<br />
/dev/sr0: pre-formatting blank BD-R for 49.8GB...<br />
/dev/sr0: "Current Write Speed" is 8.2x4390KBps.<br />
0.11% done, estimate finish Sat Jan 30 03:29:13 2016<br />
0.13% done, estimate finish Sat Jan 30 02:10:01 2016<br />
...<br />
63.20% done, estimate finish Fri Jan 29 20:43:45 2016<br />
:-[ WRITE@LBA=b6d820h failed with SK=3h/WRITE ERROR]: Input/output error<br />
:-( write failed: Input/output error<br />
/dev/sr0: flushing cache<br />
/dev/sr0: closing track<br />
/dev/sr0: closing session<br />
:-[ CLOSE SESSION failed with SK=5h/INVALID FIELD IN CDB]: Input/output error<br />
/dev/sr0: reloading tray<br />
</nowiki>}}<br />
<br />
This happened at the 25GB boundary when starting to write the second layer. Using ''cdrecord'' from {{Pkg|cdrtools}} works with no problems. Tested with a 'HL-DT-ST BD-RE WH16NS40' LG burner, and Verbatim BD-R DL 6x discs (#96911). {{bug|47797}}<br />
<br />
=== Disc tray autocloses ===<br />
<br />
If after ejecting a cd, either by using the {{ic|eject}} command, or pushing the drive button, the drive disc tray autocloses before being able to remove the disc, try the following command:<br />
<br />
# sysctl -w dev.cdrom.autoclose=0<br />
<br />
If that solves the problem, make the change permanent:<br />
<br />
{{hc|/etc/sysctl.d/60-cdrom-autoclose.conf|2=<br />
dev.cdrom.autoclose = 0<br />
}}<br />
<br />
If the above does not work and as a last resort measure, you can unload the disc module from the kernel via:<br />
<br />
# rmmod sr_mod<br />
<br />
the disc drive should now behave as expected but will not mount disc anymore. After putting a disc into the drive, reactivate the module via:<br />
<br />
# modprobe sr_mod<br />
<br />
the disc should now mount.<br />
<br />
== See also ==<br />
<br />
* In the United States, backup of physically obtained media is allowed under these conditions: [https://www.riaa.com/resources-learning/about-piracy/ About Piracy - RIAA].<br />
* [https://dev.lovelyhq.com/libburnia/web/wiki Main page of the project Libburnia]</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Optical_disc_drive_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=755908Optical disc drive (简体中文)2022-11-05T08:18:05Z<p>InsaneGuo: 1</p>
<hr />
<div>[[Category:Multimedia]]<br />
[[Category:Optical disc]]<br />
[[es:Optical disc drive]]<br />
[[ja:光学ディスクドライブ]]<br />
{{Related articles start}}<br />
{{Related|Codecs}}<br />
{{Related|MPlayer}}<br />
{{Related|dvdbackup}}<br />
{{Related|MEncoder}}<br />
{{Related|Blu-ray}}<br />
{{Related|Convert any Movie to DVD Video}}<br />
{{Related articles end}}<br />
<br />
From [[Wikipedia:Optical disc drive|Wikipedia]]:<br />
<br />
:In computing, an optical disc drive (ODD) is a disc drive that uses laser light or electromagnetic waves within or near the visible light spectrum as part of the process of reading or writing data to or from optical discs. Some drives can only read from discs, but recent drives are commonly both readers and recorders, also called burners or writers. Compact discs, DVDs, and Blu-ray discs are common types of optical media which can be read and recorded by such drives. Optical drive is the generic name; drives are usually described as "CD" "DVD", or "Blu-ray", followed by "drive", "writer", etc.<br />
<br />
== Burning ==<br />
<br />
{{Expansion|Are any command-line tools to arrange files into volumes to fit on a disc (like GAFFitter or cdrkit's dirsplit) packaged for Arch Linux?}}<br />
<br />
{{Warning|The quality of optical drives and the discs themselves varies greatly. Generally, using a slow burn speed is recommended for reliable burns. If you are experiencing unexpected behaviour from the disc, try burning at the lowest speed supported by your burner.}}<br />
<br />
The burning process of optical disc drives consists of creating or obtaining an image and writing it to an optical medium. The image may in principle be any data file. If you want to mount the resulting medium, then it is usually an ISO 9660 file system image file. Audio and multi-media CDs are often burned from a ''.bin'' file, under control of a ''.toc'' file or a ''.cue'' file which tell the desired track layout.<br />
<br />
=== Install burning utilities ===<br />
<br />
{{Style|Says twice that X is the traditional choice without stating why.}}<br />
<br />
If you want to use programs with graphical user interface, then follow [[#Burning CD/DVD/BD with a GUI]].<br />
<br />
The programs listed here are command line oriented. They are the back ends which are used by most free GUI programs for CD, DVD, and BD. GUI users might get to them when it comes to troubleshooting or to scripting of burn activities.<br />
<br />
You need at least one program for creation of file system images and one program that is able to burn data onto your desired media type.<br />
<br />
Available programs for ISO 9660 image creation are:<br />
<br />
* {{man|8|mkisofs}} from {{Pkg|cdrtools}}<br />
* {{man|1|xorriso}} and {{man|1|xorrisofs}} from {{Pkg|libisoburn}}<br />
<br />
The traditional choice is ''mkisofs''.<br />
<br />
Available programs for burning to media are:<br />
<br />
* {{man|1|cdrdao}} from {{Pkg|cdrdao}} (CD only, TOC/CUE/BIN only)<br />
* {{man|1|cdrecord}} from {{Pkg|cdrtools}}<br />
* {{man|1|cdrskin}} from {{Pkg|libburn}}<br />
* {{man|1|growisofs}} from {{Pkg|dvd+rw-tools}} (DVD and BD only)<br />
* {{man|1|xorriso}} and {{man|1|xorrecord}} from {{Pkg|libisoburn}}<br />
<br />
The traditional choices are ''cdrecord'' for CD and ''growisofs'' for DVD and Blu-ray Disc. For writing TOC/CUE/BIN files to CD, install {{Pkg|cdrdao}}.<br />
<br />
The free GUI programs for CD, DVD, and BD burning depend on at least one of the above packages.<br />
<br />
''xorrisofs'' supports the ''mkisofs'' options which are shown in this document.<br />
<br />
''cdrskin'' supports the shown ''cdrecord'' options; ''xorrecord'' also supports those which do not deal with audio CD.<br />
<br />
=== Making an ISO image from existing files ===<br />
<br />
The simplest way to create an ISO image is to first copy the needed files to one directory, for example: {{ic|./for_iso}}.<br />
<br />
Then generate the image file with ''mkisofs'':<br />
<br />
$ mkisofs -V "''ARCHIVE_2013_07_27''" -J -r -o ''isoimage.iso'' ''./for_iso''<br />
<br />
Each of those options are explained in the following sections.<br />
<br />
==== Basic options ====<br />
<br />
;{{ic|-V}}: Specifies the name (that is assigned to) of the file system. The ISO 9660 standard specs impose the limitations of 32-character string length, as well as limiting the characters allowed to sets of: "A" to "Z", "0" to "9", and "_". This volume label will probably show up as mount point if the medium is mounted automatically.<br />
;{{ic|-J}}: Enables [[Wikipedia:Joliet (file system)|Joliet]] extension, which allocates special space to store file names in Unicode (up to 64 UTF-16 characters for each file).<br />
;{{ic|-joliet-long}}: Increases maximum length of file names from 64 to 103 UTF-16 characters in Joliet table. Non-compliant to Joliet specs and not commonly supported.<br />
;{{ic|-r}}: Enables [[Wikipedia:Rock Ridge|Rock Ridge]] extension, which adds POSIX file system semantics to an image, including support of long 255-character filenames and Unix-style file permissions.<br />
;{{ic|-o}}: Sets the file path for the resulting ISO image.<br />
<br />
==== graft-points ====<br />
<br />
It is also possible to let ''mkisofs'' to collect files and directories from various paths<br />
<br />
$ mkisofs -V "''BACKUP_2013_07_27''" -J -r -o ''backup_2013_07_27.iso'' \<br />
-graft-points \<br />
/photos=/home/''user''/photos \<br />
/mail=/home/''user''/mail \<br />
/photos/holidays=/home/''user''/holidays/photos<br />
<br />
{{ic|-graft-points}} enables the recognition of ''pathspecs'' which consist of a target address in the ISO file system (e.g. {{ic|/photos}}) and a source address (e.g. {{ic|/home/user/photos}}). Both are separated by a "=" character.<br />
<br />
So this example puts the directories {{ic|/home/user/photos}}, {{ic|/home/user/mail}} and {{ic|/home/user/holidays/photos}}, respectively in the ISO image as {{ic|/photos}}, {{ic|/mail}} and {{ic|/photos/holidays}}.<br />
<br />
Programs ''mkisofs'' and ''xorrisofs'' accept the same options. For secure backups, consider using ''xorrisofs'' with option {{ic|--for_backup}}, which records eventual ACLs and stores an MD5 checksum for each data file.<br />
<br />
See the {{man|8|mkisofs}} and {{man|1|xorrisofs}} man pages for more info about their options.<br />
<br />
=== Mounting an ISO image ===<br />
<br />
You can mount an ISO image if you want to browse its files.<br />
To mount the ISO image, we can use:<br />
<br />
# mount -t iso9660 -o ro,loop ''/path/to/file.iso'' ''/mount-point''<br />
<br />
Do not forget to unmount the image when your inspection of the image is done:<br />
<br />
# umount /mount-point<br />
<br />
See also [[Mounting images as user]] for mounting without root privileges.<br />
<br />
=== Converting img/ccd to an ISO image ===<br />
<br />
To convert an {{ic|img}}/{{ic|ccd}} image, you can use {{Pkg|ccd2iso}}:<br />
<br />
$ ccd2iso ''~/image.img'' ''~/image.iso''<br />
<br />
=== Learning the name of your optical drive ===<br />
<br />
For the remainder of this section the name of your recording device is assumed to be {{ic|/dev/sr0}}.<br />
<br />
Check this by<br />
<br />
$ cdrecord dev=''/dev/sr0'' -checkdrive<br />
<br />
which should report {{ic|Vendor_info}} and {{ic|Identification}} fields of the drive.<br />
<br />
If no drive is found, check whether any {{ic|/dev/sr*}} exist and whether they offer read/write permission ({{ic|wr-}}) to you or your group.<br />
If no {{ic|/dev/sr*}} exists then try [[Kernel modules|loading]] module {{ic|sr_mod}} manually.<br />
<br />
=== Reading the volume label of a CD or DVD ===<br />
<br />
If you want to get the name/label of the media, use ''dd'':<br />
<br />
$ dd if=''/dev/sr0'' bs=1 skip=32808 count=32<br />
<br />
=== Creating an ISO image from a CD, DVD, or BD ===<br />
<br />
In order to only copy actual data from the disc and not the empty blocks filling it up, first retrieve its block/sector count and size (2048 most of the time):<br />
<br />
{{hc|$ isosize -x /dev/sr0|<br />
sector count: 2041796, sector size: 2048<br />
}}<br />
<br />
or alternatively:<br />
<br />
{{hc|$ isoinfo -d -i /dev/sr0 {{!}} awk '/block size{{!}}Volume size/'|<br />
Logical block size is: 2048<br />
Volume size is: 2041796<br />
}}<br />
<br />
{{Note|Do not forget to replace {{ic|/dev/sr0}} with your optical drive device name.}}<br />
<br />
Then use [[dd]] to copy the data using the obtained values:<br />
<br />
$ dd if=/dev/sr0 of=discmage.iso bs=''sector_size'' count=''sector_count'' status=progress<br />
<br />
{{Tip|If the medium is damaged, it is preferable to use a dedicated utility such as {{Pkg|ddrescue}}. See [[Disk cloning#Using ddrescue]].}}<br />
<br />
If the original medium was bootable, then the copy will be a bootable image. You may use it as a pseudo CD for a virtual machine or burn it onto an optical medium which should then become bootable. [https://askubuntu.com/questions/147800/ripping-dvd-to-iso-accurately#874945]<br />
<br />
=== Erasing CD-RW and DVD-RW ===<br />
<br />
Used CD-RW media need to be erased before you can write over the previously recorded data. This is done by<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
<br />
There are two options for blanking: {{ic|1=blank=fast}} and {{ic|1=blank=all}}. Full blanking lasts as long as a full write run. It overwrites the payload data on the CD. Nevertheless this should not be considered as securely making those data unreadable. For that purpose, several full write runs with random data are advised.<br />
<br />
Alternative commands are:<br />
<br />
$ cdrskin -v dev=''/dev/sr0'' blank=fast<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
To erase the DVD-RW use the ''dvd+rw-format'' utility from {{Pkg|dvd+rw-tools}}:<br />
<br />
$ dvd+rw-format -blank=fast ''/dev/sr0''<br />
<br />
Alternative commands are:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=fast<br />
$ cdrskin -v dev=''/dev/sr0'' blank=deformat_sequential_quickest<br />
$ xorriso -outdev ''/dev/sr0'' -blank deformat_quickest<br />
<br />
Such fastly blanked DVD-RW are not suitable for multi-session and cannot take input streams of unpredicted length. For that purpose one has to use one of:<br />
<br />
$ cdrecord -v dev=''/dev/sr0'' blank=all<br />
$ dvd+rw-format -blank=full ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=as_needed<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed<br />
<br />
The other media types are either write-once (CD-R, DVD-R, DVD+R, BD-R) or are overwritable without the need for erasing (DVD-RAM, DVD+RW, BD-RE).<br />
<br />
=== Formatting DVD-RW ===<br />
<br />
Formatted DVD-RW media can be overwritten without previous erasure. So consider to apply once in their life time<br />
<br />
$ dvd+rw-format -force ''/dev/sr0''<br />
$ cdrskin -v dev=''/dev/sr0'' blank=format_if_needed<br />
$ xorriso -outdev ''/dev/sr0'' -format as_needed<br />
<br />
Unlike DVD-RAM, DVD+RW, and BD-RE, formatted DVD-RW cannot be used as (slow) hard disk directly, but rather need the mediation of driver pktcdvd. See {{man|8|pktsetup}}.<br />
<br />
=== Formatting BD-RE and BD-R ===<br />
<br />
BD-RE need formatting before first use. This is done automatically by the burn programs when they detect the unformatted state. Nevertheless the size of the payload area can be influenced by expert versions of the format commands shown above for DVD-RW.<br />
<br />
BD-R can be used unformatted or formatted. Unformatted they are written with full nominal speed and offer maximum storage capacity. Formatted they get checkread during write operations and bad blocks get replaced by blocks from the Spare Area. This reduces write speed to a half or less of nominal speed. The default sized Spare Area reduces the storage capacity by 768 MiB.<br />
<br />
growisofs formats BD-R by default. The others do not. growisofs can be kept from formatting. cdrskin and xorriso can write with full nominal speed on formatted BD-RE or BD-R:<br />
<br />
$ growisofs -use-the-force-luke=spare:none ...growisofs.or.mkisofs.options...<br />
$ cdrskin stream_recording=on ...cdrecord.options...<br />
$ xorriso -stream_recording on ...xorriso.commands...<br />
<br />
=== Burning an ISO image to CD, DVD, or BD ===<br />
<br />
To burn a readily prepared ISO image file {{ic|isoimage.iso}} onto an optical medium, run for CD:<br />
<br />
$ cdrecord -v -sao dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
and for DVD or BD:<br />
<br />
$ growisofs -dvd-compat -Z ''/dev/sr0''=''isoimage.iso''<br />
<br />
for CD, DVD, BD:<br />
<br />
$ xorriso -as cdrecord -v dev=''/dev/sr0'' -dao ''isoimage.iso''<br />
<br />
{{Note|1=<br /><br />
* Make sure that the medium is not mounted when you begin to write to it. Mounting may happen automatically if the medium contains a readable file system. In the best case, it will prevent the burn programs from using the burner device. In the worst case, there will be misburns because read operations disturbed the drive. So if in doubt, do: {{bc|# umount /dev/sr0}}<br />
* ''growisofs'' has a [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=713016 small bug] with blank BD-R media. It issues an error message after the burning is complete. Programs like ''k3b'' then believe the whole burn run failed. To prevent this, either<br />
** format the blank BD-R by {{ic|dvd+rw-format ''/dev/sr0''}} before submitting it to ''growisofs''<br />
** or use ''growisofs'' option {{ic|1= -use-the-force-luke=spare:none}}<br />
}}<br />
<br />
=== Verifying the burnt ISO image ===<br />
<br />
You can verify the integrity of the burnt medium to make sure it contains no errors. Always eject the medium and reinsert it before verifying. It will guarantee that any kernel cache will not be used to read the data.<br />
<br />
First calculate the MD5 checksum of the original ISO image:<br />
<br />
{{hc|$ md5sum isoimage.iso|<br />
e5643e18e05f5646046bb2e4236986d8 isoimage.iso<br />
}}<br />
<br />
Next calculate the MD5 checksum of the ISO file system on the medium.<br />
Although some media types deliver exactly the same amount of data as have been submitted to the burn program, many others append trailing garbage when being read. So you should restrict reading to the size of the ISO image file.<br />
<br />
$ blocks=$(expr $(du -b isoimage.iso | awk '{print $1}') / 2048)<br />
<br />
{{hc|1=$ dd if=/dev/sr0 bs=2048 count=$blocks {{!}} md5sum|2=<br />
43992+0 records in<br />
43992+0 records out<br />
90095616 bytes (90 MB, 86 MiB) copied, 0.359539 s, 251 MB/s<br />
e5643e18e05f5646046bb2e4236986d8 -<br />
}}<br />
<br />
Both runs should yield the same MD5 checksum (here: {{ic|e5643e18e05f5646046bb2e4236986d8}}). If they do not, you will probably also get an I/O error message from the {{ic|dd}} run. [[dmesg]] might then tell about SCSI errors and block numbers, if you are interested.<br />
<br />
=== ISO 9660 and burning on-the-fly ===<br />
<br />
It is not necessary to store an emerging ISO file system on hard disk before writing it to optical media. Only very old CD drives in very old computers could suffer failed burns due to an empty drive buffer.<br />
<br />
If you omit option {{ic|-o}} from ''mkisofs'' then it writes the ISO image to standard output. This can be piped into the standard input of burn programs.<br />
<br />
$ mkisofs -V "ARCHIVE_2013_07_27" -J -r ./for_iso | \<br />
cdrecord -v dev=/dev/sr0 -waiti -<br />
<br />
Option {{ic|-waiti}} is not really needed here. It prevents ''cdrecord'' from writing to the medium before ''mkisofs'' starts its output. This would allow ''mkisofs'' to read the medium without disturbing an already started burn run. See next section about multi-session.<br />
<br />
On DVD and BD, you may let ''growisofs'' operate ''mkisofs'' for you and burn its output on-the-fly:<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
=== Multi-session ===<br />
<br />
ISO 9660 multi-session means that a medium with readable file system is still writable at its first unused block address, and that a new ISO directory tree gets written to this unused part. The new tree is accompanied by the content blocks of newly added or overwritten data files. The blocks of data files, which shall stay as in the old ISO tree, will not be written again.<br />
<br />
Linux and many other operating systems will mount the directory tree in the last session on the medium. This youngest tree will normally show the files of the older sessions, too.<br />
<br />
==== Multi-session by cdrecord ====<br />
<br />
CD-R and CD-RW stay writable (aka "appendable") if cdrecord option {{ic|-multi}} was used<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''isoimage.iso''<br />
<br />
Then the medium can be inquired for the parameters of the next session<br />
<br />
$ m=$(cdrecord dev=''/dev/sr0'' -msinfo)<br />
<br />
By help of these parameters and of the readable medium in the drive you can produce the add-on ISO session<br />
<br />
$ mkisofs -M ''/dev/sr0'' -C "$m" \<br />
-V "''ARCHIVE_2013_07_28''" -J -r -o ''session2.iso'' ''./more_for_iso''<br />
<br />
Finally append the session to the medium and keep it appendable again<br />
<br />
$ cdrecord -v -multi dev=''/dev/sr0'' ''session2.iso''<br />
<br />
Programs ''cdrskin'' and ''xorrecord'' do this too with DVD-R, DVD+R, BD-R and unformatted DVD-RW. Program ''cdrecord'' does multi-session with at least DVD-R and DVD-RW. They all do with CD-R and CD-RW, of course.<br />
<br />
Most re-usable media types do not record a session history that would be recognizable for a mounting kernel. But with ISO 9660 it is possible to achieve the multi-session effect even on those media.<br />
<br />
''growisofs'' and ''xorriso'' can do this and hide most of the complexity.<br />
<br />
==== Multi-session by growisofs ====<br />
<br />
By default, ''growisofs'' uses ''mkisofs'' as a backend for creating ISO images forwards most of its program arguments to . See above examples of ''mkisofs''. It bans option {{ic|-o}} and deprecates option {{ic|-C}}. By default it uses the ''mkisofs''. You may specify to use one of the others compatible backend program by setting environment variable {{ic|MKISOFS}}:<br />
<br />
$ export MKISOFS="xorrisofs"<br />
<br />
The wish to begin with a new ISO file system on the optical medium is expressed by option {{ic|-Z}}<br />
<br />
$ growisofs -Z ''/dev/sr0'' -V "''ARCHIVE_2013_07_27''" -r -J ''./for_iso''<br />
<br />
The wish to append more files as new session to an existing ISO file system is expressed by option {{ic|-M}}<br />
<br />
$ growisofs -M ''/dev/sr0'' -V "''ARCHIVE_2013_07_28''" -r -J ''./more_for_iso''<br />
<br />
For details see the {{man|1|growisofs}} manual and the manuals of ''mkisofs'' and ''xorrisofs''.<br />
<br />
==== Multi-session by xorriso ====<br />
<br />
''xorriso'' learns the wish to begin with a new ISO file system from the blank state of the medium. So it is appropriate to blank it if it contains data. The command {{ic|-blank as_needed}} applies to all kinds of re-usable media and even to ISO images in data files on hard disk. It does not cause error if applied to a blank write-once medium.<br />
<br />
$ xorriso -outdev ''/dev/sr0'' -blank as_needed \<br />
-volid "''ARCHIVE_2013_07_27''" -joliet on -add ''./for_iso'' --<br />
<br />
On non-blank writable media ''xorriso'' appends the newly given disc files if command {{ic|-dev}} is used rather than {{ic|-outdev}}. Of course, no command {{ic|-blank}} should be given here<br />
<br />
$ xorriso -dev ''/dev/sr0'' \<br />
-volid "''ARCHIVE_2013_07_28''" -joliet on -add ''./more_for_iso'' --<br />
<br />
For details see the {{man|1|xorriso}} man page and especially its examples.<br />
<br />
=== BD Defect Management ===<br />
<br />
BD-RE and formatted BD-R media are normally written with enabled Defect Management. This feature reads the written blocks while they are still stored in the drive buffer. In case of poor read quality the blocks get written again or redirected to the ''Spare Area'' where the data get stored in replacement blocks.<br />
<br />
This checkreading reduces write speed to at most half of the nominal speed of drive and BD medium. Sometimes it is even worse. Heavy use of the Spare Area causes long delays during read operations. So Defect Management is not always desirable.<br />
<br />
''cdrecord'' does not format BD-R. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''growisofs'' formats BD-R by default. The Defect Management can be prevented by option {{ic|1= -use-the-force-luke=spare:none}}. It has no means to prevent Defect Management on BD-RE media, though.<br />
<br />
''cdrskin'', ''xorriso'' and ''xorrecord'' do not format BD-R by default. They do with {{ic|1= cdrskin blank=format_if_needed}}, resp. {{ic|1= xorriso -format as_needed}}, resp. {{ic|1= xorrecord blank=format_overwrite}}. These three programs can disable Defect Management with BD-RE and already formatted BD-R by {{ic|1= cdrskin stream_recording=on}}, resp. {{ic|1= xorriso -stream_recording on}}, resp. {{ic|1= xorrecord stream_recording=on}}.<br />
<br />
=== Burning an audio CD ===<br />
<br />
Create your audio tracks and store them as uncompressed, 16-bit, 44100-Hz, stereo WAV files. To convert MP3 to WAV, ensure {{Pkg|lame}} is installed, ''cd'' to the directory with your MP3 files, and run:<br />
<br />
$ for i in *.mp3; do lame --decode "$i" "$(basename "$i" .mp3)".wav; done<br />
<br />
In case you get an error when trying to burn WAV files converted with LAME, try decoding with {{Pkg|mpg123}}:<br />
<br />
$ for i in *.mp3; do mpg123 --rate 44100 --stereo --buffer 3072 --resync -w $(basename "$i" .mp3).wav $i; done<br />
<br />
To convert AAC to WAV ensure {{Pkg|faad2}} is installed and run:<br />
$ for i in *.m4a; do faad $i; done<br />
<br />
To fix the bitrate of an already existing WAV file (or many other formats), try using {{Pkg|sox}}:<br />
$ for i in *.wav; do sox "$i" -c 2 -r 44100 "$(basename "$i" .wav)"-ok.wav; done<br />
<br />
Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as {{ic|01.wav}}, {{ic|02.wav}}, {{ic|03.wav}}, etc. Use the following command to simulate burning the WAV files as an audio CD:<br />
<br />
$ cdrecord '''-dummy''' -v -pad speed=1 dev=''/dev/sr0'' -dao -swab *.wav<br />
<br />
If everything worked, you can remove the {{ic|-dummy}} flag to actually burn the CD. <br />
<br />
{{Note|The produced disc may not play in all CD players. For an audio-only disc (discarding some track metadata), add the {{ic|-audio}} flag.}}<br />
<br />
To test the new audio CD, use [[MPlayer]]:<br />
<br />
$ mplayer cdda://<br />
<br />
=== Burning a BIN/CUE ===<br />
<br />
To burn a BIN/CUE image run:<br />
<br />
$ cdrdao write --device ''/dev/sr0'' ''image.cue''<br />
<br />
==== TOC/CUE/BIN for mixed-mode discs ====<br />
<br />
ISO images only store a single data track. If you want to create an image of a mixed-mode disc (data track with multiple audio tracks) then you need to make a TOC/BIN pair:<br />
<br />
$ cdrdao read-cd --read-raw --datafile ''image.bin'' --driver generic-mmc:0x20000 --device ''/dev/cdrom'' ''image.toc''<br />
<br />
Some software only likes CUE/BIN pair, you can make a CUE sheet with ''toc2cue'' (part of {{Pkg|cdrdao}}):<br />
<br />
$ toc2cue ''image.toc'' ''image.cue''<br />
<br />
=== Burn backend problems ===<br />
<br />
If you are experiencing problems, you may ask for advise at mailing list [mailto:cdwrite@other.debian.org cdwrite@other.debian.org], or try to write to the one of support mail addresses if some are listed near the end of the program's man page.<br />
<br />
Tell the command lines you tried, the medium type (e.g. CD-R, DVD+RW, ...), and the symptoms of failure (program messages, disappointed user expectation, ...). You will possibly get asked to obtain the newest release or development version of the affected program and to make test runs. But the answer might as well be, that your drive dislikes the particular medium.<br />
<br />
=== Burning CD/DVD/BD with a GUI ===<br />
<br />
There are several applications available to burn CDs in a graphical environment.<br />
<br />
See also [[Wikipedia:Comparison of disc authoring software]].<br />
<br />
* {{App|[[Wikipedia:AcetoneISO|AcetoneISO]]|All-in-one ISO tool (supports BIN, MDF, NRG, IMG, DAA, DMG, CDI, B5I, BWI, PDI and ISO).|https://sourceforge.net/projects/acetoneiso|{{Pkg|acetoneiso2}}}}<br />
* {{App|BashBurn|Lightweight terminal based menu frontend for CD/DVD burning tools.|http://bashburn.dose.se/|{{Pkg|bashburn}}}}<br />
* {{App|[[Wikipedia:Brasero (software)|Brasero]]|Disc burning application for the GNOME desktop that is designed to be as simple as possible.|https://wiki.gnome.org/Apps/Brasero|{{Pkg|brasero}}}}<br />
* {{App|cdw|Ncurses frontend to ''cdrecord'', ''mkisofs'', ''growisofs'', ''dvd+rw-mediainfo'', ''dvd+rw-format'' and ''xorriso''.|http://cdw.sourceforge.net/|{{AUR|cdw}}}}<br />
* {{App|Graveman|GTK-based CD/DVD burning application. It requires configuration to point to correct devices.|https://graveman.tuxfamily.org/|{{AUR|graveman}}}}<br />
* {{App|isomaster|ISO image editor.|http://littlesvr.ca/isomaster|{{AUR|isomaster}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|[[Wikipedia:X-CD-Roast|X-CD-Roast]]|Lightweight ''cdrtools'' front-end for CD and DVD writing.|http://www.xcdroast.org/|{{AUR|xcdroast}}}}<br />
* {{App|[[Wikipedia:Xfce#Xfburn|Xfburn]]|Simple front-end to the libburnia libraries with support for CD/DVD(-RW), ISO images, and BurnFree.|https://docs.xfce.org/apps/xfburn/start|{{Pkg|xfburn}}}}<br />
* {{App|xorriso-tcltk|Graphical front-end to ISO and CD/DVD/BD burn tool xorriso|https://www.gnu.org/software/xorriso/|{{Pkg|libisoburn}}}}<br />
<br />
== Playback ==<br />
<br />
=== CD ===<br />
<br />
Playback of audio CDs requires the {{Pkg|libcdio}} package. To enable KDE Applications like Dolphin to read audio CDs install {{Pkg|audiocd-kio}}.<br />
<br />
=== DVD ===<br />
<br />
If you wish to play encrypted DVDs, you must install the libdvd* packages:<br />
* {{Pkg|libdvdread}}<br />
* {{Pkg|libdvdcss}}<br />
* {{Pkg|libdvdnav}}<br />
<br />
Additionally, you must install player software. Popular DVD players are [[MPlayer]], [[Wikipedia:Xine|xine]] and [[VLC]]. See the [[List of applications/Multimedia#Video players|video players]] list and the specific instructions for [[MPlayer#DVD playing|MPlayer]].<br />
<br />
=== Blu-ray ===<br />
<br />
See [[Blu-ray#Playback]].<br />
<br />
== Ripping ==<br />
<br />
[[Wikipedia:Ripping|Ripping]] is the process of copying audio or video content to a hard disk, typically from removable media or media streams.<br />
<br />
=== Audio CD ===<br />
<br />
==== Console ====<br />
<br />
* {{App|abcde|Comprehensive command-line tool for ripping audio CDs.|https://abcde.einval.com/|{{AUR|abcde}}}}<br />
* {{App|cdda2wav|CD-audio extraction program with paranoia support.|http://www.cdda2wav.de/|{{Pkg|cdrtools}}}}<br />
* {{App|[[Wikipedia:cdparanoia|cdparanoia]]|Compact Disc Digital Audio (CDDA) Digital Audio Extraction (DAE) tool.|https://xiph.org/paranoia/index.html|{{Pkg|cdparanoia}}}}<br />
* {{App|cyanrip|Extensive CD ripper with musicbraniz integration, error detection, log generation, many formats, HDCD decoding, covert art automatic download.|https://github.com/cyanreg/cyanrip/|{{AUR|cyanrip}}}}<br />
* {{App|ripright|Minimal CD ripper modeled on autorip.|https://www.mcternan.me.uk/ripright/|{{AUR|ripright}}}}<br />
* {{App|[[Wikipedia:ripit|ripit]]|Command-line ripper that supports MusicBrainz, freeddb and various codecs. |https://www.ripit.pl/|{{AUR|ripit}}}}<br />
* {{App|shnsplit|Splits .wav and .flac files according to a CUE sheet and encodes the resulting pieces. A useful companion to ABCDE.|http://shnutils.freeshell.org/shntool/|{{AUR|shntool}}}}<br />
* {{App|whipper|CD ripper aiming for accuracy over speed. Uses cdparanoia, MusicBrainz, AccurateRip.|https://github.com/whipper-team/whipper|{{Pkg|whipper}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|[[Wikipedia:Asunder (software)|Asunder]]|GTK-based CD ripping program.|http://littlesvr.ca/asunder/|{{Pkg|asunder}}}}<br />
* {{App|Audex|Audio grabber tool for CD-ROM drives based on KDE.|https://userbase.kde.org/Audex|{{Pkg|audex}}}}<br />
* {{App|[[Wikipedia:Fre:ac|fre:ac]]|Audio converter and CD ripper with support for various popular formats and encoders.|https://freac.org/|{{AUR|freac}}}}<br />
* {{App|Goobox|CD player and ripper for GNOME.|https://people.gnome.org/~paobac/goobox/{{Dead link|2022|09|22|status=404}}|{{Pkg|goobox}}}}<br />
* {{App|[[Wikipedia:Grip (software)|Grip]]|Fast and light CD ripper within the GNOME project that resembles [[Wikipedia:Audiograbber|Audiograbber]].|https://sourceforge.net/projects/grip/|{{AUR|grip}}}}.<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|KAudioCreator|KDE program for ripping and encoding Audio-CDs. Unmaintained and [https://bugs.archlinux.org/task/67618 does not start anymore].|https://invent.kde.org/unmaintained/kaudiocreator|{{AUR|kaudiocreator-git}}}}<br />
* {{App|ripperX|GTK program to rip CD audio tracks and encode them to the Ogg, MP3, or FLAC formats.|https://sourceforge.net/projects/ripperx/|{{AUR|ripperx}}}}<br />
* {{App|rubyripper|Audio disc ripper that tries to deliver a secure rip through multiple rippings of the same track and corrections of any differences.|https://github.com/bleskodev/rubyripper|{{AUR|rubyripper}}}}<br />
* {{App|[[Wikipedia:Sound Juicer|Sound Juicer]]|CD ripper for GNOME.|https://wiki.gnome.org/Apps/SoundJuicer|{{Pkg|sound-juicer}}}}<br />
* {{App|1=soundKonverter|2=Front-end to various audio converters.|3=https://www.linux-apps.com/content/show.php?content=29024|4={{Pkg|soundkonverter}}}}<br />
<br />
=== DVD-Video ===<br />
<br />
See also [[Wikipedia:Comparison of DVD ripper software]].<br />
<br />
Often, the process of ripping a DVD can be broken down into two subtasks:<br />
<br />
# '''Data extraction''' — Copying the audio and/or video data to a hard disk,<br />
# [[Wikipedia:Transcode|Transcoding]] — Converting the extracted data into a suitable format.<br />
<br />
Some utilities perform both tasks, whilst others focus on one aspect or the other.<br />
<br />
==== Console ====<br />
<br />
* {{App|[[dvdbackup]]|Tool for pure data extraction which does not transcode. It is useful for creating ''exact'' copies of encrypted DVDs in conjunction with '''libdvdcss''' or for decrypting video for other utilities unable to read encrypted DVDs.|http://dvdbackup.sourceforge.net/|{{Pkg|dvdbackup}}}}<br />
* {{App|[[FFmpeg]]|Complete and free Internet live audio and video broadcasting solution for Linux/Unix, capable to do a direct rip in any format (audio/video) from a DVD-Video ISO image, just select the input as the ISO image and proceed with the desired options. It also allows to downmixing, shrinking, spliting, selecting streams among other features.|https://ffmpeg.org/|{{Pkg|ffmpeg}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake CLI]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping.|https://handbrake.fr/|{{Pkg|handbrake-cli}}}}<br />
* {{App|[[MEncoder]]|Free command line video decoding, encoding and filtering tool. It supports ripping and transcoding DVD-Video.|http://www.mplayerhq.hu/|{{Pkg|mencoder}}}}<br />
* {{App|subtitleripper|Convert DVD subtitles into text format.|http://subtitleripper.sourceforge.net/|{{AUR|subtitleripper}}}}<br />
* {{App|Transcode|Video/DVD ripper and encoder for the terminal/console. It is [https://www.linuxfromscratch.org/blfs/view/8.3/multimedia/transcode.html outdated/no longer actively maintained].||{{Pkg|transcode}}}}<br />
* {{App|Vobcopy|Copies DVD ''.vob'' files to hard disk, decrypting them on the way.|https://github.com/barak/vobcopy|{{AUR|vobcopy}}}}<br />
<br />
==== Graphical ====<br />
<br />
* {{App|dvd::rip|Front-end to {{Pkg|transcode}}, used to extract DVD's to the hard disk and transcode or extract and transcode on-the-fly.|https://www.exit1.org/dvdrip/|{{AUR|dvdrip}}}}<br />
* {{App|[[Wikipedia:HandBrake|HandBrake]]|Simple yet powerful video transcoder ideal for batch mkv/x264 ripping. GTK version.|https://handbrake.fr/|{{Pkg|handbrake}}}}<br />
* {{App|[[Wikipedia:K3b|K3b]]|Feature-rich and easy to handle CD/DVD burning and ripping application based on KDElibs.|https://userbase.kde.org/K3b|{{Pkg|k3b}}}}<br />
* {{App|OGMRip|An application and a set of libraries for ripping and encoding DVD into AVI, OGM, MP4, or Matroska files using a wide variety of codecs. It relies on mplayer, mencoder, ogmtools, mkvtoolnix, mp4box, oggenc, lame, and faac to perform its tasks.|http://ogmrip.sourceforge.net/|{{AUR|ogmrip}}}}<br />
<br />
=== DVD-Audio ===<br />
<br />
* {{App|Python Audio Tools|Includes dvda2track, which is easy to use command line tool to extract DVD-Audio tracks to uncompressed wav files.<br />
|http://audiotools.sourceforge.net/|{{AUR|audiotools}}}}<br />
<br />
=== Multi-format ===<br />
<br />
* {{App|Aaru|Software for archival ripping of CDs, DVDs, and harddrives|https://aaru.app|{{AUR|aaru}}}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Brasero fails to normalize audio CD ===<br />
<br />
If you try to burn it may stop at the first step called Normalization.<br />
<br />
As a workaround you can disable the normalization plugin using the ''Edit > Plugins'' menu<br />
<br />
=== VLC: Error "... could not open the disc /dev/dvd" ===<br />
<br />
If you get an error like<br />
<br />
vlc dvdread could not open the disc "/dev/dvd"<br />
<br />
it may be because there is no device node {{ic|/dev/dvd}} on your system. Udev no longer creates {{ic|/dev/dvd}} and instead uses {{ic|/dev/sr0}}. To fix this, edit the VLC configuration file ({{ic|~/.config/vlc/vlcrc}}):<br />
<br />
# DVD device (string)<br />
dvd=/dev/sr0<br />
<br />
=== DVD drive is noisy ===<br />
<br />
If playing DVD videos causes the system to be very loud, it may be because the disc is spinning faster than it needs to. To temporarily change the speed of the drive, run:<br />
<br />
# eject -x 12 /dev/dvd<br />
<br />
Sometimes:<br />
<br />
# hdparm -E12 /dev/dvd<br />
<br />
Any speed that is supported by the drive can be used, or 0 for the maximum speed.<br />
<br />
[https://michal.kosmulski.org/computing/tips/cd-rom-speed.html Setting CD-ROM and DVD-ROM drive speed]<br />
<br />
=== Playback does not work with new computer (new DVD-Drive) ===<br />
<br />
If playback does not work and you have a new computer (new DVD-Drive) the reason might be that the [[Wikipedia:DVD region code|region code]] is not set. You can read and set the region code with the {{AUR|regionset}} package.<br />
<br />
=== None of the above programs are able to rip/encode a DVD to my hard disk! ===<br />
<br />
Make sure the region of your DVD reader is set correctly; otherwise, you will get loads of inexplicable [[Wikipedia:Content Scramble System|CSS]]-related errors. Use the {{AUR|regionset}} package to do so.<br />
<br />
If ripping still does not work with the correct region set, refer to the [https://videolan.videolan.me/libdvdcss/ libdvdcss developer documentation] for enabling log messages and setting other relevant options.<br />
<br />
=== GUI program log indicates problems with backend program ===<br />
<br />
If you use a GUI program and experience problems which the program's log blames on some backend program, then try to reproduce the problem by the logged backend program arguments.<br />
Whether you succeed with reproducing or not, you may report the logged lines and your own findings to the places mentioned in [[#Burn backend problems]] section.<br />
<br />
==== Special case: medium error / write error ====<br />
<br />
Here are some typical messages about the drive disliking the medium. This can only be solved by using a different drive or a different medium. A different program will hardly help.<br />
<br />
Brasero with backend growisofs:<br />
<br />
BraseroGrowisofs stderr: :-[ WRITE@LBA=0h failed with SK=3h/ASC=0Ch/ACQ=00h]: Input/output error<br />
<br />
Brasero with backend libburn:<br />
<br />
BraseroLibburn Libburn reported an error SCSI error on write(16976,16): [3 0C 00] Write error<br />
<br />
=== BD-R DL 50GB errors on trying to burn second layer ===<br />
<br />
Using ''growisofs'' from {{Pkg|dvd+rw-tools}} for burning 50GB BD-R DL discs might result in a fatal error and damaged media, such as:<br />
<br />
{{hc|$ growisofs -Z /dev/sr0 -J -R -V "label" files|<nowiki><br />
Executing 'mkisofs -J -R -V label files | builtin_dd of=/dev/sr0 obs=32k seek=0'<br />
I: -input-charset not specified, using utf-8 (detected in locale settings)<br />
0.03% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.05% done, estimate finish Fri Jan 29 19:50:36 2016<br />
0.08% done, estimate finish Fri Jan 29 19:50:36 2016<br />
/dev/sr0: pre-formatting blank BD-R for 49.8GB...<br />
/dev/sr0: "Current Write Speed" is 8.2x4390KBps.<br />
0.11% done, estimate finish Sat Jan 30 03:29:13 2016<br />
0.13% done, estimate finish Sat Jan 30 02:10:01 2016<br />
...<br />
63.20% done, estimate finish Fri Jan 29 20:43:45 2016<br />
:-[ WRITE@LBA=b6d820h failed with SK=3h/WRITE ERROR]: Input/output error<br />
:-( write failed: Input/output error<br />
/dev/sr0: flushing cache<br />
/dev/sr0: closing track<br />
/dev/sr0: closing session<br />
:-[ CLOSE SESSION failed with SK=5h/INVALID FIELD IN CDB]: Input/output error<br />
/dev/sr0: reloading tray<br />
</nowiki>}}<br />
<br />
This happened at the 25GB boundary when starting to write the second layer. Using ''cdrecord'' from {{Pkg|cdrtools}} works with no problems. Tested with a 'HL-DT-ST BD-RE WH16NS40' LG burner, and Verbatim BD-R DL 6x discs (#96911). {{bug|47797}}<br />
<br />
=== Disc tray autocloses ===<br />
<br />
If after ejecting a cd, either by using the {{ic|eject}} command, or pushing the drive button, the drive disc tray autocloses before being able to remove the disc, try the following command:<br />
<br />
# sysctl -w dev.cdrom.autoclose=0<br />
<br />
If that solves the problem, make the change permanent:<br />
<br />
{{hc|/etc/sysctl.d/60-cdrom-autoclose.conf|2=<br />
dev.cdrom.autoclose = 0<br />
}}<br />
<br />
If the above does not work and as a last resort measure, you can unload the disc module from the kernel via:<br />
<br />
# rmmod sr_mod<br />
<br />
the disc drive should now behave as expected but will not mount disc anymore. After putting a disc into the drive, reactivate the module via:<br />
<br />
# modprobe sr_mod<br />
<br />
the disc should now mount.<br />
<br />
== See also ==<br />
<br />
* In the United States, backup of physically obtained media is allowed under these conditions: [https://www.riaa.com/resources-learning/about-piracy/ About Piracy - RIAA].<br />
* [https://dev.lovelyhq.com/libburnia/web/wiki Main page of the project Libburnia]</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=User:InsaneGuo&diff=746049User:InsaneGuo2022-09-13T09:38:23Z<p>InsaneGuo: </p>
<hr />
<div>陆中学生<br />
我爱arch 爱来自一中机房</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=User:InsaneGuo&diff=742946User:InsaneGuo2022-08-23T11:53:11Z<p>InsaneGuo: Replaced content with "陆中学生"</p>
<hr />
<div>陆中学生</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=738985Wine (简体中文)2022-07-25T08:59:02Z<p>InsaneGuo: /* 键盘输入不工作 */ 翻译</p>
<hr />
<div>[[Category:Emulation (简体中文)]]<br />
[[Category:Gaming (简体中文)]]<br />
[[de:Wine]]<br />
[[en:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
{{Related articles start}}<br />
{{Related|CrossOver}}<br />
{{Related|Deepin-wine}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Wine|2022-01-28|724914}}<br />
<br />
[[Wikipedia:Wine (software)|Wine]] 是一款可以在类 Unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而没有模拟器的性能/内存损失。<br />
<br />
{{警告|<br />
* Wine 并非与你的系统隔离。<br />
* 如果你可以使用你的用户帐户访问某个文件或资源,那么在 Wine 中运行的程序也可以。参见[[#在单独的用户帐户下运行 Wine]]和[[安全#沙盒程序]]了解可能的预防措施。<br />
* Wine 也可以运行恶意软件(参见 [https://wiki.winehq.org/FAQ#Is_Wine_malware-compatible.3F Wine 关于恶意软件兼容性的 FAQ])}}<br />
<br />
== 安装 ==<br />
<br />
首先启用[[multilib]]仓库,然后[[install|安装]] {{Pkg|wine}}(开发版),{{AUR|wine-stable}}(稳定版)或 {{Pkg|wine-staging}}(测试版本)。[https://wine-staging.com/ Wine Staging] 是 [https://www.winehq.org/ Wine] 的修补版本, 其中包含了漏洞修复和尚未集成到稳定或开发分支中的特性。<br />
<br />
其它需求见[[#图形驱动程序]]和[[#声音]]。<br />
<br />
可以考虑为依赖于 Internet Explorer 和 .NET 的应用程序分别安装 {{pkg|wine-gecko}} 和 {{pkg|wine-mono}}。这两个软件包不是一定要安装的,因为 Wine 会根据需要自行下载相关文件。反过来说,如果提前安装了软件包,Wine 就不需要再下载这些文件了。<br />
<br />
== 配置 ==<br />
<br />
配置 Wine 通常使用以下方法:<br />
<br />
* [https://wiki.winehq.org/Winecfg winecfg] 是 Wine 的 GUI 配置工具,可以通过运行 {{ic|winecfg}} 来启动。<br />
* [https://wiki.winehq.org/Regedit regedit] 是 Wine 的注册表编辑工具,可以通过运行{{ic|regedit}} 来启动。另见 WineHQ 关于 [https://wiki.winehq.org/Useful_Registry_Keys 有用的注册表键]的文档。<br />
* [https://wiki.winehq.org/Control control] 是 Wine 的 Windows 控制面板的实现,可以通过运行 {{ic|wine control}} 来启动。<br />
* 完整列表见 WineHQ 的[https://wiki.winehq.org/List_of_Commands 命令列表]。<br />
<br />
=== WINEPREFIX ===<br />
<br />
默认情况下,Wine 将其配置文件和安装的 Windows 程序存储在 {{ic|~/.wine}} ,通常会把此目录叫作“Wine prefix”或“Wine bottle”。当您运行 Windows 程序或 Wine 的捆绑程序(如 winecfg)时,它会自动创建/更新。前缀目录还包含一个目录,您的 Windows 程序将其视为 {{ic|c:}} (C盘)。<br />
<br />
您可以使用 {{ic|WINEPREFIX}}环境变量覆盖 Wine 使用的前缀位置。如果您希望为不同的 Windows 程序使用单独的配置,这将非常有用。第一次运行带有新 Wine 前缀的程序时,Wine 将自动创建一个带有 c 驱动器和注册表的目录。<br />
<br />
例如,如果您运行一个带有{{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}的程序,和另一个 {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}这两个程序将分别有一个单独的 c 驱动器和单独的注册。<br />
<br />
{{警告|Wine不是[[Wikipedia:Sandbox (computer security)|沙盒]]!在 Wine 下运行的程序仍然可以访问系统的其余部分!(例如, {{ic|Z:}} 映射到 {{ic|/}}, 与 Wine 前缀无关)}}<br />
<br />
若要在不运行 Windows 程序或其他 GUI 工具的情况下创建默认前缀,可以使用:<br />
<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
Wine将默认启动一个64位环境。你可以改变它使用{{ic|WINEARCH}}[[环境变量]]。改名你的{{ic|~/.wine}}目录并创建一个新的Wine环境通过使用{{ic|1=$WINEARCH=win32 winecfg}}。这将给你一个32位Wine环境。不舍指{{ic|WINEARCH}}将给你一个64位环境。<br />
<br />
你可以通过修改{{ic|WINEPREFIX}}来创建一个分开的{{ic|win32}}和{{ic|win64}}环境:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
你也可以使用{{ic|WINEARCH}}与其它Wine程式合并,例如''winetricks''(使用Steam作为例子)<br />
<br />
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
为了使用这个架构在一个存在的预设,你可以检查他的注册表文件。如下的命令读了{{ic|~/.wine}}的预设系统注册表并返回{{ic|1=#arch-win32}}或{{ic|1=#arch=win64}}依赖于架构类型。<br />
<br />
$ grep '#arch' ~/.wine/system.reg<br />
<br />
=== 图形驱动程序 ===<br />
<br />
你需要安装 32 位版本的图形驱动程序。请安装[[Xorg (简体中文)#驱动安装]]中 ''OpenGL (multilib)'' 一栏列出的软件包。<br />
<br />
当 Wine 在你的终端窗口中报告以下内容时,很可能你的驱动程序不合适或没有正确配置:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{注意|安装正确的库之后你可能需要重新启动 X。}}<br />
<br />
=== 声音 ===<br />
<br />
默认情况下,运行Wine应用程序时可能会出现声音问题。确保在winecfg中只选择一个声音设备。<br />
<br />
为你要使用的音频驱动器安装正确的软件包:<br />
<br />
* 对于 [[ALSA]] 安装 {{Pkg|lib32-alsa-lib}} 和 {{Pkg|lib32-alsa-plugins}}<br />
* 对于 [[PulseAudio]] 安装 {{Pkg|lib32-libpulse}} <br />
* 对于 [[PipeWire]] 同时安装 {{Pkg|pipewire-pulse}}和 {{Pkg|lib32-libpulse}} 或者 {{Pkg|pipewire-alsa}} 和 {{Pkg|lib32-alsa-lib}} + {{Pkg|lib32-alsa-plugins}}<br />
* 对于 [[OSS]] 安装 {{Pkg|lib32-alsa-oss}}<br />
<br />
额外的软件包:<br />
<br />
使用高级声音系统的游戏(例如TESV: Skyrim)可能还需要安装{{Pkg|lib32-openal}}。<br />
如果winecfg仍然无法检测到音频驱动(Selected driver: (none)),请通过注册表对其进行配置。例如,在64位的wine-1.9.7系统上,麦克风无法在32位的Windows应用程序中工作,这就提供了对声音硬件(声音播放和麦克风)的完全访问:打开regedit,寻找路径HKEY_CURRENT_USER → Software → Wine → Drivers,添加一个名为Audio的字符串,给它一个值alsa。另外,重新创建前缀可能有帮助。<br />
<br />
==== MIDI支持 ====<br />
<br />
在90年代,[[MIDI]]是相当流行的游戏音乐系统。尝试游玩老游戏时,音乐可能无法直接播放。<br />
Wine对MIDI有良好的支持,但首先需要让它在系统上工作,如[[MIDI]]中所解释的。最后,需要确保Wine使用了正确的MIDI输出。<br />
<br />
=== 其它依赖 ===<br />
<br />
对于以下情况,部分应用软件可能需要额外的软件包:<br />
<br />
* 播放音乐: {{Pkg|lib32-mpg123}}<br />
* 原生图像处理库: {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}<br />
* 加密服务: {{Pkg|lib32-gnutls}}<br />
* 32位视频编解码器: {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}<br />
* NTLM身份验证: {{Pkg|samba}}<br />
<br />
=== 字体 ===<br />
<br />
如果 Wine 应用程序没有显示易读的字体,则可能没有安装任何字体。轻松链接所有的系统字体,使其可以从Wine:<br />
<br />
$ cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; done<br />
<br />
Wine 使用 FreeType 渲染字体,而 FreeType 的默认设置在几个版本之前已经改变了。尝试在Wine项目中使用这种环境设置:<br />
<br />
FREETYPE_PROPERTIES="truetype:interpreter-version=35"<br />
<br />
另一种可能性是在Wine前缀中安装微软的 TrueType 字体。 See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
运行此类程序后,关闭所有 Wine 服务并运行{{ic| winecfg }}。字体现在应该是可读的。<br />
<br />
如果字体看起来模糊不清,导入以下文本文件到 Wine 注册表[https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
Windows Registry Editor Version 5.00<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
对于高分辨率显示,可以在 winecfg 中调整 dpi 值。<br />
<br />
另见[[Font configuration#Applications without fontconfig support]]。<br />
<br />
==== 启用平滑字体 ====<br />
<br />
提高Wine渲染效果的一个好方法是使用cleartype平滑字体。<br />
若要启用“次像素平滑(ClearType) RGB”:<br />
<br />
{{bc|<nowiki><br />
$ cat << EOF > /tmp/fontsmoothing<br />
REGEDIT4<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingOrientation"=dword:00000001<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
EOF<br />
<br />
$ WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null<br />
</nowiki>}}<br />
<br />
详见[https://askubuntu.com/a/219795]。<br />
<br />
=== 桌面启动器 ===<br />
<br />
当使用 Windows 应用安装程序创建一个快捷方式时,Wine 会创建 [[.desktop]] 文件。Arch Linux 中这些文件的默认位置是:<br />
<br />
* 桌面快捷方式位于 {{ic|~/Desktop}} 下。<br />
* 开始菜单图标位于 {{ic|~/.local/share/applications/wine/Programs/}} 下。<br />
<br />
{{Note|1=Wine 不支持为所有用户安装 Winidows 应用程序,所以 Wine 不会把 ''.desktop'' 文件放到 {{ic|/usr/share/applications}} 下。详见 WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}<br />
<br />
{{Tip|如果安装软件时桌面启动器并没有创建或已经丢失,{{ic|wine winemenubuilder}} 也许能帮得上忙。}}<br />
<br />
==== 为Wine utilities创建菜单项 ====<br />
<br />
默认情况下,Wine 的安装不会为 Wine 附带的软件创建桌面菜单/图标(例如“ winecfg”、“ winebroserer”等)。这可以通过安装 {{AUR|wine-installer}}或 {{AUR|wine-installer-git}} meta-package (后者没有附加依赖项)来实现,否则这些说明将为这些应用程序添加条目。<br />
<br />
首先,使用 Wine 安装一个 Windows 程序来创建基本菜单。创建基本菜单后,可以在 {{ic|~/.local/share/applications/wine/}}:<br />
<br />
{{hc|wine-browsedrive.desktop|2=<br />
[Desktop Entry]<br />
Name=Browse C: Drive<br />
Comment=Browse your virtual C: drive<br />
Exec=wine winebrowser c:<br />
Terminal=false<br />
Type=Application<br />
Icon=folder-wine<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-uninstaller.desktop|2=<br />
[Desktop Entry]<br />
Name=Uninstall Wine Software<br />
Comment=Uninstall Windows applications for Wine<br />
Exec=wine uninstaller<br />
Terminal=false<br />
Type=Application<br />
Icon=wine-uninstaller<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-winecfg.desktop|2=<br />
[Desktop Entry]<br />
Name=Configure Wine<br />
Comment=Change application-specific and general Wine options<br />
Exec=winecfg<br />
Terminal=false<br />
Icon=wine-winecfg<br />
Type=Application<br />
Categories=Wine;<br />
}}<br />
<br />
并在{{ic|~/.config/menus/applications-merged/}}目录下创建如下文件:<br />
<br />
{{hc|wine.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Category>Wine</Category><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
<br />
如果这些设置产生了一个难看的/不存在的图标,这意味着在您所启用的图标集中没有这些启动程序的图标。您应该将图标设置替换为所需图标的位置。单击启动器属性菜单中的图标将会产生同样的效果。一个支持这些快捷方式的图标集是[https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors]。<br />
<br />
==== Removing menu entries ====<br />
<br />
由 Wine 创建的菜单条目位于 {{ic|~/.local/share/applications/wine/Programs/}}.<br />
除了通过 Wine 删除不需要的扩展绑定,还可以执行以下命令(摘自 Wine 官网) :<br />
<br />
$ rm ~/.local/share/mime/packages/x-wine*<br />
$ rm ~/.local/share/applications/wine-extension*<br />
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
$ rm ~/.local/share/mime/application/x-wine-extension*<br />
<br />
Sometimes you should also remove {{ic|wine-*.menu}} files from {{ic|/.config/menus/}} to completely remove items from wine submenu in kde.<br />
<br />
=== 主题 ===<br />
<br />
类似于 xp 外观的主题可以在这里 [https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 下载]. To install it, see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files this upstream wiki article]. Lastly, use ''winecfg'' to select it.<br />
<br />
{{Note|上面链接的主题只能安装在32位前缀上,前缀版本为 windowsxp。要将其安装在64位前缀上,可能需要创建一个临时的32位前缀,install the theme and copy the {{ic|Zune}} folder and {{ic|Zune.theme}} files from {{ic|drive_c/Windows/Resources/Themes}} in that prefix to the same location in your usual prefix.}}<br />
<br />
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.<br />
<br />
=== 打印 ===<br />
<br />
为了在Wine程式中使用已安装的打印机(包括本地与网路的)在''win32 前缀''(如微软Word),安装{{Pkg|lib32-libcups}}包,使用(''wineboot'')重启wine,然后重新启动你的wine程式。<br />
<br />
=== 网络 ===<br />
<br />
安装过后,{{pkg|lib32-gnutls}}包也许需要为一些程式[[安装]]来创建TLS或HTTPS连接。<br />
<br />
对于ICMP(ping),Wine也许需要如上所述的网络访问,见[https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
<br />
如果在这之后出事(例如未处理的异常或特权指令),删除它通过:<br />
<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== 使用 ==<br />
<br />
{{警告|不要以 root 身份运行或安装 Wine 应用程序!详见 [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ]。}}<br />
<br />
见[https://wiki.winehq.org/Wine_User%27s_Guide#Using_Wine Wine用户手册]以获得Wine使用中的通用讯息。<br />
<br />
见[https://appdb.winehq.org/ Wine程式数据库(AppDB)]以获得Wine中特殊Windows程式的附加讯息。<br />
<br />
=== Wayland ===<br />
<br />
Wine 当前并不直接支持 Wayland,但你可以使用 [[Wayland#XWayland|XWayland]]。<br />
<br />
这有一些支援Wayland的努力:<br />
<br />
*Wine的实验性的Wayland驱动,可支援OpenGL与Windows GDI程式。见[https://www.winehq.org/pipermail/wine-devel/2020-December/178575.html 这个]和[https://www.winehq.org/pipermail/wine-devel/2021-February/181325.html 这个]wine开发邮箱列表条目。<br />
<br />
* [https://github.com/varmd/wine-wayland wine-wayland]:一个Wine的定制版本,可支持Wayland通过Vulkan(所以它只支持Direct9、10和11通过[[#SXVK]]和Vulkan完全支援的程式)。<br />
<br />
== 提示与技巧 ==<br />
<br />
=== Wineconsole ===<br />
<br />
通常情况下,你可能需要运行.exe来修补游戏文件,例如一个老游戏的宽屏mod,通过Wine正常运行.exe可能不会产生任何效果。在这种情况下,你可以打开一个终端,运行以下命令。<br />
<br />
$ wineconsole cmd<br />
<br />
然后转到该目录,从那里运行''.exe''文件。<br />
<br />
=== Winetricks ===<br />
<br />
[https://wiki.winehq.org/Winetricks Winetricks]是一个允许人安装支持Windows程式的基础依赖的脚本。可安装的组件包括Direct9 、MSXML(由微软Office 2007和Internet Explorer)、Visual运行时库和很多其它的。<br />
<br />
[[安装]]{{pkg|winetricks}}包(或{{AUR|winetriecks-git}}。然后用此运行:<br />
<br />
$ winetricks<br />
<br />
要用GUI,需要[[安装]]{{pkg|zenity}}。<br />
<br />
=== 性能 ===<br />
<br />
==== CSMT ====<br />
<br />
CSMT是Wine使用的一项技术,它为OpenGL调用使用了一个单独的线程,以显著提高性能。从Wine 3.2开始,CSMT被默认启用。然而,对于低于3.2的Wine版本,需要手动启用CSMT支持。对于vanilla Wine,运行wine regedit并将HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt的DWORD值设置为0x01(启用)。对于wine-staging,运行winecfg并在staging标签中启用它。<br />
<br />
注意,CSMT实际上可能会损害某些应用程序的性能--如果是这种情况,通过创建/设置注册表值为0x00(禁用)来禁用它。<br />
<br />
更多:<br />
*[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion]<br />
<br />
==== 强制使用OpenGL模式运行游戏 ====<br />
<br />
有些游戏可能有OpenGL模式,其性能可能比其默认的DirectX模式更好。虽然启用OpenGL渲染的是 "特定应用",但许多游戏可以使用{{Ic|-opengl}}参数。<br />
<br />
$ wine ''/path/to/3d_game.exe'' -opengl<br />
<br />
你应该参考你的应用程序文档和Wine的官网[https://appdb.winehq.org AppDB]来了解这些应用程序的具体信息。<br />
<br />
==== DXVK ====<br />
<br />
[https://github.com/doitsujin/dxvk DXVK] 是在Vulkan上对DirectX 9、10和11的一个可能的新实现。这应该有更好的性能,在某些情况下,甚至更好的兼容性。例如,《战地1》在DXVK下运行。另一方面,DXVK并不支持所有的Wine游戏(目前)。<br />
<br />
安装{{aur|dxvk-bin}}以使用它. 然后运行以下命令,在wineprefix中激活它(默认为 {{ic|~/.wine}}):<br />
<br />
$ WINEPREFIX=''your-prefix'' setup_dxvk install<br />
<br />
{{Warning|DXVK覆盖了DirectX 10和11的许多dll,这可能被认为是在线多人游戏中的作弊行为,并可能使你的账户被封。使用时风险自负!}}<br />
<br />
==== Gallium Nine ====<br />
<br />
With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.<br />
<br />
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any Wine version. Use {{ic|wine ninewinecfg}} to check if it is enabled.<br />
<br />
For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. [[Export]] the following environment variable before running Wine: <br />
<br />
MESA_LOADER_DRIVER_OVERRIDE=crocus<br />
<br />
=== Unregister existing Wine file associations ===<br />
<br />
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.<br />
<br />
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
$ update-mime-database ~/.local/share/mime/<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Prevent Wine from creating filetype associations ===<br />
<br />
{{Note|This has to be done for each WINEPREFIX which should not update file associations unless you opt to change {{ic|/usr/share/wine/wine.inf}} .}}<br />
This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).<br />
<br />
If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See [https://wiki.winehq.org/FAQ#How_can_I_prevent_Wine_from_changing_the_filetype_associations_on_my_system_or_adding_unwanted_menu_entries.2Fdesktop_links.3F Wine FAQ]<br />
<br />
To make the same change via registry add the string {{ic|Enable}} with value {{ic|N}} under:<br />
<br />
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations<br />
<br />
''You might have to create the key {{ic|FileOpenAssociations}} first!''<br />
<br />
To make this change via the command-line, run the following command:<br />
<br />
$ wine reg add "HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations" /v Enable /d N<br />
<br />
If you want to apply this by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}} and add this line for example under the {{ic|[Services]}} section:<br />
HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"<br />
<br />
To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:<br />
<br />
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=<br />
<br />
[Trigger]<br />
Operation = Install<br />
Operation = Upgrade<br />
Type = Path<br />
Target = usr/share/wine/wine.inf<br />
<br />
[Action]<br />
Description = Stopping Wine from hijacking file associations...<br />
When = PostTransaction<br />
<nowiki>Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'</nowiki><br />
}}<br />
<br />
See [[Pacman#Hooks]]<br />
<br />
=== 自动使用 Wine 执行 Windows 程序 ===<br />
<br />
{{pkg|wine}} 软件包会安装一个 ''binfmt'' 文件,这可使你能够直接运行 Windows 程序,例如,{{ic|''./myprogram.exe''}} 将与 {{ic|wine ''./myprogram.exe''}} 效果相同。服务默认在开机时启动,如果在安装 Wine 之后还没有重启过,[[启动]] {{ic|systemd-binfmt.service}} 即可。<br />
<br />
{{注意|确保 Windows 程序[[executable|可执行]],否则程序将不会运行。}}<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). [[CDemu]] will handle it correctly.<br />
<br />
=== 游戏内显示帧数 ===<br />
<br />
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.<br />
<br />
=== 在单独的用户帐户下运行 Wine ===<br />
<br />
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.<br />
<br />
First, create a [[user account]] for Wine:<br />
<br />
# useradd -m -s /bin/bash wineuser<br />
<br />
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...<br />
<br />
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information on how to execute the {{ic|xhost}} command under your main user.}}<br />
<br />
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:<br />
<br />
$ xhost +SI:localuser:wineuser<br />
<br />
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:<br />
<br />
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''<br />
<br />
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:<br />
{{hc|1=/usr/local/bin/runaswine|2=<br />
#!/bin/bash<br />
xhost +SI:localuser:wineuser<br />
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}<br />
<br />
Wine applications can then be launched via:<br />
<br />
$ runaswine ''"C:\path\to\application.exe"''<br />
<br />
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.<br />
<br />
It is recommended to run {{ic|winecfg}} as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.<br />
<br />
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to share a PulseAudio daemon]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.<br />
<br />
=== Temp directory on tmpfs ===<br />
<br />
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:<br />
<br />
$ rm -r ~/.wine/drive_c/users/$USER/Temp ~/.wine/drive_c/windows/temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/windows/temp<br />
<br />
=== Prevent installing Mono/Gecko ===<br />
<br />
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.<br />
<br />
=== Vulkan ===<br />
<br />
The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].<br />
<br />
=== Remove Wine file bindings ===<br />
<br />
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).<br />
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}<br />
<br />
NoExtract = usr/lib/binfmt.d/wine.conf<br />
NoExtract = usr/share/applications/wine.desktop<br />
<br />
=== WineASIO ===<br />
<br />
If you need professional audio support under wine you can use {{Aur|wineasio}} which provides an ASIO interface for wine that you can then use with [[JACK]].<br />
<br />
In order to use wineasio you must add yourself to the {{ic|realtime}} [[user group]].<br />
<br />
Next you need to register wineasio in your desired wine prefix. Register the 32-bit and/or 64-bit version as needed:<br />
$ regsvr32 /usr/lib32/wine/i386-windows/wineasio.dll<br />
$ wine64 regsvr32 /usr/lib/wine/x86_64-windows/wineasio.dll<br />
<br />
== 疑难解答 ==<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Troubleshooting_.2F_Reporting_bugs Wine User's Guide] and [https://wiki.winehq.org/FAQ Wine FAQ] (especially its [https://wiki.winehq.org/FAQ#Troubleshooting Troubleshooting] section) for general tips.<br />
<br />
Also refer to the [https://appdb.winehq.org/ Wine AppDB] for an advice on specific applications.<br />
<br />
=== XWayland问题 ===<br />
<br />
If you use Wine under [[Wayland#XWayland|XWayland]], you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:<br />
<br />
* flickering;<br />
* wrong window location;<br />
* wrong mouse cursor location and clicks;<br />
* keyboard detection.<br />
<br />
=== 键盘输入不工作 ===<br />
<br />
这可能是由于窗口管理器没有切换焦点造成的。在''winecfg''的''图形''标签中,禁用'允许窗口管理器...'选项,或者用'模拟虚拟桌面'设置窗口模式。<br />
*有人建议切换所有的 "窗口设置",点击 "应用",然后把它们改回来。如果这不起作用,请尝试上述方法。<br />
<br />
如果在取消应用程序的焦点后,键盘不能工作,请尝试编辑注册表。<br />
*在''HKEY_CURRENT_USER\Software\Wine\X11 Driver''下,添加一个字符串值''UseTakeFocus''并将其设置为''N''。<br />
*另外,你也可以用winetricks来设置这个值。<br />
winetricks usetakefocus=n<br />
<br />
== 参见 ==<br />
<br />
* [https://www.winehq.org/ Wine Homepage]<br />
* [https://wiki.winehq.org/ Wine Wiki]<br />
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
* [[Gentoo:Wine]]<br />
* [https://www.darlinghq.org/ Darling] - a similar project for MacOS software<br />
* [https://github.com/wineasio/wineasio WineASIO] - GitHub page of the WineASIO project with further information</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=738984Wine (简体中文)2022-07-25T08:34:38Z<p>InsaneGuo: 更改原页面时间</p>
<hr />
<div>[[Category:Emulation (简体中文)]]<br />
[[Category:Gaming (简体中文)]]<br />
[[de:Wine]]<br />
[[en:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
{{Related articles start}}<br />
{{Related|CrossOver}}<br />
{{Related|Deepin-wine}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Wine|2022-01-28|724914}}<br />
<br />
[[Wikipedia:Wine (software)|Wine]] 是一款可以在类 Unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而没有模拟器的性能/内存损失。<br />
<br />
{{警告|<br />
* Wine 并非与你的系统隔离。<br />
* 如果你可以使用你的用户帐户访问某个文件或资源,那么在 Wine 中运行的程序也可以。参见[[#在单独的用户帐户下运行 Wine]]和[[安全#沙盒程序]]了解可能的预防措施。<br />
* Wine 也可以运行恶意软件(参见 [https://wiki.winehq.org/FAQ#Is_Wine_malware-compatible.3F Wine 关于恶意软件兼容性的 FAQ])}}<br />
<br />
== 安装 ==<br />
<br />
首先启用[[multilib]]仓库,然后[[install|安装]] {{Pkg|wine}}(开发版),{{AUR|wine-stable}}(稳定版)或 {{Pkg|wine-staging}}(测试版本)。[https://wine-staging.com/ Wine Staging] 是 [https://www.winehq.org/ Wine] 的修补版本, 其中包含了漏洞修复和尚未集成到稳定或开发分支中的特性。<br />
<br />
其它需求见[[#图形驱动程序]]和[[#声音]]。<br />
<br />
可以考虑为依赖于 Internet Explorer 和 .NET 的应用程序分别安装 {{pkg|wine-gecko}} 和 {{pkg|wine-mono}}。这两个软件包不是一定要安装的,因为 Wine 会根据需要自行下载相关文件。反过来说,如果提前安装了软件包,Wine 就不需要再下载这些文件了。<br />
<br />
== 配置 ==<br />
<br />
配置 Wine 通常使用以下方法:<br />
<br />
* [https://wiki.winehq.org/Winecfg winecfg] 是 Wine 的 GUI 配置工具,可以通过运行 {{ic|winecfg}} 来启动。<br />
* [https://wiki.winehq.org/Regedit regedit] 是 Wine 的注册表编辑工具,可以通过运行{{ic|regedit}} 来启动。另见 WineHQ 关于 [https://wiki.winehq.org/Useful_Registry_Keys 有用的注册表键]的文档。<br />
* [https://wiki.winehq.org/Control control] 是 Wine 的 Windows 控制面板的实现,可以通过运行 {{ic|wine control}} 来启动。<br />
* 完整列表见 WineHQ 的[https://wiki.winehq.org/List_of_Commands 命令列表]。<br />
<br />
=== WINEPREFIX ===<br />
<br />
默认情况下,Wine 将其配置文件和安装的 Windows 程序存储在 {{ic|~/.wine}} ,通常会把此目录叫作“Wine prefix”或“Wine bottle”。当您运行 Windows 程序或 Wine 的捆绑程序(如 winecfg)时,它会自动创建/更新。前缀目录还包含一个目录,您的 Windows 程序将其视为 {{ic|c:}} (C盘)。<br />
<br />
您可以使用 {{ic|WINEPREFIX}}环境变量覆盖 Wine 使用的前缀位置。如果您希望为不同的 Windows 程序使用单独的配置,这将非常有用。第一次运行带有新 Wine 前缀的程序时,Wine 将自动创建一个带有 c 驱动器和注册表的目录。<br />
<br />
例如,如果您运行一个带有{{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}的程序,和另一个 {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}这两个程序将分别有一个单独的 c 驱动器和单独的注册。<br />
<br />
{{警告|Wine不是[[Wikipedia:Sandbox (computer security)|沙盒]]!在 Wine 下运行的程序仍然可以访问系统的其余部分!(例如, {{ic|Z:}} 映射到 {{ic|/}}, 与 Wine 前缀无关)}}<br />
<br />
若要在不运行 Windows 程序或其他 GUI 工具的情况下创建默认前缀,可以使用:<br />
<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
Wine将默认启动一个64位环境。你可以改变它使用{{ic|WINEARCH}}[[环境变量]]。改名你的{{ic|~/.wine}}目录并创建一个新的Wine环境通过使用{{ic|1=$WINEARCH=win32 winecfg}}。这将给你一个32位Wine环境。不舍指{{ic|WINEARCH}}将给你一个64位环境。<br />
<br />
你可以通过修改{{ic|WINEPREFIX}}来创建一个分开的{{ic|win32}}和{{ic|win64}}环境:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
你也可以使用{{ic|WINEARCH}}与其它Wine程式合并,例如''winetricks''(使用Steam作为例子)<br />
<br />
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
为了使用这个架构在一个存在的预设,你可以检查他的注册表文件。如下的命令读了{{ic|~/.wine}}的预设系统注册表并返回{{ic|1=#arch-win32}}或{{ic|1=#arch=win64}}依赖于架构类型。<br />
<br />
$ grep '#arch' ~/.wine/system.reg<br />
<br />
=== 图形驱动程序 ===<br />
<br />
你需要安装 32 位版本的图形驱动程序。请安装[[Xorg (简体中文)#驱动安装]]中 ''OpenGL (multilib)'' 一栏列出的软件包。<br />
<br />
当 Wine 在你的终端窗口中报告以下内容时,很可能你的驱动程序不合适或没有正确配置:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{注意|安装正确的库之后你可能需要重新启动 X。}}<br />
<br />
=== 声音 ===<br />
<br />
默认情况下,运行Wine应用程序时可能会出现声音问题。确保在winecfg中只选择一个声音设备。<br />
<br />
为你要使用的音频驱动器安装正确的软件包:<br />
<br />
* 对于 [[ALSA]] 安装 {{Pkg|lib32-alsa-lib}} 和 {{Pkg|lib32-alsa-plugins}}<br />
* 对于 [[PulseAudio]] 安装 {{Pkg|lib32-libpulse}} <br />
* 对于 [[PipeWire]] 同时安装 {{Pkg|pipewire-pulse}}和 {{Pkg|lib32-libpulse}} 或者 {{Pkg|pipewire-alsa}} 和 {{Pkg|lib32-alsa-lib}} + {{Pkg|lib32-alsa-plugins}}<br />
* 对于 [[OSS]] 安装 {{Pkg|lib32-alsa-oss}}<br />
<br />
额外的软件包:<br />
<br />
使用高级声音系统的游戏(例如TESV: Skyrim)可能还需要安装{{Pkg|lib32-openal}}。<br />
如果winecfg仍然无法检测到音频驱动(Selected driver: (none)),请通过注册表对其进行配置。例如,在64位的wine-1.9.7系统上,麦克风无法在32位的Windows应用程序中工作,这就提供了对声音硬件(声音播放和麦克风)的完全访问:打开regedit,寻找路径HKEY_CURRENT_USER → Software → Wine → Drivers,添加一个名为Audio的字符串,给它一个值alsa。另外,重新创建前缀可能有帮助。<br />
<br />
==== MIDI支持 ====<br />
<br />
在90年代,[[MIDI]]是相当流行的游戏音乐系统。尝试游玩老游戏时,音乐可能无法直接播放。<br />
Wine对MIDI有良好的支持,但首先需要让它在系统上工作,如[[MIDI]]中所解释的。最后,需要确保Wine使用了正确的MIDI输出。<br />
<br />
=== 其它依赖 ===<br />
<br />
对于以下情况,部分应用软件可能需要额外的软件包:<br />
<br />
* 播放音乐: {{Pkg|lib32-mpg123}}<br />
* 原生图像处理库: {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}<br />
* 加密服务: {{Pkg|lib32-gnutls}}<br />
* 32位视频编解码器: {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}<br />
* NTLM身份验证: {{Pkg|samba}}<br />
<br />
=== 字体 ===<br />
<br />
如果 Wine 应用程序没有显示易读的字体,则可能没有安装任何字体。轻松链接所有的系统字体,使其可以从Wine:<br />
<br />
$ cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; done<br />
<br />
Wine 使用 FreeType 渲染字体,而 FreeType 的默认设置在几个版本之前已经改变了。尝试在Wine项目中使用这种环境设置:<br />
<br />
FREETYPE_PROPERTIES="truetype:interpreter-version=35"<br />
<br />
另一种可能性是在Wine前缀中安装微软的 TrueType 字体。 See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
运行此类程序后,关闭所有 Wine 服务并运行{{ic| winecfg }}。字体现在应该是可读的。<br />
<br />
如果字体看起来模糊不清,导入以下文本文件到 Wine 注册表[https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
Windows Registry Editor Version 5.00<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
对于高分辨率显示,可以在 winecfg 中调整 dpi 值。<br />
<br />
另见[[Font configuration#Applications without fontconfig support]]。<br />
<br />
==== 启用平滑字体 ====<br />
<br />
提高Wine渲染效果的一个好方法是使用cleartype平滑字体。<br />
若要启用“次像素平滑(ClearType) RGB”:<br />
<br />
{{bc|<nowiki><br />
$ cat << EOF > /tmp/fontsmoothing<br />
REGEDIT4<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingOrientation"=dword:00000001<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
EOF<br />
<br />
$ WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null<br />
</nowiki>}}<br />
<br />
详见[https://askubuntu.com/a/219795]。<br />
<br />
=== 桌面启动器 ===<br />
<br />
当使用 Windows 应用安装程序创建一个快捷方式时,Wine 会创建 [[.desktop]] 文件。Arch Linux 中这些文件的默认位置是:<br />
<br />
* 桌面快捷方式位于 {{ic|~/Desktop}} 下。<br />
* 开始菜单图标位于 {{ic|~/.local/share/applications/wine/Programs/}} 下。<br />
<br />
{{Note|1=Wine 不支持为所有用户安装 Winidows 应用程序,所以 Wine 不会把 ''.desktop'' 文件放到 {{ic|/usr/share/applications}} 下。详见 WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}<br />
<br />
{{Tip|如果安装软件时桌面启动器并没有创建或已经丢失,{{ic|wine winemenubuilder}} 也许能帮得上忙。}}<br />
<br />
==== 为Wine utilities创建菜单项 ====<br />
<br />
默认情况下,Wine 的安装不会为 Wine 附带的软件创建桌面菜单/图标(例如“ winecfg”、“ winebroserer”等)。这可以通过安装 {{AUR|wine-installer}}或 {{AUR|wine-installer-git}} meta-package (后者没有附加依赖项)来实现,否则这些说明将为这些应用程序添加条目。<br />
<br />
首先,使用 Wine 安装一个 Windows 程序来创建基本菜单。创建基本菜单后,可以在 {{ic|~/.local/share/applications/wine/}}:<br />
<br />
{{hc|wine-browsedrive.desktop|2=<br />
[Desktop Entry]<br />
Name=Browse C: Drive<br />
Comment=Browse your virtual C: drive<br />
Exec=wine winebrowser c:<br />
Terminal=false<br />
Type=Application<br />
Icon=folder-wine<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-uninstaller.desktop|2=<br />
[Desktop Entry]<br />
Name=Uninstall Wine Software<br />
Comment=Uninstall Windows applications for Wine<br />
Exec=wine uninstaller<br />
Terminal=false<br />
Type=Application<br />
Icon=wine-uninstaller<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-winecfg.desktop|2=<br />
[Desktop Entry]<br />
Name=Configure Wine<br />
Comment=Change application-specific and general Wine options<br />
Exec=winecfg<br />
Terminal=false<br />
Icon=wine-winecfg<br />
Type=Application<br />
Categories=Wine;<br />
}}<br />
<br />
并在{{ic|~/.config/menus/applications-merged/}}目录下创建如下文件:<br />
<br />
{{hc|wine.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Category>Wine</Category><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
<br />
如果这些设置产生了一个难看的/不存在的图标,这意味着在您所启用的图标集中没有这些启动程序的图标。您应该将图标设置替换为所需图标的位置。单击启动器属性菜单中的图标将会产生同样的效果。一个支持这些快捷方式的图标集是[https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors]。<br />
<br />
==== Removing menu entries ====<br />
<br />
由 Wine 创建的菜单条目位于 {{ic|~/.local/share/applications/wine/Programs/}}.<br />
除了通过 Wine 删除不需要的扩展绑定,还可以执行以下命令(摘自 Wine 官网) :<br />
<br />
$ rm ~/.local/share/mime/packages/x-wine*<br />
$ rm ~/.local/share/applications/wine-extension*<br />
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
$ rm ~/.local/share/mime/application/x-wine-extension*<br />
<br />
Sometimes you should also remove {{ic|wine-*.menu}} files from {{ic|/.config/menus/}} to completely remove items from wine submenu in kde.<br />
<br />
=== 主题 ===<br />
<br />
类似于 xp 外观的主题可以在这里 [https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 下载]. To install it, see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files this upstream wiki article]. Lastly, use ''winecfg'' to select it.<br />
<br />
{{Note|上面链接的主题只能安装在32位前缀上,前缀版本为 windowsxp。要将其安装在64位前缀上,可能需要创建一个临时的32位前缀,install the theme and copy the {{ic|Zune}} folder and {{ic|Zune.theme}} files from {{ic|drive_c/Windows/Resources/Themes}} in that prefix to the same location in your usual prefix.}}<br />
<br />
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.<br />
<br />
=== 打印 ===<br />
<br />
为了在Wine程式中使用已安装的打印机(包括本地与网路的)在''win32 前缀''(如微软Word),安装{{Pkg|lib32-libcups}}包,使用(''wineboot'')重启wine,然后重新启动你的wine程式。<br />
<br />
=== 网络 ===<br />
<br />
安装过后,{{pkg|lib32-gnutls}}包也许需要为一些程式[[安装]]来创建TLS或HTTPS连接。<br />
<br />
对于ICMP(ping),Wine也许需要如上所述的网络访问,见[https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
<br />
如果在这之后出事(例如未处理的异常或特权指令),删除它通过:<br />
<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== 使用 ==<br />
<br />
{{警告|不要以 root 身份运行或安装 Wine 应用程序!详见 [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ]。}}<br />
<br />
见[https://wiki.winehq.org/Wine_User%27s_Guide#Using_Wine Wine用户手册]以获得Wine使用中的通用讯息。<br />
<br />
见[https://appdb.winehq.org/ Wine程式数据库(AppDB)]以获得Wine中特殊Windows程式的附加讯息。<br />
<br />
=== Wayland ===<br />
<br />
Wine 当前并不直接支持 Wayland,但你可以使用 [[Wayland#XWayland|XWayland]]。<br />
<br />
这有一些支援Wayland的努力:<br />
<br />
*Wine的实验性的Wayland驱动,可支援OpenGL与Windows GDI程式。见[https://www.winehq.org/pipermail/wine-devel/2020-December/178575.html 这个]和[https://www.winehq.org/pipermail/wine-devel/2021-February/181325.html 这个]wine开发邮箱列表条目。<br />
<br />
* [https://github.com/varmd/wine-wayland wine-wayland]:一个Wine的定制版本,可支持Wayland通过Vulkan(所以它只支持Direct9、10和11通过[[#SXVK]]和Vulkan完全支援的程式)。<br />
<br />
== 提示与技巧 ==<br />
<br />
=== Wineconsole ===<br />
<br />
通常情况下,你可能需要运行.exe来修补游戏文件,例如一个老游戏的宽屏mod,通过Wine正常运行.exe可能不会产生任何效果。在这种情况下,你可以打开一个终端,运行以下命令。<br />
<br />
$ wineconsole cmd<br />
<br />
然后转到该目录,从那里运行''.exe''文件。<br />
<br />
=== Winetricks ===<br />
<br />
[https://wiki.winehq.org/Winetricks Winetricks]是一个允许人安装支持Windows程式的基础依赖的脚本。可安装的组件包括Direct9 、MSXML(由微软Office 2007和Internet Explorer)、Visual运行时库和很多其它的。<br />
<br />
[[安装]]{{pkg|winetricks}}包(或{{AUR|winetriecks-git}}。然后用此运行:<br />
<br />
$ winetricks<br />
<br />
要用GUI,需要[[安装]]{{pkg|zenity}}。<br />
<br />
=== 性能 ===<br />
<br />
==== CSMT ====<br />
<br />
CSMT是Wine使用的一项技术,它为OpenGL调用使用了一个单独的线程,以显著提高性能。从Wine 3.2开始,CSMT被默认启用。然而,对于低于3.2的Wine版本,需要手动启用CSMT支持。对于vanilla Wine,运行wine regedit并将HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt的DWORD值设置为0x01(启用)。对于wine-staging,运行winecfg并在staging标签中启用它。<br />
<br />
注意,CSMT实际上可能会损害某些应用程序的性能--如果是这种情况,通过创建/设置注册表值为0x00(禁用)来禁用它。<br />
<br />
更多:<br />
*[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion]<br />
<br />
==== 强制使用OpenGL模式运行游戏 ====<br />
<br />
有些游戏可能有OpenGL模式,其性能可能比其默认的DirectX模式更好。虽然启用OpenGL渲染的是 "特定应用",但许多游戏可以使用{{Ic|-opengl}}参数。<br />
<br />
$ wine ''/path/to/3d_game.exe'' -opengl<br />
<br />
你应该参考你的应用程序文档和Wine的官网[https://appdb.winehq.org AppDB]来了解这些应用程序的具体信息。<br />
<br />
==== DXVK ====<br />
<br />
[https://github.com/doitsujin/dxvk DXVK] 是在Vulkan上对DirectX 9、10和11的一个可能的新实现。这应该有更好的性能,在某些情况下,甚至更好的兼容性。例如,《战地1》在DXVK下运行。另一方面,DXVK并不支持所有的Wine游戏(目前)。<br />
<br />
安装{{aur|dxvk-bin}}以使用它. 然后运行以下命令,在wineprefix中激活它(默认为 {{ic|~/.wine}}):<br />
<br />
$ WINEPREFIX=''your-prefix'' setup_dxvk install<br />
<br />
{{Warning|DXVK覆盖了DirectX 10和11的许多dll,这可能被认为是在线多人游戏中的作弊行为,并可能使你的账户被封。使用时风险自负!}}<br />
<br />
==== Gallium Nine ====<br />
<br />
With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.<br />
<br />
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any Wine version. Use {{ic|wine ninewinecfg}} to check if it is enabled.<br />
<br />
For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. [[Export]] the following environment variable before running Wine: <br />
<br />
MESA_LOADER_DRIVER_OVERRIDE=crocus<br />
<br />
=== Unregister existing Wine file associations ===<br />
<br />
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.<br />
<br />
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
$ update-mime-database ~/.local/share/mime/<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Prevent Wine from creating filetype associations ===<br />
<br />
{{Note|This has to be done for each WINEPREFIX which should not update file associations unless you opt to change {{ic|/usr/share/wine/wine.inf}} .}}<br />
This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).<br />
<br />
If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See [https://wiki.winehq.org/FAQ#How_can_I_prevent_Wine_from_changing_the_filetype_associations_on_my_system_or_adding_unwanted_menu_entries.2Fdesktop_links.3F Wine FAQ]<br />
<br />
To make the same change via registry add the string {{ic|Enable}} with value {{ic|N}} under:<br />
<br />
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations<br />
<br />
''You might have to create the key {{ic|FileOpenAssociations}} first!''<br />
<br />
To make this change via the command-line, run the following command:<br />
<br />
$ wine reg add "HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations" /v Enable /d N<br />
<br />
If you want to apply this by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}} and add this line for example under the {{ic|[Services]}} section:<br />
HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"<br />
<br />
To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:<br />
<br />
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=<br />
<br />
[Trigger]<br />
Operation = Install<br />
Operation = Upgrade<br />
Type = Path<br />
Target = usr/share/wine/wine.inf<br />
<br />
[Action]<br />
Description = Stopping Wine from hijacking file associations...<br />
When = PostTransaction<br />
<nowiki>Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'</nowiki><br />
}}<br />
<br />
See [[Pacman#Hooks]]<br />
<br />
=== 自动使用 Wine 执行 Windows 程序 ===<br />
<br />
{{pkg|wine}} 软件包会安装一个 ''binfmt'' 文件,这可使你能够直接运行 Windows 程序,例如,{{ic|''./myprogram.exe''}} 将与 {{ic|wine ''./myprogram.exe''}} 效果相同。服务默认在开机时启动,如果在安装 Wine 之后还没有重启过,[[启动]] {{ic|systemd-binfmt.service}} 即可。<br />
<br />
{{注意|确保 Windows 程序[[executable|可执行]],否则程序将不会运行。}}<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). [[CDemu]] will handle it correctly.<br />
<br />
=== 游戏内显示帧数 ===<br />
<br />
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.<br />
<br />
=== 在单独的用户帐户下运行 Wine ===<br />
<br />
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.<br />
<br />
First, create a [[user account]] for Wine:<br />
<br />
# useradd -m -s /bin/bash wineuser<br />
<br />
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...<br />
<br />
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information on how to execute the {{ic|xhost}} command under your main user.}}<br />
<br />
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:<br />
<br />
$ xhost +SI:localuser:wineuser<br />
<br />
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:<br />
<br />
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''<br />
<br />
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:<br />
{{hc|1=/usr/local/bin/runaswine|2=<br />
#!/bin/bash<br />
xhost +SI:localuser:wineuser<br />
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}<br />
<br />
Wine applications can then be launched via:<br />
<br />
$ runaswine ''"C:\path\to\application.exe"''<br />
<br />
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.<br />
<br />
It is recommended to run {{ic|winecfg}} as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.<br />
<br />
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to share a PulseAudio daemon]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.<br />
<br />
=== Temp directory on tmpfs ===<br />
<br />
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:<br />
<br />
$ rm -r ~/.wine/drive_c/users/$USER/Temp ~/.wine/drive_c/windows/temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/windows/temp<br />
<br />
=== Prevent installing Mono/Gecko ===<br />
<br />
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.<br />
<br />
=== Vulkan ===<br />
<br />
The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].<br />
<br />
=== Remove Wine file bindings ===<br />
<br />
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).<br />
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}<br />
<br />
NoExtract = usr/lib/binfmt.d/wine.conf<br />
NoExtract = usr/share/applications/wine.desktop<br />
<br />
=== WineASIO ===<br />
<br />
If you need professional audio support under wine you can use {{Aur|wineasio}} which provides an ASIO interface for wine that you can then use with [[JACK]].<br />
<br />
In order to use wineasio you must add yourself to the {{ic|realtime}} [[user group]].<br />
<br />
Next you need to register wineasio in your desired wine prefix. Register the 32-bit and/or 64-bit version as needed:<br />
$ regsvr32 /usr/lib32/wine/i386-windows/wineasio.dll<br />
$ wine64 regsvr32 /usr/lib/wine/x86_64-windows/wineasio.dll<br />
<br />
== 疑难解答 ==<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Troubleshooting_.2F_Reporting_bugs Wine User's Guide] and [https://wiki.winehq.org/FAQ Wine FAQ] (especially its [https://wiki.winehq.org/FAQ#Troubleshooting Troubleshooting] section) for general tips.<br />
<br />
Also refer to the [https://appdb.winehq.org/ Wine AppDB] for an advice on specific applications.<br />
<br />
=== XWayland问题 ===<br />
<br />
If you use Wine under [[Wayland#XWayland|XWayland]], you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:<br />
<br />
* flickering;<br />
* wrong window location;<br />
* wrong mouse cursor location and clicks;<br />
* keyboard detection.<br />
<br />
=== 键盘输入不工作 ===<br />
<br />
This could be caused by the window manager not switching focus. In the ''Graphics'' tab of ''winecfg'', disable the 'Allow the window manager...' options, or set windowed mode with 'Emulate a virtual desktop'.<br />
*Some suggest to toggle all the ''Window settings'', click ''Apply'', then change them back. If that does not work, try the above.<br />
<br />
If the keyboard does not work after unfocusing the application, try editing the registry:<br />
*Under ''HKEY_CURRENT_USER\Software\Wine\X11 Driver'', add a string value ''UseTakeFocus'' and set it to ''N''.<br />
*Alternatively, you can use winetricks to set the value.<br />
winetricks usetakefocus=n<br />
<br />
== 参见 ==<br />
<br />
* [https://www.winehq.org/ Wine Homepage]<br />
* [https://wiki.winehq.org/ Wine Wiki]<br />
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
* [[Gentoo:Wine]]<br />
* [https://www.darlinghq.org/ Darling] - a similar project for MacOS software<br />
* [https://github.com/wineasio/wineasio WineASIO] - GitHub page of the WineASIO project with further information</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=738983Wine (简体中文)2022-07-25T08:32:02Z<p>InsaneGuo: /* DXVK */ 翻译</p>
<hr />
<div>[[Category:Emulation (简体中文)]]<br />
[[Category:Gaming (简体中文)]]<br />
[[de:Wine]]<br />
[[en:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
{{Related articles start}}<br />
{{Related|CrossOver}}<br />
{{Related|Deepin-wine}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
{{translateme (简体中文)|进度:35%}}<br />
{{TranslationStatus (简体中文)|Wine|2022-04-19|724914}}<br />
<br />
[[Wikipedia:Wine (software)|Wine]] 是一款可以在类 Unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而没有模拟器的性能/内存损失。<br />
<br />
{{警告|<br />
* Wine 并非与你的系统隔离。<br />
* 如果你可以使用你的用户帐户访问某个文件或资源,那么在 Wine 中运行的程序也可以。参见[[#在单独的用户帐户下运行 Wine]]和[[安全#沙盒程序]]了解可能的预防措施。<br />
* Wine 也可以运行恶意软件(参见 [https://wiki.winehq.org/FAQ#Is_Wine_malware-compatible.3F Wine 关于恶意软件兼容性的 FAQ])}}<br />
<br />
== 安装 ==<br />
<br />
首先启用[[multilib]]仓库,然后[[install|安装]] {{Pkg|wine}}(开发版),{{AUR|wine-stable}}(稳定版)或 {{Pkg|wine-staging}}(测试版本)。[https://wine-staging.com/ Wine Staging] 是 [https://www.winehq.org/ Wine] 的修补版本, 其中包含了漏洞修复和尚未集成到稳定或开发分支中的特性。<br />
<br />
其它需求见[[#图形驱动程序]]和[[#声音]]。<br />
<br />
可以考虑为依赖于 Internet Explorer 和 .NET 的应用程序分别安装 {{pkg|wine-gecko}} 和 {{pkg|wine-mono}}。这两个软件包不是一定要安装的,因为 Wine 会根据需要自行下载相关文件。反过来说,如果提前安装了软件包,Wine 就不需要再下载这些文件了。<br />
<br />
== 配置 ==<br />
<br />
配置 Wine 通常使用以下方法:<br />
<br />
* [https://wiki.winehq.org/Winecfg winecfg] 是 Wine 的 GUI 配置工具,可以通过运行 {{ic|winecfg}} 来启动。<br />
* [https://wiki.winehq.org/Regedit regedit] 是 Wine 的注册表编辑工具,可以通过运行{{ic|regedit}} 来启动。另见 WineHQ 关于 [https://wiki.winehq.org/Useful_Registry_Keys 有用的注册表键]的文档。<br />
* [https://wiki.winehq.org/Control control] 是 Wine 的 Windows 控制面板的实现,可以通过运行 {{ic|wine control}} 来启动。<br />
* 完整列表见 WineHQ 的[https://wiki.winehq.org/List_of_Commands 命令列表]。<br />
<br />
=== WINEPREFIX ===<br />
<br />
默认情况下,Wine 将其配置文件和安装的 Windows 程序存储在 {{ic|~/.wine}} ,通常会把此目录叫作“Wine prefix”或“Wine bottle”。当您运行 Windows 程序或 Wine 的捆绑程序(如 winecfg)时,它会自动创建/更新。前缀目录还包含一个目录,您的 Windows 程序将其视为 {{ic|c:}} (C盘)。<br />
<br />
您可以使用 {{ic|WINEPREFIX}}环境变量覆盖 Wine 使用的前缀位置。如果您希望为不同的 Windows 程序使用单独的配置,这将非常有用。第一次运行带有新 Wine 前缀的程序时,Wine 将自动创建一个带有 c 驱动器和注册表的目录。<br />
<br />
例如,如果您运行一个带有{{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}的程序,和另一个 {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}这两个程序将分别有一个单独的 c 驱动器和单独的注册。<br />
<br />
{{警告|Wine不是[[Wikipedia:Sandbox (computer security)|沙盒]]!在 Wine 下运行的程序仍然可以访问系统的其余部分!(例如, {{ic|Z:}} 映射到 {{ic|/}}, 与 Wine 前缀无关)}}<br />
<br />
若要在不运行 Windows 程序或其他 GUI 工具的情况下创建默认前缀,可以使用:<br />
<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
Wine将默认启动一个64位环境。你可以改变它使用{{ic|WINEARCH}}[[环境变量]]。改名你的{{ic|~/.wine}}目录并创建一个新的Wine环境通过使用{{ic|1=$WINEARCH=win32 winecfg}}。这将给你一个32位Wine环境。不舍指{{ic|WINEARCH}}将给你一个64位环境。<br />
<br />
你可以通过修改{{ic|WINEPREFIX}}来创建一个分开的{{ic|win32}}和{{ic|win64}}环境:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
你也可以使用{{ic|WINEARCH}}与其它Wine程式合并,例如''winetricks''(使用Steam作为例子)<br />
<br />
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
为了使用这个架构在一个存在的预设,你可以检查他的注册表文件。如下的命令读了{{ic|~/.wine}}的预设系统注册表并返回{{ic|1=#arch-win32}}或{{ic|1=#arch=win64}}依赖于架构类型。<br />
<br />
$ grep '#arch' ~/.wine/system.reg<br />
<br />
=== 图形驱动程序 ===<br />
<br />
你需要安装 32 位版本的图形驱动程序。请安装[[Xorg (简体中文)#驱动安装]]中 ''OpenGL (multilib)'' 一栏列出的软件包。<br />
<br />
当 Wine 在你的终端窗口中报告以下内容时,很可能你的驱动程序不合适或没有正确配置:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{注意|安装正确的库之后你可能需要重新启动 X。}}<br />
<br />
=== 声音 ===<br />
<br />
默认情况下,运行Wine应用程序时可能会出现声音问题。确保在winecfg中只选择一个声音设备。<br />
<br />
为你要使用的音频驱动器安装正确的软件包:<br />
<br />
* 对于 [[ALSA]] 安装 {{Pkg|lib32-alsa-lib}} 和 {{Pkg|lib32-alsa-plugins}}<br />
* 对于 [[PulseAudio]] 安装 {{Pkg|lib32-libpulse}} <br />
* 对于 [[PipeWire]] 同时安装 {{Pkg|pipewire-pulse}}和 {{Pkg|lib32-libpulse}} 或者 {{Pkg|pipewire-alsa}} 和 {{Pkg|lib32-alsa-lib}} + {{Pkg|lib32-alsa-plugins}}<br />
* 对于 [[OSS]] 安装 {{Pkg|lib32-alsa-oss}}<br />
<br />
额外的软件包:<br />
<br />
使用高级声音系统的游戏(例如TESV: Skyrim)可能还需要安装{{Pkg|lib32-openal}}。<br />
如果winecfg仍然无法检测到音频驱动(Selected driver: (none)),请通过注册表对其进行配置。例如,在64位的wine-1.9.7系统上,麦克风无法在32位的Windows应用程序中工作,这就提供了对声音硬件(声音播放和麦克风)的完全访问:打开regedit,寻找路径HKEY_CURRENT_USER → Software → Wine → Drivers,添加一个名为Audio的字符串,给它一个值alsa。另外,重新创建前缀可能有帮助。<br />
<br />
==== MIDI支持 ====<br />
<br />
在90年代,[[MIDI]]是相当流行的游戏音乐系统。尝试游玩老游戏时,音乐可能无法直接播放。<br />
Wine对MIDI有良好的支持,但首先需要让它在系统上工作,如[[MIDI]]中所解释的。最后,需要确保Wine使用了正确的MIDI输出。<br />
<br />
=== 其它依赖 ===<br />
<br />
对于以下情况,部分应用软件可能需要额外的软件包:<br />
<br />
* 播放音乐: {{Pkg|lib32-mpg123}}<br />
* 原生图像处理库: {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}<br />
* 加密服务: {{Pkg|lib32-gnutls}}<br />
* 32位视频编解码器: {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}<br />
* NTLM身份验证: {{Pkg|samba}}<br />
<br />
=== 字体 ===<br />
<br />
如果 Wine 应用程序没有显示易读的字体,则可能没有安装任何字体。轻松链接所有的系统字体,使其可以从Wine:<br />
<br />
$ cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; done<br />
<br />
Wine 使用 FreeType 渲染字体,而 FreeType 的默认设置在几个版本之前已经改变了。尝试在Wine项目中使用这种环境设置:<br />
<br />
FREETYPE_PROPERTIES="truetype:interpreter-version=35"<br />
<br />
另一种可能性是在Wine前缀中安装微软的 TrueType 字体。 See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
运行此类程序后,关闭所有 Wine 服务并运行{{ic| winecfg }}。字体现在应该是可读的。<br />
<br />
如果字体看起来模糊不清,导入以下文本文件到 Wine 注册表[https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
Windows Registry Editor Version 5.00<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
对于高分辨率显示,可以在 winecfg 中调整 dpi 值。<br />
<br />
另见[[Font configuration#Applications without fontconfig support]]。<br />
<br />
==== 启用平滑字体 ====<br />
<br />
提高Wine渲染效果的一个好方法是使用cleartype平滑字体。<br />
若要启用“次像素平滑(ClearType) RGB”:<br />
<br />
{{bc|<nowiki><br />
$ cat << EOF > /tmp/fontsmoothing<br />
REGEDIT4<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingOrientation"=dword:00000001<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
EOF<br />
<br />
$ WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null<br />
</nowiki>}}<br />
<br />
详见[https://askubuntu.com/a/219795]。<br />
<br />
=== 桌面启动器 ===<br />
<br />
当使用 Windows 应用安装程序创建一个快捷方式时,Wine 会创建 [[.desktop]] 文件。Arch Linux 中这些文件的默认位置是:<br />
<br />
* 桌面快捷方式位于 {{ic|~/Desktop}} 下。<br />
* 开始菜单图标位于 {{ic|~/.local/share/applications/wine/Programs/}} 下。<br />
<br />
{{Note|1=Wine 不支持为所有用户安装 Winidows 应用程序,所以 Wine 不会把 ''.desktop'' 文件放到 {{ic|/usr/share/applications}} 下。详见 WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}<br />
<br />
{{Tip|如果安装软件时桌面启动器并没有创建或已经丢失,{{ic|wine winemenubuilder}} 也许能帮得上忙。}}<br />
<br />
==== 为Wine utilities创建菜单项 ====<br />
<br />
默认情况下,Wine 的安装不会为 Wine 附带的软件创建桌面菜单/图标(例如“ winecfg”、“ winebroserer”等)。这可以通过安装 {{AUR|wine-installer}}或 {{AUR|wine-installer-git}} meta-package (后者没有附加依赖项)来实现,否则这些说明将为这些应用程序添加条目。<br />
<br />
首先,使用 Wine 安装一个 Windows 程序来创建基本菜单。创建基本菜单后,可以在 {{ic|~/.local/share/applications/wine/}}:<br />
<br />
{{hc|wine-browsedrive.desktop|2=<br />
[Desktop Entry]<br />
Name=Browse C: Drive<br />
Comment=Browse your virtual C: drive<br />
Exec=wine winebrowser c:<br />
Terminal=false<br />
Type=Application<br />
Icon=folder-wine<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-uninstaller.desktop|2=<br />
[Desktop Entry]<br />
Name=Uninstall Wine Software<br />
Comment=Uninstall Windows applications for Wine<br />
Exec=wine uninstaller<br />
Terminal=false<br />
Type=Application<br />
Icon=wine-uninstaller<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-winecfg.desktop|2=<br />
[Desktop Entry]<br />
Name=Configure Wine<br />
Comment=Change application-specific and general Wine options<br />
Exec=winecfg<br />
Terminal=false<br />
Icon=wine-winecfg<br />
Type=Application<br />
Categories=Wine;<br />
}}<br />
<br />
并在{{ic|~/.config/menus/applications-merged/}}目录下创建如下文件:<br />
<br />
{{hc|wine.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Category>Wine</Category><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
<br />
如果这些设置产生了一个难看的/不存在的图标,这意味着在您所启用的图标集中没有这些启动程序的图标。您应该将图标设置替换为所需图标的位置。单击启动器属性菜单中的图标将会产生同样的效果。一个支持这些快捷方式的图标集是[https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors]。<br />
<br />
==== Removing menu entries ====<br />
<br />
由 Wine 创建的菜单条目位于 {{ic|~/.local/share/applications/wine/Programs/}}.<br />
除了通过 Wine 删除不需要的扩展绑定,还可以执行以下命令(摘自 Wine 官网) :<br />
<br />
$ rm ~/.local/share/mime/packages/x-wine*<br />
$ rm ~/.local/share/applications/wine-extension*<br />
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
$ rm ~/.local/share/mime/application/x-wine-extension*<br />
<br />
Sometimes you should also remove {{ic|wine-*.menu}} files from {{ic|/.config/menus/}} to completely remove items from wine submenu in kde.<br />
<br />
=== 主题 ===<br />
<br />
类似于 xp 外观的主题可以在这里 [https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 下载]. To install it, see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files this upstream wiki article]. Lastly, use ''winecfg'' to select it.<br />
<br />
{{Note|上面链接的主题只能安装在32位前缀上,前缀版本为 windowsxp。要将其安装在64位前缀上,可能需要创建一个临时的32位前缀,install the theme and copy the {{ic|Zune}} folder and {{ic|Zune.theme}} files from {{ic|drive_c/Windows/Resources/Themes}} in that prefix to the same location in your usual prefix.}}<br />
<br />
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.<br />
<br />
=== 打印 ===<br />
<br />
为了在Wine程式中使用已安装的打印机(包括本地与网路的)在''win32 前缀''(如微软Word),安装{{Pkg|lib32-libcups}}包,使用(''wineboot'')重启wine,然后重新启动你的wine程式。<br />
<br />
=== 网络 ===<br />
<br />
安装过后,{{pkg|lib32-gnutls}}包也许需要为一些程式[[安装]]来创建TLS或HTTPS连接。<br />
<br />
对于ICMP(ping),Wine也许需要如上所述的网络访问,见[https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
<br />
如果在这之后出事(例如未处理的异常或特权指令),删除它通过:<br />
<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== 使用 ==<br />
<br />
{{警告|不要以 root 身份运行或安装 Wine 应用程序!详见 [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ]。}}<br />
<br />
见[https://wiki.winehq.org/Wine_User%27s_Guide#Using_Wine Wine用户手册]以获得Wine使用中的通用讯息。<br />
<br />
见[https://appdb.winehq.org/ Wine程式数据库(AppDB)]以获得Wine中特殊Windows程式的附加讯息。<br />
<br />
=== Wayland ===<br />
<br />
Wine 当前并不直接支持 Wayland,但你可以使用 [[Wayland#XWayland|XWayland]]。<br />
<br />
这有一些支援Wayland的努力:<br />
<br />
*Wine的实验性的Wayland驱动,可支援OpenGL与Windows GDI程式。见[https://www.winehq.org/pipermail/wine-devel/2020-December/178575.html 这个]和[https://www.winehq.org/pipermail/wine-devel/2021-February/181325.html 这个]wine开发邮箱列表条目。<br />
<br />
* [https://github.com/varmd/wine-wayland wine-wayland]:一个Wine的定制版本,可支持Wayland通过Vulkan(所以它只支持Direct9、10和11通过[[#SXVK]]和Vulkan完全支援的程式)。<br />
<br />
== 提示与技巧 ==<br />
<br />
=== Wineconsole ===<br />
<br />
通常情况下,你可能需要运行.exe来修补游戏文件,例如一个老游戏的宽屏mod,通过Wine正常运行.exe可能不会产生任何效果。在这种情况下,你可以打开一个终端,运行以下命令。<br />
<br />
$ wineconsole cmd<br />
<br />
然后转到该目录,从那里运行''.exe''文件。<br />
<br />
=== Winetricks ===<br />
<br />
[https://wiki.winehq.org/Winetricks Winetricks]是一个允许人安装支持Windows程式的基础依赖的脚本。可安装的组件包括Direct9 、MSXML(由微软Office 2007和Internet Explorer)、Visual运行时库和很多其它的。<br />
<br />
[[安装]]{{pkg|winetricks}}包(或{{AUR|winetriecks-git}}。然后用此运行:<br />
<br />
$ winetricks<br />
<br />
要用GUI,需要[[安装]]{{pkg|zenity}}。<br />
<br />
=== 性能 ===<br />
<br />
==== CSMT ====<br />
<br />
CSMT是Wine使用的一项技术,它为OpenGL调用使用了一个单独的线程,以显著提高性能。从Wine 3.2开始,CSMT被默认启用。然而,对于低于3.2的Wine版本,需要手动启用CSMT支持。对于vanilla Wine,运行wine regedit并将HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt的DWORD值设置为0x01(启用)。对于wine-staging,运行winecfg并在staging标签中启用它。<br />
<br />
注意,CSMT实际上可能会损害某些应用程序的性能--如果是这种情况,通过创建/设置注册表值为0x00(禁用)来禁用它。<br />
<br />
更多:<br />
*[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion]<br />
<br />
==== 强制使用OpenGL模式运行游戏 ====<br />
<br />
有些游戏可能有OpenGL模式,其性能可能比其默认的DirectX模式更好。虽然启用OpenGL渲染的是 "特定应用",但许多游戏可以使用{{Ic|-opengl}}参数。<br />
<br />
$ wine ''/path/to/3d_game.exe'' -opengl<br />
<br />
你应该参考你的应用程序文档和Wine的官网[https://appdb.winehq.org AppDB]来了解这些应用程序的具体信息。<br />
<br />
==== DXVK ====<br />
<br />
[https://github.com/doitsujin/dxvk DXVK] 是在Vulkan上对DirectX 9、10和11的一个可能的新实现。这应该有更好的性能,在某些情况下,甚至更好的兼容性。例如,《战地1》在DXVK下运行。另一方面,DXVK并不支持所有的Wine游戏(目前)。<br />
<br />
安装{{aur|dxvk-bin}}以使用它. 然后运行以下命令,在wineprefix中激活它(默认为 {{ic|~/.wine}}):<br />
<br />
$ WINEPREFIX=''your-prefix'' setup_dxvk install<br />
<br />
{{Warning|DXVK覆盖了DirectX 10和11的许多dll,这可能被认为是在线多人游戏中的作弊行为,并可能使你的账户被封。使用时风险自负!}}<br />
<br />
==== Gallium Nine ====<br />
<br />
With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.<br />
<br />
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any Wine version. Use {{ic|wine ninewinecfg}} to check if it is enabled.<br />
<br />
For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. [[Export]] the following environment variable before running Wine: <br />
<br />
MESA_LOADER_DRIVER_OVERRIDE=crocus<br />
<br />
=== Unregister existing Wine file associations ===<br />
<br />
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.<br />
<br />
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
$ update-mime-database ~/.local/share/mime/<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Prevent Wine from creating filetype associations ===<br />
<br />
{{Note|This has to be done for each WINEPREFIX which should not update file associations unless you opt to change {{ic|/usr/share/wine/wine.inf}} .}}<br />
This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).<br />
<br />
If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See [https://wiki.winehq.org/FAQ#How_can_I_prevent_Wine_from_changing_the_filetype_associations_on_my_system_or_adding_unwanted_menu_entries.2Fdesktop_links.3F Wine FAQ]<br />
<br />
To make the same change via registry add the string {{ic|Enable}} with value {{ic|N}} under:<br />
<br />
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations<br />
<br />
''You might have to create the key {{ic|FileOpenAssociations}} first!''<br />
<br />
To make this change via the command-line, run the following command:<br />
<br />
$ wine reg add "HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations" /v Enable /d N<br />
<br />
If you want to apply this by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}} and add this line for example under the {{ic|[Services]}} section:<br />
HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"<br />
<br />
To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:<br />
<br />
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=<br />
<br />
[Trigger]<br />
Operation = Install<br />
Operation = Upgrade<br />
Type = Path<br />
Target = usr/share/wine/wine.inf<br />
<br />
[Action]<br />
Description = Stopping Wine from hijacking file associations...<br />
When = PostTransaction<br />
<nowiki>Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'</nowiki><br />
}}<br />
<br />
See [[Pacman#Hooks]]<br />
<br />
=== 自动使用 Wine 执行 Windows 程序 ===<br />
<br />
{{pkg|wine}} 软件包会安装一个 ''binfmt'' 文件,这可使你能够直接运行 Windows 程序,例如,{{ic|''./myprogram.exe''}} 将与 {{ic|wine ''./myprogram.exe''}} 效果相同。服务默认在开机时启动,如果在安装 Wine 之后还没有重启过,[[启动]] {{ic|systemd-binfmt.service}} 即可。<br />
<br />
{{注意|确保 Windows 程序[[executable|可执行]],否则程序将不会运行。}}<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). [[CDemu]] will handle it correctly.<br />
<br />
=== 游戏内显示帧数 ===<br />
<br />
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.<br />
<br />
=== 在单独的用户帐户下运行 Wine ===<br />
<br />
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.<br />
<br />
First, create a [[user account]] for Wine:<br />
<br />
# useradd -m -s /bin/bash wineuser<br />
<br />
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...<br />
<br />
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information on how to execute the {{ic|xhost}} command under your main user.}}<br />
<br />
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:<br />
<br />
$ xhost +SI:localuser:wineuser<br />
<br />
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:<br />
<br />
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''<br />
<br />
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:<br />
{{hc|1=/usr/local/bin/runaswine|2=<br />
#!/bin/bash<br />
xhost +SI:localuser:wineuser<br />
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}<br />
<br />
Wine applications can then be launched via:<br />
<br />
$ runaswine ''"C:\path\to\application.exe"''<br />
<br />
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.<br />
<br />
It is recommended to run {{ic|winecfg}} as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.<br />
<br />
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to share a PulseAudio daemon]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.<br />
<br />
=== Temp directory on tmpfs ===<br />
<br />
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:<br />
<br />
$ rm -r ~/.wine/drive_c/users/$USER/Temp ~/.wine/drive_c/windows/temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/windows/temp<br />
<br />
=== Prevent installing Mono/Gecko ===<br />
<br />
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.<br />
<br />
=== Vulkan ===<br />
<br />
The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].<br />
<br />
=== Remove Wine file bindings ===<br />
<br />
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).<br />
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}<br />
<br />
NoExtract = usr/lib/binfmt.d/wine.conf<br />
NoExtract = usr/share/applications/wine.desktop<br />
<br />
=== WineASIO ===<br />
<br />
If you need professional audio support under wine you can use {{Aur|wineasio}} which provides an ASIO interface for wine that you can then use with [[JACK]].<br />
<br />
In order to use wineasio you must add yourself to the {{ic|realtime}} [[user group]].<br />
<br />
Next you need to register wineasio in your desired wine prefix. Register the 32-bit and/or 64-bit version as needed:<br />
$ regsvr32 /usr/lib32/wine/i386-windows/wineasio.dll<br />
$ wine64 regsvr32 /usr/lib/wine/x86_64-windows/wineasio.dll<br />
<br />
== 疑难解答 ==<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Troubleshooting_.2F_Reporting_bugs Wine User's Guide] and [https://wiki.winehq.org/FAQ Wine FAQ] (especially its [https://wiki.winehq.org/FAQ#Troubleshooting Troubleshooting] section) for general tips.<br />
<br />
Also refer to the [https://appdb.winehq.org/ Wine AppDB] for an advice on specific applications.<br />
<br />
=== XWayland问题 ===<br />
<br />
If you use Wine under [[Wayland#XWayland|XWayland]], you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:<br />
<br />
* flickering;<br />
* wrong window location;<br />
* wrong mouse cursor location and clicks;<br />
* keyboard detection.<br />
<br />
=== 键盘输入不工作 ===<br />
<br />
This could be caused by the window manager not switching focus. In the ''Graphics'' tab of ''winecfg'', disable the 'Allow the window manager...' options, or set windowed mode with 'Emulate a virtual desktop'.<br />
*Some suggest to toggle all the ''Window settings'', click ''Apply'', then change them back. If that does not work, try the above.<br />
<br />
If the keyboard does not work after unfocusing the application, try editing the registry:<br />
*Under ''HKEY_CURRENT_USER\Software\Wine\X11 Driver'', add a string value ''UseTakeFocus'' and set it to ''N''.<br />
*Alternatively, you can use winetricks to set the value.<br />
winetricks usetakefocus=n<br />
<br />
== 参见 ==<br />
<br />
* [https://www.winehq.org/ Wine Homepage]<br />
* [https://wiki.winehq.org/ Wine Wiki]<br />
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
* [[Gentoo:Wine]]<br />
* [https://www.darlinghq.org/ Darling] - a similar project for MacOS software<br />
* [https://github.com/wineasio/wineasio WineASIO] - GitHub page of the WineASIO project with further information</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=User_talk:KirisameMarisa&diff=738852User talk:KirisameMarisa2022-07-24T09:39:07Z<p>InsaneGuo: 捉</p>
<hr />
<div>==到此一游==<br />
[[User:InsaneGuo|InsaneGuo]] ([[User talk:InsaneGuo|talk]]) 09:38, 24 July 2022 (UTC)</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=738851Wine (简体中文)2022-07-24T09:35:10Z<p>InsaneGuo: /* 强制使用OpenGL模式运行游戏 */ 翻译</p>
<hr />
<div>[[Category:Emulation (简体中文)]]<br />
[[Category:Gaming (简体中文)]]<br />
[[de:Wine]]<br />
[[en:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
{{Related articles start}}<br />
{{Related|CrossOver}}<br />
{{Related|Deepin-wine}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
{{translateme (简体中文)|进度:35%}}<br />
{{TranslationStatus (简体中文)|Wine|2022-04-19|724914}}<br />
<br />
[[Wikipedia:Wine (software)|Wine]] 是一款可以在类 Unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而没有模拟器的性能/内存损失。<br />
<br />
{{警告|<br />
* Wine 并非与你的系统隔离。<br />
* 如果你可以使用你的用户帐户访问某个文件或资源,那么在 Wine 中运行的程序也可以。参见[[#在单独的用户帐户下运行 Wine]]和[[安全#沙盒程序]]了解可能的预防措施。<br />
* Wine 也可以运行恶意软件(参见 [https://wiki.winehq.org/FAQ#Is_Wine_malware-compatible.3F Wine 关于恶意软件兼容性的 FAQ])}}<br />
<br />
== 安装 ==<br />
<br />
首先启用[[multilib]]仓库,然后[[install|安装]] {{Pkg|wine}}(开发版),{{AUR|wine-stable}}(稳定版)或 {{Pkg|wine-staging}}(测试版本)。[https://wine-staging.com/ Wine Staging] 是 [https://www.winehq.org/ Wine] 的修补版本, 其中包含了漏洞修复和尚未集成到稳定或开发分支中的特性。<br />
<br />
其它需求见[[#图形驱动程序]]和[[#声音]]。<br />
<br />
可以考虑为依赖于 Internet Explorer 和 .NET 的应用程序分别安装 {{pkg|wine-gecko}} 和 {{pkg|wine-mono}}。这两个软件包不是一定要安装的,因为 Wine 会根据需要自行下载相关文件。反过来说,如果提前安装了软件包,Wine 就不需要再下载这些文件了。<br />
<br />
== 配置 ==<br />
<br />
配置 Wine 通常使用以下方法:<br />
<br />
* [https://wiki.winehq.org/Winecfg winecfg] 是 Wine 的 GUI 配置工具,可以通过运行 {{ic|winecfg}} 来启动。<br />
* [https://wiki.winehq.org/Regedit regedit] 是 Wine 的注册表编辑工具,可以通过运行{{ic|regedit}} 来启动。另见 WineHQ 关于 [https://wiki.winehq.org/Useful_Registry_Keys 有用的注册表键]的文档。<br />
* [https://wiki.winehq.org/Control control] 是 Wine 的 Windows 控制面板的实现,可以通过运行 {{ic|wine control}} 来启动。<br />
* 完整列表见 WineHQ 的[https://wiki.winehq.org/List_of_Commands 命令列表]。<br />
<br />
=== WINEPREFIX ===<br />
<br />
默认情况下,Wine 将其配置文件和安装的 Windows 程序存储在 {{ic|~/.wine}} ,通常会把此目录叫作“Wine prefix”或“Wine bottle”。当您运行 Windows 程序或 Wine 的捆绑程序(如 winecfg)时,它会自动创建/更新。前缀目录还包含一个目录,您的 Windows 程序将其视为 {{ic|c:}} (C盘)。<br />
<br />
您可以使用 {{ic|WINEPREFIX}}环境变量覆盖 Wine 使用的前缀位置。如果您希望为不同的 Windows 程序使用单独的配置,这将非常有用。第一次运行带有新 Wine 前缀的程序时,Wine 将自动创建一个带有 c 驱动器和注册表的目录。<br />
<br />
例如,如果您运行一个带有{{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}的程序,和另一个 {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}这两个程序将分别有一个单独的 c 驱动器和单独的注册。<br />
<br />
{{警告|Wine不是[[Wikipedia:Sandbox (computer security)|沙盒]]!在 Wine 下运行的程序仍然可以访问系统的其余部分!(例如, {{ic|Z:}} 映射到 {{ic|/}}, 与 Wine 前缀无关)}}<br />
<br />
若要在不运行 Windows 程序或其他 GUI 工具的情况下创建默认前缀,可以使用:<br />
<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
Wine将默认启动一个64位环境。你可以改变它使用{{ic|WINEARCH}}[[环境变量]]。改名你的{{ic|~/.wine}}目录并创建一个新的Wine环境通过使用{{ic|1=$WINEARCH=win32 winecfg}}。这将给你一个32位Wine环境。不舍指{{ic|WINEARCH}}将给你一个64位环境。<br />
<br />
你可以通过修改{{ic|WINEPREFIX}}来创建一个分开的{{ic|win32}}和{{ic|win64}}环境:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
你也可以使用{{ic|WINEARCH}}与其它Wine程式合并,例如''winetricks''(使用Steam作为例子)<br />
<br />
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
为了使用这个架构在一个存在的预设,你可以检查他的注册表文件。如下的命令读了{{ic|~/.wine}}的预设系统注册表并返回{{ic|1=#arch-win32}}或{{ic|1=#arch=win64}}依赖于架构类型。<br />
<br />
$ grep '#arch' ~/.wine/system.reg<br />
<br />
=== 图形驱动程序 ===<br />
<br />
你需要安装 32 位版本的图形驱动程序。请安装[[Xorg (简体中文)#驱动安装]]中 ''OpenGL (multilib)'' 一栏列出的软件包。<br />
<br />
当 Wine 在你的终端窗口中报告以下内容时,很可能你的驱动程序不合适或没有正确配置:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{注意|安装正确的库之后你可能需要重新启动 X。}}<br />
<br />
=== 声音 ===<br />
<br />
默认情况下,运行Wine应用程序时可能会出现声音问题。确保在winecfg中只选择一个声音设备。<br />
<br />
为你要使用的音频驱动器安装正确的软件包:<br />
<br />
* 对于 [[ALSA]] 安装 {{Pkg|lib32-alsa-lib}} 和 {{Pkg|lib32-alsa-plugins}}<br />
* 对于 [[PulseAudio]] 安装 {{Pkg|lib32-libpulse}} <br />
* 对于 [[PipeWire]] 同时安装 {{Pkg|pipewire-pulse}}和 {{Pkg|lib32-libpulse}} 或者 {{Pkg|pipewire-alsa}} 和 {{Pkg|lib32-alsa-lib}} + {{Pkg|lib32-alsa-plugins}}<br />
* 对于 [[OSS]] 安装 {{Pkg|lib32-alsa-oss}}<br />
<br />
额外的软件包:<br />
<br />
使用高级声音系统的游戏(例如TESV: Skyrim)可能还需要安装{{Pkg|lib32-openal}}。<br />
如果winecfg仍然无法检测到音频驱动(Selected driver: (none)),请通过注册表对其进行配置。例如,在64位的wine-1.9.7系统上,麦克风无法在32位的Windows应用程序中工作,这就提供了对声音硬件(声音播放和麦克风)的完全访问:打开regedit,寻找路径HKEY_CURRENT_USER → Software → Wine → Drivers,添加一个名为Audio的字符串,给它一个值alsa。另外,重新创建前缀可能有帮助。<br />
<br />
==== MIDI支持 ====<br />
<br />
在90年代,[[MIDI]]是相当流行的游戏音乐系统。尝试游玩老游戏时,音乐可能无法直接播放。<br />
Wine对MIDI有良好的支持,但首先需要让它在系统上工作,如[[MIDI]]中所解释的。最后,需要确保Wine使用了正确的MIDI输出。<br />
<br />
=== 其它依赖 ===<br />
<br />
对于以下情况,部分应用软件可能需要额外的软件包:<br />
<br />
* 播放音乐: {{Pkg|lib32-mpg123}}<br />
* 原生图像处理库: {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}<br />
* 加密服务: {{Pkg|lib32-gnutls}}<br />
* 32位视频编解码器: {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}<br />
* NTLM身份验证: {{Pkg|samba}}<br />
<br />
=== 字体 ===<br />
<br />
如果 Wine 应用程序没有显示易读的字体,则可能没有安装任何字体。轻松链接所有的系统字体,使其可以从Wine:<br />
<br />
$ cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; done<br />
<br />
Wine 使用 FreeType 渲染字体,而 FreeType 的默认设置在几个版本之前已经改变了。尝试在Wine项目中使用这种环境设置:<br />
<br />
FREETYPE_PROPERTIES="truetype:interpreter-version=35"<br />
<br />
另一种可能性是在Wine前缀中安装微软的 TrueType 字体。 See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
运行此类程序后,关闭所有 Wine 服务并运行{{ic| winecfg }}。字体现在应该是可读的。<br />
<br />
如果字体看起来模糊不清,导入以下文本文件到 Wine 注册表[https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
Windows Registry Editor Version 5.00<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
对于高分辨率显示,可以在 winecfg 中调整 dpi 值。<br />
<br />
另见[[Font configuration#Applications without fontconfig support]]。<br />
<br />
==== 启用平滑字体 ====<br />
<br />
提高Wine渲染效果的一个好方法是使用cleartype平滑字体。<br />
若要启用“次像素平滑(ClearType) RGB”:<br />
<br />
{{bc|<nowiki><br />
$ cat << EOF > /tmp/fontsmoothing<br />
REGEDIT4<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingOrientation"=dword:00000001<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
EOF<br />
<br />
$ WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null<br />
</nowiki>}}<br />
<br />
详见[https://askubuntu.com/a/219795]。<br />
<br />
=== 桌面启动器 ===<br />
<br />
当使用 Windows 应用安装程序创建一个快捷方式时,Wine 会创建 [[.desktop]] 文件。Arch Linux 中这些文件的默认位置是:<br />
<br />
* 桌面快捷方式位于 {{ic|~/Desktop}} 下。<br />
* 开始菜单图标位于 {{ic|~/.local/share/applications/wine/Programs/}} 下。<br />
<br />
{{Note|1=Wine 不支持为所有用户安装 Winidows 应用程序,所以 Wine 不会把 ''.desktop'' 文件放到 {{ic|/usr/share/applications}} 下。详见 WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}<br />
<br />
{{Tip|如果安装软件时桌面启动器并没有创建或已经丢失,{{ic|wine winemenubuilder}} 也许能帮得上忙。}}<br />
<br />
==== 为Wine utilities创建菜单项 ====<br />
<br />
默认情况下,Wine 的安装不会为 Wine 附带的软件创建桌面菜单/图标(例如“ winecfg”、“ winebroserer”等)。这可以通过安装 {{AUR|wine-installer}}或 {{AUR|wine-installer-git}} meta-package (后者没有附加依赖项)来实现,否则这些说明将为这些应用程序添加条目。<br />
<br />
首先,使用 Wine 安装一个 Windows 程序来创建基本菜单。创建基本菜单后,可以在 {{ic|~/.local/share/applications/wine/}}:<br />
<br />
{{hc|wine-browsedrive.desktop|2=<br />
[Desktop Entry]<br />
Name=Browse C: Drive<br />
Comment=Browse your virtual C: drive<br />
Exec=wine winebrowser c:<br />
Terminal=false<br />
Type=Application<br />
Icon=folder-wine<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-uninstaller.desktop|2=<br />
[Desktop Entry]<br />
Name=Uninstall Wine Software<br />
Comment=Uninstall Windows applications for Wine<br />
Exec=wine uninstaller<br />
Terminal=false<br />
Type=Application<br />
Icon=wine-uninstaller<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-winecfg.desktop|2=<br />
[Desktop Entry]<br />
Name=Configure Wine<br />
Comment=Change application-specific and general Wine options<br />
Exec=winecfg<br />
Terminal=false<br />
Icon=wine-winecfg<br />
Type=Application<br />
Categories=Wine;<br />
}}<br />
<br />
并在{{ic|~/.config/menus/applications-merged/}}目录下创建如下文件:<br />
<br />
{{hc|wine.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Category>Wine</Category><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
<br />
如果这些设置产生了一个难看的/不存在的图标,这意味着在您所启用的图标集中没有这些启动程序的图标。您应该将图标设置替换为所需图标的位置。单击启动器属性菜单中的图标将会产生同样的效果。一个支持这些快捷方式的图标集是[https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors]。<br />
<br />
==== Removing menu entries ====<br />
<br />
由 Wine 创建的菜单条目位于 {{ic|~/.local/share/applications/wine/Programs/}}.<br />
除了通过 Wine 删除不需要的扩展绑定,还可以执行以下命令(摘自 Wine 官网) :<br />
<br />
$ rm ~/.local/share/mime/packages/x-wine*<br />
$ rm ~/.local/share/applications/wine-extension*<br />
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
$ rm ~/.local/share/mime/application/x-wine-extension*<br />
<br />
Sometimes you should also remove {{ic|wine-*.menu}} files from {{ic|/.config/menus/}} to completely remove items from wine submenu in kde.<br />
<br />
=== 主题 ===<br />
<br />
类似于 xp 外观的主题可以在这里 [https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 下载]. To install it, see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files this upstream wiki article]. Lastly, use ''winecfg'' to select it.<br />
<br />
{{Note|上面链接的主题只能安装在32位前缀上,前缀版本为 windowsxp。要将其安装在64位前缀上,可能需要创建一个临时的32位前缀,install the theme and copy the {{ic|Zune}} folder and {{ic|Zune.theme}} files from {{ic|drive_c/Windows/Resources/Themes}} in that prefix to the same location in your usual prefix.}}<br />
<br />
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.<br />
<br />
=== 打印 ===<br />
<br />
In order to use your installed printers (both local and network) with wine applications in ''win32 prefixes'' (e.g. MS Word), install the {{Pkg|lib32-libcups}} package, reboot wine (''wineboot'') and restart your wine application.<br />
<br />
=== 网络 ===<br />
<br />
After installation, the {{pkg|lib32-gnutls}} package may need to be [[install]]ed for applications making TLS or HTTPS connections to work.<br />
<br />
For ICMP (ping), Wine may need the network access as described in the [https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
<br />
If issues arise after this (such as an unhandled exception or privileged instruction), remove via:<br />
<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== 使用 ==<br />
<br />
{{警告|不要以 root 身份运行或安装 Wine 应用程序!详见 [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ]。}}<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Using_Wine Wine User's Guide] for general information on Wine usage.<br />
<br />
See [https://appdb.winehq.org/ Wine Application Database (AppDB)] for additional information on specific Windows applications in Wine.<br />
<br />
=== Wayland ===<br />
<br />
Wine 当前并不直接支持 Wayland,但你可以使用 [[Wayland#XWayland|XWayland]]。<br />
<br />
There are some efforts to support Wayland though:<br />
<br />
* Experimental Wayland driver for Wine, which supports using OpenGL- and Windows GDI-applications. See [https://www.winehq.org/pipermail/wine-devel/2020-December/178575.html this] and [https://www.winehq.org/pipermail/wine-devel/2021-February/181325.html this] wine-devel maillist entries.<br />
* [https://github.com/varmd/wine-wayland wine-wayland]: a custom version of Wine, which supports Wayland via Vulkan (so it supports only: DirectX 9, 10 and 11 via [[#DXVK]] and Vulkan-compatible applications).<br />
<br />
== 提示与技巧 ==<br />
<br />
=== Wineconsole ===<br />
<br />
通常情况下,你可能需要运行.exe来修补游戏文件,例如一个老游戏的宽屏mod,通过Wine正常运行.exe可能不会产生任何效果。在这种情况下,你可以打开一个终端,运行以下命令。<br />
<br />
$ wineconsole cmd<br />
<br />
然后转到该目录,从那里运行''.exe''文件。<br />
<br />
=== Winetricks ===<br />
<br />
[https://wiki.winehq.org/Winetricks Winetricks] is a script to allow one to install base requirements needed to run Windows programs. Installable components include DirectX 9.x, MSXML (required by Microsoft Office 2007 and Internet Explorer), Visual Runtime libraries and many more.<br />
<br />
[[Install]] the {{pkg|winetricks}} package (or alternatively {{AUR|winetricks-git}}). Then run it with:<br />
$ winetricks<br />
<br />
For using GUI you should [[install]] the {{pkg|zenity}}.<br />
<br />
=== 性能 ===<br />
<br />
==== CSMT ====<br />
<br />
CSMT是Wine使用的一项技术,它为OpenGL调用使用了一个单独的线程,以显著提高性能。从Wine 3.2开始,CSMT被默认启用。然而,对于低于3.2的Wine版本,需要手动启用CSMT支持。对于vanilla Wine,运行wine regedit并将HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt的DWORD值设置为0x01(启用)。对于wine-staging,运行winecfg并在staging标签中启用它。<br />
<br />
注意,CSMT实际上可能会损害某些应用程序的性能--如果是这种情况,通过创建/设置注册表值为0x00(禁用)来禁用它。<br />
<br />
更多:<br />
*[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion]<br />
<br />
==== 强制使用OpenGL模式运行游戏 ====<br />
<br />
有些游戏可能有OpenGL模式,其性能可能比其默认的DirectX模式更好。虽然启用OpenGL渲染的是 "特定应用",但许多游戏可以使用{{Ic|-opengl}}参数。<br />
<br />
$ wine ''/path/to/3d_game.exe'' -opengl<br />
<br />
你应该参考你的应用程序文档和Wine的官网[https://appdb.winehq.org AppDB]来了解这些应用程序的具体信息。<br />
<br />
==== DXVK ====<br />
<br />
[https://github.com/doitsujin/dxvk DXVK] is a promising new implementation for DirectX 9, 10 & 11 over Vulkan. This should allow for greater performance, and in some cases, even better compatibility. Battlefield 1 for example, only runs under DXVK. On the other hand, DXVK does not support all Wine games (yet).<br />
<br />
To use it, install {{aur|dxvk-bin}}. Then run the following command to activate it in your Wineprefix (by default {{ic|~/.wine}}):<br />
<br />
$ WINEPREFIX=''your-prefix'' setup_dxvk install<br />
<br />
{{Warning|DXVK overrides the DirectX 10 and 11 DLLs, which may be considered cheating in online multiplayer games, and may get your account '''banned'''. Use at your own risk!}}<br />
<br />
==== Gallium Nine ====<br />
<br />
With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.<br />
<br />
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any Wine version. Use {{ic|wine ninewinecfg}} to check if it is enabled.<br />
<br />
For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. [[Export]] the following environment variable before running Wine: <br />
<br />
MESA_LOADER_DRIVER_OVERRIDE=crocus<br />
<br />
=== Unregister existing Wine file associations ===<br />
<br />
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.<br />
<br />
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
$ update-mime-database ~/.local/share/mime/<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Prevent Wine from creating filetype associations ===<br />
<br />
{{Note|This has to be done for each WINEPREFIX which should not update file associations unless you opt to change {{ic|/usr/share/wine/wine.inf}} .}}<br />
This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).<br />
<br />
If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See [https://wiki.winehq.org/FAQ#How_can_I_prevent_Wine_from_changing_the_filetype_associations_on_my_system_or_adding_unwanted_menu_entries.2Fdesktop_links.3F Wine FAQ]<br />
<br />
To make the same change via registry add the string {{ic|Enable}} with value {{ic|N}} under:<br />
<br />
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations<br />
<br />
''You might have to create the key {{ic|FileOpenAssociations}} first!''<br />
<br />
To make this change via the command-line, run the following command:<br />
<br />
$ wine reg add "HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations" /v Enable /d N<br />
<br />
If you want to apply this by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}} and add this line for example under the {{ic|[Services]}} section:<br />
HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"<br />
<br />
To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:<br />
<br />
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=<br />
<br />
[Trigger]<br />
Operation = Install<br />
Operation = Upgrade<br />
Type = Path<br />
Target = usr/share/wine/wine.inf<br />
<br />
[Action]<br />
Description = Stopping Wine from hijacking file associations...<br />
When = PostTransaction<br />
<nowiki>Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'</nowiki><br />
}}<br />
<br />
See [[Pacman#Hooks]]<br />
<br />
=== 自动使用 Wine 执行 Windows 程序 ===<br />
<br />
{{pkg|wine}} 软件包会安装一个 ''binfmt'' 文件,这可使你能够直接运行 Windows 程序,例如,{{ic|''./myprogram.exe''}} 将与 {{ic|wine ''./myprogram.exe''}} 效果相同。服务默认在开机时启动,如果在安装 Wine 之后还没有重启过,[[启动]] {{ic|systemd-binfmt.service}} 即可。<br />
<br />
{{注意|确保 Windows 程序[[executable|可执行]],否则程序将不会运行。}}<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). [[CDemu]] will handle it correctly.<br />
<br />
=== 游戏内显示帧数 ===<br />
<br />
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.<br />
<br />
=== 在单独的用户帐户下运行 Wine ===<br />
<br />
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.<br />
<br />
First, create a [[user account]] for Wine:<br />
<br />
# useradd -m -s /bin/bash wineuser<br />
<br />
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...<br />
<br />
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information on how to execute the {{ic|xhost}} command under your main user.}}<br />
<br />
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:<br />
<br />
$ xhost +SI:localuser:wineuser<br />
<br />
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:<br />
<br />
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''<br />
<br />
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:<br />
{{hc|1=/usr/local/bin/runaswine|2=<br />
#!/bin/bash<br />
xhost +SI:localuser:wineuser<br />
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}<br />
<br />
Wine applications can then be launched via:<br />
<br />
$ runaswine ''"C:\path\to\application.exe"''<br />
<br />
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.<br />
<br />
It is recommended to run {{ic|winecfg}} as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.<br />
<br />
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to share a PulseAudio daemon]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.<br />
<br />
=== Temp directory on tmpfs ===<br />
<br />
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:<br />
<br />
$ rm -r ~/.wine/drive_c/users/$USER/Temp ~/.wine/drive_c/windows/temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/windows/temp<br />
<br />
=== Prevent installing Mono/Gecko ===<br />
<br />
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.<br />
<br />
=== Vulkan ===<br />
<br />
The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].<br />
<br />
=== Remove Wine file bindings ===<br />
<br />
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).<br />
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}<br />
<br />
NoExtract = usr/lib/binfmt.d/wine.conf<br />
NoExtract = usr/share/applications/wine.desktop<br />
<br />
=== WineASIO ===<br />
<br />
If you need professional audio support under wine you can use {{Aur|wineasio}} which provides an ASIO interface for wine that you can then use with [[JACK]].<br />
<br />
In order to use wineasio you must add yourself to the {{ic|realtime}} [[user group]].<br />
<br />
Next you need to register wineasio in your desired wine prefix. Register the 32-bit and/or 64-bit version as needed:<br />
$ regsvr32 /usr/lib32/wine/i386-windows/wineasio.dll<br />
$ wine64 regsvr32 /usr/lib/wine/x86_64-windows/wineasio.dll<br />
<br />
== 疑难解答 ==<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Troubleshooting_.2F_Reporting_bugs Wine User's Guide] and [https://wiki.winehq.org/FAQ Wine FAQ] (especially its [https://wiki.winehq.org/FAQ#Troubleshooting Troubleshooting] section) for general tips.<br />
<br />
Also refer to the [https://appdb.winehq.org/ Wine AppDB] for an advice on specific applications.<br />
<br />
=== XWayland问题 ===<br />
<br />
If you use Wine under [[Wayland#XWayland|XWayland]], you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:<br />
<br />
* flickering;<br />
* wrong window location;<br />
* wrong mouse cursor location and clicks;<br />
* keyboard detection.<br />
<br />
=== 键盘输入不工作 ===<br />
<br />
This could be caused by the window manager not switching focus. In the ''Graphics'' tab of ''winecfg'', disable the 'Allow the window manager...' options, or set windowed mode with 'Emulate a virtual desktop'.<br />
*Some suggest to toggle all the ''Window settings'', click ''Apply'', then change them back. If that does not work, try the above.<br />
<br />
If the keyboard does not work after unfocusing the application, try editing the registry:<br />
*Under ''HKEY_CURRENT_USER\Software\Wine\X11 Driver'', add a string value ''UseTakeFocus'' and set it to ''N''.<br />
*Alternatively, you can use winetricks to set the value.<br />
winetricks usetakefocus=n<br />
<br />
== 参见 ==<br />
<br />
* [https://www.winehq.org/ Wine Homepage]<br />
* [https://wiki.winehq.org/ Wine Wiki]<br />
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
* [[Gentoo:Wine]]<br />
* [https://www.darlinghq.org/ Darling] - a similar project for MacOS software<br />
* [https://github.com/wineasio/wineasio WineASIO] - GitHub page of the WineASIO project with further information</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=738850Wine (简体中文)2022-07-24T09:33:07Z<p>InsaneGuo: /* CSMT */ 翻译</p>
<hr />
<div>[[Category:Emulation (简体中文)]]<br />
[[Category:Gaming (简体中文)]]<br />
[[de:Wine]]<br />
[[en:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
{{Related articles start}}<br />
{{Related|CrossOver}}<br />
{{Related|Deepin-wine}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
{{translateme (简体中文)|进度:35%}}<br />
{{TranslationStatus (简体中文)|Wine|2022-04-19|724914}}<br />
<br />
[[Wikipedia:Wine (software)|Wine]] 是一款可以在类 Unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而没有模拟器的性能/内存损失。<br />
<br />
{{警告|<br />
* Wine 并非与你的系统隔离。<br />
* 如果你可以使用你的用户帐户访问某个文件或资源,那么在 Wine 中运行的程序也可以。参见[[#在单独的用户帐户下运行 Wine]]和[[安全#沙盒程序]]了解可能的预防措施。<br />
* Wine 也可以运行恶意软件(参见 [https://wiki.winehq.org/FAQ#Is_Wine_malware-compatible.3F Wine 关于恶意软件兼容性的 FAQ])}}<br />
<br />
== 安装 ==<br />
<br />
首先启用[[multilib]]仓库,然后[[install|安装]] {{Pkg|wine}}(开发版),{{AUR|wine-stable}}(稳定版)或 {{Pkg|wine-staging}}(测试版本)。[https://wine-staging.com/ Wine Staging] 是 [https://www.winehq.org/ Wine] 的修补版本, 其中包含了漏洞修复和尚未集成到稳定或开发分支中的特性。<br />
<br />
其它需求见[[#图形驱动程序]]和[[#声音]]。<br />
<br />
可以考虑为依赖于 Internet Explorer 和 .NET 的应用程序分别安装 {{pkg|wine-gecko}} 和 {{pkg|wine-mono}}。这两个软件包不是一定要安装的,因为 Wine 会根据需要自行下载相关文件。反过来说,如果提前安装了软件包,Wine 就不需要再下载这些文件了。<br />
<br />
== 配置 ==<br />
<br />
配置 Wine 通常使用以下方法:<br />
<br />
* [https://wiki.winehq.org/Winecfg winecfg] 是 Wine 的 GUI 配置工具,可以通过运行 {{ic|winecfg}} 来启动。<br />
* [https://wiki.winehq.org/Regedit regedit] 是 Wine 的注册表编辑工具,可以通过运行{{ic|regedit}} 来启动。另见 WineHQ 关于 [https://wiki.winehq.org/Useful_Registry_Keys 有用的注册表键]的文档。<br />
* [https://wiki.winehq.org/Control control] 是 Wine 的 Windows 控制面板的实现,可以通过运行 {{ic|wine control}} 来启动。<br />
* 完整列表见 WineHQ 的[https://wiki.winehq.org/List_of_Commands 命令列表]。<br />
<br />
=== WINEPREFIX ===<br />
<br />
默认情况下,Wine 将其配置文件和安装的 Windows 程序存储在 {{ic|~/.wine}} ,通常会把此目录叫作“Wine prefix”或“Wine bottle”。当您运行 Windows 程序或 Wine 的捆绑程序(如 winecfg)时,它会自动创建/更新。前缀目录还包含一个目录,您的 Windows 程序将其视为 {{ic|c:}} (C盘)。<br />
<br />
您可以使用 {{ic|WINEPREFIX}}环境变量覆盖 Wine 使用的前缀位置。如果您希望为不同的 Windows 程序使用单独的配置,这将非常有用。第一次运行带有新 Wine 前缀的程序时,Wine 将自动创建一个带有 c 驱动器和注册表的目录。<br />
<br />
例如,如果您运行一个带有{{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}的程序,和另一个 {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}这两个程序将分别有一个单独的 c 驱动器和单独的注册。<br />
<br />
{{警告|Wine不是[[Wikipedia:Sandbox (computer security)|沙盒]]!在 Wine 下运行的程序仍然可以访问系统的其余部分!(例如, {{ic|Z:}} 映射到 {{ic|/}}, 与 Wine 前缀无关)}}<br />
<br />
若要在不运行 Windows 程序或其他 GUI 工具的情况下创建默认前缀,可以使用:<br />
<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
Wine将默认启动一个64位环境。你可以改变它使用{{ic|WINEARCH}}[[环境变量]]。改名你的{{ic|~/.wine}}目录并创建一个新的Wine环境通过使用{{ic|1=$WINEARCH=win32 winecfg}}。这将给你一个32位Wine环境。不舍指{{ic|WINEARCH}}将给你一个64位环境。<br />
<br />
你可以通过修改{{ic|WINEPREFIX}}来创建一个分开的{{ic|win32}}和{{ic|win64}}环境:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
你也可以使用{{ic|WINEARCH}}与其它Wine程式合并,例如''winetricks''(使用Steam作为例子)<br />
<br />
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
为了使用这个架构在一个存在的预设,你可以检查他的注册表文件。如下的命令读了{{ic|~/.wine}}的预设系统注册表并返回{{ic|1=#arch-win32}}或{{ic|1=#arch=win64}}依赖于架构类型。<br />
<br />
$ grep '#arch' ~/.wine/system.reg<br />
<br />
=== 图形驱动程序 ===<br />
<br />
你需要安装 32 位版本的图形驱动程序。请安装[[Xorg (简体中文)#驱动安装]]中 ''OpenGL (multilib)'' 一栏列出的软件包。<br />
<br />
当 Wine 在你的终端窗口中报告以下内容时,很可能你的驱动程序不合适或没有正确配置:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{注意|安装正确的库之后你可能需要重新启动 X。}}<br />
<br />
=== 声音 ===<br />
<br />
默认情况下,运行Wine应用程序时可能会出现声音问题。确保在winecfg中只选择一个声音设备。<br />
<br />
为你要使用的音频驱动器安装正确的软件包:<br />
<br />
* 对于 [[ALSA]] 安装 {{Pkg|lib32-alsa-lib}} 和 {{Pkg|lib32-alsa-plugins}}<br />
* 对于 [[PulseAudio]] 安装 {{Pkg|lib32-libpulse}} <br />
* 对于 [[PipeWire]] 同时安装 {{Pkg|pipewire-pulse}}和 {{Pkg|lib32-libpulse}} 或者 {{Pkg|pipewire-alsa}} 和 {{Pkg|lib32-alsa-lib}} + {{Pkg|lib32-alsa-plugins}}<br />
* 对于 [[OSS]] 安装 {{Pkg|lib32-alsa-oss}}<br />
<br />
额外的软件包:<br />
<br />
使用高级声音系统的游戏(例如TESV: Skyrim)可能还需要安装{{Pkg|lib32-openal}}。<br />
如果winecfg仍然无法检测到音频驱动(Selected driver: (none)),请通过注册表对其进行配置。例如,在64位的wine-1.9.7系统上,麦克风无法在32位的Windows应用程序中工作,这就提供了对声音硬件(声音播放和麦克风)的完全访问:打开regedit,寻找路径HKEY_CURRENT_USER → Software → Wine → Drivers,添加一个名为Audio的字符串,给它一个值alsa。另外,重新创建前缀可能有帮助。<br />
<br />
==== MIDI支持 ====<br />
<br />
在90年代,[[MIDI]]是相当流行的游戏音乐系统。尝试游玩老游戏时,音乐可能无法直接播放。<br />
Wine对MIDI有良好的支持,但首先需要让它在系统上工作,如[[MIDI]]中所解释的。最后,需要确保Wine使用了正确的MIDI输出。<br />
<br />
=== 其它依赖 ===<br />
<br />
对于以下情况,部分应用软件可能需要额外的软件包:<br />
<br />
* 播放音乐: {{Pkg|lib32-mpg123}}<br />
* 原生图像处理库: {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}<br />
* 加密服务: {{Pkg|lib32-gnutls}}<br />
* 32位视频编解码器: {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}<br />
* NTLM身份验证: {{Pkg|samba}}<br />
<br />
=== 字体 ===<br />
<br />
如果 Wine 应用程序没有显示易读的字体,则可能没有安装任何字体。轻松链接所有的系统字体,使其可以从Wine:<br />
<br />
$ cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; done<br />
<br />
Wine 使用 FreeType 渲染字体,而 FreeType 的默认设置在几个版本之前已经改变了。尝试在Wine项目中使用这种环境设置:<br />
<br />
FREETYPE_PROPERTIES="truetype:interpreter-version=35"<br />
<br />
另一种可能性是在Wine前缀中安装微软的 TrueType 字体。 See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
运行此类程序后,关闭所有 Wine 服务并运行{{ic| winecfg }}。字体现在应该是可读的。<br />
<br />
如果字体看起来模糊不清,导入以下文本文件到 Wine 注册表[https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
Windows Registry Editor Version 5.00<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
对于高分辨率显示,可以在 winecfg 中调整 dpi 值。<br />
<br />
另见[[Font configuration#Applications without fontconfig support]]。<br />
<br />
==== 启用平滑字体 ====<br />
<br />
提高Wine渲染效果的一个好方法是使用cleartype平滑字体。<br />
若要启用“次像素平滑(ClearType) RGB”:<br />
<br />
{{bc|<nowiki><br />
$ cat << EOF > /tmp/fontsmoothing<br />
REGEDIT4<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingOrientation"=dword:00000001<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
EOF<br />
<br />
$ WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null<br />
</nowiki>}}<br />
<br />
详见[https://askubuntu.com/a/219795]。<br />
<br />
=== 桌面启动器 ===<br />
<br />
当使用 Windows 应用安装程序创建一个快捷方式时,Wine 会创建 [[.desktop]] 文件。Arch Linux 中这些文件的默认位置是:<br />
<br />
* 桌面快捷方式位于 {{ic|~/Desktop}} 下。<br />
* 开始菜单图标位于 {{ic|~/.local/share/applications/wine/Programs/}} 下。<br />
<br />
{{Note|1=Wine 不支持为所有用户安装 Winidows 应用程序,所以 Wine 不会把 ''.desktop'' 文件放到 {{ic|/usr/share/applications}} 下。详见 WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}<br />
<br />
{{Tip|如果安装软件时桌面启动器并没有创建或已经丢失,{{ic|wine winemenubuilder}} 也许能帮得上忙。}}<br />
<br />
==== 为Wine utilities创建菜单项 ====<br />
<br />
默认情况下,Wine 的安装不会为 Wine 附带的软件创建桌面菜单/图标(例如“ winecfg”、“ winebroserer”等)。这可以通过安装 {{AUR|wine-installer}}或 {{AUR|wine-installer-git}} meta-package (后者没有附加依赖项)来实现,否则这些说明将为这些应用程序添加条目。<br />
<br />
首先,使用 Wine 安装一个 Windows 程序来创建基本菜单。创建基本菜单后,可以在 {{ic|~/.local/share/applications/wine/}}:<br />
<br />
{{hc|wine-browsedrive.desktop|2=<br />
[Desktop Entry]<br />
Name=Browse C: Drive<br />
Comment=Browse your virtual C: drive<br />
Exec=wine winebrowser c:<br />
Terminal=false<br />
Type=Application<br />
Icon=folder-wine<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-uninstaller.desktop|2=<br />
[Desktop Entry]<br />
Name=Uninstall Wine Software<br />
Comment=Uninstall Windows applications for Wine<br />
Exec=wine uninstaller<br />
Terminal=false<br />
Type=Application<br />
Icon=wine-uninstaller<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-winecfg.desktop|2=<br />
[Desktop Entry]<br />
Name=Configure Wine<br />
Comment=Change application-specific and general Wine options<br />
Exec=winecfg<br />
Terminal=false<br />
Icon=wine-winecfg<br />
Type=Application<br />
Categories=Wine;<br />
}}<br />
<br />
并在{{ic|~/.config/menus/applications-merged/}}目录下创建如下文件:<br />
<br />
{{hc|wine.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Category>Wine</Category><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
<br />
如果这些设置产生了一个难看的/不存在的图标,这意味着在您所启用的图标集中没有这些启动程序的图标。您应该将图标设置替换为所需图标的位置。单击启动器属性菜单中的图标将会产生同样的效果。一个支持这些快捷方式的图标集是[https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors]。<br />
<br />
==== Removing menu entries ====<br />
<br />
由 Wine 创建的菜单条目位于 {{ic|~/.local/share/applications/wine/Programs/}}.<br />
除了通过 Wine 删除不需要的扩展绑定,还可以执行以下命令(摘自 Wine 官网) :<br />
<br />
$ rm ~/.local/share/mime/packages/x-wine*<br />
$ rm ~/.local/share/applications/wine-extension*<br />
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
$ rm ~/.local/share/mime/application/x-wine-extension*<br />
<br />
Sometimes you should also remove {{ic|wine-*.menu}} files from {{ic|/.config/menus/}} to completely remove items from wine submenu in kde.<br />
<br />
=== 主题 ===<br />
<br />
类似于 xp 外观的主题可以在这里 [https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 下载]. To install it, see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files this upstream wiki article]. Lastly, use ''winecfg'' to select it.<br />
<br />
{{Note|上面链接的主题只能安装在32位前缀上,前缀版本为 windowsxp。要将其安装在64位前缀上,可能需要创建一个临时的32位前缀,install the theme and copy the {{ic|Zune}} folder and {{ic|Zune.theme}} files from {{ic|drive_c/Windows/Resources/Themes}} in that prefix to the same location in your usual prefix.}}<br />
<br />
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.<br />
<br />
=== 打印 ===<br />
<br />
In order to use your installed printers (both local and network) with wine applications in ''win32 prefixes'' (e.g. MS Word), install the {{Pkg|lib32-libcups}} package, reboot wine (''wineboot'') and restart your wine application.<br />
<br />
=== 网络 ===<br />
<br />
After installation, the {{pkg|lib32-gnutls}} package may need to be [[install]]ed for applications making TLS or HTTPS connections to work.<br />
<br />
For ICMP (ping), Wine may need the network access as described in the [https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
<br />
If issues arise after this (such as an unhandled exception or privileged instruction), remove via:<br />
<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== 使用 ==<br />
<br />
{{警告|不要以 root 身份运行或安装 Wine 应用程序!详见 [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ]。}}<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Using_Wine Wine User's Guide] for general information on Wine usage.<br />
<br />
See [https://appdb.winehq.org/ Wine Application Database (AppDB)] for additional information on specific Windows applications in Wine.<br />
<br />
=== Wayland ===<br />
<br />
Wine 当前并不直接支持 Wayland,但你可以使用 [[Wayland#XWayland|XWayland]]。<br />
<br />
There are some efforts to support Wayland though:<br />
<br />
* Experimental Wayland driver for Wine, which supports using OpenGL- and Windows GDI-applications. See [https://www.winehq.org/pipermail/wine-devel/2020-December/178575.html this] and [https://www.winehq.org/pipermail/wine-devel/2021-February/181325.html this] wine-devel maillist entries.<br />
* [https://github.com/varmd/wine-wayland wine-wayland]: a custom version of Wine, which supports Wayland via Vulkan (so it supports only: DirectX 9, 10 and 11 via [[#DXVK]] and Vulkan-compatible applications).<br />
<br />
== 提示与技巧 ==<br />
<br />
=== Wineconsole ===<br />
<br />
通常情况下,你可能需要运行.exe来修补游戏文件,例如一个老游戏的宽屏mod,通过Wine正常运行.exe可能不会产生任何效果。在这种情况下,你可以打开一个终端,运行以下命令。<br />
<br />
$ wineconsole cmd<br />
<br />
然后转到该目录,从那里运行''.exe''文件。<br />
<br />
=== Winetricks ===<br />
<br />
[https://wiki.winehq.org/Winetricks Winetricks] is a script to allow one to install base requirements needed to run Windows programs. Installable components include DirectX 9.x, MSXML (required by Microsoft Office 2007 and Internet Explorer), Visual Runtime libraries and many more.<br />
<br />
[[Install]] the {{pkg|winetricks}} package (or alternatively {{AUR|winetricks-git}}). Then run it with:<br />
$ winetricks<br />
<br />
For using GUI you should [[install]] the {{pkg|zenity}}.<br />
<br />
=== 性能 ===<br />
<br />
==== CSMT ====<br />
<br />
CSMT是Wine使用的一项技术,它为OpenGL调用使用了一个单独的线程,以显著提高性能。从Wine 3.2开始,CSMT被默认启用。然而,对于低于3.2的Wine版本,需要手动启用CSMT支持。对于vanilla Wine,运行wine regedit并将HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt的DWORD值设置为0x01(启用)。对于wine-staging,运行winecfg并在staging标签中启用它。<br />
<br />
注意,CSMT实际上可能会损害某些应用程序的性能--如果是这种情况,通过创建/设置注册表值为0x00(禁用)来禁用它。<br />
<br />
更多:<br />
*[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion]<br />
<br />
==== 强制使用OpenGL模式运行游戏 ====<br />
<br />
Some games might have an OpenGL mode which ''may'' perform better than their default DirectX mode. While the steps to enable OpenGL rendering is ''application specific'', many games accept the {{Ic|-opengl}} parameter.<br />
<br />
$ wine ''/path/to/3d_game.exe'' -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [https://appdb.winehq.org AppDB] for such application specific information.<br />
<br />
==== DXVK ====<br />
<br />
[https://github.com/doitsujin/dxvk DXVK] is a promising new implementation for DirectX 9, 10 & 11 over Vulkan. This should allow for greater performance, and in some cases, even better compatibility. Battlefield 1 for example, only runs under DXVK. On the other hand, DXVK does not support all Wine games (yet).<br />
<br />
To use it, install {{aur|dxvk-bin}}. Then run the following command to activate it in your Wineprefix (by default {{ic|~/.wine}}):<br />
<br />
$ WINEPREFIX=''your-prefix'' setup_dxvk install<br />
<br />
{{Warning|DXVK overrides the DirectX 10 and 11 DLLs, which may be considered cheating in online multiplayer games, and may get your account '''banned'''. Use at your own risk!}}<br />
<br />
==== Gallium Nine ====<br />
<br />
With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.<br />
<br />
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any Wine version. Use {{ic|wine ninewinecfg}} to check if it is enabled.<br />
<br />
For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. [[Export]] the following environment variable before running Wine: <br />
<br />
MESA_LOADER_DRIVER_OVERRIDE=crocus<br />
<br />
=== Unregister existing Wine file associations ===<br />
<br />
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.<br />
<br />
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
$ update-mime-database ~/.local/share/mime/<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Prevent Wine from creating filetype associations ===<br />
<br />
{{Note|This has to be done for each WINEPREFIX which should not update file associations unless you opt to change {{ic|/usr/share/wine/wine.inf}} .}}<br />
This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).<br />
<br />
If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See [https://wiki.winehq.org/FAQ#How_can_I_prevent_Wine_from_changing_the_filetype_associations_on_my_system_or_adding_unwanted_menu_entries.2Fdesktop_links.3F Wine FAQ]<br />
<br />
To make the same change via registry add the string {{ic|Enable}} with value {{ic|N}} under:<br />
<br />
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations<br />
<br />
''You might have to create the key {{ic|FileOpenAssociations}} first!''<br />
<br />
To make this change via the command-line, run the following command:<br />
<br />
$ wine reg add "HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations" /v Enable /d N<br />
<br />
If you want to apply this by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}} and add this line for example under the {{ic|[Services]}} section:<br />
HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"<br />
<br />
To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:<br />
<br />
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=<br />
<br />
[Trigger]<br />
Operation = Install<br />
Operation = Upgrade<br />
Type = Path<br />
Target = usr/share/wine/wine.inf<br />
<br />
[Action]<br />
Description = Stopping Wine from hijacking file associations...<br />
When = PostTransaction<br />
<nowiki>Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'</nowiki><br />
}}<br />
<br />
See [[Pacman#Hooks]]<br />
<br />
=== 自动使用 Wine 执行 Windows 程序 ===<br />
<br />
{{pkg|wine}} 软件包会安装一个 ''binfmt'' 文件,这可使你能够直接运行 Windows 程序,例如,{{ic|''./myprogram.exe''}} 将与 {{ic|wine ''./myprogram.exe''}} 效果相同。服务默认在开机时启动,如果在安装 Wine 之后还没有重启过,[[启动]] {{ic|systemd-binfmt.service}} 即可。<br />
<br />
{{注意|确保 Windows 程序[[executable|可执行]],否则程序将不会运行。}}<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). [[CDemu]] will handle it correctly.<br />
<br />
=== 游戏内显示帧数 ===<br />
<br />
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.<br />
<br />
=== 在单独的用户帐户下运行 Wine ===<br />
<br />
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.<br />
<br />
First, create a [[user account]] for Wine:<br />
<br />
# useradd -m -s /bin/bash wineuser<br />
<br />
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...<br />
<br />
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information on how to execute the {{ic|xhost}} command under your main user.}}<br />
<br />
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:<br />
<br />
$ xhost +SI:localuser:wineuser<br />
<br />
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:<br />
<br />
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''<br />
<br />
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:<br />
{{hc|1=/usr/local/bin/runaswine|2=<br />
#!/bin/bash<br />
xhost +SI:localuser:wineuser<br />
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}<br />
<br />
Wine applications can then be launched via:<br />
<br />
$ runaswine ''"C:\path\to\application.exe"''<br />
<br />
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.<br />
<br />
It is recommended to run {{ic|winecfg}} as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.<br />
<br />
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to share a PulseAudio daemon]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.<br />
<br />
=== Temp directory on tmpfs ===<br />
<br />
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:<br />
<br />
$ rm -r ~/.wine/drive_c/users/$USER/Temp ~/.wine/drive_c/windows/temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/windows/temp<br />
<br />
=== Prevent installing Mono/Gecko ===<br />
<br />
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.<br />
<br />
=== Vulkan ===<br />
<br />
The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].<br />
<br />
=== Remove Wine file bindings ===<br />
<br />
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).<br />
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}<br />
<br />
NoExtract = usr/lib/binfmt.d/wine.conf<br />
NoExtract = usr/share/applications/wine.desktop<br />
<br />
=== WineASIO ===<br />
<br />
If you need professional audio support under wine you can use {{Aur|wineasio}} which provides an ASIO interface for wine that you can then use with [[JACK]].<br />
<br />
In order to use wineasio you must add yourself to the {{ic|realtime}} [[user group]].<br />
<br />
Next you need to register wineasio in your desired wine prefix. Register the 32-bit and/or 64-bit version as needed:<br />
$ regsvr32 /usr/lib32/wine/i386-windows/wineasio.dll<br />
$ wine64 regsvr32 /usr/lib/wine/x86_64-windows/wineasio.dll<br />
<br />
== 疑难解答 ==<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Troubleshooting_.2F_Reporting_bugs Wine User's Guide] and [https://wiki.winehq.org/FAQ Wine FAQ] (especially its [https://wiki.winehq.org/FAQ#Troubleshooting Troubleshooting] section) for general tips.<br />
<br />
Also refer to the [https://appdb.winehq.org/ Wine AppDB] for an advice on specific applications.<br />
<br />
=== XWayland问题 ===<br />
<br />
If you use Wine under [[Wayland#XWayland|XWayland]], you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:<br />
<br />
* flickering;<br />
* wrong window location;<br />
* wrong mouse cursor location and clicks;<br />
* keyboard detection.<br />
<br />
=== 键盘输入不工作 ===<br />
<br />
This could be caused by the window manager not switching focus. In the ''Graphics'' tab of ''winecfg'', disable the 'Allow the window manager...' options, or set windowed mode with 'Emulate a virtual desktop'.<br />
*Some suggest to toggle all the ''Window settings'', click ''Apply'', then change them back. If that does not work, try the above.<br />
<br />
If the keyboard does not work after unfocusing the application, try editing the registry:<br />
*Under ''HKEY_CURRENT_USER\Software\Wine\X11 Driver'', add a string value ''UseTakeFocus'' and set it to ''N''.<br />
*Alternatively, you can use winetricks to set the value.<br />
winetricks usetakefocus=n<br />
<br />
== 参见 ==<br />
<br />
* [https://www.winehq.org/ Wine Homepage]<br />
* [https://wiki.winehq.org/ Wine Wiki]<br />
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
* [[Gentoo:Wine]]<br />
* [https://www.darlinghq.org/ Darling] - a similar project for MacOS software<br />
* [https://github.com/wineasio/wineasio WineASIO] - GitHub page of the WineASIO project with further information</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=738849Wine (简体中文)2022-07-24T09:30:49Z<p>InsaneGuo: /* Wineconsole */ 翻译</p>
<hr />
<div>[[Category:Emulation (简体中文)]]<br />
[[Category:Gaming (简体中文)]]<br />
[[de:Wine]]<br />
[[en:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
{{Related articles start}}<br />
{{Related|CrossOver}}<br />
{{Related|Deepin-wine}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
{{translateme (简体中文)|进度:35%}}<br />
{{TranslationStatus (简体中文)|Wine|2022-04-19|724914}}<br />
<br />
[[Wikipedia:Wine (software)|Wine]] 是一款可以在类 Unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而没有模拟器的性能/内存损失。<br />
<br />
{{警告|<br />
* Wine 并非与你的系统隔离。<br />
* 如果你可以使用你的用户帐户访问某个文件或资源,那么在 Wine 中运行的程序也可以。参见[[#在单独的用户帐户下运行 Wine]]和[[安全#沙盒程序]]了解可能的预防措施。<br />
* Wine 也可以运行恶意软件(参见 [https://wiki.winehq.org/FAQ#Is_Wine_malware-compatible.3F Wine 关于恶意软件兼容性的 FAQ])}}<br />
<br />
== 安装 ==<br />
<br />
首先启用[[multilib]]仓库,然后[[install|安装]] {{Pkg|wine}}(开发版),{{AUR|wine-stable}}(稳定版)或 {{Pkg|wine-staging}}(测试版本)。[https://wine-staging.com/ Wine Staging] 是 [https://www.winehq.org/ Wine] 的修补版本, 其中包含了漏洞修复和尚未集成到稳定或开发分支中的特性。<br />
<br />
其它需求见[[#图形驱动程序]]和[[#声音]]。<br />
<br />
可以考虑为依赖于 Internet Explorer 和 .NET 的应用程序分别安装 {{pkg|wine-gecko}} 和 {{pkg|wine-mono}}。这两个软件包不是一定要安装的,因为 Wine 会根据需要自行下载相关文件。反过来说,如果提前安装了软件包,Wine 就不需要再下载这些文件了。<br />
<br />
== 配置 ==<br />
<br />
配置 Wine 通常使用以下方法:<br />
<br />
* [https://wiki.winehq.org/Winecfg winecfg] 是 Wine 的 GUI 配置工具,可以通过运行 {{ic|winecfg}} 来启动。<br />
* [https://wiki.winehq.org/Regedit regedit] 是 Wine 的注册表编辑工具,可以通过运行{{ic|regedit}} 来启动。另见 WineHQ 关于 [https://wiki.winehq.org/Useful_Registry_Keys 有用的注册表键]的文档。<br />
* [https://wiki.winehq.org/Control control] 是 Wine 的 Windows 控制面板的实现,可以通过运行 {{ic|wine control}} 来启动。<br />
* 完整列表见 WineHQ 的[https://wiki.winehq.org/List_of_Commands 命令列表]。<br />
<br />
=== WINEPREFIX ===<br />
<br />
默认情况下,Wine 将其配置文件和安装的 Windows 程序存储在 {{ic|~/.wine}} ,通常会把此目录叫作“Wine prefix”或“Wine bottle”。当您运行 Windows 程序或 Wine 的捆绑程序(如 winecfg)时,它会自动创建/更新。前缀目录还包含一个目录,您的 Windows 程序将其视为 {{ic|c:}} (C盘)。<br />
<br />
您可以使用 {{ic|WINEPREFIX}}环境变量覆盖 Wine 使用的前缀位置。如果您希望为不同的 Windows 程序使用单独的配置,这将非常有用。第一次运行带有新 Wine 前缀的程序时,Wine 将自动创建一个带有 c 驱动器和注册表的目录。<br />
<br />
例如,如果您运行一个带有{{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}的程序,和另一个 {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}这两个程序将分别有一个单独的 c 驱动器和单独的注册。<br />
<br />
{{警告|Wine不是[[Wikipedia:Sandbox (computer security)|沙盒]]!在 Wine 下运行的程序仍然可以访问系统的其余部分!(例如, {{ic|Z:}} 映射到 {{ic|/}}, 与 Wine 前缀无关)}}<br />
<br />
若要在不运行 Windows 程序或其他 GUI 工具的情况下创建默认前缀,可以使用:<br />
<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
Wine将默认启动一个64位环境。你可以改变它使用{{ic|WINEARCH}}[[环境变量]]。改名你的{{ic|~/.wine}}目录并创建一个新的Wine环境通过使用{{ic|1=$WINEARCH=win32 winecfg}}。这将给你一个32位Wine环境。不舍指{{ic|WINEARCH}}将给你一个64位环境。<br />
<br />
你可以通过修改{{ic|WINEPREFIX}}来创建一个分开的{{ic|win32}}和{{ic|win64}}环境:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
你也可以使用{{ic|WINEARCH}}与其它Wine程式合并,例如''winetricks''(使用Steam作为例子)<br />
<br />
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
为了使用这个架构在一个存在的预设,你可以检查他的注册表文件。如下的命令读了{{ic|~/.wine}}的预设系统注册表并返回{{ic|1=#arch-win32}}或{{ic|1=#arch=win64}}依赖于架构类型。<br />
<br />
$ grep '#arch' ~/.wine/system.reg<br />
<br />
=== 图形驱动程序 ===<br />
<br />
你需要安装 32 位版本的图形驱动程序。请安装[[Xorg (简体中文)#驱动安装]]中 ''OpenGL (multilib)'' 一栏列出的软件包。<br />
<br />
当 Wine 在你的终端窗口中报告以下内容时,很可能你的驱动程序不合适或没有正确配置:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{注意|安装正确的库之后你可能需要重新启动 X。}}<br />
<br />
=== 声音 ===<br />
<br />
默认情况下,运行Wine应用程序时可能会出现声音问题。确保在winecfg中只选择一个声音设备。<br />
<br />
为你要使用的音频驱动器安装正确的软件包:<br />
<br />
* 对于 [[ALSA]] 安装 {{Pkg|lib32-alsa-lib}} 和 {{Pkg|lib32-alsa-plugins}}<br />
* 对于 [[PulseAudio]] 安装 {{Pkg|lib32-libpulse}} <br />
* 对于 [[PipeWire]] 同时安装 {{Pkg|pipewire-pulse}}和 {{Pkg|lib32-libpulse}} 或者 {{Pkg|pipewire-alsa}} 和 {{Pkg|lib32-alsa-lib}} + {{Pkg|lib32-alsa-plugins}}<br />
* 对于 [[OSS]] 安装 {{Pkg|lib32-alsa-oss}}<br />
<br />
额外的软件包:<br />
<br />
使用高级声音系统的游戏(例如TESV: Skyrim)可能还需要安装{{Pkg|lib32-openal}}。<br />
如果winecfg仍然无法检测到音频驱动(Selected driver: (none)),请通过注册表对其进行配置。例如,在64位的wine-1.9.7系统上,麦克风无法在32位的Windows应用程序中工作,这就提供了对声音硬件(声音播放和麦克风)的完全访问:打开regedit,寻找路径HKEY_CURRENT_USER → Software → Wine → Drivers,添加一个名为Audio的字符串,给它一个值alsa。另外,重新创建前缀可能有帮助。<br />
<br />
==== MIDI支持 ====<br />
<br />
在90年代,[[MIDI]]是相当流行的游戏音乐系统。尝试游玩老游戏时,音乐可能无法直接播放。<br />
Wine对MIDI有良好的支持,但首先需要让它在系统上工作,如[[MIDI]]中所解释的。最后,需要确保Wine使用了正确的MIDI输出。<br />
<br />
=== 其它依赖 ===<br />
<br />
对于以下情况,部分应用软件可能需要额外的软件包:<br />
<br />
* 播放音乐: {{Pkg|lib32-mpg123}}<br />
* 原生图像处理库: {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}<br />
* 加密服务: {{Pkg|lib32-gnutls}}<br />
* 32位视频编解码器: {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}<br />
* NTLM身份验证: {{Pkg|samba}}<br />
<br />
=== 字体 ===<br />
<br />
如果 Wine 应用程序没有显示易读的字体,则可能没有安装任何字体。轻松链接所有的系统字体,使其可以从Wine:<br />
<br />
$ cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; done<br />
<br />
Wine 使用 FreeType 渲染字体,而 FreeType 的默认设置在几个版本之前已经改变了。尝试在Wine项目中使用这种环境设置:<br />
<br />
FREETYPE_PROPERTIES="truetype:interpreter-version=35"<br />
<br />
另一种可能性是在Wine前缀中安装微软的 TrueType 字体。 See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
运行此类程序后,关闭所有 Wine 服务并运行{{ic| winecfg }}。字体现在应该是可读的。<br />
<br />
如果字体看起来模糊不清,导入以下文本文件到 Wine 注册表[https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
Windows Registry Editor Version 5.00<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
对于高分辨率显示,可以在 winecfg 中调整 dpi 值。<br />
<br />
另见[[Font configuration#Applications without fontconfig support]]。<br />
<br />
==== 启用平滑字体 ====<br />
<br />
提高Wine渲染效果的一个好方法是使用cleartype平滑字体。<br />
若要启用“次像素平滑(ClearType) RGB”:<br />
<br />
{{bc|<nowiki><br />
$ cat << EOF > /tmp/fontsmoothing<br />
REGEDIT4<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingOrientation"=dword:00000001<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
EOF<br />
<br />
$ WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null<br />
</nowiki>}}<br />
<br />
详见[https://askubuntu.com/a/219795]。<br />
<br />
=== 桌面启动器 ===<br />
<br />
当使用 Windows 应用安装程序创建一个快捷方式时,Wine 会创建 [[.desktop]] 文件。Arch Linux 中这些文件的默认位置是:<br />
<br />
* 桌面快捷方式位于 {{ic|~/Desktop}} 下。<br />
* 开始菜单图标位于 {{ic|~/.local/share/applications/wine/Programs/}} 下。<br />
<br />
{{Note|1=Wine 不支持为所有用户安装 Winidows 应用程序,所以 Wine 不会把 ''.desktop'' 文件放到 {{ic|/usr/share/applications}} 下。详见 WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}<br />
<br />
{{Tip|如果安装软件时桌面启动器并没有创建或已经丢失,{{ic|wine winemenubuilder}} 也许能帮得上忙。}}<br />
<br />
==== 为Wine utilities创建菜单项 ====<br />
<br />
默认情况下,Wine 的安装不会为 Wine 附带的软件创建桌面菜单/图标(例如“ winecfg”、“ winebroserer”等)。这可以通过安装 {{AUR|wine-installer}}或 {{AUR|wine-installer-git}} meta-package (后者没有附加依赖项)来实现,否则这些说明将为这些应用程序添加条目。<br />
<br />
首先,使用 Wine 安装一个 Windows 程序来创建基本菜单。创建基本菜单后,可以在 {{ic|~/.local/share/applications/wine/}}:<br />
<br />
{{hc|wine-browsedrive.desktop|2=<br />
[Desktop Entry]<br />
Name=Browse C: Drive<br />
Comment=Browse your virtual C: drive<br />
Exec=wine winebrowser c:<br />
Terminal=false<br />
Type=Application<br />
Icon=folder-wine<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-uninstaller.desktop|2=<br />
[Desktop Entry]<br />
Name=Uninstall Wine Software<br />
Comment=Uninstall Windows applications for Wine<br />
Exec=wine uninstaller<br />
Terminal=false<br />
Type=Application<br />
Icon=wine-uninstaller<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-winecfg.desktop|2=<br />
[Desktop Entry]<br />
Name=Configure Wine<br />
Comment=Change application-specific and general Wine options<br />
Exec=winecfg<br />
Terminal=false<br />
Icon=wine-winecfg<br />
Type=Application<br />
Categories=Wine;<br />
}}<br />
<br />
并在{{ic|~/.config/menus/applications-merged/}}目录下创建如下文件:<br />
<br />
{{hc|wine.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Category>Wine</Category><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
<br />
如果这些设置产生了一个难看的/不存在的图标,这意味着在您所启用的图标集中没有这些启动程序的图标。您应该将图标设置替换为所需图标的位置。单击启动器属性菜单中的图标将会产生同样的效果。一个支持这些快捷方式的图标集是[https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors]。<br />
<br />
==== Removing menu entries ====<br />
<br />
由 Wine 创建的菜单条目位于 {{ic|~/.local/share/applications/wine/Programs/}}.<br />
除了通过 Wine 删除不需要的扩展绑定,还可以执行以下命令(摘自 Wine 官网) :<br />
<br />
$ rm ~/.local/share/mime/packages/x-wine*<br />
$ rm ~/.local/share/applications/wine-extension*<br />
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
$ rm ~/.local/share/mime/application/x-wine-extension*<br />
<br />
Sometimes you should also remove {{ic|wine-*.menu}} files from {{ic|/.config/menus/}} to completely remove items from wine submenu in kde.<br />
<br />
=== 主题 ===<br />
<br />
类似于 xp 外观的主题可以在这里 [https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 下载]. To install it, see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files this upstream wiki article]. Lastly, use ''winecfg'' to select it.<br />
<br />
{{Note|上面链接的主题只能安装在32位前缀上,前缀版本为 windowsxp。要将其安装在64位前缀上,可能需要创建一个临时的32位前缀,install the theme and copy the {{ic|Zune}} folder and {{ic|Zune.theme}} files from {{ic|drive_c/Windows/Resources/Themes}} in that prefix to the same location in your usual prefix.}}<br />
<br />
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.<br />
<br />
=== 打印 ===<br />
<br />
In order to use your installed printers (both local and network) with wine applications in ''win32 prefixes'' (e.g. MS Word), install the {{Pkg|lib32-libcups}} package, reboot wine (''wineboot'') and restart your wine application.<br />
<br />
=== 网络 ===<br />
<br />
After installation, the {{pkg|lib32-gnutls}} package may need to be [[install]]ed for applications making TLS or HTTPS connections to work.<br />
<br />
For ICMP (ping), Wine may need the network access as described in the [https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
<br />
If issues arise after this (such as an unhandled exception or privileged instruction), remove via:<br />
<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== 使用 ==<br />
<br />
{{警告|不要以 root 身份运行或安装 Wine 应用程序!详见 [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ]。}}<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Using_Wine Wine User's Guide] for general information on Wine usage.<br />
<br />
See [https://appdb.winehq.org/ Wine Application Database (AppDB)] for additional information on specific Windows applications in Wine.<br />
<br />
=== Wayland ===<br />
<br />
Wine 当前并不直接支持 Wayland,但你可以使用 [[Wayland#XWayland|XWayland]]。<br />
<br />
There are some efforts to support Wayland though:<br />
<br />
* Experimental Wayland driver for Wine, which supports using OpenGL- and Windows GDI-applications. See [https://www.winehq.org/pipermail/wine-devel/2020-December/178575.html this] and [https://www.winehq.org/pipermail/wine-devel/2021-February/181325.html this] wine-devel maillist entries.<br />
* [https://github.com/varmd/wine-wayland wine-wayland]: a custom version of Wine, which supports Wayland via Vulkan (so it supports only: DirectX 9, 10 and 11 via [[#DXVK]] and Vulkan-compatible applications).<br />
<br />
== 提示与技巧 ==<br />
<br />
=== Wineconsole ===<br />
<br />
通常情况下,你可能需要运行.exe来修补游戏文件,例如一个老游戏的宽屏mod,通过Wine正常运行.exe可能不会产生任何效果。在这种情况下,你可以打开一个终端,运行以下命令。<br />
<br />
$ wineconsole cmd<br />
<br />
然后转到该目录,从那里运行''.exe''文件。<br />
<br />
=== Winetricks ===<br />
<br />
[https://wiki.winehq.org/Winetricks Winetricks] is a script to allow one to install base requirements needed to run Windows programs. Installable components include DirectX 9.x, MSXML (required by Microsoft Office 2007 and Internet Explorer), Visual Runtime libraries and many more.<br />
<br />
[[Install]] the {{pkg|winetricks}} package (or alternatively {{AUR|winetricks-git}}). Then run it with:<br />
$ winetricks<br />
<br />
For using GUI you should [[install]] the {{pkg|zenity}}.<br />
<br />
=== 性能 ===<br />
<br />
==== CSMT ====<br />
<br />
CSMT is a technology used by Wine to use a separate thread for the OpenGL calls to improve performance noticeably. Since Wine 3.2, CSMT is enabled by default. However, CSMT support needs to be enabled manually for Wine versions lower than 3.2. For vanilla Wine run {{ic|wine regedit}} and set the DWORD value for ''HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt'' to 0x01 (enabled). For wine-staging run {{ic|winecfg}} and enable it in the staging tab.<br />
<br />
Note that CSMT may actually hurt performance for some applications - if this is the case, disable it by creating/setting the registry value to 0x00 (disabled).<br />
<br />
Further information:<br />
*[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion] with the CSMT developer Stefan Dösinger<br />
<br />
==== 强制使用OpenGL模式运行游戏 ====<br />
<br />
Some games might have an OpenGL mode which ''may'' perform better than their default DirectX mode. While the steps to enable OpenGL rendering is ''application specific'', many games accept the {{Ic|-opengl}} parameter.<br />
<br />
$ wine ''/path/to/3d_game.exe'' -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [https://appdb.winehq.org AppDB] for such application specific information.<br />
<br />
==== DXVK ====<br />
<br />
[https://github.com/doitsujin/dxvk DXVK] is a promising new implementation for DirectX 9, 10 & 11 over Vulkan. This should allow for greater performance, and in some cases, even better compatibility. Battlefield 1 for example, only runs under DXVK. On the other hand, DXVK does not support all Wine games (yet).<br />
<br />
To use it, install {{aur|dxvk-bin}}. Then run the following command to activate it in your Wineprefix (by default {{ic|~/.wine}}):<br />
<br />
$ WINEPREFIX=''your-prefix'' setup_dxvk install<br />
<br />
{{Warning|DXVK overrides the DirectX 10 and 11 DLLs, which may be considered cheating in online multiplayer games, and may get your account '''banned'''. Use at your own risk!}}<br />
<br />
==== Gallium Nine ====<br />
<br />
With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.<br />
<br />
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any Wine version. Use {{ic|wine ninewinecfg}} to check if it is enabled.<br />
<br />
For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. [[Export]] the following environment variable before running Wine: <br />
<br />
MESA_LOADER_DRIVER_OVERRIDE=crocus<br />
<br />
=== Unregister existing Wine file associations ===<br />
<br />
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.<br />
<br />
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
$ update-mime-database ~/.local/share/mime/<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Prevent Wine from creating filetype associations ===<br />
<br />
{{Note|This has to be done for each WINEPREFIX which should not update file associations unless you opt to change {{ic|/usr/share/wine/wine.inf}} .}}<br />
This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).<br />
<br />
If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See [https://wiki.winehq.org/FAQ#How_can_I_prevent_Wine_from_changing_the_filetype_associations_on_my_system_or_adding_unwanted_menu_entries.2Fdesktop_links.3F Wine FAQ]<br />
<br />
To make the same change via registry add the string {{ic|Enable}} with value {{ic|N}} under:<br />
<br />
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations<br />
<br />
''You might have to create the key {{ic|FileOpenAssociations}} first!''<br />
<br />
To make this change via the command-line, run the following command:<br />
<br />
$ wine reg add "HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations" /v Enable /d N<br />
<br />
If you want to apply this by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}} and add this line for example under the {{ic|[Services]}} section:<br />
HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"<br />
<br />
To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:<br />
<br />
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=<br />
<br />
[Trigger]<br />
Operation = Install<br />
Operation = Upgrade<br />
Type = Path<br />
Target = usr/share/wine/wine.inf<br />
<br />
[Action]<br />
Description = Stopping Wine from hijacking file associations...<br />
When = PostTransaction<br />
<nowiki>Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'</nowiki><br />
}}<br />
<br />
See [[Pacman#Hooks]]<br />
<br />
=== 自动使用 Wine 执行 Windows 程序 ===<br />
<br />
{{pkg|wine}} 软件包会安装一个 ''binfmt'' 文件,这可使你能够直接运行 Windows 程序,例如,{{ic|''./myprogram.exe''}} 将与 {{ic|wine ''./myprogram.exe''}} 效果相同。服务默认在开机时启动,如果在安装 Wine 之后还没有重启过,[[启动]] {{ic|systemd-binfmt.service}} 即可。<br />
<br />
{{注意|确保 Windows 程序[[executable|可执行]],否则程序将不会运行。}}<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). [[CDemu]] will handle it correctly.<br />
<br />
=== 游戏内显示帧数 ===<br />
<br />
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.<br />
<br />
=== 在单独的用户帐户下运行 Wine ===<br />
<br />
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.<br />
<br />
First, create a [[user account]] for Wine:<br />
<br />
# useradd -m -s /bin/bash wineuser<br />
<br />
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...<br />
<br />
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information on how to execute the {{ic|xhost}} command under your main user.}}<br />
<br />
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:<br />
<br />
$ xhost +SI:localuser:wineuser<br />
<br />
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:<br />
<br />
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''<br />
<br />
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:<br />
{{hc|1=/usr/local/bin/runaswine|2=<br />
#!/bin/bash<br />
xhost +SI:localuser:wineuser<br />
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}<br />
<br />
Wine applications can then be launched via:<br />
<br />
$ runaswine ''"C:\path\to\application.exe"''<br />
<br />
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.<br />
<br />
It is recommended to run {{ic|winecfg}} as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.<br />
<br />
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to share a PulseAudio daemon]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.<br />
<br />
=== Temp directory on tmpfs ===<br />
<br />
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:<br />
<br />
$ rm -r ~/.wine/drive_c/users/$USER/Temp ~/.wine/drive_c/windows/temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/windows/temp<br />
<br />
=== Prevent installing Mono/Gecko ===<br />
<br />
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.<br />
<br />
=== Vulkan ===<br />
<br />
The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].<br />
<br />
=== Remove Wine file bindings ===<br />
<br />
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).<br />
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}<br />
<br />
NoExtract = usr/lib/binfmt.d/wine.conf<br />
NoExtract = usr/share/applications/wine.desktop<br />
<br />
=== WineASIO ===<br />
<br />
If you need professional audio support under wine you can use {{Aur|wineasio}} which provides an ASIO interface for wine that you can then use with [[JACK]].<br />
<br />
In order to use wineasio you must add yourself to the {{ic|realtime}} [[user group]].<br />
<br />
Next you need to register wineasio in your desired wine prefix. Register the 32-bit and/or 64-bit version as needed:<br />
$ regsvr32 /usr/lib32/wine/i386-windows/wineasio.dll<br />
$ wine64 regsvr32 /usr/lib/wine/x86_64-windows/wineasio.dll<br />
<br />
== 疑难解答 ==<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Troubleshooting_.2F_Reporting_bugs Wine User's Guide] and [https://wiki.winehq.org/FAQ Wine FAQ] (especially its [https://wiki.winehq.org/FAQ#Troubleshooting Troubleshooting] section) for general tips.<br />
<br />
Also refer to the [https://appdb.winehq.org/ Wine AppDB] for an advice on specific applications.<br />
<br />
=== XWayland问题 ===<br />
<br />
If you use Wine under [[Wayland#XWayland|XWayland]], you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:<br />
<br />
* flickering;<br />
* wrong window location;<br />
* wrong mouse cursor location and clicks;<br />
* keyboard detection.<br />
<br />
=== 键盘输入不工作 ===<br />
<br />
This could be caused by the window manager not switching focus. In the ''Graphics'' tab of ''winecfg'', disable the 'Allow the window manager...' options, or set windowed mode with 'Emulate a virtual desktop'.<br />
*Some suggest to toggle all the ''Window settings'', click ''Apply'', then change them back. If that does not work, try the above.<br />
<br />
If the keyboard does not work after unfocusing the application, try editing the registry:<br />
*Under ''HKEY_CURRENT_USER\Software\Wine\X11 Driver'', add a string value ''UseTakeFocus'' and set it to ''N''.<br />
*Alternatively, you can use winetricks to set the value.<br />
winetricks usetakefocus=n<br />
<br />
== 参见 ==<br />
<br />
* [https://www.winehq.org/ Wine Homepage]<br />
* [https://wiki.winehq.org/ Wine Wiki]<br />
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
* [[Gentoo:Wine]]<br />
* [https://www.darlinghq.org/ Darling] - a similar project for MacOS software<br />
* [https://github.com/wineasio/wineasio WineASIO] - GitHub page of the WineASIO project with further information</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=738848Wine (简体中文)2022-07-24T09:28:55Z<p>InsaneGuo: /* 声音 */ 翻译</p>
<hr />
<div>[[Category:Emulation (简体中文)]]<br />
[[Category:Gaming (简体中文)]]<br />
[[de:Wine]]<br />
[[en:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
{{Related articles start}}<br />
{{Related|CrossOver}}<br />
{{Related|Deepin-wine}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
{{translateme (简体中文)|进度:35%}}<br />
{{TranslationStatus (简体中文)|Wine|2022-04-19|724914}}<br />
<br />
[[Wikipedia:Wine (software)|Wine]] 是一款可以在类 Unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而没有模拟器的性能/内存损失。<br />
<br />
{{警告|<br />
* Wine 并非与你的系统隔离。<br />
* 如果你可以使用你的用户帐户访问某个文件或资源,那么在 Wine 中运行的程序也可以。参见[[#在单独的用户帐户下运行 Wine]]和[[安全#沙盒程序]]了解可能的预防措施。<br />
* Wine 也可以运行恶意软件(参见 [https://wiki.winehq.org/FAQ#Is_Wine_malware-compatible.3F Wine 关于恶意软件兼容性的 FAQ])}}<br />
<br />
== 安装 ==<br />
<br />
首先启用[[multilib]]仓库,然后[[install|安装]] {{Pkg|wine}}(开发版),{{AUR|wine-stable}}(稳定版)或 {{Pkg|wine-staging}}(测试版本)。[https://wine-staging.com/ Wine Staging] 是 [https://www.winehq.org/ Wine] 的修补版本, 其中包含了漏洞修复和尚未集成到稳定或开发分支中的特性。<br />
<br />
其它需求见[[#图形驱动程序]]和[[#声音]]。<br />
<br />
可以考虑为依赖于 Internet Explorer 和 .NET 的应用程序分别安装 {{pkg|wine-gecko}} 和 {{pkg|wine-mono}}。这两个软件包不是一定要安装的,因为 Wine 会根据需要自行下载相关文件。反过来说,如果提前安装了软件包,Wine 就不需要再下载这些文件了。<br />
<br />
== 配置 ==<br />
<br />
配置 Wine 通常使用以下方法:<br />
<br />
* [https://wiki.winehq.org/Winecfg winecfg] 是 Wine 的 GUI 配置工具,可以通过运行 {{ic|winecfg}} 来启动。<br />
* [https://wiki.winehq.org/Regedit regedit] 是 Wine 的注册表编辑工具,可以通过运行{{ic|regedit}} 来启动。另见 WineHQ 关于 [https://wiki.winehq.org/Useful_Registry_Keys 有用的注册表键]的文档。<br />
* [https://wiki.winehq.org/Control control] 是 Wine 的 Windows 控制面板的实现,可以通过运行 {{ic|wine control}} 来启动。<br />
* 完整列表见 WineHQ 的[https://wiki.winehq.org/List_of_Commands 命令列表]。<br />
<br />
=== WINEPREFIX ===<br />
<br />
默认情况下,Wine 将其配置文件和安装的 Windows 程序存储在 {{ic|~/.wine}} ,通常会把此目录叫作“Wine prefix”或“Wine bottle”。当您运行 Windows 程序或 Wine 的捆绑程序(如 winecfg)时,它会自动创建/更新。前缀目录还包含一个目录,您的 Windows 程序将其视为 {{ic|c:}} (C盘)。<br />
<br />
您可以使用 {{ic|WINEPREFIX}}环境变量覆盖 Wine 使用的前缀位置。如果您希望为不同的 Windows 程序使用单独的配置,这将非常有用。第一次运行带有新 Wine 前缀的程序时,Wine 将自动创建一个带有 c 驱动器和注册表的目录。<br />
<br />
例如,如果您运行一个带有{{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}的程序,和另一个 {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}这两个程序将分别有一个单独的 c 驱动器和单独的注册。<br />
<br />
{{警告|Wine不是[[Wikipedia:Sandbox (computer security)|沙盒]]!在 Wine 下运行的程序仍然可以访问系统的其余部分!(例如, {{ic|Z:}} 映射到 {{ic|/}}, 与 Wine 前缀无关)}}<br />
<br />
若要在不运行 Windows 程序或其他 GUI 工具的情况下创建默认前缀,可以使用:<br />
<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
Wine将默认启动一个64位环境。你可以改变它使用{{ic|WINEARCH}}[[环境变量]]。改名你的{{ic|~/.wine}}目录并创建一个新的Wine环境通过使用{{ic|1=$WINEARCH=win32 winecfg}}。这将给你一个32位Wine环境。不舍指{{ic|WINEARCH}}将给你一个64位环境。<br />
<br />
你可以通过修改{{ic|WINEPREFIX}}来创建一个分开的{{ic|win32}}和{{ic|win64}}环境:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
你也可以使用{{ic|WINEARCH}}与其它Wine程式合并,例如''winetricks''(使用Steam作为例子)<br />
<br />
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
为了使用这个架构在一个存在的预设,你可以检查他的注册表文件。如下的命令读了{{ic|~/.wine}}的预设系统注册表并返回{{ic|1=#arch-win32}}或{{ic|1=#arch=win64}}依赖于架构类型。<br />
<br />
$ grep '#arch' ~/.wine/system.reg<br />
<br />
=== 图形驱动程序 ===<br />
<br />
你需要安装 32 位版本的图形驱动程序。请安装[[Xorg (简体中文)#驱动安装]]中 ''OpenGL (multilib)'' 一栏列出的软件包。<br />
<br />
当 Wine 在你的终端窗口中报告以下内容时,很可能你的驱动程序不合适或没有正确配置:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{注意|安装正确的库之后你可能需要重新启动 X。}}<br />
<br />
=== 声音 ===<br />
<br />
默认情况下,运行Wine应用程序时可能会出现声音问题。确保在winecfg中只选择一个声音设备。<br />
<br />
为你要使用的音频驱动器安装正确的软件包:<br />
<br />
* 对于 [[ALSA]] 安装 {{Pkg|lib32-alsa-lib}} 和 {{Pkg|lib32-alsa-plugins}}<br />
* 对于 [[PulseAudio]] 安装 {{Pkg|lib32-libpulse}} <br />
* 对于 [[PipeWire]] 同时安装 {{Pkg|pipewire-pulse}}和 {{Pkg|lib32-libpulse}} 或者 {{Pkg|pipewire-alsa}} 和 {{Pkg|lib32-alsa-lib}} + {{Pkg|lib32-alsa-plugins}}<br />
* 对于 [[OSS]] 安装 {{Pkg|lib32-alsa-oss}}<br />
<br />
额外的软件包:<br />
<br />
使用高级声音系统的游戏(例如TESV: Skyrim)可能还需要安装{{Pkg|lib32-openal}}。<br />
如果winecfg仍然无法检测到音频驱动(Selected driver: (none)),请通过注册表对其进行配置。例如,在64位的wine-1.9.7系统上,麦克风无法在32位的Windows应用程序中工作,这就提供了对声音硬件(声音播放和麦克风)的完全访问:打开regedit,寻找路径HKEY_CURRENT_USER → Software → Wine → Drivers,添加一个名为Audio的字符串,给它一个值alsa。另外,重新创建前缀可能有帮助。<br />
<br />
==== MIDI支持 ====<br />
<br />
在90年代,[[MIDI]]是相当流行的游戏音乐系统。尝试游玩老游戏时,音乐可能无法直接播放。<br />
Wine对MIDI有良好的支持,但首先需要让它在系统上工作,如[[MIDI]]中所解释的。最后,需要确保Wine使用了正确的MIDI输出。<br />
<br />
=== 其它依赖 ===<br />
<br />
对于以下情况,部分应用软件可能需要额外的软件包:<br />
<br />
* 播放音乐: {{Pkg|lib32-mpg123}}<br />
* 原生图像处理库: {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}<br />
* 加密服务: {{Pkg|lib32-gnutls}}<br />
* 32位视频编解码器: {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}<br />
* NTLM身份验证: {{Pkg|samba}}<br />
<br />
=== 字体 ===<br />
<br />
如果 Wine 应用程序没有显示易读的字体,则可能没有安装任何字体。轻松链接所有的系统字体,使其可以从Wine:<br />
<br />
$ cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; done<br />
<br />
Wine 使用 FreeType 渲染字体,而 FreeType 的默认设置在几个版本之前已经改变了。尝试在Wine项目中使用这种环境设置:<br />
<br />
FREETYPE_PROPERTIES="truetype:interpreter-version=35"<br />
<br />
另一种可能性是在Wine前缀中安装微软的 TrueType 字体。 See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
运行此类程序后,关闭所有 Wine 服务并运行{{ic| winecfg }}。字体现在应该是可读的。<br />
<br />
如果字体看起来模糊不清,导入以下文本文件到 Wine 注册表[https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
Windows Registry Editor Version 5.00<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
对于高分辨率显示,可以在 winecfg 中调整 dpi 值。<br />
<br />
另见[[Font configuration#Applications without fontconfig support]]。<br />
<br />
==== 启用平滑字体 ====<br />
<br />
提高Wine渲染效果的一个好方法是使用cleartype平滑字体。<br />
若要启用“次像素平滑(ClearType) RGB”:<br />
<br />
{{bc|<nowiki><br />
$ cat << EOF > /tmp/fontsmoothing<br />
REGEDIT4<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingOrientation"=dword:00000001<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
EOF<br />
<br />
$ WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null<br />
</nowiki>}}<br />
<br />
详见[https://askubuntu.com/a/219795]。<br />
<br />
=== 桌面启动器 ===<br />
<br />
当使用 Windows 应用安装程序创建一个快捷方式时,Wine 会创建 [[.desktop]] 文件。Arch Linux 中这些文件的默认位置是:<br />
<br />
* 桌面快捷方式位于 {{ic|~/Desktop}} 下。<br />
* 开始菜单图标位于 {{ic|~/.local/share/applications/wine/Programs/}} 下。<br />
<br />
{{Note|1=Wine 不支持为所有用户安装 Winidows 应用程序,所以 Wine 不会把 ''.desktop'' 文件放到 {{ic|/usr/share/applications}} 下。详见 WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}<br />
<br />
{{Tip|如果安装软件时桌面启动器并没有创建或已经丢失,{{ic|wine winemenubuilder}} 也许能帮得上忙。}}<br />
<br />
==== 为Wine utilities创建菜单项 ====<br />
<br />
默认情况下,Wine 的安装不会为 Wine 附带的软件创建桌面菜单/图标(例如“ winecfg”、“ winebroserer”等)。这可以通过安装 {{AUR|wine-installer}}或 {{AUR|wine-installer-git}} meta-package (后者没有附加依赖项)来实现,否则这些说明将为这些应用程序添加条目。<br />
<br />
首先,使用 Wine 安装一个 Windows 程序来创建基本菜单。创建基本菜单后,可以在 {{ic|~/.local/share/applications/wine/}}:<br />
<br />
{{hc|wine-browsedrive.desktop|2=<br />
[Desktop Entry]<br />
Name=Browse C: Drive<br />
Comment=Browse your virtual C: drive<br />
Exec=wine winebrowser c:<br />
Terminal=false<br />
Type=Application<br />
Icon=folder-wine<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-uninstaller.desktop|2=<br />
[Desktop Entry]<br />
Name=Uninstall Wine Software<br />
Comment=Uninstall Windows applications for Wine<br />
Exec=wine uninstaller<br />
Terminal=false<br />
Type=Application<br />
Icon=wine-uninstaller<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-winecfg.desktop|2=<br />
[Desktop Entry]<br />
Name=Configure Wine<br />
Comment=Change application-specific and general Wine options<br />
Exec=winecfg<br />
Terminal=false<br />
Icon=wine-winecfg<br />
Type=Application<br />
Categories=Wine;<br />
}}<br />
<br />
并在{{ic|~/.config/menus/applications-merged/}}目录下创建如下文件:<br />
<br />
{{hc|wine.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Category>Wine</Category><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
<br />
如果这些设置产生了一个难看的/不存在的图标,这意味着在您所启用的图标集中没有这些启动程序的图标。您应该将图标设置替换为所需图标的位置。单击启动器属性菜单中的图标将会产生同样的效果。一个支持这些快捷方式的图标集是[https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors]。<br />
<br />
==== Removing menu entries ====<br />
<br />
由 Wine 创建的菜单条目位于 {{ic|~/.local/share/applications/wine/Programs/}}.<br />
除了通过 Wine 删除不需要的扩展绑定,还可以执行以下命令(摘自 Wine 官网) :<br />
<br />
$ rm ~/.local/share/mime/packages/x-wine*<br />
$ rm ~/.local/share/applications/wine-extension*<br />
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
$ rm ~/.local/share/mime/application/x-wine-extension*<br />
<br />
Sometimes you should also remove {{ic|wine-*.menu}} files from {{ic|/.config/menus/}} to completely remove items from wine submenu in kde.<br />
<br />
=== 主题 ===<br />
<br />
类似于 xp 外观的主题可以在这里 [https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 下载]. To install it, see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files this upstream wiki article]. Lastly, use ''winecfg'' to select it.<br />
<br />
{{Note|上面链接的主题只能安装在32位前缀上,前缀版本为 windowsxp。要将其安装在64位前缀上,可能需要创建一个临时的32位前缀,install the theme and copy the {{ic|Zune}} folder and {{ic|Zune.theme}} files from {{ic|drive_c/Windows/Resources/Themes}} in that prefix to the same location in your usual prefix.}}<br />
<br />
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.<br />
<br />
=== 打印 ===<br />
<br />
In order to use your installed printers (both local and network) with wine applications in ''win32 prefixes'' (e.g. MS Word), install the {{Pkg|lib32-libcups}} package, reboot wine (''wineboot'') and restart your wine application.<br />
<br />
=== 网络 ===<br />
<br />
After installation, the {{pkg|lib32-gnutls}} package may need to be [[install]]ed for applications making TLS or HTTPS connections to work.<br />
<br />
For ICMP (ping), Wine may need the network access as described in the [https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
<br />
If issues arise after this (such as an unhandled exception or privileged instruction), remove via:<br />
<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== 使用 ==<br />
<br />
{{警告|不要以 root 身份运行或安装 Wine 应用程序!详见 [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ]。}}<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Using_Wine Wine User's Guide] for general information on Wine usage.<br />
<br />
See [https://appdb.winehq.org/ Wine Application Database (AppDB)] for additional information on specific Windows applications in Wine.<br />
<br />
=== Wayland ===<br />
<br />
Wine 当前并不直接支持 Wayland,但你可以使用 [[Wayland#XWayland|XWayland]]。<br />
<br />
There are some efforts to support Wayland though:<br />
<br />
* Experimental Wayland driver for Wine, which supports using OpenGL- and Windows GDI-applications. See [https://www.winehq.org/pipermail/wine-devel/2020-December/178575.html this] and [https://www.winehq.org/pipermail/wine-devel/2021-February/181325.html this] wine-devel maillist entries.<br />
* [https://github.com/varmd/wine-wayland wine-wayland]: a custom version of Wine, which supports Wayland via Vulkan (so it supports only: DirectX 9, 10 and 11 via [[#DXVK]] and Vulkan-compatible applications).<br />
<br />
== 提示与技巧 ==<br />
<br />
=== Wineconsole ===<br />
<br />
Often you may need to run ''.exe'''s to patch game files, for example a widescreen mod for an old game, and running the ''.exe'' normally through Wine might yield nothing happening. In this case, you can open a terminal and run the following command:<br />
<br />
$ wineconsole cmd<br />
<br />
Then navigate to the directory and run the ''.exe'' file from there.<br />
<br />
=== Winetricks ===<br />
<br />
[https://wiki.winehq.org/Winetricks Winetricks] is a script to allow one to install base requirements needed to run Windows programs. Installable components include DirectX 9.x, MSXML (required by Microsoft Office 2007 and Internet Explorer), Visual Runtime libraries and many more.<br />
<br />
[[Install]] the {{pkg|winetricks}} package (or alternatively {{AUR|winetricks-git}}). Then run it with:<br />
$ winetricks<br />
<br />
For using GUI you should [[install]] the {{pkg|zenity}}.<br />
<br />
=== 性能 ===<br />
<br />
==== CSMT ====<br />
<br />
CSMT is a technology used by Wine to use a separate thread for the OpenGL calls to improve performance noticeably. Since Wine 3.2, CSMT is enabled by default. However, CSMT support needs to be enabled manually for Wine versions lower than 3.2. For vanilla Wine run {{ic|wine regedit}} and set the DWORD value for ''HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt'' to 0x01 (enabled). For wine-staging run {{ic|winecfg}} and enable it in the staging tab.<br />
<br />
Note that CSMT may actually hurt performance for some applications - if this is the case, disable it by creating/setting the registry value to 0x00 (disabled).<br />
<br />
Further information:<br />
*[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion] with the CSMT developer Stefan Dösinger<br />
<br />
==== 强制使用OpenGL模式运行游戏 ====<br />
<br />
Some games might have an OpenGL mode which ''may'' perform better than their default DirectX mode. While the steps to enable OpenGL rendering is ''application specific'', many games accept the {{Ic|-opengl}} parameter.<br />
<br />
$ wine ''/path/to/3d_game.exe'' -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [https://appdb.winehq.org AppDB] for such application specific information.<br />
<br />
==== DXVK ====<br />
<br />
[https://github.com/doitsujin/dxvk DXVK] is a promising new implementation for DirectX 9, 10 & 11 over Vulkan. This should allow for greater performance, and in some cases, even better compatibility. Battlefield 1 for example, only runs under DXVK. On the other hand, DXVK does not support all Wine games (yet).<br />
<br />
To use it, install {{aur|dxvk-bin}}. Then run the following command to activate it in your Wineprefix (by default {{ic|~/.wine}}):<br />
<br />
$ WINEPREFIX=''your-prefix'' setup_dxvk install<br />
<br />
{{Warning|DXVK overrides the DirectX 10 and 11 DLLs, which may be considered cheating in online multiplayer games, and may get your account '''banned'''. Use at your own risk!}}<br />
<br />
==== Gallium Nine ====<br />
<br />
With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.<br />
<br />
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any Wine version. Use {{ic|wine ninewinecfg}} to check if it is enabled.<br />
<br />
For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. [[Export]] the following environment variable before running Wine: <br />
<br />
MESA_LOADER_DRIVER_OVERRIDE=crocus<br />
<br />
=== Unregister existing Wine file associations ===<br />
<br />
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.<br />
<br />
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
$ update-mime-database ~/.local/share/mime/<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Prevent Wine from creating filetype associations ===<br />
<br />
{{Note|This has to be done for each WINEPREFIX which should not update file associations unless you opt to change {{ic|/usr/share/wine/wine.inf}} .}}<br />
This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).<br />
<br />
If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See [https://wiki.winehq.org/FAQ#How_can_I_prevent_Wine_from_changing_the_filetype_associations_on_my_system_or_adding_unwanted_menu_entries.2Fdesktop_links.3F Wine FAQ]<br />
<br />
To make the same change via registry add the string {{ic|Enable}} with value {{ic|N}} under:<br />
<br />
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations<br />
<br />
''You might have to create the key {{ic|FileOpenAssociations}} first!''<br />
<br />
To make this change via the command-line, run the following command:<br />
<br />
$ wine reg add "HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations" /v Enable /d N<br />
<br />
If you want to apply this by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}} and add this line for example under the {{ic|[Services]}} section:<br />
HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"<br />
<br />
To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:<br />
<br />
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=<br />
<br />
[Trigger]<br />
Operation = Install<br />
Operation = Upgrade<br />
Type = Path<br />
Target = usr/share/wine/wine.inf<br />
<br />
[Action]<br />
Description = Stopping Wine from hijacking file associations...<br />
When = PostTransaction<br />
<nowiki>Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'</nowiki><br />
}}<br />
<br />
See [[Pacman#Hooks]]<br />
<br />
=== 自动使用 Wine 执行 Windows 程序 ===<br />
<br />
{{pkg|wine}} 软件包会安装一个 ''binfmt'' 文件,这可使你能够直接运行 Windows 程序,例如,{{ic|''./myprogram.exe''}} 将与 {{ic|wine ''./myprogram.exe''}} 效果相同。服务默认在开机时启动,如果在安装 Wine 之后还没有重启过,[[启动]] {{ic|systemd-binfmt.service}} 即可。<br />
<br />
{{注意|确保 Windows 程序[[executable|可执行]],否则程序将不会运行。}}<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). [[CDemu]] will handle it correctly.<br />
<br />
=== 游戏内显示帧数 ===<br />
<br />
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.<br />
<br />
=== 在单独的用户帐户下运行 Wine ===<br />
<br />
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.<br />
<br />
First, create a [[user account]] for Wine:<br />
<br />
# useradd -m -s /bin/bash wineuser<br />
<br />
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...<br />
<br />
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information on how to execute the {{ic|xhost}} command under your main user.}}<br />
<br />
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:<br />
<br />
$ xhost +SI:localuser:wineuser<br />
<br />
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:<br />
<br />
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''<br />
<br />
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:<br />
{{hc|1=/usr/local/bin/runaswine|2=<br />
#!/bin/bash<br />
xhost +SI:localuser:wineuser<br />
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}<br />
<br />
Wine applications can then be launched via:<br />
<br />
$ runaswine ''"C:\path\to\application.exe"''<br />
<br />
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.<br />
<br />
It is recommended to run {{ic|winecfg}} as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.<br />
<br />
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to share a PulseAudio daemon]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.<br />
<br />
=== Temp directory on tmpfs ===<br />
<br />
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:<br />
<br />
$ rm -r ~/.wine/drive_c/users/$USER/Temp ~/.wine/drive_c/windows/temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/windows/temp<br />
<br />
=== Prevent installing Mono/Gecko ===<br />
<br />
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.<br />
<br />
=== Vulkan ===<br />
<br />
The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].<br />
<br />
=== Remove Wine file bindings ===<br />
<br />
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).<br />
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}<br />
<br />
NoExtract = usr/lib/binfmt.d/wine.conf<br />
NoExtract = usr/share/applications/wine.desktop<br />
<br />
=== WineASIO ===<br />
<br />
If you need professional audio support under wine you can use {{Aur|wineasio}} which provides an ASIO interface for wine that you can then use with [[JACK]].<br />
<br />
In order to use wineasio you must add yourself to the {{ic|realtime}} [[user group]].<br />
<br />
Next you need to register wineasio in your desired wine prefix. Register the 32-bit and/or 64-bit version as needed:<br />
$ regsvr32 /usr/lib32/wine/i386-windows/wineasio.dll<br />
$ wine64 regsvr32 /usr/lib/wine/x86_64-windows/wineasio.dll<br />
<br />
== 疑难解答 ==<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Troubleshooting_.2F_Reporting_bugs Wine User's Guide] and [https://wiki.winehq.org/FAQ Wine FAQ] (especially its [https://wiki.winehq.org/FAQ#Troubleshooting Troubleshooting] section) for general tips.<br />
<br />
Also refer to the [https://appdb.winehq.org/ Wine AppDB] for an advice on specific applications.<br />
<br />
=== XWayland问题 ===<br />
<br />
If you use Wine under [[Wayland#XWayland|XWayland]], you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:<br />
<br />
* flickering;<br />
* wrong window location;<br />
* wrong mouse cursor location and clicks;<br />
* keyboard detection.<br />
<br />
=== 键盘输入不工作 ===<br />
<br />
This could be caused by the window manager not switching focus. In the ''Graphics'' tab of ''winecfg'', disable the 'Allow the window manager...' options, or set windowed mode with 'Emulate a virtual desktop'.<br />
*Some suggest to toggle all the ''Window settings'', click ''Apply'', then change them back. If that does not work, try the above.<br />
<br />
If the keyboard does not work after unfocusing the application, try editing the registry:<br />
*Under ''HKEY_CURRENT_USER\Software\Wine\X11 Driver'', add a string value ''UseTakeFocus'' and set it to ''N''.<br />
*Alternatively, you can use winetricks to set the value.<br />
winetricks usetakefocus=n<br />
<br />
== 参见 ==<br />
<br />
* [https://www.winehq.org/ Wine Homepage]<br />
* [https://wiki.winehq.org/ Wine Wiki]<br />
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
* [[Gentoo:Wine]]<br />
* [https://www.darlinghq.org/ Darling] - a similar project for MacOS software<br />
* [https://github.com/wineasio/wineasio WineASIO] - GitHub page of the WineASIO project with further information</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=738847Wine (简体中文)2022-07-24T09:27:16Z<p>InsaneGuo: /* 声音 */ 翻译</p>
<hr />
<div>[[Category:Emulation (简体中文)]]<br />
[[Category:Gaming (简体中文)]]<br />
[[de:Wine]]<br />
[[en:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
{{Related articles start}}<br />
{{Related|CrossOver}}<br />
{{Related|Deepin-wine}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
{{translateme (简体中文)|进度:35%}}<br />
{{TranslationStatus (简体中文)|Wine|2022-04-19|724914}}<br />
<br />
[[Wikipedia:Wine (software)|Wine]] 是一款可以在类 Unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而没有模拟器的性能/内存损失。<br />
<br />
{{警告|<br />
* Wine 并非与你的系统隔离。<br />
* 如果你可以使用你的用户帐户访问某个文件或资源,那么在 Wine 中运行的程序也可以。参见[[#在单独的用户帐户下运行 Wine]]和[[安全#沙盒程序]]了解可能的预防措施。<br />
* Wine 也可以运行恶意软件(参见 [https://wiki.winehq.org/FAQ#Is_Wine_malware-compatible.3F Wine 关于恶意软件兼容性的 FAQ])}}<br />
<br />
== 安装 ==<br />
<br />
首先启用[[multilib]]仓库,然后[[install|安装]] {{Pkg|wine}}(开发版),{{AUR|wine-stable}}(稳定版)或 {{Pkg|wine-staging}}(测试版本)。[https://wine-staging.com/ Wine Staging] 是 [https://www.winehq.org/ Wine] 的修补版本, 其中包含了漏洞修复和尚未集成到稳定或开发分支中的特性。<br />
<br />
其它需求见[[#图形驱动程序]]和[[#声音]]。<br />
<br />
可以考虑为依赖于 Internet Explorer 和 .NET 的应用程序分别安装 {{pkg|wine-gecko}} 和 {{pkg|wine-mono}}。这两个软件包不是一定要安装的,因为 Wine 会根据需要自行下载相关文件。反过来说,如果提前安装了软件包,Wine 就不需要再下载这些文件了。<br />
<br />
== 配置 ==<br />
<br />
配置 Wine 通常使用以下方法:<br />
<br />
* [https://wiki.winehq.org/Winecfg winecfg] 是 Wine 的 GUI 配置工具,可以通过运行 {{ic|winecfg}} 来启动。<br />
* [https://wiki.winehq.org/Regedit regedit] 是 Wine 的注册表编辑工具,可以通过运行{{ic|regedit}} 来启动。另见 WineHQ 关于 [https://wiki.winehq.org/Useful_Registry_Keys 有用的注册表键]的文档。<br />
* [https://wiki.winehq.org/Control control] 是 Wine 的 Windows 控制面板的实现,可以通过运行 {{ic|wine control}} 来启动。<br />
* 完整列表见 WineHQ 的[https://wiki.winehq.org/List_of_Commands 命令列表]。<br />
<br />
=== WINEPREFIX ===<br />
<br />
默认情况下,Wine 将其配置文件和安装的 Windows 程序存储在 {{ic|~/.wine}} ,通常会把此目录叫作“Wine prefix”或“Wine bottle”。当您运行 Windows 程序或 Wine 的捆绑程序(如 winecfg)时,它会自动创建/更新。前缀目录还包含一个目录,您的 Windows 程序将其视为 {{ic|c:}} (C盘)。<br />
<br />
您可以使用 {{ic|WINEPREFIX}}环境变量覆盖 Wine 使用的前缀位置。如果您希望为不同的 Windows 程序使用单独的配置,这将非常有用。第一次运行带有新 Wine 前缀的程序时,Wine 将自动创建一个带有 c 驱动器和注册表的目录。<br />
<br />
例如,如果您运行一个带有{{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}的程序,和另一个 {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}这两个程序将分别有一个单独的 c 驱动器和单独的注册。<br />
<br />
{{警告|Wine不是[[Wikipedia:Sandbox (computer security)|沙盒]]!在 Wine 下运行的程序仍然可以访问系统的其余部分!(例如, {{ic|Z:}} 映射到 {{ic|/}}, 与 Wine 前缀无关)}}<br />
<br />
若要在不运行 Windows 程序或其他 GUI 工具的情况下创建默认前缀,可以使用:<br />
<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
Wine将默认启动一个64位环境。你可以改变它使用{{ic|WINEARCH}}[[环境变量]]。改名你的{{ic|~/.wine}}目录并创建一个新的Wine环境通过使用{{ic|1=$WINEARCH=win32 winecfg}}。这将给你一个32位Wine环境。不舍指{{ic|WINEARCH}}将给你一个64位环境。<br />
<br />
你可以通过修改{{ic|WINEPREFIX}}来创建一个分开的{{ic|win32}}和{{ic|win64}}环境:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
你也可以使用{{ic|WINEARCH}}与其它Wine程式合并,例如''winetricks''(使用Steam作为例子)<br />
<br />
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
为了使用这个架构在一个存在的预设,你可以检查他的注册表文件。如下的命令读了{{ic|~/.wine}}的预设系统注册表并返回{{ic|1=#arch-win32}}或{{ic|1=#arch=win64}}依赖于架构类型。<br />
<br />
$ grep '#arch' ~/.wine/system.reg<br />
<br />
=== 图形驱动程序 ===<br />
<br />
你需要安装 32 位版本的图形驱动程序。请安装[[Xorg (简体中文)#驱动安装]]中 ''OpenGL (multilib)'' 一栏列出的软件包。<br />
<br />
当 Wine 在你的终端窗口中报告以下内容时,很可能你的驱动程序不合适或没有正确配置:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{注意|安装正确的库之后你可能需要重新启动 X。}}<br />
<br />
=== 声音 ===<br />
<br />
默认情况下,运行Wine应用程序时可能会出现声音问题。确保在winecfg中只选择一个声音设备。<br />
<br />
为你要使用的音频驱动器安装正确的软件包:<br />
<br />
* 对于 [[ALSA]] 安装 {{Pkg|lib32-alsa-lib}} 和 {{Pkg|lib32-alsa-plugins}}<br />
* 对于 [[PulseAudio]] 安装 {{Pkg|lib32-libpulse}} <br />
* 对于 [[PipeWire]] 同时安装 {{Pkg|pipewire-pulse}}和 {{Pkg|lib32-libpulse}} 或者 {{Pkg|pipewire-alsa}} 和 {{Pkg|lib32-alsa-lib}} + {{Pkg|lib32-alsa-plugins}}<br />
* 对于 [[OSS]] 安装 {{Pkg|lib32-alsa-oss}}<br />
<br />
Additional packages: <br />
<br />
* Games that use advanced sound systems (''e.g.'' TESV: Skyrim) may additionally require installations of {{Pkg|lib32-openal}}.<br />
<br />
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [https://wiki.winehq.org/Wine_User's_Guide#Using_Regedit configure it via the registry]. For example, in a case where the microphone was not working in a 32-bit Windows application on a 64-bit stock install of wine-1.9.7, this provided full access to the sound hardware (sound playback and mic): open ''regedit'', look for the key HKEY_CURRENT_USER → Software → Wine → Drivers, and add a string called ''Audio'' and give it the value ''alsa''. Also, it may help to [[#WINEARCH|recreate the prefix]].<br />
<br />
==== MIDI支持 ====<br />
<br />
在90年代,[[MIDI]]是相当流行的游戏音乐系统。尝试游玩老游戏时,音乐可能无法直接播放。<br />
Wine对MIDI有良好的支持,但首先需要让它在系统上工作,如[[MIDI]]中所解释的。最后,需要确保Wine使用了正确的MIDI输出。<br />
<br />
=== 其它依赖 ===<br />
<br />
对于以下情况,部分应用软件可能需要额外的软件包:<br />
<br />
* 播放音乐: {{Pkg|lib32-mpg123}}<br />
* 原生图像处理库: {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}<br />
* 加密服务: {{Pkg|lib32-gnutls}}<br />
* 32位视频编解码器: {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}<br />
* NTLM身份验证: {{Pkg|samba}}<br />
<br />
=== 字体 ===<br />
<br />
如果 Wine 应用程序没有显示易读的字体,则可能没有安装任何字体。轻松链接所有的系统字体,使其可以从Wine:<br />
<br />
$ cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; done<br />
<br />
Wine 使用 FreeType 渲染字体,而 FreeType 的默认设置在几个版本之前已经改变了。尝试在Wine项目中使用这种环境设置:<br />
<br />
FREETYPE_PROPERTIES="truetype:interpreter-version=35"<br />
<br />
另一种可能性是在Wine前缀中安装微软的 TrueType 字体。 See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
运行此类程序后,关闭所有 Wine 服务并运行{{ic| winecfg }}。字体现在应该是可读的。<br />
<br />
如果字体看起来模糊不清,导入以下文本文件到 Wine 注册表[https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
Windows Registry Editor Version 5.00<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
对于高分辨率显示,可以在 winecfg 中调整 dpi 值。<br />
<br />
另见[[Font configuration#Applications without fontconfig support]]。<br />
<br />
==== 启用平滑字体 ====<br />
<br />
提高Wine渲染效果的一个好方法是使用cleartype平滑字体。<br />
若要启用“次像素平滑(ClearType) RGB”:<br />
<br />
{{bc|<nowiki><br />
$ cat << EOF > /tmp/fontsmoothing<br />
REGEDIT4<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingOrientation"=dword:00000001<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
EOF<br />
<br />
$ WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null<br />
</nowiki>}}<br />
<br />
详见[https://askubuntu.com/a/219795]。<br />
<br />
=== 桌面启动器 ===<br />
<br />
当使用 Windows 应用安装程序创建一个快捷方式时,Wine 会创建 [[.desktop]] 文件。Arch Linux 中这些文件的默认位置是:<br />
<br />
* 桌面快捷方式位于 {{ic|~/Desktop}} 下。<br />
* 开始菜单图标位于 {{ic|~/.local/share/applications/wine/Programs/}} 下。<br />
<br />
{{Note|1=Wine 不支持为所有用户安装 Winidows 应用程序,所以 Wine 不会把 ''.desktop'' 文件放到 {{ic|/usr/share/applications}} 下。详见 WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}<br />
<br />
{{Tip|如果安装软件时桌面启动器并没有创建或已经丢失,{{ic|wine winemenubuilder}} 也许能帮得上忙。}}<br />
<br />
==== 为Wine utilities创建菜单项 ====<br />
<br />
默认情况下,Wine 的安装不会为 Wine 附带的软件创建桌面菜单/图标(例如“ winecfg”、“ winebroserer”等)。这可以通过安装 {{AUR|wine-installer}}或 {{AUR|wine-installer-git}} meta-package (后者没有附加依赖项)来实现,否则这些说明将为这些应用程序添加条目。<br />
<br />
首先,使用 Wine 安装一个 Windows 程序来创建基本菜单。创建基本菜单后,可以在 {{ic|~/.local/share/applications/wine/}}:<br />
<br />
{{hc|wine-browsedrive.desktop|2=<br />
[Desktop Entry]<br />
Name=Browse C: Drive<br />
Comment=Browse your virtual C: drive<br />
Exec=wine winebrowser c:<br />
Terminal=false<br />
Type=Application<br />
Icon=folder-wine<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-uninstaller.desktop|2=<br />
[Desktop Entry]<br />
Name=Uninstall Wine Software<br />
Comment=Uninstall Windows applications for Wine<br />
Exec=wine uninstaller<br />
Terminal=false<br />
Type=Application<br />
Icon=wine-uninstaller<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-winecfg.desktop|2=<br />
[Desktop Entry]<br />
Name=Configure Wine<br />
Comment=Change application-specific and general Wine options<br />
Exec=winecfg<br />
Terminal=false<br />
Icon=wine-winecfg<br />
Type=Application<br />
Categories=Wine;<br />
}}<br />
<br />
并在{{ic|~/.config/menus/applications-merged/}}目录下创建如下文件:<br />
<br />
{{hc|wine.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Category>Wine</Category><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
<br />
如果这些设置产生了一个难看的/不存在的图标,这意味着在您所启用的图标集中没有这些启动程序的图标。您应该将图标设置替换为所需图标的位置。单击启动器属性菜单中的图标将会产生同样的效果。一个支持这些快捷方式的图标集是[https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors]。<br />
<br />
==== Removing menu entries ====<br />
<br />
由 Wine 创建的菜单条目位于 {{ic|~/.local/share/applications/wine/Programs/}}.<br />
除了通过 Wine 删除不需要的扩展绑定,还可以执行以下命令(摘自 Wine 官网) :<br />
<br />
$ rm ~/.local/share/mime/packages/x-wine*<br />
$ rm ~/.local/share/applications/wine-extension*<br />
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
$ rm ~/.local/share/mime/application/x-wine-extension*<br />
<br />
Sometimes you should also remove {{ic|wine-*.menu}} files from {{ic|/.config/menus/}} to completely remove items from wine submenu in kde.<br />
<br />
=== 主题 ===<br />
<br />
类似于 xp 外观的主题可以在这里 [https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 下载]. To install it, see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files this upstream wiki article]. Lastly, use ''winecfg'' to select it.<br />
<br />
{{Note|上面链接的主题只能安装在32位前缀上,前缀版本为 windowsxp。要将其安装在64位前缀上,可能需要创建一个临时的32位前缀,install the theme and copy the {{ic|Zune}} folder and {{ic|Zune.theme}} files from {{ic|drive_c/Windows/Resources/Themes}} in that prefix to the same location in your usual prefix.}}<br />
<br />
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.<br />
<br />
=== 打印 ===<br />
<br />
In order to use your installed printers (both local and network) with wine applications in ''win32 prefixes'' (e.g. MS Word), install the {{Pkg|lib32-libcups}} package, reboot wine (''wineboot'') and restart your wine application.<br />
<br />
=== 网络 ===<br />
<br />
After installation, the {{pkg|lib32-gnutls}} package may need to be [[install]]ed for applications making TLS or HTTPS connections to work.<br />
<br />
For ICMP (ping), Wine may need the network access as described in the [https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
<br />
If issues arise after this (such as an unhandled exception or privileged instruction), remove via:<br />
<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== 使用 ==<br />
<br />
{{警告|不要以 root 身份运行或安装 Wine 应用程序!详见 [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ]。}}<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Using_Wine Wine User's Guide] for general information on Wine usage.<br />
<br />
See [https://appdb.winehq.org/ Wine Application Database (AppDB)] for additional information on specific Windows applications in Wine.<br />
<br />
=== Wayland ===<br />
<br />
Wine 当前并不直接支持 Wayland,但你可以使用 [[Wayland#XWayland|XWayland]]。<br />
<br />
There are some efforts to support Wayland though:<br />
<br />
* Experimental Wayland driver for Wine, which supports using OpenGL- and Windows GDI-applications. See [https://www.winehq.org/pipermail/wine-devel/2020-December/178575.html this] and [https://www.winehq.org/pipermail/wine-devel/2021-February/181325.html this] wine-devel maillist entries.<br />
* [https://github.com/varmd/wine-wayland wine-wayland]: a custom version of Wine, which supports Wayland via Vulkan (so it supports only: DirectX 9, 10 and 11 via [[#DXVK]] and Vulkan-compatible applications).<br />
<br />
== 提示与技巧 ==<br />
<br />
=== Wineconsole ===<br />
<br />
Often you may need to run ''.exe'''s to patch game files, for example a widescreen mod for an old game, and running the ''.exe'' normally through Wine might yield nothing happening. In this case, you can open a terminal and run the following command:<br />
<br />
$ wineconsole cmd<br />
<br />
Then navigate to the directory and run the ''.exe'' file from there.<br />
<br />
=== Winetricks ===<br />
<br />
[https://wiki.winehq.org/Winetricks Winetricks] is a script to allow one to install base requirements needed to run Windows programs. Installable components include DirectX 9.x, MSXML (required by Microsoft Office 2007 and Internet Explorer), Visual Runtime libraries and many more.<br />
<br />
[[Install]] the {{pkg|winetricks}} package (or alternatively {{AUR|winetricks-git}}). Then run it with:<br />
$ winetricks<br />
<br />
For using GUI you should [[install]] the {{pkg|zenity}}.<br />
<br />
=== 性能 ===<br />
<br />
==== CSMT ====<br />
<br />
CSMT is a technology used by Wine to use a separate thread for the OpenGL calls to improve performance noticeably. Since Wine 3.2, CSMT is enabled by default. However, CSMT support needs to be enabled manually for Wine versions lower than 3.2. For vanilla Wine run {{ic|wine regedit}} and set the DWORD value for ''HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt'' to 0x01 (enabled). For wine-staging run {{ic|winecfg}} and enable it in the staging tab.<br />
<br />
Note that CSMT may actually hurt performance for some applications - if this is the case, disable it by creating/setting the registry value to 0x00 (disabled).<br />
<br />
Further information:<br />
*[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion] with the CSMT developer Stefan Dösinger<br />
<br />
==== 强制使用OpenGL模式运行游戏 ====<br />
<br />
Some games might have an OpenGL mode which ''may'' perform better than their default DirectX mode. While the steps to enable OpenGL rendering is ''application specific'', many games accept the {{Ic|-opengl}} parameter.<br />
<br />
$ wine ''/path/to/3d_game.exe'' -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [https://appdb.winehq.org AppDB] for such application specific information.<br />
<br />
==== DXVK ====<br />
<br />
[https://github.com/doitsujin/dxvk DXVK] is a promising new implementation for DirectX 9, 10 & 11 over Vulkan. This should allow for greater performance, and in some cases, even better compatibility. Battlefield 1 for example, only runs under DXVK. On the other hand, DXVK does not support all Wine games (yet).<br />
<br />
To use it, install {{aur|dxvk-bin}}. Then run the following command to activate it in your Wineprefix (by default {{ic|~/.wine}}):<br />
<br />
$ WINEPREFIX=''your-prefix'' setup_dxvk install<br />
<br />
{{Warning|DXVK overrides the DirectX 10 and 11 DLLs, which may be considered cheating in online multiplayer games, and may get your account '''banned'''. Use at your own risk!}}<br />
<br />
==== Gallium Nine ====<br />
<br />
With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.<br />
<br />
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any Wine version. Use {{ic|wine ninewinecfg}} to check if it is enabled.<br />
<br />
For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. [[Export]] the following environment variable before running Wine: <br />
<br />
MESA_LOADER_DRIVER_OVERRIDE=crocus<br />
<br />
=== Unregister existing Wine file associations ===<br />
<br />
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.<br />
<br />
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
$ update-mime-database ~/.local/share/mime/<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Prevent Wine from creating filetype associations ===<br />
<br />
{{Note|This has to be done for each WINEPREFIX which should not update file associations unless you opt to change {{ic|/usr/share/wine/wine.inf}} .}}<br />
This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).<br />
<br />
If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See [https://wiki.winehq.org/FAQ#How_can_I_prevent_Wine_from_changing_the_filetype_associations_on_my_system_or_adding_unwanted_menu_entries.2Fdesktop_links.3F Wine FAQ]<br />
<br />
To make the same change via registry add the string {{ic|Enable}} with value {{ic|N}} under:<br />
<br />
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations<br />
<br />
''You might have to create the key {{ic|FileOpenAssociations}} first!''<br />
<br />
To make this change via the command-line, run the following command:<br />
<br />
$ wine reg add "HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations" /v Enable /d N<br />
<br />
If you want to apply this by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}} and add this line for example under the {{ic|[Services]}} section:<br />
HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"<br />
<br />
To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:<br />
<br />
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=<br />
<br />
[Trigger]<br />
Operation = Install<br />
Operation = Upgrade<br />
Type = Path<br />
Target = usr/share/wine/wine.inf<br />
<br />
[Action]<br />
Description = Stopping Wine from hijacking file associations...<br />
When = PostTransaction<br />
<nowiki>Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'</nowiki><br />
}}<br />
<br />
See [[Pacman#Hooks]]<br />
<br />
=== 自动使用 Wine 执行 Windows 程序 ===<br />
<br />
{{pkg|wine}} 软件包会安装一个 ''binfmt'' 文件,这可使你能够直接运行 Windows 程序,例如,{{ic|''./myprogram.exe''}} 将与 {{ic|wine ''./myprogram.exe''}} 效果相同。服务默认在开机时启动,如果在安装 Wine 之后还没有重启过,[[启动]] {{ic|systemd-binfmt.service}} 即可。<br />
<br />
{{注意|确保 Windows 程序[[executable|可执行]],否则程序将不会运行。}}<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). [[CDemu]] will handle it correctly.<br />
<br />
=== 游戏内显示帧数 ===<br />
<br />
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.<br />
<br />
=== 在单独的用户帐户下运行 Wine ===<br />
<br />
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.<br />
<br />
First, create a [[user account]] for Wine:<br />
<br />
# useradd -m -s /bin/bash wineuser<br />
<br />
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...<br />
<br />
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information on how to execute the {{ic|xhost}} command under your main user.}}<br />
<br />
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:<br />
<br />
$ xhost +SI:localuser:wineuser<br />
<br />
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:<br />
<br />
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''<br />
<br />
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:<br />
{{hc|1=/usr/local/bin/runaswine|2=<br />
#!/bin/bash<br />
xhost +SI:localuser:wineuser<br />
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}<br />
<br />
Wine applications can then be launched via:<br />
<br />
$ runaswine ''"C:\path\to\application.exe"''<br />
<br />
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.<br />
<br />
It is recommended to run {{ic|winecfg}} as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.<br />
<br />
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to share a PulseAudio daemon]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.<br />
<br />
=== Temp directory on tmpfs ===<br />
<br />
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:<br />
<br />
$ rm -r ~/.wine/drive_c/users/$USER/Temp ~/.wine/drive_c/windows/temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/windows/temp<br />
<br />
=== Prevent installing Mono/Gecko ===<br />
<br />
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.<br />
<br />
=== Vulkan ===<br />
<br />
The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].<br />
<br />
=== Remove Wine file bindings ===<br />
<br />
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).<br />
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}<br />
<br />
NoExtract = usr/lib/binfmt.d/wine.conf<br />
NoExtract = usr/share/applications/wine.desktop<br />
<br />
=== WineASIO ===<br />
<br />
If you need professional audio support under wine you can use {{Aur|wineasio}} which provides an ASIO interface for wine that you can then use with [[JACK]].<br />
<br />
In order to use wineasio you must add yourself to the {{ic|realtime}} [[user group]].<br />
<br />
Next you need to register wineasio in your desired wine prefix. Register the 32-bit and/or 64-bit version as needed:<br />
$ regsvr32 /usr/lib32/wine/i386-windows/wineasio.dll<br />
$ wine64 regsvr32 /usr/lib/wine/x86_64-windows/wineasio.dll<br />
<br />
== 疑难解答 ==<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Troubleshooting_.2F_Reporting_bugs Wine User's Guide] and [https://wiki.winehq.org/FAQ Wine FAQ] (especially its [https://wiki.winehq.org/FAQ#Troubleshooting Troubleshooting] section) for general tips.<br />
<br />
Also refer to the [https://appdb.winehq.org/ Wine AppDB] for an advice on specific applications.<br />
<br />
=== XWayland问题 ===<br />
<br />
If you use Wine under [[Wayland#XWayland|XWayland]], you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:<br />
<br />
* flickering;<br />
* wrong window location;<br />
* wrong mouse cursor location and clicks;<br />
* keyboard detection.<br />
<br />
=== 键盘输入不工作 ===<br />
<br />
This could be caused by the window manager not switching focus. In the ''Graphics'' tab of ''winecfg'', disable the 'Allow the window manager...' options, or set windowed mode with 'Emulate a virtual desktop'.<br />
*Some suggest to toggle all the ''Window settings'', click ''Apply'', then change them back. If that does not work, try the above.<br />
<br />
If the keyboard does not work after unfocusing the application, try editing the registry:<br />
*Under ''HKEY_CURRENT_USER\Software\Wine\X11 Driver'', add a string value ''UseTakeFocus'' and set it to ''N''.<br />
*Alternatively, you can use winetricks to set the value.<br />
winetricks usetakefocus=n<br />
<br />
== 参见 ==<br />
<br />
* [https://www.winehq.org/ Wine Homepage]<br />
* [https://wiki.winehq.org/ Wine Wiki]<br />
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
* [[Gentoo:Wine]]<br />
* [https://www.darlinghq.org/ Darling] - a similar project for MacOS software<br />
* [https://github.com/wineasio/wineasio WineASIO] - GitHub page of the WineASIO project with further information</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=User_talk:InsaneGuo&diff=726526User talk:InsaneGuo2022-04-15T12:33:33Z<p>InsaneGuo: </p>
<hr />
<div>==[[Wine (简体中文)]]翻译==<br />
wine 页面你在2021年说在翻译,但是英语不太好。你现在翻译到哪一步了,我六级刚过,有没有什么我可以帮忙的<br />
#感谢 希望可以把原来不通的部分改下 顺便翻译下剩余段落 最近学业繁忙 望合作 (另附:请在末尾以四个~结尾以签名)--[[User:InsaneGuo|InsaneGuo]] ([[User talk:InsaneGuo|talk]]) 12:32, 15 April 2022 (UTC)</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=User_talk:InsaneGuo&diff=726525User talk:InsaneGuo2022-04-15T12:32:53Z<p>InsaneGuo: </p>
<hr />
<div>==[[Wine(简体中文)]]翻译==<br />
wine 页面你在2021年说在翻译,但是英语不太好。你现在翻译到哪一步了,我六级刚过,有没有什么我可以帮忙的<br />
#感谢 希望可以把原来不通的部分改下 顺便翻译下剩余段落 最近学业繁忙 望合作 (另附:请在末尾以四个~结尾以签名)--[[User:InsaneGuo|InsaneGuo]] ([[User talk:InsaneGuo|talk]]) 12:32, 15 April 2022 (UTC)</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=719270Wine (简体中文)2022-02-19T04:24:32Z<p>InsaneGuo: 翻译</p>
<hr />
<div>[[Category:Emulation (简体中文)]]<br />
[[Category:Gaming (简体中文)]]<br />
[[de:Wine]]<br />
[[en:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
{{translateme (简体中文)| 进度:35%}}<br />
{{Related articles start}}<br />
{{Related|CrossOver}}<br />
{{Related|Deepin-wine}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
[[Wikipedia:Wine (software)|Wine]] 是一款可以在类 unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而不会像模拟器那样影响性能/内存。<br />
<br />
{{警告|<br />
* Wine并非与你的系统分离。<br />
* 如果您可以使用您的用户帐户访问文件或资源,那么在 Wine 中运行的程序也可以。参见[[#Running Wine under a separate user account]]和[[Security#sandboxing applications]]了解可能的预防措施。<br />
* Wine 也可以运行恶意软件(参见 [https://wiki.winehq.org/FAQ#is_wine_malware-compatible.3f 葡萄酒常见问题])}}<br />
<br />
== 安装 ==<br />
<br />
可以通过启用[[multilib]] 库来 [[install|安装]] {{Pkg|wine}} (稳定) 或 {{Pkg|wine-staging}} (测试) 包。 [https://wine-staging.com/ Wine Staging]是[https://www.winehq.org/ Wine]的修补版本 [https://www.winehq.org/ Wine], 其中包含了 bug 修复和尚未集成到稳定或开发分支中的特性。<br />
<br />
另请参阅[[#Graphics drivers|#图形驱动程序]]和[[#Sound|# 声音]]以了解其他需求。<br />
<br />
可以考虑为依赖于 Internet Explorer 和 .NET 的应用程序分别安装{{pkg|wine-gecko}}和{{pkg|wine-mono}}。这些软件包并不是严格要求的,因为 Wine 会根据需要下载相关文件。但是,提前下载文件可以让您离线工作,这样 Wine 就不会为每个需要它们的 Wine 前缀下载文件。<br />
<br />
=== 第三方Wine应用 ===<br />
<br />
这些都有自己的社区和网站,并不受主要Wine社区的支持。详情请参阅[https://wiki.winehq.org/Third_Party_Applications Wine Wiki] 。<br />
<br />
* {{App|[[CrossOver]]|Wine 的付费商业版,提供更全面的终端用户支持。|https://www.codeweavers.com|{{AUR|crossover}}}}<br />
* {{App|exe-thumbnailer|为 Windows 可执行文件(. exe、 . lnk、 . msi 和. dll)生成缩略图。|https://github.com/exe-thumbnailer/exe-thumbnailer|{{AUR|exe-thumbnailer}}}}<br />
* {{App|[[Wikipedia:Lutris|Lutris]]|所有类型游戏的游戏启动器,包括 Wine 游戏(带前缀管理)、原生 Linux 游戏和模拟器。|https://lutris.net|{{Pkg|lutris}}}}<br />
* {{App|[[Wikipedia:PlayOnLinux|PlayOnLinux]]|Wine 的图形化前缀管理器。包含帮助程序安装和配置的脚本。|https://www.playonlinux.com|{{Pkg|playonlinux}}}}<br />
* {{App|Proton|Compatibility tool 基于Wine和其他部件为[Wikipedia:Steam]制造的Proton兼容性工具。兼容性列表见 [https://www.protondb.com/ ProtonDB] <br />
|list.|https://github.com/ValveSoftware/Proton|{{AUR|proton}}}}<br />
* {{App|PyWinery|Wine 的简单图形化前缀管理器。|https://github.com/ergoithz/pywinery|{{AUR|pywinery}}}}<br />
* {{App|Q4Wine|Wine 的图形前缀管理器。可以将 [[Qt]] 主题导出到 Wine 配置中,以便更好地集成。|https://sourceforge.net/projects/q4wine/|{{AUR|q4wine}}{{Broken package link (简体中文)|package not found}}}}<br />
* {{App|Bottles|基于 GTK 的 Wine 的图形化前缀和管理器。|https://usebottles.com/|{{AUR|bottles}}}}<br />
<br />
== 配置 ==<br />
<br />
配置Wine通常使用以下方法:<br />
<br />
* [https://wiki.winehq.org/Winecfg winecfg] 是 Wine 的 GUI 配置工具,可以通过运行{{ic|winecfg}}启动它。 <br />
* [https://wiki.winehq.org/Regedit regedit] 是 Wine 的注册表编辑工具,可以通过运行{{ic|regedit}} 来启动。See WineHQ's article on [https://wiki.winehq.org/Useful_Registry_Keys Useful Registry Keys].<br />
* [https://wiki.winehq.org/Control control] 是 Wine 的 Windows 控件面板的实现,它可以通过运行{{ic|wine control}}来启动。<br />
* 完整列表见 [https://wiki.winehq.org/List_of_Commands WineHQ 的命令列表]。<br />
<br />
=== WINEPREFIX ===<br />
<br />
默认情况下,Wine 将其配置文件和安装的 Windows 程序存储在 {{ic|~/.wine}} 。这个目录通常被称为“ Wine prefix”或“ Wine bottle”。当您运行 Windows 程序或 Wine 的捆绑程序(如 winecfg)时,它会自动创建/更新。前缀目录还包含一个目录,您的 Windows 程序将其视为 {{ic|c:}} (C盘)。<br />
<br />
你可以使用 {{ic|WINEPREFIX}}环境变量覆盖 Wine 使用的前缀位置。如果您希望为不同的 Windows 程序使用单独的配置,这将非常有用。第一次运行带有新 Wine 前缀的程序时,Wine 将自动创建一个带有 c 驱动器和注册表的目录。<br />
<br />
例如,如果您运行一个带有{{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}的程序,和另一个 {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}这两个程序将分别有一个单独的 c 驱动器和单独的注册。<br />
<br />
{{注意: Wine不是沙箱!在 Wine 下运行的程序仍然可以访问系统的其余部分!(例如, {{ic|Z:}} 映射到 {{ic|/}}, 与 Wine 前缀无关).}}<br />
<br />
若要在不运行 Windows 程序或其他 GUI 工具的情况下创建默认前缀,可以使用:<br />
<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
Wine will start a 64-bit environment by default. You can change this behavior using the {{ic|WINEARCH}} [[environment variable]]. Rename your {{ic|~/.wine}} directory and create a new Wine environment by running {{ic|1=$ WINEARCH=win32 winecfg}}. This will get you a 32-bit Wine environment. Not setting {{ic|WINEARCH}} will get you a 64-bit one.<br />
<br />
You can combine this with {{ic|WINEPREFIX}} to make a separate {{ic|win32}} and {{ic|win64}} environment:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
You can also use {{ic|WINEARCH}} in combination with other Wine programs, such as ''winetricks'' (using Steam as an example):<br />
<br />
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
In order to see the architecture of an existing prefix you can check its registry file. The command below reads the system registry of the {{ic|~/.wine}} prefix and returns {{ic|1=#arch=win32}} or {{ic|1=#arch=win64}} depending on the architecture type:<br />
<br />
$ grep '#arch' ~/.wine/system.reg<br />
<br />
=== Graphics drivers ===<br />
<br />
You need to install the 32-bit version of your graphics driver. Please install the package that is listed in the ''OpenGL (multilib)'' column in the table in [[Xorg#Driver installation]].<br />
<br />
A good sign that your drivers are inadequate or not properly configured is when Wine reports the following in your terminal window:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{Note|You might need to restart X after having installed the correct library.}}<br />
<br />
=== Sound ===<br />
<br />
By default sound issues may arise when running Wine applications. Ensure only one sound device is selected in ''winecfg''.<br />
<br />
Install the correct packages for the audio driver you want to use:<br />
<br />
* For [[ALSA]] install {{Pkg|lib32-alsa-lib}} and {{Pkg|lib32-alsa-plugins}}<br />
* For [[PulseAudio]] install {{Pkg|lib32-libpulse}} <br />
* For [[PipeWire]] install either {{Pkg|pipewire-pulse}} and {{Pkg|lib32-libpulse}} or {{Pkg|pipewire-alsa}} and {{Pkg|lib32-alsa-lib}} + {{Pkg|lib32-alsa-plugins}}<br />
* For [[OSS]] install {{Pkg|lib32-alsa-oss}}<br />
<br />
Additional packages: <br />
<br />
* Games that use advanced sound systems (''e.g.'' TESV: Skyrim) may additionally require installations of {{Pkg|lib32-openal}}.<br />
<br />
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [https://wiki.winehq.org/Wine_User's_Guide#Using_Regedit configure it via the registry]. For example, in a case where the microphone was not working in a 32-bit Windows application on a 64-bit stock install of wine-1.9.7, this provided full access to the sound hardware (sound playback and mic): open ''regedit'', look for the key HKEY_CURRENT_USER → Software → Wine → Drivers, and add a string called ''Audio'' and give it the value ''alsa''. Also, it may help to [[#WINEARCH|recreate the prefix]].<br />
<br />
==== MIDI support ====<br />
<br />
[[MIDI]] 是90年代流行的电子游戏音乐系统。如果你正在尝试旧的游戏,这是不寻常的音乐不会发挥出来的盒子。<br />
葡萄酒有很好的 MIDI 支持。但是,您首先需要使它在您的主机系统上工作,如[[MIDI]]中所解释的。最后但并非最不重要的是,您需要确保 Wine 将使用正确的 MIDI 输出。<br />
<br />
=== 其他依赖 ===<br />
<br />
部分应用软件可能需要额外的包对于以下情况:<br />
<br />
* 播放音乐: {{Pkg|lib32-mpg123}}<br />
* 本机图像处理库: {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}<br />
* 加密服务: {{Pkg|lib32-gnutls}}<br />
* 32位视频解码: {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}<br />
* NTLM 身份验证: {{Pkg|samba}}<br />
<br />
=== 字体 ===<br />
<br />
如果 Wine 应用程序没有显示易读的字体,则可能没有安装任何字体。轻松链接所有的系统字体,使他们可以从Wine:<br />
<br />
$ cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; 来完成<br />
<br />
使用 FreeType 渲染字体,而 FreeType 的默认设置在几个版本之前已经改变了。尝试在葡萄酒项目中使用这种环境设置:<br />
FREETYPE_PROPERTIES="truetype:interpreter-version=35"<br />
<br />
另一种可能性是在葡萄酒前缀中安装微软的 TrueType 字体。 See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
运行此类程序后,关闭所有 Wine 服务并运行{{ic| winecfg }}。字体现在应该是可读的。<br />
<br />
如果字体看起来模糊不清,导入以下文本文件到 Wine 注册表[https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
Windows Registry Editor Version 5.00<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
对于高分辨率显示,可以在 winecfg 中调整 dpi 值。<br />
<br />
See also [[Font configuration#Applications without fontconfig support]].<br />
<br />
==== 启用字体平滑 ====<br />
<br />
提高Wine染效果的一个好方法是使用明显的字体平滑。/n要启用“次像素平滑(ClearType) RGB”:<br />
<br />
{{bc|<nowiki><br />
cat << EOF > /tmp/fontsmoothing<br />
REGEDIT4<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingOrientation"=dword:00000001<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
EOF<br />
<br />
WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null<br />
</nowiki>}}<br />
<br />
得到更多,参见 [https://askubuntu.com/a/219795 ]<br />
<br />
=== Desktop launcher menus ===<br />
<br />
当 Windows 应用程序安装程序创建一个快捷方式时,Wine 创建一个[[.desktop]]Arch Linux 中这些文件的默认位置是:<br />
<br />
* Desktop shortcuts are put in {{ic|~/Desktop}}<br />
* Start menu shortcuts are put in {{ic|~/.local/share/applications/wine/Programs/}}<br />
<br />
{{Note|1=Wine does not support installing Windows applications for all users, so it will not put ''.desktop'' files in {{ic|/usr/share/applications}}. See WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}<br />
<br />
{{Tip|If menu items were ''not'' created while installing software or have been lost, {{ic|wine winemenubuilder}} may be of some use.}}<br />
<br />
==== Creating menu entries for Wine utilities ====<br />
<br />
默认情况下,Wine 的安装不会为 Wine 附带的软件创建桌面菜单/图标(例如“ winecfg”、“ winebroserer”等)。这可以通过安装 {{AUR|wine-installer}}或 {{AUR|wine-installer-git}} meta-package (后者没有附加依赖项)来实现,否则这些说明将为这些应用程序添加条目。<br />
<br />
首先,使用 Wine 安装一个 Windows 程序来创建基本菜单。创建基本菜单后,可以在 {{ic|~/.local/share/applications/wine/}}:<br />
<br />
{{hc|wine-browsedrive.desktop|2=<br />
[Desktop Entry]<br />
Name=Browse C: Drive<br />
Comment=Browse your virtual C: drive<br />
Exec=wine winebrowser c:<br />
Terminal=false<br />
Type=Application<br />
Icon=folder-wine<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-uninstaller.desktop|2=<br />
[Desktop Entry]<br />
Name=Uninstall Wine Software<br />
Comment=Uninstall Windows applications for Wine<br />
Exec=wine uninstaller<br />
Terminal=false<br />
Type=Application<br />
Icon=wine-uninstaller<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-winecfg.desktop|2=<br />
[Desktop Entry]<br />
Name=Configure Wine<br />
Comment=Change application-specific and general Wine options<br />
Exec=winecfg<br />
Terminal=false<br />
Icon=wine-winecfg<br />
Type=Application<br />
Categories=Wine;<br />
}}<br />
<br />
And create the following file in {{ic|~/.config/menus/applications-merged/}}:<br />
<br />
{{hc|wine.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Category>Wine</Category><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
<br />
如果这些设置产生了一个难看的/不存在的图标,这意味着在您所启用的图标集中没有这些启动程序的图标。您应该将图标设置替换为所需图标的显式位置。单击启动器属性菜单中的图标将会产生同样的效果。一个优秀的图标集,支持这些捷径是 [https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors].<br />
<br />
==== Removing menu entries ====<br />
<br />
由 Wine 创建的菜单条目位于 {{ic|~/.local/share/applications/wine/Programs/}}.<br />
除了通过 Wine 删除不需要的扩展绑定,还可以执行以下命令(摘自 Wine 官网) :<br />
<br />
$ rm ~/.local/share/mime/packages/x-wine*<br />
$ rm ~/.local/share/applications/wine-extension*<br />
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
$ rm ~/.local/share/mime/application/x-wine-extension*<br />
<br />
Sometimes you should also remove {{ic|wine-*.menu}} files from {{ic|/.config/menus/}} to completely remove items from wine submenu in kde.<br />
<br />
=== 主题 ===<br />
<br />
类似于 xp 外观的主题可以在这里 [https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 下载]. To install it, see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files this upstream wiki article]. Lastly, use ''winecfg'' to select it.<br />
<br />
{{Note|上面链接的主题只能安装在32位前缀上,前缀版本为 windowsxp。要将其安装在64位前缀上,可能需要创建一个临时的32位前缀,install the theme and copy the {{ic|Zune}} folder and {{ic|Zune.theme}} files from {{ic|drive_c/Windows/Resources/Themes}} in that prefix to the same location in your usual prefix.}}<br />
<br />
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.<br />
<br />
=== Printing ===<br />
<br />
In order to use your installed printers (both local and network) with wine applications in ''win32 prefixes'' (e.g. MS Word), install the {{Pkg|lib32-libcups}} package, reboot wine (''wineboot'') and restart your wine application.<br />
<br />
=== Networking ===<br />
<br />
After installation, the {{pkg|lib32-gnutls}} package may need to be [[install]]ed for applications making TLS or HTTPS connections to work.<br />
<br />
For ICMP (ping), Wine may need the network access as described in the [https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
<br />
If issues arise after this (such as an unhandled exception or privileged instruction), remove via:<br />
<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== Usage ==<br />
<br />
{{Warning|Do not run or install Wine applications as root! See [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ] for details.}}<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Using_Wine Wine User's Guide] for general information on Wine usage.<br />
<br />
See [https://appdb.winehq.org/ Wine Application Database (AppDB)] for additional information on specific Windows applications in Wine.<br />
<br />
=== Wayland ===<br />
<br />
Currently Wine does not support Wayland directly, but you can use [[Wayland#XWayland|XWayland]] instead.<br />
<br />
There are some efforts to support Wayland though:<br />
<br />
* Experimental Wayland driver for Wine, which supports using OpenGL- and Windows GDI-applications. See [https://www.winehq.org/pipermail/wine-devel/2020-December/178575.html this] and [https://www.winehq.org/pipermail/wine-devel/2021-February/181325.html this] wine-devel maillist entries.<br />
* [https://github.com/varmd/wine-wayland wine-wayland]: a custom version of Wine, which supports Wayland via Vulkan (so it supports only: DirectX 9, 10 and 11 via [[#DXVK]] and Vulkan-compatible applications).<br />
<br />
== Tips and tricks ==<br />
<br />
=== Wineconsole ===<br />
<br />
Often you may need to run ''.exe'''s to patch game files, for example a widescreen mod for an old game, and running the ''.exe'' normally through Wine might yield nothing happening. In this case, you can open a terminal and run the following command:<br />
<br />
$ wineconsole cmd<br />
<br />
Then navigate to the directory and run the ''.exe'' file from there.<br />
<br />
=== Winetricks ===<br />
<br />
[https://wiki.winehq.org/Winetricks Winetricks] is a script to allow one to install base requirements needed to run Windows programs. Installable components include DirectX 9.x, MSXML (required by Microsoft Office 2007 and Internet Explorer), Visual Runtime libraries and many more.<br />
<br />
[[Install]] the {{pkg|winetricks}} package (or alternatively {{AUR|winetricks-git}}). Then run it with:<br />
$ winetricks<br />
<br />
For using GUI you should [[install]] the {{pkg|zenity}}.<br />
<br />
=== Performance ===<br />
<br />
==== CSMT ====<br />
<br />
CSMT is a technology used by Wine to use a separate thread for the OpenGL calls to improve performance noticeably. Since Wine 3.2, CSMT is enabled by default. However, CSMT support needs to be enabled manually for Wine versions lower than 3.2. For vanilla Wine run {{ic|wine regedit}} and set the DWORD value for ''HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt'' to 0x01 (enabled). For wine-staging run {{ic|winecfg}} and enable it in the staging tab.<br />
<br />
Note that CSMT may actually hurt performance for some applications - if this is the case, disable it by creating/setting the registry value to 0x00 (disabled).<br />
<br />
Further information:<br />
*[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion] with the CSMT developer Stefan Dösinger<br />
<br />
==== Force OpenGL mode in games ====<br />
<br />
Some games might have an OpenGL mode which ''may'' perform better than their default DirectX mode. While the steps to enable OpenGL rendering is ''application specific'', many games accept the {{Ic|-opengl}} parameter.<br />
<br />
$ wine ''/path/to/3d_game.exe'' -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [https://appdb.winehq.org AppDB] for such application specific information.<br />
<br />
==== DXVK ====<br />
<br />
[https://github.com/doitsujin/dxvk DXVK] is a promising new implementation for DirectX 9, 10 & 11 over Vulkan. This should allow for greater performance, and in some cases, even better compatibility. Battlefield 1 for example, only runs under DXVK. On the other hand, DXVK does not support all Wine games (yet).<br />
<br />
To use it, install {{aur|dxvk-bin}}. Then run the following command to activate it in your Wineprefix (by default {{ic|~/.wine}}):<br />
$ WINEPREFIX=''your-prefix'' setup_dxvk install<br />
<br />
{{Note|For Wine versions below 3.5 you need to configure Vulkan support manually, following the instructions at [https://github.com/roderickc/wine-vulkan GitHub].}}<br />
<br />
{{Warning|DXVK overrides the DirectX 10 and 11 DLLs, which may be considered cheating in online multiplayer games, and may get your account '''banned'''. Use at your own risk!}}<br />
<br />
==== Gallium Nine ====<br />
<br />
With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.<br />
<br />
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any Wine version. Use {{ic|wine ninewinecfg}} to check if it is enabled.<br />
<br />
For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. [[Export]] the following environment variable before running Wine: <br />
<br />
MESA_LOADER_DRIVER_OVERRIDE=crocus<br />
<br />
=== Unregister existing Wine file associations ===<br />
<br />
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.<br />
<br />
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
$ update-mime-database ~/.local/share/mime/<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Prevent Wine from creating filetype associations ===<br />
<br />
{{Note|This has to be done for each WINEPREFIX which should not update file associations unless you opt to change {{ic|/usr/share/wine/wine.inf}} .}}<br />
This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).<br />
<br />
If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See [https://wiki.winehq.org/FAQ#How_can_I_prevent_Wine_from_changing_the_filetype_associations_on_my_system_or_adding_unwanted_menu_entries.2Fdesktop_links.3F Wine FAQ]<br />
<br />
To make the same change via registry add the string {{ic|Enable}} with value {{ic|N}} under:<br />
<br />
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations<br />
<br />
''You might have to create the key {{ic|FileOpenAssociations}} first!''<br />
<br />
If you want to apply this by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}} and add this line for example under the {{ic|[Services]}} section:<br />
HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"<br />
<br />
To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:<br />
<br />
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=<br />
<br />
[Trigger]<br />
Operation = Install<br />
Operation = Upgrade<br />
Type = Path<br />
Target = usr/share/wine/wine.inf<br />
<br />
[Action]<br />
Description = Stopping Wine from hijacking file associations...<br />
When = PostTransaction<br />
<nowiki>Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'</nowiki><br />
}}<br />
<br />
See [[Pacman#Hooks]]<br />
<br />
=== Execute Windows binaries with Wine implicitly ===<br />
<br />
The {{pkg|wine}} package installs a ''binfmt'' file which will allows you to run Windows programs directly, e.g. {{ic|''./myprogram.exe''}} will launch as if you had typed {{ic|wine ''./myprogram.exe''}}. Service starts by default on boot, if you have not rebooted after installing Wine you can [[start]] {{ic|systemd-binfmt.service}} to use it right away.<br />
<br />
{{Note|Make sure the Windows binary is [[executable]], otherwise the binary will not run.}}<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). [[CDemu]] will handle it correctly.<br />
<br />
=== Show FPS overlay in games ===<br />
<br />
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.<br />
<br />
=== Running Wine under a separate user account ===<br />
<br />
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.<br />
<br />
First, create a [[user account]] for Wine:<br />
<br />
# useradd -m -s /bin/bash wineuser<br />
<br />
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...<br />
<br />
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information on how to execute the {{ic|xhost}} command under your main user.}}<br />
<br />
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:<br />
<br />
$ xhost +SI:localuser:wineuser<br />
<br />
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:<br />
<br />
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''<br />
<br />
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:<br />
{{hc|1=/usr/local/bin/runaswine|2=<br />
#!/bin/bash<br />
xhost +SI:localuser:wineuser<br />
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}<br />
<br />
Wine applications can then be launched via:<br />
<br />
$ runaswine ''"C:\path\to\application.exe"''<br />
<br />
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.<br />
<br />
It is recommended to run {{ic|winecfg}} as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.<br />
<br />
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to share a PulseAudio daemon]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.<br />
<br />
=== Temp directory on tmpfs ===<br />
<br />
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:<br />
<br />
$ rm -r ~/.wine/drive_c/users/$USER/Temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp<br />
<br />
=== Prevent installing Mono/Gecko ===<br />
<br />
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.<br />
<br />
=== Vulkan ===<br />
<br />
Vulkan support is included, since Wine 3.3. The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].<br />
<br />
{{Note|The Wine ICD loader was added in Wine 3.5, you need to install the official Vulkan SDK to use Vulkan in Wine 3.3 and 3.4}}<br />
<br />
=== Remove Wine file bindings ===<br />
<br />
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).<br />
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}<br />
<br />
NoExtract = usr/lib/binfmt.d/wine.conf<br />
NoExtract = usr/share/applications/wine.desktop<br />
<br />
== Troubleshooting ==<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Troubleshooting_.2F_Reporting_bugs Wine User's Guide] and [https://wiki.winehq.org/FAQ Wine FAQ] (especially its [https://wiki.winehq.org/FAQ#Troubleshooting Troubleshooting] section) for general tips.<br />
<br />
Also refer to the [https://appdb.winehq.org/ Wine AppDB] for an advice on specific applications.<br />
<br />
=== XWayland problems ===<br />
<br />
If you use Wine under [[Wayland#XWayland|XWayland]], you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:<br />
<br />
* flickering;<br />
* wrong window location;<br />
* wrong mouse cursor location and clicks;<br />
* keyboard detection.<br />
<br />
=== Keyboard input doesn't work after unfocusing application ===<br />
<br />
If you encounter this problem, you may be able to fix it by editing the registry:<br />
Under ''HKEY_CURRENT_USER\Software\Wine\X11 Driver'', add a string value ''UseTakeFocus'' and set it to ''N''.<br />
<br />
Alternatively, you can use winetricks to set the value.<br />
winetricks usetakefocus=n<br />
<br />
== See also ==<br />
<br />
* [https://www.winehq.org/ Wine Homepage]<br />
* [https://wiki.winehq.org/ Wine Wiki]<br />
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
* [[Gentoo:Wine]]<br />
* [https://www.darlinghq.org/ Darling] - a similar project for MacOS software</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=719269Wine (简体中文)2022-02-19T04:23:32Z<p>InsaneGuo: 翻译</p>
<hr />
<div>[[Category:Emulation (简体中文)]]<br />
[[Category:Gaming (简体中文)]]<br />
[[de:Wine]]<br />
[[en:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
{{translateme (简体中文)| 进度:35%}}<br />
{{Related articles start}}<br />
{{Related|CrossOver}}<br />
{{Related|Deepin-wine}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
[[Wikipedia:Wine (software)|Wine]] 是一款可以在类 unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而不会像模拟器那样影响性能/内存。<br />
<br />
{{警告|<br />
* Wine并非与你的系统分离。<br />
* 如果您可以使用您的用户帐户访问文件或资源,那么在 Wine 中运行的程序也可以。参见[[#Running Wine under a separate user account]]和[[Security#sandboxing applications]]了解可能的预防措施。<br />
* Wine 也可以运行恶意软件(参见 [https://wiki.winehq.org/FAQ#is_wine_malware-compatible.3f 葡萄酒常见问题])}}<br />
<br />
== 安装 ==<br />
<br />
可以通过启用[[multilib]] 库来 [[install|安装]] {{Pkg|wine}} (稳定) 或 {{Pkg|wine-staging}} (测试) 包。 [https://wine-staging.com/ Wine Staging]是[https://www.winehq.org/ Wine]的修补版本 [https://www.winehq.org/ Wine], 其中包含了 bug 修复和尚未集成到稳定或开发分支中的特性。<br />
<br />
另请参阅[[#Graphics drivers|#图形驱动程序]]和[[#Sound|# 声音]]以了解其他需求。<br />
<br />
可以考虑为依赖于 Internet Explorer 和 .NET 的应用程序分别安装{{pkg|wine-gecko}}和{{pkg|wine-mono}}。这些软件包并不是严格要求的,因为 Wine 会根据需要下载相关文件。但是,提前下载文件可以让您离线工作,这样 Wine 就不会为每个需要它们的 Wine 前缀下载文件。<br />
<br />
=== 第三方Wine应用 ===<br />
<br />
这些都有自己的社区和网站,并不受主要Wine社区的支持。详情请参阅[https://wiki.winehq.org/Third_Party_Applications Wine Wiki] 。<br />
<br />
* {{App|[[CrossOver]]|Wine 的付费商业版,提供更全面的终端用户支持。|https://www.codeweavers.com|{{AUR|crossover}}}}<br />
* {{App|exe-thumbnailer|为 Windows 可执行文件(. exe、 . lnk、 . msi 和. dll)生成缩略图。|https://github.com/exe-thumbnailer/exe-thumbnailer|{{AUR|exe-thumbnailer}}}}<br />
* {{App|[[Wikipedia:Lutris|Lutris]]|所有类型游戏的游戏启动器,包括 Wine 游戏(带前缀管理)、原生 Linux 游戏和模拟器。|https://lutris.net|{{Pkg|lutris}}}}<br />
* {{App|[[Wikipedia:PlayOnLinux|PlayOnLinux]]|Wine 的图形化前缀管理器。包含帮助程序安装和配置的脚本。|https://www.playonlinux.com|{{Pkg|playonlinux}}}}<br />
* {{App|Proton|Compatibility tool 基于Wine和其他部件为[Wikipedia:Steam]制造的Proton兼容性工具。兼容性列表见 [https://www.protondb.com/ ProtonDB] <br />
|list.|https://github.com/ValveSoftware/Proton|{{AUR|proton}}}}<br />
* {{App|PyWinery|Wine 的简单图形化前缀管理器。|https://github.com/ergoithz/pywinery|{{AUR|pywinery}}}}<br />
* {{App|Q4Wine|Wine 的图形前缀管理器。可以将 [[Qt]] 主题导出到 Wine 配置中,以便更好地集成。|https://sourceforge.net/projects/q4wine/|{{AUR|q4wine}}{{Broken package link (简体中文)|package not found}}}}<br />
* {{App|Bottles|基于 GTK 的 Wine 的图形化前缀和管理器。|https://usebottles.com/|{{AUR|bottles}}}}<br />
<br />
== 配置 ==<br />
<br />
配置Wine通常使用以下方法:<br />
<br />
* [https://wiki.winehq.org/Winecfg winecfg] 是 Wine 的 GUI 配置工具,可以通过运行{{ic|winecfg}}启动它。 <br />
* [https://wiki.winehq.org/Regedit regedit] 是 Wine 的注册表编辑工具,可以通过运行{{ic|regedit}} 来启动。See WineHQ's article on [https://wiki.winehq.org/Useful_Registry_Keys Useful Registry Keys].<br />
* [https://wiki.winehq.org/Control control] 是 Wine 的 Windows 控件面板的实现,它可以通过运行{{ic|wine control}}来启动。<br />
* 完整列表见 [https://wiki.winehq.org/List_of_Commands WineHQ 的命令列表]。<br />
<br />
=== WINEPREFIX ===<br />
<br />
默认情况下,Wine 将其配置文件和安装的 Windows 程序存储在 {{ic|~/.wine}} 。这个目录通常被称为“ Wine prefix”或“ Wine bottle”。当您运行 Windows 程序或 Wine 的捆绑程序(如 winecfg)时,它会自动创建/更新。前缀目录还包含一个目录,您的 Windows 程序将其视为 {{ic|c:}} (C盘)。<br />
<br />
你可以使用 {{ic|WINEPREFIX}}环境变量覆盖 Wine 使用的前缀位置。如果您希望为不同的 Windows 程序使用单独的配置,这将非常有用。第一次运行带有新 Wine 前缀的程序时,Wine 将自动创建一个带有 c 驱动器和注册表的目录。<br />
<br />
例如,如果您运行一个带有{{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}的程序,和另一个 {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}这两个程序将分别有一个单独的 c 驱动器和单独的注册。<br />
<br />
{{注意: Wine不是沙箱!在 Wine 下运行的程序仍然可以访问系统的其余部分!(例如, {{ic|Z:}} 映射到 {{ic|/}}, 与 Wine 前缀无关).}}<br />
<br />
若要在不运行 Windows 程序或其他 GUI 工具的情况下创建默认前缀,可以使用:<br />
<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
Wine will start a 64-bit environment by default. You can change this behavior using the {{ic|WINEARCH}} [[environment variable]]. Rename your {{ic|~/.wine}} directory and create a new Wine environment by running {{ic|1=$ WINEARCH=win32 winecfg}}. This will get you a 32-bit Wine environment. Not setting {{ic|WINEARCH}} will get you a 64-bit one.<br />
<br />
You can combine this with {{ic|WINEPREFIX}} to make a separate {{ic|win32}} and {{ic|win64}} environment:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
You can also use {{ic|WINEARCH}} in combination with other Wine programs, such as ''winetricks'' (using Steam as an example):<br />
<br />
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
In order to see the architecture of an existing prefix you can check its registry file. The command below reads the system registry of the {{ic|~/.wine}} prefix and returns {{ic|1=#arch=win32}} or {{ic|1=#arch=win64}} depending on the architecture type:<br />
<br />
$ grep '#arch' ~/.wine/system.reg<br />
<br />
=== Graphics drivers ===<br />
<br />
You need to install the 32-bit version of your graphics driver. Please install the package that is listed in the ''OpenGL (multilib)'' column in the table in [[Xorg#Driver installation]].<br />
<br />
A good sign that your drivers are inadequate or not properly configured is when Wine reports the following in your terminal window:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{Note|You might need to restart X after having installed the correct library.}}<br />
<br />
=== Sound ===<br />
<br />
By default sound issues may arise when running Wine applications. Ensure only one sound device is selected in ''winecfg''.<br />
<br />
Install the correct packages for the audio driver you want to use:<br />
<br />
* For [[ALSA]] install {{Pkg|lib32-alsa-lib}} and {{Pkg|lib32-alsa-plugins}}<br />
* For [[PulseAudio]] install {{Pkg|lib32-libpulse}} <br />
* For [[PipeWire]] install either {{Pkg|pipewire-pulse}} and {{Pkg|lib32-libpulse}} or {{Pkg|pipewire-alsa}} and {{Pkg|lib32-alsa-lib}} + {{Pkg|lib32-alsa-plugins}}<br />
* For [[OSS]] install {{Pkg|lib32-alsa-oss}}<br />
<br />
Additional packages: <br />
<br />
* Games that use advanced sound systems (''e.g.'' TESV: Skyrim) may additionally require installations of {{Pkg|lib32-openal}}.<br />
<br />
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [https://wiki.winehq.org/Wine_User's_Guide#Using_Regedit configure it via the registry]. For example, in a case where the microphone was not working in a 32-bit Windows application on a 64-bit stock install of wine-1.9.7, this provided full access to the sound hardware (sound playback and mic): open ''regedit'', look for the key HKEY_CURRENT_USER → Software → Wine → Drivers, and add a string called ''Audio'' and give it the value ''alsa''. Also, it may help to [[#WINEARCH|recreate the prefix]].<br />
<br />
==== MIDI support ====<br />
<br />
[[MIDI]] 是90年代流行的电子游戏音乐系统。如果你正在尝试旧的游戏,这是不寻常的音乐不会发挥出来的盒子。<br />
葡萄酒有很好的 MIDI 支持。但是,您首先需要使它在您的主机系统上工作,如[[MIDI]]中所解释的。最后但并非最不重要的是,您需要确保 Wine 将使用正确的 MIDI 输出。<br />
<br />
=== 其他依赖 ===<br />
<br />
部分应用软件可能需要额外的包对于以下情况:<br />
<br />
* 播放音乐: {{Pkg|lib32-mpg123}}<br />
* 本机图像处理库: {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}<br />
* 加密服务: {{Pkg|lib32-gnutls}}<br />
* 32位视频解码: {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}<br />
* NTLM 身份验证: {{Pkg|samba}}<br />
<br />
=== 字体 ===<br />
<br />
如果 Wine 应用程序没有显示易读的字体,则可能没有安装任何字体。轻松链接所有的系统字体,使他们可以从Wine:<br />
<br />
$ cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; 来完成<br />
<br />
使用 FreeType 渲染字体,而 FreeType 的默认设置在几个版本之前已经改变了。尝试在葡萄酒项目中使用这种环境设置:<br />
FREETYPE_PROPERTIES="truetype:interpreter-version=35"<br />
<br />
另一种可能性是在葡萄酒前缀中安装微软的 TrueType 字体。 See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
运行此类程序后,关闭所有 Wine 服务并运行{{ic| winecfg }}。字体现在应该是可读的。<br />
<br />
如果字体看起来模糊不清,导入以下文本文件到 Wine 注册表[https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
Windows Registry Editor Version 5.00<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
对于高分辨率显示,可以在 winecfg 中调整 dpi 值。<br />
<br />
See also [[Font configuration#Applications without fontconfig support]].<br />
<br />
==== Enable font smoothing ====<br />
<br />
提高Wine染效果的一个好方法是使用明显的字体平滑。/n要启用“次像素平滑(ClearType) RGB”:<br />
<br />
{{bc|<nowiki><br />
cat << EOF > /tmp/fontsmoothing<br />
REGEDIT4<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingOrientation"=dword:00000001<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
EOF<br />
<br />
WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null<br />
</nowiki>}}<br />
<br />
For more information, check [https://askubuntu.com/a/219795 the original answer]<br />
<br />
=== Desktop launcher menus ===<br />
<br />
当 Windows 应用程序安装程序创建一个快捷方式时,Wine 创建一个[[.desktop]]Arch Linux 中这些文件的默认位置是:<br />
<br />
* Desktop shortcuts are put in {{ic|~/Desktop}}<br />
* Start menu shortcuts are put in {{ic|~/.local/share/applications/wine/Programs/}}<br />
<br />
{{Note|1=Wine does not support installing Windows applications for all users, so it will not put ''.desktop'' files in {{ic|/usr/share/applications}}. See WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}<br />
<br />
{{Tip|If menu items were ''not'' created while installing software or have been lost, {{ic|wine winemenubuilder}} may be of some use.}}<br />
<br />
==== Creating menu entries for Wine utilities ====<br />
<br />
默认情况下,Wine 的安装不会为 Wine 附带的软件创建桌面菜单/图标(例如“ winecfg”、“ winebroserer”等)。这可以通过安装 {{AUR|wine-installer}}或 {{AUR|wine-installer-git}} meta-package (后者没有附加依赖项)来实现,否则这些说明将为这些应用程序添加条目。<br />
<br />
首先,使用 Wine 安装一个 Windows 程序来创建基本菜单。创建基本菜单后,可以在 {{ic|~/.local/share/applications/wine/}}:<br />
<br />
{{hc|wine-browsedrive.desktop|2=<br />
[Desktop Entry]<br />
Name=Browse C: Drive<br />
Comment=Browse your virtual C: drive<br />
Exec=wine winebrowser c:<br />
Terminal=false<br />
Type=Application<br />
Icon=folder-wine<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-uninstaller.desktop|2=<br />
[Desktop Entry]<br />
Name=Uninstall Wine Software<br />
Comment=Uninstall Windows applications for Wine<br />
Exec=wine uninstaller<br />
Terminal=false<br />
Type=Application<br />
Icon=wine-uninstaller<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-winecfg.desktop|2=<br />
[Desktop Entry]<br />
Name=Configure Wine<br />
Comment=Change application-specific and general Wine options<br />
Exec=winecfg<br />
Terminal=false<br />
Icon=wine-winecfg<br />
Type=Application<br />
Categories=Wine;<br />
}}<br />
<br />
And create the following file in {{ic|~/.config/menus/applications-merged/}}:<br />
<br />
{{hc|wine.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Category>Wine</Category><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
<br />
如果这些设置产生了一个难看的/不存在的图标,这意味着在您所启用的图标集中没有这些启动程序的图标。您应该将图标设置替换为所需图标的显式位置。单击启动器属性菜单中的图标将会产生同样的效果。一个优秀的图标集,支持这些捷径是 [https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors].<br />
<br />
==== Removing menu entries ====<br />
<br />
由 Wine 创建的菜单条目位于 {{ic|~/.local/share/applications/wine/Programs/}}.<br />
除了通过 Wine 删除不需要的扩展绑定,还可以执行以下命令(摘自 Wine 官网) :<br />
<br />
$ rm ~/.local/share/mime/packages/x-wine*<br />
$ rm ~/.local/share/applications/wine-extension*<br />
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
$ rm ~/.local/share/mime/application/x-wine-extension*<br />
<br />
Sometimes you should also remove {{ic|wine-*.menu}} files from {{ic|/.config/menus/}} to completely remove items from wine submenu in kde.<br />
<br />
=== 主题 ===<br />
<br />
类似于 xp 外观的主题可以在这里 [https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 下载]. To install it, see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files this upstream wiki article]. Lastly, use ''winecfg'' to select it.<br />
<br />
{{Note|上面链接的主题只能安装在32位前缀上,前缀版本为 windowsxp。要将其安装在64位前缀上,可能需要创建一个临时的32位前缀,install the theme and copy the {{ic|Zune}} folder and {{ic|Zune.theme}} files from {{ic|drive_c/Windows/Resources/Themes}} in that prefix to the same location in your usual prefix.}}<br />
<br />
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.<br />
<br />
=== Printing ===<br />
<br />
In order to use your installed printers (both local and network) with wine applications in ''win32 prefixes'' (e.g. MS Word), install the {{Pkg|lib32-libcups}} package, reboot wine (''wineboot'') and restart your wine application.<br />
<br />
=== Networking ===<br />
<br />
After installation, the {{pkg|lib32-gnutls}} package may need to be [[install]]ed for applications making TLS or HTTPS connections to work.<br />
<br />
For ICMP (ping), Wine may need the network access as described in the [https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
<br />
If issues arise after this (such as an unhandled exception or privileged instruction), remove via:<br />
<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== Usage ==<br />
<br />
{{Warning|Do not run or install Wine applications as root! See [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ] for details.}}<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Using_Wine Wine User's Guide] for general information on Wine usage.<br />
<br />
See [https://appdb.winehq.org/ Wine Application Database (AppDB)] for additional information on specific Windows applications in Wine.<br />
<br />
=== Wayland ===<br />
<br />
Currently Wine does not support Wayland directly, but you can use [[Wayland#XWayland|XWayland]] instead.<br />
<br />
There are some efforts to support Wayland though:<br />
<br />
* Experimental Wayland driver for Wine, which supports using OpenGL- and Windows GDI-applications. See [https://www.winehq.org/pipermail/wine-devel/2020-December/178575.html this] and [https://www.winehq.org/pipermail/wine-devel/2021-February/181325.html this] wine-devel maillist entries.<br />
* [https://github.com/varmd/wine-wayland wine-wayland]: a custom version of Wine, which supports Wayland via Vulkan (so it supports only: DirectX 9, 10 and 11 via [[#DXVK]] and Vulkan-compatible applications).<br />
<br />
== Tips and tricks ==<br />
<br />
=== Wineconsole ===<br />
<br />
Often you may need to run ''.exe'''s to patch game files, for example a widescreen mod for an old game, and running the ''.exe'' normally through Wine might yield nothing happening. In this case, you can open a terminal and run the following command:<br />
<br />
$ wineconsole cmd<br />
<br />
Then navigate to the directory and run the ''.exe'' file from there.<br />
<br />
=== Winetricks ===<br />
<br />
[https://wiki.winehq.org/Winetricks Winetricks] is a script to allow one to install base requirements needed to run Windows programs. Installable components include DirectX 9.x, MSXML (required by Microsoft Office 2007 and Internet Explorer), Visual Runtime libraries and many more.<br />
<br />
[[Install]] the {{pkg|winetricks}} package (or alternatively {{AUR|winetricks-git}}). Then run it with:<br />
$ winetricks<br />
<br />
For using GUI you should [[install]] the {{pkg|zenity}}.<br />
<br />
=== Performance ===<br />
<br />
==== CSMT ====<br />
<br />
CSMT is a technology used by Wine to use a separate thread for the OpenGL calls to improve performance noticeably. Since Wine 3.2, CSMT is enabled by default. However, CSMT support needs to be enabled manually for Wine versions lower than 3.2. For vanilla Wine run {{ic|wine regedit}} and set the DWORD value for ''HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt'' to 0x01 (enabled). For wine-staging run {{ic|winecfg}} and enable it in the staging tab.<br />
<br />
Note that CSMT may actually hurt performance for some applications - if this is the case, disable it by creating/setting the registry value to 0x00 (disabled).<br />
<br />
Further information:<br />
*[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion] with the CSMT developer Stefan Dösinger<br />
<br />
==== Force OpenGL mode in games ====<br />
<br />
Some games might have an OpenGL mode which ''may'' perform better than their default DirectX mode. While the steps to enable OpenGL rendering is ''application specific'', many games accept the {{Ic|-opengl}} parameter.<br />
<br />
$ wine ''/path/to/3d_game.exe'' -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [https://appdb.winehq.org AppDB] for such application specific information.<br />
<br />
==== DXVK ====<br />
<br />
[https://github.com/doitsujin/dxvk DXVK] is a promising new implementation for DirectX 9, 10 & 11 over Vulkan. This should allow for greater performance, and in some cases, even better compatibility. Battlefield 1 for example, only runs under DXVK. On the other hand, DXVK does not support all Wine games (yet).<br />
<br />
To use it, install {{aur|dxvk-bin}}. Then run the following command to activate it in your Wineprefix (by default {{ic|~/.wine}}):<br />
$ WINEPREFIX=''your-prefix'' setup_dxvk install<br />
<br />
{{Note|For Wine versions below 3.5 you need to configure Vulkan support manually, following the instructions at [https://github.com/roderickc/wine-vulkan GitHub].}}<br />
<br />
{{Warning|DXVK overrides the DirectX 10 and 11 DLLs, which may be considered cheating in online multiplayer games, and may get your account '''banned'''. Use at your own risk!}}<br />
<br />
==== Gallium Nine ====<br />
<br />
With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.<br />
<br />
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any Wine version. Use {{ic|wine ninewinecfg}} to check if it is enabled.<br />
<br />
For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. [[Export]] the following environment variable before running Wine: <br />
<br />
MESA_LOADER_DRIVER_OVERRIDE=crocus<br />
<br />
=== Unregister existing Wine file associations ===<br />
<br />
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.<br />
<br />
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
$ update-mime-database ~/.local/share/mime/<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Prevent Wine from creating filetype associations ===<br />
<br />
{{Note|This has to be done for each WINEPREFIX which should not update file associations unless you opt to change {{ic|/usr/share/wine/wine.inf}} .}}<br />
This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).<br />
<br />
If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See [https://wiki.winehq.org/FAQ#How_can_I_prevent_Wine_from_changing_the_filetype_associations_on_my_system_or_adding_unwanted_menu_entries.2Fdesktop_links.3F Wine FAQ]<br />
<br />
To make the same change via registry add the string {{ic|Enable}} with value {{ic|N}} under:<br />
<br />
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations<br />
<br />
''You might have to create the key {{ic|FileOpenAssociations}} first!''<br />
<br />
If you want to apply this by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}} and add this line for example under the {{ic|[Services]}} section:<br />
HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"<br />
<br />
To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:<br />
<br />
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=<br />
<br />
[Trigger]<br />
Operation = Install<br />
Operation = Upgrade<br />
Type = Path<br />
Target = usr/share/wine/wine.inf<br />
<br />
[Action]<br />
Description = Stopping Wine from hijacking file associations...<br />
When = PostTransaction<br />
<nowiki>Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'</nowiki><br />
}}<br />
<br />
See [[Pacman#Hooks]]<br />
<br />
=== Execute Windows binaries with Wine implicitly ===<br />
<br />
The {{pkg|wine}} package installs a ''binfmt'' file which will allows you to run Windows programs directly, e.g. {{ic|''./myprogram.exe''}} will launch as if you had typed {{ic|wine ''./myprogram.exe''}}. Service starts by default on boot, if you have not rebooted after installing Wine you can [[start]] {{ic|systemd-binfmt.service}} to use it right away.<br />
<br />
{{Note|Make sure the Windows binary is [[executable]], otherwise the binary will not run.}}<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). [[CDemu]] will handle it correctly.<br />
<br />
=== Show FPS overlay in games ===<br />
<br />
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.<br />
<br />
=== Running Wine under a separate user account ===<br />
<br />
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.<br />
<br />
First, create a [[user account]] for Wine:<br />
<br />
# useradd -m -s /bin/bash wineuser<br />
<br />
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...<br />
<br />
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information on how to execute the {{ic|xhost}} command under your main user.}}<br />
<br />
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:<br />
<br />
$ xhost +SI:localuser:wineuser<br />
<br />
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:<br />
<br />
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''<br />
<br />
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:<br />
{{hc|1=/usr/local/bin/runaswine|2=<br />
#!/bin/bash<br />
xhost +SI:localuser:wineuser<br />
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}<br />
<br />
Wine applications can then be launched via:<br />
<br />
$ runaswine ''"C:\path\to\application.exe"''<br />
<br />
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.<br />
<br />
It is recommended to run {{ic|winecfg}} as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.<br />
<br />
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to share a PulseAudio daemon]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.<br />
<br />
=== Temp directory on tmpfs ===<br />
<br />
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:<br />
<br />
$ rm -r ~/.wine/drive_c/users/$USER/Temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp<br />
<br />
=== Prevent installing Mono/Gecko ===<br />
<br />
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.<br />
<br />
=== Vulkan ===<br />
<br />
Vulkan support is included, since Wine 3.3. The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].<br />
<br />
{{Note|The Wine ICD loader was added in Wine 3.5, you need to install the official Vulkan SDK to use Vulkan in Wine 3.3 and 3.4}}<br />
<br />
=== Remove Wine file bindings ===<br />
<br />
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).<br />
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}<br />
<br />
NoExtract = usr/lib/binfmt.d/wine.conf<br />
NoExtract = usr/share/applications/wine.desktop<br />
<br />
== Troubleshooting ==<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Troubleshooting_.2F_Reporting_bugs Wine User's Guide] and [https://wiki.winehq.org/FAQ Wine FAQ] (especially its [https://wiki.winehq.org/FAQ#Troubleshooting Troubleshooting] section) for general tips.<br />
<br />
Also refer to the [https://appdb.winehq.org/ Wine AppDB] for an advice on specific applications.<br />
<br />
=== XWayland problems ===<br />
<br />
If you use Wine under [[Wayland#XWayland|XWayland]], you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:<br />
<br />
* flickering;<br />
* wrong window location;<br />
* wrong mouse cursor location and clicks;<br />
* keyboard detection.<br />
<br />
=== Keyboard input doesn't work after unfocusing application ===<br />
<br />
If you encounter this problem, you may be able to fix it by editing the registry:<br />
Under ''HKEY_CURRENT_USER\Software\Wine\X11 Driver'', add a string value ''UseTakeFocus'' and set it to ''N''.<br />
<br />
Alternatively, you can use winetricks to set the value.<br />
winetricks usetakefocus=n<br />
<br />
== See also ==<br />
<br />
* [https://www.winehq.org/ Wine Homepage]<br />
* [https://wiki.winehq.org/ Wine Wiki]<br />
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
* [[Gentoo:Wine]]<br />
* [https://www.darlinghq.org/ Darling] - a similar project for MacOS software</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=714096Wine (简体中文)2022-01-28T04:15:42Z<p>InsaneGuo: /* 安装 */</p>
<hr />
<div>{{translateme (简体中文)| 进度:35%}}<br />
[[Category:Emulation]]<br />
[[Category:Gaming]]<br />
[[de:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
[[zh-hans:Wine]]<br />
{{Related articles start}}<br />
{{Related|CrossOver}}<br />
{{Related|Deepin-wine}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
[[Wikipedia:Wine (software)|Wine]] 是一款可以在类 unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而不会像模拟器那样影响性能/内存。<br />
<br />
{{警告|<br />
* Wine并非与你的系统分离。<br />
* 如果您可以使用您的用户帐户访问文件或资源,那么在 Wine 中运行的程序也可以。参见[[ # running Wine under a separate user account ]]和[[ Security # sandboxing applications ]]了解可能的预防措施。<br />
* Wine 也可以运行恶意软件(参见[ https://wiki.winehq.org/FAQ#is_wine_malware-compatible.3f 葡萄酒常见问题]])}}<br />
<br />
== 安装 ==<br />
<br />
可以通过启用[[multilib]] 库来 [[install|安装]] {{Pkg|wine}} (稳定) 或 {{Pkg|wine-staging}} (测试) 包。 [https://wine-staging.com/ Wine Staging]是[https://www.winehq.org/ Wine]的修补版本 [https://www.winehq.org/ Wine], 其中包含了 bug 修复和尚未集成到稳定或开发分支中的特性。<br />
<br />
另请参阅[[#Graphics drivers| # 图形驱动程序]]和[[#Sound|# 声音]]以了解其他需求。<br />
<br />
可以考虑为依赖于 Internet Explorer 和 .NET 的应用程序分别安装{{pkg|wine-gecko}}和{{pkg|wine-mono}}。这些软件包并不是严格要求的,因为 Wine 会根据需要下载相关文件。但是,提前下载文件可以让您离线工作,这样 Wine 就不会为每个需要它们的 Wine 前缀下载文件。<br />
<br />
=== 第三方Wine应用 ===<br />
<br />
这些都有自己的社区和网站,并不受主要Wine社区的支持。详情请参阅[https://wiki.winehq.org/Third_Party_Applications Wine Wiki] 。<br />
<br />
* {{App|[[CrossOver]]|Wine 的付费商业版,提供更全面的终端用户支持。|https://www.codeweavers.com|{{AUR|crossover}}}}<br />
* {{App|exe-thumbnailer|为 Windows 可执行文件(. exe、 . lnk、 . msi 和. dll)生成缩略图。|https://github.com/exe-thumbnailer/exe-thumbnailer|{{AUR|exe-thumbnailer}}}}<br />
* {{App|[[Wikipedia:Lutris|Lutris]]|所有类型游戏的游戏启动器,包括 Wine 游戏(带前缀管理)、原生 Linux 游戏和模拟器。|https://lutris.net|{{Pkg|lutris}}}}<br />
* {{App|[[Wikipedia:PlayOnLinux|PlayOnLinux]]|Wine 的图形化前缀管理器。包含帮助程序安装和配置的脚本。|https://www.playonlinux.com|{{Pkg|playonlinux}}}}<br />
* {{App|Proton|Compatibility tool 基于Wine和其他部件为[Wikipedia:Steam]制造的Proton兼容性工具。兼容性列表见 [https://www.protondb.com/ ProtonDB] <br />
|list.|https://github.com/ValveSoftware/Proton|{{AUR|proton}}}}<br />
* {{App|PyWinery|Wine 的简单图形化前缀管理器。|https://github.com/ergoithz/pywinery|{{AUR|pywinery}}}}<br />
* {{App|Q4Wine|Wine 的图形前缀管理器。可以将 [[Qt]] 主题导出到 Wine 配置中,以便更好地集成。|https://sourceforge.net/projects/q4wine/|{{AUR|q4wine}}{{Broken package link|package not found}}}}<br />
* {{App|Bottles|基于 GTK 的 Wine 的图形化前缀和管理器。|https://usebottles.com/|{{AUR|bottles}}}}<br />
<br />
== 配置 ==<br />
<br />
配置Wine通常使用以下方法:<br />
<br />
* [https://wiki.winehq.org/Winecfg winecfg] 是 Wine 的 GUI 配置工具,可以通过运行{{ic|winecfg}}启动它。 <br />
* [https://wiki.winehq.org/Regedit regedit] 是 Wine 的注册表编辑工具,可以通过运行{{ic|regedit}} 来启动。See WineHQ's article on [https://wiki.winehq.org/Useful_Registry_Keys Useful Registry Keys].<br />
* [https://wiki.winehq.org/Control control] 是 Wine 的 Windows 控件面板的实现,它可以通过运行{{ic|wine control}}来启动。<br />
* 完整列表见 [https://wiki.winehq.org/List_of_Commands WineHQ 的命令列表]。<br />
<br />
=== WINEPREFIX ===<br />
<br />
默认情况下,Wine 将其配置文件和安装的 Windows 程序存储在 {{ic|~/.wine}} 。这个目录通常被称为“ Wine prefix”或“ Wine bottle”。当您运行 Windows 程序或 Wine 的捆绑程序(如 winecfg)时,它会自动创建/更新。前缀目录还包含一个目录,您的 Windows 程序将其视为 {{ic|c:}} (C盘)。<br />
<br />
你可以使用 {{ic|WINEPREFIX}}环境变量覆盖 Wine 使用的前缀位置。如果您希望为不同的 Windows 程序使用单独的配置,这将非常有用。第一次运行带有新 Wine 前缀的程序时,Wine 将自动创建一个带有 c 驱动器和注册表的目录。<br />
<br />
例如,如果您运行一个带有{{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}的程序,和另一个 {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}这两个程序将分别有一个单独的 c 驱动器和单独的注册。<br />
<br />
{{注意: Wine不是沙箱!在 Wine 下运行的程序仍然可以访问系统的其余部分!(例如, {{ic|Z:}} 映射到 {{ic|/}}, 与 Wine 前缀无关).}}<br />
<br />
若要在不运行 Windows 程序或其他 GUI 工具的情况下创建默认前缀,可以使用:<br />
<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
Wine will start a 64-bit environment by default. You can change this behavior using the {{ic|WINEARCH}} [[environment variable]]. Rename your {{ic|~/.wine}} directory and create a new Wine environment by running {{ic|1=$ WINEARCH=win32 winecfg}}. This will get you a 32-bit Wine environment. Not setting {{ic|WINEARCH}} will get you a 64-bit one.<br />
<br />
You can combine this with {{ic|WINEPREFIX}} to make a separate {{ic|win32}} and {{ic|win64}} environment:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
You can also use {{ic|WINEARCH}} in combination with other Wine programs, such as ''winetricks'' (using Steam as an example):<br />
<br />
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
In order to see the architecture of an existing prefix you can check its registry file. The command below reads the system registry of the {{ic|~/.wine}} prefix and returns {{ic|1=#arch=win32}} or {{ic|1=#arch=win64}} depending on the architecture type:<br />
<br />
$ grep '#arch' ~/.wine/system.reg<br />
<br />
=== Graphics drivers ===<br />
<br />
You need to install the 32-bit version of your graphics driver. Please install the package that is listed in the ''OpenGL (multilib)'' column in the table in [[Xorg#Driver installation]].<br />
<br />
A good sign that your drivers are inadequate or not properly configured is when Wine reports the following in your terminal window:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{Note|You might need to restart X after having installed the correct library.}}<br />
<br />
=== Sound ===<br />
<br />
By default sound issues may arise when running Wine applications. Ensure only one sound device is selected in ''winecfg''.<br />
<br />
Install the correct packages for the audio driver you want to use:<br />
<br />
* For [[ALSA]] install {{Pkg|lib32-alsa-lib}} and {{Pkg|lib32-alsa-plugins}}<br />
* For [[PulseAudio]] install {{Pkg|lib32-libpulse}} <br />
* For [[PipeWire]] install either {{Pkg|pipewire-pulse}} and {{Pkg|lib32-libpulse}} or {{Pkg|pipewire-alsa}} and {{Pkg|lib32-alsa-lib}} + {{Pkg|lib32-alsa-plugins}}<br />
* For [[OSS]] install {{Pkg|lib32-alsa-oss}}<br />
<br />
Additional packages: <br />
<br />
* Games that use advanced sound systems (''e.g.'' TESV: Skyrim) may additionally require installations of {{Pkg|lib32-openal}}.<br />
<br />
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [https://wiki.winehq.org/Wine_User's_Guide#Using_Regedit configure it via the registry]. For example, in a case where the microphone was not working in a 32-bit Windows application on a 64-bit stock install of wine-1.9.7, this provided full access to the sound hardware (sound playback and mic): open ''regedit'', look for the key HKEY_CURRENT_USER → Software → Wine → Drivers, and add a string called ''Audio'' and give it the value ''alsa''. Also, it may help to [[#WINEARCH|recreate the prefix]].<br />
<br />
==== MIDI support ====<br />
<br />
[[MIDI]] 是90年代流行的电子游戏音乐系统。如果你正在尝试旧的游戏,这是不寻常的音乐不会发挥出来的盒子。<br />
葡萄酒有很好的 MIDI 支持。但是,您首先需要使它在您的主机系统上工作,如[[ MIDI ]]中所解释的。最后但并非最不重要的是,您需要确保 Wine 将使用正确的 MIDI 输出。<br />
<br />
=== Other dependencies ===<br />
<br />
Some applications may require additional packages for the following purposes:<br />
<br />
* playing music: {{Pkg|lib32-mpg123}}<br />
* native image manipulation libraries: {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}<br />
* encryption support: {{Pkg|lib32-gnutls}}<br />
* 32-bit video codecs: {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}<br />
* NTLM authentication: {{Pkg|samba}}<br />
<br />
=== Fonts ===<br />
<br />
如果 Wine 应用程序没有显示易读的字体,则可能没有安装任何字体。轻松链接所有的系统字体,使他们可以从Wine:<br />
<br />
$ cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; 来完成<br />
<br />
使用 FreeType 渲染字体,而 FreeType 的默认设置在几个版本之前已经改变了。尝试在葡萄酒项目中使用这种环境设置:<br />
FREETYPE_PROPERTIES="truetype:interpreter-version=35"<br />
<br />
另一种可能性是在葡萄酒前缀中安装微软的 TrueType 字体。 See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
运行此类程序后,关闭所有 Wine 服务并运行{{ic| winecfg }}。字体现在应该是可读的。<br />
<br />
如果字体看起来模糊不清,导入以下文本文件到 Wine 注册表[https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
Windows Registry Editor Version 5.00<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
对于高分辨率显示,可以在 winecfg 中调整 dpi 值。<br />
<br />
See also [[Font configuration#Applications without fontconfig support]].<br />
<br />
==== Enable font smoothing ====<br />
<br />
提高Wine染效果的一个好方法是使用明显的字体平滑。/n要启用“次像素平滑(ClearType) RGB”:<br />
<br />
{{bc|<nowiki><br />
cat << EOF > /tmp/fontsmoothing<br />
REGEDIT4<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingOrientation"=dword:00000001<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
EOF<br />
<br />
WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null<br />
</nowiki>}}<br />
<br />
For more information, check [https://askubuntu.com/a/219795 the original answer]<br />
<br />
=== Desktop launcher menus ===<br />
<br />
当 Windows 应用程序安装程序创建一个快捷方式时,Wine 创建一个[[.desktop]]Arch Linux 中这些文件的默认位置是:<br />
<br />
* Desktop shortcuts are put in {{ic|~/Desktop}}<br />
* Start menu shortcuts are put in {{ic|~/.local/share/applications/wine/Programs/}}<br />
<br />
{{Note|1=Wine does not support installing Windows applications for all users, so it will not put ''.desktop'' files in {{ic|/usr/share/applications}}. See WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}<br />
<br />
{{Tip|If menu items were ''not'' created while installing software or have been lost, {{ic|wine winemenubuilder}} may be of some use.}}<br />
<br />
==== Creating menu entries for Wine utilities ====<br />
<br />
默认情况下,Wine 的安装不会为 Wine 附带的软件创建桌面菜单/图标(例如“ winecfg”、“ winebroserer”等)。这可以通过安装{{AUR | wine-installer}}或{{ AUR | wine-installer-git }}meta-package (后者没有附加依赖项)来实现,否则这些说明将为这些应用程序添加条目。<br />
<br />
首先,使用 Wine 安装一个 Windows 程序来创建基本菜单。创建基本菜单后,可以在 {{ic|~/.local/share/applications/wine/}}:<br />
<br />
{{hc|wine-browsedrive.desktop|2=<br />
[Desktop Entry]<br />
Name=Browse C: Drive<br />
Comment=Browse your virtual C: drive<br />
Exec=wine winebrowser c:<br />
Terminal=false<br />
Type=Application<br />
Icon=folder-wine<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-uninstaller.desktop|2=<br />
[Desktop Entry]<br />
Name=Uninstall Wine Software<br />
Comment=Uninstall Windows applications for Wine<br />
Exec=wine uninstaller<br />
Terminal=false<br />
Type=Application<br />
Icon=wine-uninstaller<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-winecfg.desktop|2=<br />
[Desktop Entry]<br />
Name=Configure Wine<br />
Comment=Change application-specific and general Wine options<br />
Exec=winecfg<br />
Terminal=false<br />
Icon=wine-winecfg<br />
Type=Application<br />
Categories=Wine;<br />
}}<br />
<br />
And create the following file in {{ic|~/.config/menus/applications-merged/}}:<br />
<br />
{{hc|wine.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Category>Wine</Category><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
<br />
如果这些设置产生了一个难看的/不存在的图标,这意味着在您所启用的图标集中没有这些启动程序的图标。您应该将图标设置替换为所需图标的显式位置。单击启动器属性菜单中的图标将会产生同样的效果。一个优秀的图标集,支持这些捷径是 [https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors].<br />
<br />
==== Removing menu entries ====<br />
<br />
由 Wine 创建的菜单条目位于 {{ic|~/.local/share/applications/wine/Programs/}}.<br />
除了通过 Wine 删除不需要的扩展绑定,还可以执行以下命令(摘自 Wine 官网) :<br />
<br />
$ rm ~/.local/share/mime/packages/x-wine*<br />
$ rm ~/.local/share/applications/wine-extension*<br />
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
$ rm ~/.local/share/mime/application/x-wine-extension*<br />
<br />
Sometimes you should also remove {{ic|wine-*.menu}} files from {{ic|/.config/menus/}} to completely remove items from wine submenu in kde.<br />
<br />
=== 主题 ===<br />
<br />
类似于 xp 外观的主题可以在这里 [https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 下载]. To install it, see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files this upstream wiki article]. Lastly, use ''winecfg'' to select it.<br />
<br />
{{Note|上面链接的主题只能安装在32位前缀上,前缀版本为 windowsxp。要将其安装在64位前缀上,可能需要创建一个临时的32位前缀,install the theme and copy the {{ic|Zune}} folder and {{ic|Zune.theme}} files from {{ic|drive_c/Windows/Resources/Themes}} in that prefix to the same location in your usual prefix.}}<br />
<br />
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.<br />
<br />
=== Printing ===<br />
<br />
In order to use your installed printers (both local and network) with wine applications in ''win32 prefixes'' (e.g. MS Word), install the {{Pkg|lib32-libcups}} package, reboot wine (''wineboot'') and restart your wine application.<br />
<br />
=== Networking ===<br />
<br />
After installation, the {{pkg|lib32-gnutls}} package may need to be [[install]]ed for applications making TLS or HTTPS connections to work.<br />
<br />
For ICMP (ping), Wine may need the network access as described in the [https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
<br />
If issues arise after this (such as an unhandled exception or privileged instruction), remove via:<br />
<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== Usage ==<br />
<br />
{{Warning|Do not run or install Wine applications as root! See [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ] for details.}}<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Using_Wine Wine User's Guide] for general information on Wine usage.<br />
<br />
See [https://appdb.winehq.org/ Wine Application Database (AppDB)] for additional information on specific Windows applications in Wine.<br />
<br />
=== Wayland ===<br />
<br />
Currently Wine does not support Wayland directly, but you can use [[Wayland#XWayland|XWayland]] instead.<br />
<br />
There are some efforts to support Wayland though:<br />
<br />
* Experimental Wayland driver for Wine, which supports using OpenGL- and Windows GDI-applications. See [https://www.winehq.org/pipermail/wine-devel/2020-December/178575.html this] and [https://www.winehq.org/pipermail/wine-devel/2021-February/181325.html this] wine-devel maillist entries.<br />
* [https://github.com/varmd/wine-wayland wine-wayland]: a custom version of Wine, which supports Wayland via Vulkan (so it supports only: DirectX 9, 10 and 11 via [[#DXVK]] and Vulkan-compatible applications).<br />
<br />
== Tips and tricks ==<br />
<br />
=== Wineconsole ===<br />
<br />
Often you may need to run ''.exe'''s to patch game files, for example a widescreen mod for an old game, and running the ''.exe'' normally through Wine might yield nothing happening. In this case, you can open a terminal and run the following command:<br />
<br />
$ wineconsole cmd<br />
<br />
Then navigate to the directory and run the ''.exe'' file from there.<br />
<br />
=== Winetricks ===<br />
<br />
[https://wiki.winehq.org/Winetricks Winetricks] is a script to allow one to install base requirements needed to run Windows programs. Installable components include DirectX 9.x, MSXML (required by Microsoft Office 2007 and Internet Explorer), Visual Runtime libraries and many more.<br />
<br />
[[Install]] the {{pkg|winetricks}} package (or alternatively {{AUR|winetricks-git}}). Then run it with:<br />
$ winetricks<br />
<br />
For using GUI you should [[install]] the {{pkg|zenity}}.<br />
<br />
=== Performance ===<br />
<br />
==== CSMT ====<br />
<br />
CSMT is a technology used by Wine to use a separate thread for the OpenGL calls to improve performance noticeably. Since Wine 3.2, CSMT is enabled by default. However, CSMT support needs to be enabled manually for Wine versions lower than 3.2. For vanilla Wine run {{ic|wine regedit}} and set the DWORD value for ''HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt'' to 0x01 (enabled). For wine-staging run {{ic|winecfg}} and enable it in the staging tab.<br />
<br />
Note that CSMT may actually hurt performance for some applications - if this is the case, disable it by creating/setting the registry value to 0x00 (disabled).<br />
<br />
Further information:<br />
*[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion] with the CSMT developer Stefan Dösinger<br />
<br />
==== Force OpenGL mode in games ====<br />
<br />
Some games might have an OpenGL mode which ''may'' perform better than their default DirectX mode. While the steps to enable OpenGL rendering is ''application specific'', many games accept the {{Ic|-opengl}} parameter.<br />
<br />
$ wine ''/path/to/3d_game.exe'' -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [https://appdb.winehq.org AppDB] for such application specific information.<br />
<br />
==== DXVK ====<br />
<br />
[https://github.com/doitsujin/dxvk DXVK] is a promising new implementation for DirectX 9, 10 & 11 over Vulkan. This should allow for greater performance, and in some cases, even better compatibility. Battlefield 1 for example, only runs under DXVK. On the other hand, DXVK does not support all Wine games (yet).<br />
<br />
To use it, install {{aur|dxvk-bin}}. Then run the following command to activate it in your Wineprefix (by default {{ic|~/.wine}}):<br />
$ WINEPREFIX=''your-prefix'' setup_dxvk install<br />
<br />
{{Note|For Wine versions below 3.5 you need to configure Vulkan support manually, following the instructions at [https://github.com/roderickc/wine-vulkan GitHub].}}<br />
<br />
{{Warning|DXVK overrides the DirectX 10 and 11 DLLs, which may be considered cheating in online multiplayer games, and may get your account '''banned'''. Use at your own risk!}}<br />
<br />
==== Gallium Nine ====<br />
<br />
With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.<br />
<br />
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any Wine version. Use {{ic|wine ninewinecfg}} to check if it is enabled.<br />
<br />
For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. [[Export]] the following environment variable before running Wine: <br />
<br />
MESA_LOADER_DRIVER_OVERRIDE=crocus<br />
<br />
=== Unregister existing Wine file associations ===<br />
<br />
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.<br />
<br />
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
$ update-mime-database ~/.local/share/mime/<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Prevent Wine from creating filetype associations ===<br />
<br />
{{Note|This has to be done for each WINEPREFIX which should not update file associations unless you opt to change {{ic|/usr/share/wine/wine.inf}} .}}<br />
This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).<br />
<br />
If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See [https://wiki.winehq.org/FAQ#How_can_I_prevent_Wine_from_changing_the_filetype_associations_on_my_system_or_adding_unwanted_menu_entries.2Fdesktop_links.3F Wine FAQ]<br />
<br />
To make the same change via registry add the string {{ic|Enable}} with value {{ic|N}} under:<br />
<br />
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations<br />
<br />
''You might have to create the key {{ic|FileOpenAssociations}} first!''<br />
<br />
If you want to apply this by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}} and add this line for example under the {{ic|[Services]}} section:<br />
HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"<br />
<br />
To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:<br />
<br />
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=<br />
<br />
[Trigger]<br />
Operation = Install<br />
Operation = Upgrade<br />
Type = Path<br />
Target = usr/share/wine/wine.inf<br />
<br />
[Action]<br />
Description = Stopping Wine from hijacking file associations...<br />
When = PostTransaction<br />
<nowiki>Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'</nowiki><br />
}}<br />
<br />
See [[Pacman#Hooks]]<br />
<br />
=== Execute Windows binaries with Wine implicitly ===<br />
<br />
The {{pkg|wine}} package installs a ''binfmt'' file which will allows you to run Windows programs directly, e.g. {{ic|''./myprogram.exe''}} will launch as if you had typed {{ic|wine ''./myprogram.exe''}}. Service starts by default on boot, if you have not rebooted after installing Wine you can [[start]] {{ic|systemd-binfmt.service}} to use it right away.<br />
<br />
{{Note|Make sure the Windows binary is [[executable]], otherwise the binary will not run.}}<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). [[CDemu]] will handle it correctly.<br />
<br />
=== Show FPS overlay in games ===<br />
<br />
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.<br />
<br />
=== Running Wine under a separate user account ===<br />
<br />
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.<br />
<br />
First, create a [[user account]] for Wine:<br />
<br />
# useradd -m -s /bin/bash wineuser<br />
<br />
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...<br />
<br />
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information on how to execute the {{ic|xhost}} command under your main user.}}<br />
<br />
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:<br />
<br />
$ xhost +SI:localuser:wineuser<br />
<br />
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:<br />
<br />
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''<br />
<br />
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:<br />
{{hc|1=/usr/local/bin/runaswine|2=<br />
#!/bin/bash<br />
xhost +SI:localuser:wineuser<br />
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}<br />
<br />
Wine applications can then be launched via:<br />
<br />
$ runaswine ''"C:\path\to\application.exe"''<br />
<br />
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.<br />
<br />
It is recommended to run {{ic|winecfg}} as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.<br />
<br />
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to share a PulseAudio daemon]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.<br />
<br />
=== Temp directory on tmpfs ===<br />
<br />
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:<br />
<br />
$ rm -r ~/.wine/drive_c/users/$USER/Temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp<br />
<br />
=== Prevent installing Mono/Gecko ===<br />
<br />
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.<br />
<br />
=== Vulkan ===<br />
<br />
Vulkan support is included, since Wine 3.3. The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].<br />
<br />
{{Note|The Wine ICD loader was added in Wine 3.5, you need to install the official Vulkan SDK to use Vulkan in Wine 3.3 and 3.4}}<br />
<br />
=== Remove Wine file bindings ===<br />
<br />
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).<br />
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}<br />
<br />
NoExtract = usr/lib/binfmt.d/wine.conf<br />
NoExtract = usr/share/applications/wine.desktop<br />
<br />
== Troubleshooting ==<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Troubleshooting_.2F_Reporting_bugs Wine User's Guide] and [https://wiki.winehq.org/FAQ Wine FAQ] (especially its [https://wiki.winehq.org/FAQ#Troubleshooting Troubleshooting] section) for general tips.<br />
<br />
Also refer to the [https://appdb.winehq.org/ Wine AppDB] for an advice on specific applications.<br />
<br />
=== XWayland problems ===<br />
<br />
If you use Wine under [[Wayland#XWayland|XWayland]], you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:<br />
<br />
* flickering;<br />
* wrong window location;<br />
* wrong mouse cursor location and clicks;<br />
* keyboard detection.<br />
<br />
=== Keyboard input doesn't work after unfocusing application ===<br />
<br />
If you encounter this problem, you may be able to fix it by editing the registry:<br />
Under ''HKEY_CURRENT_USER\Software\Wine\X11 Driver'', add a string value ''UseTakeFocus'' and set it to ''N''.<br />
<br />
Alternatively, you can use winetricks to set the value.<br />
winetricks usetakefocus=n<br />
<br />
== See also ==<br />
<br />
* [https://www.winehq.org/ Wine Homepage]<br />
* [https://wiki.winehq.org/ Wine Wiki]<br />
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
* [[Gentoo:Wine]]<br />
* [https://www.darlinghq.org/ Darling] - a similar project for MacOS software</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=714095Wine (简体中文)2022-01-28T04:04:36Z<p>InsaneGuo: </p>
<hr />
<div>{{translateme (简体中文)| 进度:35%}}<br />
[[Category:Emulation]]<br />
[[Category:Gaming]]<br />
[[de:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
[[zh-hans:Wine]]<br />
{{Related articles start}}<br />
{{Related|CrossOver}}<br />
{{Related|Deepin-wine}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
[[Wikipedia:Wine (software)|Wine]] 是一款可以在类 unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而不会像模拟器那样影响性能/内存。<br />
<br />
{{警告|<br />
* Wine并非与你的系统分离。<br />
* 如果您可以使用您的用户帐户访问文件或资源,那么在 Wine 中运行的程序也可以。参见[[ # running Wine under a separate user account ]]和[[ Security # sandboxing applications ]]了解可能的预防措施。<br />
* Wine 也可以运行恶意软件(参见[ https://wiki.winehq.org/FAQ#is_wine_malware-compatible.3f 葡萄酒常见问题]])}}<br />
<br />
== 安装 ==<br />
<br />
可以通过启用[[multilib]] 库来 [[install|安装]] {{Pkg|wine}} (稳定) 或 {{Pkg|wine-staging}} (测试) 包。 [https://wine-staging.com/ Wine Staging] Wine Staging 是[https://www.winehq.org/ Wine]的修补版本 [https://www.winehq.org/ Wine], 其中包含了 bug 修复和尚未集成到稳定或开发分支中的特性。<br />
<br />
另请参阅[[#Graphics drivers| # 图形驱动程序]]和[[#Sound|# 声音]]以了解其他需求。<br />
<br />
可以考虑为依赖于 Internet Explorer 和 .NET 的应用程序分别安装{{pkg|wine-gecko}}和{{pkg|wine-mono}}。这些软件包并不是严格要求的,因为 Wine 会根据需要下载相关文件。但是,提前下载文件可以让您离线工作,这样 Wine 就不会为每个需要它们的 Wine 前缀下载文件。<br />
<br />
=== 第三方Wine应用 ===<br />
<br />
这些都有自己的社区和网站,并不受主要葡萄酒社区的支持。详情请参阅[https://wiki.winehq.org/Third_Party_Applications Wine Wiki] 。<br />
<br />
* {{App|[[CrossOver]]|Wine 的付费商业版,提供更全面的终端用户支持。|https://www.codeweavers.com|{{AUR|crossover}}}}<br />
* {{App|exe-thumbnailer|为 Windows 可执行文件(. exe、 . lnk、 . msi 和. dll)生成缩略图。|https://github.com/exe-thumbnailer/exe-thumbnailer|{{AUR|exe-thumbnailer}}}}<br />
* {{App|[[Wikipedia:Lutris|Lutris]]|所有类型游戏的游戏启动器,包括 Wine 游戏(带前缀管理)、原生 Linux 游戏和模拟器。|https://lutris.net|{{Pkg|lutris}}}}<br />
* {{App|[[Wikipedia:PlayOnLinux|PlayOnLinux]]|Wine 的图形化前缀管理器。包含帮助程序安装和配置的脚本。|https://www.playonlinux.com|{{Pkg|playonlinux}}}}<br />
* {{App|Proton|Compatibility tool 基于Wine和其他部件为[Wikipedia:Steam]制造的Proton兼容性工具。兼容性列表见 [https://www.protondb.com/ ProtonDB] <br />
|list.|https://github.com/ValveSoftware/Proton|{{AUR|proton}}}}<br />
* {{App|PyWinery|Wine 的简单图形化前缀管理器。|https://github.com/ergoithz/pywinery|{{AUR|pywinery}}}}<br />
* {{App|Q4Wine|Wine 的图形前缀管理器。可以将 [[Qt]] 主题导出到 Wine 配置中,以便更好地集成。|https://sourceforge.net/projects/q4wine/|{{AUR|q4wine}}{{Broken package link|package not found}}}}<br />
* {{App|Bottles|基于 GTK 的 Wine 的图形化前缀和管理器。|https://usebottles.com/|{{AUR|bottles}}}}<br />
<br />
== 配置 ==<br />
<br />
配置Wine通常使用以下方法:<br />
<br />
* [https://wiki.winehq.org/Winecfg winecfg] 是 Wine 的 GUI 配置工具,可以通过运行{{ic|winecfg}}启动它。 <br />
* [https://wiki.winehq.org/Regedit regedit] 是 Wine 的注册表编辑工具,可以通过运行{{ic|regedit}} 来启动。See WineHQ's article on [https://wiki.winehq.org/Useful_Registry_Keys Useful Registry Keys].<br />
* [https://wiki.winehq.org/Control control] 是 Wine 的 Windows 控件面板的实现,它可以通过运行{{ic|wine control}}来启动。<br />
* 完整列表见 [https://wiki.winehq.org/List_of_Commands WineHQ 的命令列表]。<br />
<br />
=== WINEPREFIX ===<br />
<br />
默认情况下,Wine 将其配置文件和安装的 Windows 程序存储在 {{ic|~/.wine}} 。这个目录通常被称为“ Wine prefix”或“ Wine bottle”。当您运行 Windows 程序或 Wine 的捆绑程序(如 winecfg)时,它会自动创建/更新。前缀目录还包含一个目录,您的 Windows 程序将其视为 {{ic|c:}} (C盘)。<br />
<br />
你可以使用 {{ic|WINEPREFIX}}环境变量覆盖 Wine 使用的前缀位置。如果您希望为不同的 Windows 程序使用单独的配置,这将非常有用。第一次运行带有新 Wine 前缀的程序时,Wine 将自动创建一个带有 c 驱动器和注册表的目录。<br />
<br />
例如,如果您运行一个带有{{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}的程序,和另一个 {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}这两个程序将分别有一个单独的 c 驱动器和单独的注册。<br />
<br />
{{注意: Wine不是沙箱!在 Wine 下运行的程序仍然可以访问系统的其余部分!(例如, {{ic|Z:}} 映射到 {{ic|/}}, 与 Wine 前缀无关).}}<br />
<br />
若要在不运行 Windows 程序或其他 GUI 工具的情况下创建默认前缀,可以使用:<br />
<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
Wine will start a 64-bit environment by default. You can change this behavior using the {{ic|WINEARCH}} [[environment variable]]. Rename your {{ic|~/.wine}} directory and create a new Wine environment by running {{ic|1=$ WINEARCH=win32 winecfg}}. This will get you a 32-bit Wine environment. Not setting {{ic|WINEARCH}} will get you a 64-bit one.<br />
<br />
You can combine this with {{ic|WINEPREFIX}} to make a separate {{ic|win32}} and {{ic|win64}} environment:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
You can also use {{ic|WINEARCH}} in combination with other Wine programs, such as ''winetricks'' (using Steam as an example):<br />
<br />
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
In order to see the architecture of an existing prefix you can check its registry file. The command below reads the system registry of the {{ic|~/.wine}} prefix and returns {{ic|1=#arch=win32}} or {{ic|1=#arch=win64}} depending on the architecture type:<br />
<br />
$ grep '#arch' ~/.wine/system.reg<br />
<br />
=== Graphics drivers ===<br />
<br />
You need to install the 32-bit version of your graphics driver. Please install the package that is listed in the ''OpenGL (multilib)'' column in the table in [[Xorg#Driver installation]].<br />
<br />
A good sign that your drivers are inadequate or not properly configured is when Wine reports the following in your terminal window:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{Note|You might need to restart X after having installed the correct library.}}<br />
<br />
=== Sound ===<br />
<br />
By default sound issues may arise when running Wine applications. Ensure only one sound device is selected in ''winecfg''.<br />
<br />
Install the correct packages for the audio driver you want to use:<br />
<br />
* For [[ALSA]] install {{Pkg|lib32-alsa-lib}} and {{Pkg|lib32-alsa-plugins}}<br />
* For [[PulseAudio]] install {{Pkg|lib32-libpulse}} <br />
* For [[PipeWire]] install either {{Pkg|pipewire-pulse}} and {{Pkg|lib32-libpulse}} or {{Pkg|pipewire-alsa}} and {{Pkg|lib32-alsa-lib}} + {{Pkg|lib32-alsa-plugins}}<br />
* For [[OSS]] install {{Pkg|lib32-alsa-oss}}<br />
<br />
Additional packages: <br />
<br />
* Games that use advanced sound systems (''e.g.'' TESV: Skyrim) may additionally require installations of {{Pkg|lib32-openal}}.<br />
<br />
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [https://wiki.winehq.org/Wine_User's_Guide#Using_Regedit configure it via the registry]. For example, in a case where the microphone was not working in a 32-bit Windows application on a 64-bit stock install of wine-1.9.7, this provided full access to the sound hardware (sound playback and mic): open ''regedit'', look for the key HKEY_CURRENT_USER → Software → Wine → Drivers, and add a string called ''Audio'' and give it the value ''alsa''. Also, it may help to [[#WINEARCH|recreate the prefix]].<br />
<br />
==== MIDI support ====<br />
<br />
[[MIDI]] 是90年代流行的电子游戏音乐系统。如果你正在尝试旧的游戏,这是不寻常的音乐不会发挥出来的盒子。<br />
葡萄酒有很好的 MIDI 支持。但是,您首先需要使它在您的主机系统上工作,如[[ MIDI ]]中所解释的。最后但并非最不重要的是,您需要确保 Wine 将使用正确的 MIDI 输出。<br />
<br />
=== Other dependencies ===<br />
<br />
Some applications may require additional packages for the following purposes:<br />
<br />
* playing music: {{Pkg|lib32-mpg123}}<br />
* native image manipulation libraries: {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}<br />
* encryption support: {{Pkg|lib32-gnutls}}<br />
* 32-bit video codecs: {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}<br />
* NTLM authentication: {{Pkg|samba}}<br />
<br />
=== Fonts ===<br />
<br />
如果 Wine 应用程序没有显示易读的字体,则可能没有安装任何字体。轻松链接所有的系统字体,使他们可以从Wine:<br />
<br />
$ cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; 来完成<br />
<br />
使用 FreeType 渲染字体,而 FreeType 的默认设置在几个版本之前已经改变了。尝试在葡萄酒项目中使用这种环境设置:<br />
FREETYPE_PROPERTIES="truetype:interpreter-version=35"<br />
<br />
另一种可能性是在葡萄酒前缀中安装微软的 TrueType 字体。 See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
运行此类程序后,关闭所有 Wine 服务并运行{{ic| winecfg }}。字体现在应该是可读的。<br />
<br />
如果字体看起来模糊不清,导入以下文本文件到 Wine 注册表[https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
Windows Registry Editor Version 5.00<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
对于高分辨率显示,可以在 winecfg 中调整 dpi 值。<br />
<br />
See also [[Font configuration#Applications without fontconfig support]].<br />
<br />
==== Enable font smoothing ====<br />
<br />
提高Wine染效果的一个好方法是使用明显的字体平滑。/n要启用“次像素平滑(ClearType) RGB”:<br />
<br />
{{bc|<nowiki><br />
cat << EOF > /tmp/fontsmoothing<br />
REGEDIT4<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingOrientation"=dword:00000001<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
EOF<br />
<br />
WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null<br />
</nowiki>}}<br />
<br />
For more information, check [https://askubuntu.com/a/219795 the original answer]<br />
<br />
=== Desktop launcher menus ===<br />
<br />
当 Windows 应用程序安装程序创建一个快捷方式时,Wine 创建一个[[.desktop]]Arch Linux 中这些文件的默认位置是:<br />
<br />
* Desktop shortcuts are put in {{ic|~/Desktop}}<br />
* Start menu shortcuts are put in {{ic|~/.local/share/applications/wine/Programs/}}<br />
<br />
{{Note|1=Wine does not support installing Windows applications for all users, so it will not put ''.desktop'' files in {{ic|/usr/share/applications}}. See WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}<br />
<br />
{{Tip|If menu items were ''not'' created while installing software or have been lost, {{ic|wine winemenubuilder}} may be of some use.}}<br />
<br />
==== Creating menu entries for Wine utilities ====<br />
<br />
默认情况下,Wine 的安装不会为 Wine 附带的软件创建桌面菜单/图标(例如“ winecfg”、“ winebroserer”等)。这可以通过安装{{AUR | wine-installer}}或{{ AUR | wine-installer-git }}meta-package (后者没有附加依赖项)来实现,否则这些说明将为这些应用程序添加条目。<br />
<br />
首先,使用 Wine 安装一个 Windows 程序来创建基本菜单。创建基本菜单后,可以在 {{ic|~/.local/share/applications/wine/}}:<br />
<br />
{{hc|wine-browsedrive.desktop|2=<br />
[Desktop Entry]<br />
Name=Browse C: Drive<br />
Comment=Browse your virtual C: drive<br />
Exec=wine winebrowser c:<br />
Terminal=false<br />
Type=Application<br />
Icon=folder-wine<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-uninstaller.desktop|2=<br />
[Desktop Entry]<br />
Name=Uninstall Wine Software<br />
Comment=Uninstall Windows applications for Wine<br />
Exec=wine uninstaller<br />
Terminal=false<br />
Type=Application<br />
Icon=wine-uninstaller<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-winecfg.desktop|2=<br />
[Desktop Entry]<br />
Name=Configure Wine<br />
Comment=Change application-specific and general Wine options<br />
Exec=winecfg<br />
Terminal=false<br />
Icon=wine-winecfg<br />
Type=Application<br />
Categories=Wine;<br />
}}<br />
<br />
And create the following file in {{ic|~/.config/menus/applications-merged/}}:<br />
<br />
{{hc|wine.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Category>Wine</Category><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
<br />
如果这些设置产生了一个难看的/不存在的图标,这意味着在您所启用的图标集中没有这些启动程序的图标。您应该将图标设置替换为所需图标的显式位置。单击启动器属性菜单中的图标将会产生同样的效果。一个优秀的图标集,支持这些捷径是 [https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors].<br />
<br />
==== Removing menu entries ====<br />
<br />
由 Wine 创建的菜单条目位于 {{ic|~/.local/share/applications/wine/Programs/}}.<br />
除了通过 Wine 删除不需要的扩展绑定,还可以执行以下命令(摘自 Wine 官网) :<br />
<br />
$ rm ~/.local/share/mime/packages/x-wine*<br />
$ rm ~/.local/share/applications/wine-extension*<br />
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
$ rm ~/.local/share/mime/application/x-wine-extension*<br />
<br />
Sometimes you should also remove {{ic|wine-*.menu}} files from {{ic|/.config/menus/}} to completely remove items from wine submenu in kde.<br />
<br />
=== 主题 ===<br />
<br />
类似于 xp 外观的主题可以在这里 [https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 下载]. To install it, see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files this upstream wiki article]. Lastly, use ''winecfg'' to select it.<br />
<br />
{{Note|上面链接的主题只能安装在32位前缀上,前缀版本为 windowsxp。要将其安装在64位前缀上,可能需要创建一个临时的32位前缀,install the theme and copy the {{ic|Zune}} folder and {{ic|Zune.theme}} files from {{ic|drive_c/Windows/Resources/Themes}} in that prefix to the same location in your usual prefix.}}<br />
<br />
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.<br />
<br />
=== Printing ===<br />
<br />
In order to use your installed printers (both local and network) with wine applications in ''win32 prefixes'' (e.g. MS Word), install the {{Pkg|lib32-libcups}} package, reboot wine (''wineboot'') and restart your wine application.<br />
<br />
=== Networking ===<br />
<br />
After installation, the {{pkg|lib32-gnutls}} package may need to be [[install]]ed for applications making TLS or HTTPS connections to work.<br />
<br />
For ICMP (ping), Wine may need the network access as described in the [https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
<br />
If issues arise after this (such as an unhandled exception or privileged instruction), remove via:<br />
<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== Usage ==<br />
<br />
{{Warning|Do not run or install Wine applications as root! See [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ] for details.}}<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Using_Wine Wine User's Guide] for general information on Wine usage.<br />
<br />
See [https://appdb.winehq.org/ Wine Application Database (AppDB)] for additional information on specific Windows applications in Wine.<br />
<br />
=== Wayland ===<br />
<br />
Currently Wine does not support Wayland directly, but you can use [[Wayland#XWayland|XWayland]] instead.<br />
<br />
There are some efforts to support Wayland though:<br />
<br />
* Experimental Wayland driver for Wine, which supports using OpenGL- and Windows GDI-applications. See [https://www.winehq.org/pipermail/wine-devel/2020-December/178575.html this] and [https://www.winehq.org/pipermail/wine-devel/2021-February/181325.html this] wine-devel maillist entries.<br />
* [https://github.com/varmd/wine-wayland wine-wayland]: a custom version of Wine, which supports Wayland via Vulkan (so it supports only: DirectX 9, 10 and 11 via [[#DXVK]] and Vulkan-compatible applications).<br />
<br />
== Tips and tricks ==<br />
<br />
=== Wineconsole ===<br />
<br />
Often you may need to run ''.exe'''s to patch game files, for example a widescreen mod for an old game, and running the ''.exe'' normally through Wine might yield nothing happening. In this case, you can open a terminal and run the following command:<br />
<br />
$ wineconsole cmd<br />
<br />
Then navigate to the directory and run the ''.exe'' file from there.<br />
<br />
=== Winetricks ===<br />
<br />
[https://wiki.winehq.org/Winetricks Winetricks] is a script to allow one to install base requirements needed to run Windows programs. Installable components include DirectX 9.x, MSXML (required by Microsoft Office 2007 and Internet Explorer), Visual Runtime libraries and many more.<br />
<br />
[[Install]] the {{pkg|winetricks}} package (or alternatively {{AUR|winetricks-git}}). Then run it with:<br />
$ winetricks<br />
<br />
For using GUI you should [[install]] the {{pkg|zenity}}.<br />
<br />
=== Performance ===<br />
<br />
==== CSMT ====<br />
<br />
CSMT is a technology used by Wine to use a separate thread for the OpenGL calls to improve performance noticeably. Since Wine 3.2, CSMT is enabled by default. However, CSMT support needs to be enabled manually for Wine versions lower than 3.2. For vanilla Wine run {{ic|wine regedit}} and set the DWORD value for ''HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt'' to 0x01 (enabled). For wine-staging run {{ic|winecfg}} and enable it in the staging tab.<br />
<br />
Note that CSMT may actually hurt performance for some applications - if this is the case, disable it by creating/setting the registry value to 0x00 (disabled).<br />
<br />
Further information:<br />
*[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion] with the CSMT developer Stefan Dösinger<br />
<br />
==== Force OpenGL mode in games ====<br />
<br />
Some games might have an OpenGL mode which ''may'' perform better than their default DirectX mode. While the steps to enable OpenGL rendering is ''application specific'', many games accept the {{Ic|-opengl}} parameter.<br />
<br />
$ wine ''/path/to/3d_game.exe'' -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [https://appdb.winehq.org AppDB] for such application specific information.<br />
<br />
==== DXVK ====<br />
<br />
[https://github.com/doitsujin/dxvk DXVK] is a promising new implementation for DirectX 9, 10 & 11 over Vulkan. This should allow for greater performance, and in some cases, even better compatibility. Battlefield 1 for example, only runs under DXVK. On the other hand, DXVK does not support all Wine games (yet).<br />
<br />
To use it, install {{aur|dxvk-bin}}. Then run the following command to activate it in your Wineprefix (by default {{ic|~/.wine}}):<br />
$ WINEPREFIX=''your-prefix'' setup_dxvk install<br />
<br />
{{Note|For Wine versions below 3.5 you need to configure Vulkan support manually, following the instructions at [https://github.com/roderickc/wine-vulkan GitHub].}}<br />
<br />
{{Warning|DXVK overrides the DirectX 10 and 11 DLLs, which may be considered cheating in online multiplayer games, and may get your account '''banned'''. Use at your own risk!}}<br />
<br />
==== Gallium Nine ====<br />
<br />
With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.<br />
<br />
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any Wine version. Use {{ic|wine ninewinecfg}} to check if it is enabled.<br />
<br />
For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. [[Export]] the following environment variable before running Wine: <br />
<br />
MESA_LOADER_DRIVER_OVERRIDE=crocus<br />
<br />
=== Unregister existing Wine file associations ===<br />
<br />
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.<br />
<br />
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
$ update-mime-database ~/.local/share/mime/<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Prevent Wine from creating filetype associations ===<br />
<br />
{{Note|This has to be done for each WINEPREFIX which should not update file associations unless you opt to change {{ic|/usr/share/wine/wine.inf}} .}}<br />
This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).<br />
<br />
If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See [https://wiki.winehq.org/FAQ#How_can_I_prevent_Wine_from_changing_the_filetype_associations_on_my_system_or_adding_unwanted_menu_entries.2Fdesktop_links.3F Wine FAQ]<br />
<br />
To make the same change via registry add the string {{ic|Enable}} with value {{ic|N}} under:<br />
<br />
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations<br />
<br />
''You might have to create the key {{ic|FileOpenAssociations}} first!''<br />
<br />
If you want to apply this by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}} and add this line for example under the {{ic|[Services]}} section:<br />
HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"<br />
<br />
To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:<br />
<br />
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=<br />
<br />
[Trigger]<br />
Operation = Install<br />
Operation = Upgrade<br />
Type = Path<br />
Target = usr/share/wine/wine.inf<br />
<br />
[Action]<br />
Description = Stopping Wine from hijacking file associations...<br />
When = PostTransaction<br />
<nowiki>Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'</nowiki><br />
}}<br />
<br />
See [[Pacman#Hooks]]<br />
<br />
=== Execute Windows binaries with Wine implicitly ===<br />
<br />
The {{pkg|wine}} package installs a ''binfmt'' file which will allows you to run Windows programs directly, e.g. {{ic|''./myprogram.exe''}} will launch as if you had typed {{ic|wine ''./myprogram.exe''}}. Service starts by default on boot, if you have not rebooted after installing Wine you can [[start]] {{ic|systemd-binfmt.service}} to use it right away.<br />
<br />
{{Note|Make sure the Windows binary is [[executable]], otherwise the binary will not run.}}<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). [[CDemu]] will handle it correctly.<br />
<br />
=== Show FPS overlay in games ===<br />
<br />
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.<br />
<br />
=== Running Wine under a separate user account ===<br />
<br />
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.<br />
<br />
First, create a [[user account]] for Wine:<br />
<br />
# useradd -m -s /bin/bash wineuser<br />
<br />
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...<br />
<br />
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information on how to execute the {{ic|xhost}} command under your main user.}}<br />
<br />
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:<br />
<br />
$ xhost +SI:localuser:wineuser<br />
<br />
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:<br />
<br />
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''<br />
<br />
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:<br />
{{hc|1=/usr/local/bin/runaswine|2=<br />
#!/bin/bash<br />
xhost +SI:localuser:wineuser<br />
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}<br />
<br />
Wine applications can then be launched via:<br />
<br />
$ runaswine ''"C:\path\to\application.exe"''<br />
<br />
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.<br />
<br />
It is recommended to run {{ic|winecfg}} as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.<br />
<br />
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to share a PulseAudio daemon]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.<br />
<br />
=== Temp directory on tmpfs ===<br />
<br />
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:<br />
<br />
$ rm -r ~/.wine/drive_c/users/$USER/Temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp<br />
<br />
=== Prevent installing Mono/Gecko ===<br />
<br />
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.<br />
<br />
=== Vulkan ===<br />
<br />
Vulkan support is included, since Wine 3.3. The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].<br />
<br />
{{Note|The Wine ICD loader was added in Wine 3.5, you need to install the official Vulkan SDK to use Vulkan in Wine 3.3 and 3.4}}<br />
<br />
=== Remove Wine file bindings ===<br />
<br />
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).<br />
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}<br />
<br />
NoExtract = usr/lib/binfmt.d/wine.conf<br />
NoExtract = usr/share/applications/wine.desktop<br />
<br />
== Troubleshooting ==<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Troubleshooting_.2F_Reporting_bugs Wine User's Guide] and [https://wiki.winehq.org/FAQ Wine FAQ] (especially its [https://wiki.winehq.org/FAQ#Troubleshooting Troubleshooting] section) for general tips.<br />
<br />
Also refer to the [https://appdb.winehq.org/ Wine AppDB] for an advice on specific applications.<br />
<br />
=== XWayland problems ===<br />
<br />
If you use Wine under [[Wayland#XWayland|XWayland]], you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:<br />
<br />
* flickering;<br />
* wrong window location;<br />
* wrong mouse cursor location and clicks;<br />
* keyboard detection.<br />
<br />
=== Keyboard input doesn't work after unfocusing application ===<br />
<br />
If you encounter this problem, you may be able to fix it by editing the registry:<br />
Under ''HKEY_CURRENT_USER\Software\Wine\X11 Driver'', add a string value ''UseTakeFocus'' and set it to ''N''.<br />
<br />
Alternatively, you can use winetricks to set the value.<br />
winetricks usetakefocus=n<br />
<br />
== See also ==<br />
<br />
* [https://www.winehq.org/ Wine Homepage]<br />
* [https://wiki.winehq.org/ Wine Wiki]<br />
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
* [[Gentoo:Wine]]<br />
* [https://www.darlinghq.org/ Darling] - a similar project for MacOS software</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=714094Wine (简体中文)2022-01-28T04:03:40Z<p>InsaneGuo: </p>
<hr />
<div>{{translateme (简体中文)}}<br />
[[Category:Emulation]]<br />
[[Category:Gaming]]<br />
[[de:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
[[zh-hans:Wine]]<br />
{{Related articles start}}<br />
{{Related|CrossOver}}<br />
{{Related|Deepin-wine}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
[[Wikipedia:Wine (software)|Wine]] 是一款可以在类 unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而不会像模拟器那样影响性能/内存。<br />
<br />
{{警告|<br />
* Wine并非与你的系统分离。<br />
* 如果您可以使用您的用户帐户访问文件或资源,那么在 Wine 中运行的程序也可以。参见[[ # running Wine under a separate user account ]]和[[ Security # sandboxing applications ]]了解可能的预防措施。<br />
* Wine 也可以运行恶意软件(参见[ https://wiki.winehq.org/FAQ#is_wine_malware-compatible.3f 葡萄酒常见问题]])}}<br />
<br />
== 安装 ==<br />
<br />
可以通过启用[[multilib]] 库来 [[install|安装]] {{Pkg|wine}} (稳定) 或 {{Pkg|wine-staging}} (测试) 包。 [https://wine-staging.com/ Wine Staging] Wine Staging 是[https://www.winehq.org/ Wine]的修补版本 [https://www.winehq.org/ Wine], 其中包含了 bug 修复和尚未集成到稳定或开发分支中的特性。<br />
<br />
另请参阅[[#Graphics drivers| # 图形驱动程序]]和[[#Sound|# 声音]]以了解其他需求。<br />
<br />
可以考虑为依赖于 Internet Explorer 和 .NET 的应用程序分别安装{{pkg|wine-gecko}}和{{pkg|wine-mono}}。这些软件包并不是严格要求的,因为 Wine 会根据需要下载相关文件。但是,提前下载文件可以让您离线工作,这样 Wine 就不会为每个需要它们的 Wine 前缀下载文件。<br />
<br />
=== 第三方Wine应用 ===<br />
<br />
这些都有自己的社区和网站,并不受主要葡萄酒社区的支持。详情请参阅[https://wiki.winehq.org/Third_Party_Applications Wine Wiki] 。<br />
<br />
* {{App|[[CrossOver]]|Wine 的付费商业版,提供更全面的终端用户支持。|https://www.codeweavers.com|{{AUR|crossover}}}}<br />
* {{App|exe-thumbnailer|为 Windows 可执行文件(. exe、 . lnk、 . msi 和. dll)生成缩略图。|https://github.com/exe-thumbnailer/exe-thumbnailer|{{AUR|exe-thumbnailer}}}}<br />
* {{App|[[Wikipedia:Lutris|Lutris]]|所有类型游戏的游戏启动器,包括 Wine 游戏(带前缀管理)、原生 Linux 游戏和模拟器。|https://lutris.net|{{Pkg|lutris}}}}<br />
* {{App|[[Wikipedia:PlayOnLinux|PlayOnLinux]]|Wine 的图形化前缀管理器。包含帮助程序安装和配置的脚本。|https://www.playonlinux.com|{{Pkg|playonlinux}}}}<br />
* {{App|Proton|Compatibility tool 基于Wine和其他部件为[Wikipedia:Steam]制造的Proton兼容性工具。兼容性列表见 [https://www.protondb.com/ ProtonDB] <br />
|list.|https://github.com/ValveSoftware/Proton|{{AUR|proton}}}}<br />
* {{App|PyWinery|Wine 的简单图形化前缀管理器。|https://github.com/ergoithz/pywinery|{{AUR|pywinery}}}}<br />
* {{App|Q4Wine|Wine 的图形前缀管理器。可以将 [[Qt]] 主题导出到 Wine 配置中,以便更好地集成。|https://sourceforge.net/projects/q4wine/|{{AUR|q4wine}}{{Broken package link|package not found}}}}<br />
* {{App|Bottles|基于 GTK 的 Wine 的图形化前缀和管理器。|https://usebottles.com/|{{AUR|bottles}}}}<br />
<br />
== 配置 ==<br />
<br />
配置Wine通常使用以下方法:<br />
<br />
* [https://wiki.winehq.org/Winecfg winecfg] 是 Wine 的 GUI 配置工具,可以通过运行{{ic|winecfg}}启动它。 <br />
* [https://wiki.winehq.org/Regedit regedit] 是 Wine 的注册表编辑工具,可以通过运行{{ic|regedit}} 来启动。See WineHQ's article on [https://wiki.winehq.org/Useful_Registry_Keys Useful Registry Keys].<br />
* [https://wiki.winehq.org/Control control] 是 Wine 的 Windows 控件面板的实现,它可以通过运行{{ic|wine control}}来启动。<br />
* 完整列表见 [https://wiki.winehq.org/List_of_Commands WineHQ 的命令列表]。<br />
<br />
=== WINEPREFIX ===<br />
<br />
默认情况下,Wine 将其配置文件和安装的 Windows 程序存储在 {{ic|~/.wine}} 。这个目录通常被称为“ Wine prefix”或“ Wine bottle”。当您运行 Windows 程序或 Wine 的捆绑程序(如 winecfg)时,它会自动创建/更新。前缀目录还包含一个目录,您的 Windows 程序将其视为 {{ic|c:}} (C盘)。<br />
<br />
你可以使用 {{ic|WINEPREFIX}}环境变量覆盖 Wine 使用的前缀位置。如果您希望为不同的 Windows 程序使用单独的配置,这将非常有用。第一次运行带有新 Wine 前缀的程序时,Wine 将自动创建一个带有 c 驱动器和注册表的目录。<br />
<br />
例如,如果您运行一个带有{{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}的程序,和另一个 {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}这两个程序将分别有一个单独的 c 驱动器和单独的注册。<br />
<br />
{{注意: Wine不是沙箱!在 Wine 下运行的程序仍然可以访问系统的其余部分!(例如, {{ic|Z:}} 映射到 {{ic|/}}, 与 Wine 前缀无关).}}<br />
<br />
若要在不运行 Windows 程序或其他 GUI 工具的情况下创建默认前缀,可以使用:<br />
<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
Wine will start a 64-bit environment by default. You can change this behavior using the {{ic|WINEARCH}} [[environment variable]]. Rename your {{ic|~/.wine}} directory and create a new Wine environment by running {{ic|1=$ WINEARCH=win32 winecfg}}. This will get you a 32-bit Wine environment. Not setting {{ic|WINEARCH}} will get you a 64-bit one.<br />
<br />
You can combine this with {{ic|WINEPREFIX}} to make a separate {{ic|win32}} and {{ic|win64}} environment:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
You can also use {{ic|WINEARCH}} in combination with other Wine programs, such as ''winetricks'' (using Steam as an example):<br />
<br />
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
In order to see the architecture of an existing prefix you can check its registry file. The command below reads the system registry of the {{ic|~/.wine}} prefix and returns {{ic|1=#arch=win32}} or {{ic|1=#arch=win64}} depending on the architecture type:<br />
<br />
$ grep '#arch' ~/.wine/system.reg<br />
<br />
=== Graphics drivers ===<br />
<br />
You need to install the 32-bit version of your graphics driver. Please install the package that is listed in the ''OpenGL (multilib)'' column in the table in [[Xorg#Driver installation]].<br />
<br />
A good sign that your drivers are inadequate or not properly configured is when Wine reports the following in your terminal window:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{Note|You might need to restart X after having installed the correct library.}}<br />
<br />
=== Sound ===<br />
<br />
By default sound issues may arise when running Wine applications. Ensure only one sound device is selected in ''winecfg''.<br />
<br />
Install the correct packages for the audio driver you want to use:<br />
<br />
* For [[ALSA]] install {{Pkg|lib32-alsa-lib}} and {{Pkg|lib32-alsa-plugins}}<br />
* For [[PulseAudio]] install {{Pkg|lib32-libpulse}} <br />
* For [[PipeWire]] install either {{Pkg|pipewire-pulse}} and {{Pkg|lib32-libpulse}} or {{Pkg|pipewire-alsa}} and {{Pkg|lib32-alsa-lib}} + {{Pkg|lib32-alsa-plugins}}<br />
* For [[OSS]] install {{Pkg|lib32-alsa-oss}}<br />
<br />
Additional packages: <br />
<br />
* Games that use advanced sound systems (''e.g.'' TESV: Skyrim) may additionally require installations of {{Pkg|lib32-openal}}.<br />
<br />
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [https://wiki.winehq.org/Wine_User's_Guide#Using_Regedit configure it via the registry]. For example, in a case where the microphone was not working in a 32-bit Windows application on a 64-bit stock install of wine-1.9.7, this provided full access to the sound hardware (sound playback and mic): open ''regedit'', look for the key HKEY_CURRENT_USER → Software → Wine → Drivers, and add a string called ''Audio'' and give it the value ''alsa''. Also, it may help to [[#WINEARCH|recreate the prefix]].<br />
<br />
==== MIDI support ====<br />
<br />
[[MIDI]] 是90年代流行的电子游戏音乐系统。如果你正在尝试旧的游戏,这是不寻常的音乐不会发挥出来的盒子。<br />
葡萄酒有很好的 MIDI 支持。但是,您首先需要使它在您的主机系统上工作,如[[ MIDI ]]中所解释的。最后但并非最不重要的是,您需要确保 Wine 将使用正确的 MIDI 输出。<br />
<br />
=== Other dependencies ===<br />
<br />
Some applications may require additional packages for the following purposes:<br />
<br />
* playing music: {{Pkg|lib32-mpg123}}<br />
* native image manipulation libraries: {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}<br />
* encryption support: {{Pkg|lib32-gnutls}}<br />
* 32-bit video codecs: {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}<br />
* NTLM authentication: {{Pkg|samba}}<br />
<br />
=== Fonts ===<br />
<br />
如果 Wine 应用程序没有显示易读的字体,则可能没有安装任何字体。轻松链接所有的系统字体,使他们可以从Wine:<br />
<br />
$ cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; 来完成<br />
<br />
使用 FreeType 渲染字体,而 FreeType 的默认设置在几个版本之前已经改变了。尝试在葡萄酒项目中使用这种环境设置:<br />
FREETYPE_PROPERTIES="truetype:interpreter-version=35"<br />
<br />
另一种可能性是在葡萄酒前缀中安装微软的 TrueType 字体。 See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
运行此类程序后,关闭所有 Wine 服务并运行{{ic| winecfg }}。字体现在应该是可读的。<br />
<br />
如果字体看起来模糊不清,导入以下文本文件到 Wine 注册表[https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
Windows Registry Editor Version 5.00<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
对于高分辨率显示,可以在 winecfg 中调整 dpi 值。<br />
<br />
See also [[Font configuration#Applications without fontconfig support]].<br />
<br />
==== Enable font smoothing ====<br />
<br />
提高Wine染效果的一个好方法是使用明显的字体平滑。/n要启用“次像素平滑(ClearType) RGB”:<br />
<br />
{{bc|<nowiki><br />
cat << EOF > /tmp/fontsmoothing<br />
REGEDIT4<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingOrientation"=dword:00000001<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
EOF<br />
<br />
WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null<br />
</nowiki>}}<br />
<br />
For more information, check [https://askubuntu.com/a/219795 the original answer]<br />
<br />
=== Desktop launcher menus ===<br />
<br />
当 Windows 应用程序安装程序创建一个快捷方式时,Wine 创建一个[[.desktop]]Arch Linux 中这些文件的默认位置是:<br />
<br />
* Desktop shortcuts are put in {{ic|~/Desktop}}<br />
* Start menu shortcuts are put in {{ic|~/.local/share/applications/wine/Programs/}}<br />
<br />
{{Note|1=Wine does not support installing Windows applications for all users, so it will not put ''.desktop'' files in {{ic|/usr/share/applications}}. See WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}<br />
<br />
{{Tip|If menu items were ''not'' created while installing software or have been lost, {{ic|wine winemenubuilder}} may be of some use.}}<br />
<br />
==== Creating menu entries for Wine utilities ====<br />
<br />
默认情况下,Wine 的安装不会为 Wine 附带的软件创建桌面菜单/图标(例如“ winecfg”、“ winebroserer”等)。这可以通过安装{{AUR | wine-installer}}或{{ AUR | wine-installer-git }}meta-package (后者没有附加依赖项)来实现,否则这些说明将为这些应用程序添加条目。<br />
<br />
首先,使用 Wine 安装一个 Windows 程序来创建基本菜单。创建基本菜单后,可以在 {{ic|~/.local/share/applications/wine/}}:<br />
<br />
{{hc|wine-browsedrive.desktop|2=<br />
[Desktop Entry]<br />
Name=Browse C: Drive<br />
Comment=Browse your virtual C: drive<br />
Exec=wine winebrowser c:<br />
Terminal=false<br />
Type=Application<br />
Icon=folder-wine<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-uninstaller.desktop|2=<br />
[Desktop Entry]<br />
Name=Uninstall Wine Software<br />
Comment=Uninstall Windows applications for Wine<br />
Exec=wine uninstaller<br />
Terminal=false<br />
Type=Application<br />
Icon=wine-uninstaller<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-winecfg.desktop|2=<br />
[Desktop Entry]<br />
Name=Configure Wine<br />
Comment=Change application-specific and general Wine options<br />
Exec=winecfg<br />
Terminal=false<br />
Icon=wine-winecfg<br />
Type=Application<br />
Categories=Wine;<br />
}}<br />
<br />
And create the following file in {{ic|~/.config/menus/applications-merged/}}:<br />
<br />
{{hc|wine.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Category>Wine</Category><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
<br />
如果这些设置产生了一个难看的/不存在的图标,这意味着在您所启用的图标集中没有这些启动程序的图标。您应该将图标设置替换为所需图标的显式位置。单击启动器属性菜单中的图标将会产生同样的效果。一个优秀的图标集,支持这些捷径是 [https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors].<br />
<br />
==== Removing menu entries ====<br />
<br />
由 Wine 创建的菜单条目位于 {{ic|~/.local/share/applications/wine/Programs/}}.<br />
除了通过 Wine 删除不需要的扩展绑定,还可以执行以下命令(摘自 Wine 官网) :<br />
<br />
$ rm ~/.local/share/mime/packages/x-wine*<br />
$ rm ~/.local/share/applications/wine-extension*<br />
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
$ rm ~/.local/share/mime/application/x-wine-extension*<br />
<br />
Sometimes you should also remove {{ic|wine-*.menu}} files from {{ic|/.config/menus/}} to completely remove items from wine submenu in kde.<br />
<br />
=== 主题 ===<br />
<br />
类似于 xp 外观的主题可以在这里 [https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 下载]. To install it, see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files this upstream wiki article]. Lastly, use ''winecfg'' to select it.<br />
<br />
{{Note|上面链接的主题只能安装在32位前缀上,前缀版本为 windowsxp。要将其安装在64位前缀上,可能需要创建一个临时的32位前缀,install the theme and copy the {{ic|Zune}} folder and {{ic|Zune.theme}} files from {{ic|drive_c/Windows/Resources/Themes}} in that prefix to the same location in your usual prefix.}}<br />
<br />
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.<br />
<br />
=== Printing ===<br />
<br />
In order to use your installed printers (both local and network) with wine applications in ''win32 prefixes'' (e.g. MS Word), install the {{Pkg|lib32-libcups}} package, reboot wine (''wineboot'') and restart your wine application.<br />
<br />
=== Networking ===<br />
<br />
After installation, the {{pkg|lib32-gnutls}} package may need to be [[install]]ed for applications making TLS or HTTPS connections to work.<br />
<br />
For ICMP (ping), Wine may need the network access as described in the [https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
<br />
If issues arise after this (such as an unhandled exception or privileged instruction), remove via:<br />
<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== Usage ==<br />
<br />
{{Warning|Do not run or install Wine applications as root! See [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ] for details.}}<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Using_Wine Wine User's Guide] for general information on Wine usage.<br />
<br />
See [https://appdb.winehq.org/ Wine Application Database (AppDB)] for additional information on specific Windows applications in Wine.<br />
<br />
=== Wayland ===<br />
<br />
Currently Wine does not support Wayland directly, but you can use [[Wayland#XWayland|XWayland]] instead.<br />
<br />
There are some efforts to support Wayland though:<br />
<br />
* Experimental Wayland driver for Wine, which supports using OpenGL- and Windows GDI-applications. See [https://www.winehq.org/pipermail/wine-devel/2020-December/178575.html this] and [https://www.winehq.org/pipermail/wine-devel/2021-February/181325.html this] wine-devel maillist entries.<br />
* [https://github.com/varmd/wine-wayland wine-wayland]: a custom version of Wine, which supports Wayland via Vulkan (so it supports only: DirectX 9, 10 and 11 via [[#DXVK]] and Vulkan-compatible applications).<br />
<br />
== Tips and tricks ==<br />
<br />
=== Wineconsole ===<br />
<br />
Often you may need to run ''.exe'''s to patch game files, for example a widescreen mod for an old game, and running the ''.exe'' normally through Wine might yield nothing happening. In this case, you can open a terminal and run the following command:<br />
<br />
$ wineconsole cmd<br />
<br />
Then navigate to the directory and run the ''.exe'' file from there.<br />
<br />
=== Winetricks ===<br />
<br />
[https://wiki.winehq.org/Winetricks Winetricks] is a script to allow one to install base requirements needed to run Windows programs. Installable components include DirectX 9.x, MSXML (required by Microsoft Office 2007 and Internet Explorer), Visual Runtime libraries and many more.<br />
<br />
[[Install]] the {{pkg|winetricks}} package (or alternatively {{AUR|winetricks-git}}). Then run it with:<br />
$ winetricks<br />
<br />
For using GUI you should [[install]] the {{pkg|zenity}}.<br />
<br />
=== Performance ===<br />
<br />
==== CSMT ====<br />
<br />
CSMT is a technology used by Wine to use a separate thread for the OpenGL calls to improve performance noticeably. Since Wine 3.2, CSMT is enabled by default. However, CSMT support needs to be enabled manually for Wine versions lower than 3.2. For vanilla Wine run {{ic|wine regedit}} and set the DWORD value for ''HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt'' to 0x01 (enabled). For wine-staging run {{ic|winecfg}} and enable it in the staging tab.<br />
<br />
Note that CSMT may actually hurt performance for some applications - if this is the case, disable it by creating/setting the registry value to 0x00 (disabled).<br />
<br />
Further information:<br />
*[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion] with the CSMT developer Stefan Dösinger<br />
<br />
==== Force OpenGL mode in games ====<br />
<br />
Some games might have an OpenGL mode which ''may'' perform better than their default DirectX mode. While the steps to enable OpenGL rendering is ''application specific'', many games accept the {{Ic|-opengl}} parameter.<br />
<br />
$ wine ''/path/to/3d_game.exe'' -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [https://appdb.winehq.org AppDB] for such application specific information.<br />
<br />
==== DXVK ====<br />
<br />
[https://github.com/doitsujin/dxvk DXVK] is a promising new implementation for DirectX 9, 10 & 11 over Vulkan. This should allow for greater performance, and in some cases, even better compatibility. Battlefield 1 for example, only runs under DXVK. On the other hand, DXVK does not support all Wine games (yet).<br />
<br />
To use it, install {{aur|dxvk-bin}}. Then run the following command to activate it in your Wineprefix (by default {{ic|~/.wine}}):<br />
$ WINEPREFIX=''your-prefix'' setup_dxvk install<br />
<br />
{{Note|For Wine versions below 3.5 you need to configure Vulkan support manually, following the instructions at [https://github.com/roderickc/wine-vulkan GitHub].}}<br />
<br />
{{Warning|DXVK overrides the DirectX 10 and 11 DLLs, which may be considered cheating in online multiplayer games, and may get your account '''banned'''. Use at your own risk!}}<br />
<br />
==== Gallium Nine ====<br />
<br />
With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.<br />
<br />
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any Wine version. Use {{ic|wine ninewinecfg}} to check if it is enabled.<br />
<br />
For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. [[Export]] the following environment variable before running Wine: <br />
<br />
MESA_LOADER_DRIVER_OVERRIDE=crocus<br />
<br />
=== Unregister existing Wine file associations ===<br />
<br />
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.<br />
<br />
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
$ update-mime-database ~/.local/share/mime/<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Prevent Wine from creating filetype associations ===<br />
<br />
{{Note|This has to be done for each WINEPREFIX which should not update file associations unless you opt to change {{ic|/usr/share/wine/wine.inf}} .}}<br />
This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).<br />
<br />
If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See [https://wiki.winehq.org/FAQ#How_can_I_prevent_Wine_from_changing_the_filetype_associations_on_my_system_or_adding_unwanted_menu_entries.2Fdesktop_links.3F Wine FAQ]<br />
<br />
To make the same change via registry add the string {{ic|Enable}} with value {{ic|N}} under:<br />
<br />
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations<br />
<br />
''You might have to create the key {{ic|FileOpenAssociations}} first!''<br />
<br />
If you want to apply this by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}} and add this line for example under the {{ic|[Services]}} section:<br />
HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"<br />
<br />
To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:<br />
<br />
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=<br />
<br />
[Trigger]<br />
Operation = Install<br />
Operation = Upgrade<br />
Type = Path<br />
Target = usr/share/wine/wine.inf<br />
<br />
[Action]<br />
Description = Stopping Wine from hijacking file associations...<br />
When = PostTransaction<br />
<nowiki>Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'</nowiki><br />
}}<br />
<br />
See [[Pacman#Hooks]]<br />
<br />
=== Execute Windows binaries with Wine implicitly ===<br />
<br />
The {{pkg|wine}} package installs a ''binfmt'' file which will allows you to run Windows programs directly, e.g. {{ic|''./myprogram.exe''}} will launch as if you had typed {{ic|wine ''./myprogram.exe''}}. Service starts by default on boot, if you have not rebooted after installing Wine you can [[start]] {{ic|systemd-binfmt.service}} to use it right away.<br />
<br />
{{Note|Make sure the Windows binary is [[executable]], otherwise the binary will not run.}}<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). [[CDemu]] will handle it correctly.<br />
<br />
=== Show FPS overlay in games ===<br />
<br />
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.<br />
<br />
=== Running Wine under a separate user account ===<br />
<br />
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.<br />
<br />
First, create a [[user account]] for Wine:<br />
<br />
# useradd -m -s /bin/bash wineuser<br />
<br />
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...<br />
<br />
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information on how to execute the {{ic|xhost}} command under your main user.}}<br />
<br />
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:<br />
<br />
$ xhost +SI:localuser:wineuser<br />
<br />
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:<br />
<br />
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''<br />
<br />
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:<br />
{{hc|1=/usr/local/bin/runaswine|2=<br />
#!/bin/bash<br />
xhost +SI:localuser:wineuser<br />
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}<br />
<br />
Wine applications can then be launched via:<br />
<br />
$ runaswine ''"C:\path\to\application.exe"''<br />
<br />
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.<br />
<br />
It is recommended to run {{ic|winecfg}} as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.<br />
<br />
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to share a PulseAudio daemon]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.<br />
<br />
=== Temp directory on tmpfs ===<br />
<br />
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:<br />
<br />
$ rm -r ~/.wine/drive_c/users/$USER/Temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp<br />
<br />
=== Prevent installing Mono/Gecko ===<br />
<br />
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.<br />
<br />
=== Vulkan ===<br />
<br />
Vulkan support is included, since Wine 3.3. The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].<br />
<br />
{{Note|The Wine ICD loader was added in Wine 3.5, you need to install the official Vulkan SDK to use Vulkan in Wine 3.3 and 3.4}}<br />
<br />
=== Remove Wine file bindings ===<br />
<br />
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).<br />
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}<br />
<br />
NoExtract = usr/lib/binfmt.d/wine.conf<br />
NoExtract = usr/share/applications/wine.desktop<br />
<br />
== Troubleshooting ==<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Troubleshooting_.2F_Reporting_bugs Wine User's Guide] and [https://wiki.winehq.org/FAQ Wine FAQ] (especially its [https://wiki.winehq.org/FAQ#Troubleshooting Troubleshooting] section) for general tips.<br />
<br />
Also refer to the [https://appdb.winehq.org/ Wine AppDB] for an advice on specific applications.<br />
<br />
=== XWayland problems ===<br />
<br />
If you use Wine under [[Wayland#XWayland|XWayland]], you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:<br />
<br />
* flickering;<br />
* wrong window location;<br />
* wrong mouse cursor location and clicks;<br />
* keyboard detection.<br />
<br />
=== Keyboard input doesn't work after unfocusing application ===<br />
<br />
If you encounter this problem, you may be able to fix it by editing the registry:<br />
Under ''HKEY_CURRENT_USER\Software\Wine\X11 Driver'', add a string value ''UseTakeFocus'' and set it to ''N''.<br />
<br />
Alternatively, you can use winetricks to set the value.<br />
winetricks usetakefocus=n<br />
<br />
== See also ==<br />
<br />
* [https://www.winehq.org/ Wine Homepage]<br />
* [https://wiki.winehq.org/ Wine Wiki]<br />
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
* [[Gentoo:Wine]]<br />
* [https://www.darlinghq.org/ Darling] - a similar project for MacOS software</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=ArchWiki:Translation_Team_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=714093ArchWiki:Translation Team (简体中文)2022-01-28T04:02:46Z<p>InsaneGuo: /* 页面维护列表 */</p>
<hr />
<div>[[Category:ArchWiki (简体中文)]]<br />
[[Category:Teams (简体中文)]]<br />
[[ar:ArchWiki:Translation Team]]<br />
[[cs:ArchWiki:Translation Team]]<br />
[[el:ArchWiki:Translation Team]]<br />
[[en:ArchWiki:Translation Team]]<br />
[[es:ArchWiki:Translation Team]]<br />
[[fi:ArchWiki:Translation Team]]<br />
[[fr:ArchWiki:Translation Team]]<br />
[[hr:ArchWiki:Translation Team]]<br />
[[it:ArchWiki:Translation Team]]<br />
[[ja:ArchWiki:翻訳チーム]]<br />
[[ko:ArchWiki:Translation Team]]<br />
[[nl:ArchWiki:Translation Team]]<br />
[[pl:ArchWiki:Translation Team]]<br />
[[pt:ArchWiki:Translation Team]]<br />
[[ru:ArchWiki:Translation Team]]<br />
[[sk:ArchWiki:Translation Team]]<br />
[[uk:ArchWiki:Translation Team]]<br />
[[zh-hant:ArchWiki:Translation Team]]<br />
ArchWiki 上有许多中文页面,这其中大部分是从外文翻译过来的,这些页面是无数中文志愿者劳动的结晶。随着时间推移,有些页面因为没有及时维护,内容严重过时。而目前的翻译工作缺少组织,效率偏低。所以参照西班牙和意大利翻译组的做法,添加这个页面。<br />
<br />
如果你希望对 ArchWiki 做贡献,参与 Wiki 建设,比如翻译英文页面和对已翻译过的中文页面进行维护,只需要编辑下面的[[#页面维护列表]],添加相应的条目,并将自己加为相关页面的维护者。如果你在列表中还没有找到想要翻译的页面,可以自行添加。另外,如果因为时间原因无法再维护页面,请及时将自己从维护者列表中删除。<br />
<br />
== 创建翻译 ==<br />
<br />
{{警告|如果不准备翻译页面的大部分内容,请尽量不要新建简体中文页面。检查英文页面的更新需要花费不少精力,没有翻译的页面会增加维护负担。}}<br />
# 如果还不知道如何编辑 wiki,请阅读[[Help:Editing (简体中文)|编辑帮助]]。<br />
# 阅读 [[Help:i18n (简体中文)|i18n 帮助]],文章给出了 ArchWiki 国际化和本地化的指南。<br />
# [[Special:UserLogin|登录]]以进行编辑。<br />
# 选择要翻译的页面,例如从[[Special:Random|随机页面]]或[[#页面维护列表|页面维护列表]]中选择一个未翻译完成的页面。假设要翻译 [[ArchWiki:Translation Team]]。<br />
# 进入选择的英文页面,点击页面顶部的'''编辑'''。<br />
# 添加要翻译文件的语言间链接, 简体中文的话加入 <nowiki>[[zh-hans:Some Page]]</nowiki>,其它语言参见 [[Help:i18n#Interlanguage links]])。<br />
# 复制所有页面代码。<br />
# 预览页面 (新加了语言链接)<br />
# 访问页面左边新添加的语言链接,应该会进到 [[ArchWiki Translation Team (Language)]](打开新标签页,不要关闭预览的页面)<br />
# 因为页面不存在,点击'''创建'''。<br />
# 将显示一个编辑器 - 粘贴复制的英文页面。<br />
# 将文章分类修改为本地化版本,例如将 {{ic|<nowiki>[[Category:ArchWiki]]</nowiki>}} 修改为 {{ic|<nowiki>[[Category:ArchWiki (简体中文)]]</nowiki>}},参阅 [[Help:Category (简体中文)]].<br />
# 修改语言间链接,指向英文页面(将 {{ic|zh-hans}} 修改为 {{ic|en}},并将英文页面的语言间链接移到文章顶部)。<br />
# 翻译页面,进行保存,还需要使用合适的[[Help:Style (简体中文)#编辑摘要|编辑摘要]],例如 {{ic|translate <nowiki>[[ArchWiki Translation Team]]</nowiki>}}。碰到不好翻译的段落,可以保留英文。尽量不要让原文和不太确认的翻译同时存在,会让页面看上去比较杂乱。<br />
# 在翻译页面的底部,列出了该页面所包含的类别。检查所有这些类别是否存在,即,链接不应为红色。否则,请点击红色链接,然后创建所有缺少的类别 - 类别的创建方式与常规页面相同。<br />
# 返回预览的页面并保存页面。<br />
# (可选)将 [[Template:TranslationStatus (简体中文)]] 添加到已翻译的页面。有关使用方法,请参见 [[Template:TranslationStatus (简体中文)#用法]]。<br />
# (可选)创建另一个页面,例如 [[ArchWiki Translation Team 的翻译后的标题]],其标题将是 [[ArchWiki Translation Team (语言)]] 的标题的翻译,输入 {{ic|<nowiki>#redirect [[ArchWiki Translation Team (Language)</nowiki>]]}} 作为其唯一内容并保存。<br />
<br />
== 模板 ==<br />
<br />
下表列出了应翻译的英文[[Help:Template (简体中文)|模板]]及其等效的简体中文模板。<br />
<br />
{| class=wikitable<br />
! 英文模板 || 简体中文模板<br />
|-<br />
! colspan=2| 文章模板<br />
|-<br />
| [[Template:Related articles start]] || [[Template:Related articles start (简体中文)]]<br />
|-<br />
| [[Template:Unsupported]] || [[Template:Unsupported (简体中文)]]<br />
|-<br />
| [[Template:Yes]] || [[Template:是]]<br />
|-<br />
| [[Template:No]] || [[Template:否]]<br />
|-<br />
| [[Template:Tip]] || [[Template:提示]]<br />
|-<br />
| [[Template:Note]] || [[Template:注意]]<br />
|-<br />
| [[Template:Warning]] || [[Template:警告]]<br />
|-<br />
| [[Template:Dead link]] || [[Template:Dead link (简体中文)]]<br />
|-<br />
| [[Template:Broken package link]] || [[Template:Broken package link (简体中文)]]<br />
|-<br />
| [[Template:Broken section link]] || [[Template:Broken section link (简体中文)]]<br />
|-<br />
! colspan=2| 翻译状态模板<br />
|-<br />
| [[Template:Bad translation]] || [[Template:Bad translation (简体中文)]]<br />
|-<br />
| [[Template:Translateme]] || [[Template:Translateme (简体中文)]]<br />
|-<br />
| [[Template:TranslationStatus]] || [[Template:TranslationStatus (简体中文)]]<br />
|-<br />
! colspan=2| 导航模板<br />
|-<br />
| [[Template:Laptops table header]] || [[Template:Laptops table header (简体中文)]]<br />
|-<br />
| [[Template:Laptops navigation]] || [[Template:Laptops navigation (简体中文)]]<br />
|-<br />
| [[Template:List of applications navigation]] || [[Template:List of applications navigation (简体中文)]]<br />
|-<br />
| [[Template:Package guidelines]] || [[Template:Package guidelines (简体中文)]]<br />
|-<br />
! colspan=2| 特殊模板<br />
|-<br />
| [[Template:Cat main]] || [[Template:Cat main (简体中文)]]<br />
|-<br />
| [[Template:Template]] || [[Template:Template (简体中文)]]<br />
|-<br />
| [[Template:META Error]] || [[Template:META Error (简体中文)]]<br />
|-<br />
| [[Template:META Unexplained Status Template]] || [[Template:META Unexplained Status Template (简体中文)]]<br />
|-<br />
| [[Template:Comment]] || [[Template:Comment (简体中文)]]<br />
|-<br />
| [[Template:Committed identity]] || [[Template:Committed identity (简体中文)]]<br />
|-<br />
| [[Template:Unsigned]] || [[Template:Unsigned (简体中文)]]<br />
|}<br />
<br />
== 翻译中应省略的模板 ==<br />
<br />
当页面或部分标记有 [[Template:Accuracy]],[[Template:Style]],[[Template:Archive]],[[Template:Remove]] 或 [[Template:Out of date]] 时 — 在解决问题并且删除模板之前,不要翻译有问题的页面/部分。<br />
<br />
如果看到 [[Template:Expansion]],[[Template:Merge]],[[Template:Move]] 或 [[Template:Redirect]],则可以安全地翻译页面,但不要将这些模板复制到翻译的文章中。<br />
<br />
如果看到 [[Template:Broken package link]],[[Template:Broken section link]] 或 [[Template:Dead link]],请不要将这些模板复制到翻译的文章中。要么在原始文本中将其修复,然后复制并在要翻译时翻译修复的链接,要么在翻译时忽略与它们有关的整个句子或部分。<br />
<br />
== 完善翻译 ==<br />
<br />
[https://wiki.archlinux.org/index.php?title=Special:WhatLinksHere/Template:Translateme_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&limit=100 这个特殊页面]包含了需要完善翻译的简体中文页面。完善翻译的基本步骤:<br />
# 选择自己比较熟悉的文章进行翻译<br />
# 先检查英文页面的对应段落,更新成最新的英文后再翻译,避免翻译过时的内容,减少信息遗漏。<br />
# 翻译完成后删除页面中的 <nowiki>{{translateme (简体中文)}}</nowiki> 标记<br />
# (可选)给翻译完成的页面加上[[Template:TranslationStatus (简体中文)|翻译状态]],请参见 [[#创建翻译]]。<br />
<br />
== 更新过期页面 ==<br />
<br />
如果发现有 Wiki 页面过期或错误:<br />
* 小的改动,有时间可以立即进行修改同步,维护者并不控制页面的编辑权限,越多的人参与维护越好。如果改动较大,请先联系维护者,避免重复劳动。<br />
* 没有时间查看更改,请给页面加上 {{ic|<nowiki>{{out of date}}</nowiki>}} 模板,这样其他贡献者更容易发现需要更新的页面,而读者看到过期标记就可以直接查看英文页面,以免被错误内容误导,白白耽误时间。<br />
* 没有时间翻译,请将过期的中文部分删去,从英文页面中复制更改的部分到中文页面的相应部分,去掉{{ic|<nowiki>{{out of date}}</nowiki>}}模板(如果页面上有的话)并加上{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他贡献者就更容易发现需要翻译的页面,而读者也不会被过期的内容误导。<br />
如果发现有页面未翻译:<br />
* 有时间的话,请将页面中的英文部分翻译为中文,并去掉{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板。<br />
* 没有时间翻译,请为页面添加{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他的贡献者就能更容易发现需要翻译的页面。<br />
{{注意|在修改页面上的模板时,请同时更新页面维护列表的翻译状态。}}<br />
<br />
== 维护翻译 ==<br />
<br />
完成页面的翻译只是初步完成任务,及时同步英文页面改动、更新翻译是一个持续性的工作,可能会耗费更多的时间。<br />
<br />
=== 页面认领 ===<br />
<br />
所有人都可以认领页面。认领后的责任包括进行翻译,关注英文页面的改动,及时同步翻译。<br />
<br />
为了更好的跟踪英文页面的修改,请务必在设置中启用监视列表邮件通知,并监视对应的英文页面(从设置中找到监视列表,加入英文页面。或者直接到英文页面点击页面顶端的监视标签。这样只要有改动,就会收到邮件通知)。<br />
<br />
{{小贴士|如果收到邮件通知后没有访问页面或者访问了页面却没有登录用户,下次页面改动时就不会再发邮件通知。可以点击监视列表中的'''标记所有页面为已读'''再次获取更新。}}<br />
<br />
如果页面有维护者但长期得不到更新,将会在维护列表中删除维护者。<br />
<br />
=== 翻译状态模板 ===<br />
<br />
Arch 作为滚动发行版,软件变化比较快,对应的文档变化也比较快。许多翻译的文章由于缺乏更新,会产生命令运行出错或不起作用等问题。而由于这些过期页面没有及时标记出来,所以用户无法及时获得更新。[[Template:TranslationStatus (简体中文)|翻译状态模板]]就是为了解决这个问题而创建。<br />
<br />
此模板可以起到如下作用:<br />
* 为用户提供翻译状况,包括翻译时间、英文页面的最后版本等<br />
* 用户可以点击查看翻译后,英文页面的改动,这样英文不是很好的用户可以只查看很小一部分英文内容,并判断出是否影响操作。<br />
* 翻译人员可以跟踪页面状况,通过[[Special:WhatLinksHere/Template:TranslationStatus_(简体中文)|模板的反向链接]]可以查找到所有标记页面,查看需要更新翻译的部分。<br />
<br />
[[Template:TranslationStatus (简体中文)|模板页面]]有详细的使用方法。<br />
<br />
=== 页面维护列表 ===<br />
<br />
{{注意|请按照拉丁字母顺序添加页面。}}<br />
<br />
翻译状态说明:<br />
;过期:页面内容未与英文页面同步,对应 {{ic|<nowiki>{{out of date}}</nowiki>}} 模板<br />
;未翻译:页面中含有英文内容,对应 {{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}} 模板<br />
;完成:页面已与英文页面同步<br />
<br />
{| class="wikitable sortable collapsible" border="1"<br />
|-<br />
! 页面<br />
! 翻译状态<br />
! 维护者<br />
! class="unsortable" width="30%" | 备注<br />
|-<br />
| [[Arch-based distributions (简体中文)]]<br />
| 完成<br />
| Joshua<br />
| 勘误中<br />
|-<br />
| [[Arch boot process (简体中文)]]<br />
| 翻译中<br />
| Bangbo Zheng<br />
| <br />
|-<br />
| [[Arch Security Team (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Arch Testing Team (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[ArchWiki:Maintenance Team (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[ArchWiki:News (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Aria2 (简体中文)]]<br />
| 完成<br />
| [[User:FENPRACE|FENPRACE]]<br />
| 长期维护中<br />
|-<br />
| [[ASCII art (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[AUR helpers (简体中文)]]<br />
| 完成<br />
| Kurobac<br />
| 部分用词可能需要修改<br />
|-<br />
| [[Bash (简体中文)]]<br />
| 完成<br />
| [[User:VictriD|VictriD]]<br />
| 无<br />
|-<br />
| [[Common Desktop Environment (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Conky (简体中文)]]<br />
| 完成<br />
| upi<br />
| 无<br />
|-<br />
| [[ConnMan (简体中文)]]<br />
| 完成<br />
| [[User:FENPRACE|FENPRACE]]<br />
| 长期维护中<br />
|-<br />
| [[Core utilities (简体中文)]]<br />
| 完成<br />
| rentaro, Arisaka<br />
| 无<br />
|-<br />
| [[Dark mode switching (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Discord (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Django (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Dynamic Kernel Module Support (简体中文)]]<br />
| 完成<br />
| Mithrandir<br />
| 完善中<br />
|-<br />
| [[Emacs (简体中文)]]<br />
| 翻译中<br />
| Jaurung yuanhang<br />
| 未完成<br />
|-<br />
| [[Equinox Desktop Environment (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[FHEM (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中 <br />
|-<br />
| [[Flatpak (简体中文)]]<br />
| 完成<br />
| C0n5t4ntK<br />
| 长期维护中<br />
|-<br />
| [[Fwupd (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Gcin (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[GIMP (简体中文)]]<br />
| 完成<br />
| [[User:驿窗|驿窗]]<br />
| 长期维护中<br />
|-<br />
| [[GNOME (简体中文)]]<br />
| 完成<br />
| skywet<br />
| <br />
|-<br />
| [[Google Authenticator (简体中文)]]<br />
| 完成<br />
| [[User:VictriD|VictriD]]<br />
| 无<br />
|-<br />
| [[GRUB (简体中文)]]<br />
| 完成<br />
| [[User:Reverier|Reverier]]<br />
| 长期维护中<br />
|-<br />
| [[GRUB/Tips and tricks (简体中文)]]<br />
| 完成<br />
| [[User:Reverier|Reverier]]<br />
| 长期维护中<br />
|-<br />
| [[Heirloom (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Inkscape (简体中文)]]<br />
| 完成<br />
| [[User:驿窗|驿窗]]<br />
| 长期维护中<br />
|-<br />
| [[Install Arch Linux from existing Linux (简体中文)]]<br />
| 完成<br />
| [[User:FENPRACE|FENPRACE]]<br />
| 长期维护中<br />
|-<br />
| [[Install Arch Linux with accessibility options (简体中文)]]<br />
| 完成<br />
| [[User:Albertwang1988|Albert Wang]]<br />
| 长期维护中<br />
|-<br />
| [[Installation guide (简体中文)]]<br />
| 完成<br />
| [[User:Whiredplanck|WhiredPlanck]]<br />
| 长期维护中<br />
|-<br />
| [[International communities (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Java (简体中文)]]<br />
| 翻译中<br />
| CaCaCarrot<br />
| 无<br />
|-<br />
| [[Kernel live patching (简体中文)]]<br />
| 完成<br />
| [[User:VictriD|VictriD]]<br />
| 无<br />
|-<br />
| [[KRunner (简体中文)]]<br />
| 完成<br />
| [[User:Reverier|Reverier]]<br />
| 长期维护中<br />
|-<br />
| [[Lenovo Thinkpad T14 (AMD) Gen 1 (简体中文)]]<br />
| 完成<br />
| [[User:Albertwang1988|Albert Wang]]<br />
| 长期维护中<br />
|-<br />
| [[Libvirt (简体中文)]]<br />
| 完成<br />
| Kurobac<br />
| 需要格式改进<br />
|-<br />
| [[Liri (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|- <br />
| [[List of applications (简体中文)]]<br />
| 部分翻译<br />
| DavidChen<br />
| 翻译中<br />
|-<br />
| [[Lua (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Lumina (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Minecraft (简体中文)]]<br />
| 完成<br />
| Xavier Lau<br />
| 页面已经与英文版同步,长期维护中<br />
|-<br />
| [[Moksha (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[MySQL (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Network configuration (简体中文)]]<br />
| 完成<br />
| [[User:Chirsz|Chirsz]]<br />
| 更新相关页面<br />
|-<br />
| [[Node.js package guidelines (简体中文)]]<br />
| 完成<br />
| [[User:FENPRACE|FENPRACE]]<br />
| 长期维护中<br />
|-<br />
| [[Notion (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Openbox (简体中文)]]<br />
| 未完成<br />
| [[User:Aaron Chen|Aaron Chen]]<br />
| 翻译中<br />
|-<br />
| [[OpenSSH (简体中文)]]<br />
| 完成<br />
| Arisaka<br />
| 无<br />
|-<br />
| [[Pacman (简体中文)]]<br />
| 翻译中<br />
| [[User:Miswanting|Miswanting]]<br />
| 同步中<br />
|-<br />
| [[pkgstats (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|- <br />
| [[PKGBUILD (简体中文)]]<br />
| 完成<br />
| [[User:VictriD|VictriD]]<br />
| 无<br />
|- <br />
| [[Polybar (简体中文)]]<br />
| 完成<br />
| [[User:Wjhmrc|Wjhmrc]]<br />
| 长期维护中<br />
|- <br />
| [[QEMU (简体中文)]]<br />
| 完成<br />
| Heersin<br />
| 长期维护中<br />
|- <br />
| [[ranger (简体中文)]]<br />
| 完成<br />
| Jason Zhang<br />
| 完善中<br />
|-<br />
| [[Rockbox (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Roles (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Rxvt-unicode (简体中文)]]<br />
| 完成<br />
| KyanCh<br />
| 无<br />
|-<br />
| [[Scheme (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[SDDM (简体中文)]]<br />
| 完成<br />
| C0n5t4ntK<br />
| 长期维护中<br />
|-<br />
| [[Steam (简体中文)]]<br />
| 完成<br />
| C0n5t4ntK<br />
| 长期维护中<br />
|-<br />
| [[Syslinux (简体中文)]]<br />
| 完成<br />
| [[User:VictriD|VictriD]]<br />
| 无<br />
|-<br />
| [[TLP (简体中文)]]<br />
| 完成<br />
| Skywet<br />
| 持续更新中<br />
|-<br />
| [[Trac (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Trusted Users (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Twm (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Unofficial mirrors (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Unofficial user repositories (简体中文)]]<br />
| 翻译中<br />
| TransistorLogic<br />
| 无<br />
|-<br />
| [[UP Squared (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Vivaldi (简体中文)]]<br />
| 完成<br />
| [[User:Aaron Chen|Aaron Chen]]<br />
| 长期维护<br />
|-<br />
| [[Webmin (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Wine (简体中文)]]<br />
| 翻译中<br />
| [[User:InsaneGuo|InsaneGuo]]<br />
| <br />
|-<br />
| [[Windows PE (简体中文)]]<br />
| 完成<br />
| [[User:呼啦呼啦~|呼啦呼啦~]]<br />
| 长期维护中<br />
|- <br />
| [[X2Go (简体中文)]]<br />
| 过期<br />
| [[User:Aaron Chen|Aaron Chen]]<br />
|</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=714092Wine (简体中文)2022-01-28T03:59:00Z<p>InsaneGuo: /* Appearance */</p>
<hr />
<div>[[Category:Emulation]]<br />
[[Category:Gaming]]<br />
[[de:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
[[zh-hans:Wine]]<br />
{{Related articles start}}<br />
{{Related|CrossOver}}<br />
{{Related|Deepin-wine}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
[[Wikipedia:Wine (software)|Wine]] 是一款可以在类 unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而不会像模拟器那样影响性能/内存。<br />
<br />
{{警告|<br />
* Wine并非与你的系统分离。<br />
* 如果您可以使用您的用户帐户访问文件或资源,那么在 Wine 中运行的程序也可以。参见[[ # running Wine under a separate user account ]]和[[ Security # sandboxing applications ]]了解可能的预防措施。<br />
* Wine 也可以运行恶意软件(参见[ https://wiki.winehq.org/FAQ#is_wine_malware-compatible.3f 葡萄酒常见问题]])}}<br />
<br />
== 安装 ==<br />
<br />
可以通过启用[[multilib]] 库来 [[install|安装]] {{Pkg|wine}} (稳定) 或 {{Pkg|wine-staging}} (测试) 包。 [https://wine-staging.com/ Wine Staging] Wine Staging 是[https://www.winehq.org/ Wine]的修补版本 [https://www.winehq.org/ Wine], 其中包含了 bug 修复和尚未集成到稳定或开发分支中的特性。<br />
<br />
另请参阅[[#Graphics drivers| # 图形驱动程序]]和[[#Sound|# 声音]]以了解其他需求。<br />
<br />
可以考虑为依赖于 Internet Explorer 和 .NET 的应用程序分别安装{{pkg|wine-gecko}}和{{pkg|wine-mono}}。这些软件包并不是严格要求的,因为 Wine 会根据需要下载相关文件。但是,提前下载文件可以让您离线工作,这样 Wine 就不会为每个需要它们的 Wine 前缀下载文件。<br />
<br />
=== 第三方Wine应用 ===<br />
<br />
这些都有自己的社区和网站,并不受主要葡萄酒社区的支持。详情请参阅[https://wiki.winehq.org/Third_Party_Applications Wine Wiki] 。<br />
<br />
* {{App|[[CrossOver]]|Wine 的付费商业版,提供更全面的终端用户支持。|https://www.codeweavers.com|{{AUR|crossover}}}}<br />
* {{App|exe-thumbnailer|为 Windows 可执行文件(. exe、 . lnk、 . msi 和. dll)生成缩略图。|https://github.com/exe-thumbnailer/exe-thumbnailer|{{AUR|exe-thumbnailer}}}}<br />
* {{App|[[Wikipedia:Lutris|Lutris]]|所有类型游戏的游戏启动器,包括 Wine 游戏(带前缀管理)、原生 Linux 游戏和模拟器。|https://lutris.net|{{Pkg|lutris}}}}<br />
* {{App|[[Wikipedia:PlayOnLinux|PlayOnLinux]]|Wine 的图形化前缀管理器。包含帮助程序安装和配置的脚本。|https://www.playonlinux.com|{{Pkg|playonlinux}}}}<br />
* {{App|Proton|Compatibility tool 基于Wine和其他部件为[Wikipedia:Steam]制造的Proton兼容性工具。兼容性列表见 [https://www.protondb.com/ ProtonDB] <br />
|list.|https://github.com/ValveSoftware/Proton|{{AUR|proton}}}}<br />
* {{App|PyWinery|Wine 的简单图形化前缀管理器。|https://github.com/ergoithz/pywinery|{{AUR|pywinery}}}}<br />
* {{App|Q4Wine|Wine 的图形前缀管理器。可以将 [[Qt]] 主题导出到 Wine 配置中,以便更好地集成。|https://sourceforge.net/projects/q4wine/|{{AUR|q4wine}}{{Broken package link|package not found}}}}<br />
* {{App|Bottles|基于 GTK 的 Wine 的图形化前缀和管理器。|https://usebottles.com/|{{AUR|bottles}}}}<br />
<br />
== 配置 ==<br />
<br />
配置Wine通常使用以下方法:<br />
<br />
* [https://wiki.winehq.org/Winecfg winecfg] 是 Wine 的 GUI 配置工具,可以通过运行{{ic|winecfg}}启动它。 <br />
* [https://wiki.winehq.org/Regedit regedit] 是 Wine 的注册表编辑工具,可以通过运行{{ic|regedit}} 来启动。See WineHQ's article on [https://wiki.winehq.org/Useful_Registry_Keys Useful Registry Keys].<br />
* [https://wiki.winehq.org/Control control] 是 Wine 的 Windows 控件面板的实现,它可以通过运行{{ic|wine control}}来启动。<br />
* 完整列表见 [https://wiki.winehq.org/List_of_Commands WineHQ 的命令列表]。<br />
<br />
=== WINEPREFIX ===<br />
<br />
默认情况下,Wine 将其配置文件和安装的 Windows 程序存储在 {{ic|~/.wine}} 。这个目录通常被称为“ Wine prefix”或“ Wine bottle”。当您运行 Windows 程序或 Wine 的捆绑程序(如 winecfg)时,它会自动创建/更新。前缀目录还包含一个目录,您的 Windows 程序将其视为 {{ic|c:}} (C盘)。<br />
<br />
你可以使用 {{ic|WINEPREFIX}}环境变量覆盖 Wine 使用的前缀位置。如果您希望为不同的 Windows 程序使用单独的配置,这将非常有用。第一次运行带有新 Wine 前缀的程序时,Wine 将自动创建一个带有 c 驱动器和注册表的目录。<br />
<br />
例如,如果您运行一个带有{{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}的程序,和另一个 {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}这两个程序将分别有一个单独的 c 驱动器和单独的注册。<br />
<br />
{{注意: Wine不是沙箱!在 Wine 下运行的程序仍然可以访问系统的其余部分!(例如, {{ic|Z:}} 映射到 {{ic|/}}, 与 Wine 前缀无关).}}<br />
<br />
若要在不运行 Windows 程序或其他 GUI 工具的情况下创建默认前缀,可以使用:<br />
<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
Wine will start a 64-bit environment by default. You can change this behavior using the {{ic|WINEARCH}} [[environment variable]]. Rename your {{ic|~/.wine}} directory and create a new Wine environment by running {{ic|1=$ WINEARCH=win32 winecfg}}. This will get you a 32-bit Wine environment. Not setting {{ic|WINEARCH}} will get you a 64-bit one.<br />
<br />
You can combine this with {{ic|WINEPREFIX}} to make a separate {{ic|win32}} and {{ic|win64}} environment:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
You can also use {{ic|WINEARCH}} in combination with other Wine programs, such as ''winetricks'' (using Steam as an example):<br />
<br />
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
In order to see the architecture of an existing prefix you can check its registry file. The command below reads the system registry of the {{ic|~/.wine}} prefix and returns {{ic|1=#arch=win32}} or {{ic|1=#arch=win64}} depending on the architecture type:<br />
<br />
$ grep '#arch' ~/.wine/system.reg<br />
<br />
=== Graphics drivers ===<br />
<br />
You need to install the 32-bit version of your graphics driver. Please install the package that is listed in the ''OpenGL (multilib)'' column in the table in [[Xorg#Driver installation]].<br />
<br />
A good sign that your drivers are inadequate or not properly configured is when Wine reports the following in your terminal window:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{Note|You might need to restart X after having installed the correct library.}}<br />
<br />
=== Sound ===<br />
<br />
By default sound issues may arise when running Wine applications. Ensure only one sound device is selected in ''winecfg''.<br />
<br />
Install the correct packages for the audio driver you want to use:<br />
<br />
* For [[ALSA]] install {{Pkg|lib32-alsa-lib}} and {{Pkg|lib32-alsa-plugins}}<br />
* For [[PulseAudio]] install {{Pkg|lib32-libpulse}} <br />
* For [[PipeWire]] install either {{Pkg|pipewire-pulse}} and {{Pkg|lib32-libpulse}} or {{Pkg|pipewire-alsa}} and {{Pkg|lib32-alsa-lib}} + {{Pkg|lib32-alsa-plugins}}<br />
* For [[OSS]] install {{Pkg|lib32-alsa-oss}}<br />
<br />
Additional packages: <br />
<br />
* Games that use advanced sound systems (''e.g.'' TESV: Skyrim) may additionally require installations of {{Pkg|lib32-openal}}.<br />
<br />
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [https://wiki.winehq.org/Wine_User's_Guide#Using_Regedit configure it via the registry]. For example, in a case where the microphone was not working in a 32-bit Windows application on a 64-bit stock install of wine-1.9.7, this provided full access to the sound hardware (sound playback and mic): open ''regedit'', look for the key HKEY_CURRENT_USER → Software → Wine → Drivers, and add a string called ''Audio'' and give it the value ''alsa''. Also, it may help to [[#WINEARCH|recreate the prefix]].<br />
<br />
==== MIDI support ====<br />
<br />
[[MIDI]] 是90年代流行的电子游戏音乐系统。如果你正在尝试旧的游戏,这是不寻常的音乐不会发挥出来的盒子。<br />
葡萄酒有很好的 MIDI 支持。但是,您首先需要使它在您的主机系统上工作,如[[ MIDI ]]中所解释的。最后但并非最不重要的是,您需要确保 Wine 将使用正确的 MIDI 输出。<br />
<br />
=== Other dependencies ===<br />
<br />
Some applications may require additional packages for the following purposes:<br />
<br />
* playing music: {{Pkg|lib32-mpg123}}<br />
* native image manipulation libraries: {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}<br />
* encryption support: {{Pkg|lib32-gnutls}}<br />
* 32-bit video codecs: {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}<br />
* NTLM authentication: {{Pkg|samba}}<br />
<br />
=== Fonts ===<br />
<br />
如果 Wine 应用程序没有显示易读的字体,则可能没有安装任何字体。轻松链接所有的系统字体,使他们可以从Wine:<br />
<br />
$ cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; 来完成<br />
<br />
使用 FreeType 渲染字体,而 FreeType 的默认设置在几个版本之前已经改变了。尝试在葡萄酒项目中使用这种环境设置:<br />
FREETYPE_PROPERTIES="truetype:interpreter-version=35"<br />
<br />
另一种可能性是在葡萄酒前缀中安装微软的 TrueType 字体。 See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
运行此类程序后,关闭所有 Wine 服务并运行{{ic| winecfg }}。字体现在应该是可读的。<br />
<br />
如果字体看起来模糊不清,导入以下文本文件到 Wine 注册表[https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
Windows Registry Editor Version 5.00<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
对于高分辨率显示,可以在 winecfg 中调整 dpi 值。<br />
<br />
See also [[Font configuration#Applications without fontconfig support]].<br />
<br />
==== Enable font smoothing ====<br />
<br />
提高Wine染效果的一个好方法是使用明显的字体平滑。/n要启用“次像素平滑(ClearType) RGB”:<br />
<br />
{{bc|<nowiki><br />
cat << EOF > /tmp/fontsmoothing<br />
REGEDIT4<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingOrientation"=dword:00000001<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
EOF<br />
<br />
WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null<br />
</nowiki>}}<br />
<br />
For more information, check [https://askubuntu.com/a/219795 the original answer]<br />
<br />
=== Desktop launcher menus ===<br />
<br />
当 Windows 应用程序安装程序创建一个快捷方式时,Wine 创建一个[[.desktop]]Arch Linux 中这些文件的默认位置是:<br />
<br />
* Desktop shortcuts are put in {{ic|~/Desktop}}<br />
* Start menu shortcuts are put in {{ic|~/.local/share/applications/wine/Programs/}}<br />
<br />
{{Note|1=Wine does not support installing Windows applications for all users, so it will not put ''.desktop'' files in {{ic|/usr/share/applications}}. See WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}<br />
<br />
{{Tip|If menu items were ''not'' created while installing software or have been lost, {{ic|wine winemenubuilder}} may be of some use.}}<br />
<br />
==== Creating menu entries for Wine utilities ====<br />
<br />
默认情况下,Wine 的安装不会为 Wine 附带的软件创建桌面菜单/图标(例如“ winecfg”、“ winebroserer”等)。这可以通过安装{{AUR | wine-installer}}或{{ AUR | wine-installer-git }}meta-package (后者没有附加依赖项)来实现,否则这些说明将为这些应用程序添加条目。<br />
<br />
首先,使用 Wine 安装一个 Windows 程序来创建基本菜单。创建基本菜单后,可以在 {{ic|~/.local/share/applications/wine/}}:<br />
<br />
{{hc|wine-browsedrive.desktop|2=<br />
[Desktop Entry]<br />
Name=Browse C: Drive<br />
Comment=Browse your virtual C: drive<br />
Exec=wine winebrowser c:<br />
Terminal=false<br />
Type=Application<br />
Icon=folder-wine<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-uninstaller.desktop|2=<br />
[Desktop Entry]<br />
Name=Uninstall Wine Software<br />
Comment=Uninstall Windows applications for Wine<br />
Exec=wine uninstaller<br />
Terminal=false<br />
Type=Application<br />
Icon=wine-uninstaller<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-winecfg.desktop|2=<br />
[Desktop Entry]<br />
Name=Configure Wine<br />
Comment=Change application-specific and general Wine options<br />
Exec=winecfg<br />
Terminal=false<br />
Icon=wine-winecfg<br />
Type=Application<br />
Categories=Wine;<br />
}}<br />
<br />
And create the following file in {{ic|~/.config/menus/applications-merged/}}:<br />
<br />
{{hc|wine.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Category>Wine</Category><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
<br />
如果这些设置产生了一个难看的/不存在的图标,这意味着在您所启用的图标集中没有这些启动程序的图标。您应该将图标设置替换为所需图标的显式位置。单击启动器属性菜单中的图标将会产生同样的效果。一个优秀的图标集,支持这些捷径是 [https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors].<br />
<br />
==== Removing menu entries ====<br />
<br />
由 Wine 创建的菜单条目位于 {{ic|~/.local/share/applications/wine/Programs/}}.<br />
除了通过 Wine 删除不需要的扩展绑定,还可以执行以下命令(摘自 Wine 官网) :<br />
<br />
$ rm ~/.local/share/mime/packages/x-wine*<br />
$ rm ~/.local/share/applications/wine-extension*<br />
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
$ rm ~/.local/share/mime/application/x-wine-extension*<br />
<br />
Sometimes you should also remove {{ic|wine-*.menu}} files from {{ic|/.config/menus/}} to completely remove items from wine submenu in kde.<br />
<br />
=== 主题 ===<br />
<br />
类似于 xp 外观的主题可以在这里 [https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 下载]. To install it, see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files this upstream wiki article]. Lastly, use ''winecfg'' to select it.<br />
<br />
{{Note|上面链接的主题只能安装在32位前缀上,前缀版本为 windowsxp。要将其安装在64位前缀上,可能需要创建一个临时的32位前缀,install the theme and copy the {{ic|Zune}} folder and {{ic|Zune.theme}} files from {{ic|drive_c/Windows/Resources/Themes}} in that prefix to the same location in your usual prefix.}}<br />
<br />
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.<br />
<br />
=== Printing ===<br />
<br />
In order to use your installed printers (both local and network) with wine applications in ''win32 prefixes'' (e.g. MS Word), install the {{Pkg|lib32-libcups}} package, reboot wine (''wineboot'') and restart your wine application.<br />
<br />
=== Networking ===<br />
<br />
After installation, the {{pkg|lib32-gnutls}} package may need to be [[install]]ed for applications making TLS or HTTPS connections to work.<br />
<br />
For ICMP (ping), Wine may need the network access as described in the [https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
<br />
If issues arise after this (such as an unhandled exception or privileged instruction), remove via:<br />
<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== Usage ==<br />
<br />
{{Warning|Do not run or install Wine applications as root! See [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ] for details.}}<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Using_Wine Wine User's Guide] for general information on Wine usage.<br />
<br />
See [https://appdb.winehq.org/ Wine Application Database (AppDB)] for additional information on specific Windows applications in Wine.<br />
<br />
=== Wayland ===<br />
<br />
Currently Wine does not support Wayland directly, but you can use [[Wayland#XWayland|XWayland]] instead.<br />
<br />
There are some efforts to support Wayland though:<br />
<br />
* Experimental Wayland driver for Wine, which supports using OpenGL- and Windows GDI-applications. See [https://www.winehq.org/pipermail/wine-devel/2020-December/178575.html this] and [https://www.winehq.org/pipermail/wine-devel/2021-February/181325.html this] wine-devel maillist entries.<br />
* [https://github.com/varmd/wine-wayland wine-wayland]: a custom version of Wine, which supports Wayland via Vulkan (so it supports only: DirectX 9, 10 and 11 via [[#DXVK]] and Vulkan-compatible applications).<br />
<br />
== Tips and tricks ==<br />
<br />
=== Wineconsole ===<br />
<br />
Often you may need to run ''.exe'''s to patch game files, for example a widescreen mod for an old game, and running the ''.exe'' normally through Wine might yield nothing happening. In this case, you can open a terminal and run the following command:<br />
<br />
$ wineconsole cmd<br />
<br />
Then navigate to the directory and run the ''.exe'' file from there.<br />
<br />
=== Winetricks ===<br />
<br />
[https://wiki.winehq.org/Winetricks Winetricks] is a script to allow one to install base requirements needed to run Windows programs. Installable components include DirectX 9.x, MSXML (required by Microsoft Office 2007 and Internet Explorer), Visual Runtime libraries and many more.<br />
<br />
[[Install]] the {{pkg|winetricks}} package (or alternatively {{AUR|winetricks-git}}). Then run it with:<br />
$ winetricks<br />
<br />
For using GUI you should [[install]] the {{pkg|zenity}}.<br />
<br />
=== Performance ===<br />
<br />
==== CSMT ====<br />
<br />
CSMT is a technology used by Wine to use a separate thread for the OpenGL calls to improve performance noticeably. Since Wine 3.2, CSMT is enabled by default. However, CSMT support needs to be enabled manually for Wine versions lower than 3.2. For vanilla Wine run {{ic|wine regedit}} and set the DWORD value for ''HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt'' to 0x01 (enabled). For wine-staging run {{ic|winecfg}} and enable it in the staging tab.<br />
<br />
Note that CSMT may actually hurt performance for some applications - if this is the case, disable it by creating/setting the registry value to 0x00 (disabled).<br />
<br />
Further information:<br />
*[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion] with the CSMT developer Stefan Dösinger<br />
<br />
==== Force OpenGL mode in games ====<br />
<br />
Some games might have an OpenGL mode which ''may'' perform better than their default DirectX mode. While the steps to enable OpenGL rendering is ''application specific'', many games accept the {{Ic|-opengl}} parameter.<br />
<br />
$ wine ''/path/to/3d_game.exe'' -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [https://appdb.winehq.org AppDB] for such application specific information.<br />
<br />
==== DXVK ====<br />
<br />
[https://github.com/doitsujin/dxvk DXVK] is a promising new implementation for DirectX 9, 10 & 11 over Vulkan. This should allow for greater performance, and in some cases, even better compatibility. Battlefield 1 for example, only runs under DXVK. On the other hand, DXVK does not support all Wine games (yet).<br />
<br />
To use it, install {{aur|dxvk-bin}}. Then run the following command to activate it in your Wineprefix (by default {{ic|~/.wine}}):<br />
$ WINEPREFIX=''your-prefix'' setup_dxvk install<br />
<br />
{{Note|For Wine versions below 3.5 you need to configure Vulkan support manually, following the instructions at [https://github.com/roderickc/wine-vulkan GitHub].}}<br />
<br />
{{Warning|DXVK overrides the DirectX 10 and 11 DLLs, which may be considered cheating in online multiplayer games, and may get your account '''banned'''. Use at your own risk!}}<br />
<br />
==== Gallium Nine ====<br />
<br />
With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.<br />
<br />
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any Wine version. Use {{ic|wine ninewinecfg}} to check if it is enabled.<br />
<br />
For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. [[Export]] the following environment variable before running Wine: <br />
<br />
MESA_LOADER_DRIVER_OVERRIDE=crocus<br />
<br />
=== Unregister existing Wine file associations ===<br />
<br />
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.<br />
<br />
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
$ update-mime-database ~/.local/share/mime/<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Prevent Wine from creating filetype associations ===<br />
<br />
{{Note|This has to be done for each WINEPREFIX which should not update file associations unless you opt to change {{ic|/usr/share/wine/wine.inf}} .}}<br />
This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).<br />
<br />
If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See [https://wiki.winehq.org/FAQ#How_can_I_prevent_Wine_from_changing_the_filetype_associations_on_my_system_or_adding_unwanted_menu_entries.2Fdesktop_links.3F Wine FAQ]<br />
<br />
To make the same change via registry add the string {{ic|Enable}} with value {{ic|N}} under:<br />
<br />
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations<br />
<br />
''You might have to create the key {{ic|FileOpenAssociations}} first!''<br />
<br />
If you want to apply this by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}} and add this line for example under the {{ic|[Services]}} section:<br />
HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"<br />
<br />
To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:<br />
<br />
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=<br />
<br />
[Trigger]<br />
Operation = Install<br />
Operation = Upgrade<br />
Type = Path<br />
Target = usr/share/wine/wine.inf<br />
<br />
[Action]<br />
Description = Stopping Wine from hijacking file associations...<br />
When = PostTransaction<br />
<nowiki>Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'</nowiki><br />
}}<br />
<br />
See [[Pacman#Hooks]]<br />
<br />
=== Execute Windows binaries with Wine implicitly ===<br />
<br />
The {{pkg|wine}} package installs a ''binfmt'' file which will allows you to run Windows programs directly, e.g. {{ic|''./myprogram.exe''}} will launch as if you had typed {{ic|wine ''./myprogram.exe''}}. Service starts by default on boot, if you have not rebooted after installing Wine you can [[start]] {{ic|systemd-binfmt.service}} to use it right away.<br />
<br />
{{Note|Make sure the Windows binary is [[executable]], otherwise the binary will not run.}}<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). [[CDemu]] will handle it correctly.<br />
<br />
=== Show FPS overlay in games ===<br />
<br />
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.<br />
<br />
=== Running Wine under a separate user account ===<br />
<br />
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.<br />
<br />
First, create a [[user account]] for Wine:<br />
<br />
# useradd -m -s /bin/bash wineuser<br />
<br />
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...<br />
<br />
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information on how to execute the {{ic|xhost}} command under your main user.}}<br />
<br />
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:<br />
<br />
$ xhost +SI:localuser:wineuser<br />
<br />
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:<br />
<br />
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''<br />
<br />
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:<br />
{{hc|1=/usr/local/bin/runaswine|2=<br />
#!/bin/bash<br />
xhost +SI:localuser:wineuser<br />
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}<br />
<br />
Wine applications can then be launched via:<br />
<br />
$ runaswine ''"C:\path\to\application.exe"''<br />
<br />
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.<br />
<br />
It is recommended to run {{ic|winecfg}} as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.<br />
<br />
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to share a PulseAudio daemon]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.<br />
<br />
=== Temp directory on tmpfs ===<br />
<br />
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:<br />
<br />
$ rm -r ~/.wine/drive_c/users/$USER/Temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp<br />
<br />
=== Prevent installing Mono/Gecko ===<br />
<br />
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.<br />
<br />
=== Vulkan ===<br />
<br />
Vulkan support is included, since Wine 3.3. The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].<br />
<br />
{{Note|The Wine ICD loader was added in Wine 3.5, you need to install the official Vulkan SDK to use Vulkan in Wine 3.3 and 3.4}}<br />
<br />
=== Remove Wine file bindings ===<br />
<br />
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).<br />
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}<br />
<br />
NoExtract = usr/lib/binfmt.d/wine.conf<br />
NoExtract = usr/share/applications/wine.desktop<br />
<br />
== Troubleshooting ==<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Troubleshooting_.2F_Reporting_bugs Wine User's Guide] and [https://wiki.winehq.org/FAQ Wine FAQ] (especially its [https://wiki.winehq.org/FAQ#Troubleshooting Troubleshooting] section) for general tips.<br />
<br />
Also refer to the [https://appdb.winehq.org/ Wine AppDB] for an advice on specific applications.<br />
<br />
=== XWayland problems ===<br />
<br />
If you use Wine under [[Wayland#XWayland|XWayland]], you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:<br />
<br />
* flickering;<br />
* wrong window location;<br />
* wrong mouse cursor location and clicks;<br />
* keyboard detection.<br />
<br />
=== Keyboard input doesn't work after unfocusing application ===<br />
<br />
If you encounter this problem, you may be able to fix it by editing the registry:<br />
Under ''HKEY_CURRENT_USER\Software\Wine\X11 Driver'', add a string value ''UseTakeFocus'' and set it to ''N''.<br />
<br />
Alternatively, you can use winetricks to set the value.<br />
winetricks usetakefocus=n<br />
<br />
== See also ==<br />
<br />
* [https://www.winehq.org/ Wine Homepage]<br />
* [https://wiki.winehq.org/ Wine Wiki]<br />
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
* [[Gentoo:Wine]]<br />
* [https://www.darlinghq.org/ Darling] - a similar project for MacOS software</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=714091Wine (简体中文)2022-01-28T03:58:03Z<p>InsaneGuo: 全部重写翻译</p>
<hr />
<div>[[Category:Emulation]]<br />
[[Category:Gaming]]<br />
[[de:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
[[zh-hans:Wine]]<br />
{{Related articles start}}<br />
{{Related|CrossOver}}<br />
{{Related|Deepin-wine}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
[[Wikipedia:Wine (software)|Wine]] 是一款可以在类 unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而不会像模拟器那样影响性能/内存。<br />
<br />
{{警告|<br />
* Wine并非与你的系统分离。<br />
* 如果您可以使用您的用户帐户访问文件或资源,那么在 Wine 中运行的程序也可以。参见[[ # running Wine under a separate user account ]]和[[ Security # sandboxing applications ]]了解可能的预防措施。<br />
* Wine 也可以运行恶意软件(参见[ https://wiki.winehq.org/FAQ#is_wine_malware-compatible.3f 葡萄酒常见问题]])}}<br />
<br />
== 安装 ==<br />
<br />
可以通过启用[[multilib]] 库来 [[install|安装]] {{Pkg|wine}} (稳定) 或 {{Pkg|wine-staging}} (测试) 包。 [https://wine-staging.com/ Wine Staging] Wine Staging 是[https://www.winehq.org/ Wine]的修补版本 [https://www.winehq.org/ Wine], 其中包含了 bug 修复和尚未集成到稳定或开发分支中的特性。<br />
<br />
另请参阅[[#Graphics drivers| # 图形驱动程序]]和[[#Sound|# 声音]]以了解其他需求。<br />
<br />
可以考虑为依赖于 Internet Explorer 和 .NET 的应用程序分别安装{{pkg|wine-gecko}}和{{pkg|wine-mono}}。这些软件包并不是严格要求的,因为 Wine 会根据需要下载相关文件。但是,提前下载文件可以让您离线工作,这样 Wine 就不会为每个需要它们的 Wine 前缀下载文件。<br />
<br />
=== 第三方Wine应用 ===<br />
<br />
这些都有自己的社区和网站,并不受主要葡萄酒社区的支持。详情请参阅[https://wiki.winehq.org/Third_Party_Applications Wine Wiki] 。<br />
<br />
* {{App|[[CrossOver]]|Wine 的付费商业版,提供更全面的终端用户支持。|https://www.codeweavers.com|{{AUR|crossover}}}}<br />
* {{App|exe-thumbnailer|为 Windows 可执行文件(. exe、 . lnk、 . msi 和. dll)生成缩略图。|https://github.com/exe-thumbnailer/exe-thumbnailer|{{AUR|exe-thumbnailer}}}}<br />
* {{App|[[Wikipedia:Lutris|Lutris]]|所有类型游戏的游戏启动器,包括 Wine 游戏(带前缀管理)、原生 Linux 游戏和模拟器。|https://lutris.net|{{Pkg|lutris}}}}<br />
* {{App|[[Wikipedia:PlayOnLinux|PlayOnLinux]]|Wine 的图形化前缀管理器。包含帮助程序安装和配置的脚本。|https://www.playonlinux.com|{{Pkg|playonlinux}}}}<br />
* {{App|Proton|Compatibility tool 基于Wine和其他部件为[Wikipedia:Steam]制造的Proton兼容性工具。兼容性列表见 [https://www.protondb.com/ ProtonDB] <br />
|list.|https://github.com/ValveSoftware/Proton|{{AUR|proton}}}}<br />
* {{App|PyWinery|Wine 的简单图形化前缀管理器。|https://github.com/ergoithz/pywinery|{{AUR|pywinery}}}}<br />
* {{App|Q4Wine|Wine 的图形前缀管理器。可以将 [[Qt]] 主题导出到 Wine 配置中,以便更好地集成。|https://sourceforge.net/projects/q4wine/|{{AUR|q4wine}}{{Broken package link|package not found}}}}<br />
* {{App|Bottles|基于 GTK 的 Wine 的图形化前缀和管理器。|https://usebottles.com/|{{AUR|bottles}}}}<br />
<br />
== 配置 ==<br />
<br />
配置Wine通常使用以下方法:<br />
<br />
* [https://wiki.winehq.org/Winecfg winecfg] 是 Wine 的 GUI 配置工具,可以通过运行{{ic|winecfg}}启动它。 <br />
* [https://wiki.winehq.org/Regedit regedit] 是 Wine 的注册表编辑工具,可以通过运行{{ic|regedit}} 来启动。See WineHQ's article on [https://wiki.winehq.org/Useful_Registry_Keys Useful Registry Keys].<br />
* [https://wiki.winehq.org/Control control] 是 Wine 的 Windows 控件面板的实现,它可以通过运行{{ic|wine control}}来启动。<br />
* 完整列表见 [https://wiki.winehq.org/List_of_Commands WineHQ 的命令列表]。<br />
<br />
=== WINEPREFIX ===<br />
<br />
默认情况下,Wine 将其配置文件和安装的 Windows 程序存储在 {{ic|~/.wine}} 。这个目录通常被称为“ Wine prefix”或“ Wine bottle”。当您运行 Windows 程序或 Wine 的捆绑程序(如 winecfg)时,它会自动创建/更新。前缀目录还包含一个目录,您的 Windows 程序将其视为 {{ic|c:}} (C盘)。<br />
<br />
你可以使用 {{ic|WINEPREFIX}}环境变量覆盖 Wine 使用的前缀位置。如果您希望为不同的 Windows 程序使用单独的配置,这将非常有用。第一次运行带有新 Wine 前缀的程序时,Wine 将自动创建一个带有 c 驱动器和注册表的目录。<br />
<br />
例如,如果您运行一个带有{{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}的程序,和另一个 {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}这两个程序将分别有一个单独的 c 驱动器和单独的注册。<br />
<br />
{{注意: Wine不是沙箱!在 Wine 下运行的程序仍然可以访问系统的其余部分!(例如, {{ic|Z:}} 映射到 {{ic|/}}, 与 Wine 前缀无关).}}<br />
<br />
若要在不运行 Windows 程序或其他 GUI 工具的情况下创建默认前缀,可以使用:<br />
<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
Wine will start a 64-bit environment by default. You can change this behavior using the {{ic|WINEARCH}} [[environment variable]]. Rename your {{ic|~/.wine}} directory and create a new Wine environment by running {{ic|1=$ WINEARCH=win32 winecfg}}. This will get you a 32-bit Wine environment. Not setting {{ic|WINEARCH}} will get you a 64-bit one.<br />
<br />
You can combine this with {{ic|WINEPREFIX}} to make a separate {{ic|win32}} and {{ic|win64}} environment:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
You can also use {{ic|WINEARCH}} in combination with other Wine programs, such as ''winetricks'' (using Steam as an example):<br />
<br />
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
In order to see the architecture of an existing prefix you can check its registry file. The command below reads the system registry of the {{ic|~/.wine}} prefix and returns {{ic|1=#arch=win32}} or {{ic|1=#arch=win64}} depending on the architecture type:<br />
<br />
$ grep '#arch' ~/.wine/system.reg<br />
<br />
=== Graphics drivers ===<br />
<br />
You need to install the 32-bit version of your graphics driver. Please install the package that is listed in the ''OpenGL (multilib)'' column in the table in [[Xorg#Driver installation]].<br />
<br />
A good sign that your drivers are inadequate or not properly configured is when Wine reports the following in your terminal window:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{Note|You might need to restart X after having installed the correct library.}}<br />
<br />
=== Sound ===<br />
<br />
By default sound issues may arise when running Wine applications. Ensure only one sound device is selected in ''winecfg''.<br />
<br />
Install the correct packages for the audio driver you want to use:<br />
<br />
* For [[ALSA]] install {{Pkg|lib32-alsa-lib}} and {{Pkg|lib32-alsa-plugins}}<br />
* For [[PulseAudio]] install {{Pkg|lib32-libpulse}} <br />
* For [[PipeWire]] install either {{Pkg|pipewire-pulse}} and {{Pkg|lib32-libpulse}} or {{Pkg|pipewire-alsa}} and {{Pkg|lib32-alsa-lib}} + {{Pkg|lib32-alsa-plugins}}<br />
* For [[OSS]] install {{Pkg|lib32-alsa-oss}}<br />
<br />
Additional packages: <br />
<br />
* Games that use advanced sound systems (''e.g.'' TESV: Skyrim) may additionally require installations of {{Pkg|lib32-openal}}.<br />
<br />
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [https://wiki.winehq.org/Wine_User's_Guide#Using_Regedit configure it via the registry]. For example, in a case where the microphone was not working in a 32-bit Windows application on a 64-bit stock install of wine-1.9.7, this provided full access to the sound hardware (sound playback and mic): open ''regedit'', look for the key HKEY_CURRENT_USER → Software → Wine → Drivers, and add a string called ''Audio'' and give it the value ''alsa''. Also, it may help to [[#WINEARCH|recreate the prefix]].<br />
<br />
==== MIDI support ====<br />
<br />
[[MIDI]] 是90年代流行的电子游戏音乐系统。如果你正在尝试旧的游戏,这是不寻常的音乐不会发挥出来的盒子。<br />
葡萄酒有很好的 MIDI 支持。但是,您首先需要使它在您的主机系统上工作,如[[ MIDI ]]中所解释的。最后但并非最不重要的是,您需要确保 Wine 将使用正确的 MIDI 输出。<br />
<br />
=== Other dependencies ===<br />
<br />
Some applications may require additional packages for the following purposes:<br />
<br />
* playing music: {{Pkg|lib32-mpg123}}<br />
* native image manipulation libraries: {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}<br />
* encryption support: {{Pkg|lib32-gnutls}}<br />
* 32-bit video codecs: {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}<br />
* NTLM authentication: {{Pkg|samba}}<br />
<br />
=== Fonts ===<br />
<br />
如果 Wine 应用程序没有显示易读的字体,则可能没有安装任何字体。轻松链接所有的系统字体,使他们可以从Wine:<br />
<br />
$ cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; 来完成<br />
<br />
使用 FreeType 渲染字体,而 FreeType 的默认设置在几个版本之前已经改变了。尝试在葡萄酒项目中使用这种环境设置:<br />
FREETYPE_PROPERTIES="truetype:interpreter-version=35"<br />
<br />
另一种可能性是在葡萄酒前缀中安装微软的 TrueType 字体。 See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
运行此类程序后,关闭所有 Wine 服务并运行{{ic| winecfg }}。字体现在应该是可读的。<br />
<br />
如果字体看起来模糊不清,导入以下文本文件到 Wine 注册表[https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
Windows Registry Editor Version 5.00<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
对于高分辨率显示,可以在 winecfg 中调整 dpi 值。<br />
<br />
See also [[Font configuration#Applications without fontconfig support]].<br />
<br />
==== Enable font smoothing ====<br />
<br />
提高Wine染效果的一个好方法是使用明显的字体平滑。/n要启用“次像素平滑(ClearType) RGB”:<br />
<br />
{{bc|<nowiki><br />
cat << EOF > /tmp/fontsmoothing<br />
REGEDIT4<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingOrientation"=dword:00000001<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
EOF<br />
<br />
WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null<br />
</nowiki>}}<br />
<br />
For more information, check [https://askubuntu.com/a/219795 the original answer]<br />
<br />
=== Desktop launcher menus ===<br />
<br />
当 Windows 应用程序安装程序创建一个快捷方式时,Wine 创建一个[[.desktop]]Arch Linux 中这些文件的默认位置是:<br />
<br />
* Desktop shortcuts are put in {{ic|~/Desktop}}<br />
* Start menu shortcuts are put in {{ic|~/.local/share/applications/wine/Programs/}}<br />
<br />
{{Note|1=Wine does not support installing Windows applications for all users, so it will not put ''.desktop'' files in {{ic|/usr/share/applications}}. See WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}<br />
<br />
{{Tip|If menu items were ''not'' created while installing software or have been lost, {{ic|wine winemenubuilder}} may be of some use.}}<br />
<br />
==== Creating menu entries for Wine utilities ====<br />
<br />
默认情况下,Wine 的安装不会为 Wine 附带的软件创建桌面菜单/图标(例如“ winecfg”、“ winebroserer”等)。这可以通过安装{{AUR | wine-installer}}或{{ AUR | wine-installer-git }}meta-package (后者没有附加依赖项)来实现,否则这些说明将为这些应用程序添加条目。<br />
<br />
首先,使用 Wine 安装一个 Windows 程序来创建基本菜单。创建基本菜单后,可以在 {{ic|~/.local/share/applications/wine/}}:<br />
<br />
{{hc|wine-browsedrive.desktop|2=<br />
[Desktop Entry]<br />
Name=Browse C: Drive<br />
Comment=Browse your virtual C: drive<br />
Exec=wine winebrowser c:<br />
Terminal=false<br />
Type=Application<br />
Icon=folder-wine<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-uninstaller.desktop|2=<br />
[Desktop Entry]<br />
Name=Uninstall Wine Software<br />
Comment=Uninstall Windows applications for Wine<br />
Exec=wine uninstaller<br />
Terminal=false<br />
Type=Application<br />
Icon=wine-uninstaller<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-winecfg.desktop|2=<br />
[Desktop Entry]<br />
Name=Configure Wine<br />
Comment=Change application-specific and general Wine options<br />
Exec=winecfg<br />
Terminal=false<br />
Icon=wine-winecfg<br />
Type=Application<br />
Categories=Wine;<br />
}}<br />
<br />
And create the following file in {{ic|~/.config/menus/applications-merged/}}:<br />
<br />
{{hc|wine.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Category>Wine</Category><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
<br />
如果这些设置产生了一个难看的/不存在的图标,这意味着在您所启用的图标集中没有这些启动程序的图标。您应该将图标设置替换为所需图标的显式位置。单击启动器属性菜单中的图标将会产生同样的效果。一个优秀的图标集,支持这些捷径是 [https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors].<br />
<br />
==== Removing menu entries ====<br />
<br />
由 Wine 创建的菜单条目位于 {{ic|~/.local/share/applications/wine/Programs/}}.<br />
除了通过 Wine 删除不需要的扩展绑定,还可以执行以下命令(摘自 Wine 官网) :<br />
<br />
$ rm ~/.local/share/mime/packages/x-wine*<br />
$ rm ~/.local/share/applications/wine-extension*<br />
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
$ rm ~/.local/share/mime/application/x-wine-extension*<br />
<br />
Sometimes you should also remove {{ic|wine-*.menu}} files from {{ic|/.config/menus/}} to completely remove items from wine submenu in kde.<br />
<br />
=== Appearance ===<br />
<br />
类似于 xp 外观的主题可以在 [https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 下载]. To install it, see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files this upstream wiki article]. Lastly, use ''winecfg'' to select it.<br />
<br />
{{Note|上面链接的主题只能安装在32位前缀上,前缀版本为 windowsxp。要将其安装在64位前缀上,可能需要创建一个临时的32位前缀,install the theme and copy the {{ic|Zune}} folder and {{ic|Zune.theme}} files from {{ic|drive_c/Windows/Resources/Themes}} in that prefix to the same location in your usual prefix.}}<br />
<br />
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.<br />
<br />
=== Printing ===<br />
<br />
In order to use your installed printers (both local and network) with wine applications in ''win32 prefixes'' (e.g. MS Word), install the {{Pkg|lib32-libcups}} package, reboot wine (''wineboot'') and restart your wine application.<br />
<br />
=== Networking ===<br />
<br />
After installation, the {{pkg|lib32-gnutls}} package may need to be [[install]]ed for applications making TLS or HTTPS connections to work.<br />
<br />
For ICMP (ping), Wine may need the network access as described in the [https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
<br />
If issues arise after this (such as an unhandled exception or privileged instruction), remove via:<br />
<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== Usage ==<br />
<br />
{{Warning|Do not run or install Wine applications as root! See [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ] for details.}}<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Using_Wine Wine User's Guide] for general information on Wine usage.<br />
<br />
See [https://appdb.winehq.org/ Wine Application Database (AppDB)] for additional information on specific Windows applications in Wine.<br />
<br />
=== Wayland ===<br />
<br />
Currently Wine does not support Wayland directly, but you can use [[Wayland#XWayland|XWayland]] instead.<br />
<br />
There are some efforts to support Wayland though:<br />
<br />
* Experimental Wayland driver for Wine, which supports using OpenGL- and Windows GDI-applications. See [https://www.winehq.org/pipermail/wine-devel/2020-December/178575.html this] and [https://www.winehq.org/pipermail/wine-devel/2021-February/181325.html this] wine-devel maillist entries.<br />
* [https://github.com/varmd/wine-wayland wine-wayland]: a custom version of Wine, which supports Wayland via Vulkan (so it supports only: DirectX 9, 10 and 11 via [[#DXVK]] and Vulkan-compatible applications).<br />
<br />
== Tips and tricks ==<br />
<br />
=== Wineconsole ===<br />
<br />
Often you may need to run ''.exe'''s to patch game files, for example a widescreen mod for an old game, and running the ''.exe'' normally through Wine might yield nothing happening. In this case, you can open a terminal and run the following command:<br />
<br />
$ wineconsole cmd<br />
<br />
Then navigate to the directory and run the ''.exe'' file from there.<br />
<br />
=== Winetricks ===<br />
<br />
[https://wiki.winehq.org/Winetricks Winetricks] is a script to allow one to install base requirements needed to run Windows programs. Installable components include DirectX 9.x, MSXML (required by Microsoft Office 2007 and Internet Explorer), Visual Runtime libraries and many more.<br />
<br />
[[Install]] the {{pkg|winetricks}} package (or alternatively {{AUR|winetricks-git}}). Then run it with:<br />
$ winetricks<br />
<br />
For using GUI you should [[install]] the {{pkg|zenity}}.<br />
<br />
=== Performance ===<br />
<br />
==== CSMT ====<br />
<br />
CSMT is a technology used by Wine to use a separate thread for the OpenGL calls to improve performance noticeably. Since Wine 3.2, CSMT is enabled by default. However, CSMT support needs to be enabled manually for Wine versions lower than 3.2. For vanilla Wine run {{ic|wine regedit}} and set the DWORD value for ''HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt'' to 0x01 (enabled). For wine-staging run {{ic|winecfg}} and enable it in the staging tab.<br />
<br />
Note that CSMT may actually hurt performance for some applications - if this is the case, disable it by creating/setting the registry value to 0x00 (disabled).<br />
<br />
Further information:<br />
*[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion] with the CSMT developer Stefan Dösinger<br />
<br />
==== Force OpenGL mode in games ====<br />
<br />
Some games might have an OpenGL mode which ''may'' perform better than their default DirectX mode. While the steps to enable OpenGL rendering is ''application specific'', many games accept the {{Ic|-opengl}} parameter.<br />
<br />
$ wine ''/path/to/3d_game.exe'' -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [https://appdb.winehq.org AppDB] for such application specific information.<br />
<br />
==== DXVK ====<br />
<br />
[https://github.com/doitsujin/dxvk DXVK] is a promising new implementation for DirectX 9, 10 & 11 over Vulkan. This should allow for greater performance, and in some cases, even better compatibility. Battlefield 1 for example, only runs under DXVK. On the other hand, DXVK does not support all Wine games (yet).<br />
<br />
To use it, install {{aur|dxvk-bin}}. Then run the following command to activate it in your Wineprefix (by default {{ic|~/.wine}}):<br />
$ WINEPREFIX=''your-prefix'' setup_dxvk install<br />
<br />
{{Note|For Wine versions below 3.5 you need to configure Vulkan support manually, following the instructions at [https://github.com/roderickc/wine-vulkan GitHub].}}<br />
<br />
{{Warning|DXVK overrides the DirectX 10 and 11 DLLs, which may be considered cheating in online multiplayer games, and may get your account '''banned'''. Use at your own risk!}}<br />
<br />
==== Gallium Nine ====<br />
<br />
With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.<br />
<br />
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any Wine version. Use {{ic|wine ninewinecfg}} to check if it is enabled.<br />
<br />
For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. [[Export]] the following environment variable before running Wine: <br />
<br />
MESA_LOADER_DRIVER_OVERRIDE=crocus<br />
<br />
=== Unregister existing Wine file associations ===<br />
<br />
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.<br />
<br />
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
$ update-mime-database ~/.local/share/mime/<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Prevent Wine from creating filetype associations ===<br />
<br />
{{Note|This has to be done for each WINEPREFIX which should not update file associations unless you opt to change {{ic|/usr/share/wine/wine.inf}} .}}<br />
This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).<br />
<br />
If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See [https://wiki.winehq.org/FAQ#How_can_I_prevent_Wine_from_changing_the_filetype_associations_on_my_system_or_adding_unwanted_menu_entries.2Fdesktop_links.3F Wine FAQ]<br />
<br />
To make the same change via registry add the string {{ic|Enable}} with value {{ic|N}} under:<br />
<br />
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations<br />
<br />
''You might have to create the key {{ic|FileOpenAssociations}} first!''<br />
<br />
If you want to apply this by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}} and add this line for example under the {{ic|[Services]}} section:<br />
HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"<br />
<br />
To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:<br />
<br />
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=<br />
<br />
[Trigger]<br />
Operation = Install<br />
Operation = Upgrade<br />
Type = Path<br />
Target = usr/share/wine/wine.inf<br />
<br />
[Action]<br />
Description = Stopping Wine from hijacking file associations...<br />
When = PostTransaction<br />
<nowiki>Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'</nowiki><br />
}}<br />
<br />
See [[Pacman#Hooks]]<br />
<br />
=== Execute Windows binaries with Wine implicitly ===<br />
<br />
The {{pkg|wine}} package installs a ''binfmt'' file which will allows you to run Windows programs directly, e.g. {{ic|''./myprogram.exe''}} will launch as if you had typed {{ic|wine ''./myprogram.exe''}}. Service starts by default on boot, if you have not rebooted after installing Wine you can [[start]] {{ic|systemd-binfmt.service}} to use it right away.<br />
<br />
{{Note|Make sure the Windows binary is [[executable]], otherwise the binary will not run.}}<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). [[CDemu]] will handle it correctly.<br />
<br />
=== Show FPS overlay in games ===<br />
<br />
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.<br />
<br />
=== Running Wine under a separate user account ===<br />
<br />
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.<br />
<br />
First, create a [[user account]] for Wine:<br />
<br />
# useradd -m -s /bin/bash wineuser<br />
<br />
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...<br />
<br />
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information on how to execute the {{ic|xhost}} command under your main user.}}<br />
<br />
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:<br />
<br />
$ xhost +SI:localuser:wineuser<br />
<br />
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:<br />
<br />
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''<br />
<br />
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:<br />
{{hc|1=/usr/local/bin/runaswine|2=<br />
#!/bin/bash<br />
xhost +SI:localuser:wineuser<br />
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}<br />
<br />
Wine applications can then be launched via:<br />
<br />
$ runaswine ''"C:\path\to\application.exe"''<br />
<br />
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.<br />
<br />
It is recommended to run {{ic|winecfg}} as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.<br />
<br />
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to share a PulseAudio daemon]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.<br />
<br />
=== Temp directory on tmpfs ===<br />
<br />
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:<br />
<br />
$ rm -r ~/.wine/drive_c/users/$USER/Temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp<br />
<br />
=== Prevent installing Mono/Gecko ===<br />
<br />
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.<br />
<br />
=== Vulkan ===<br />
<br />
Vulkan support is included, since Wine 3.3. The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].<br />
<br />
{{Note|The Wine ICD loader was added in Wine 3.5, you need to install the official Vulkan SDK to use Vulkan in Wine 3.3 and 3.4}}<br />
<br />
=== Remove Wine file bindings ===<br />
<br />
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).<br />
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}<br />
<br />
NoExtract = usr/lib/binfmt.d/wine.conf<br />
NoExtract = usr/share/applications/wine.desktop<br />
<br />
== Troubleshooting ==<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Troubleshooting_.2F_Reporting_bugs Wine User's Guide] and [https://wiki.winehq.org/FAQ Wine FAQ] (especially its [https://wiki.winehq.org/FAQ#Troubleshooting Troubleshooting] section) for general tips.<br />
<br />
Also refer to the [https://appdb.winehq.org/ Wine AppDB] for an advice on specific applications.<br />
<br />
=== XWayland problems ===<br />
<br />
If you use Wine under [[Wayland#XWayland|XWayland]], you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:<br />
<br />
* flickering;<br />
* wrong window location;<br />
* wrong mouse cursor location and clicks;<br />
* keyboard detection.<br />
<br />
=== Keyboard input doesn't work after unfocusing application ===<br />
<br />
If you encounter this problem, you may be able to fix it by editing the registry:<br />
Under ''HKEY_CURRENT_USER\Software\Wine\X11 Driver'', add a string value ''UseTakeFocus'' and set it to ''N''.<br />
<br />
Alternatively, you can use winetricks to set the value.<br />
winetricks usetakefocus=n<br />
<br />
== See also ==<br />
<br />
* [https://www.winehq.org/ Wine Homepage]<br />
* [https://wiki.winehq.org/ Wine Wiki]<br />
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
* [[Gentoo:Wine]]<br />
* [https://www.darlinghq.org/ Darling] - a similar project for MacOS software</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=User:InsaneGuo/1&diff=714090User:InsaneGuo/12022-01-28T03:57:31Z<p>InsaneGuo: Created page with "Category:Emulation Category:Gaming de:Wine fr:Wine ja:Wine ru:Wine zh-hans:Wine {{Related articles start}} {{Related|CrossOver}} {{Related|Deepin-wine}} {{Related|Wine package guidelines}} {{Related articles end}} Wine 是一款可以在类 unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而不会像模拟器那样影响性能/..."</p>
<hr />
<div>[[Category:Emulation]]<br />
[[Category:Gaming]]<br />
[[de:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
[[zh-hans:Wine]]<br />
{{Related articles start}}<br />
{{Related|CrossOver}}<br />
{{Related|Deepin-wine}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
[[Wikipedia:Wine (software)|Wine]] 是一款可以在类 unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而不会像模拟器那样影响性能/内存。<br />
<br />
{{警告|<br />
* Wine并非与你的系统分离。<br />
* 如果您可以使用您的用户帐户访问文件或资源,那么在 Wine 中运行的程序也可以。参见[[ # running Wine under a separate user account ]]和[[ Security # sandboxing applications ]]了解可能的预防措施。<br />
* Wine 也可以运行恶意软件(参见[ https://wiki.winehq.org/FAQ#is_wine_malware-compatible.3f 葡萄酒常见问题]])}}<br />
<br />
== 安装 ==<br />
<br />
可以通过启用[[multilib]] 库来 [[install|安装]] {{Pkg|wine}} (稳定) 或 {{Pkg|wine-staging}} (测试) 包。 [https://wine-staging.com/ Wine Staging] Wine Staging 是[https://www.winehq.org/ Wine]的修补版本 [https://www.winehq.org/ Wine], 其中包含了 bug 修复和尚未集成到稳定或开发分支中的特性。<br />
<br />
另请参阅[[#Graphics drivers| # 图形驱动程序]]和[[#Sound|# 声音]]以了解其他需求。<br />
<br />
可以考虑为依赖于 Internet Explorer 和 .NET 的应用程序分别安装{{pkg|wine-gecko}}和{{pkg|wine-mono}}。这些软件包并不是严格要求的,因为 Wine 会根据需要下载相关文件。但是,提前下载文件可以让您离线工作,这样 Wine 就不会为每个需要它们的 Wine 前缀下载文件。<br />
<br />
=== 第三方Wine应用 ===<br />
<br />
这些都有自己的社区和网站,并不受主要葡萄酒社区的支持。详情请参阅[https://wiki.winehq.org/Third_Party_Applications Wine Wiki] 。<br />
<br />
* {{App|[[CrossOver]]|Wine 的付费商业版,提供更全面的终端用户支持。|https://www.codeweavers.com|{{AUR|crossover}}}}<br />
* {{App|exe-thumbnailer|为 Windows 可执行文件(. exe、 . lnk、 . msi 和. dll)生成缩略图。|https://github.com/exe-thumbnailer/exe-thumbnailer|{{AUR|exe-thumbnailer}}}}<br />
* {{App|[[Wikipedia:Lutris|Lutris]]|所有类型游戏的游戏启动器,包括 Wine 游戏(带前缀管理)、原生 Linux 游戏和模拟器。|https://lutris.net|{{Pkg|lutris}}}}<br />
* {{App|[[Wikipedia:PlayOnLinux|PlayOnLinux]]|Wine 的图形化前缀管理器。包含帮助程序安装和配置的脚本。|https://www.playonlinux.com|{{Pkg|playonlinux}}}}<br />
* {{App|Proton|Compatibility tool 基于Wine和其他部件为[Wikipedia:Steam]制造的Proton兼容性工具。兼容性列表见 [https://www.protondb.com/ ProtonDB] <br />
|list.|https://github.com/ValveSoftware/Proton|{{AUR|proton}}}}<br />
* {{App|PyWinery|Wine 的简单图形化前缀管理器。|https://github.com/ergoithz/pywinery|{{AUR|pywinery}}}}<br />
* {{App|Q4Wine|Wine 的图形前缀管理器。可以将 [[Qt]] 主题导出到 Wine 配置中,以便更好地集成。|https://sourceforge.net/projects/q4wine/|{{AUR|q4wine}}{{Broken package link|package not found}}}}<br />
* {{App|Bottles|基于 GTK 的 Wine 的图形化前缀和管理器。|https://usebottles.com/|{{AUR|bottles}}}}<br />
<br />
== 配置 ==<br />
<br />
配置Wine通常使用以下方法:<br />
<br />
* [https://wiki.winehq.org/Winecfg winecfg] 是 Wine 的 GUI 配置工具,可以通过运行{{ic|winecfg}}启动它。 <br />
* [https://wiki.winehq.org/Regedit regedit] 是 Wine 的注册表编辑工具,可以通过运行{{ic|regedit}} 来启动。See WineHQ's article on [https://wiki.winehq.org/Useful_Registry_Keys Useful Registry Keys].<br />
* [https://wiki.winehq.org/Control control] 是 Wine 的 Windows 控件面板的实现,它可以通过运行{{ic|wine control}}来启动。<br />
* 完整列表见 [https://wiki.winehq.org/List_of_Commands WineHQ 的命令列表]。<br />
<br />
=== WINEPREFIX ===<br />
<br />
默认情况下,Wine 将其配置文件和安装的 Windows 程序存储在 {{ic|~/.wine}} 。这个目录通常被称为“ Wine prefix”或“ Wine bottle”。当您运行 Windows 程序或 Wine 的捆绑程序(如 winecfg)时,它会自动创建/更新。前缀目录还包含一个目录,您的 Windows 程序将其视为 {{ic|c:}} (C盘)。<br />
<br />
你可以使用 {{ic|WINEPREFIX}}环境变量覆盖 Wine 使用的前缀位置。如果您希望为不同的 Windows 程序使用单独的配置,这将非常有用。第一次运行带有新 Wine 前缀的程序时,Wine 将自动创建一个带有 c 驱动器和注册表的目录。<br />
<br />
例如,如果您运行一个带有{{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}的程序,和另一个 {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}这两个程序将分别有一个单独的 c 驱动器和单独的注册。<br />
<br />
{{注意: Wine不是沙箱!在 Wine 下运行的程序仍然可以访问系统的其余部分!(例如, {{ic|Z:}} 映射到 {{ic|/}}, 与 Wine 前缀无关).}}<br />
<br />
若要在不运行 Windows 程序或其他 GUI 工具的情况下创建默认前缀,可以使用:<br />
<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
Wine will start a 64-bit environment by default. You can change this behavior using the {{ic|WINEARCH}} [[environment variable]]. Rename your {{ic|~/.wine}} directory and create a new Wine environment by running {{ic|1=$ WINEARCH=win32 winecfg}}. This will get you a 32-bit Wine environment. Not setting {{ic|WINEARCH}} will get you a 64-bit one.<br />
<br />
You can combine this with {{ic|WINEPREFIX}} to make a separate {{ic|win32}} and {{ic|win64}} environment:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
You can also use {{ic|WINEARCH}} in combination with other Wine programs, such as ''winetricks'' (using Steam as an example):<br />
<br />
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
In order to see the architecture of an existing prefix you can check its registry file. The command below reads the system registry of the {{ic|~/.wine}} prefix and returns {{ic|1=#arch=win32}} or {{ic|1=#arch=win64}} depending on the architecture type:<br />
<br />
$ grep '#arch' ~/.wine/system.reg<br />
<br />
=== Graphics drivers ===<br />
<br />
You need to install the 32-bit version of your graphics driver. Please install the package that is listed in the ''OpenGL (multilib)'' column in the table in [[Xorg#Driver installation]].<br />
<br />
A good sign that your drivers are inadequate or not properly configured is when Wine reports the following in your terminal window:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{Note|You might need to restart X after having installed the correct library.}}<br />
<br />
=== Sound ===<br />
<br />
By default sound issues may arise when running Wine applications. Ensure only one sound device is selected in ''winecfg''.<br />
<br />
Install the correct packages for the audio driver you want to use:<br />
<br />
* For [[ALSA]] install {{Pkg|lib32-alsa-lib}} and {{Pkg|lib32-alsa-plugins}}<br />
* For [[PulseAudio]] install {{Pkg|lib32-libpulse}} <br />
* For [[PipeWire]] install either {{Pkg|pipewire-pulse}} and {{Pkg|lib32-libpulse}} or {{Pkg|pipewire-alsa}} and {{Pkg|lib32-alsa-lib}} + {{Pkg|lib32-alsa-plugins}}<br />
* For [[OSS]] install {{Pkg|lib32-alsa-oss}}<br />
<br />
Additional packages: <br />
<br />
* Games that use advanced sound systems (''e.g.'' TESV: Skyrim) may additionally require installations of {{Pkg|lib32-openal}}.<br />
<br />
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [https://wiki.winehq.org/Wine_User's_Guide#Using_Regedit configure it via the registry]. For example, in a case where the microphone was not working in a 32-bit Windows application on a 64-bit stock install of wine-1.9.7, this provided full access to the sound hardware (sound playback and mic): open ''regedit'', look for the key HKEY_CURRENT_USER → Software → Wine → Drivers, and add a string called ''Audio'' and give it the value ''alsa''. Also, it may help to [[#WINEARCH|recreate the prefix]].<br />
<br />
==== MIDI support ====<br />
<br />
[[MIDI]] 是90年代流行的电子游戏音乐系统。如果你正在尝试旧的游戏,这是不寻常的音乐不会发挥出来的盒子。<br />
葡萄酒有很好的 MIDI 支持。但是,您首先需要使它在您的主机系统上工作,如[[ MIDI ]]中所解释的。最后但并非最不重要的是,您需要确保 Wine 将使用正确的 MIDI 输出。<br />
<br />
=== Other dependencies ===<br />
<br />
Some applications may require additional packages for the following purposes:<br />
<br />
* playing music: {{Pkg|lib32-mpg123}}<br />
* native image manipulation libraries: {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}<br />
* encryption support: {{Pkg|lib32-gnutls}}<br />
* 32-bit video codecs: {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}<br />
* NTLM authentication: {{Pkg|samba}}<br />
<br />
=== Fonts ===<br />
<br />
如果 Wine 应用程序没有显示易读的字体,则可能没有安装任何字体。轻松链接所有的系统字体,使他们可以从Wine:<br />
<br />
$ cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; 来完成<br />
<br />
使用 FreeType 渲染字体,而 FreeType 的默认设置在几个版本之前已经改变了。尝试在葡萄酒项目中使用这种环境设置:<br />
FREETYPE_PROPERTIES="truetype:interpreter-version=35"<br />
<br />
另一种可能性是在葡萄酒前缀中安装微软的 TrueType 字体。 See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
运行此类程序后,关闭所有 Wine 服务并运行{{ic| winecfg }}。字体现在应该是可读的。<br />
<br />
如果字体看起来模糊不清,导入以下文本文件到 Wine 注册表[https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
Windows Registry Editor Version 5.00<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
对于高分辨率显示,可以在 winecfg 中调整 dpi 值。<br />
<br />
See also [[Font configuration#Applications without fontconfig support]].<br />
<br />
==== Enable font smoothing ====<br />
<br />
提高Wine染效果的一个好方法是使用明显的字体平滑。/n要启用“次像素平滑(ClearType) RGB”:<br />
<br />
{{bc|<nowiki><br />
cat << EOF > /tmp/fontsmoothing<br />
REGEDIT4<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingOrientation"=dword:00000001<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
EOF<br />
<br />
WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null<br />
</nowiki>}}<br />
<br />
For more information, check [https://askubuntu.com/a/219795 the original answer]<br />
<br />
=== Desktop launcher menus ===<br />
<br />
当 Windows 应用程序安装程序创建一个快捷方式时,Wine 创建一个[[.desktop]]Arch Linux 中这些文件的默认位置是:<br />
<br />
* Desktop shortcuts are put in {{ic|~/Desktop}}<br />
* Start menu shortcuts are put in {{ic|~/.local/share/applications/wine/Programs/}}<br />
<br />
{{Note|1=Wine does not support installing Windows applications for all users, so it will not put ''.desktop'' files in {{ic|/usr/share/applications}}. See WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}<br />
<br />
{{Tip|If menu items were ''not'' created while installing software or have been lost, {{ic|wine winemenubuilder}} may be of some use.}}<br />
<br />
==== Creating menu entries for Wine utilities ====<br />
<br />
默认情况下,Wine 的安装不会为 Wine 附带的软件创建桌面菜单/图标(例如“ winecfg”、“ winebroserer”等)。这可以通过安装{{AUR | wine-installer}}或{{ AUR | wine-installer-git }}meta-package (后者没有附加依赖项)来实现,否则这些说明将为这些应用程序添加条目。<br />
<br />
首先,使用 Wine 安装一个 Windows 程序来创建基本菜单。创建基本菜单后,可以在 {{ic|~/.local/share/applications/wine/}}:<br />
<br />
{{hc|wine-browsedrive.desktop|2=<br />
[Desktop Entry]<br />
Name=Browse C: Drive<br />
Comment=Browse your virtual C: drive<br />
Exec=wine winebrowser c:<br />
Terminal=false<br />
Type=Application<br />
Icon=folder-wine<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-uninstaller.desktop|2=<br />
[Desktop Entry]<br />
Name=Uninstall Wine Software<br />
Comment=Uninstall Windows applications for Wine<br />
Exec=wine uninstaller<br />
Terminal=false<br />
Type=Application<br />
Icon=wine-uninstaller<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-winecfg.desktop|2=<br />
[Desktop Entry]<br />
Name=Configure Wine<br />
Comment=Change application-specific and general Wine options<br />
Exec=winecfg<br />
Terminal=false<br />
Icon=wine-winecfg<br />
Type=Application<br />
Categories=Wine;<br />
}}<br />
<br />
And create the following file in {{ic|~/.config/menus/applications-merged/}}:<br />
<br />
{{hc|wine.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Category>Wine</Category><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
<br />
如果这些设置产生了一个难看的/不存在的图标,这意味着在您所启用的图标集中没有这些启动程序的图标。您应该将图标设置替换为所需图标的显式位置。单击启动器属性菜单中的图标将会产生同样的效果。一个优秀的图标集,支持这些捷径是 [https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors].<br />
<br />
==== Removing menu entries ====<br />
<br />
由 Wine 创建的菜单条目位于 {{ic|~/.local/share/applications/wine/Programs/}}.<br />
除了通过 Wine 删除不需要的扩展绑定,还可以执行以下命令(摘自 Wine 官网) :<br />
<br />
$ rm ~/.local/share/mime/packages/x-wine*<br />
$ rm ~/.local/share/applications/wine-extension*<br />
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
$ rm ~/.local/share/mime/application/x-wine-extension*<br />
<br />
Sometimes you should also remove {{ic|wine-*.menu}} files from {{ic|/.config/menus/}} to completely remove items from wine submenu in kde.<br />
<br />
=== Appearance ===<br />
<br />
类似于 xp 外观的主题可以在 [https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 下载]. To install it, see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files this upstream wiki article]. Lastly, use ''winecfg'' to select it.<br />
<br />
{{Note|上面链接的主题只能安装在32位前缀上,前缀版本为 windowsxp。要将其安装在64位前缀上,可能需要创建一个临时的32位前缀,install the theme and copy the {{ic|Zune}} folder and {{ic|Zune.theme}} files from {{ic|drive_c/Windows/Resources/Themes}} in that prefix to the same location in your usual prefix.}}<br />
<br />
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.<br />
<br />
=== Printing ===<br />
<br />
In order to use your installed printers (both local and network) with wine applications in ''win32 prefixes'' (e.g. MS Word), install the {{Pkg|lib32-libcups}} package, reboot wine (''wineboot'') and restart your wine application.<br />
<br />
=== Networking ===<br />
<br />
After installation, the {{pkg|lib32-gnutls}} package may need to be [[install]]ed for applications making TLS or HTTPS connections to work.<br />
<br />
For ICMP (ping), Wine may need the network access as described in the [https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
<br />
If issues arise after this (such as an unhandled exception or privileged instruction), remove via:<br />
<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== Usage ==<br />
<br />
{{Warning|Do not run or install Wine applications as root! See [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ] for details.}}<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Using_Wine Wine User's Guide] for general information on Wine usage.<br />
<br />
See [https://appdb.winehq.org/ Wine Application Database (AppDB)] for additional information on specific Windows applications in Wine.<br />
<br />
=== Wayland ===<br />
<br />
Currently Wine does not support Wayland directly, but you can use [[Wayland#XWayland|XWayland]] instead.<br />
<br />
There are some efforts to support Wayland though:<br />
<br />
* Experimental Wayland driver for Wine, which supports using OpenGL- and Windows GDI-applications. See [https://www.winehq.org/pipermail/wine-devel/2020-December/178575.html this] and [https://www.winehq.org/pipermail/wine-devel/2021-February/181325.html this] wine-devel maillist entries.<br />
* [https://github.com/varmd/wine-wayland wine-wayland]: a custom version of Wine, which supports Wayland via Vulkan (so it supports only: DirectX 9, 10 and 11 via [[#DXVK]] and Vulkan-compatible applications).<br />
<br />
== Tips and tricks ==<br />
<br />
=== Wineconsole ===<br />
<br />
Often you may need to run ''.exe'''s to patch game files, for example a widescreen mod for an old game, and running the ''.exe'' normally through Wine might yield nothing happening. In this case, you can open a terminal and run the following command:<br />
<br />
$ wineconsole cmd<br />
<br />
Then navigate to the directory and run the ''.exe'' file from there.<br />
<br />
=== Winetricks ===<br />
<br />
[https://wiki.winehq.org/Winetricks Winetricks] is a script to allow one to install base requirements needed to run Windows programs. Installable components include DirectX 9.x, MSXML (required by Microsoft Office 2007 and Internet Explorer), Visual Runtime libraries and many more.<br />
<br />
[[Install]] the {{pkg|winetricks}} package (or alternatively {{AUR|winetricks-git}}). Then run it with:<br />
$ winetricks<br />
<br />
For using GUI you should [[install]] the {{pkg|zenity}}.<br />
<br />
=== Performance ===<br />
<br />
==== CSMT ====<br />
<br />
CSMT is a technology used by Wine to use a separate thread for the OpenGL calls to improve performance noticeably. Since Wine 3.2, CSMT is enabled by default. However, CSMT support needs to be enabled manually for Wine versions lower than 3.2. For vanilla Wine run {{ic|wine regedit}} and set the DWORD value for ''HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt'' to 0x01 (enabled). For wine-staging run {{ic|winecfg}} and enable it in the staging tab.<br />
<br />
Note that CSMT may actually hurt performance for some applications - if this is the case, disable it by creating/setting the registry value to 0x00 (disabled).<br />
<br />
Further information:<br />
*[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion] with the CSMT developer Stefan Dösinger<br />
<br />
==== Force OpenGL mode in games ====<br />
<br />
Some games might have an OpenGL mode which ''may'' perform better than their default DirectX mode. While the steps to enable OpenGL rendering is ''application specific'', many games accept the {{Ic|-opengl}} parameter.<br />
<br />
$ wine ''/path/to/3d_game.exe'' -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [https://appdb.winehq.org AppDB] for such application specific information.<br />
<br />
==== DXVK ====<br />
<br />
[https://github.com/doitsujin/dxvk DXVK] is a promising new implementation for DirectX 9, 10 & 11 over Vulkan. This should allow for greater performance, and in some cases, even better compatibility. Battlefield 1 for example, only runs under DXVK. On the other hand, DXVK does not support all Wine games (yet).<br />
<br />
To use it, install {{aur|dxvk-bin}}. Then run the following command to activate it in your Wineprefix (by default {{ic|~/.wine}}):<br />
$ WINEPREFIX=''your-prefix'' setup_dxvk install<br />
<br />
{{Note|For Wine versions below 3.5 you need to configure Vulkan support manually, following the instructions at [https://github.com/roderickc/wine-vulkan GitHub].}}<br />
<br />
{{Warning|DXVK overrides the DirectX 10 and 11 DLLs, which may be considered cheating in online multiplayer games, and may get your account '''banned'''. Use at your own risk!}}<br />
<br />
==== Gallium Nine ====<br />
<br />
With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.<br />
<br />
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any Wine version. Use {{ic|wine ninewinecfg}} to check if it is enabled.<br />
<br />
For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. [[Export]] the following environment variable before running Wine: <br />
<br />
MESA_LOADER_DRIVER_OVERRIDE=crocus<br />
<br />
=== Unregister existing Wine file associations ===<br />
<br />
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.<br />
<br />
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
$ update-mime-database ~/.local/share/mime/<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Prevent Wine from creating filetype associations ===<br />
<br />
{{Note|This has to be done for each WINEPREFIX which should not update file associations unless you opt to change {{ic|/usr/share/wine/wine.inf}} .}}<br />
This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).<br />
<br />
If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See [https://wiki.winehq.org/FAQ#How_can_I_prevent_Wine_from_changing_the_filetype_associations_on_my_system_or_adding_unwanted_menu_entries.2Fdesktop_links.3F Wine FAQ]<br />
<br />
To make the same change via registry add the string {{ic|Enable}} with value {{ic|N}} under:<br />
<br />
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations<br />
<br />
''You might have to create the key {{ic|FileOpenAssociations}} first!''<br />
<br />
If you want to apply this by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}} and add this line for example under the {{ic|[Services]}} section:<br />
HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"<br />
<br />
To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:<br />
<br />
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=<br />
<br />
[Trigger]<br />
Operation = Install<br />
Operation = Upgrade<br />
Type = Path<br />
Target = usr/share/wine/wine.inf<br />
<br />
[Action]<br />
Description = Stopping Wine from hijacking file associations...<br />
When = PostTransaction<br />
<nowiki>Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'</nowiki><br />
}}<br />
<br />
See [[Pacman#Hooks]]<br />
<br />
=== Execute Windows binaries with Wine implicitly ===<br />
<br />
The {{pkg|wine}} package installs a ''binfmt'' file which will allows you to run Windows programs directly, e.g. {{ic|''./myprogram.exe''}} will launch as if you had typed {{ic|wine ''./myprogram.exe''}}. Service starts by default on boot, if you have not rebooted after installing Wine you can [[start]] {{ic|systemd-binfmt.service}} to use it right away.<br />
<br />
{{Note|Make sure the Windows binary is [[executable]], otherwise the binary will not run.}}<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). [[CDemu]] will handle it correctly.<br />
<br />
=== Show FPS overlay in games ===<br />
<br />
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.<br />
<br />
=== Running Wine under a separate user account ===<br />
<br />
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.<br />
<br />
First, create a [[user account]] for Wine:<br />
<br />
# useradd -m -s /bin/bash wineuser<br />
<br />
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...<br />
<br />
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information on how to execute the {{ic|xhost}} command under your main user.}}<br />
<br />
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:<br />
<br />
$ xhost +SI:localuser:wineuser<br />
<br />
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:<br />
<br />
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''<br />
<br />
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:<br />
{{hc|1=/usr/local/bin/runaswine|2=<br />
#!/bin/bash<br />
xhost +SI:localuser:wineuser<br />
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}<br />
<br />
Wine applications can then be launched via:<br />
<br />
$ runaswine ''"C:\path\to\application.exe"''<br />
<br />
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.<br />
<br />
It is recommended to run {{ic|winecfg}} as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.<br />
<br />
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to share a PulseAudio daemon]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.<br />
<br />
=== Temp directory on tmpfs ===<br />
<br />
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:<br />
<br />
$ rm -r ~/.wine/drive_c/users/$USER/Temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp<br />
<br />
=== Prevent installing Mono/Gecko ===<br />
<br />
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.<br />
<br />
=== Vulkan ===<br />
<br />
Vulkan support is included, since Wine 3.3. The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].<br />
<br />
{{Note|The Wine ICD loader was added in Wine 3.5, you need to install the official Vulkan SDK to use Vulkan in Wine 3.3 and 3.4}}<br />
<br />
=== Remove Wine file bindings ===<br />
<br />
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).<br />
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}<br />
<br />
NoExtract = usr/lib/binfmt.d/wine.conf<br />
NoExtract = usr/share/applications/wine.desktop<br />
<br />
== Troubleshooting ==<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Troubleshooting_.2F_Reporting_bugs Wine User's Guide] and [https://wiki.winehq.org/FAQ Wine FAQ] (especially its [https://wiki.winehq.org/FAQ#Troubleshooting Troubleshooting] section) for general tips.<br />
<br />
Also refer to the [https://appdb.winehq.org/ Wine AppDB] for an advice on specific applications.<br />
<br />
=== XWayland problems ===<br />
<br />
If you use Wine under [[Wayland#XWayland|XWayland]], you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:<br />
<br />
* flickering;<br />
* wrong window location;<br />
* wrong mouse cursor location and clicks;<br />
* keyboard detection.<br />
<br />
=== Keyboard input doesn't work after unfocusing application ===<br />
<br />
If you encounter this problem, you may be able to fix it by editing the registry:<br />
Under ''HKEY_CURRENT_USER\Software\Wine\X11 Driver'', add a string value ''UseTakeFocus'' and set it to ''N''.<br />
<br />
Alternatively, you can use winetricks to set the value.<br />
winetricks usetakefocus=n<br />
<br />
== See also ==<br />
<br />
* [https://www.winehq.org/ Wine Homepage]<br />
* [https://wiki.winehq.org/ Wine Wiki]<br />
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
* [[Gentoo:Wine]]<br />
* [https://www.darlinghq.org/ Darling] - a similar project for MacOS software</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=User:InsaneGuo&diff=714089User:InsaneGuo2022-01-28T03:07:23Z<p>InsaneGuo: </p>
<hr />
<div>ARCH新手 刚会安装~ 先前使用过较长时间的OPENSUSE和UBUNTU和MANJARO 有一、、linux经验~ 欢迎来我的 [https://zh.wikipedia.org/wiki/User:InsaneGuo WIKIPEDIA]玩~</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=714088Wine (简体中文)2022-01-28T02:36:48Z<p>InsaneGuo: </p>
<hr />
<div>[[Category:Wine (简体中文)]]<br />
[[de:Wine]]<br />
[[en:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
{{TranslationStatus (简体中文)|Wine|2015-08-5|389504}}<br />
{{Bad translation (简体中文)|Very out of sync with English page}}<br />
{{Template:Translateme}}<br />
{{Related articles start (简体中文)}}<br />
{{Related|Steam}}<br />
{{Related|CrossOver}}<br />
{{Related articles end}}<br />
[[Wikipedia:Wine (software)|Wine]] 是类UNIX系统下运行微软Windows程序的"兼容层"。在Wine中运行的Windows程序,就如同运行原生Linux程序一样,不会有模拟器那样的性能问题。<br />
<br />
获取更详细的介绍请浏览[https://www.winehq.org/ 项目官方网站]和[https://wiki.winehq.org/ wiki]页面。<br />
<br />
{{警告|如果您的账户能浏览某些文件或资源,Wine运行的程序也可以。Wine不是[[wikipedia:Sandbox (computer security)|沙箱]]。如果很重视安全,请考虑使用[[wikipedia:Virtualization|虚拟化]]。}}<br />
<br />
== 安装 ==<br />
<br />
Wine可通过开启[[Multilib]]仓库来安装{{Pkg|wine}}(稳定版本)or{{Pkg|wine-staging}}(测试版本)。[https://www.wine-staging.com/ Wine-Staging]包括目前上游未采纳的补丁,专门为wine开发者在向上游打补丁前测试。<br />
<br />
另外,您可能需要安装 {{pkg|wine-gecko}} 和 {{pkg|wine-mono}} 软件包。它们分别用于运行依赖于 Internet Explorer 和 .NET 的程序。不过,也可以随后通过 Wine 在需要时下载安装这些组件。但如果提前下载安装,您就可以离线使用它们,而且 Wine 不必为了每一个 WINEPREFIX 都单独下载。<br />
<br />
'''平台差异'''<br />
<br />
默认的Wine是32位的程序,也是i686的Arch软件包。所以它不能运行64位的Windows程序(反正是罕见的)。<br />
<br />
然而,x86_64的Wine软件包目前以{{ic| --enable-win64}}方式编译。这个参数激活了[[Wikipedia:WoW64|WoW64]]的Wine版本。<br />
<br />
*在Windows中,这个复杂的子系统允许用户同时使用32位和64位的Windows程序,甚至是在同一目录。<br />
<br />
*在Wine中,用户将必须建立单独分开的目录/前缀。这项Wine功能仍是试验阶段,并建议用户使用一个win32{{ic|WINEPREFIX}}。浏览[http://wiki.winehq.org/Wine64 Wine64]{{Dead link (简体中文)|2020|08|06|status=404}}以获取有关这个的详细信息。<br />
<br />
总结一下,配置{{ic|1=WINEARCH=win32}}后,x86_64平台的Arch和i686平台的Arch完全相同。<br />
<br />
{{注意|如果在64位环境中执行{{ic|winetricks}}或其它程序出现问题,请试试创建一个新的32位{{ic|WINEPREFIX}}. 参见下面的[[#WINEARCH]]}}<br />
<br />
== 配置 ==<br />
<br />
配置Wine的方式通常有:<br />
* [https://wiki.winehq.org/winecfg winecfg]是Wine的图形界面配置程序。控制台下调用{{ic|$ winecfg}}(或指定系统目录:{{ic|1=$ WINEPREFIX=~/.系统目录 winecfg}})即可启动<br />
* [https://wiki.winehq.org/control control.exe]是Windows控制面板的Wine实现,通过{{ic|$ wine control}}命令启动<br />
* [https://wiki.winehq.org/regedit regedit]是Wine的注册表编辑器,比较前两者,该工具能配置更多东西。部分常用键值参见:[https://wiki.winehq.org/UsefulRegistryKeys WineHQ's article on Useful Registry Keys]<br />
<br />
=== WINEPREFIX ===<br />
<br />
Wine默认将配置文件和安装的Windows程序保存在{{ic|~/.wine}}。这样的目录称为一个"Wine prefix"或"Wine bottle"(保留原文,下文称“系统目录”)。每次运行Windows程序(包括内置程序,如{{ic|winecfg}})时,系统目录会自动创建(如果缺失)或更新。系统目录中存放有相当于Windows下{{ic | C:\}}C盘(更确切的说应是系统盘)的文件夹。<br />
<br />
通过设置{{ic|WINEPREFIX}}环境变量,可以更改Wine系统目录的位置。如果希望让不同的Windows程序使用不同的系统环境或配置,这一变量会非常有用。<br />
<br />
例如,如果您使用 <br />
{{ic |1= $ env WINEPREFIX=~/.win-a wine-A程序.exe}}参数来运行一个程序。另一个使用<br />
{{ic |1= $ env WINEPREFIX=~/.win-b wine-B程序.exe}}参数,这两个程序将使用独立的C盘和注册表配置。<br />
<br />
以下命令会建立一个默认的系统目录,且不启动任何Windows程序:<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
对于64位用户,如果使用[multilib]仓库里的Wine,默认创建的系统目录是64位环境的。若想使用纯32位环境,修改{{ic|WINEARCH}} 变量win32为即可:<br />
{{ic |1=$ WINEARCH=win32 winecfg}}这样就会生成32位Wine环境。若不设置{{ic|WINEARCH}}得到的就是64位环境。<br />
<br />
通过{{ic|WINEPREFIX}}变量,在不同的系统目录分别创建32位和64位环境:<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg <br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
{{注意|系统目录创建过程中,64位版本的wine将视全部目录如同64位系统目录,也将不会在已存在的目录中创建任何32位的.创建32位系统目录,您必须让Wine创建指定的{{ic|WINEPREFIX}}目录。}}<br />
<br />
winetricks也接受{{ic|WINEPREFIX}}变量,以安装Steam为例:<br />
env WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
To have them permanently defined for [[Bash#Shell and environment variables|bash configuration ~/.bashrc]] do:<br />
<br />
export WINEPREFIX=$HOME/.config/wine/<br />
export WINEARCH=win32<br />
{{小贴士|编辑 [[Bash_(简体中文)#配置文件|~/.bashrc]],使得 WINEPREFIX 和 WINEARCH 永久生效。}}<br />
{{注意|不必手动在 {{ic|wineprefixes}} 文件夹下建立 steam 文件夹,Wine会自动创建不存在的系统目录。}}<br />
<br />
=== 图形驱动 ===<br />
<br />
你需要安装32位的显卡驱动。请安装[[Xorg (简体中文)#驱动安装]]的表格中 ''OpenGL (multilib)'' 列所写的驱动<br />
<br />
缺少或未能正确配置驱动的一个标志是 Wine 在终端窗口里报告如下内容:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{注意|在安装对应的库以后,你可能需要重启 X}}<br />
<br />
=== 声音 ===<br />
<br />
Wine程序有可能遇到某些声音问题。首先,确保{{ic|winecfg}}中只启用了一种声卡驱动。目前,Wine对[[Alsa (简体中文)|Alsa]]的支持最好。<br />
<br />
x86_64平台下使用[[Alsa (简体中文)|Alsa]]的话,需要安装{{Pkg|lib32-alsa-lib}}。如果还要使用PulseAudio,则需安装{{Pkg|lib32-libpulse}}。<br />
<br />
若使用[[OSS (简体中文)|OSS]],需要安装{{Pkg|lib32-alsa-oss}}。仅靠内核驱动是不行的。<br />
<br />
安装上述软件包后,若{{ic|winecfg}}'''仍'''无法识别声卡(Selected driver: (none)),请尝试[http://wiki.jswindle.com/index.php/Wine_Registry#Configuring_Sound registry 通过注册表配置]。<br />
<br />
运行使用某些高级声音系统的游戏,可能还需要安装{{Pkg|lib32-openal}}。<br />
<br />
==== MIDI 支持 ====<br />
<br />
[[MIDI]] 是九十年代非常流行的游戏声音系统。如果你尝试运行老一点的游戏,音乐无法开箱即用的情况并不罕见。<br />
Wine 拥有非常优秀的 MIDI 支持。但是首先你需要确保 Wine 会使用正确的 MIDI 输出。详细设置参考 [https://wiki.winehq.org/MIDI Wine Wiki]<br />
<br />
=== 其他函数库 ===<br />
<br />
*某些程序(如 Office 2003)需要解析HTML、XML(使用MSXML库),需要安装{{Pkg|lib32-libxml2}}。<br />
<br />
*播放音频的程序可能依赖{{Pkg|lib32-mpg123}}。<br />
<br />
*使用色彩管理引擎的一些应用 (例如: PDF查看器, 图片查看器, etc) may require {{Pkg|lib32-lcms2}}.<br />
<br />
*对于使用图像处理库的程序,可能依赖{{Pkg|lib32-giflib}}和{{Pkg|lib32-libpng}},<br />
<br />
*x86_64的加密支持需要{{Pkg|lib32-gnutls}}软件包。<br />
<br />
=== 字体 ===<br />
<br />
如果没有安装微软Truetype字体,Wine程序的字体显示可能会一团糟,参见[[MS Fonts (简体中文)]]。如果还是不行,试试{{ic|winetricks allfonts}}。<br />
<br />
上述操作后,杀死wine相关进程再运行{{ic|winecfg}},字体应该变好看了。<br />
<br />
如果字体看起来很毛糙,试试用[https://wiki.winehq.org/regedit regedit]导入下列文本文件:<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
{{提示|高分辨率显示器,可在winecfg的显示选项卡中适当dpi的值,例如缩放150%,将dpi设置为144。}}<br />
参阅 [[Font configuration#Applications without fontconfig support]].<br />
<br />
=== 启动器和菜单 ===<br />
<br />
Wine不会为内置程序(如{{ic|winecfg}}、{{ic|winebrowser}})创建桌面启动器和菜单项。但手动安装的Windows程序通常会自动创建启动器和菜单项。在Windows下,安装程序(如{{ic|setup.exe}})通常会在桌面和开始菜单建立快捷方式,而Wine下会创建遵循freedesktop.org规范的.desktop文件(即启动器,相当于快捷方式)。<br />
<br />
{{小贴士|如果启动器''没有''自动创建,或者这些文件丢失了,可以尝试使用[https://wiki.winehq.org/winemenubuilder winemenubuilder]修复。}}<br />
<br />
Ubuntu下,Wine项目以子菜单形式出现在系统菜单。以下步骤将实现这个效果:<br />
<br />
==== 创建菜单项 ====<br />
<br />
首先,用Wine安装一个Windows程序,以建立基本的菜单。完成后,向其中添加菜单项。桌面右键选择{{ic|"创建启动器..."}}(不同桌面环境操作有所差异),设置如下:<br />
'''类型(Type)''': 应用程序(Application)<br />
'''名称(Name)''': 配置<br />
'''命令(Command)''': winecfg<br />
'''备注(Comment)''': Wine配置工具<br />
<br />
'''类型''': 应用程序<br />
'''名称''': 卸载程序<br />
'''命令''': wine uninstaller<br />
'''备注''': 卸载Wine下的Windows程序<br />
<br />
'''类型''': 应用程序<br />
'''名称''': 浏览 C:\<br />
'''命令''': wine winebrowser c:\\<br />
'''备注''': 浏览Wine中虚拟的C盘<br />
现在,桌面上出现了三个启动器,下面将把它们移入菜单。不过首先,我们给这些启动器加上动态图标(由图标主题提供)。方法是,用文本编辑器打开启动器,编辑Icon项目:<br />
<br />
{{ic|配置}} 启动器:<br />
Icon=wine-winecfg<br />
{{ic|卸载程序}} 启动器:<br />
Icon=wine-uninstaller<br />
{{ic|浏览 C:\}} 启动器:<br />
Icon=wine-winefile<br />
{{小贴士|多数桌面环境在上述“创建启动器”步骤即可设置图标。以第一个启动器为例,在选择图标窗口中搜索wine-winecfg,选择即可,无需手动编辑。 ——译者注}}<br />
如果图标无法显示或者你觉得很丑陋,换成其他图标也可以。右键设置启动器,应该有更改图标的地方。很多图标主题,例如[https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors],都提供这些图标。<br />
<br />
现在,将启动器移入菜单。把启动器复制到 {{ic|~/.local/share/applications/wine/}} 目录即可。<br />
<br />
诶?图标还没出现在菜单中!还剩下最后一步,创建下列文本文件:<br />
{{hc|~/.config/menus/applications-merged/wine-utilities.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Filename>wine-Configuration.desktop</Filename><br />
</Include><br />
<Include><br />
<Filename>wine-Browse C:\.desktop</Filename><br />
</Include><br />
<Include><br />
<Filename>wine-Uninstall Programs.desktop</Filename><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
再看看菜单,应该万事大吉了。<br />
<br />
==== Gnome3 中清理 Wine 菜单启动项 ====<br />
<br />
系统全局的菜单启动器安装在 {{ic|/usr/share/applications/}},清除相应程序的“.desktop”文件即可从整个系统删除该启动器。<br />
<br />
如果这样还是无法解决问题,那么很可能 Wine 的启动器存放在用户级别的 {{ic|~/.local/share/applications/wine/Programs/}} 目录中。删除相应的“.desktop”文件即可清理对应启动项。删除整个 Programs 文件夹将清理所有 Wine 程序的启动项。<br />
<br />
==== 修复 KDE 4 菜单问题 ====<br />
<br />
Wine菜单项有可能[https://bugs.launchpad.net/ubuntu/+source/wine/+bug/263041 错误地出现]在{{ic|"Lost & Found(其他)"}} ,而非Wine子菜单。原因是kde-applications.menu文件缺失{{ic|MergeDir}}配置。<br />
<br />
编辑{{ic|/etc/xdg/menus/kde-applications.menu}}。<br />
<br />
在文件末尾处,{{ic|<DefaultMergeDirs/>}}后添加{{ic|<MergeDir>applications-merged</MergeDir>}}。修改后内容大致如下:<br />
<Menu><br />
<Include><br />
<And><br />
<Category>KDE</Category><br />
<Category>Core</Category><br />
</And><br />
</Include><br />
<DefaultMergeDirs/><br />
'''<MergeDir>applications-merged</MergeDir>'''<br />
<MergeFile>applications-kmenuedit.menu</MergeFile><br />
</Menu><br />
<br />
另一个方法是:<br />
ln -s ~/.config/menus/applications-merged ~/.config/menus/kde-applications-merged<br />
<br />
这样的好处是,不会因为KDE升级而重置配置。但该方法只对一个用户有效。<br />
<br />
==== 外观 ====<br />
<br />
XP外观主题可以从[https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 这里]下载,安装请看[https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files 这里],最后使用''winecfg''选择主题。<br />
Wine staging 的用户可能想要允许''winecfg'' Staging部分的''Enable GTK3 Theming''选项使得主题能够与当前GTK主题相匹配。<br />
<br />
==== 打印 ====<br />
<br />
为了能够在''win32 prefixes''中使用打印机,请安装{{Pkg|lib32-libcups}},重启wine和运行在wine上的程序。<br />
<br />
==== 网络 ====<br />
<br />
wine安装之后,需要安装{{pkg|lib32-gnutls}}以使wine中的程序使用TLS、HTTPS安全连接。<br />
对于ICMP数据包,wine的网络需要[https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
如果执行后出现错误,通过以下方式移除:<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== 运行 Windows 程序 ==<br />
<br />
{{警告|千万不要以root身份运行Wine!详情参见[https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F 本文]。}}<br />
运行Windows程序:<br />
$ wine <exe文件><br />
<br />
内置的msiexec程序可以运行MSI安装包:<br />
$ msiexec /i ''path_to_msi''<br />
<br />
== 技巧和技巧 ==<br />
<br />
{{小贴士|此外您可能会感兴趣以下文章的开始所提供的链接<br />
* [https://appdb.winehq.org/ Wine程序数据库 (Wine Application Database, AppDB)] —— 特定Windows程序的Wine兼容情况(运行时的已知问题、用户评分、指南等等)<br />
* [https://forum.winehq.org/ WineHQ论坛] —— 要是看完上述网页还有问题,可以到这里咨询<br />
}}<br />
<br />
这里介绍一些安装Windows组件的工具。由于这些工具可能严重破坏Wine配置,没有需要时最好不要使用。<br />
<br />
=== 取消注册Wine文件关联 ===<br />
<br />
在默认情况下,Wine接管了许多扩展名. 一些扩展名 {例如 {{ic|.vbs}} 或者 {{ic|.chm}}) 是Windows专用, 用Wine打开这些程序是很方便的. 但是, 有一些其他格式 (例如 {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) 在Wine中用 {{ic|Internet Explorer}} 和 {{ic|Windows记事本}} 打开会出错 .<br />
<br />
Wine的文件关联设置在 {{ic|~/.local/share/applications/}} 像 {{ic|wine-extension-{extension}.desktop}} 这样的文件中. 删除与要取消注册的扩展名相对应的文件. 或者像这样删除所有的扩展名:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
=== exe-thumbnailer ===<br />
<br />
This is a small piece of UI code meant to be installed with (or even before) Wine. It provides thumbnails for executable files that show the embedded icons when available, and also gives the user a hint that Wine will be used to open it. Details can be found [https://github.com/exe-thumbnailer/exe-thumbnailer here]. Install it with the {{AUR|exe-thumbnailer}} package.<br />
<br />
=== CSMT patch ===<br />
<br />
{{Out of date|See wine-staging below}}<br />
Currently [https://www.winehq.org/pipermail/wine-devel/2013-September/101106.html wine developers] experiment with stream/worker thread optimizations for Wine. You may experience an enormous performance improvement by using this experimental patched Wine versions. Many games may run as fast as on Windows or even faster. This Wine patch is is known as CSMT patch and works with NVidia and AMD graphics cards.<br />
<br />
{{Note (简体中文)|This is ''still experimental code'', therefore, it may not work as expected. Please, report your experiences to the developers for helping with development of those patches.}}<br />
<br />
The easy way is to install {{Pkg|playonlinux}}. Then install your game and activate the Wine version ''1.7.4-CSMT'' from the {{ic|Tools}} → {{ic|Manage Wine Versions}} menu in PlayOnLinux. For now it is recommended to use the patched Wine version ''1.7.4-CSMT''.<br />
<br />
Open your game's configuration settings and copy the following settings to the {{ic|Miscellaneous}}/{{ic|Command to exec before running the program}} section of your game configuration settings:<br />
<br />
export WINEDEBUG=-all<br />
export LD_PRELOAD="libpthread.so.0 libGL.so.1"<br />
export __GL_THREADED_OPTIMIZATIONS=0<br />
export __GL_SYNC_TO_VBLANK=1<br />
export __GL_YIELD="NOTHING"<br />
export CSMT=enabled<br />
<br />
Make sure you have disabled {{ic|StrictDrawOrdering}} from {{ic|Tools}} → {{ic|General}}.<br />
<br />
=== CSMT via wine-staging ===<br />
<br />
[https://www.wine-staging.com/ Wine-staging] includes CSMT support, and can be installed with the {{Pkg|wine-staging}} package, or directly via the wine-staging [https://github.com/wine-compholio/wine-staging/wiki/Installation#-arch-linux Arch Linux repo].<br />
<br />
CSMT support needs to be enabled before it can be used, instructions can be found [https://github.com/wine-compholio/wine-staging/wiki/CSMT#enabledisable-csmt here], no further configuration is needed.<br />
<br />
==== Further Information ====<br />
<br />
[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion] with the CSMT developer Stefan Dösinger<br />
<br />
[https://web.archive.org/web/20150908000147/http://wiki.winehq.org/FOSDEM2014?action=AttachFile&do=get&target=d3d-drivers.odp FOSDEM2014 CSMT presentation] of CSMT with benchmarks<br />
<br />
[https://www.youtube.com/playlist?list=PL0P2a_sII2eTd8uq-azTNpQjiFLqBhDjg Here] you find some game videos running with CSMT enabled<br />
<br />
=== Changing the language ===<br />
<br />
Some programs may not offer a language selection, they will guess the desired language upon the sytem locales. Wine will transfer the current environment (including the locales) to the application, so it should work out of the box. If you want to force a program to run in a specific locale (which is fully [[Locale|generated]] on your system), you can call Wine with the following setting:<br />
<br />
LC_ALL=''xx_XX.encoding'' wine ''/path/to/program''<br />
<br />
For instance<br />
<br />
LC_ALL=it_IT.UTF-8 wine ''/path/to/program''<br />
<br />
=== 安装 Microsoft Office ===<br />
<br />
更新(2013年4月9日):对于 Wine 1.5.27,下面所述的步骤已经不必要了。先安装 winbind(包含在 {{pkg|samba}} 中),然后执行: <br />
<br />
$ export WINEPREFIX="<用户家目录中的某一可写目录>" <br />
$ export WINEARCH="win32"<br />
$ wine /到/office安装盘/的路径/setup.exe<br />
<br />
可以把上述 export 语句加入 bashrc 文件。<br />
<br />
安装结束后,打开 Word 或 Excel,联网激活。完成后,关闭程序,执行 '''winecfg''',在“函数库”选项卡中把 riched20 设置为“Native (Windows)”。这样 PowerPoint 就可以正常工作。<br />
(使用 Office Home/Student 2010 和 wine 1.5.27 测试。在线激活有效)<br />
<br />
安装Office套装前,需要先安装某些Windows组件:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=/path/to/wineprefix winecfg<br />
# pacman -S winetricks<br />
$ winetricks msxml3 # For MS Office 2007<br />
$ winetricks msxml3 msxml6 # For MS Office 2010<br />
$ wine /path/to/office_cd/setup.exe<br />
<br />
更多信息,参见[https://appdb.winehq.org/appview.php?iVersionId=4992 WineHQ上的文章]。<br />
<br />
{{注意|{{Pkg|playonlinux}} 提供了一个自定义安装脚本,简化了 Office 2003、2007 和 2010 的安装。您只需提供 setup.exe 或 ISO 文件,这个脚本就可以指导您完成安装,完全不需要自己设置 Wine。}}<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). CDEmu will handle it correctly.<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== OpenGL 模式 ===<br />
<br />
很多游戏(比如魔兽争霸啦)都支持OpenGL模式,在Wine下''可能''比默认DirectX模式性能更好。一般添加{{Ic|-opengl}}启动程序即可,但''不同程序可能有所不同'':<br />
$ wine /path/to/3d_game.exe -opengl<br />
<br />
请参考[https://appdb.winehq.org AppDB],了解特定程序的相关信息。<br />
<br />
=== 将 Wine 作为 Win16/Win32 程序的解释器 ===<br />
<br />
通知内核识别和执行 Win16/Win32 程序的方式:<br />
echo ':DOSWin:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register<br />
To make the setting permanent, create a configuration file in {{ic|/etc/binfmt.d}} with the following contents:<br />
测试效果,若一切正常,可以使该设置永久生效。在 {{ic|/etc/binfmt.d}} 目录创建新的配置文件,内容为:<br />
{{hc|/etc/tmpfiles.d/wine.conf|<br />
:DOSWin:M::MZ::/usr/bin/wine:}}<br />
<br />
说明一下,和 initscripts 不同,systemd 会自动挂载 {{ic|/proc/sys/fs/binfmt_misc}},所以只需要通过临时文件机制向内核写入配置即可。<br />
<br />
更多信息,参见 [[Systemd (简体中文)#临时文件]]。<br />
<br />
现在,直接运行Windows程序试试:<br />
chmod 755 exefile.exe<br />
./exefile.exe<br />
<br />
=== Wine 控制台 ===<br />
<br />
有些时候,可能需要运行{{ic|.exe}}给游戏打补丁,比如给古董游戏添加宽屏支持。这时直接通过Wine运行可能没有用。那么,打开终端,运行一下命令:<br />
<br />
$ wineconsole cmd<br />
<br />
将进入一个和Windows下cmd一样的命令行环境。在该环境下试试也许就可以了。<br />
<br />
=== Winetricks ===<br />
<br />
使用[https://wiki.winehq.org/winetricks Winetricks]快速脚本,能够方便地安装许多Windows组件,包括DirectX、msxml(被Office 2007、IE浏览器依赖)visual运行库还有其他更多的。<br />
<br />
您可以使用[[pacman (简体中文)|pacman]]或者从[[AUR (简体中文)|AUR]]上获取{{AUR|winetricks-git}}软件包来安装该工具:<br />
<br />
运行:<br />
<br />
$ winetricks<br />
<br />
=== 安装 .NET framework 4.0 ===<br />
<br />
如果您是64位的系统,首先为Wine创建一个新的32位环境变量:<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
然后使用winetricks安装以下包:<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winetricks -q msxml3 dotnet40 corefonts<br />
<br />
=== Crackling sound when using PulseAudio ===<br />
<br />
If you experience crackling sound in Wine applications when PulseAudio is in use, edit the file {{ic|/etc/pulse/daemon.conf}} by uncommenting the line {{ic|; default-fragment-size-msec &#61; 25}} and setting the value to {{ic|5}} such that it looks like this:<br />
<br />
default-fragment-size-msec = 5<br />
<br />
See [https://wiki.winehq.org/FAQ#head-58290651b9f85c059a8bfc98118a0262e2cca84b here] for further information.<br />
<br />
=== 16 Bit Programs ===<br />
<br />
Upon running older Windows 9x programs, the following error may be encountered:<br />
<br />
modify_ldt: Invalid argument<br />
err:winediag:build_module Failed to create module for "krnl386.exe",<br />
16-bit LDT support may be missing.<br />
err:module:attach_process_dlls "krnl386.exe16" failed to initialize,<br />
aborting<br />
<br />
In this case, running the following may fix it:<br />
<br />
echo 1 > /proc/sys/abi/ldt16<br />
<br />
Source: [https://www.spinics.net/linux/fedora/fedora-users/msg450821.html Fedora Mailing List]<br />
<br />
=== 解决中文乱码 ===<br />
<br />
中文乱码解决,新建一个reg文件(例如 zh.reg)添加如下内容:<br />
<br />
REGEDIT4<br />
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink]<br />
"Lucida Sans Unicode"="wqy-microhei.ttc"<br />
"Microsoft Sans Serif"="wqy-microhei.ttc"<br />
"Microsoft YaHei"="wqy-microhei.ttc"<br />
"微软雅黑"="wqy-microhei.ttc"<br />
"MS Sans Serif"="wqy-microhei.ttc"<br />
"Tahoma"="wqy-microhei.ttc" <br />
"Tahoma Bold"="wqy-microhei.ttc"<br />
"SimSun"="wqy-microhei.ttc"<br />
"Arial"="wqy-microhei.ttc"<br />
"Arial Black"="wqy-microhei.ttc"<br />
"宋体"="wqy-microhei.ttc"<br />
"新細明體"="wqy-microhei.ttc"<br />
<br />
{{提示|这里以文泉驿微米黑为例,如果使用其他字体,请到/usr/share/fonts目录下找到该字体的完整名称,例如使用adobe source hans 中号字体,将上面的wqy-microhei.ttc改为SourceHanSansCN-Medium.otf。}}<br />
<br />
然后打开注册表编辑器:<br />
wine regedit<br />
在注册表编辑器界面选择“注册表”--“导入”,导入该wine-fonts.reg文件即可。<br />
或者直接运行:<br />
<br />
$regedit zh.reg<br />
<br />
更多信息参考[http://linux-wiki.cn/wiki/Wine%E7%9A%84%E4%B8%AD%E6%96%87%E6%98%BE%E7%A4%BA%E4%B8%8E%E5%AD%97%E4%BD%93%E8%AE%BE%E7%BD%AE Wine的中文显示与字体设置]<br />
<br />
=== 解决中文看起来脏 ===<br />
<br />
新建一个 {{ic|tmp.reg}} 文件,添加如下内容:<br />
<br />
{{hc|tmp.reg|2=<br />
REGEDIT4<br />
[HKEY_CURRENT_USER\Software\Wine\Fonts\Replacements]<br />
"DFKai-SB"="adobe-source-han-serif"<br />
"FangSong"="adobe-source-han-serif"<br />
"KaiTi"="adobe-source-han-serif"<br />
"Microsoft JhengHei"="adobe-source-han-serif"<br />
"Microsoft YaHei"="adobe-source-han-serif"<br />
"MingLiU"="adobe-source-han-serif"<br />
"NSimSun"="adobe-source-han-serif"<br />
"PMingLiU"="adobe-source-han-serif"<br />
"SimHei"="adobe-source-han-serif"<br />
"SimKai"="adobe-source-han-serif"<br />
"SimSun"="adobe-source-han-serif"<br />
<br />
REGEDIT4<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideAntiAliasWithCore"="N"<br />
"ClientSideAntiAliasWithRender"="N"<br />
"ClientSideWithRender"="N"<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
"FontSmoothingOrientation"=dword:00000001<br />
}}<br />
<br />
{{提示|这里以思源宋体为例,如果使用其他字体,请到 {{ic|/usr/share/fonts}} 目录下找到该字体的完整名称。}}<br />
<br />
保存后在终端输入 {{ic|wine regedit}},然后在注册表编辑器界面选择“注册表”--“导入”,导入该 {{ic|tmp.reg}} 文件即可。<br />
<br />
或者直接输入:<br />
<br />
$ regedit tmp.reg<br />
<br />
{{提示|此外,使用 {{ic|winecfg}} 命令更改 wine 的 dpi 也能让字体显示更好看,但是注意不要太高,否则可能不得不重新调整。}}<br />
<br />
== 第三方工具 ==<br />
<br />
这些程序有其自己的主页和支持论坛。<br />
<br />
=== CrossOver ===<br />
<br />
[https://www.codeweavers.com/about/ CrossOver] 有单独的[[CrossOver|wiki 页面]].<br />
<br />
=== PlayOnLinux/PlayOnMac ===<br />
<br />
[https://www.playonlinux.com/ PlayOnLinux]是一个图形界面的Windows/DOS程序管理器。它提供了一些帮助配置/运行程序的脚本,能够管理多个不同版本的Wine,甚至能对不同程序使用不同Wine版本。参考[https://appdb.winehq.org AppDB],看看哪个Wine版本对你要运行的程序兼容最好。从[[AUR (简体中文)|AUR]]安装{{Pkg|playonlinux}}。<br />
<br />
=== PyWinery ===<br />
<br />
[https://code.google.com/p/pywinery/ PyWinery]是一个简单的、图形界面的Wine系统目录管理器,用它可以方便地管理不同系统目录,并从不同系统目录运行程序。同时可以开启winetricks在同一系统目录,打开系统目录所在文件夹, {{ic|winecfg}}, 软件卸载程序和wineDOS。[[AUR (简体中文)|AUR]]中提供了软件包{{AUR|pywinery}}。当你使用很多系统目录(一个打游戏用、一个编程用……)时,这个程序会非常有用。<br />
<br />
它在默认情况下使用winetricks打开{{ic|.exe}}文件,所以你可以选择你有的任何Wine的配置。<br />
<br />
=== Q4wine ===<br />
<br />
[https://q4wine.brezblock.org.ua/ Q4Wine] 是一个图形界面的系统目录(wine-prefix)管理器。它的特色是可以把 QT 主题导入 Wine 配置,使两者完美整合。{{AUR|q4wine}} 软件包在 <nowiki>[</nowiki>[[multilib]]] 仓库中提供。<br />
<br />
== 相关链接 ==<br />
<br />
* [http://www.winehq.com/ Wine官方网站]<br />
* [https://appdb.winehq.org/ Wine程序数据库]<br />
* [https://linuxgamingtoday.wordpress.com/2008/02/16/quick-tips-to-speed-up-your-gaming-in-wine/ 加速Wine,显卡及OpenGL高级配置]<br />
* [http://wiki.gotux.net/code:perl:fileinfo FileInfo]{{Dead link (简体中文)|2020|08|06|status=domain name not resolved}} —— Find Win32 PE/COFF headers in EXE/DLL/OCX files under linux/unix environment</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=User_talk:Erus_Iluvatar&diff=713046User talk:Erus Iluvatar2022-01-23T14:57:58Z<p>InsaneGuo: /* Wine in Simplified Chinese */</p>
<hr />
<div>== [[Wine_(简体中文)|Wine]] in Simplified Chinese ==<br />
Although this page has not been updated for a long time, it still has reference value for users who use Chinese. Please don't delete it arbitrarily![[User:InsaneGuo|InsaneGuo]] ([[User talk:InsaneGuo|talk]]) 14:57, 23 January 2022 (UTC)</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=User_talk:Erus_Iluvatar&diff=713045User talk:Erus Iluvatar2022-01-23T14:57:45Z<p>InsaneGuo: /* wine in Simplified Chinese */</p>
<hr />
<div>== [[Wine_(简体中文)|Wine]] in Simplified Chinese ==<br />
Although this page has not been updated for a long time, it still has reference value for users who use Chinese. Please don't delete it arbitrarily!</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=User_talk:Erus_Iluvatar&diff=713044User talk:Erus Iluvatar2022-01-23T14:56:14Z<p>InsaneGuo: Created page with "== wine in Simplified Chinese == Although this page has not been updated for a long time, it still has reference value for users who use Chinese. Please don't delete it arbitrarily!"</p>
<hr />
<div>== wine in Simplified Chinese ==<br />
Although this page has not been updated for a long time, it still has reference value for users who use Chinese. Please don't delete it arbitrarily!</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=713043Wine (简体中文)2022-01-23T14:50:47Z<p>InsaneGuo: Undo revision 712421 by Erus Iluvatar (talk)</p>
<hr />
<div>[[Category:Wine (简体中文)]]<br />
[[de:Wine]]<br />
[[en:Wine]]<br />
[[es:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
{{TranslationStatus (简体中文)|Wine|2015-08-5|389504}}<br />
{{Bad translation (简体中文)|Very out of sync with English page}}<br />
<br />
{{Related articles start (简体中文)}}<br />
{{Related|Steam}}<br />
{{Related|CrossOver}}<br />
{{Related articles end}}<br />
[[Wikipedia:Wine (software)|Wine]] 是类UNIX系统下运行微软Windows程序的"兼容层"。在Wine中运行的Windows程序,就如同运行原生Linux程序一样,不会有模拟器那样的性能问题。<br />
<br />
获取更详细的介绍请浏览[https://www.winehq.org/ 项目官方网站]和[https://wiki.winehq.org/ wiki]页面。<br />
<br />
{{警告|如果您的账户能浏览某些文件或资源,Wine运行的程序也可以。Wine不是[[wikipedia:Sandbox (computer security)|沙箱]]。如果很重视安全,请考虑使用[[wikipedia:Virtualization|虚拟化]]。}}<br />
<br />
== 安装 ==<br />
<br />
Wine可通过开启[[Multilib]]仓库来安装{{Pkg|wine}}(稳定版本)or{{Pkg|wine-staging}}(测试版本)。[https://www.wine-staging.com/ Wine-Staging]包括目前上游未采纳的补丁,专门为wine开发者在向上游打补丁前测试。<br />
<br />
另外,您可能需要安装 {{pkg|wine-gecko}} 和 {{pkg|wine-mono}} 软件包。它们分别用于运行依赖于 Internet Explorer 和 .NET 的程序。不过,也可以随后通过 Wine 在需要时下载安装这些组件。但如果提前下载安装,您就可以离线使用它们,而且 Wine 不必为了每一个 WINEPREFIX 都单独下载。<br />
<br />
'''平台差异'''<br />
<br />
默认的Wine是32位的程序,也是i686的Arch软件包。所以它不能运行64位的Windows程序(反正是罕见的)。<br />
<br />
然而,x86_64的Wine软件包目前以{{ic| --enable-win64}}方式编译。这个参数激活了[[Wikipedia:WoW64|WoW64]]的Wine版本。<br />
<br />
*在Windows中,这个复杂的子系统允许用户同时使用32位和64位的Windows程序,甚至是在同一目录。<br />
<br />
*在Wine中,用户将必须建立单独分开的目录/前缀。这项Wine功能仍是试验阶段,并建议用户使用一个win32{{ic|WINEPREFIX}}。浏览[http://wiki.winehq.org/Wine64 Wine64]{{Dead link (简体中文)|2020|08|06|status=404}}以获取有关这个的详细信息。<br />
<br />
总结一下,配置{{ic|1=WINEARCH=win32}}后,x86_64平台的Arch和i686平台的Arch完全相同。<br />
<br />
{{注意|如果在64位环境中执行{{ic|winetricks}}或其它程序出现问题,请试试创建一个新的32位{{ic|WINEPREFIX}}. 参见下面的[[#WINEARCH]]}}<br />
<br />
== 配置 ==<br />
<br />
配置Wine的方式通常有:<br />
* [https://wiki.winehq.org/winecfg winecfg]是Wine的图形界面配置程序。控制台下调用{{ic|$ winecfg}}(或指定系统目录:{{ic|1=$ WINEPREFIX=~/.系统目录 winecfg}})即可启动<br />
* [https://wiki.winehq.org/control control.exe]是Windows控制面板的Wine实现,通过{{ic|$ wine control}}命令启动<br />
* [https://wiki.winehq.org/regedit regedit]是Wine的注册表编辑器,比较前两者,该工具能配置更多东西。部分常用键值参见:[https://wiki.winehq.org/UsefulRegistryKeys WineHQ's article on Useful Registry Keys]<br />
<br />
=== WINEPREFIX ===<br />
<br />
Wine默认将配置文件和安装的Windows程序保存在{{ic|~/.wine}}。这样的目录称为一个"Wine prefix"或"Wine bottle"(保留原文,下文称“系统目录”)。每次运行Windows程序(包括内置程序,如{{ic|winecfg}})时,系统目录会自动创建(如果缺失)或更新。系统目录中存放有相当于Windows下{{ic | C:\}}C盘(更确切的说应是系统盘)的文件夹。<br />
<br />
通过设置{{ic|WINEPREFIX}}环境变量,可以更改Wine系统目录的位置。如果希望让不同的Windows程序使用不同的系统环境或配置,这一变量会非常有用。<br />
<br />
例如,如果您使用 <br />
{{ic |1= $ env WINEPREFIX=~/.win-a wine-A程序.exe}}参数来运行一个程序。另一个使用<br />
{{ic |1= $ env WINEPREFIX=~/.win-b wine-B程序.exe}}参数,这两个程序将使用独立的C盘和注册表配置。<br />
<br />
以下命令会建立一个默认的系统目录,且不启动任何Windows程序:<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
对于64位用户,如果使用[multilib]仓库里的Wine,默认创建的系统目录是64位环境的。若想使用纯32位环境,修改{{ic|WINEARCH}} 变量win32为即可:<br />
{{ic |1=$ WINEARCH=win32 winecfg}}这样就会生成32位Wine环境。若不设置{{ic|WINEARCH}}得到的就是64位环境。<br />
<br />
通过{{ic|WINEPREFIX}}变量,在不同的系统目录分别创建32位和64位环境:<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg <br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
{{注意|系统目录创建过程中,64位版本的wine将视全部目录如同64位系统目录,也将不会在已存在的目录中创建任何32位的.创建32位系统目录,您必须让Wine创建指定的{{ic|WINEPREFIX}}目录。}}<br />
<br />
winetricks也接受{{ic|WINEPREFIX}}变量,以安装Steam为例:<br />
env WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
To have them permanently defined for [[Bash#Shell and environment variables|bash configuration ~/.bashrc]] do:<br />
<br />
export WINEPREFIX=$HOME/.config/wine/<br />
export WINEARCH=win32<br />
{{小贴士|编辑 [[Bash_(简体中文)#配置文件|~/.bashrc]],使得 WINEPREFIX 和 WINEARCH 永久生效。}}<br />
{{注意|不必手动在 {{ic|wineprefixes}} 文件夹下建立 steam 文件夹,Wine会自动创建不存在的系统目录。}}<br />
<br />
=== 图形驱动 ===<br />
<br />
你需要安装32位的显卡驱动。请安装[[Xorg (简体中文)#驱动安装]]的表格中 ''OpenGL (multilib)'' 列所写的驱动<br />
<br />
缺少或未能正确配置驱动的一个标志是 Wine 在终端窗口里报告如下内容:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{注意|在安装对应的库以后,你可能需要重启 X}}<br />
<br />
=== 声音 ===<br />
<br />
Wine程序有可能遇到某些声音问题。首先,确保{{ic|winecfg}}中只启用了一种声卡驱动。目前,Wine对[[Alsa (简体中文)|Alsa]]的支持最好。<br />
<br />
x86_64平台下使用[[Alsa (简体中文)|Alsa]]的话,需要安装{{Pkg|lib32-alsa-lib}}。如果还要使用PulseAudio,则需安装{{Pkg|lib32-libpulse}}。<br />
<br />
若使用[[OSS (简体中文)|OSS]],需要安装{{Pkg|lib32-alsa-oss}}。仅靠内核驱动是不行的。<br />
<br />
安装上述软件包后,若{{ic|winecfg}}'''仍'''无法识别声卡(Selected driver: (none)),请尝试[http://wiki.jswindle.com/index.php/Wine_Registry#Configuring_Sound registry 通过注册表配置]。<br />
<br />
运行使用某些高级声音系统的游戏,可能还需要安装{{Pkg|lib32-openal}}。<br />
<br />
==== MIDI 支持 ====<br />
<br />
[[MIDI]] 是九十年代非常流行的游戏声音系统。如果你尝试运行老一点的游戏,音乐无法开箱即用的情况并不罕见。<br />
Wine 拥有非常优秀的 MIDI 支持。但是首先你需要确保 Wine 会使用正确的 MIDI 输出。详细设置参考 [https://wiki.winehq.org/MIDI Wine Wiki]<br />
<br />
=== 其他函数库 ===<br />
<br />
*某些程序(如 Office 2003)需要解析HTML、XML(使用MSXML库),需要安装{{Pkg|lib32-libxml2}}。<br />
<br />
*播放音频的程序可能依赖{{Pkg|lib32-mpg123}}。<br />
<br />
*使用色彩管理引擎的一些应用 (例如: PDF查看器, 图片查看器, etc) may require {{Pkg|lib32-lcms2}}.<br />
<br />
*对于使用图像处理库的程序,可能依赖{{Pkg|lib32-giflib}}和{{Pkg|lib32-libpng}},<br />
<br />
*x86_64的加密支持需要{{Pkg|lib32-gnutls}}软件包。<br />
<br />
=== 字体 ===<br />
<br />
如果没有安装微软Truetype字体,Wine程序的字体显示可能会一团糟,参见[[MS Fonts (简体中文)]]。如果还是不行,试试{{ic|winetricks allfonts}}。<br />
<br />
上述操作后,杀死wine相关进程再运行{{ic|winecfg}},字体应该变好看了。<br />
<br />
如果字体看起来很毛糙,试试用[https://wiki.winehq.org/regedit regedit]导入下列文本文件:<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
{{提示|高分辨率显示器,可在winecfg的显示选项卡中适当dpi的值,例如缩放150%,将dpi设置为144。}}<br />
参阅 [[Font configuration#Applications without fontconfig support]].<br />
<br />
=== 启动器和菜单 ===<br />
<br />
Wine不会为内置程序(如{{ic|winecfg}}、{{ic|winebrowser}})创建桌面启动器和菜单项。但手动安装的Windows程序通常会自动创建启动器和菜单项。在Windows下,安装程序(如{{ic|setup.exe}})通常会在桌面和开始菜单建立快捷方式,而Wine下会创建遵循freedesktop.org规范的.desktop文件(即启动器,相当于快捷方式)。<br />
<br />
{{小贴士|如果启动器''没有''自动创建,或者这些文件丢失了,可以尝试使用[https://wiki.winehq.org/winemenubuilder winemenubuilder]修复。}}<br />
<br />
Ubuntu下,Wine项目以子菜单形式出现在系统菜单。以下步骤将实现这个效果:<br />
<br />
==== 创建菜单项 ====<br />
<br />
首先,用Wine安装一个Windows程序,以建立基本的菜单。完成后,向其中添加菜单项。桌面右键选择{{ic|"创建启动器..."}}(不同桌面环境操作有所差异),设置如下:<br />
'''类型(Type)''': 应用程序(Application)<br />
'''名称(Name)''': 配置<br />
'''命令(Command)''': winecfg<br />
'''备注(Comment)''': Wine配置工具<br />
<br />
'''类型''': 应用程序<br />
'''名称''': 卸载程序<br />
'''命令''': wine uninstaller<br />
'''备注''': 卸载Wine下的Windows程序<br />
<br />
'''类型''': 应用程序<br />
'''名称''': 浏览 C:\<br />
'''命令''': wine winebrowser c:\\<br />
'''备注''': 浏览Wine中虚拟的C盘<br />
现在,桌面上出现了三个启动器,下面将把它们移入菜单。不过首先,我们给这些启动器加上动态图标(由图标主题提供)。方法是,用文本编辑器打开启动器,编辑Icon项目:<br />
<br />
{{ic|配置}} 启动器:<br />
Icon=wine-winecfg<br />
{{ic|卸载程序}} 启动器:<br />
Icon=wine-uninstaller<br />
{{ic|浏览 C:\}} 启动器:<br />
Icon=wine-winefile<br />
{{小贴士|多数桌面环境在上述“创建启动器”步骤即可设置图标。以第一个启动器为例,在选择图标窗口中搜索wine-winecfg,选择即可,无需手动编辑。 ——译者注}}<br />
如果图标无法显示或者你觉得很丑陋,换成其他图标也可以。右键设置启动器,应该有更改图标的地方。很多图标主题,例如[https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors],都提供这些图标。<br />
<br />
现在,将启动器移入菜单。把启动器复制到 {{ic|~/.local/share/applications/wine/}} 目录即可。<br />
<br />
诶?图标还没出现在菜单中!还剩下最后一步,创建下列文本文件:<br />
{{hc|~/.config/menus/applications-merged/wine-utilities.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Filename>wine-Configuration.desktop</Filename><br />
</Include><br />
<Include><br />
<Filename>wine-Browse C:\.desktop</Filename><br />
</Include><br />
<Include><br />
<Filename>wine-Uninstall Programs.desktop</Filename><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
再看看菜单,应该万事大吉了。<br />
<br />
==== Gnome3 中清理 Wine 菜单启动项 ====<br />
<br />
系统全局的菜单启动器安装在 {{ic|/usr/share/applications/}},清除相应程序的“.desktop”文件即可从整个系统删除该启动器。<br />
<br />
如果这样还是无法解决问题,那么很可能 Wine 的启动器存放在用户级别的 {{ic|~/.local/share/applications/wine/Programs/}} 目录中。删除相应的“.desktop”文件即可清理对应启动项。删除整个 Programs 文件夹将清理所有 Wine 程序的启动项。<br />
<br />
==== 修复 KDE 4 菜单问题 ====<br />
<br />
Wine菜单项有可能[https://bugs.launchpad.net/ubuntu/+source/wine/+bug/263041 错误地出现]在{{ic|"Lost & Found(其他)"}} ,而非Wine子菜单。原因是kde-applications.menu文件缺失{{ic|MergeDir}}配置。<br />
<br />
编辑{{ic|/etc/xdg/menus/kde-applications.menu}}。<br />
<br />
在文件末尾处,{{ic|<DefaultMergeDirs/>}}后添加{{ic|<MergeDir>applications-merged</MergeDir>}}。修改后内容大致如下:<br />
<Menu><br />
<Include><br />
<And><br />
<Category>KDE</Category><br />
<Category>Core</Category><br />
</And><br />
</Include><br />
<DefaultMergeDirs/><br />
'''<MergeDir>applications-merged</MergeDir>'''<br />
<MergeFile>applications-kmenuedit.menu</MergeFile><br />
</Menu><br />
<br />
另一个方法是:<br />
ln -s ~/.config/menus/applications-merged ~/.config/menus/kde-applications-merged<br />
<br />
这样的好处是,不会因为KDE升级而重置配置。但该方法只对一个用户有效。<br />
<br />
==== 外观 ====<br />
<br />
XP外观主题可以从[https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 这里]下载,安装请看[https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files 这里],最后使用''winecfg''选择主题。<br />
Wine staging 的用户可能想要允许''winecfg'' Staging部分的''Enable GTK3 Theming''选项使得主题能够与当前GTK主题相匹配。<br />
<br />
==== 打印 ====<br />
<br />
为了能够在''win32 prefixes''中使用打印机,请安装{{Pkg|lib32-libcups}},重启wine和运行在wine上的程序。<br />
<br />
==== 网络 ====<br />
<br />
wine安装之后,需要安装{{pkg|lib32-gnutls}}以使wine中的程序使用TLS、HTTPS安全连接。<br />
对于ICMP数据包,wine的网络需要[https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
如果执行后出现错误,通过以下方式移除:<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== 运行 Windows 程序 ==<br />
<br />
{{警告|千万不要以root身份运行Wine!详情参见[https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F 本文]。}}<br />
运行Windows程序:<br />
$ wine <exe文件><br />
<br />
内置的msiexec程序可以运行MSI安装包:<br />
$ msiexec /i ''path_to_msi''<br />
<br />
== 技巧和技巧 ==<br />
<br />
{{小贴士|此外您可能会感兴趣以下文章的开始所提供的链接<br />
* [https://appdb.winehq.org/ Wine程序数据库 (Wine Application Database, AppDB)] —— 特定Windows程序的Wine兼容情况(运行时的已知问题、用户评分、指南等等)<br />
* [https://forum.winehq.org/ WineHQ论坛] —— 要是看完上述网页还有问题,可以到这里咨询<br />
}}<br />
<br />
这里介绍一些安装Windows组件的工具。由于这些工具可能严重破坏Wine配置,没有需要时最好不要使用。<br />
<br />
=== 取消注册Wine文件关联 ===<br />
<br />
在默认情况下,Wine接管了许多扩展名. 一些扩展名 {例如 {{ic|.vbs}} 或者 {{ic|.chm}}) 是Windows专用, 用Wine打开这些程序是很方便的. 但是, 有一些其他格式 (例如 {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) 在Wine中用 {{ic|Internet Explorer}} 和 {{ic|Windows记事本}} 打开会出错 .<br />
<br />
Wine的文件关联设置在 {{ic|~/.local/share/applications/}} 像 {{ic|wine-extension-{extension}.desktop}} 这样的文件中. 删除与要取消注册的扩展名相对应的文件. 或者像这样删除所有的扩展名:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
=== exe-thumbnailer ===<br />
<br />
This is a small piece of UI code meant to be installed with (or even before) Wine. It provides thumbnails for executable files that show the embedded icons when available, and also gives the user a hint that Wine will be used to open it. Details can be found [https://github.com/exe-thumbnailer/exe-thumbnailer here]. Install it with the {{AUR|exe-thumbnailer}} package.<br />
<br />
=== CSMT patch ===<br />
<br />
{{Out of date|See wine-staging below}}<br />
Currently [https://www.winehq.org/pipermail/wine-devel/2013-September/101106.html wine developers] experiment with stream/worker thread optimizations for Wine. You may experience an enormous performance improvement by using this experimental patched Wine versions. Many games may run as fast as on Windows or even faster. This Wine patch is is known as CSMT patch and works with NVidia and AMD graphics cards.<br />
<br />
{{Note (简体中文)|This is ''still experimental code'', therefore, it may not work as expected. Please, report your experiences to the developers for helping with development of those patches.}}<br />
<br />
The easy way is to install {{Pkg|playonlinux}}. Then install your game and activate the Wine version ''1.7.4-CSMT'' from the {{ic|Tools}} → {{ic|Manage Wine Versions}} menu in PlayOnLinux. For now it is recommended to use the patched Wine version ''1.7.4-CSMT''.<br />
<br />
Open your game's configuration settings and copy the following settings to the {{ic|Miscellaneous}}/{{ic|Command to exec before running the program}} section of your game configuration settings:<br />
<br />
export WINEDEBUG=-all<br />
export LD_PRELOAD="libpthread.so.0 libGL.so.1"<br />
export __GL_THREADED_OPTIMIZATIONS=0<br />
export __GL_SYNC_TO_VBLANK=1<br />
export __GL_YIELD="NOTHING"<br />
export CSMT=enabled<br />
<br />
Make sure you have disabled {{ic|StrictDrawOrdering}} from {{ic|Tools}} → {{ic|General}}.<br />
<br />
=== CSMT via wine-staging ===<br />
<br />
[https://www.wine-staging.com/ Wine-staging] includes CSMT support, and can be installed with the {{Pkg|wine-staging}} package, or directly via the wine-staging [https://github.com/wine-compholio/wine-staging/wiki/Installation#-arch-linux Arch Linux repo].<br />
<br />
CSMT support needs to be enabled before it can be used, instructions can be found [https://github.com/wine-compholio/wine-staging/wiki/CSMT#enabledisable-csmt here], no further configuration is needed.<br />
<br />
==== Further Information ====<br />
<br />
[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion] with the CSMT developer Stefan Dösinger<br />
<br />
[https://web.archive.org/web/20150908000147/http://wiki.winehq.org/FOSDEM2014?action=AttachFile&do=get&target=d3d-drivers.odp FOSDEM2014 CSMT presentation] of CSMT with benchmarks<br />
<br />
[https://www.youtube.com/playlist?list=PL0P2a_sII2eTd8uq-azTNpQjiFLqBhDjg Here] you find some game videos running with CSMT enabled<br />
<br />
=== Changing the language ===<br />
<br />
Some programs may not offer a language selection, they will guess the desired language upon the sytem locales. Wine will transfer the current environment (including the locales) to the application, so it should work out of the box. If you want to force a program to run in a specific locale (which is fully [[Locale|generated]] on your system), you can call Wine with the following setting:<br />
<br />
LC_ALL=''xx_XX.encoding'' wine ''/path/to/program''<br />
<br />
For instance<br />
<br />
LC_ALL=it_IT.UTF-8 wine ''/path/to/program''<br />
<br />
=== 安装 Microsoft Office ===<br />
<br />
更新(2013年4月9日):对于 Wine 1.5.27,下面所述的步骤已经不必要了。先安装 winbind(包含在 {{pkg|samba}} 中),然后执行: <br />
<br />
$ export WINEPREFIX="<用户家目录中的某一可写目录>" <br />
$ export WINEARCH="win32"<br />
$ wine /到/office安装盘/的路径/setup.exe<br />
<br />
可以把上述 export 语句加入 bashrc 文件。<br />
<br />
安装结束后,打开 Word 或 Excel,联网激活。完成后,关闭程序,执行 '''winecfg''',在“函数库”选项卡中把 riched20 设置为“Native (Windows)”。这样 PowerPoint 就可以正常工作。<br />
(使用 Office Home/Student 2010 和 wine 1.5.27 测试。在线激活有效)<br />
<br />
安装Office套装前,需要先安装某些Windows组件:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=/path/to/wineprefix winecfg<br />
# pacman -S winetricks<br />
$ winetricks msxml3 # For MS Office 2007<br />
$ winetricks msxml3 msxml6 # For MS Office 2010<br />
$ wine /path/to/office_cd/setup.exe<br />
<br />
更多信息,参见[https://appdb.winehq.org/appview.php?iVersionId=4992 WineHQ上的文章]。<br />
<br />
{{注意|{{Pkg|playonlinux}} 提供了一个自定义安装脚本,简化了 Office 2003、2007 和 2010 的安装。您只需提供 setup.exe 或 ISO 文件,这个脚本就可以指导您完成安装,完全不需要自己设置 Wine。}}<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). CDEmu will handle it correctly.<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== OpenGL 模式 ===<br />
<br />
很多游戏(比如魔兽争霸啦)都支持OpenGL模式,在Wine下''可能''比默认DirectX模式性能更好。一般添加{{Ic|-opengl}}启动程序即可,但''不同程序可能有所不同'':<br />
$ wine /path/to/3d_game.exe -opengl<br />
<br />
请参考[https://appdb.winehq.org AppDB],了解特定程序的相关信息。<br />
<br />
=== 将 Wine 作为 Win16/Win32 程序的解释器 ===<br />
<br />
通知内核识别和执行 Win16/Win32 程序的方式:<br />
echo ':DOSWin:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register<br />
To make the setting permanent, create a configuration file in {{ic|/etc/binfmt.d}} with the following contents:<br />
测试效果,若一切正常,可以使该设置永久生效。在 {{ic|/etc/binfmt.d}} 目录创建新的配置文件,内容为:<br />
{{hc|/etc/tmpfiles.d/wine.conf|<br />
:DOSWin:M::MZ::/usr/bin/wine:}}<br />
<br />
说明一下,和 initscripts 不同,systemd 会自动挂载 {{ic|/proc/sys/fs/binfmt_misc}},所以只需要通过临时文件机制向内核写入配置即可。<br />
<br />
更多信息,参见 [[Systemd (简体中文)#临时文件]]。<br />
<br />
现在,直接运行Windows程序试试:<br />
chmod 755 exefile.exe<br />
./exefile.exe<br />
<br />
=== Wine 控制台 ===<br />
<br />
有些时候,可能需要运行{{ic|.exe}}给游戏打补丁,比如给古董游戏添加宽屏支持。这时直接通过Wine运行可能没有用。那么,打开终端,运行一下命令:<br />
<br />
$ wineconsole cmd<br />
<br />
将进入一个和Windows下cmd一样的命令行环境。在该环境下试试也许就可以了。<br />
<br />
=== Winetricks ===<br />
<br />
使用[https://wiki.winehq.org/winetricks Winetricks]快速脚本,能够方便地安装许多Windows组件,包括DirectX、msxml(被Office 2007、IE浏览器依赖)visual运行库还有其他更多的。<br />
<br />
您可以使用[[pacman (简体中文)|pacman]]或者从[[AUR (简体中文)|AUR]]上获取{{AUR|winetricks-git}}软件包来安装该工具:<br />
<br />
运行:<br />
<br />
$ winetricks<br />
<br />
=== 安装 .NET framework 4.0 ===<br />
<br />
如果您是64位的系统,首先为Wine创建一个新的32位环境变量:<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
然后使用winetricks安装以下包:<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winetricks -q msxml3 dotnet40 corefonts<br />
<br />
=== Crackling sound when using PulseAudio ===<br />
<br />
If you experience crackling sound in Wine applications when PulseAudio is in use, edit the file {{ic|/etc/pulse/daemon.conf}} by uncommenting the line {{ic|; default-fragment-size-msec &#61; 25}} and setting the value to {{ic|5}} such that it looks like this:<br />
<br />
default-fragment-size-msec = 5<br />
<br />
See [https://wiki.winehq.org/FAQ#head-58290651b9f85c059a8bfc98118a0262e2cca84b here] for further information.<br />
<br />
=== 16 Bit Programs ===<br />
<br />
Upon running older Windows 9x programs, the following error may be encountered:<br />
<br />
modify_ldt: Invalid argument<br />
err:winediag:build_module Failed to create module for "krnl386.exe",<br />
16-bit LDT support may be missing.<br />
err:module:attach_process_dlls "krnl386.exe16" failed to initialize,<br />
aborting<br />
<br />
In this case, running the following may fix it:<br />
<br />
echo 1 > /proc/sys/abi/ldt16<br />
<br />
Source: [https://www.spinics.net/linux/fedora/fedora-users/msg450821.html Fedora Mailing List]<br />
<br />
=== 解决中文乱码 ===<br />
<br />
中文乱码解决,新建一个reg文件(例如 zh.reg)添加如下内容:<br />
<br />
REGEDIT4<br />
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink]<br />
"Lucida Sans Unicode"="wqy-microhei.ttc"<br />
"Microsoft Sans Serif"="wqy-microhei.ttc"<br />
"Microsoft YaHei"="wqy-microhei.ttc"<br />
"微软雅黑"="wqy-microhei.ttc"<br />
"MS Sans Serif"="wqy-microhei.ttc"<br />
"Tahoma"="wqy-microhei.ttc" <br />
"Tahoma Bold"="wqy-microhei.ttc"<br />
"SimSun"="wqy-microhei.ttc"<br />
"Arial"="wqy-microhei.ttc"<br />
"Arial Black"="wqy-microhei.ttc"<br />
"宋体"="wqy-microhei.ttc"<br />
"新細明體"="wqy-microhei.ttc"<br />
<br />
{{提示|这里以文泉驿微米黑为例,如果使用其他字体,请到/usr/share/fonts目录下找到该字体的完整名称,例如使用adobe source hans 中号字体,将上面的wqy-microhei.ttc改为SourceHanSansCN-Medium.otf。}}<br />
<br />
然后打开注册表编辑器:<br />
wine regedit<br />
在注册表编辑器界面选择“注册表”--“导入”,导入该wine-fonts.reg文件即可。<br />
或者直接运行:<br />
<br />
$regedit zh.reg<br />
<br />
更多信息参考[http://linux-wiki.cn/wiki/Wine%E7%9A%84%E4%B8%AD%E6%96%87%E6%98%BE%E7%A4%BA%E4%B8%8E%E5%AD%97%E4%BD%93%E8%AE%BE%E7%BD%AE Wine的中文显示与字体设置]<br />
<br />
=== 解决中文看起来脏 ===<br />
<br />
新建一个 {{ic|tmp.reg}} 文件,添加如下内容:<br />
<br />
{{hc|tmp.reg|2=<br />
REGEDIT4<br />
[HKEY_CURRENT_USER\Software\Wine\Fonts\Replacements]<br />
"DFKai-SB"="adobe-source-han-serif"<br />
"FangSong"="adobe-source-han-serif"<br />
"KaiTi"="adobe-source-han-serif"<br />
"Microsoft JhengHei"="adobe-source-han-serif"<br />
"Microsoft YaHei"="adobe-source-han-serif"<br />
"MingLiU"="adobe-source-han-serif"<br />
"NSimSun"="adobe-source-han-serif"<br />
"PMingLiU"="adobe-source-han-serif"<br />
"SimHei"="adobe-source-han-serif"<br />
"SimKai"="adobe-source-han-serif"<br />
"SimSun"="adobe-source-han-serif"<br />
<br />
REGEDIT4<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideAntiAliasWithCore"="N"<br />
"ClientSideAntiAliasWithRender"="N"<br />
"ClientSideWithRender"="N"<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
"FontSmoothingOrientation"=dword:00000001<br />
}}<br />
<br />
{{提示|这里以思源宋体为例,如果使用其他字体,请到 {{ic|/usr/share/fonts}} 目录下找到该字体的完整名称。}}<br />
<br />
保存后在终端输入 {{ic|wine regedit}},然后在注册表编辑器界面选择“注册表”--“导入”,导入该 {{ic|tmp.reg}} 文件即可。<br />
<br />
或者直接输入:<br />
<br />
$ regedit tmp.reg<br />
<br />
{{提示|此外,使用 {{ic|winecfg}} 命令更改 wine 的 dpi 也能让字体显示更好看,但是注意不要太高,否则可能不得不重新调整。}}<br />
<br />
== 第三方工具 ==<br />
<br />
这些程序有其自己的主页和支持论坛。<br />
<br />
=== CrossOver ===<br />
<br />
[https://www.codeweavers.com/about/ CrossOver] 有单独的[[CrossOver|wiki 页面]].<br />
<br />
=== PlayOnLinux/PlayOnMac ===<br />
<br />
[https://www.playonlinux.com/ PlayOnLinux]是一个图形界面的Windows/DOS程序管理器。它提供了一些帮助配置/运行程序的脚本,能够管理多个不同版本的Wine,甚至能对不同程序使用不同Wine版本。参考[https://appdb.winehq.org AppDB],看看哪个Wine版本对你要运行的程序兼容最好。从[[AUR (简体中文)|AUR]]安装{{Pkg|playonlinux}}。<br />
<br />
=== PyWinery ===<br />
<br />
[https://code.google.com/p/pywinery/ PyWinery]是一个简单的、图形界面的Wine系统目录管理器,用它可以方便地管理不同系统目录,并从不同系统目录运行程序。同时可以开启winetricks在同一系统目录,打开系统目录所在文件夹, {{ic|winecfg}}, 软件卸载程序和wineDOS。[[AUR (简体中文)|AUR]]中提供了软件包{{AUR|pywinery}}。当你使用很多系统目录(一个打游戏用、一个编程用……)时,这个程序会非常有用。<br />
<br />
它在默认情况下使用winetricks打开{{ic|.exe}}文件,所以你可以选择你有的任何Wine的配置。<br />
<br />
=== Q4wine ===<br />
<br />
[https://q4wine.brezblock.org.ua/ Q4Wine] 是一个图形界面的系统目录(wine-prefix)管理器。它的特色是可以把 QT 主题导入 Wine 配置,使两者完美整合。{{AUR|q4wine}} 软件包在 <nowiki>[</nowiki>[[multilib]]] 仓库中提供。<br />
<br />
== 相关链接 ==<br />
<br />
* [http://www.winehq.com/ Wine官方网站]<br />
* [https://appdb.winehq.org/ Wine程序数据库]<br />
* [https://linuxgamingtoday.wordpress.com/2008/02/16/quick-tips-to-speed-up-your-gaming-in-wine/ 加速Wine,显卡及OpenGL高级配置]<br />
* [http://wiki.gotux.net/code:perl:fileinfo FileInfo]{{Dead link (简体中文)|2020|08|06|status=domain name not resolved}} —— Find Win32 PE/COFF headers in EXE/DLL/OCX files under linux/unix environment</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=User:InsaneGuo&diff=699249User:InsaneGuo2021-10-16T03:42:50Z<p>InsaneGuo: Created page with "ARCH新手 刚会安装~ 先前使用过较长时间的OPENSUSE和UBUNTU和MANJARO 有一、、linux经验~ 欢迎来我的 [http://https://zh.wikipedia.org/wiki/User:Insa..."</p>
<hr />
<div>ARCH新手 刚会安装~ 先前使用过较长时间的OPENSUSE和UBUNTU和MANJARO 有一、、linux经验~ 欢迎来我的 [http://https://zh.wikipedia.org/wiki/User:InsaneGuo WIKIPEDIA]玩~</div>InsaneGuohttps://wiki.archlinux.org/index.php?title=KDE_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=699246KDE (简体中文)2021-10-16T03:13:15Z<p>InsaneGuo: /* Plasma 桌面 */</p>
<hr />
<div>[[Category:KDE (简体中文)|KDE]]<br />
[[de:KDE]]<br />
[[en:KDE]]<br />
[[es:KDE]]<br />
[[fa:KDE]]<br />
[[fr:KDE]]<br />
[[it:KDE]]<br />
[[ja:KDE]]<br />
[[ko:KDE]]<br />
[[pl:KDE]]<br />
[[pt:KDE]]<br />
[[ru:KDE]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Desktop environment (简体中文)}}<br />
{{Related|Display manager (简体中文)}}<br />
{{Related|Window manager (简体中文)}}<br />
{{Related|Qt (简体中文)}}<br />
{{Related|SDDM (简体中文)}}<br />
{{Related|Dolphin}}<br />
{{Related|KDE Wallet (简体中文)}}<br />
{{Related|KDevelop}}<br />
{{Related|Trinity}}<br />
{{Related|Uniform Look for Qt and GTK Applications (简体中文)}}<br />
{{Related articles end}}<br />
<br />
KDE 是由 Plasma [[desktop environment (简体中文)|桌面环境]]、库、框架 (KDE Frameworks)、和应用组成的软件项目。KDE 上游有一份维护良好的 [https://userbase.kde.org/ UserBase Wiki]。大多数 KDE 应用程序的详细信息都可以在那里找到。<br />
<br />
== 安装 ==<br />
<br />
=== Plasma 桌面 ===<br />
<br />
在安装 Plasma 之前,请确保 [[Xorg (简体中文)|Xorg]] 已经被安装到您的系统中并可以正常工作。<br />
<br />
[[安装]] {{Pkg|plasma-meta}} 元软件包或者 {{Grp|plasma}} 组。<br />
关于 {{Pkg|plasma-meta}} 和 {{Grp|plasma}} 两者的不同请参阅[[Meta package and package group|这里]]。若要最小化安装 Plasma,可以安装 {{Pkg|plasma-desktop}} 包。<br />
<br />
若要为 Plasma 启动 [[Wayland]] 支持,请安装 {{Pkg|plasma-wayland-session}} 软件包。<br />
<br />
=== KDE 应用 ===<br />
<br />
可以通过安装 {{Grp|kde-applications}} 组或者 {{Pkg|kde-applications-meta}} 元软件包,从而安装 KDE 的全套应用。请注意这仅仅安装应用程序,并不会安装 Plasma 桌面。<br />
<br />
=== 不稳定版 ===<br />
<br />
参阅 [[Official repositories#kde-unstable]](英文)。<br />
<br />
== 启动 Plasma ==<br />
<br />
{{注意|虽然可以使用 [[Wayland (简体中文)|Wayland]] 启动 Plasma,但 Plasma 仍存在一些缺失的功能和已知问题。问题清单详见 [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers],当前开发状况详见 [https://phabricator.kde.org/project/board/99/ Plasma on Wayland workboard(英文)]。使用 [[Xorg (简体中文)|Xorg]] 以获得最完整和稳定的体验。}}<br />
<br />
Plasma 可以通过[[display manager (简体中文)|显示管理器]]启动,也可以从控制台手动启动。<br />
<br />
=== 使用显示管理器 ===<br />
<br />
*在菜单中选择 ''Plasma'' 用 [[Xorg (简体中文)|Xorg]] 启动。<br />
*安装 {{Pkg|plasma-wayland-session}} 软件包,并选择 ''Plasma (Wayland) '' 用 [[Wayland (简体中文)|Wayland]] 启动。<br />
<br />
=== 从控制台启动 ===<br />
<br />
若要使用 "[[xinit (简体中文)|xinit/startx]]" 启动 Plasma 桌面,请在 {{ic|.xinitrc}} 文件中添加 {{ic|exec startplasma-x11}}。<br />
若要在登录的时候开启 Xorg 请参阅[[Start X at Login (简体中文)|在启动时自动启用 X]]。若要从终端启动 Wayland 会话, 运行 {{ic|1=XDG_SESSION_TYPE=wayland dbus-run-session startplasmacompositor}}。[https://community.kde.org/KWin/Wayland#Start_a_Plasma_session_on_Wayland|在控制台启动Wayland会话]<br />
<br />
== 配置 ==<br />
<br />
KDE应用的大部分配置被储存在 {{ic|~/.config}}。KDE 主要在'''“系统设置”'''内配置。它也可通过 终端执行{{ic|systemsettings5}} 启动。<br />
<br />
=== 个性化 ===<br />
<br />
==== Plasma 桌面 ====<br />
<br />
===== 主题 =====<br />
<br />
[https://store.kde.org/browse/cat/104/ Plasma 主题]定义了面板和 plasmoids的样式。为使系统级使用更加便利,官方软件源和 [https://aur.archlinux.org/packages.php?K=plasma+theme AUR] 提供了很多可用主题。<br />
<br />
您也可以通过系统设置来安装主题:<br />
<br />
系统设置 > 工作空间主题 > 桌面主题 > 获取新主题<br />
<br />
这将呈现出 https://store.kde.org/ 的前端,轻松安装,卸载,或者更新第三方 Plasma 脚本。 [https://store.kde.org/ KDE商店] 提供了更多的plasma个性化方案,包括 [[SDDM_(简体中文)|SDDM]] 主题和 [[plymouth]] 主题<br />
{{提示|加载页面和锁定页面暂时无法自定义,但你可以在 '''' /usr/share/plasma/look-and-feel '''' 中修改原本的主题。请参阅 Kubuntu论坛这个帖子 <nowiki>https://www.kubuntuforums.net/showthread.php?67599-Plasma-5-background-images&=59832dc20e5bfc2948dbb591d8453f61</nowiki> }}<br />
<br />
[[SDDM_(简体中文)|SDDM]]的登录界面主题亦可在设置中进行调整。<br />
<br />
====== Qt 和 GTK+ 应用外观 ======<br />
<br />
{{提示|为了 Qt 和 GTK 主题的一致性,请参见 [[Uniform_look_for_Qt_and_GTK_applications_(简体中文)|外观统一的 QT 和 GTK 应用]]。}}<br />
<br />
;Qt4<br />
请安装{{AUR|breeze-kde4}},然后从 {{ic|qtconfig-qt4}} 中挑选微风作为图形用户界面风格。<br />
<br />
;GTK+<br />
在 GTK 中推荐外形美观的主题是 {{Pkg|breeze-gtk}} 或 {{AUR|gnome-breeze-git}}{{Broken package link (简体中文)|package not found}}。安装 {{Pkg|kde-gtk-config}} (该软件是{{Grp|plasma}} 的一部分),在 ''系统设置 > 应用风格 > GNOME 应用设置'' 中选择想要的 GTK 主题。<br />
<br />
在某些主题中,GTK+ 应用程序的工具栏显示为白底白字。若要更改 GTK2 应用程序中的颜色,请找到 {{ic|.gtkrc-2.0}} 并修改工具栏区。若要更改 GTK3 应用程序中的颜色,{{ic|gtk.css}} 和 {{ic|settings.ini}} 文件需要被修改。您也可以尝试在 ''系统设置 > 颜色'' 中取消对 ''将颜色应用于非Qt应用程序'' 的勾选。<br />
<br />
一些例如 {{AUR|vuescan-bin}} 的 GTK2 程序仍然因为 Plasma 的微风和 Adwaita 主题拥有透明的复选框.要解决这个问题,请安装并在 ''系统设置 > 应用风格 > GNOME 应用设置'' 中选择例如 {{AUR|numix-frost-themes}} 这样的皮肤。Numix-Frost-Light 看起来与微风相似。<br />
<br />
===== 小部件 =====<br />
<br />
Plasmoid包含短的脚本(plasmoid scripts)或者编译过的(plasmoid binaries)的KDE应用程序,用于增强桌面的功能。<br />
Plasmoid二进制文件可以从[https://aur.archlinux.org/packages.php?O=0&K=plasmoid&do_Search=Go&PP=25&SO=d&SB=v AUR]上获得的PKGBUILD安装,或者您可以编写自己的PKGBUILD。<br />
最简单的安装Plasmoid脚本的方式是右击面板或桌面:<br />
<br />
添加部件 > 获得新部件 > 下载新 Plasma 部件<br />
<br />
这将显示 [https://www.kde-look.org/ kde-look.org] 的前端界面,并可一键可以安装/卸载/更新第三方 plasmoid 脚本。<br />
<br />
大部分 plasmoids 的二进位编码可从 [https://aur.archlinux.org/packages.php?O=0&K=plasmoid&PP=50&SO=d&SB=v AUR] 上获得。<br />
<br />
===== 系统托盘中的声音应用 =====<br />
<br />
[[安装]] {{Pkg|plasma-pa}} 或 {{Pkg|kmix}} (从程序启动器启动 Kmix)。前者已被自动安装,无需其他设定。<br />
<br />
{{注意|1=要调整 [https://bugs.kde.org/show_bug.cgi?id=313579#c28 音量增减的步长],将诸如 {{ic|1=VolumePercentageStep=1}} 一行添加到 {{ic|~/.kde4/share/config/kmixrc}} 的 {{ic|[Global]}} 一节中。}}<br />
<br />
===== 禁用面板阴影 =====<br />
<br />
因为 Plasma 的面板在其他窗口之上,所以它的阴影会渲染在其他窗口之上。[https://bbs.archlinux.org/viewtopic.php?pid=1228394#p1228394]若要在不影响其他阴影的情况下禁用此行为,[[安装]] {{Pkg|xorg-xprop}} 并运行:<br />
<br />
$ xprop -remove _KDE_NET_WM_SHADOW<br />
<br />
然后用增大光标选择面板。[https://forum.kde.org/viewtopic.php?f=285&t=121592] 若要自动化,[[安装]] {{Pkg|xorg-xwininfo}} 并创建以下脚本:<br />
<br />
{{hc|/usr/local/bin/kde-no-shadow|<nowiki><br />
#!/bin/bash<br />
for WID in $(xwininfo -root -tree | sed '/"Plasma": ("plasmashell" "plasmashell")/!d; s/^ *\([^ ]*\) .*/\1/g'); do<br />
xprop -id $WID -remove _KDE_NET_WM_SHADOW<br />
done<br />
</nowiki>}}<br />
<br />
添加可执行权限<br />
# chmod 755 /usr/local/bin/kde-no-shadow<br />
<br />
此脚本可以在登录时启动,请将其加在''自动启动'':<br />
<br />
$ kcmshell5 autostart<br />
<br />
==== 窗口装饰 ====<br />
<br />
[https://kde-look.org/index.php?xcontentmode=75 窗口装饰]可以在 ''系统设置 > 应用程序风格 > 窗口装饰'' 中设置。<br />
<br />
您也可以在[https://aur.archlinux.org/packages.php?O=0&K=kdestyle&do_Search=Go&PP=25&SO=d&SB=v AUR]上找到,直接下载并安装更多的主题。<br />
<br />
==== 图标主题 ====<br />
<br />
图标主题可以在 ''系统设置 > 图标'' 中安装或改变.<br />
<br />
{{注意|虽然所有现代的Linux发行版都共享统一的图标主题格式,但像 [[GNOME_(简体中文)|GNOME]]这样的桌面使用更少的图标(特别是在工具栏和菜单中)。为这些桌面开发的主题一般都缺少 Plasma 和 KDE 应用需要的图标。建议安装与 Plasma 兼容的主题。}}<br />
<br />
{{提示|部分图标主题不从默认图标主题中引入图标,这将导致部分图标缺失。要想从默认图标主题中导入缺失图标,把{{ic|breeze}}添加到 {{ic|/usr/share/icon/''theme-name''/index.theme}}的{{ic|1=Inherits=}} 中,比如{{ic|1=Inherits=breeze,hicolor}}。每次更新图标主题时你都需要重新使用这个补丁,尝试使用[[Pacman hooks]]来自动完成这项任务。}}<br />
<br />
==== 字体 ====<br />
<br />
===== 字体感觉模糊 =====<br />
<br />
尝试安装 {{Pkg|ttf-dejavu}} 和 {{Pkg|ttf-liberation}} 软件包。<br />
<br />
安装后,确保注销并重新登录。不需要修改''系统设置 > 应用程序外观 > 字体''里的设置。 如果你使用 {{Pkg|qt5ct}} 包,Qt5 设置工具将有可能覆盖系用设置内的字体设置。<br />
<br />
如果您个人已经设置了[[Fonts|字体]]渲染,小心系统设置可能会改变它们的外观。当改变了''系统设置 > 应用程序外观 > 字体''里的设置,系统将可能改写字体配置文件({{ic|fonts.conf}})。<br />
<br />
没有办法避免这种情况,但是如果把数值调到了匹配 {{ic|fonts.conf}} 文件的话,所期望的字体渲染效果将会重新出现(这需要重启您的应用程序,在某些情况下可能需要重启桌面环境)。注意 Gnome 中的字体设置也会有这样的效果。<br />
<br />
===== 字体太大或变形 =====<br />
<br />
从 ''系统设置 > 应用程序外观 > 字体'' 将字体 DPI 强制设置为 '''96''' <br />
<br />
如果还是不行请尝试直接通过 Xorg 配置文件设置 DPI。[[Xorg_(简体中文)#手动设置DPI|参见这里]].<br />
<br />
==== 空间效率 ====<br />
<br />
Plasma Netbool shell (上网本交互界面)已从 Plasma 5 中移除,请阅[https://forum.kde.org/viewtopic.php?f=289&t=126631&p=335947&hilit=plasma+netbook#p335899 此KDE论坛帖子]。但是你仍然可以通过编辑 {{ic|~/.config/kwinrc}},在 {{ic|[Windows]}} 区内加上 {{ic|1=BorderlessMaximizedWindows=true}} 来实现类似的操作。<br />
<br />
==== 缩略图生成 ====<br />
<br />
若要在桌面和 Dolphin 内为媒体或文档文件生成缩略图,安装 {{Pkg|kdegraphics-thumbnailers}},{{Pkg|ffmpegthumbs}}。<br />
<br />
然后在 ''桌面背景'' > ''配置桌面'' > ''图标'' > ''更多预览选项...'' 内通过 ''右键单击'' 启用桌面的缩略图类别。<br />
<br />
在 ''Dolphin'' 中,浏览到 ''控制'' > ''通用'' > ''预览''。<br />
<br />
=== 夜晚颜色 ===<br />
<br />
Plasma提供了一种类似Redshift的特性(在Xorg和Wayland上都可以使用),称为夜晚颜色。它使屏幕上的颜色呈现更暖的色调,让你在选择使用的时间里减少眼睛疲劳。<br />
你可以在 系统设置 -> 显示和监控 -> 夜晚颜色 中启动该功能。<br />
<br />
=== 打印 ===<br />
<br />
{{提示|使用 [[CUPS (简体中文)|CUPS]] 的 Web 接口进行快速配置。这种方式配置的打印机可以被 KDE 应用使用。}}<br />
<br />
你也可以在 '''系统设置 > 打印机配置''' 中配置打印机。要使用这种配置方式,必须首先安装 {{Pkg|print-manager}} 和 {{Pkg|cups}} 软件包。请阅[[CUPS_(简体中文)#配置|CUPS配置]]<br />
<br />
=== Samba/Windows 的支持 ===<br />
<br />
若要使用 Windows 服务,安装 [[Samba (简体中文)|Samba]] ({{Pkg|samba}} 软件包)。<br />
<br />
Dophin 的共享服务需要 {{Pkg|kdenetwork-filesharing}} 软件包以及 usershares。关于如何配置usershares({{ic|smb.conf}}未启动它),详见 [[Samba (简体中文)#建立 Usershare 路径]]。在重新启动Samba之后,Dolphin的共享应该无需进一步配置。<br />
<br />
Plasma 访问 SMB 共享的能力有限。写入到 Windows 共享存在问题,打开 Windows 共享内文件(例:大的视频文件)会让 Plasma 先将整个文件先复制到本地系统。要解决这个问题,您可以安装类似 {{Pkg|thunar}} 加 {{Pkg|gvfs}} 和 {{Pkg|gvfs-smb}}(和 {{Pkg|gnome-keyring}} 用于保存登录凭据)的基于GTK的文件浏览器,以更有效的方式访问 SMB 共享。<br />
另一种可能的解决方法则是通过 {{Pkg|cifs-utils}} 来 [[File_systems#Mount_a_file system|挂载]] Samba 共享从而让 Plasma 把 SMB 共享当成一个普通的本地文件夹从而正常访问。对于公共共享的写入访问,mount命令可能如下所示:<br />
# mount -t cifs -o username=*,password=*,uid=1000,gid=1000,file_mode=0660,dir_mode=0770 //networkhost/share/ /home/user/localmountpoint/<br />
若要永久将其挂载:<br />
{{hc|/etc/fstab|<nowiki><br />
//networkhost/share/ /home/user/localmountpoint/ cifs defaults,username=*,password=*,uid=1000,gid=1000,file_mode=0660,dir_mode=0770 0 2<br />
</nowiki>}}<br />
可能需要将 {{ic|.local}} 附加到 hostname。对于某些 NAS 设备,可能需要将 {{ic|1=vers=1.0}} 附加到参数行以实现 SMB 1.0 的兼容性。<br />
<br />
另一种简单的解决办法则是使用 {{AUR|samba-mounter-git}}。它在 ''系统设置'' > ''网络驱动'' 中提供了基本相同的功能。<br />
<br />
=== KDE 桌面活动 ===<br />
<br />
KDE 桌面活动是类似于“虚拟桌面”的 Plasma 组件,你可以独立地对某个特定的活动进行特别的设定。 只有当你在用这个活动时,这些设定才会生效。<br />
<br />
=== 节能 ===<br />
<br />
[[安装]] {{Pkg|powerdevil}} 以便使用 KDE 内置的 "'''PowerDevil 电源管理'''"的节能服务,它可以用于调整系统的节能配置、(如果支持的话)屏幕的亮度并提供更详细的电源报告。可以选用{{AUR|powerdevil-light}}作为替代品,它不需要[[NetworkManager]]和[[Bluez]]作为依赖。<br />
<br />
{{Accuracy|根据后面的链接,问题可能是logind的{{ic|LidSwitchIgnoreInhibited}}的默认值是{{ic|yes}}。[https://bbs.archlinux.org/viewtopic.php?pid&#61;1649022#p1649022]}}<br />
<br />
{{Note (简体中文)|Powerdevil 可能无法 [[Power management (简体中文)#电源管理器|覆盖]] 所有的 logind 设置(例如笔记本合盖动作). 如果遇到这样的问题,需要修改logind的设置,请参考 [[Power management (简体中文)#用 systemd 进行电源管理]].}}<br />
<br />
=== 程序自启动 ===<br />
<br />
Plasma 可以在启动和关闭时自动启动应用程序并运行shell脚本。若要自动启动应用程序,请浏览到 ''系统设置 > 开关机 > 自启动'' 并添加您想要的程序或shell脚本。对于应用程序,{{ic|.desktop}} 文件将被创建。对于shell脚本,symlink 将被创建。<br />
<br />
{{注意|<br />
* 程序只能在登录时自启动,而shell脚本也可以在关机和 Plasma 启动前启动。<br />
* Shell脚本只有在被标记为可执行文件时才会运行。<br />
}}<br />
<br />
将[[Desktop_entries_(简体中文)|桌面配置项]](即{{ic|.desktop}}文件)放在这里:<br />
<br />
; {{ic|~/.config/autostart}}: 在登录时启动应用程序。<br />
<br />
将shell脚本的symlink放入以下目录之一中:<br />
<br />
; {{ic|~/.config/plasma-workspace/env}}: 在 Plasma 启动前启动脚本。<br />
; {{ic|~/.config/autostart-scripts}}: 在登录时启动脚本。<br />
; {{ic|~/.config/plasma-workspace/shutdown}}: 在关机时启动脚本。<br />
<br />
=== Phonon ===<br />
<br />
摘自 [[Wikipedia:Phonon (software)|Wikipedia]]:<br />
''Phonon 是 KDE 的多媒体 API, 提供了多个多媒体框架的抽象,为 KDE 和一些 QT 程序提供多媒体流处理功能。''<br />
<br />
Phonon 最初是为了让 KDE 和 Qt 软件独立于其他多媒体框架(例如GStreamer或xine)并其提供一个稳定的 API。<br />
<br />
KDE 中广泛地使用 Phonon 用于声音(例如系统通知或者 KDE 声音应用)和视频(例如 Dolphin 中的视频缩略图)中。<br />
<br />
==== 我应该选择哪个后端? ====<br />
<br />
你可以在 [[GStreamer]] 和 [[VLC]] 之间做选择–每个后端都有 Qt4 和 Qt5 版本 ({{AUR|phonon-qt4-gstreamer}}, {{Pkg|phonon-qt5-gstreamer}} – {{AUR|phonon-qt4-vlc}}, {{Pkg|phonon-qt5-vlc}}).<br />
<br />
[https://lists.kde.org/?l=kde-multimedia&m=137994906723790&w=2 KDE-Multimedia 上游建议使用 VLC 后端],但是很多 Linux 发行版 (例如 Kubuntu 和 Fedora-KDE ) 选择 GStreamer,因为它可以更方便的去掉专利 MPEG codecs。它们的 [https://community.kde.org/Phonon/FeatureMatrix 功能]有稍许不同。<br />
<br />
之前还有一些后端,但是因为缺乏维护,已经从 Arch 中删除。<br />
<br />
{{注意|1=<br><br />
* 可以同时安装多个后端,并在 ''系统设置 > 多媒体 > 后端'' 中进行优先级设定。<br />
* 根据 [https://forum.kde.org/viewtopic.php?f=250&t=126476&p=335080 KDE 这个帖子], VLC 后端不支持 [[wikipedia:ReplayGain|ReplayGain]]。<br />
* 如果你选择 VLC 后端,你可能会在每次kde想要发送一个语音警告时遇到崩溃(以及在很多其他情况下,参见[https://forum.kde.org/viewtopic.php?f=289&t=135956])<br />
* 你可以尝试运行以下代码进行修复:<br />
{{bc|# /usr/lib/vlc/vlc-cache-gen -f /usr/lib/vlc/plugins}}<br />
}}<br />
<br />
=== 拼写检查 ===<br />
<br />
KDE 依靠 {{Pkg|sonnet}} 及其可选依赖提供拼写检查功能。查看它的 [[PKGBUILD#optdepends|可选依赖]] 选择你喜欢的拼写检查插件。<br />
<br />
之后可进入 '''系统设置->区域设置->拼写检查''' 设置相应的功能。<br />
<br />
=== WiFi 热点 ===<br />
<br />
KDE 依靠 [[NetworkManager]] 作为它的网络后端,要想使用热点,必须安装 [[NetworkManager]] 的可选依赖 {{pkg|dnsmasq}} 并重新启动 {{ic|NetworkManager.service}} 。<br />
<br />
{{Note (简体中文)|参阅:<br />
* [[NetworkManager#Sharing internet connection over Wi-Fi]]}}<br />
<br />
== 应用程序 ==<br />
<br />
KDE项目提供了一套与Plasma桌面集成的应用程序。有关可用应用程序的完整列表,详见 {{Grp|kde-applications}} 软件包。另请参阅 [[:Category:KDE|KDE 相关应用页面]]。<br />
<br />
除了 KDE 应用程序包提供的程序之外,还有许多其他可用于补充 Plasma 的应用程序。其中一些将在下面讨论。<br />
<br />
=== 系统管理 ===<br />
<br />
==== KDE 系统设置中配置终止 Xorg-server ====<br />
<br />
浏览到子菜单:<br />
系统设置 > 硬件 > 输入设备 > 键盘 > 高级(标签) > "Key Sequence to kill the X server" <br />
然后选中复选框。<br />
<br />
==== KCM ====<br />
<br />
KCM 意为 KDE 控制模块('''KC'''onfig '''M'''odule)。这些模块在系统设置中提供了界面从而帮助你配置系统,或通过命令行('kcmshell5'')。<br />
<br />
* {{App|kde-gtk-config|GTK2 和 GTK3 的 KDE 设置器。|https://invent.kde.org/plasma/kde-gtk-config|{{Pkg|kde-gtk-config}}}}<br />
* {{App|KCM Qt Graphics System|该 KCM 让您轻松配置标准的Qt图形系统。|https://www.linux-apps.com/p/1127857/|{{AUR|kcm-qt-graphicssystem}}{{Broken package link (简体中文)|package not found}}}}<br />
* {{App|UFW KControl Module|KDE4 UFW 控制组件 ([[Uncomplicated Firewall]])。|https://www.linux-apps.com/p/1127851/|{{AUR|kcm-ufw}}{{Broken package link (简体中文)|package not found}}}}<br />
* {{App|System policies|配置[[PolicyKit]]。|https://invent.kde.org/system/polkit-kde-kcmodules-1|{{AUR|kcm-polkit-kde-git}}}}<br />
* {{App|wacom tablet|KDE Wacom 驱动图形界面。|https://www.linux-apps.com/p/1127862/|{{Pkg|kcm-wacomtablet}}}}<br />
* {{App|Kcmsystemd|KDE 系统控制组件.|https://github.com/rthomsen/kcmsystemd|{{AUR|systemd-kcm}}}}<br />
<br />
可从 [https://www.linux-apps.com/search?projectSearchText=KCM linux-apps.com] 找到更多的 KCM 。<br />
<br />
=== 桌面搜索 ===<br />
<br />
KDE 使用 Baloo 实现文件索引和查找。<br />
<br />
==== Baloo ====<br />
<br />
===== 使用及配置 Baloo =====<br />
<br />
为了在 Plasma 桌面上使用 Baloo 进行搜索,启动 krunner (默认快捷键 {{ic|ALT+F2}})并键入查询。若要在 Dophin(文件管理器)内搜索,按{{ic|CTRL+F}}。<br />
<br />
在默认情况下,桌面搜索的 KCM 仅显示两个选项:一个将文件夹放入黑名单的面板以及一种一次点击来禁用它的方法。<br />
<br />
或者你可以编辑 {{ic|~/.config/baloofilerc}} 文件[https://community.kde.org/Baloo/Configuration]。另外你也可以使用 {{ic|balooctl}} 进程。运行 {{ic|balooctl stop}} 和 {{ic|balooctl disable}}。<br />
<br />
将文件夹添加到黑名单或完全禁用了Baloo之后,{{ic|baloo_file_cleaner}} 进程将会自动删除所有不需要的索引文件。它们被存储在 {{ic|~/.local/share/baloo/}} 。<br />
<br />
===== 如何把可移动设备加入索引? =====<br />
<br />
默认情况下,所有可移动设备都在黑名单内。你只需要在 KCM 面板中移除你的设备即可。<br />
<br />
=== Web 浏览器 ===<br />
<br />
* {{App|[[Wikipedia:Konqueror|Konqueror]]|KDE项目的一部分, 支持两种渲染引擎 – KHTML 和基于[[Chromium]]的 Qt Web引擎。|https://konqueror.org/|{{Pkg|konqueror}}}}<br />
* {{App|[[Wikipedia:QupZilla|QupZilla]]|包含 Plasma 集成特性的 Qt web 浏览器。其使用 Qt Web引擎。|https://github.com/QupZilla/qupzilla|{{Pkg|qupzilla}}{{Broken package link (简体中文)|replaced by {{Pkg|falkon}}}}}}<br />
* {{App|[[Chromium]]|Chromium 及它的专有版本 Google Chrome 具有有限的 Plasma 集成。 [[KDE Wallet#KDE Wallet for Chrome and Chromium|它们可以使用 KWallet]] 以及 KDE 窗口 打开/保存。|https://www.chromium.org/|{{Pkg|chromium}}}}<br />
* {{App|[[Firefox]]|Firefox 可以通过配置以和 Plasma 更好地集成。参考 [[Firefox_(简体中文)#KDE_整合|Firefox KDE整合]]。|https://mozilla.org/firefox|{{Pkg|firefox}}}}<br />
<br />
=== 个人信息管理 ===<br />
<br />
KDE 提供了其自己的个人信息管理应用储存,包括电子邮件,联系人,日历等。可以使用 {{Pkg|kdepim-meta}}{{Broken package link (简体中文)|replaced by {{Pkg|kde-pim-meta}}}} 元软件包安装所有相关的软件包。<br />
<br />
==== Akonadi ====<br />
<br />
Akonadi 是系统中本地缓存各种来源的 PIM 数据的一种方法,接着这些数据可以被其它的应用使用。这包含了用户的邮件、联系人、日历、事件、刊物、闹钟、笔记等。<br />
<br />
Akonadi 自身并不存储任何数据:存储格式依赖于数据的性质(例如,联系人可能以 vcard 格式存储)。<br />
<br />
===== 安装 =====<br />
<br />
[[安装]] {{Pkg|akonadi}}. 若需其他插件,安装 {{Pkg|kdepim-addons}}。<br />
<br />
{{注意|若要使用除 MariaDB/MySQL 以外的数据库引擎,请在安装 {{Pkg|akonadi}} 包时使用以下命令从而跳过 {{Pkg|mariadb}} 依赖项的安装:<br />
<br />
{{bc|# pacman -S akonadi --assume-installed mariadb}}<br />
<br />
}}<br />
<br />
===== 禁用 Akonadi =====<br />
<br />
请参见 KDE userbase 的[https://userbase.kde.org/Akonadi#Disabling_the_Akonadi_subsystem 这一节]。<br />
<br />
===== 配置数据库 =====<br />
<br />
====== MariaDB/MySQL (使用 ZFS) ======<br />
<br />
如果您的主目录位于ZFS池中,你将需要创建 {{ic|~/.config/akonadi/mysql-local.conf}} 并添加以下内容:<br />
<br />
[mysqld]<br />
innodb_use_native_aio = 0<br />
<br />
否则你会收到 [[MariaDB#OS error 22 when running on ZFS|OS error 22]]。<br />
<br />
====== PostgreSQL ======<br />
<br />
安装并设置 [[PostgreSQL (简体中文)]]。确保 {{ic|postgresql.service}} 已被[[Systemd_(简体中文)#使用单元|激活]].<br />
<br />
编辑Akonadi配置文件,使其具有以下内容:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|<nowiki><br />
[%General]<br />
Driver=QPSQL<br />
<br />
[QPSQL]<br />
Host=/run/postgresql/<br />
InitDbPath=/usr/bin/initdb<br />
Name=akonadi<br />
Options=<br />
Password=<br />
Port=5432<br />
ServerPath=/usr/bin/pg_ctl<br />
StartServer=true<br />
User=postgres<br />
</nowiki>}}<br />
<br />
{{注意|如果你的 PostgreSQL 数据库用户名,密码和端口不同于 {{ic|postgres}} 及 {{ic|5432}}, 请确保你别更改了配置选项:{{ic|1=User=}}, {{ic|1=Password=}}, 以及 {{ic|1=Port=}}.}}<br />
<br />
运行 {{ic|akonadictl start}} 启动 Akonadi 并检查其状态: {{ic|akonadictl status}}。<br />
<br />
====== SQLite ======<br />
<br />
{{注意|Akonadi 默认不使用 SQLite,KDE 亦表示 SQLite [https://techbase.kde.org/KDE_PIM/Akonadi#Why_not_use_sqlite.3F 不能满足 Akonadi 的需求]。}}<br />
<br />
编辑Akonadi配置文件以匹配以下配置:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QSQLITE3<br />
<br />
[QSQLITE3]<br />
Name=/home/''username''/.local/share/akonadi/akonadi.db<br />
}}<br />
<br />
=== KDE Telepathy ===<br />
<br />
[https://community.kde.org/KTp KDE Telepathy] 是一个把即时信息功能紧密整合到 KDE 桌面中的项目。它使用 Telepathy 框架作为后端,意在替代 Kopete。<br />
<br />
若要安装所有 Telepathy 协议,安装 {{Grp|telepathy}} 组。<br />
若要使用 KDE Telepathy 客户端,安装 {{Pkg|telepathy-kde-meta}} 元软件包,它包含了所有在 {{Grp|telepathy-kde}} 组中的软件包。<br />
<br />
==== 使用 Telegram 与 KDE Telepathy ====<br />
<br />
[[Telegram]] 协议需要使用 {{pkg|telepathy-haze}}, 安装 {{aur|telegram-purple}} 或 {{aur|telegram-purple-git}} 和 {{aur|telepathy-morse-git}}。用户名是 Telegram 账户电话号码 (加国家前缀 {{ic|+''xx''}},例如德国是 {{ic|+49}}).<br />
<br />
通过图形界面进行配置可能会很棘手:如果在KDE Telepathy客户端中配置新帐户时不接受电话号码(出现一个错误信息表明参数无效并阻止创建账户),请把其添加在单引号中,并在帐号创建好后从配置文件({{ic|~/.local/share/telepathy/mission-control/accounts.cfg}})中手动移除引号(如果引号未被移除,会发生认证错误)。<br />
<br />
{{注意|配置文件应当在 KDE Telepathy 未运行时手动编辑,例如当 KDE 桌面未激活时,否则手动更改可能会被软件覆盖。}}<br />
<br />
=== 安卓整合 ===<br />
<br />
[https://community.kde.org/KDEConnect KDE Connect] 提供了一些功能:<br />
<br />
* 从任何应用向 KDE 共享文件和 URL 或从 KDE 向任何应用共享,无需连线。<br />
* 触摸板模拟:将手机屏幕用作计算机的触摸板。<br />
* 通知同步(4.3+):从桌面读取您的安卓通知。<br />
* 共享剪贴板:在手机和电脑之间复制粘贴。<br />
* 多媒体远程控制:将手机用作 Linux 媒体播放器的遥控器。<br />
* WiFi 连接:不需要 usb 和蓝牙。<br />
* RSA加密:保证您的信息安全。<br />
<br />
你需要同时在电脑和安卓上安装 KDE Connect。在PC端上安装 {{Pkg|kdeconnect}} 软件包。对于安卓端,请通过 [https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp Google Play] 或 [https://f-droid.org/repository/browse/?fdid=org.kde.kdeconnect_tp F-Droid] 安装 {{ic|KDE Connect}}。<br />
<br />
即使不使用 Plasma 桌面,你也可以使用 KDE Connect。对于使用 AppIndicator(如Unity)的桌面环境,也需要安装indicator-kdeconnect 软件包。<br />
<br />
== 提示和技巧 ==<br />
<br />
=== 使用其他窗口管理器 ===<br />
<br />
Plasma 中的组件选择器设置已不再允许更改窗口管理器。[https://github.com/KDE/plasma-desktop/commit/2f83a4434a888cd17b03af1f9925cbb054256ade]若需要更改窗口管理器,你需要在 KDE 启动之前设置 {{ic|KDEWM}} [[Environment_variables_(简体中文)|环境变量]]。[https://wiki.haskell.org/Xmonad/Using_xmonad_in_KDE]为此,你可以在 {{ic|~/.config/plasma-workspace/env}} 中创建一个名为 {{ic|set_window_manager.sh}} 的脚本,并在这导出 {{ic|KDEWM}} 变量。例:使用 i3 窗口管理器:<br />
<br />
{{hc|~/.config/plasma-workspace/env/set_window_manager.sh|2=<br />
export KDEWM=/usr/bin/i3<br />
}}<br />
<br />
然后标记其为可执行:<br />
<br />
{{bc|$ chmod +x ~/.config/plasma-workspace/env/set_window_manager.sh}}<br />
<br />
==== KDE/Openbox 会话 ====<br />
<br />
软件包 {{Pkg|openbox}} 为在plasma下使用 [[Openbox]] 提供了会话. 要使用这个会话,请在 [[display manager]] 菜单中选择 ''KDE/Openbox'' .<br />
<br />
若要手动启动会话,请将下面这行添加到你的 {{ic|.xinitrc}} 文件中:<br />
<br />
exec openbox-kde-session<br />
<br />
==== 重新启用特殊效果 ====<br />
<br />
当你用不包含窗口混合器(Compositor)的窗口管理器(例如 Openbox)替换 Kwin 时,任何桌面特殊效果都会失效(例如窗口透明度)。在这种情况下,请安装并运行其他独立混合器,比如 [[Xcompmgr]] 或 [[Compton]]。<br />
<br />
=== 显示器分辨率 / 多显示器配置 ===<br />
<br />
要在 Plasma 中启用分辨率和多显示器管理, 请安装 {{Pkg|kscreen}}. 它在 ''系统设置 > 显示'' 中添加了更多选项.<br />
<br />
=== KWin-lowlatency ===<br />
<br />
[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency]是一种尝试,它试图减少KWin compositor在Wayland中的延迟和中断,可以在这里 {{AUR|KWin-lowlatency}}获得。<br />
<br />
=== 配置 ICC 色彩矫正 ===<br />
<br />
在Plasmak中启用ICC配置文件,请先安装{{Pkg|colord-kde}},它会在 系统设置 中添加 色彩校正 选项。<br />
使用“添加配置文件”可以导入ICC配置文件。<br />
<br />
=== 禁用超级键(Windows 键)打开应用程序启动器 ===<br />
<br />
若要禁用此功能,请运行以下命令:<br />
<br />
$ kwriteconfig5 --file kwinrc --group ModifierOnlyShortcuts --key Meta ""<br />
<br />
=== 在应用程序菜单中禁用书签 ===<br />
<br />
安装了Plasma Browser集成后,KDE将在应用程序启动器中显示书签。<br />
要禁用此功能,您可以运行以下命令:<br />
<br />
$ mkdir ~/.local/share/kservices5<br />
$ sed 's/EnabledByDefault=true$/EnabledByDefault=false/' /usr/share/kservices5/plasma-runner-bookmarks.desktop > ~/.local/share/kservices5/plasma-runner-bookmarks.desktop<br />
<br />
== 疑难解答 ==<br />
<br />
=== 字体 ===<br />
<br />
==== 字体在Plasma会话中看起来发虚 ====<br />
<br />
尝试安装{{Pkg|ttf-dejavu}}和{{Pkg|ttf-liberation}}包。<br />
<br />
安装后,请确保登出并重新登录。无需修改 ''系统设置 > 字体'' 中的任何选项。如果您正在使用{{Pkg|qt5ct}},Qt5配置工具中的设置可能会覆盖系统设置中的字体设置。<br />
<br />
如果您设置了字体[[Fonts (简体中文)]]的渲染方式,请注意系统设置可能会改变它们的外观。当你进入 ''系统设置 > 字体'' 时,系统设置可能会改变你的字体配置文件({{ic|Fonts.conf}})。<br />
<br />
这是无法避免的,但是,如果您设置的字体与{{ic|fonts.conf}} 文件匹配,则将返回预期的字体渲染效果(这将要求您重新启动应用程序或在重新登录您的桌面)。请注意,Gnome的“字体首选项”也可以执行此操作。<br />
<br />
==== 字体很大或看起来不成比例 ====<br />
<br />
尝试在 ''系统设置 > 字体'' 中强制字体DPI为 {{ic|'''96'''}} 。<br />
<br />
如果不起作用,请尝试按照 [[Xorg (简体中文)#手动设置DPI]] 中的说明直接在Xorg配置文件中设置DPI。<br />
<br />
=== 有关配置的问题 ===<br />
<br />
KDE 中许多问题都跟配置相关。<br />
<br />
==== Plasma 桌面行为异常 ====<br />
<br />
Plasma 故障通常是由不稳定的 '''plasma 小部件'''(plasmoids)或者 '''plasma 主题'''引起的。首先寻找最近安装的 plasmoid 或者 plasma 主题并禁用或者卸载它。<br />
<br />
因此,如果你的桌面突然被"锁定"了,很可能是由于安装了有问题的组件造成的。如果你不记得故障发生前你安装了什么小部件(有时它可能是一个不寻常的问题),通过逐个移除小部件直到问题不再出现。然后你可以卸载这个小部件并提交一份缺陷报告,'''若是官方小部件时'''到[https://bugs.kde.org/ KDE 缺陷跟踪页]提交一份缺陷报告。如果它不是,你可以在 https://store.kde.org/ 上寻找它的条目并告知小部件的开发者你所碰到的问题(以及再现它的详细步骤等)。<br />
<br />
如果你找不到问题,也不想丢失''所有的''设置,浏览到{{ic|~/.config}}:<br />
<br />
$ for j in plasma*; do mv -- "$j" "${j%}.bak"; done<br />
<br />
这个命令会将'''所有你用户跟 Plasma 有关的设置''' 重命名为 *.bak (例如 {{ic|plasmarc.bak}}),并且当您重新登录 Plasma 时,您将恢复'''默认'''设置。若要撤销该操作,请删除.bak文件扩展名。若已有 *.bak 文件,请先重命名,移动或删除它们。强烈建议您经常备份。 有关可能的方案列表,请参阅[[Synchronization and backup programs|同步和备份程序(英文)]]。<br />
<br />
==== 清理缓存以解决升级故障 ====<br />
<br />
故障可能由旧的缓存导致。有时,升级后旧缓存可能会产生奇怪的、难以调试的行为,例如关不掉的 shell、改变设置时失去响应、以及像 ark 不能解压 rar/zip 文件又或者 amarok 不能识别音乐等各种其它问题。这个办法也能解决 KDE 和 Qt 程序在升级后变得难看的问题。<br />
<br />
用以下命令来重建缓存:<br />
<br />
$ rm ~/.config/Trolltech.conf<br />
$ kbuildsycoca5 --noincremental<br />
<br />
==== 不能在系统设置中更改主题、图标、字体、颜色;大多数图标不显示 ====<br />
<br />
确保 {{ic|QT_QPA_PLATFORMTHEME}} 在 [[Environment variables (简体中文)]] 未设置,命令 {{ic|printenv QT_QPA_PLATFORMTHEME}} 输出应该为空,该变量通常用于在Qt应用程序上强制执行qt5ct设置。<br />
<br />
==== 音量控制、通知或多媒体键不起作用 ====<br />
<br />
隐藏系统托盘设置中的某些项(如音频音量、媒体播放器或通知)也会禁用相关功能。请到系统托盘查看相应的设置。<br />
<br />
==== 登录界面不会将光标设置同步到SDDM ====<br />
<br />
登录界面从{{ic|~/.config/kcminputrc}}读取您的光标设置,如果没有此文件,则不会同步任何设置。生成此文件的最简单方法是在 ''系统设置 > 光标'' 中更改光标主题,然后将其更改回首选的光标主题。<br />
<br />
=== 图形问题 ===<br />
<br />
请先确保您已安装了适合您 GPU 的驱动程序。有关详细信息,请参阅 [[Xorg#Driver installation]]。如果你的显卡较旧,你可以尝试 [[#禁用桌面特效]] 或 [[#禁用混合项(compositing)]]。<br />
<br />
==== 获取KWin的当前状态以用于支持和调试 ====<br />
<br />
该命令打印出KWin当前状态的摘要,包括使用的选项,使用的合成后端以及相关的OpenGL驱动程序功能。更多请参阅[https://blog.martin-graesslin.com/blog/2012/03/on-getting-help-for-kwin-and-helping-kwin/ Martin's blog]。<br />
$ qdbus org.kde.KWin /KWin supportInformation<br />
<br />
==== 禁用桌面特效 ====<br />
<br />
Plasma 默认启用了桌面特效,并且不是所有的游戏都会自动禁用它们。你可以通过''系统设置 > 桌面特效'' 禁用桌面特效。你也可以使用 {{ic|Alt+Shift+F12}} 切换桌面效果。另外,您也可以在 ''系统设置 > 窗口管理 > 窗口规则'' 下创建自定义KWin规则,以在某个应用程序/窗口启动时自动禁用/启用混合项。<br />
<br />
==== 启用透明度 ====<br />
<br />
如果使用透明背景而不启用合成器,则会收到以下消息:<br />
<br />
配色方案使用的透明背景在您的桌面上似乎不受支持<br />
<br />
在 ''系统设置 > 显示和监视 > 合成器'' 中,选中 ''启动时开启混成'' 并重新启动Plasma。<br />
<br />
==== 禁用混合项(compositing) ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''启动时激活混合器(compositing)''并重启 Plasma<br />
<br />
==== 启用混合项(compositing)后全屏时闪烁 ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''允许应用程序阻止混合项(compositing)''。这可能会影响性能。<br />
<br />
==== Nvidia 显卡屏幕撕裂 ====<br />
<br />
{{提示|翻译人员使用,请无视本提示。英文页面本章搬到 NVIDIA/Troubleshooting 页面去了,但这页面中文没有,故中文保留此章}}<br />
<br />
默认情况下,KWin 混合项在与 Nvidia 闭源驱动一起使用时会遭受屏幕撕裂。要解决此问题,运行 {{ic|kwin_x11 --replace}} 并在其之前陈述环境变量 {{ic|1=export __GL_YIELD="USLEEP"}}:<br />
<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
<br />
与使用全局环境变量不同,这只会影响 KWin,并不会降低其他 3D 应用程序的 CPU 性能。也可以通过在 Plasma 的 {{ic|~/.config/autostart-scripts}} 文件夹中创建一个简单的脚本,使其在登录时自动执行。<br />
<br />
{{hc|~/.config/autostart-scripts/restartkwinusleep.sh|<nowiki><br />
(sleep 2s &&<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
)<br />
<br />
</nowiki>}}<br />
{{ic|sleep}} 参数有助于防止 KWin 在登录后过早重新启动时出现问题,可以根据需要调整时间。 不要忘记将脚本标记为可执行文件。<br />
<br />
==== Plasma 光标有时显示不正确 ====<br />
<br />
创建 {{ic|~/.icons/default}} 目录并在其内创建一个包含以下内容的 {{ic|index.theme}} 的文件:<br />
<br />
{{hc|/home/''archie''/.icons/default/index.theme|2=<br />
[Icon Theme]<br />
Inherits=breeze_cursors<br />
}}<br />
<br />
执行以下命令:<br />
<br />
$ ln -s /usr/share/icons/breeze_cursors/cursors ~/.icons/default/cursors<br />
<br />
==== 更改角色时(例如,将鼠标悬停在超链接上时)光标抖动/闪烁 ====<br />
<br />
尝试为系统和窗口管理器安装适当的2D加速驱动程序。<br />
<br />
==== 屏幕分辨率设置不可用 ====<br />
<br />
您的kscreen本地配置设置可以覆盖{{ic|xorg.conf}}中设置的配置。在{{ic|~/.local/share/kscreen/}}中查找kscreen配置文件,并检查分辨率是否设置为显示器不支持的分辨率。<br />
<br />
==== 系统托盘上的图标模糊 ====<br />
<br />
为了在托盘中添加图标,应用程序经常使用 appindicator库。如果图标模糊,请检查已安装的libappindicator版本。如果您只安装了{{Pkg|libappindicator-gtk2}},那么您可以安装{{Pkg|libappindicator-gtk3},以尝试获得清晰的图标。<br />
<br />
==== 在虚拟机中无法更改屏幕分辨率 ====<br />
<br />
当在[[VMware]]、[[VirtualBox]]或[[QEMU]]虚拟机上运行Plasma时,kscreen可能不允许将Guest的屏幕分辨率更改为高于800x600的分辨率。<br />
<br />
解决方法是在 {{man|5|xorg.conf.d}} 中设置 {{ic|PreferredMode}} 选项,或者尝试在VM中使用其他图形适配器。例如,对于VirtualBox,使用VBoxSVGA代替VMSVGA;对于QEMU,用Virtio代替QXL。<br />
有关详细信息,请参见[https://bugs.kde.org/show_bug.cgi?id=407058 KDE Bug 407058]。<br />
<br />
=== 声音问题 ===<br />
<br />
{{注意|首先保证你已经安装了 {{Pkg|alsa-utils}}。}}<br />
<br />
==== 睡眠后没声音 ====<br />
<br />
如果睡眠后没有声音并且 Kmix 没有显示应该显示的音频设备,可以尝试重新启动 plasmeshell 和 pulseaudio:<br />
<br />
$ killall plasmashell<br />
$ systemctl --user restart pulseaudio.service<br />
$ plasmashell<br />
<br />
某些应用程序也可能需要重新启动才能再次播放声音。<br />
<br />
==== 在播放任何声音时出现 "返回默认" 消息 ====<br />
<br />
当你碰到这些消息:<br />
<br />
The audio playback device ''声音设备的名称'' does not work.<br />
Falling back to default<br />
<br />
访问:<br />
系统设置 > 多媒体<br />
并在每一栏中都把名称为 "'''默认(default)'''" 的设备设置在所有其它设备的上面。<br />
<br />
==== 使用 GStreamer Phonon 后端时不能播放 MP3 文件 ====<br />
<br />
安装 GStreamer libav 插件(软件包{{Pkg|gst-libav}})可以解决问题。如果仍然碰到,你可以尝试换一个软件包,例如 {{AUR|phonon-qt4-vlc}} 或 {{Pkg|phonon-qt5-vlc}}。然后,请确保它是首选的后端,通过:<br />
<br />
系统设置 > 多媒体 > 后端<br />
<br />
=== 电源管理 ===<br />
<br />
==== 没有挂起/休眠选项 ====<br />
<br />
如果你的系统可以使用 systemd 挂起/休眠,但 KDE 中没有这些选项,请确保 {{Pkg|powerdevil}} 已被安装。<br />
<br />
=== KMail ===<br />
<br />
==== 清理 akonadi 配置来修复 kmail ====<br />
<br />
首先确保 KMail 不在运行。然后备份配置文件:<br />
<br />
$ cp -a ~/.local/share/akonadi ~/.local/share/akonadi-old<br />
$ cp -a ~/.config/akonadi ~/.config/akonadi-old<br />
<br />
启动 ''系统设置 > 个人信息'' 并删除所有资源。回到 Dolphin 中移除原始的 {{ic|~/.local/share/akonadi}} 和 {{ic|~/.config/akonadi}} - 之前所作的备份能让你在必要时恢复它们。<br />
<br />
现在回到 系统设置 页面并小心地添加必要的资源。你应该看到读取你邮件目录的资源。然后启动 Kontact/KMail 查看它是否正常运作。<br />
<br />
==== KMail 中空的 IMAP 收件箱 ====<br />
<br />
对于某些 IMAP 账户,kmail将把收件箱当作一个包含此帐户所有其他文件夹的容器显示。Kmail 不会在收件箱容器中显示消息,而是在所有其他子文件夹中显示消息,请参阅 [https://bugs.kde.org/show_bug.cgi?id=284172 KDE Bug 284172]。若要解决此问题,只需在kmail帐户设置中禁用服务器端订阅即可。<br />
<br />
==== KMail中EWS帐户的授权错误 ====<br />
<br />
在KMail中设置EWS帐户时,您可能会不断收到关于授权失败的错误,即使是使用有效的凭证。这可能是由于[[KWallet]]和KMail之间的通讯中断造成的。要解决此问题,请通过qdbus设置密码:<br />
$ qdbus org.freedesktop.Akonadi.Resource.akonadi_ews_resource_0 /Settings org.kde.Akonadi.Ews.Wallet.setPassword "XXX"<br />
<br />
=== 网络 ===<br />
<br />
==== 自动挂载NFS卷时卡死 ====<br />
<br />
对 [[NFS]] 卷使用 [[Fstab#Automount with systemd]] 可能导致卡死,见 [https://bugs.kde.org/show_bug.cgi?id=354137 bug report upstream].<br />
<br />
=== Aggressive QXcbConnection journal logging ===<br />
<br />
See [[Qt#Disable/Change Qt journal logging behaviour]].<br />
<br />
=== KF5/Qt 5应用程序在i3/FVWM/awesome中不显示图标 ===<br />
<br />
See [[Qt#Configuration of Qt5 apps under environments other than KDE Plasma]].<br />
<br />
=== 保存凭据和持续显示 KWallet 对话框的问题 ===<br />
<br />
不建议在用户设置中关闭 KWallet 密码保存系统,因为需要它为每个用户保存加密凭证(如WiFi密码)。持续显示的 KWallet 对话框可能是关闭它的后果。如果你嫌每当应用程序想要访问 Kwallet 时需要解锁烦,你可以让登录管理器 SDDM 和 LightDM 在登录时自动解锁 KWallet,请参阅 [[KDE Wallet (简体中文)]]。第一个钱包需要由 KWallet 生成(而不是“用户生成”),以便用于系统程序凭据。如果你不希望让钱包凭据在内存内为每个应用打开,可以通过 {{Pkg|kwalletmanager}} 在KWallet设置中限制应用程序访问它。如果您根本不关心凭证加密,您可以在创建钱包,KWallet 要求输入密码时,将密码留空。这样,应用程序将可以在不解锁钱包的情况下访问密码。<br />
<br />
=== Discover不显示任何程序 ===<br />
<br />
请安装 {{Pkg|packagekit-qt5}}.<br />
<br />
=== NVIDIA驱动程序的kscreenlocker_greet的CPU使用率很高 ===<br />
<br />
As described in [https://bugs.kde.org/show_bug.cgi?id=347772 KDE Bug 347772] NVIDIA OpenGL drivers and QML may not play well together with Qt 5. This may lead {{ic|kscreenlocker_greet}} to high CPU usage after unlocking the session. To work around this issue, set the {{ic|QSG_RENDERER_LOOP}} [[environment variable]] to {{ic|basic}}.<br />
<br />
Then kill previous instances of the greeter with {{ic|killall kscreenlocker_greet}}.<br />
<br />
=== OS error 22 when running Akonadi on ZFS ===<br />
<br />
If your home directory is on a [[ZFS]] pool, create a {{ic|~/.config/akonadi/mysql-local.conf}} file with the following contents:<br />
<br />
[mysqld]<br />
innodb_use_native_aio = 0<br />
<br />
See [[MariaDB#OS error 22 when running on ZFS]].<br />
<br />
=== 某些程序的窗口处于非活动状态时无法滚动 ===<br />
<br />
这是由GTK3处理鼠标滚动事件处理有问题造成的。一个解决方法是设置[[environment variable]] {{ic|1=GDK_CORE_DEVICE_EVENTS=1}}。但是,这种方法也会破坏触摸板的平滑滚动和触摸屏滚动。<br />
<br />
=== TeamViewer 很卡 ===<br />
<br />
在使用TeamViewer时,如果您使用平滑动画(比如最小化窗口),它可能会运行得很慢。参见 [[#禁用混合项(compositing)]] 作为一种解决方案。<br />
<br />
=== Kmail, Kontact and wayland ===<br />
<br />
Kmail可能会失去响应,显示一个黑色的消息视图或者类似的,通常是在最小化和恢复之后。一个解决方案可能是设置 [[environment variable]] {{ic|1=QT_QPA_PLATFORM="xcb;wayland"}}。<br />
<br />
=== Inotify 文件夹监控上限 ===<br />
<br />
如果收到以下错误:<br />
<br />
KDE Baloo Filewatch service reached the inotify folder watch limit. File changes may be ignored.<br />
<br />
您就需要增加 inotify 文件夹监控上限:<br />
<br />
# echo 524288 > /proc/sys/fs/inotify/max_user_watches<br />
<br />
永久设置可以创建文件{{ic|/etc/sysctl.d/40-max-user-watches.conf}}:<br />
<br />
#increase inotify watch limit<br />
fs.inotify.max_user_watches = 524288<br />
<br />
== 参见 ==<br />
<br />
* [https://www.kde.org/ KDE 主页]<br />
* [https://bugs.kde.org/ KDE 缺陷跟踪页]<br />
* [https://blog.martin-graesslin.com/blog/kategorien/kde/ Martin Graesslin 的博客]</div>InsaneGuo