https://wiki.archlinux.org/api.php?action=feedcontributions&user=Lesmana&feedformat=atomArchWiki - User contributions [en]2024-03-29T01:33:45ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Nmcli_examples&diff=751444Nmcli examples2022-10-06T14:09:14Z<p>Lesmana: redirect as per https://wiki.archlinux.org/title/ArchWiki:Archive (If among the archived pages you find some that could make sense to instead redirect to an existing article, please do so. )</p>
<hr />
<div>#REDIRECT [[NetworkManager#nmcli_examples]]</div>Lesmanahttps://wiki.archlinux.org/index.php?title=PDF,_PS_and_DjVu&diff=701147PDF, PS and DjVu2021-11-07T07:25:38Z<p>Lesmana: fix broken section link</p>
<hr />
<div>[[Category:Applications]]<br />
[[Category:File formats]]<br />
[[Category:Lists of software]]<br />
[[Category:Software comparisons]]<br />
[[es:PDF, PS and DjVu]]<br />
This article covers software to view, edit and convert [[Wikipedia:PDF|PDF]], [[Wikipedia:PostScript|PostScript]] (PS), [[Wikipedia:DjVu|DjVu]] (''déjà vu'') and [[Wikipedia:Open XML Paper Specification|XPS]] files.<br />
<br />
== Engines ==<br />
<br />
* {{App|[[Wikipedia:Poppler (software)|Poppler]]|PDF rendering library based on Xpdf. For CJK (Chinese, Japanese, Korean) support with Poppler, [[install]] {{Pkg|poppler-data}}.|https://poppler.freedesktop.org/|{{Pkg|poppler}}}}<br />
* {{App|[[Wikipedia:MuPDF|Mupdf]]| MuPDF is a lightweight PDF, XPS, and EPUB viewer, consisting of a software library, command line tools, and viewers.|https://mupdf.com/|{{Pkg|libmupdf}}}}<br />
* {{App|libspectre|Small library for rendering Postscript documents.|https://www.freedesktop.org/wiki/Software/libspectre|{{Pkg|libspectre}}}}<br />
* {{App|[[Wikipedia:Ghostscript|Ghostscript]]|Interpreter for PostScript and PDF. Provides the {{man|1|gs}} command-line interface, see also {{ic|/usr/share/doc/ghostscript/*/Use.htm}} ([https://ghostscript.com/doc/current/Use.htm online]), along with many wrapper scripts like ''ps2pdf'' and ''pdf2ps''.|https://ghostscript.com/|{{Pkg|ghostscript}}}}<br />
* {{App|DjVuLibre|Suite to create, manipulate and view DjVu documents.|http://djvu.sourceforge.net/|{{Pkg|djvulibre}}}}<br />
* {{App|libgxps|GObject based library for handling and rendering XPS documents.|https://wiki.gnome.org/Projects/libgxps|{{Pkg|libgxps}}}}<br />
<br />
== Viewers ==<br />
<br />
=== Framebuffer ===<br />
<br />
* {{App|fbgs|Poor man's PostScript/pdf viewer for the linux framebuffer console.|https://www.kraxel.org/blog/linux/fbida/|{{Pkg|fbida}}}}<br />
* {{App|fbpdf|Small framebuffer PDF and DjVu viewer based on MuPDF, with [[Vim]] keybindings and written in C|https://repo.or.cz/w/fbpdf.git|{{AUR|fbpdf-git}}}}<br />
* {{App|jfbview|Framebuffer PDF and image viewer. Features include Vim-like controls, zoom-to-fit, a TOC (outline) view and fast multi-threaded rendering.|https://github.com/jichu4n/jfbview|{{AUR|jfbview}}}}<br />
<br />
=== Graphical ===<br />
<br />
{{Note|Some [[web browser]]s can display PDF files, for example with [https://github.com/mozilla/pdf.js PDF.js].}}<br />
<br />
* {{App|[[Wikipedia:Adobe Reader|Adobe Reader]]|Proprietary PDF file viewer offered by Adobe. Discontinued for Linux.|https://www.adobe.com/products/reader.html|{{AUR|acroread}}}}<br />
* {{App|apvlv|Lightweight document viewer with [[Vim]] keybindings. Supports PDF, DjVu, EPUB, HTML and TXT.|https://naihe2010.github.io/apvlv/|{{AUR|apvlv}}}}<br />
* {{App|Atril|Simple multi-page document viewer for MATE. Supports DjVu, DVI, EPS, EPUB, PDF, PostScript, TIFF, XPS and Comicbook.|https://github.com/mate-desktop/atril|{{Pkg|atril}}}}<br />
* {{App|CorePDF|Simple lightweight PDF viewer based on Qt and poppler. Part of C-Suite.|https://cubocore.org/|{{AUR|corepdf}}}}<br />
* {{App|Deepin Document Viewer|A simple PDF and DjVu reader, supporting bookmarks, highlights and annotations.|https://github.com/linuxdeepin/deepin-reader|{{Pkg|deepin-reader}}}}<br />
* {{App|DjView|Viewer for DjVu documents.|http://djvu.sourceforge.net/djview4.html|{{Pkg|djview}}}}<br />
* {{App|ePDFView|Lightweight PDF document viewer using the Poppler and GTK libraries. Development stopped.|http://freecode.com/projects/epdfview|{{Pkg|epdfview}}}}<br />
* {{App|[[Emacs]]|See also [https://github.com/politza/pdf-tools pdf-tools] for improved pdf support ({{AUR|emacs-pdf-tools-git}}) and the [https://elpa.gnu.org/packages/djvu.html djvu package] for djvu support.|https://www.gnu.org/software/emacs/|{{Pkg|emacs}}}}<br />
* {{App|[[Evince]]|Document viewer for GNOME. Supports DjVu, DVI, EPS, PDF, PostScript, TIFF, XPS and Comicbook.|https://wiki.gnome.org/Apps/Evince|{{Pkg|evince}}}}<br />
* {{App|[[Wikipedia:Foxit Reader|Foxit Reader]]|Small, fast (compared to Acrobat) proprietary PDF viewer. [https://forums.foxitsoftware.com/forum/portable-document-format-pdf-tools/foxit-reader/180532-linux-how-to-get-automatically-updates-for-foxit-reader-free-version?p&#61;180540#post180540 Discontinued for Linux].|https://www.foxitsoftware.com/pdf-reader/|{{AUR|foxitreader}}}}<br />
* {{App|gv|Graphical user interface for the Ghostscript interpreter that allows to view and navigate through PostScript and PDF documents.|https://www.gnu.org/software/gv/|{{Pkg|gv}}}}<br />
* {{App|[[llpp]]|Very fast PDF reader based off of MuPDF, that supports continuous page scrolling, bookmarking, and text search through the whole document.|https://repo.or.cz/w/llpp.git|{{Pkg|llpp}}}}<br />
* {{App|[[MuPDF]]|Very fast EPUB, FictionBook, PDF, XPS and Comicbook viewer written in portable C. Features CJK font support.|https://mupdf.com/|{{Pkg|mupdf}}}}<br />
* {{App|[[Wikipedia:Okular|Okular]]|Universal document viewer for KDE. Supports CHM, Comicbook, DjVu, DVI, EPUB, FictionBook, Mobipocket, ODT, PDF, Plucker, PostScript, TIFF and XPS.|https://okular.kde.org/|{{Pkg|okular}}}}<br />
* {{App|pdfpc|Presenter console with multi-monitor support for PDF files.|https://pdfpc.github.io/|{{Pkg|pdfpc}}}}<br />
* {{App|qpdfview|Tabbed document viewer. It uses Poppler for PDF support, libspectre for PS support, DjVuLibre for DjVu support, CUPS for printing support and the Qt toolkit for its interface.|https://launchpad.net/qpdfview|{{Pkg|qpdfview}}}}<br />
* {{App|[[Wikipedia:Xpdf|Xpdf]]|Viewer that can decode LZW and read encrypted PDFs.|https://www.xpdfreader.com/|{{Pkg|xpdf}}}}<br />
* {{App|Xreader|Document viewer part of the X-Apps Project. Supports DjVu, DVI, EPUB, PDF, PostScript, TIFF, XPS, Comicbook.|https://github.com/linuxmint/xreader/|{{Pkg|xreader}}}}<br />
* {{App|[[Zathura]]|Highly customizable and functional document viewer (plugin based). Supports PDF, DjVu, PostScript and Comicbook.|https://pwmt.org/projects/zathura/|{{Pkg|zathura}}}}<br />
<br />
==== Comparison ====<br />
<br />
{{Accuracy|Filling out PDF forms seem to be broken in MuPDF and llpp.}}<br />
<br />
Asterisk next to library denotes optional dependency needs to be installed for specified feature.<br />
<br />
{| class="wikitable sortable" style="text-align:center;"<br />
! Name !! PDF !! PostScript !! DjVu !! XPS !! PDF forms !! PDF Annotation !! License<br />
|-<br />
! [[Wikipedia:Adobe Reader|Adobe Reader]]<br />
| Custom || {{-}} || {{-}} || {{-}} || {{Yes}} || {{-}} || {{V|proprietary}}<br />
|-<br />
! apvlv<br />
| Poppler || {{-}} || DjVuLibre || {{-}} || {{No}} || {{-}} || {{B|GPLv2}}<br />
|-<br />
! Atril<br />
| Poppler || libspectre || DjVuLibre || libgxps || {{Yes}} || {{-}} || {{B|GPLv2}}<br />
|-<br />
! DjView<br />
| {{-}} || {{-}} || DjVuLibre || {{-}} || {{-}} || {{-}} || {{B|GPLv2}}<br />
|-<br />
! [[Emacs]]<br />
| colspan=2 | Ghostscript* || DjVuLibre* || {{-}} || {{No}} || {{Yes}} || {{B|GPLv3}}<br />
|-<br />
! ePDFView<br />
| Poppler || {{-}} || {{-}} || {{-}} || {{No}} || {{-}} || {{B|GPLv2}}<br />
|-<br />
! [[Evince]]<br />
| Poppler || libspectre || DjVuLibre || libgxps || {{Yes}} || {{Yes}} || {{B|GPLv2}}<br />
|-<br />
! [[Wikipedia:Foxit Reader|Foxit Reader]]<br />
| Custom || {{-}} || {{-}} || {{-}} || {{Yes}} || {{Yes}} || {{V|proprietary}}<br />
|-<br />
! gv<br />
| colspan=2 | Ghostscript || {{-}} || {{-}} || {{No}} || {{-}} || {{B|GPLv3}}<br />
|-<br />
! [[llpp]]<br />
| libmupdf || {{-}} || {{-}} || libmupdf || {{Yes}} || {{-}} || {{B|GPLv3}}<br />
|-<br />
! [[MuPDF]]<br />
| Custom || {{-}} || {{-}} || Custom || {{Yes}} || {{Yes}} || {{B|AGPLv3}}<br />
|-<br />
! [[Wikipedia:Okular|Okular]]<br />
| Poppler || libspectre || DjVuLibre || Custom || {{Yes}} || {{Yes}} || {{B|GPL, LGPL}}<br />
|-<br />
! pdfpc<br />
| Poppler || {{-}} || {{-}} || {{-}} || {{No}} || {{-}} || {{B|GPLv2}}<br />
|-<br />
! qpdfview<br />
| Poppler || libspectre* || DjVuLibre* || {{-}} || {{Yes}} || {{Yes}} || {{B|GPLv2}}<br />
|-<br />
! [[Wikipedia:Xpdf|Xpdf]]<br />
| Custom || {{-}} || {{-}} || {{-}} || {{No}} || {{-}} || {{B|GPLv3}}<br />
|-<br />
! Xreader<br />
| Poppler || libspectre* || DjVuLibre* || libgxps* || {{Yes}} || {{Yes}} || {{B|GPLv2}}<br />
|-<br />
! [[Zathura]]<br />
| Poppler* / libmupdf* || libspectre* || DjVuLibre* || libmupdf* || {{No|https://git.pwmt.org/pwmt/zathura/issues/101}} || {{-}} || {{B|zlib}}<br />
|}<br />
<br />
==== PDF forms ====<br />
<br />
The ''PDF forms'' column in the above table refers to [[Wikipedia:PDF#Forms|AcroForms]] support. If you do not need your input to be directly extractable from the PDF, you can also use the applications in [[#Annotation]] or [[#Graphical PDF editing]] to put text on top of a PDF. PDF forms can be created with [[LibreOffice|LibreOffice Writer]] (''View > Toolbars > Form Controls'') and the [[#Advanced editors|advanced PDF editors]].<br />
<br />
The proprietary and deprecated [[Wikipedia:XFA|XFA]] format for forms is not fully supported by Poppler[https://gitlab.freedesktop.org/poppler/poppler/issues/199][https://gitlab.freedesktop.org/poppler/poppler/issues/530] and only supported by [[#Graphical|Adobe Reader]] and [[#Advanced editors|Master PDF Editor]].<br />
<br />
Alternatively, web browsers such as [[Firefox]] or [[Chromium]] feature a built-in PDF viewer capable of filling out forms.<br />
<br />
== Annotation ==<br />
<br />
* {{App|flpsed|A PostScript and PDF annotator, only supports text boxes.|https://flpsed.org/flpsed.html|{{AUR|flpsed}}}}<br />
<br />
See also [[List of applications/Documents#Stylus note-taking]].<br />
<br />
== Graphical PDF editing ==<br />
<br />
* [[Scribus]] can import and export PDF; text is imported as polygons.[https://wiki.scribus.net/canvas/Importing_PDF_files_as_Vector_Graphics]<br />
* [[LibreOffice|LibreOffice Draw]] can import and export PDF; text is imported as text; embedded fonts are substituted.[https://bugs.documentfoundation.org/show_bug.cgi?id=82163][https://ask.libreoffice.org/en/question/38991/garbled-text-when-opening-pdfs-in-draw/]<br />
* [[Inkscape]] can import a single page from a PDF and export to PDF; text is imported as cloned glyphs or text; with the latter embedded fonts are substituted.<br />
* Graphics editors like [[GIMP]] and {{Pkg|krita}} can also import and export PDFs at the cost of [[Wikipedia:Raster graphics|rasterization]].<br />
<br />
=== Basic editors ===<br />
<br />
* {{App|jPDF Tweak|Java Swing application that can combine, split, rotate, reorder, watermark, encrypt, sign, and otherwise tweak PDF files.|http://jpdftweak.sourceforge.net/|{{AUR|jpdftweak}}}}<br />
* {{App|PDF Arranger|Helps merge or split pdf documents and rotate, crop and rearrange pages. It is a maintained fork of PDF-Shuffler.|https://github.com/jeromerobert/pdfarranger|{{Pkg|pdfarranger}}}}<br />
* {{App|PDF Chain|GTK front-end for [[#PDF tools|PDFtk]], written in C++, supporting concatenation, burst, watermarks, attaching files and more.|http://pdfchain.sourceforge.net/|{{AUR|pdfchain}}}}<br />
* {{App|PdfJumbler|Simple tool to rearrange, merge, delete and rotate pages in PDF files.|https://github.com/mgropp/pdfjumbler|{{AUR|pdfjumbler}}}}<br />
* {{App|PDF Mix Tool|Qt front-end for [[#Libraries|PoDoFo]], written in C++, supports splitting, merging, rotating and mixing PDF files.|https://scarpetta.eu/pdfmixtool/|{{Pkg|pdfmixtool}}}}<br />
* {{App|PDF Mod|Reorder, rotate, and remove pages, export images from a document, edit the title, subject, author, and keywords, and combine documents via drag and drop.|https://wiki.gnome.org/Attic/PdfMod|{{Pkg|pdfmod}}}}<br />
* {{App|PDFsam|Open source application, written in Java, supports merging, splitting and rotating.|https://pdfsam.org/|{{AUR|pdfsam}}}}<br />
* {{App|PDF Slicer|Simple application to extract, merge, rotate and reorder pages of PDF documents.|https://junrrein.github.io/pdfslicer/|{{Pkg|pdfslicer}}}}<br />
* {{App|PDF Tricks|Simple, efficient application for small manipulations in PDF files using Ghostscript.|https://github.com/muriloventuroso/pdftricks|{{Pkg|pdftricks}}}}<br />
<br />
=== Cropping tools ===<br />
<br />
* {{App|briss|Java GUI to crop pages of PDF documents to one or more regions selected.|https://sourceforge.net/projects/briss/|{{AUR|briss}}}}<br />
* {{App|krop|Simple graphical tool to crop the pages of PDF files.|https://arminstraub.com/software/krop|{{AUR|krop}}}}<br />
* {{App|pdfCropMargins|Automatically crops the margins of PDF files.|https://github.com/abarker/pdfCropMargins|{{AUR|pdfcropmargins}}}}<br />
* {{App|PdfHandoutCrop|Tool to crop pdf handout with multiple pages per sheet.|https://cges30901.github.io/pdfhandoutcrop/|{{AUR|pdfhandoutcrop}}}}<br />
<br />
=== Advanced editors ===<br />
<br />
* {{App|Master PDF Editor|Functional proprietary PDF editor. Latest version free for non-commercial use. The ''-free'' package is outdated but lacks a watermark.|https://code-industry.net/free-pdf-editor/|{{AUR|masterpdfeditor}}, {{AUR|masterpdfeditor-free}}}}<br />
* {{App|PDF Studio|All-in-one proprietary PDF editor similar to Adobe Acrobat.|https://www.qoppa.com/pdfstudio/|{{AUR|pdfstudio-bin}}}}<br />
<br />
== PDF tools ==<br />
<br />
See also [[#Engines|Ghostscript]].<br />
<br />
* {{App|Coherent PDF|Command line tools to manipulate PDF files including merge, encrypt, decrypt, scale, crop, rotate, bookmarks, stamp, logos, page numbers.|https://community.coherentpdf.com/|{{AUR|cpdf}}}}<br />
* {{App|DiffPDF|Compare the text or the visual appearance of each page in two PDF files.|https://gitlab.com/eang/diffpdf|{{Pkg|diffpdf}}}}<br />
* {{App|mupdf-tools|Tools developed as part of MuPDF, contains {{man|1|mutool}} and ''muraster''.|https://mupdf.com|{{Pkg|mupdf-tools}}}}<br />
* {{App|pdfgrep|Commandline utility to search text in PDF files.|https://pdfgrep.org/|{{Pkg|pdfgrep}}}}<br />
* {{App|pdfjam|Can be used to n-up, join, rotate and flip PDFs and arrange them into a format suitable for book binding.|https://github.com/DavidFirth/pdfjam|{{Pkg|texlive-core}}}}<br />
* {{App|pdf2svg|Convert PDF files to SVG files.|http://www.cityinthesky.co.uk/opensource/pdf2svg/|{{Pkg|pdf2svg}}}}<br />
* {{App|[[Wikipedia:PDFtk|PDFtk]]|Simple tool for doing everyday things with PDF documents.|https://gitlab.com/pdftk-java/pdftk|{{pkg|pdftk}}}}<br />
* {{App|[[Wikipedia:QPDF|QPDF]]|Content-preserving PDF transformation system.|https://github.com/qpdf/qpdf|{{Pkg|qpdf}}}}<br />
* {{App|Stapler|Light alternative to PDFtk using the [[#Python|PyPDF2]] library.|https://github.com/hellerbarde/stapler|{{AUR|stapler}}, {{AUR|stapler-git}}}}<br />
<br />
=== Create a PDF from images ===<br />
<br />
With [[GraphicsMagick]]:<br />
<br />
$ gm convert 1.jpg 2.jpg 3.jpg out.pdf<br />
<br />
=== Concatenate PDFs ===<br />
<br />
With Ghostscript:<br />
<br />
$ gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=out.pdf -dBATCH 1.pdf 2.pdf 3.pdf<br />
<br />
With PDFtk:<br />
<br />
$ pdftk 1.pdf 2.pdf 3.pdf cat output out.pdf<br />
<br />
With Poppler:<br />
<br />
$ pdfunite 1.pdf 2.pdf 3.pdf out.pdf<br />
<br />
With QPDF:<br />
<br />
$ qpdf --empty --pages 1.pdf 2.pdf 3.pdf -- out.pdf<br />
<br />
=== Convert a PDF to text ===<br />
<br />
With Poppler and maintaining the layout:<br />
<br />
$ pdftotext -layout in.pdf out.txt<br />
<br />
See also {{man|1|pdftotext}}.<br />
<br />
=== Decrypt a PDF ===<br />
<br />
This section lists commands to decrypt a PDF to an unencrypted file. Note that most [[#Viewers|PDF viewers]] also support encrypted PDFs.<br />
<br />
With PDFtk:<br />
<br />
$ pdftk in.pdf input_pw ''password'' output out.pdf<br />
<br />
With Poppler to PostScript:<br />
<br />
$ pdftops -upw ''password'' in.pdf out.ps<br />
<br />
With QPDF:<br />
<br />
$ qpdf --decrypt --password=''password'' in.pdf out.pdf<br />
<br />
{{Tip|Forgotten passwords might be recovered with {{Pkg|pdfcrack}}, see {{man|1|pdfcrack}}.}}<br />
<br />
=== Encrypt a PDF ===<br />
<br />
The ''user password'' is used for encryption, the ''owner password'' to restrict operations once the document is decrypted, for more information, see [[Wikipedia:PDF#Security and signatures]].<br />
<br />
With PDFtk:<br />
<br />
$ pdftk in.pdf output out.pdf user_pw ''password''<br />
<br />
With [[#Libraries|PoDoFo]]:<br />
<br />
$ podofoencrypt -u ''user_password'' -o ''owner_password'' in.pdf out.pdf<br />
<br />
With QPDF:<br />
<br />
$ qpdf --encrypt ''user_password'' ''owner_password'' ''key_length'' -- in.pdf out.pdf<br />
<br />
where {{ic|''key_length''}} can be 40, 128 or 256.<br />
<br />
=== Extract images from a PDF ===<br />
<br />
With Poppler to JPEG:<br />
<br />
$ pdfimages ''infile''.pdf -j ''outfileroot''<br />
<br />
=== Extract page range from PDF, split multipage PDF document ===<br />
<br />
With Ghostscript as a single file[https://forums.freebsd.org/threads/split-pdf-file.58902/#post-336971]<br />
<br />
$ gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -dFirstPage=''first'' -dLastPage=''last'' -sOutputFile=''outfile''.pdf ''infile''.pdf<br />
<br />
With PDFtk as a single file:<br />
<br />
$ pdftk ''infile''.pdf cat ''first''-''last'' output ''outfile''.pdf<br />
<br />
With Poppler as separate files:<br />
<br />
$ pdfseparate -f ''first'' -l ''last'' ''infile''.pdf ''outfileroot''-%d.pdf<br />
<br />
With QPDF as a single file:<br />
<br />
$ qpdf --empty --pages ''infile''.pdf ''first''-''last'' -- ''outfile''.pdf<br />
<br />
With mutool as a single file:<br />
<br />
$ mutool clean -g ''infile''.pdf ''outfile''.pdf ''first''-''last''<br />
<br />
=== Imposing a PDF (combine multiple pages to one page) ===<br />
<br />
PDF [[Wikipedia:Imposition|Imposition]] can be done with [[#PDF tools|pdfjam]], for example paper waste can be reduced with ''pdfnup'' and ''pdfbook'' can be used to arrange PDFs into a format suitable for book binding.<br />
<br />
=== Inspecting metadata ===<br />
<br />
With [[ExifTool]]:<br />
<br />
$ exiftool file.pdf<br />
<br />
With Poppler:<br />
<br />
$ pdfinfo file.pdf<br />
<br />
=== Optimize, reduce size of a PDF ===<br />
<br />
With Ghostscript one of:<br />
<br />
$ ps2pdf -dPDFSETTINGS=/screen in.pdf out.pdf<br />
$ gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -sOutputFile=out.pdf in.pdf<br />
<br />
For different settings see the [https://www.ghostscript.com/doc/VectorDevices.htm#PSPDF_IN documentation].<br />
<br />
There is also {{AUR|shrinkpdf}}, a script wrapping gs.<br />
<br />
=== Rasterize a PDF ===<br />
<br />
With [[GraphicsMagick]] to convert a specific page:<br />
<br />
$ gm convert -density ''dpi'' ''infile''.pdf[''page''] ''outfile''.jpg<br />
<br />
With Poppler to convert all pages:<br />
<br />
$ pdftoppm -jpeg -r ''dpi'' ''infile''.pdf ''outfileroot''<br />
<br />
With Poppler to convert a specific page:<br />
<br />
$ pdftoppm -jpeg -r ''dpi'' -f ''page'' -singlefile ''infile''.pdf ''outfileroot''<br />
<br />
=== Splitting PDF pages ===<br />
<br />
With mupdf-tools to split every page vertically into two pages:<br />
<br />
$ mutool poster -y 2 in.pdf out.pdf<br />
<br />
Can be used to undo simple [[#Imposing a PDF (combine multiple pages to one page)|imposition]].<br />
<br />
=== Add signature.png or image to one of the pages in the PDF ===<br />
<br />
To add an image to any location in PDF can be done with [[ImageMagick]] (convert), xv and pdftk. A wrapper script is [http://emmanuel.branlard.free.fr/work/linux/dev/SignPDF/SignPDF here] and other hints are [https://unix.stackexchange.com/questions/85873/how-can-i-add-a-signature-png-to-a-pdf-in-linux here].<br />
<br />
=== Removing annotations from a PDF ===<br />
<br />
With {{AUR|perl-cam-pdf}}:<br />
<br />
$ rewritepdf.pl -C in.pdf out.pdf<br />
<br />
See https://superuser.com/a/1051543 for more information.<br />
<br />
== DjVu tools ==<br />
<br />
* [[#Engines|DjVuLibre]] provides many command-line tools, like {{man|1|ddjvu}} for example.<br />
* {{App|img2djvu|Single-pass DjVu encoder based on DjVu Libre and ImageMagick.|https://github.com/ashipunov/img2djvu|{{AUR|img2djvu-git}}}}<br />
* {{App|pdf2djvu|Creates DjVu files from PDF files.|https://jwilk.net/software/pdf2djvu|{{AUR|pdf2djvu}}}}<br />
<br />
=== Convert DjVu to images ===<br />
<br />
Break Djvu into separate pages:<br />
<br />
$ djvmcvt -i input.djvu /path/to/out/dir output-index.djvu<br />
<br />
Convert Djvu pages into images:<br />
<br />
$ ddjvu --format=tiff page.djvu page.tiff<br />
<br />
Convert Djvu pages into PDF:<br />
<br />
$ ddjvu --format=pdf inputfile.djvu ouputfile.pdf<br />
<br />
You can also use ''--page'' to export specific pages:<br />
<br />
$ ddjvu --format=tiff --page=1-10 input.djvu output.tiff<br />
<br />
this will convert pages from 1 to 10 into one tiff file.<br />
<br />
=== Processing images ===<br />
<br />
You can use {{Pkg|scantailor-advanced}} to:<br />
<br />
* fix orientation<br />
* split pages<br />
* deskew<br />
* crop<br />
* adjust margins<br />
<br />
=== Make DjVu from images ===<br />
<br />
There is a useful script {{AUR|img2djvu-git}}.<br />
<br />
$ img2djvu -c1 -d600 -v1 ./out<br />
<br />
it will create 600 DPI {{ic|out.djvu}} from all files in {{ic|./out}} directory.<br />
<br />
Alternatively, you can try {{AUR|didjvu}}, which seems to create smaller files especially on images with well defined background.<br />
<br />
== PostScript tools ==<br />
<br />
* {{App|pstotext|Converts PostScript files to text.|https://www.cs.wisc.edu/~ghost/doc/pstotext.htm|{{Pkg|pstotext}}}}<br />
* [[#Engines|Ghostscript]]<br />
<br />
=== ps2pdf ===<br />
<br />
''ps2pdf'' is a wrapper around ghostscript to convert PostScript to PDF:<br />
<br />
$ ps2pdf -sPAPERSIZE=a4 -dOptimize=true -dEmbedAllFonts=true YourPSFile.ps<br />
<br />
Explanation:<br />
<br />
* with {{ic|1=-sPAPERSIZE=something}} you define the paper size. For valid PAPERSIZE values, see [https://ghostscript.com/doc/current/Use.htm#Known_paper_sizes].<br />
* {{ic|1=-dOptimize=true}} lets the created PDF be optimised for loading.<br />
* {{ic|1=-dEmbedAllFonts=true}} makes the fonts look always nice.<br />
<br />
{{Note|You cannot choose the paper orientation in ps2pdf. If your input PS file is healthy, it already contains the orientation information. If you are trying to use an Encapsulated PS file, you will have problems, if it does not fit in the {{ic|1=-sPAPERSIZE}} you specified, because EPS files usually do not contain paper orientation information. A workaround is creating a new paper in ghostscript settings (call it e.g. "slide") and use it as {{ic|1=-sPAPERSIZE=slide}}.}}<br />
<br />
== Libraries ==<br />
<br />
* {{App|libharu|C library for generating PDF documents.|https://github.com/libharu/libharu|{{Pkg|libharu}}, Lua binding: {{AUR|lua-hpdf}}}}<br />
* {{App|PoDoFo|A C++ library to work with the PDF file format.|http://podofo.sourceforge.net|{{Pkg|podofo}}}}<br />
<br />
=== Python ===<br />
<br />
* {{App|PDFMiner|Utils to extract, analyze text data of PDF files. Includes pdf2txt, dumppdf, and latin2ascii|https://www.unixuser.org/~euske/python/pdfminer/|{{Pkg|python-pdfminer}}, {{AUR|pdfminer}}}}<br />
* {{App|pdfrw|A pure Python library that reads and writes PDFs.|https://github.com/pmaupin/pdfrw|{{Pkg|python-pdfrw}}, {{AUR|python2-pdfrw}}}}<br />
* {{App|PyPDF2|A pure-Python library built as a PDF toolkit.|https://mstamy2.github.io/PyPDF2/|{{AUR|python-pypdf2}}, {{AUR|python2-pypdf2}}}}<br />
* {{App|PyX|Python library for the creation of PostScript and PDF files.|http://pyx.sourceforge.net|{{Pkg|python-pyx}}}}<br />
* {{App|ReportLab|A proven industry-strength PDF generating solution|https://www.reportlab.com/|{{Pkg|python-reportlab}}, {{AUR|python2-reportlab}}}}<br />
<br />
== See also ==<br />
<br />
* [[List of applications/Documents#Readers and viewers]]<br />
* [[List of applications/Documents#OCR software]]<br />
* [[Wikipedia:List of PDF software]]<br />
* PDF References<br />
** [https://web.archive.org/web/20210116133007/https://www.adobe.com/devnet/pdf/pdf_reference.html PDF Reference and Adobe Extensions to the PDF Specification]<br />
** [[Wikipedia:PDF#Further reading]]</div>Lesmanahttps://wiki.archlinux.org/index.php?title=PDF,_PS_and_DjVu&diff=699205PDF, PS and DjVu2021-10-15T09:37:39Z<p>Lesmana: /* Imposing a PDF */ state common use case of imposing</p>
<hr />
<div>[[Category:Applications]]<br />
[[Category:File formats]]<br />
[[Category:Lists of software]]<br />
[[Category:Software comparisons]]<br />
[[es:PDF, PS and DjVu]]<br />
This article covers software to view, edit and convert [[Wikipedia:PDF|PDF]], [[Wikipedia:PostScript|PostScript]] (PS), [[Wikipedia:DjVu|DjVu]] (''déjà vu'') and [[Wikipedia:Open XML Paper Specification|XPS]] files.<br />
<br />
== Engines ==<br />
<br />
* {{App|[[Wikipedia:Poppler (software)|Poppler]]|PDF rendering library based on Xpdf. For CJK (Chinese, Japanese, Korean) support with Poppler, [[install]] {{Pkg|poppler-data}}.|https://poppler.freedesktop.org/|{{Pkg|poppler}}}}<br />
* {{App|[[Wikipedia:MuPDF|Mupdf]]| MuPDF is a lightweight PDF, XPS, and EPUB viewer, consisting of a software library, command line tools, and viewers.|https://mupdf.com/|{{Pkg|libmupdf}}}}<br />
* {{App|libspectre|Small library for rendering Postscript documents.|https://www.freedesktop.org/wiki/Software/libspectre|{{Pkg|libspectre}}}}<br />
* {{App|[[Wikipedia:Ghostscript|Ghostscript]]|Interpreter for PostScript and PDF. Provides the {{man|1|gs}} command-line interface, see also {{ic|/usr/share/doc/ghostscript/*/Use.htm}} ([https://ghostscript.com/doc/current/Use.htm online]), along with many wrapper scripts like ''ps2pdf'' and ''pdf2ps''.|https://ghostscript.com/|{{Pkg|ghostscript}}}}<br />
* {{App|DjVuLibre|Suite to create, manipulate and view DjVu documents.|http://djvu.sourceforge.net/|{{Pkg|djvulibre}}}}<br />
* {{App|libgxps|GObject based library for handling and rendering XPS documents.|https://wiki.gnome.org/Projects/libgxps|{{Pkg|libgxps}}}}<br />
<br />
== Viewers ==<br />
<br />
=== Framebuffer ===<br />
<br />
* {{App|fbgs|Poor man's PostScript/pdf viewer for the linux framebuffer console.|https://www.kraxel.org/blog/linux/fbida/|{{Pkg|fbida}}}}<br />
* {{App|fbpdf|Small framebuffer PDF and DjVu viewer based on MuPDF, with [[Vim]] keybindings and written in C|https://repo.or.cz/w/fbpdf.git|{{AUR|fbpdf-git}}}}<br />
* {{App|jfbview|Framebuffer PDF and image viewer. Features include Vim-like controls, zoom-to-fit, a TOC (outline) view and fast multi-threaded rendering.|https://github.com/jichu4n/jfbview|{{AUR|jfbview}}}}<br />
<br />
=== Graphical ===<br />
<br />
{{Note|Some [[web browser]]s can display PDF files, for example with [https://github.com/mozilla/pdf.js PDF.js].}}<br />
<br />
* {{App|[[Wikipedia:Adobe Reader|Adobe Reader]]|Proprietary PDF file viewer offered by Adobe. Discontinued for Linux.|https://www.adobe.com/products/reader.html|{{AUR|acroread}}}}<br />
* {{App|apvlv|Lightweight document viewer with [[Vim]] keybindings. Supports PDF, DjVu, EPUB, HTML and TXT.|https://naihe2010.github.io/apvlv/|{{AUR|apvlv}}}}<br />
* {{App|Atril|Simple multi-page document viewer for MATE. Supports DjVu, DVI, EPS, EPUB, PDF, PostScript, TIFF, XPS and Comicbook.|https://github.com/mate-desktop/atril|{{Pkg|atril}}}}<br />
* {{App|CorePDF|Simple lightweight PDF viewer based on Qt and poppler. Part of C-Suite.|https://cubocore.org/|{{AUR|corepdf}}}}<br />
* {{App|Deepin Document Viewer|A simple PDF and DjVu reader, supporting bookmarks, highlights and annotations.|https://github.com/linuxdeepin/deepin-reader|{{Pkg|deepin-reader}}}}<br />
* {{App|DjView|Viewer for DjVu documents.|http://djvu.sourceforge.net/djview4.html|{{Pkg|djview}}}}<br />
* {{App|ePDFView|Lightweight PDF document viewer using the Poppler and GTK libraries. Development stopped.|http://freecode.com/projects/epdfview|{{Pkg|epdfview}}}}<br />
* {{App|[[Emacs]]|See also [https://github.com/politza/pdf-tools pdf-tools] for improved pdf support ({{AUR|emacs-pdf-tools-git}}) and the [https://elpa.gnu.org/packages/djvu.html djvu package] for djvu support.|https://www.gnu.org/software/emacs/|{{Pkg|emacs}}}}<br />
* {{App|[[Evince]]|Document viewer for GNOME. Supports DjVu, DVI, EPS, PDF, PostScript, TIFF, XPS and Comicbook.|https://wiki.gnome.org/Apps/Evince|{{Pkg|evince}}}}<br />
* {{App|[[Wikipedia:Foxit Reader|Foxit Reader]]|Small, fast (compared to Acrobat) proprietary PDF viewer. [https://forums.foxitsoftware.com/forum/portable-document-format-pdf-tools/foxit-reader/180532-linux-how-to-get-automatically-updates-for-foxit-reader-free-version?p&#61;180540#post180540 Discontinued for Linux].|https://www.foxitsoftware.com/pdf-reader/|{{AUR|foxitreader}}}}<br />
* {{App|gv|Graphical user interface for the Ghostscript interpreter that allows to view and navigate through PostScript and PDF documents.|https://www.gnu.org/software/gv/|{{Pkg|gv}}}}<br />
* {{App|[[llpp]]|Very fast PDF reader based off of MuPDF, that supports continuous page scrolling, bookmarking, and text search through the whole document.|https://repo.or.cz/w/llpp.git|{{Pkg|llpp}}}}<br />
* {{App|[[MuPDF]]|Very fast EPUB, FictionBook, PDF, XPS and Comicbook viewer written in portable C. Features CJK font support.|https://mupdf.com/|{{Pkg|mupdf}}}}<br />
* {{App|[[Wikipedia:Okular|Okular]]|Universal document viewer for KDE. Supports CHM, Comicbook, DjVu, DVI, EPUB, FictionBook, Mobipocket, ODT, PDF, Plucker, PostScript, TIFF and XPS.|https://okular.kde.org/|{{Pkg|okular}}}}<br />
* {{App|pdfpc|Presenter console with multi-monitor support for PDF files.|https://pdfpc.github.io/|{{Pkg|pdfpc}}}}<br />
* {{App|qpdfview|Tabbed document viewer. It uses Poppler for PDF support, libspectre for PS support, DjVuLibre for DjVu support, CUPS for printing support and the Qt toolkit for its interface.|https://launchpad.net/qpdfview|{{Pkg|qpdfview}}}}<br />
* {{App|[[Wikipedia:Xpdf|Xpdf]]|Viewer that can decode LZW and read encrypted PDFs.|https://www.xpdfreader.com/|{{Pkg|xpdf}}}}<br />
* {{App|Xreader|Document viewer part of the X-Apps Project. Supports DjVu, DVI, EPUB, PDF, PostScript, TIFF, XPS, Comicbook.|https://github.com/linuxmint/xreader/|{{Pkg|xreader}}}}<br />
* {{App|[[Zathura]]|Highly customizable and functional document viewer (plugin based). Supports PDF, DjVu, PostScript and Comicbook.|https://pwmt.org/projects/zathura/|{{Pkg|zathura}}}}<br />
<br />
==== Comparison ====<br />
<br />
{{Accuracy|Filling out PDF forms seem to be broken in MuPDF and llpp.}}<br />
<br />
Asterisk next to library denotes optional dependency needs to be installed for specified feature.<br />
<br />
{| class="wikitable sortable" style="text-align:center;"<br />
! Name !! PDF !! PostScript !! DjVu !! XPS !! PDF forms !! PDF Annotation !! License<br />
|-<br />
! [[Wikipedia:Adobe Reader|Adobe Reader]]<br />
| Custom || {{-}} || {{-}} || {{-}} || {{Yes}} || {{-}} || {{V|proprietary}}<br />
|-<br />
! apvlv<br />
| Poppler || {{-}} || DjVuLibre || {{-}} || {{No}} || {{-}} || {{B|GPLv2}}<br />
|-<br />
! Atril<br />
| Poppler || libspectre || DjVuLibre || libgxps || {{Yes}} || {{-}} || {{B|GPLv2}}<br />
|-<br />
! DjView<br />
| {{-}} || {{-}} || DjVuLibre || {{-}} || {{-}} || {{-}} || {{B|GPLv2}}<br />
|-<br />
! [[Emacs]]<br />
| colspan=2 | Ghostscript* || DjVuLibre* || {{-}} || {{No}} || {{Yes}} || {{B|GPLv3}}<br />
|-<br />
! ePDFView<br />
| Poppler || {{-}} || {{-}} || {{-}} || {{No}} || {{-}} || {{B|GPLv2}}<br />
|-<br />
! [[Evince]]<br />
| Poppler || libspectre || DjVuLibre || libgxps || {{Yes}} || {{Yes}} || {{B|GPLv2}}<br />
|-<br />
! [[Wikipedia:Foxit Reader|Foxit Reader]]<br />
| Custom || {{-}} || {{-}} || {{-}} || {{Yes}} || {{Yes}} || {{V|proprietary}}<br />
|-<br />
! gv<br />
| colspan=2 | Ghostscript || {{-}} || {{-}} || {{No}} || {{-}} || {{B|GPLv3}}<br />
|-<br />
! [[llpp]]<br />
| libmupdf || {{-}} || {{-}} || libmupdf || {{Yes}} || {{-}} || {{B|GPLv3}}<br />
|-<br />
! [[MuPDF]]<br />
| Custom || {{-}} || {{-}} || Custom || {{Yes}} || {{Yes}} || {{B|AGPLv3}}<br />
|-<br />
! [[Wikipedia:Okular|Okular]]<br />
| Poppler || libspectre || DjVuLibre || Custom || {{Yes}} || {{Yes}} || {{B|GPL, LGPL}}<br />
|-<br />
! pdfpc<br />
| Poppler || {{-}} || {{-}} || {{-}} || {{No}} || {{-}} || {{B|GPLv2}}<br />
|-<br />
! qpdfview<br />
| Poppler || libspectre* || DjVuLibre* || {{-}} || {{Yes}} || {{Yes}} || {{B|GPLv2}}<br />
|-<br />
! [[Wikipedia:Xpdf|Xpdf]]<br />
| Custom || {{-}} || {{-}} || {{-}} || {{No}} || {{-}} || {{B|GPLv3}}<br />
|-<br />
! Xreader<br />
| Poppler || libspectre* || DjVuLibre* || libgxps* || {{Yes}} || {{Yes}} || {{B|GPLv2}}<br />
|-<br />
! [[Zathura]]<br />
| Poppler* / libmupdf* || libspectre* || DjVuLibre* || libmupdf* || {{No|https://git.pwmt.org/pwmt/zathura/issues/101}} || {{-}} || {{B|zlib}}<br />
|}<br />
<br />
==== PDF forms ====<br />
<br />
The ''PDF forms'' column in the above table refers to [[Wikipedia:PDF#Forms|AcroForms]] support. If you do not need your input to be directly extractable from the PDF, you can also use the applications in [[#Annotation]] or [[#Graphical PDF editing]] to put text on top of a PDF. PDF forms can be created with [[LibreOffice|LibreOffice Writer]] (''View > Toolbars > Form Controls'') and the [[#Advanced editors|advanced PDF editors]].<br />
<br />
The proprietary and deprecated [[Wikipedia:XFA|XFA]] format for forms is not fully supported by Poppler[https://gitlab.freedesktop.org/poppler/poppler/issues/199][https://gitlab.freedesktop.org/poppler/poppler/issues/530] and only supported by [[#Graphical|Adobe Reader]] and [[#Advanced editors|Master PDF Editor]].<br />
<br />
Alternatively, web browsers such as [[Firefox]] or [[Chromium]] feature a built-in PDF viewer capable of filling out forms.<br />
<br />
== Annotation ==<br />
<br />
* {{App|flpsed|A PostScript and PDF annotator, only supports text boxes.|https://flpsed.org/flpsed.html|{{AUR|flpsed}}}}<br />
<br />
See also [[List of applications/Documents#Stylus note-taking]].<br />
<br />
== Graphical PDF editing ==<br />
<br />
* [[Scribus]] can import and export PDF; text is imported as polygons.[https://wiki.scribus.net/canvas/Importing_PDF_files_as_Vector_Graphics]<br />
* [[LibreOffice|LibreOffice Draw]] can import and export PDF; text is imported as text; embedded fonts are substituted.[https://bugs.documentfoundation.org/show_bug.cgi?id=82163][https://ask.libreoffice.org/en/question/38991/garbled-text-when-opening-pdfs-in-draw/]<br />
* [[Inkscape]] can import a single page from a PDF and export to PDF; text is imported as cloned glyphs or text; with the latter embedded fonts are substituted.<br />
* Graphics editors like [[GIMP]] and {{Pkg|krita}} can also import and export PDFs at the cost of [[Wikipedia:Raster graphics|rasterization]].<br />
<br />
=== Basic editors ===<br />
<br />
* {{App|jPDF Tweak|Java Swing application that can combine, split, rotate, reorder, watermark, encrypt, sign, and otherwise tweak PDF files.|http://jpdftweak.sourceforge.net/|{{AUR|jpdftweak}}}}<br />
* {{App|PDF Arranger|Helps merge or split pdf documents and rotate, crop and rearrange pages. It is a maintained fork of PDF-Shuffler.|https://github.com/jeromerobert/pdfarranger|{{Pkg|pdfarranger}}}}<br />
* {{App|PDF Chain|GTK front-end for [[#PDF tools|PDFtk]], written in C++, supporting concatenation, burst, watermarks, attaching files and more.|http://pdfchain.sourceforge.net/|{{AUR|pdfchain}}}}<br />
* {{App|PdfJumbler|Simple tool to rearrange, merge, delete and rotate pages in PDF files.|https://github.com/mgropp/pdfjumbler|{{AUR|pdfjumbler}}}}<br />
* {{App|PDF Mix Tool|Qt front-end for [[#Libraries|PoDoFo]], written in C++, supports splitting, merging, rotating and mixing PDF files.|https://scarpetta.eu/pdfmixtool/|{{Pkg|pdfmixtool}}}}<br />
* {{App|PDF Mod|Reorder, rotate, and remove pages, export images from a document, edit the title, subject, author, and keywords, and combine documents via drag and drop.|https://wiki.gnome.org/Attic/PdfMod|{{Pkg|pdfmod}}}}<br />
* {{App|PDFsam|Open source application, written in Java, supports merging, splitting and rotating.|https://pdfsam.org/|{{AUR|pdfsam}}}}<br />
* {{App|PDF Slicer|Simple application to extract, merge, rotate and reorder pages of PDF documents.|https://junrrein.github.io/pdfslicer/|{{Pkg|pdfslicer}}}}<br />
* {{App|PDF Tricks|Simple, efficient application for small manipulations in PDF files using Ghostscript.|https://github.com/muriloventuroso/pdftricks|{{Pkg|pdftricks}}}}<br />
<br />
=== Cropping tools ===<br />
<br />
* {{App|briss|Java GUI to crop pages of PDF documents to one or more regions selected.|https://sourceforge.net/projects/briss/|{{AUR|briss}}}}<br />
* {{App|krop|Simple graphical tool to crop the pages of PDF files.|https://arminstraub.com/software/krop|{{AUR|krop}}}}<br />
* {{App|pdfCropMargins|Automatically crops the margins of PDF files.|https://github.com/abarker/pdfCropMargins|{{AUR|pdfcropmargins}}}}<br />
* {{App|PdfHandoutCrop|Tool to crop pdf handout with multiple pages per sheet.|https://cges30901.github.io/pdfhandoutcrop/|{{AUR|pdfhandoutcrop}}}}<br />
<br />
=== Advanced editors ===<br />
<br />
* {{App|Master PDF Editor|Functional proprietary PDF editor. Latest version free for non-commercial use. The ''-free'' package is outdated but lacks a watermark.|https://code-industry.net/free-pdf-editor/|{{AUR|masterpdfeditor}}, {{AUR|masterpdfeditor-free}}}}<br />
* {{App|PDF Studio|All-in-one proprietary PDF editor similar to Adobe Acrobat.|https://www.qoppa.com/pdfstudio/|{{AUR|pdfstudio-bin}}}}<br />
<br />
== PDF tools ==<br />
<br />
See also [[#Engines|Ghostscript]].<br />
<br />
* {{App|Coherent PDF|Command line tools to manipulate PDF files including merge, encrypt, decrypt, scale, crop, rotate, bookmarks, stamp, logos, page numbers.|https://community.coherentpdf.com/|{{AUR|cpdf}}}}<br />
* {{App|DiffPDF|Compare the text or the visual appearance of each page in two PDF files.|https://gitlab.com/eang/diffpdf|{{Pkg|diffpdf}}}}<br />
* {{App|mupdf-tools|Tools developed as part of MuPDF, contains {{man|1|mutool}} and ''muraster''.|https://mupdf.com|{{Pkg|mupdf-tools}}}}<br />
* {{App|pdfgrep|Commandline utility to search text in PDF files.|https://pdfgrep.org/|{{Pkg|pdfgrep}}}}<br />
* {{App|pdfjam|Can be used to n-up, join, rotate and flip PDFs and arrange them into a format suitable for book binding.|https://github.com/DavidFirth/pdfjam|{{Pkg|texlive-core}}}}<br />
* {{App|pdf2svg|Convert PDF files to SVG files.|http://www.cityinthesky.co.uk/opensource/pdf2svg/|{{Pkg|pdf2svg}}}}<br />
* {{App|[[Wikipedia:PDFtk|PDFtk]]|Simple tool for doing everyday things with PDF documents.|https://gitlab.com/pdftk-java/pdftk|{{pkg|pdftk}}}}<br />
* {{App|[[Wikipedia:QPDF|QPDF]]|Content-preserving PDF transformation system.|https://github.com/qpdf/qpdf|{{Pkg|qpdf}}}}<br />
* {{App|Stapler|Light alternative to PDFtk using the [[#Python|PyPDF2]] library.|https://github.com/hellerbarde/stapler|{{AUR|stapler}}, {{AUR|stapler-git}}}}<br />
<br />
=== Create a PDF from images ===<br />
<br />
With [[GraphicsMagick]]:<br />
<br />
$ gm convert 1.jpg 2.jpg 3.jpg out.pdf<br />
<br />
=== Concatenate PDFs ===<br />
<br />
With Ghostscript:<br />
<br />
$ gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=out.pdf -dBATCH 1.pdf 2.pdf 3.pdf<br />
<br />
With PDFtk:<br />
<br />
$ pdftk 1.pdf 2.pdf 3.pdf cat output out.pdf<br />
<br />
With Poppler:<br />
<br />
$ pdfunite 1.pdf 2.pdf 3.pdf out.pdf<br />
<br />
With QPDF:<br />
<br />
$ qpdf --empty --pages 1.pdf 2.pdf 3.pdf -- out.pdf<br />
<br />
=== Convert a PDF to text ===<br />
<br />
With Poppler and maintaining the layout:<br />
<br />
$ pdftotext -layout in.pdf out.txt<br />
<br />
See also {{man|1|pdftotext}}.<br />
<br />
=== Decrypt a PDF ===<br />
<br />
This section lists commands to decrypt a PDF to an unencrypted file. Note that most [[#Viewers|PDF viewers]] also support encrypted PDFs.<br />
<br />
With PDFtk:<br />
<br />
$ pdftk in.pdf input_pw ''password'' output out.pdf<br />
<br />
With Poppler to PostScript:<br />
<br />
$ pdftops -upw ''password'' in.pdf out.ps<br />
<br />
With QPDF:<br />
<br />
$ qpdf --decrypt --password=''password'' in.pdf out.pdf<br />
<br />
{{Tip|Forgotten passwords might be recovered with {{Pkg|pdfcrack}}, see {{man|1|pdfcrack}}.}}<br />
<br />
=== Encrypt a PDF ===<br />
<br />
The ''user password'' is used for encryption, the ''owner password'' to restrict operations once the document is decrypted, for more information, see [[Wikipedia:PDF#Security and signatures]].<br />
<br />
With PDFtk:<br />
<br />
$ pdftk in.pdf output out.pdf user_pw ''password''<br />
<br />
With [[#Libraries|PoDoFo]]:<br />
<br />
$ podofoencrypt -u ''user_password'' -o ''owner_password'' in.pdf out.pdf<br />
<br />
With QPDF:<br />
<br />
$ qpdf --encrypt ''user_password'' ''owner_password'' ''key_length'' -- in.pdf out.pdf<br />
<br />
where {{ic|''key_length''}} can be 40, 128 or 256.<br />
<br />
=== Extract images from a PDF ===<br />
<br />
With Poppler to JPEG:<br />
<br />
$ pdfimages ''infile''.pdf -j ''outfileroot''<br />
<br />
=== Extract page range from PDF, split multipage PDF document ===<br />
<br />
With Ghostscript as a single file[https://forums.freebsd.org/threads/split-pdf-file.58902/#post-336971]<br />
<br />
$ gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -dFirstPage=''first'' -dLastPage=''last'' -sOutputFile=''outfile''.pdf ''infile''.pdf<br />
<br />
With PDFtk as a single file:<br />
<br />
$ pdftk ''infile''.pdf cat ''first''-''last'' output ''outfile''.pdf<br />
<br />
With Poppler as separate files:<br />
<br />
$ pdfseparate -f ''first'' -l ''last'' ''infile''.pdf ''outfileroot''-%d.pdf<br />
<br />
With QPDF as a single file:<br />
<br />
$ qpdf --empty --pages ''infile''.pdf ''first''-''last'' -- ''outfile''.pdf<br />
<br />
With mutool as a single file:<br />
<br />
$ mutool clean -g ''infile''.pdf ''outfile''.pdf ''first''-''last''<br />
<br />
=== Imposing a PDF (combine multiple pages to one page) ===<br />
<br />
PDF [[Wikipedia:Imposition|Imposition]] can be done with [[#PDF tools|pdfjam]], for example paper waste can be reduced with ''pdfnup'' and ''pdfbook'' can be used to arrange PDFs into a format suitable for book binding.<br />
<br />
=== Inspecting metadata ===<br />
<br />
With [[ExifTool]]:<br />
<br />
$ exiftool file.pdf<br />
<br />
With Poppler:<br />
<br />
$ pdfinfo file.pdf<br />
<br />
=== Optimize, reduce size of a PDF ===<br />
<br />
With Ghostscript one of:<br />
<br />
$ ps2pdf -dPDFSETTINGS=/screen in.pdf out.pdf<br />
$ gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -sOutputFile=out.pdf in.pdf<br />
<br />
For different settings see the [https://www.ghostscript.com/doc/VectorDevices.htm#PSPDF_IN documentation].<br />
<br />
There is also {{AUR|shrinkpdf}}, a script wrapping gs.<br />
<br />
=== Rasterize a PDF ===<br />
<br />
With [[GraphicsMagick]] to convert a specific page:<br />
<br />
$ gm convert -density ''dpi'' ''infile''.pdf[''page''] ''outfile''.jpg<br />
<br />
With Poppler to convert all pages:<br />
<br />
$ pdftoppm -jpeg -r ''dpi'' ''infile''.pdf ''outfileroot''<br />
<br />
With Poppler to convert a specific page:<br />
<br />
$ pdftoppm -jpeg -r ''dpi'' -f ''page'' -singlefile ''infile''.pdf ''outfileroot''<br />
<br />
=== Splitting PDF pages ===<br />
<br />
With mupdf-tools to split every page vertically into two pages:<br />
<br />
$ mutool poster -y 2 in.pdf out.pdf<br />
<br />
Can be used to undo simple [[#Imposing a PDF|imposition]].<br />
<br />
=== Add signature.png or image to one of the pages in the PDF ===<br />
<br />
To add an image to any location in PDF can be done with [[ImageMagick]] (convert), xv and pdftk. A wrapper script is [http://emmanuel.branlard.free.fr/work/linux/dev/SignPDF/SignPDF here] and other hints are [https://unix.stackexchange.com/questions/85873/how-can-i-add-a-signature-png-to-a-pdf-in-linux here].<br />
<br />
=== Removing annotations from a PDF ===<br />
<br />
With {{AUR|perl-cam-pdf}}:<br />
<br />
$ rewritepdf.pl -C in.pdf out.pdf<br />
<br />
See https://superuser.com/a/1051543 for more information.<br />
<br />
== DjVu tools ==<br />
<br />
* [[#Engines|DjVuLibre]] provides many command-line tools, like {{man|1|ddjvu}} for example.<br />
* {{App|img2djvu|Single-pass DjVu encoder based on DjVu Libre and ImageMagick.|https://github.com/ashipunov/img2djvu|{{AUR|img2djvu-git}}}}<br />
* {{App|pdf2djvu|Creates DjVu files from PDF files.|https://jwilk.net/software/pdf2djvu|{{AUR|pdf2djvu}}}}<br />
<br />
=== Convert DjVu to images ===<br />
<br />
Break Djvu into separate pages:<br />
<br />
$ djvmcvt -i input.djvu /path/to/out/dir output-index.djvu<br />
<br />
Convert Djvu pages into images:<br />
<br />
$ ddjvu --format=tiff page.djvu page.tiff<br />
<br />
Convert Djvu pages into PDF:<br />
<br />
$ ddjvu --format=pdf inputfile.djvu ouputfile.pdf<br />
<br />
You can also use ''--page'' to export specific pages:<br />
<br />
$ ddjvu --format=tiff --page=1-10 input.djvu output.tiff<br />
<br />
this will convert pages from 1 to 10 into one tiff file.<br />
<br />
=== Processing images ===<br />
<br />
You can use {{Pkg|scantailor-advanced}} to:<br />
<br />
* fix orientation<br />
* split pages<br />
* deskew<br />
* crop<br />
* adjust margins<br />
<br />
=== Make DjVu from images ===<br />
<br />
There is a useful script {{AUR|img2djvu-git}}.<br />
<br />
$ img2djvu -c1 -d600 -v1 ./out<br />
<br />
it will create 600 DPI {{ic|out.djvu}} from all files in {{ic|./out}} directory.<br />
<br />
Alternatively, you can try {{AUR|didjvu}}, which seems to create smaller files especially on images with well defined background.<br />
<br />
== PostScript tools ==<br />
<br />
* {{App|pstotext|Converts PostScript files to text.|https://www.cs.wisc.edu/~ghost/doc/pstotext.htm|{{Pkg|pstotext}}}}<br />
* [[#Engines|Ghostscript]]<br />
<br />
=== ps2pdf ===<br />
<br />
''ps2pdf'' is a wrapper around ghostscript to convert PostScript to PDF:<br />
<br />
$ ps2pdf -sPAPERSIZE=a4 -dOptimize=true -dEmbedAllFonts=true YourPSFile.ps<br />
<br />
Explanation:<br />
<br />
* with {{ic|1=-sPAPERSIZE=something}} you define the paper size. For valid PAPERSIZE values, see [https://ghostscript.com/doc/current/Use.htm#Known_paper_sizes].<br />
* {{ic|1=-dOptimize=true}} lets the created PDF be optimised for loading.<br />
* {{ic|1=-dEmbedAllFonts=true}} makes the fonts look always nice.<br />
<br />
{{Note|You cannot choose the paper orientation in ps2pdf. If your input PS file is healthy, it already contains the orientation information. If you are trying to use an Encapsulated PS file, you will have problems, if it does not fit in the {{ic|1=-sPAPERSIZE}} you specified, because EPS files usually do not contain paper orientation information. A workaround is creating a new paper in ghostscript settings (call it e.g. "slide") and use it as {{ic|1=-sPAPERSIZE=slide}}.}}<br />
<br />
== Libraries ==<br />
<br />
* {{App|libharu|C library for generating PDF documents.|https://github.com/libharu/libharu|{{Pkg|libharu}}, Lua binding: {{AUR|lua-hpdf}}}}<br />
* {{App|PoDoFo|A C++ library to work with the PDF file format.|http://podofo.sourceforge.net|{{Pkg|podofo}}}}<br />
<br />
=== Python ===<br />
<br />
* {{App|PDFMiner|Utils to extract, analyze text data of PDF files. Includes pdf2txt, dumppdf, and latin2ascii|https://www.unixuser.org/~euske/python/pdfminer/|{{Pkg|python-pdfminer}}, {{AUR|pdfminer}}}}<br />
* {{App|pdfrw|A pure Python library that reads and writes PDFs.|https://github.com/pmaupin/pdfrw|{{Pkg|python-pdfrw}}, {{AUR|python2-pdfrw}}}}<br />
* {{App|PyPDF2|A pure-Python library built as a PDF toolkit.|https://mstamy2.github.io/PyPDF2/|{{AUR|python-pypdf2}}, {{AUR|python2-pypdf2}}}}<br />
* {{App|PyX|Python library for the creation of PostScript and PDF files.|http://pyx.sourceforge.net|{{Pkg|python-pyx}}}}<br />
* {{App|ReportLab|A proven industry-strength PDF generating solution|https://www.reportlab.com/|{{Pkg|python-reportlab}}, {{AUR|python2-reportlab}}}}<br />
<br />
== See also ==<br />
<br />
* [[List of applications/Documents#Readers and viewers]]<br />
* [[List of applications/Documents#OCR software]]<br />
* [[Wikipedia:List of PDF software]]<br />
* PDF References<br />
** [https://web.archive.org/web/20210116133007/https://www.adobe.com/devnet/pdf/pdf_reference.html PDF Reference and Adobe Extensions to the PDF Specification]<br />
** [[Wikipedia:PDF#Further reading]]</div>Lesmanahttps://wiki.archlinux.org/index.php?title=GNOME/Troubleshooting&diff=501295GNOME/Troubleshooting2017-12-07T06:53:27Z<p>Lesmana: /* Shell freezes */ typo</p>
<hr />
<div>[[Category:Desktop environments]]<br />
[[ja:GNOME/トラブルシューティング]]<br />
[[zh-hans:GNOME/Troubleshooting]]<br />
See [[GNOME]] for the main article.<br />
<br />
== Shell freezes ==<br />
<br />
In the event of a Shell freeze (which might be caused by certain appearance tweaks, malfunctioning extensions or perhaps a lack of available memory) restarting the Shell by pressing {{ic|Alt}} + {{ic|F2}} and then entering '''r''' may not be possible.<br />
<br />
In this case, try switching to another TTY ('''Ctrl''' + '''Alt''' + '''F2''') and entering the following command: {{ic|pkill -HUP gnome-shell}}. It may take a few seconds before the Shell successfully restarts. On X11 restarting the shell in this fashion should not log the user out but it is a good idea to try and ensure that all work is saved anyway; on Wayland (currently the default) restarting the shell kills the whole session, so everything will be lost.<br />
<br />
If this fails, the [[Xorg]] server will need to be restarted either by: {{ic|pkill X}} for console logins or: {{ic|systemctl restart gdm}} for GDM logins. Bear in mind that restarting the Xorg server will log the user out so try to ensure that all work is saved before attempting this.<br />
<br />
== Shell segfaults ==<br />
<br />
If you experience gnome-shell disappearing and reappearing, it means that it has segfaulted (probably because of an extension). Gnome-shell extensions use javascript; to enable debugging of extensions, it is necessary to<br />
<br />
1) rebuild {{pkg|gjs}} with the following additions:<br />
<br />
packages/gjs/trunk$ svn diff<br />
Index: PKGBUILD<br />
===================================================================<br />
--- PKGBUILD (révision 300688)<br />
+++ PKGBUILD (copie de travail)<br />
@@ -11,8 +11,8 @@<br />
depends=(cairo gobject-introspection-runtime js38 gtk3)<br />
makedepends=(gobject-introspection git gnome-common)<br />
_commit=43c5d7839630dd166372f2c404a9a72c87fd102a # tags/1.48.5^0<br />
source=("git+https://git.gnome.org/browse/gjs#commit=$_commit")<br />
sha256sums=('SKIP')<br />
<br />
pkgver() {<br />
cd $pkgname<br />
@@ -21,12 +21,15 @@<br />
<br />
prepare() {<br />
cd $pkgname<br />
NOCONFIGURE=1 ./autogen.sh<br />
}<br />
<br />
build() {<br />
cd $pkgname<br />
- ./configure --prefix=/usr --disable-static --libexecdir=/usr/lib<br />
+ export CXXFLAGS='-g -O0'<br />
+ export CPPFLAGS='-D_FORITFY_SOURCE=0'<br />
+ ./configure --prefix=/usr --disable-static --libexecdir=/usr/lib --enable-debug-symbols=-gdwarf-2<br />
sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool<br />
make<br />
}<br />
<br />
<br />
2) rebuild {{pkg|js38}} with debug enabled:<br />
<br />
packages/js38/trunk$ svn diff PKGBUILD <br />
Index: PKGBUILD<br />
===================================================================<br />
--- PKGBUILD (révision 300681)<br />
+++ PKGBUILD (copie de travail)<br />
@@ -10,7 +10,7 @@<br />
license=(MPL)<br />
depends=(nspr gcc-libs readline zlib icu libffi)<br />
makedepends=(python2 libffi zip)<br />
-options=(!staticlibs)<br />
+options=(!staticlibs debug)<br />
source=(https://ftp.mozilla.org/pub/firefox/releases/${pkgver}esr/source/firefox-${pkgver}esr.source.tar.bz2<br />
mozjs38-fix-tracelogger.patch<br />
mozjs38-shell-version.patch<br />
<br />
Once the gjs and js38-debug packages are installed and gnome-shell restarted ({{ic|Alt}}+ {{ic|F2}} + {{ic|r}}), whenever gnome-shell crashes the debug symbols will be available.<br />
<br />
After the crash:<br />
{{bc|1=$ coredumpctl -1<br />
TIME PID UID GID SIG COREFILE EXE<br />
Mon 2017-07-17 15:34:49 CEST 27368 1000 1000 11 present /usr/bin/gnome-shell<br />
$ coredumpctl gdb 27368<br />
(gdb) bt<br />
#0 0x00007fbc7b997945 in js::GCMethods<JSObject*>::needsPostBarrier(JSObject*) (v=0x7fbc0a9548c0) at /usr/include/mozjs-38/js/RootingAPI.h:663<br />
#1 0x00007fbc7b997945 in JS::Heap<JSObject*>::set(JSObject*) (newPtr=0x0, this=0x254c260) at /usr/include/mozjs-38/js/RootingAPI.h:296<br />
#2 0x00007fbc7b997945 in JS::Heap<JSObject*>::operator=(JSObject* const&) (p=<optimized out>, this=0x254c260) at /usr/include/mozjs-38/js/RootingAPI.h:266<br />
#3 0x00007fbc7b997945 in GjsMaybeOwned<JSObject*>::reset() (this=0x254c250) at ./gjs/jsapi-util-root.h:267<br />
#4 0x00007fbc7b997945 in closure_clear_idle(void*) (data=0x254c220) at gi/closure.cpp:133<br />
#5 0x00007fbc79abd8c5 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0<br />
#6 0x00007fbc79abdc88 in () at /usr/lib/libglib-2.0.so.0<br />
#7 0x00007fbc79abdfa2 in g_main_loop_run () at /usr/lib/libglib-2.0.so.0<br />
#8 0x00007fbc7b27508c in meta_run () at /usr/lib/libmutter-0.so.0<br />
#9 0x0000000000401ff7 in main ()<br />
}}<br />
<br />
You can then report the bug on the [https://bugzilla.gnome.org/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=NEEDINFO&list_id=233614&product=gnome-shell&query_format=advanced gnome bugzilla].<br />
<br />
== Incorrect application defaults ==<br />
<br />
When installing applications for the first time you may find that GNOME has the wrong application associated to a certain protocols - for instance, ''easytag'' becomes the folder handler instead of [[GNOME Files]].<br />
<br />
For GNOME Files see the following page: [[GNOME Files#Files is no longer the default file manager]].<br />
<br />
For Document Viewer, run the following command:<br />
$ xdg-mime default evince.desktop application/pdf<br />
<br />
For other applications, default handler settings are detailed on the following page: [[Default applications]].<br />
<br />
Optionally, you can [[install]] {{AUR|gnome-defaults-list}}. It will place your configuration file at {{ic|/etc/gnome/defaults.list}}.<br />
<br />
== Tracker & Documents do not list any local files ==<br />
<br />
In order for Tracker (and, therefore, Documents) to detect your local files, they must be stored in an [http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html XDG compliant directory] (such as 'Documents' or 'Music'). For more information, see [[XDG user directories]].<br />
<br />
You can also configure Tracker to recursively search inside specific directories such as your home directory. These settings can be made using {{ic|tracker-preferences}}.<br />
<br />
== Unable to add accounts in Empathy and GNOME Online Accounts ==<br />
<br />
Empathy, the engine behind integrated messaging, GNOME Online Accounts, and all other system settings based on messaging accounts will not function correctly unless the {{Grp|telepathy}} group of packages or at least one of the backends ({{Pkg|telepathy-gabble}}, or {{Pkg|telepathy-haze}}, for example) is [[install]]ed. View descriptions of ''telepathy'' components on the [http://telepathy.freedesktop.org/wiki/Components freedesktop.org telepathy wiki].<br />
<br />
{{Note|[[Avahi]] daemon is required for connecting with the People Nearby account, and also in order for some desktop extensions to work correctly like [https://extensions.gnome.org/extension/746/chat-status/ Chat Status]}}<br />
<br />
== Empathy does not use GNOME Online Accounts ==<br />
<br />
After adding a Gnome Online Account, it may be necessary to log out and log back in for it to be used by Empathy.<br />
<br />
== Cannot change settings in dconf-editor ==<br />
<br />
When one cannot set settings in {{pkg|dconf}}, it is possible their dconf user settings are corrupt. In this case it is best to delete the user dconf files in {{ic|~/.config/dconf/user*}} and set the settings in dconf-editor after.<br />
<br />
== When an extension breaks the shell ==<br />
<br />
When enabling shell extensions causes GNOME breakage, you should first remove the ''user-theme'' and ''auto-move-windows'' extensions from their installation directory.<br />
<br />
The installation directory could be one of {{ic|~/.local/share/gnome‑shell/extensions}}, {{ic|/usr/share/gnome‑shell/extensions}} or {{ic|/usr/local/share/gnome‑shell/extensions}}. Removing these two extension-containing folders may fix the breakage. Otherwise, isolate the problem extension with trial‑and‑error.<br />
<br />
Removing or adding an extension-containing folder to the aforementioned directories removes or adds the corresponding extension to your system. Details on GNOME Shell extensions are available at the [https://live.gnome.org/GnomeShell/Extensions GNOME web site.]<br />
<br />
If you have trouble with uninstalling an extension via [https://extensions.gnome.org/local/ extensions.gnome.org/local], then probably they have been installed as system-wide extensions with the {{Pkg|gnome-shell-extensions}} package. Removing the package again obviously affects all user accounts.<br />
<br />
== Extensions do not work after GNOME 3 update ==<br />
<br />
{{Note|Please bear in mind that whilst the methods below will allow you to '''try''' and activate an extension with an unsupported version of GNOME Shell, it is by no means a guarantee that the extension will work successfully. The most likely outcome of trying to activate such an extension is that GNOME Shell will crash and then restart.}}<br />
<br />
Before trying the workarounds below, check if an update is available for the extension by visiting [https://extensions.gnome.org/local extensions.gnome.org/local]. <br />
<br />
If there is no update for your current GNOME version yet, use the following command to disable version validation for extensions:<br />
$ gsettings set org.gnome.shell disable-extension-version-validation true<br />
<br />
Alternatively, you could modify the extension itself, changing the supported shell version to satisfy the version validation. See the method below.<br />
<br />
Locate the folder where your extensions are installed. It might be {{ic|~/.local/share/gnome-shell/extensions}} or {{ic|/usr/share/gnome-shell/extensions}}.<br />
<br />
Edit each occurrence of {{ic|metadata.json}} which appears in each extension sub-folder.<br />
<br />
{| border="0"<br />
| Insert: || {{ic|"shell-version": ["3.x"]}}<br />
|-<br />
| Instead of (for example): || {{ic|"shell-version": ["3.4"]}}<br />
|}<br />
<br />
{{ic|"3.x"}} indicates the extension works with every shell version. If it breaks, you will know to change it back.<br />
<br />
== Keyboard shortcut do not work with only conky running ==<br />
<br />
The GNOME shell keyboard shortcuts like {{ic|Alt+F2}}, {{ic|Alt+F1}}, and the media key shortcuts do not work if conky is the only program running. However, if another application like ''gedit'' is running, then the keyboard shortcuts work.<br />
<br />
Solution: edit {{ic|.conkyrc}}<br />
<br />
own_window yes<br />
own_window_transparent yes<br />
own_window_argb_visual yes<br />
own_window_type dock<br />
own_window_class Conky<br />
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager<br />
<br />
== Unable to apply stored configuration for monitors ==<br />
<br />
If you encounter this message try to disable the ''xrandr'' {{ic|gnome-settings-daemon plugin}}:<br />
<br />
$ dconf write /org/gnome/settings-daemon/plugins/xrandr/active false<br />
<br />
== Consistent cursor theme ==<br />
<br />
See [[Cursor themes#Desktop environments]].<br />
<br />
== Windows cannot be modified with Alt-Key + mouse-button ==<br />
<br />
In GNOME 3.6 and above, the mouse button modifier (the key that allows you to drag a window from a location other than the titlebar) is the {{ic|Super}} key instead of the {{ic|Alt}} key which was used in the past. The change was made in response to the following [https://bugzilla.gnome.org/show_bug.cgi?id=607797 bug report]. <br />
<br />
To change the mouse button modifier back to the {{ic|Alt}} key, execute the following:<br />
$ gsettings set org.gnome.desktop.wm.preferences mouse-button-modifier '<Alt>' <br />
<br />
{{Note|It is not possible to change this with ''System settings'' > ''Keyboard'' > ''Shortcuts''}}<br />
<br />
== Slow loading of system icons/slow GDM login ==<br />
<br />
Problems with the loading of system icons, such the ones in the title bar of Files, might be solved by executing the following command:<br />
# gdk-pixbuf-query-loaders --update-cache<br />
<br />
Running the aforementioned command may also fix repeated occurrences of the "Oh no! Something has gone wrong!" error screen and/or very slow loading and login with GDM as described in the following [https://bbs.archlinux.org/viewtopic.php?pid=1414157 forum thread].<br />
<br />
== Artifacts when maximizing windows ==<br />
<br />
Maximizing windows may cause artifacts as of GNOME 3.12.0 - see the following [https://bbs.archlinux.org/viewtopic.php?id=183617 forum thread] and [https://bugzilla.gnome.org/show_bug.cgi?id=728385 bug report]. A solution is detailed in the following section: [[#Tear-free video with Intel HD Graphics]].<br />
<br />
== Tear-free video with Intel HD Graphics ==<br />
<br />
;DRI3<br />
According to [https://bugzilla.gnome.org/show_bug.cgi?id=711028#c2 this bug report], DRI3 includes the {{ic|buffer_age}} extension that allows GNOME Shell's Mutter compositor to sync windows to vblank in an efficient way. Since version {{ic|1:2.99.917+682+g4eaab17-1}}, DRI3 is enabled by default in {{Pkg|xf86-video-intel}} [https://git.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/xf86-video-intel&id=cd3de9bb45a9ab84383541ed45ee6f0c10ea8798].<br />
<br />
;Intel TearFree<br />
Enabling the [[Intel graphics#Tear-free video|Xorg Intel TearFree option]] is a known workaround for tearing problems on Intel adapters. However, the way this option acts increases memory consumption and lowers performance, see [https://bugs.freedesktop.org/show_bug.cgi?id=37686#c123 the original bug report's final comment].<br />
<br />
;Mutter tweaks<br />
{{Note|1=This workaround has been [https://bugzilla.gnome.org/show_bug.cgi?id=711028#c0 reported] to have side effects and may not fix tearing in all cases.}}<br />
GNOME Shell's Mutter compositor has a tweak known to address tearing problems (see [https://bugzilla.gnome.org/show_bug.cgi?id=657071#c1 the original suggestion for this fix] and its mention in [https://bugs.freedesktop.org/show_bug.cgi?id=37686#c59 the Freedesktop bug report]). To enable this tweak, append the following line to {{ic|/etc/environment}}: {{ic|1=CLUTTER_PAINT=disable-clipped-redraws:disable-culling}}. Then restart the Xorg server.<br />
<br />
== Window opens behind other windows when using multiple monitors ==<br />
<br />
This is possibly a bug in GNOME Shell which causes new windows to open behind others. To fix this issue, one can run the following command:<br />
$ gsettings set org.gnome.shell.overrides workspaces-only-on-primary false<br />
<br />
== Lock button fails to re-enable touchpad ==<br />
<br />
Some laptops have a touchpad lock button that disables the touchpad so that users can type without worrying about touching the touchpad. Currently, it appears that although GNOME can lock the touchpad by pressing this button, it cannot unlock it. If the touchpad gets locked you can run the following to unlock it:<br />
<br />
$ xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 1<br />
<br />
== GNOME Shell keyboard sources menu not visible ==<br />
<br />
A menu showing the keyboard input sources (for example 'en' for an English keyboard layout) should be visible next to the status area containing icons for network, volume and power sources. If the keyboard sources menu is not visible, this is probably because you have configured your [[Xorg]] keyboard layout in a way which GNOME does not recognise.<br />
<br />
To ensure that the menu is visible, remove any Xorg keyboard configuration you might have created and set the keyboard locale using [[Keyboard_configuration_in_Xorg#Using_localectl|localectl]].<br />
<br />
Upon running the command and then logging out, you should find that the keyboard input sources menu is visible in GDM and in the GNOME Shell desktop. See [http://blogs.gnome.org/mclasen/2012/09/21/input-sources-in-gnome/ Input sources in GNOME] for more information.<br />
<br />
== Mouse cursor missing ==<br />
<br />
When using a separate [[window manager]] with ''gnome-settings-daemon'', the mouse cursor may vanish. Run:<br />
<br />
$ gsettings set org.gnome.settings-daemon.plugins.cursor active false<br />
<br />
== No restart button in session menu when screen is locked ==<br />
<br />
If [[XScreenSaver]] is installed, ensure that it is not running at startup, see [[GNOME#Startup applications]].<br />
<br />
== PulseAudio system-wide causes delay in GNOME and GDM ==<br />
<br />
If you are running [[PulseAudio]] in system-wide mode, the PulseAudio 7.0 upgrade breaks [[GDM]] and GNOME.<br />
See [https://bbs.archlinux.org/viewtopic.php?id=203051 this forum post] for more information.<br />
<br />
== GNOME crashes when trying to reorder applications in the GNOME Shell Dash ==<br />
The dash is the "toolbar" that appears, by default, [[wikipedia:GNOME_Shell#Design_components|on the left]] when you click Activities. Applications can be reordered in the dash by dragging and dropping. If this fails, and/or causes GNOME to crash, try [https://bbs.archlinux.org/viewtopic.php?id=171689 changing your icon theme].<br />
<br />
== Gnome Crashes while installing gnome-extra ==<br />
<br />
{{Expansion|Is there a related bug report?}}<br />
<br />
Attempting to install the gnome-extra group while a gnome environment is running will crash gnome while installing gnome-getting-started-docs. X will continue to run, but gnome will not work until fixed. To fix, simply install gnome-extra from a terminal rather than inside gnome. When complete, gnome should work again.<br />
<br />
== No H264 Video in Gnome Video Player (Totem) ==<br />
<br />
[[Codecs#Tips and tricks|See Codecs]]<br />
<br />
== No suspend on LID closure ==<br />
<br />
GNOME defaults to this behaviour about suspension:<br />
* No external monitor attached, computer goes in suspension when LID closes.<br />
* External monitor attached, computer does not go in suspension when LID closes.<br />
Currently {{Pkg|gnome-tweak-tool}} is not able to modify the behaviour on the second case, when a monitor is connected to the computer. While it can inhibit suspension with no monitor attached.<br />
{{Note|Behaviour on LID closure is controlled also by systemd. See [[Power management#Power management with systemd]].}}<br />
<br />
== gnome-shell / gnome-session crashes on session startup ==<br />
<br />
Sometimes {{ic|gnome-session}} crashes immediately after login. This might be more visible on wayland and it might seem as if every second login attempt fails. The problem can be temporarily worked around by removing the files in {{ic|~/.config/gnome-session/saved-session}}. A more lasting work-around is to disable the session manager's {{ic|auto-save-session}} feature:<br />
<br />
$ gsettings set org.gnome.SessionManager auto-save-session false<br />
<br />
== Low OpenGL performance and stuttering on proprietary NVIDIA driver ==<br />
<br />
[https://bugzilla.gnome.org/show_bug.cgi?id=781835 This] bug is much likely the cause of it. You should revert {{ic|383ba566bd7c2a76d0856015a66e47caedef06b6 }} commit in {{Pkg|mutter}}. Use [[ABS]] for this and add <br />
{{ic|git revert -n 383ba566bd7c2a76d0856015a66e47caedef06b6}} to {{ic|prepare()}} function.<br />
Or you can simply install {{Aur|mutter-781835-workaround}}<br />
<br />
== GNOME Wayland session not available ==<br />
<br />
GNOME Wayland does not support more than one GPU for output yet, [https://bugzilla.gnome.org/show_bug.cgi?id=771442 falling back] on GNOME X11.<br />
<br />
If your displays are only connected to one of your video devices, add this to your [[Environment_variables#Using_pam_env|system environment variables]]:<br />
<br />
MUTTER_ALLOW_HYBRID_GPUS=1<br />
<br />
To avoid [https://bbs.archlinux.org/viewtopic.php?pid=1744592#p1744592 problems] with some chipsets enable [[Kernel_mode_setting#Early_KMS_start|Early KMS]].<br />
<br />
<br />
== gnome-control-center is empty and does not list any categories ==<br />
<br />
Under alternative window managers (i3 for example), ''gnome-control-center'' starts as an empty window.<br />
You need to set the variable {{ic|XDG_CURRENT_DESKTOP}} to {{ic|GNOME}} to start it (either in a script or exporting the variable in {{ic|~/.profile}}).<br />
<br />
export XDG_CURRENT_DESKTOP=GNOME<br />
gnome-control-center &</div>Lesmanahttps://wiki.archlinux.org/index.php?title=KVM&diff=500830KVM2017-12-03T15:37:42Z<p>Lesmana: /* Hardware support */ more explicit lscpu command</p>
<hr />
<div>[[Category:Hypervisors]]<br />
[[Category:Kernel]]<br />
[[it:KVM]]<br />
[[ja:KVM]]<br />
[[zh-hans:KVM]]<br />
[[zh-hant:KVM]]<br />
{{Related articles start}}<br />
{{Related|:Category:Hypervisors}}<br />
{{Related|Libvirt}}<br />
{{Related articles end}}<br />
'''KVM''', Kernel-based Virtual Machine, is a [[Wikipedia:hypervisor|hypervisor]] built into the Linux kernel. It is similar to [[Xen]] in purpose but much simpler to get running. Unlike native [[QEMU]], which uses emulation, KVM is a special operating mode of QEMU that uses CPU extensions ([[Wikipedia:Hardware-assisted virtualization|HVM]]) for virtualization via a kernel module.<br />
<br />
Using KVM, one can run multiple virtual machines running unmodified GNU/Linux, Windows, or any other operating system. (See [http://www.linux-kvm.org/page/Guest_Support_Status Guest Support Status] for more information.) Each virtual machine has private virtualized hardware: a network card, disk, graphics card, etc.<br />
<br />
Differences between KVM and [[Xen]], [[VMware]], or QEMU can be found at the [http://www.linux-kvm.org/page/FAQ#General_KVM_information KVM FAQ].<br />
<br />
This article does not cover features common to multiple emulators using KVM as a backend. You should see related articles for such information.<br />
<br />
== Checking support for KVM ==<br />
<br />
=== Hardware support ===<br />
<br />
KVM requires that the virtual machine host's processor has virtualization support (named VT-x for Intel processors and AMD-V for AMD processors). You can check whether your processor supports hardware virtualization with the following command:<br />
$ lscpu | grep Virtualization<br />
<br />
Alternatively:<br />
$ egrep --color=auto 'vmx|svm|0xc0f' /proc/cpuinfo<br />
<br />
If nothing is displayed after running either command, then your processor does '''not''' support hardware virtualization, and you will '''not''' be able to use KVM.<br />
<br />
{{Note|You may need to enable virtualization support in your BIOS.}}<br />
<br />
=== Kernel support ===<br />
Arch Linux kernels provide the appropriate [[kernel modules]] to support KVM and VIRTIO.<br />
==== KVM modules ====<br />
You can check if necessary modules ({{ic|kvm}} and one of {{ic|kvm_amd}}, {{ic|kvm_intel}}) are available in your kernel with the following command (assuming your kernel is built with {{ic|CONFIG_IKCONFIG_PROC}}):<br />
$ zgrep CONFIG_KVM /proc/config.gz<br />
The module is '''only''' available if it is set to either {{ic|y}} or {{ic|m}}.<br />
<br />
==Para-virtualized devices==<br />
Para-virtualization provides a fast and efficient means of communication for guests to use devices on the host machine. KVM provides para-virtualized devices to virtual machines using the Virtio API as a layer between the hypervisor and guest.<br />
<br />
All virtio devices have two parts: the host device and the guest driver. <br />
<br />
=== VIRTIO modules ===<br />
Use the following command to check if needed modules are available:<br />
$ zgrep VIRTIO /proc/config.gz<br />
<br />
=== Loading kernel modules ===<br />
<br />
First, check if the kernel modules are automatically loaded. This should be the case with recent versions of [[udev]].<br />
$ lsmod | grep kvm<br />
$ lsmod | grep virtio<br />
<br />
In case the above commands return nothing, you need to [[Kernel modules#Manual module handling]] kernel modules.<br />
{{Tip|<br />
If modprobing {{Ic|kvm_intel}} or {{Ic|kvm_amd}} fails but modprobing {{Ic|kvm}} succeeds, (and {{ic|lscpu}} claims that hardware acceleration is supported), check your BIOS settings. Some vendors (especially laptop vendors) disable these processor extensions by default. To determine whether there's no hardware support or there is but the extensions are disabled in BIOS, the output from {{Ic|dmesg}} after having failed to modprobe will tell.}}<br />
<br />
=== List of para-virtualized devices ===<br />
<br />
* network device (virtio-net)<br />
* block device (virtio-blk)<br />
* controller device (virtio-scsi)<br />
* serial device (virtio-serial)<br />
* balloon device (virtio-balloon)<br />
<br />
== How to use KVM ==<br />
See the main article: [[QEMU]].<br />
<br />
== Tips and tricks ==<br />
<br />
{{Note|See [[QEMU#Tips and tricks]] and [[QEMU#Troubleshooting]] for general tips and tricks.}}<br />
<br />
=== Nested virtualization ===<br />
<br />
{{Expansion|Is it possible also with {{ic|kvm_amd}}?}}<br />
<br />
Nested virtualization enables existing virtual machines to be run on third-party hypervisors and on other clouds without any modifications to the original virtual machines or their networking.<br />
<br />
On host, enable nested feature for {{ic|kvm_intel}}:<br />
# modprobe -r kvm_intel<br />
# modprobe kvm_intel nested=1<br />
<br />
To make it permanent (see [[Kernel modules#Setting module options]]):<br />
{{hc|/etc/modprobe.d/kvm_intel.conf|<nowiki><br />
options kvm_intel nested=1<br />
</nowiki>}}<br />
<br />
Verify that feature is activated: <br />
{{hc|<nowiki>$ systool -m kvm_intel -v | grep nested</nowiki>|<nowiki><br />
nested = "Y"<br />
</nowiki>}}<br />
<br />
Run guest VM with following command:<br />
$ qemu-system-x86_64 -enable-kvm -cpu host<br />
<br />
Boot VM and check if vmx flag is present:<br />
$ egrep --color=auto 'vmx|svm' /proc/cpuinfo<br />
<br />
=== Enabling huge pages ===<br />
<br />
{{Merge|QEMU|qemu-kvm no longer exists as all of its features have been merged into {{Pkg|qemu}}. After the above issue is cleared, I suggest merging this section into [[QEMU]].}}<br />
<br />
You may also want to enable hugepages to improve the performance of your virtual machine.<br />
With an up to date Arch Linux and a running KVM you probably already have everything you need. Check if you have the directory {{ic|/dev/hugepages}}. If not, create it. <br />
Now we need the right permissions to use this directory. The default permission is root's uid and gid with 0755, but we want anyone in the kmv group to have access to hugepages.<br />
<br />
Add to your {{ic|/etc/fstab}}:<br />
hugetlbfs /dev/hugepages hugetlbfs mode=1770,gid=78 0 0<br />
<br />
Of course the gid must match that of the {{ic|kvm}} group. The mode of {{ic|1770}} allows anyone in the group to create files but not unlink or rename each other's files. Make sure {{ic|/dev/hugepages}} is mounted properly:<br />
{{hc|# umount /dev/hugepages<br />
# mount /dev/hugepages<br />
$ mount <nowiki>|</nowiki> grep huge|<br />
2=hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,mode=1770,gid=78)<br />
}}<br />
<br />
Now you can calculate how many hugepages you need. Check how large your hugepages are:<br />
$ grep Hugepagesize /proc/meminfo<br />
<br />
Normally that should be 2048 kB ≙ 2 MB. Let's say you want to run your virtual machine with 1024 MB. 1024 / 2 = 512. Add a few extra so we can round this up to 550. Now tell your machine how many hugepages you want:<br />
# echo 550 > /proc/sys/vm/nr_hugepages<br />
<br />
If you had enough free memory you should see:<br />
{{hc|$ grep HugePages_Total /proc/meminfo |<br />
HugesPages_Total: 550<br />
}}<br />
<br />
If the number is smaller, close some applications or start your virtual machine with less memory (number_of_pages x 2):<br />
$ qemu-system-x86_64 -enable-kvm -m 1024 -mem-path /dev/hugepages -hda <disk_image> [...]<br />
<br />
Note the {{ic|-mem-path}} parameter. This will make use of the hugepages.<br />
<br />
Now you can check, while your virtual machine is running, how many pages are used:<br />
{{hc|$ grep HugePages /proc/meminfo |<br />
HugePages_Total: 550<br />
HugePages_Free: 48<br />
HugePages_Rsvd: 6<br />
HugePages_Surp: 0<br />
}}<br />
<br />
Now that everything seems to work you can enable hugepages by default if you like. Add to your {{ic|/etc/sysctl.d/40-hugepage.conf}}:<br />
vm.nr_hugepages = 550<br />
<br />
See also:<br />
* [https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt summary of hugetlbpage support in the Linux kernel]<br />
* [[debian:Hugepages|Debian Wiki - Hugepages]]<br />
<br />
== See also ==<br />
* [http://www.linux-kvm.org/page/HOWTO KVM Howto]<br />
* [http://www.linux-kvm.org/page/FAQ#General_KVM_information KVM FAQ]</div>Lesmanahttps://wiki.archlinux.org/index.php?title=Systemd/FAQ&diff=490960Systemd/FAQ2017-09-22T17:46:11Z<p>Lesmana: /* How do I change the default number of gettys? */ simply remove unnecessary simply</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Daemons and system services]]<br />
[[Category:Boot process]]<br />
[[es:Systemd FAQ]]<br />
[[it:Systemd FAQ]]<br />
[[ja:Systemd FAQ]]<br />
[[zh-hans:Systemd FAQ]]<br />
<br />
{{Related articles start}}<br />
{{Related|systemd}}<br />
{{Related|systemd/User}}<br />
{{Related|Daemons#List of daemons}}<br />
{{Related articles end}}<br />
<br />
== FAQ ==<br />
<br />
For an up-to-date list of known issues, look at the upstream [https://github.com/systemd/systemd/blob/master/TODO TODO].<br />
<br />
=== Why do I get log messages on my console? ===<br />
<br />
You must set the kernel loglevel yourself. Historically, {{ic|/etc/rc.sysinit}} did this for us and set dmesg loglevel to {{ic|3}}, which was a reasonably quiet loglevel. Either add {{ic|1=loglevel=3}} or {{ic|quiet}} to your [[kernel parameters]].<br />
<br />
=== How do I change the default number of gettys? ===<br />
<br />
Currently, only one getty is launched by default. If you switch to another tty, a getty will be launched there (socket-activation style). In other words, [Ctl] [Alt] [F2] will launch a new getty on tty2.<br />
<br />
By default, the number of auto-activated gettys is capped at six. Thus [F7] through [F12] won't launch a getty.<br />
<br />
If you want to change this behavior, then edit {{ic|/etc/systemd/logind.conf}} and change the value of {{ic|NAutoVTs}}. If you want all [F''x''] keys to start a getty, increase the value of NAutoVTs to 12. If you are [[Systemd#Forward_journald_to_.2Fdev.2Ftty12|forwarding journald to tty12]], increase the value of NAutoVTs to 11 (thus leaving tty12 free).<br />
<br />
You can also pre-activate gettys which will be running from boot.<br />
<br />
To add another pre-activated getty, place another symlink for instantiating another getty in the {{ic|/etc/systemd/system/getty.target.wants/}} directory:<br />
<br />
# ln -sf /usr/lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty9.service<br />
# systemctl start getty@tty9.service<br />
<br />
To remove a getty, remove the getty symlinks you want to get rid of in the {{ic|/etc/systemd/system/getty.target.wants/}} directory:<br />
<br />
# rm /etc/systemd/system/getty.target.wants/getty@{tty5,tty6}.service<br />
# systemctl stop getty@tty5.service getty@tty6.service<br />
<br />
systemd does not use the {{ic|/etc/inittab}} file.<br />
<br />
=== How do I get more verbose output during boot? ===<br />
<br />
If you see no output at all in console after the initram message, this means you have the {{ic|quiet}} parameter in your kernel line. It's best to remove it, at least the first time you boot with systemd, to see if everything is ok. Then, you will see a list {{ic|[ OK ]}} in green or {{ic|[ FAILED ]}} in red.<br />
<br />
Any messages are logged to the system log and if you want to find out about the status of your system run {{ic|systemctl}} (no root privileges required) or look at the boot/system log with {{ic|journalctl}}.<br />
<br />
=== How do I avoid clearing the console after boot? ===<br />
<br />
Create a directory called {{ic|/etc/systemd/system/getty@.service.d}} and place {{ic|nodisallocate.conf}} in there to [[Systemd#Editing provided units|override]] the {{ic|TTYVTDisallocate}} option to {{ic|no}}.<br />
<br />
{{hc|/etc/systemd/system/getty@.service.d/nodisallocate.conf|2=<br />
[Service]<br />
TTYVTDisallocate=no<br />
}}<br />
<br />
=== What kernel options are required for systemd? ===<br />
<br />
Kernels prior to 3.0 are unsupported. <br />
<br />
If you use a custom kernel, you will need to make sure that systemd's options are selected.<br />
<br />
If you are compiling a new kernel for use with an installed version of systemd, the required and recommended options are listed in the systemd README file {{ic|/usr/share/doc/systemd/README}}.<br />
<br />
If you are preparing to install a new version of systemd and are running a custom kernel, the most recent version of the file can be found in the [http://cgit.freedesktop.org/systemd/systemd/tree/README the systemd git].<br />
<br />
=== What other units does a unit depend on? ===<br />
<br />
For example, if you want to figure out which services a target like {{ic|multi-user.target}} pulls in, use something like this: <br />
<br />
{{hc|$ systemctl show -p "Wants" multi-user.target|2=<br />
Wants=rc-local.service avahi-daemon.service rpcbind.service NetworkManager.service acpid.service dbus.service atd.service crond.service auditd.service ntpd.service udisks.service bluetooth.service org.cups.cupsd.service wpa_supplicant.service getty.target modem-manager.service portreserve.service abrtd.service yum-updatesd.service upowerd.service test-first.service pcscd.service rsyslog.service haldaemon.service remote-fs.target plymouth-quit.service systemd-update-utmp-runlevel.service sendmail.service lvm2-monitor.service cpuspeed.service udev-post.service mdmonitor.service iscsid.service livesys.service livesys-late.service irqbalance.service iscsi.service<br />
}}<br />
<br />
Instead of {{ic|Wants}} you might also try {{ic|WantedBy}}, {{ic|Requires}}, {{ic|RequiredBy}}, {{ic|Conflicts}}, {{ic|ConflictedBy}}, {{ic|Before}}, {{ic|After}} for the respective types of dependencies and their inverse.<br />
<br />
=== My computer shuts down, but the power stays on ===<br />
<br />
Use {{ic|systemctl poweroff}} instead of {{ic|systemctl halt}}.<br />
<br />
=== After migrating to systemd, why won't my fakeRAID mount? ===<br />
<br />
Be sure you use:<br />
<br />
# systemctl enable dmraid.service<br />
<br />
=== How can I make a script start during the boot process? ===<br />
<br />
Create a new file in {{ic|/etc/systemd/system}} (e.g. ''myscript''.service) and add the following contents:<br />
<br />
[Unit]<br />
Description=My script<br />
<br />
[Service]<br />
ExecStart=/usr/bin/my-script<br />
<br />
[Install]<br />
WantedBy=multi-user.target <br />
<br />
Then:<br />
<br />
# systemctl enable ''myscript''.service<br />
<br />
This example assumes you want your script to start up when the target multi-user is launched. Also do {{ic|chmod 755}} to your script to enable execute permissions if you haven't done so already.<br />
<br />
{{Note|In case you want to start a shell script, make sure you have {{ic|#!/bin/sh}} in the first line of the script. Do '''not''' write something like {{ic|<nowiki>ExecStart=/bin/sh /path/to/script.sh</nowiki>}} because that will not work.}}<br />
<br />
=== Status of .service says "active (exited)" in green. (e.g. iptables) ===<br />
<br />
This is perfectly normal. In the case with iptables it is because there is no daemon to run, it is controlled in the kernel. Therefore, it exits after the rules have been loaded.<br />
<br />
To check if your iptables rules have been loaded properly:<br />
<br />
# iptables --list<br />
<br />
=== "Failed to issue method call: File exists" error ===<br />
<br />
This happens when using {{ic|systemctl enable}} and the symlink it tries to create in {{ic|/etc/systemd/system/}} already exists. Typically this happens when switching from one display manager to another one (for instance GDM to KDM, which can be enabled with {{ic|gdm.service}} and {{ic|kdm.service}}, respectively) and the corresponding symlink {{ic|/etc/systemd/system/display-manager.service}} already exists.<br />
<br />
To solve this problem, either first disable the relevant display manager before enabling the new one, or use {{ic|systemctl -f enable}} to overwrite an existing symlink.</div>Lesmanahttps://wiki.archlinux.org/index.php?title=Screen_capture&diff=490229Screen capture2017-09-13T21:28:47Z<p>Lesmana: /* maim */ maim no longer uses imlib2 https://github.com/naelstrof/maim/releases?after=v4.4.60</p>
<hr />
<div>[[Category:Image manipulation]]<br />
[[cs:Taking a screenshot]]<br />
[[es:Taking a screenshot]]<br />
[[fr:Capture d'écran]]<br />
[[ja:スクリーンショットの取得]]<br />
[[ru:Taking a screenshot]]<br />
[[zh-hans:Taking a screenshot]]<br />
{{Related articles start}}<br />
{{Related|Extra keyboard keys}}<br />
{{Related articles end}}<br />
This article explains different methods to take [[Wikipedia:Screenshot|screenshots]] on your system.<br />
<br />
== Dedicated software ==<br />
<br />
* {{App|Deepin Screenshot|A quite easy-to-use screenshot tool. Features: global hotkey to trigger screenshot tool, take screenshot of a selected area, easy to add text and line drawings onto the screenshot. Python/Qt5 based.|https://www.deepin.org/|{{Pkg|deepin-screenshot}}}}<br />
* {{App|Escrotum|Screen capture using pygtk, inspired by scrot.|https://github.com/Roger/escrotum|{{AUR|escrotum-git}}}}<br />
* {{App|gnome-screenshot|Despite its name its dependencies are only dconf, gtk3, and libcanberra.|http://gnome.org|{{Pkg|gnome-screenshot}}}}<br />
* {{App|gscreenshot|Simple GTK screenshot utility with delays, selection, and copy-to-clipboard functionality.|https://github.com/thenaterhood/gscreenshot|{{AUR|gscreenshot}}}}<br />
* {{App|imgur-screenshot|Take screenshot selection, upload to [http://imgur.com imgur]. + more cool things|https://github.com/jomo/imgur-screenshot|{{AUR|imgur-screenshot-git}}}}<br />
* {{App|Lightscreen| Lightscreen is a simple tool to automate the tedious process of saving and cataloging screenshots, it operates as a hidden background process that is invoked with one (or multiple) hotkeys and then saves a screenshot file to disk according to the user's preferences.|http://lightscreen.com.ar|{{AUR|lightscreen}}}}<br />
* {{App|maim|A simple command line utility that takes screenshots. It's meant to replace scrot and performs better than scrot in many ways.|https://github.com/naelstrof/maim|{{Pkg|maim}}}}<br />
* {{App|screencloud| allows you to take a screenshot of the entire screen or to select an area and then uploading the screenshot to [http://imgur.com imgur]+auth. has plugins and system tray. |http://screencloud.net/|{{AUR|screencloud}}}}<br />
* {{App|screengrab|Cross-platform application designed to quickly take screenshots (Qt).|http://screengrab.doomer.org/|{{AUR|screengrab}}}}<br />
* {{App|[[Wikipedia:Scrot|Scrot]]|Simple command-line screenshot utility for X.|http://freecode.com/projects/scrot|{{Pkg|scrot}}}}<br />
* {{App|Shutter|Rich screenshot and editing program. Supports [https://hyp.is/AVQUNTRUH9ZO4OKSlue9/askubuntu.com/questions/252281/how-do-i-take-screenshots-with-a-delay/260178 delay]. |http://shutter-project.org/|{{AUR|shutter}}}}<br />
* {{App|Spectacle|[[KDE]] application for taking screenshots. It is capable of capturing images of the whole desktop, a single window, a section of a window, a selected rectangular region or a freehand region. Part of {{Grp|kdegraphics}}.|https://github.com/KDE/spectacle/|{{Pkg|spectacle}}}}<br />
* {{App|Xfce4 Screenshooter|This application allows you to capture the entire screen, the active window or a selected region. You can set the delay that elapses before the screenshot is taken and the action that will be done with the screenshot: save it to a PNG file, copy it to the clipboard, open it using another application, or host it on ZimageZ, a free online image hosting service. Part of {{Grp|xfce4-goodies}}.|http://goodies.xfce.org/projects/applications/xfce4-screenshooter|{{Pkg|xfce4-screenshooter}}}}<br />
* {{App|xwd|X Window System image dumping utility|http://xorg.freedesktop.org/|{{Pkg|xorg-xwd}}}}<br />
<br />
== Packages including a screenshot utility ==<br />
<br />
* {{App|[[Wikipedia:GIMP|GIMP]]|Image editing suite in the vein of proprietary editors such as [[Wikipedia:Adobe Photoshop|Adobe Photoshop]]. GIMP ([[GNU]] Image Manipulation Program) has been started in the mid 1990s and has acquired a large number of [[CMYK support in The GIMP|plugins]] and additional tools.|http://www.gimp.org/|{{Pkg|gimp}}}}<br />
* {{App|[[Wikipedia:GraphicsMagick|GraphicsMagick]]|Fork of ImageMagick designed to have API and command-line stability. It also supports multi-CPU for enhanced performance and thus is used by some large commercial sites (Flickr, etsy) for its performance.|http://www.graphicsmagick.org/|{{Pkg|graphicsmagick}}}}<br />
* {{App|[[Wikipedia:ImageMagick|ImageMagick]]|Command-line image manipulation program. It is known for its accurate format conversions with support for over 100 formats. Its API enables it to be scripted and it is usually used as a backend processor.|http://www.imagemagick.org/script/index.php|{{Pkg|imagemagick}}}}<br />
* {{App|Imlib2|Library that does image file loading and saving as well as rendering, manipulation, arbitrary polygon support.|http://sourceforge.net/projects/enlightenment/|{{Pkg|imlib2}}}}<br />
* {{App|MATE Utils|Common MATE utilities for viewing disk usage, logs and fonts, taking screenshots, managing dictionaries and searching files.|http://mate-desktop.org|{{Pkg|mate-utils}}}}<br />
<br />
== Details: general methods ==<br />
<br />
=== ImageMagick/GraphicsMagick ===<br />
<br />
An easy way to take a screenshot of your current system is using the {{ic|import}} command:<br />
$ import -window root screenshot.jpg<br />
<br />
{{ic|import}} is part of the {{Pkg|imagemagick}} package.<br />
<br />
Running {{ic|import}} without the {{ic|-window}} option allows selecting a window or an arbitrary region interactively.<br />
<br />
{{Note|If you prefer '''graphicsmagick''' alternative, just prepend "gm", e.g. {{ic|$ gm import -window root screenshot.jpg}}.}}<br />
<br />
==== Screenshot of multiple X screens ====<br />
<br />
If you run twinview or dualhead, simply take the screenshot twice and use {{Ic|imagemagick}} to paste them together:<br />
{{bc|<br />
import -window root -display :0.0 -screen /tmp/0.png<br />
import -window root -display :0.1 -screen /tmp/1.png<br />
convert +append /tmp/0.png /tmp/1.png screenshot.png<br />
rm /tmp/{0,1}.png<br />
}}<br />
<br />
==== Screenshot of individual Xinerama heads ====<br />
<br />
Xinerama-based multi-head setups have only one virtual screen. If the physical screens are different in height, you will find dead space in the screenshot. In this case, you may want to take screenshot of each physical screen individually. As long as Xinerama information is available from the X server, the following will work:<br />
{{bc|<nowiki><br />
#!/bin/sh<br />
xdpyinfo -ext XINERAMA | sed '/^ head #/!d;s///' |<br />
while IFS=' :x@,' read i w h x y; do<br />
import -window root -crop ${w}x$h+$x+$y head_$i.png<br />
done<br />
</nowiki>}}<br />
<br />
==== Screenshot of the active/focused window ====<br />
<br />
The following script takes a screenshot of the currently focused window. It works with EWMH/NetWM compatible X Window Managers. To avoid overwriting previous screenshots, the current date is used as the filename.<br />
{{bc|<nowiki><br />
#!/bin/sh<br />
activeWinLine=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)")<br />
activeWinId=${activeWinLine:40}<br />
import -window "$activeWinId" /tmp/$(date +%F_%H%M%S_%N).png<br />
</nowiki>}}<br />
<br />
Alternatively, the following should work regardless of EWMH support:<br />
$ import -window "$(xdotool getwindowfocus -f)" /tmp/$(date +%F_%H%M%S_%N).png<br />
<br />
{{Note|If screenshots of some programs (dwb and zathura) appear blank, try appending {{ic|-frame}} or removing {{ic|-f}} from the {{ic|xdotool}} command.}}<br />
<br />
=== GIMP ===<br />
<br />
You also can take screenshots with GIMP (''File > Create > Screenshot''...).<br />
<br />
=== xwd ===<br />
<br />
Take a screenshot of the root window:<br />
$ xwd -root -out screenshot.xwd<br />
<br />
{{Note|The methods for taking shots of active windows with {{ic|import}} can also be used with {{ic|xwd}}.}}<br />
<br />
=== scrot ===<br />
<br />
{{Pkg|scrot}} enables taking screenshots from the CLI and offers features such as a user-definable time delay. Unless instructed otherwise, it saves the file in the current working directory.<br />
$ scrot -t 20 -d 5<br />
<br />
The above command saves a dated {{ic|.png}} file, along with a thumbnail (20% of original), for Web posting. It provides a 5 second delay before capturing in this instance.<br />
<br />
You can also use standard date and time formatting when saving to a file. e.g.,<br />
$ scrot ~/screenshots/%Y-%m-%d-%T-screenshot.png<br />
<br />
saves the screenshot in a filename with the current year, month, date, hours, minutes, and seconds to a folder in your home directory called "screenshots" <br />
<br />
See {{man|1|scrot}} for more information. You can simply automate the file to uploaded like so [https://github.com/kaihendry/Kai-s--HOME/tree/master/bin].<br />
<br />
{{Note|According to [http://comments.gmane.org/gmane.comp.misc.suckless/6901 this thread], {{ic|scrot -s}} does not work when run using a shortcut in {{Pkg|dwm}} (defined in {{ic|config.def.c}}/{{ic|config.c}}).}}<br />
<br />
=== escrotum ===<br />
<br />
{{AUR|escrotum-git}} screen capture using pygtk, inspired by scrot<br />
<br />
Created because scrot has glitches when selection mode is used with refreshing windows.<br />
<br />
Because the command line interface its almost the same as scrot, can be used as a replacement of it.<br />
<br />
=== imlib2 ===<br />
<br />
{{Pkg|imlib2}} provides a binary {{ic|imlib2_grab}} to take screenshots. To take a screenshot of the full screen, type:<br />
$ imlib2_grab screenshot.png<br />
<br />
Note that {{Pkg|scrot}} actually uses {{ic|imlib2}}.<br />
<br />
=== maim ===<br />
<br />
{{Pkg|maim}} is aimed to be an improved scrot.<br />
<br />
Takes screenshots of your desktop using [https://github.com/naelstrof/slop slop] for regions. It's meant to overcome shortcomings of scrot and performs better in [https://github.com/naelstrof/maim#why-use-maim-over-import-or-scrot several ways].<br />
<br />
=== FFmpeg ===<br />
<br />
[[FFmpeg]] provides an x11grab device that allows the screen to be captured in X11.<br />
<br />
Take a screenshot on a ''width'' x ''height'' display:<br />
<br />
$ ffmpeg -f x11grab -video_size ''width''x''height'' -i $DISPLAY -vframes 1 screen.png<br />
<br />
Here, the PNG codec is used as it's lossless and suitable for screenshots, but any image codec can be used.<br />
<br />
The same device allows for screencasting (on a display with a refresh rate of ''rate'' HZ):<br />
<br />
$ ffmpeg -f x11grab -video_size ''width''x''height'' -framerate ''rate'' -i $DISPLAY -c:v libx264 -preset ultrafast cast.mkv<br />
<br />
Here, the x264 codec with the fastest possible encoding speed is used. Other codecs can be used; if writing each frame is too slow (either due to inadequate disk performance or slow encoding), then frames will be dropped and video output will be choppy.<br />
<br />
=== Weston ===<br />
<br />
In the [[Wayland#Weston|Weston]] Wayland compositor, screenshots can be taking by pressing {{ic|Super+s}}, which are stored in Weston's current working directory. Screencasts are also supported; recording is started and stopped by pressing {{ic|Super+r}}, which will create a file called {{ic|capture.wcap}} in Weston's current working directory. The capture can be decoded to YUV format by running {{ic|wcap-decode --yuv4mpeg2 capture.wcap}}; the output of this command can be written to a file or piped into FFmpeg for further processing.<br />
<br />
== Details: desktop environment specific ==<br />
<br />
=== Spectacle ===<br />
<br />
If you use [[KDE]], you might want to use {{ic|Spectacle}}.<br />
<br />
Spectacle is provided by the {{Pkg|spectacle}}.<br />
<br />
=== Xfce Screenshooter ===<br />
<br />
If you use [[Xfce]] you can install {{Pkg|xfce4-screenshooter}} and then add a keyboard binding:<br />
<br />
''Xfce Menu > Settings > Keyboard > Application Shortcuts''<br />
<br />
If you want to skip the Screenshot prompt, type {{ic|$ xfce4-screenshooter -h}} in terminal for the options.<br />
<br />
=== GNOME ===<br />
<br />
[[GNOME]] users can press {{ic|Prnt Scr}} or ''Apps > Accessories > Take Screenshot''. You may need to install {{Pkg|gnome-screenshot}}.<br />
<br />
=== Cinnamon ===<br />
The default installation of [[Cinnamon]] does not provide a screenshot utility. Installing {{Pkg|gnome-screenshot}} will enable screenshots through the ''Menu > Accessories > Screenshot'' or by pressing {{ic|Prnt Scr}}.<br />
<br />
=== Other desktop environments or window managers ===<br />
<br />
For other desktop environments such as [[LXDE]] or window managers such as [[Openbox]] and [[Compiz]], one can add the above commands to the hotkey to take the screenshot. For example,<br />
$ import -window root ~/Pictures/$(date '+%Y%m%d-%H%M%S').png<br />
Adding the above command to the {{ic|Prnt Scr}} key to Compiz allows to take the screenshot to the Pictures folder according to date and time.<br />
Notice that the {{ic|rc.xml}} file in Openbox does not understand commas; so, in order to bind that command to the {{ic|Prnt Scr}} key in Openbox, you need to add the following to the keyboard section of your {{ic|rc.xml}} file:<br />
<br />
{{hc|rc.xml|<nowiki><br />
<!-- Screenshot --><br />
<keybind key="Print"><br />
<action name="Execute"><br />
<command>sh -c "import -window root ~/Pictures/$(date '+%Y%m%d-%H%M%S').png"</command><br />
</action><br />
</keybind><br />
</nowiki>}}<br />
<br />
If the {{ic|Print}} above does not work, see [[Extra keyboard keys]] and use different ''keysym'' or ''keycode''.<br />
<br />
== Terminal ==<br />
<br />
=== Output with ansi codes ===<br />
<br />
You can use the {{ic|script}} command, part of the {{Pkg|util-linux}} package.<br />
Just enter {{ic|$ script}} and from that moment, all the output is going to be saved to the {{ic|typescript}} file, including the ansi codes.<br />
<br />
Once you are done, just type {{ic|exit}} and the {{ic|typescript}} would ready. The resulting file can be converted to html using the package {{AUR|ansi2html}}, from the [[AUR]].<br />
<br />
To convert the {{ic|typescript}} file to {{ic|typescript.html}}, do the following:<br />
<br />
$ ansi2html --bg=dark < typescript > typescript.html<br />
<br />
Actually, '''some''' commands can be piped directly to ansi2html:<br />
<br />
$ ls --color|ansi2html --bg=dark >output.html<br />
<br />
That does not work on every single case, so in those cases, using {{ic|script}} is mandatory.<br />
<br />
=== Virtual console ===<br />
<br />
Install a [[framebuffer]] and use {{Pkg|fbgrab}} or {{Pkg|fbdump}} to take a screenshot.<br />
<br />
If you merely want to capture the text in the console and not an actual image, you can use {{ic|setterm}}, which is part of the {{Pkg|util-linux}} package. The following command will dump the textual contents of virtual console 1 to a file screen.dump in the current directory:<br />
# setterm -dump 1 -file screen.dump<br />
<br />
Root permission is needed because the contents of {{ic|/dev/vcs1}} need to be read.</div>Lesmanahttps://wiki.archlinux.org/index.php?title=Pacman&diff=490226Pacman2017-09-13T19:46:14Z<p>Lesmana: /* Querying package databases */ shortcut redirect</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Package management]]<br />
[[ar:Pacman]]<br />
[[cs:Pacman]]<br />
[[da:Pacman]]<br />
[[de:Pacman]]<br />
[[el:Pacman]]<br />
[[es:Pacman]]<br />
[[fa:Pacman]]<br />
[[fr:Pacman]]<br />
[[id:Pacman]]<br />
[[it:Pacman]]<br />
[[ja:Pacman]]<br />
[[ko:Pacman]]<br />
[[nl:Pacman]]<br />
[[pl:Pacman]]<br />
[[pt:Pacman]]<br />
[[ro:Pacman]]<br />
[[ru:Pacman]]<br />
[[sr:Pacman]]<br />
[[sv:Pacman]]<br />
[[tr:pacman]]<br />
[[uk:Pacman]]<br />
[[zh-hans:Pacman]]<br />
[[zh-hant:Pacman]]<br />
{{Related articles start}}<br />
{{Related|Creating packages}}<br />
{{Related|Downgrading packages}}<br />
{{Related|pacman/Package signing}}<br />
{{Related|pacman/Pacnew and Pacsave}}<br />
{{Related|pacman/Restore local database}}<br />
{{Related|pacman/Rosetta}}<br />
{{Related|pacman/Tips and tricks}}<br />
{{Related|FAQ#Package management}}<br />
{{Related|System maintenance}}<br />
{{Related|Arch Build System}}<br />
{{Related|Official repositories}}<br />
{{Related|Arch User Repository}}<br />
{{Related articles end}}<br />
<br />
The [https://www.archlinux.org/pacman/ pacman] [[Wikipedia:Package manager|package manager]] is one of the major distinguishing features of Arch Linux. It combines a simple binary package format with an easy-to-use [[Arch Build System|build system]]. The goal of ''pacman'' is to make it possible to easily manage packages, whether they are from the [[official repositories]] or the user's own builds.<br />
<br />
''pacman'' keeps the system up to date by synchronizing package lists with the master server. This server/client model also allows the user to download/install packages with a simple command, complete with all required dependencies.<br />
<br />
''pacman'' is written in the C programming language and uses the [[w:tar (computing)|tar]] format for packaging.<br />
<br />
{{Tip|The {{Pkg|pacman}} package contains other useful tools such as [[makepkg]], '''pactree''', '''vercmp''', and [[checkupdates]]. Run {{ic|pacman -Qlq pacman <nowiki>|</nowiki> grep bin}} to see the full list.}}<br />
<br />
== Usage ==<br />
<br />
What follows is just a small sample of the operations that ''pacman'' can perform. To read more examples, refer to {{man|8|pacman}}.<br />
<br />
{{Tip|For those who have used other Linux distributions before, there is a helpful [[Pacman Rosetta]] article.}}<br />
<br />
=== Installing packages ===<br />
<br />
{{Note|Packages often have a series of [[PKGBUILD#optdepends|optional dependencies]] which are packages that provide additional functionality to the application, albeit not strictly required for running it. When installing a package, ''pacman'' will list its optional dependencies among the output messages, but they will not be found in {{ic|pacman.log}}: use the [[#Querying package databases|pacman -Si]] command to view the optional dependencies of a package, together with short descriptions of their functionality.}}<br />
<br />
{{Warning|1=When installing packages in Arch, avoid refreshing the package list without [[#Upgrading packages|upgrading the system]] (for example, when a [[#Packages cannot be retrieved on installation|package is no longer found]] in the official repositories). In practice, do '''not''' run {{ic|pacman -Sy ''package_name''}} instead of {{ic|pacman -Sy'''u''' ''package_name''}}, as this could lead to dependency issues. See [[System maintenance#Partial upgrades are unsupported]] and [https://bbs.archlinux.org/viewtopic.php?id=89328 BBS#89328].}}<br />
<br />
==== Installing specific packages ====<br />
<br />
To install a single package or list of packages (including dependencies), issue the following command:<br />
<br />
# pacman -S ''package_name1'' ''package_name2'' ...<br />
<br />
To install a list of packages with regex (see [https://bbs.archlinux.org/viewtopic.php?id=7179 this forum thread]):<br />
<br />
# pacman -S $(pacman -Ssq ''package_regex'')<br />
<br />
Sometimes there are multiple versions of a package in different repositories, e.g. ''extra'' and ''testing''. To install the former version, the repository needs to be defined in front:<br />
<br />
# pacman -S extra/''package_name''<br />
<br />
To install a number of packages sharing similar patterns in their names -- not the entire group nor all matching packages; eg. {{Grp|plasma}}:<br />
<br />
# pacman -S plasma-{desktop,mediacenter,nm}<br />
<br />
Of course, that is not limited and can be expanded to however many levels needed:<br />
<br />
# pacman -S plasma-{workspace{,-wallpapers},pa}<br />
<br />
==== Installing package groups ====<br />
<br />
Some packages belong to a [[Creating_packages#Meta_packages_and_groups|group of packages]] that can all be installed simultaneously. For example, issuing the command:<br />
<br />
# pacman -S gnome<br />
<br />
will prompt you to select the packages from the {{Grp|gnome}} group that you wish to install.<br />
<br />
Sometimes a package group will contain a large amount of packages, and there may be only a few that you do or do not want to install. Instead of having to enter all the numbers except the ones you do not want, it is sometimes more convenient to select or exclude packages or ranges of packages with the following syntax:<br />
<br />
Enter a selection (default=all): 1-10 15<br />
<br />
which will select packages 1 through 10 and 15 for installation, or:<br />
<br />
Enter a selection (default=all): ^5-8 ^2<br />
<br />
which will select all packages except 5 through 8 and 2 for installation.<br />
<br />
To see what packages belong to the gnome group, run:<br />
<br />
# pacman -Sg gnome<br />
<br />
Also visit https://www.archlinux.org/groups/ to see what package groups are available.<br />
<br />
{{Note|If a package in the list is already installed on the system, it will be reinstalled even if it is already up to date. This behavior can be overridden with the {{ic|--needed}} option.}}<br />
<br />
=== Removing packages ===<br />
<br />
To remove a single package, leaving all of its dependencies installed:<br />
<br />
# pacman -R ''package_name''<br />
<br />
To remove a package and its dependencies which are not required by any other installed package:<br />
<br />
# pacman -Rs ''package_name''<br />
<br />
To remove a package, its dependencies and all the packages that depend on the target package:<br />
<br />
{{Warning|This operation is recursive, and must be used with care since it can remove many potentially needed packages.}}<br />
<br />
# pacman -Rsc ''package_name''<br />
<br />
To remove a package, which is required by another package, without removing the dependent package:<br />
<br />
# pacman -Rdd ''package_name''<br />
<br />
''pacman'' saves important configuration files when removing certain applications and names them with the extension: ''.pacsave''. To prevent the creation of these backup files use the {{ic|-n}} option:<br />
<br />
# pacman -Rn ''package_name''<br />
<br />
{{Note|''pacman'' will not remove configurations that the application itself creates (for example "dotfiles" in the home folder).}}<br />
<br />
=== Upgrading packages ===<br />
<br />
{{Warning|<br />
*Users are expected to follow the guidance in the [[System maintenance#Upgrading the system]] section to upgrade their systems regularly and not blindly run the following command.<br />
*Arch only supports full system upgrades. See [[System maintenance#Partial upgrades are unsupported]] and [[#Installing packages]] for details.}}<br />
<br />
''pacman'' can update all packages on the system with just one command. This could take quite a while depending on how up-to-date the system is. The following command synchronizes the repository databases ''and'' updates the system's packages, excluding "local" packages that are not in the configured repositories:<br />
<br />
# pacman -Syu<br />
<br />
=== Querying package databases ===<br />
<br />
''pacman'' queries the local package database with the {{ic|-Q}} flag, the sync database with the {{ic|-S}} flag and the files database with the {{ic|-F}} flag. See {{ic|pacman -Q --help}}, {{ic|pacman -S --help}} and {{ic|pacman -F --help}} for the respective suboptions of each flag.<br />
<br />
''pacman'' can search for packages in the database, searching both in packages' names and descriptions:<br />
<br />
$ pacman -Ss ''string1'' ''string2'' ...<br />
<br />
Sometimes, {{Ic|-s}}'s builtin ERE (Extended Regular Expressions) can cause a lot of unwanted results, so it has to be limited to match the package name only; not the description nor any other field:<br />
<br />
$ pacman -Ss '^vim-'<br />
<br />
To search for already installed packages:<br />
<br />
$ pacman -Qs ''string1'' ''string2'' ...<br />
<br />
To search for package file names in remote packages:<br />
<br />
$ pacman -Fs ''string1'' ''string2'' ...<br />
<br />
To display extensive information about a given package:<br />
<br />
$ pacman -Si ''package_name''<br />
<br />
For locally installed packages:<br />
<br />
$ pacman -Qi ''package_name''<br />
<br />
Passing two {{ic|-i}} flags will also display the list of backup files and their modification states:<br />
<br />
$ pacman -Qii ''package_name''<br />
<br />
To retrieve a list of the files installed by a package:<br />
<br />
$ pacman -Ql ''package_name''<br />
<br />
To retrieve a list of the files installed by a remote package:<br />
<br />
$ pacman -Fl ''package_name''<br />
<br />
To verify the presence of the files installed by a package:<br />
<br />
$ pacman -Qk ''package_name''<br />
<br />
Passing the {{ic|k}} flag twice will perform a more thorough check.<br />
<br />
To query the database to know which package a file in the file system belongs to:<br />
<br />
$ pacman -Qo ''/path/to/file_name''<br />
<br />
To query the database to know which remote package a file belongs to:<br />
<br />
$ pacman -Fo ''/path/to/file_name''<br />
<br />
To list all packages no longer required as dependencies (orphans):<br />
<br />
$ pacman -Qdt<br />
<br />
To list all packages explicitly installed and not required as dependencies:<br />
<br />
$ pacman -Qet<br />
<br />
To list a dependency tree of a package:<br />
<br />
$ pactree ''package_name''<br />
<br />
To list all the packages recursively depending on an ''installed'' package, use ''whoneeds'' from {{AUR|pkgtools}}:<br />
<br />
$ whoneeds ''package_name''<br />
<br />
or the reverse flag to ''pactree'':<br />
<br />
$ pactree -r ''package_name''<br />
<br />
See [[Pacman/Tips and tricks]] for more examples.<br />
<br />
==== Database structure ====<br />
<br />
The pacman databases are normally located at {{ic|/var/lib/pacman/sync}}. For each repository specified in {{ic|/etc/pacman.conf}} there will be a corresponding database file located there. Database files are tar-gzipped archives containing one directory for each package, for example for the {{Pkg|which}} package:<br />
<br />
{{bc|<br />
% tree which-2.20-6 <br />
which-2.20-6<nowiki><br />
|-- depends<br />
`-- desc</nowiki><br />
}}<br />
<br />
The {{ic|depends}} file lists the packages this package depends on, while {{ic|desc}} has a description of the package such as the file size and the MD5 hash.<br />
<br />
=== Cleaning the package cache ===<br />
<br />
''pacman'' stores its downloaded packages in {{ic|/var/cache/pacman/pkg/}} and does not remove the old or uninstalled versions automatically, therefore it is necessary to deliberately clean up that folder periodically to prevent such folder to grow indefinitely in size.<br />
<br />
The built-in option to remove all the cached packages that are not currently installed is:<br />
<br />
# pacman -Sc<br />
<br />
{{Warning|<br />
* Only do this when certain that previous package versions are not required, for example for a later [[downgrade]]. {{ic|pacman -Sc}} only leaves the versions of packages which are ''currently installed'' available, older versions would have to be retrieved through other means, such as the [[Archive]].<br />
* It is possible to empty the cache folder fully with {{ic|pacman -Scc}}. In addition to the above, this also prevents from reinstalling a package directly ''from'' the cache folder in case of need, thus requiring a new download. It should be avoided unless there is an immediate need for disk space.<br />
}}<br />
<br />
Because of the above limitations, consider an alternative for more control over which packages, and how many, are deleted from the cache:<br />
<br />
The ''paccache'' script, provided by the {{Pkg|pacman}} package itself, deletes all cached versions of each package regardless of whether they're installed or not, except for the most recent 3, by default:<br />
<br />
# paccache -r<br />
<br />
{{Tip|1=You can create [[pacman hooks]] to run this automatically after every pacman transaction. See [https://bbs.archlinux.org/viewtopic.php?pid=1694743#p1694743 this thread] for examples.}}<br />
<br />
You can also define how many recent versions you want to keep:<br />
<br />
# paccache -rk 1<br />
<br />
To remove all cached versions of uninstalled packages, re-run ''paccache'' with:<br />
<br />
# paccache -ruk0<br />
<br />
See {{ic|paccache -h}} for more options.<br />
<br />
{{AUR|pkgcacheclean}} and {{AUR|pacleaner}} are two further alternatives.<br />
<br />
=== Additional commands ===<br />
<br />
Download a package without installing it:<br />
<br />
# pacman -Sw ''package_name''<br />
<br />
Install a 'local' package that is not from a remote repository (e.g. the package is from the [[AUR]]):<br />
<br />
# pacman -U ''/path/to/package/package_name-version.pkg.tar.xz''<br />
<br />
To keep a copy of the local package in ''pacman'''s cache, use:<br />
<br />
# pacman -U file:///''path/to/package/package_name-version.pkg.tar.xz''<br />
<br />
Install a 'remote' package (not from a repository stated in ''pacman'''s configuration files):<br />
<br />
# pacman -U ''<nowiki>http://www.example.com/repo/example.pkg.tar.xz</nowiki>''<br />
<br />
To inhibit the {{ic|-S}}, {{ic|-U}} and {{ic|-R}} actions, {{ic|-p}} can be used.<br />
<br />
''pacman'' always lists packages to be installed or removed and asks for permission before it takes action.<br />
<br />
=== Installation reason ===<br />
<br />
The ''pacman'' database distinguishes the installed packages in two groups according to the reason why they were installed:<br />
<br />
* '''explicitly-installed''': the packages that were literally passed to a generic ''pacman'' {{ic|-S}} or {{ic|-U}} command;<br />
* '''dependencies''': the packages that, despite never (in general) having been passed to a ''pacman'' installation command, were implicitly installed because [[dependency|required]] by another package that was explicitly installed.<br />
<br />
When installing a package, it is possible to force its installation reason to ''dependency'' with:<br />
<br />
# pacman -S --asdeps ''package_name''<br />
<br />
When '''re'''installing a package, though, the current installation reason is preserved by default.<br />
<br />
The list of explicitly-installed packages can be shown with {{ic|pacman -Qe}}, while the complementary list of dependencies can be shown with {{ic|pacman -Qd}}.<br />
<br />
To change the installation reason of an already installed package, execute:<br />
<br />
# pacman -D --asdeps ''package_name''<br />
<br />
Use {{ic|--asexplicit}} to do the opposite operation.<br />
<br />
{{Tip|Installing optional dependencies with {{ic|--asdeps}} will cause it such that if you [[Pacman/Tips_and_tricks#Removing_unused_packages_.28orphans.29|remove orphans]], ''pacman'' will also remove leftover optional dependencies.}}<br />
<br />
=== Search for a package that contains a specific file ===<br />
<br />
Sync the files database:<br />
<br />
# pacman -Fy<br />
<br />
Search for a package containing a file, e.g.:<br />
<br />
# pacman -Fs pacman<br />
core/pacman 5.0.1-4<br />
usr/bin/pacman<br />
usr/share/bash-completion/completions/pacman<br />
extra/xscreensaver 5.36-1<br />
usr/lib/xscreensaver/pacman<br />
<br />
{{Tip|You can set a cron job or a systemd timer to sync the files database regularly.}}<br />
<br />
For advanced functionality install [[pkgfile]], which uses a separate database with all files and their associated packages.<br />
<br />
== Configuration ==<br />
<br />
''pacman'''s settings are located in {{ic|/etc/pacman.conf}}: this is the place where the user configures the program to work in the desired manner. In-depth information about the configuration file can be found in {{man|5|pacman.conf}}.<br />
<br />
=== General options ===<br />
<br />
General options are in the {{ic|[options]}} section. Read {{man|8|pacman}} or look in the default {{ic|pacman.conf}} for information on what can be done here.<br />
<br />
==== Comparing versions before updating ====<br />
<br />
To see old and new versions of available packages, uncomment the "VerbosePkgLists" line in {{ic|/etc/pacman.conf}}. The output of {{ic|pacman -Syu}} will be like this:<br />
<br />
Package (6) Old Version New Version Net Change Download Size<br />
<br />
extra/libmariadbclient 10.1.9-4 10.1.10-1 0.03 MiB 4.35 MiB<br />
extra/libpng 1.6.19-1 1.6.20-1 0.00 MiB 0.23 MiB<br />
extra/mariadb 10.1.9-4 10.1.10-1 0.26 MiB 13.80 MiB<br />
<br />
==== Skip package from being upgraded ====<br />
<br />
{{Warning|Be careful in skipping packages, since [[partial upgrades]] are unsupported.}}<br />
<br />
To have a specific package skipped when [[#Upgrading packages|upgrading]] the system, specify it as such:<br />
<br />
IgnorePkg=linux<br />
<br />
For multiple packages use a space-separated list, or use additional {{ic|IgnorePkg}} lines. Also, glob patterns can be used. If you want to skip packages just once, you can also use the {{ic|--ignore}} option on the command-line - this time with a comma-separated list.<br />
<br />
It will still be possible to upgrade the ignored packages using {{ic|pacman -S}}: in this case ''pacman'' will remind you that the packages have been included in an {{ic|IgnorePkg}} statement.<br />
<br />
==== Skip package group from being upgraded ====<br />
<br />
{{Warning|Be careful in skipping package groups, since [[partial upgrades]] are unsupported.}}<br />
<br />
As with packages, skipping a whole package group is also possible:<br />
<br />
IgnoreGroup=gnome<br />
<br />
==== Skip files from being installed to system ====<br />
<br />
To always skip installation of specific directories list them under {{Ic|NoExtract}}. For example, to avoid installation of [[systemd]] units use this:<br />
<br />
NoExtract=usr/lib/systemd/system/*<br />
<br />
Later rules override previous ones, and you can negate a rule by prepending {{ic|!}}.<br />
<br />
{{Tip|''pacman'' issues warning messages about missing locales when updating a package for which locales have been cleared by ''localepurge'' or ''bleachbit''. Commenting the {{ic|CheckSpace}} option in {{ic|pacman.conf}} suppresses such warnings, but consider that the space-checking functionality will be disabled for all packages.}}<br />
<br />
==== Maintain several configuration files ====<br />
<br />
If you have several configuration files (e.g. main configuration and configuration with [[testing]] repository enabled) and would have to share options between configurations you may use {{ic|Include}} option declared in the configuration files, e.g.:<br />
<br />
Include = ''/path/to/common/settings''<br />
<br />
where {{ic|''/path/to/common/settings''}} file contains the same options for both configurations.<br />
<br />
==== Hooks ====<br />
<br />
''pacman'' can run pre- and post-transaction hooks from the {{ic|/usr/share/libalpm/hooks/}} directory; more directories can be specified with the {{ic|HookDir}} option in {{ic|pacman.conf}}, which defaults to {{ic|/etc/pacman.d/hooks}}. Hook file names must be suffixed with ''.hook''.<br />
<br />
For more information on alpm hooks, see {{man|5|alpm-hooks}}.<br />
<br />
=== Repositories and mirrors ===<br />
<br />
Besides the special [[#General options|[options]]] section, each other {{ic|[section]}} in {{ic|pacman.conf}} defines a package repository to be used. A ''repository'' is a ''logical'' collection of packages, which are ''physically'' stored on one or more servers: for this reason each server is called a ''mirror'' for the repository.<br />
<br />
Repositories are distinguished between [[Official repositories|official]] and [[Unofficial user repositories|unofficial]]. The order of repositories in the configuration file matters; repositories listed first will take precedence over those listed later in the file when packages in two repositories have identical names, regardless of version number. In order to use a repository after adding it, you will need to [[#Upgrading packages|upgrade]] the whole system first.<br />
<br />
Each repository section allows defining the list of its mirrors directly or in a dedicated external file through the {{ic|Include}} directive: for example, the mirrors for the official repositories are included from {{ic|/etc/pacman.d/mirrorlist}}. See the [[Mirrors]] article for mirror configuration.<br />
<br />
==== Package security ====<br />
<br />
''pacman'' supports package signatures, which add an extra layer of security to the packages. The default configuration, {{ic|1=SigLevel = Required DatabaseOptional}}, enables signature verification for all the packages on a global level: this can be overridden by per-repository {{ic|SigLevel}} lines. For more details on package signing and signature verification, take a look at [[pacman-key]].<br />
<br />
== Troubleshooting ==<br />
<br />
=== "Failed to commit transaction (conflicting files)" error ===<br />
<br />
If you see the following error: [https://bbs.archlinux.org/viewtopic.php?id=56373]<br />
<br />
error: could not prepare transaction<br />
error: failed to commit transaction (conflicting files)<br />
''package'': ''/path/to/file'' exists in filesystem<br />
Errors occurred, no packages were upgraded.<br />
<br />
Why this is happening: ''pacman'' has detected a file conflict, and by design, will not overwrite files for you. This is a design feature, not a flaw.<br />
<br />
The problem is usually trivial to solve. A safe way is to first check if another package owns the file ({{ic|pacman -Qo ''/path/to/file''}}). If the file is owned by another package, [[Reporting bug guidelines|file a bug report]]. If the file is not owned by another package, rename the file which 'exists in filesystem' and re-issue the update command. If all goes well, the file may then be removed.<br />
<br />
If you had installed a program manually without using ''pacman'' or a frontend, for example through {{ic|make install}}, you have to remove it and all its files and reinstall properly using ''pacman''. See also [[Pacman tips#Identify files not owned by any package]].<br />
<br />
Every installed package provides a {{ic|/var/lib/pacman/local/''$package-$version''/files}} file that contains metadata about this package. If this file gets corrupted, is empty or goes missing, it results in {{ic|file exists in filesystem}} errors when trying to update the package. Such an error usually concerns only one package. Instead of manually renaming and later removing all the files that belong to the package in question, you may exceptionally run {{ic|pacman -S --force $package}} to force ''pacman'' to overwrite these files.<br />
<br />
{{Warning|Take care when using the {{ic|--force}} switch (for example {{ic|pacman -Syu --force}}) as it can cause major problems if used improperly. It is highly recommended to only use this option when the Arch news instructs the user to do so.}}<br />
<br />
=== "Failed to commit transaction (invalid or corrupted package)" error ===<br />
<br />
Look for ''.part'' files (partially downloaded packages) in {{ic|/var/cache/pacman/pkg}} and remove them (often caused by usage of a custom {{ic|XferCommand}} in {{ic|pacman.conf}}).<br />
<br />
# find /var/cache/pacman/pkg/ -iname "*.part" -exec rm {} \;<br />
<br />
=== "Failed to init transaction (unable to lock database)" error ===<br />
<br />
When ''pacman'' is about to alter the package database, for example installing a package, it creates a lock file at {{ic|/var/lib/pacman/db.lck}}. This prevents another instance of ''pacman'' from trying to alter the package database at the same time.<br />
<br />
If ''pacman'' is interrupted while changing the database, this stale lock file can remain. If you are certain that no instances of ''pacman'' are running then delete the lock file:<br />
<br />
# rm /var/lib/pacman/db.lck<br />
<br />
=== Packages cannot be retrieved on installation ===<br />
<br />
This error manifests as {{ic|Not found in sync db}}, {{ic|Target not found}} or {{ic|Failed retrieving file}}.<br />
<br />
Firstly, ensure the package actually exists (and watch out for typos!). If certain the package exists, your package list may be out-of-date or your repositories may be incorrectly configured. Try running {{ic|pacman -Syyu}} to force a refresh of all package lists and upgrade.<br />
<br />
It could also be that the repository containing the package is not enabled on your system, e.g. the package could be in the ''multilib'' repository, but ''multilib'' is not enabled in your ''pacman.conf''.<br />
<br />
See also [[FAQ#Why is there only a single version of each shared library in the official repositories?]].<br />
<br />
=== Manually reinstalling pacman ===<br />
<br />
{{Warning|It is extremely easy to break your system even worse using this approach. Use this only as a last resort if the method from [[#pacman crashes during an upgrade]] is not an option.}}<br />
<br />
Even if ''pacman'' is terribly broken, you can fix it manually by downloading the latest packages and extracting them to the correct locations. The rough steps to perform are<br />
<br />
# Determine dependencies to install<br />
# Download each package from a mirror of your choice<br />
# Extract each package to root<br />
# Reinstall these packages with {{ic|pacman -Sf}} to update the package database accordingly<br />
# Do a full system upgrade<br />
<br />
If you have a healthy Arch system on hand, you can see the full list of dependencies with<br />
<br />
$ pacman -Q $(pactree -u pacman)<br />
<br />
but you may only need to update a few of them depending on your issue. An example of extracting a package is<br />
<br />
# tar -xvpwf ''package.tar.xz'' -C / --exclude .PKGINFO --exclude .INSTALL<br />
<br />
Note the use of the {{ic|w}} flag for interactive mode. Running non-interactively is very risky since you might end up overwriting an important file. Also take care to extract packages in the correct order (i.e. dependencies first). [https://bbs.archlinux.org/viewtopic.php?id=95007 This forum post] contains an example of this process where only a couple ''pacman'' dependencies are broken.<br />
<br />
=== pacman crashes during an upgrade ===<br />
<br />
In the case that ''pacman'' crashes with a "database write" error while removing packages, and reinstalling or upgrading packages fails thereafter, do the following:<br />
<br />
# Boot using the Arch installation media. Preferably use a recent media so that the ''pacman'' version matches/is newer than the system. <br />
# Mount the system's root filesystem, e.g. {{ic|mount /dev/sdaX /mnt}} as root, and check the mount has sufficient space with {{ic|df -h}}<br />
# Mount the proc and sysfs filesystems as well: {{ic|mount -t {proc,sysfs} /dev/sdaX {/mnt/proc, /mnt/sys} }} <br />
# If the system uses default database and directory locations, you can now update the system's pacman database and upgrade it via {{ic|1=pacman --root=/mnt --cachedir=/mnt/var/cache/pacman/pkg -Syyu}} as root. <br />
# After the upgrade, one way to double-check for not upgraded but still broken packages: {{ic|find /mnt/usr/lib -size 0}} <br />
# Followed by a re-install of any still broken package via {{ic|1=pacman --root /mnt --cachedir=/mnt/var/cache/pacman/pkg -S ''package''}}.<br />
<br />
=== "Unable to find root device" error after rebooting ===<br />
<br />
Most likely your initramfs got broken during a kernel update (improper use of ''pacman'''s {{ic|--force}} option can be a cause). You have two options; first, try the ''Fallback'' entry.<br />
<br />
{{Tip|In case you removed the ''Fallback'' entry, you can always press the {{ic|Tab}} key when the bootloader menu shows up (for Syslinux) or {{ic|e}} (for GRUB or systemd-boot), rename it {{ic|initramfs-linux-fallback.img}} and press {{ic|Enter}} or {{ic|b}} (depending on your bootloader) to boot with the new parameters.}}<br />
<br />
Once the system starts, run this command (for the stock {{Pkg|linux}} kernel) either from the console or from a terminal to rebuild the initramfs image:<br />
<br />
# mkinitcpio -p linux<br />
<br />
If that does not work, from a current Arch release (CD/DVD or USB stick), [[mount]] your root and boot partitions. Then [[chroot]] using ''arch-chroot'':<br />
<br />
# arch-chroot /mnt<br />
# pacman -Syu mkinitcpio systemd linux<br />
<br />
{{Note|<br />
* If you do not have a current release or if you only have some other "live" Linux distribution laying around, you can [[chroot]] using the old fashioned way. Obviously, there will be more typing than simply running the {{ic|arch-chroot}} script.<br />
* If ''pacman'' fails with {{ic|Could not resolve host}}, please [[Network_configuration#Check_the_connection|check your internet connection]].<br />
* If you cannot enter the arch-chroot or chroot environment but need to re-install packages you can use the command {{ic|pacman -r /mnt -Syu foo bar}} to use ''pacman'' on your root partition.}}<br />
<br />
Reinstalling the kernel (the {{Pkg|linux}} package) will automatically re-generate the initramfs image with {{ic|mkinitcpio -p linux}}. There is no need to do this separately.<br />
<br />
Afterwards, it is recommended that you run {{ic|exit}}, {{ic|umount /mnt/{boot,} }} and {{ic|reboot}}.<br />
<br />
=== Signature from "User <email@example.org>" is unknown trust, installation failed ===<br />
<br />
You can try to either:<br />
* update the known keys, i.e. {{ic|pacman-key --refresh-keys}}<br />
* manually upgrade {{Pkg|archlinux-keyring}} package first, i.e. {{ic|pacman -Sy archlinux-keyring && pacman -Su}}<br />
* follow [[pacman-key#Resetting all the keys]]<br />
<br />
=== Request on importing PGP keys ===<br />
<br />
If [[Installation guide|installing]] Arch with an outdated ISO, you are likely prompted to import PGP keys. Agree to download the key to proceed. If you are unable to add the PGP key successfully, update the keyring or upgrade {{Pkg|archlinux-keyring}} (see [[#Signature from "User <email@example.org>" is unknown trust, installation failed|above]]).<br />
<br />
=== Error: key "0123456789ABCDEF" could not be looked up remotely ===<br />
<br />
If packages are signed with new keys, which were only recently added to {{Pkg|archlinux-keyring}}, these keys are not locally available during update (chicken-egg-problem). The installed {{Pkg|archlinux-keyring}} does not contain the key, until it is updated. Pacman tries to bypass this by a lookup through a key-server, might not be possible e.g. behind proxys or firewalls and results in the stated error. Upgrade {{Pkg|archlinux-keyring}} first as shown [[#Signature from "User <email@example.org>" is unknown trust, installation failed|above]].<br />
<br />
=== Signature from "User <email@archlinux.org>" is invalid, installation failed ===<br />
<br />
When the system time is faulty, signing keys are considered expired (or invalid) and signature checks on packages will fail with the following error:<br />
<br />
error: ''package'': signature from "User <email@archlinux.org>" is invalid<br />
error: failed to commit transaction (invalid or corrupted package (PGP signature))<br />
Errors occured, no packages were upgraded.<br />
<br />
Make sure to correct the [[time]], for example with {{ic|ntpd -qg}} run as root, and run {{ic|hwclock -w}} as root before subsequent installations or upgrades.<br />
<br />
=== "Warning: current locale is invalid; using default "C" locale" error ===<br />
<br />
As the error message says, your locale is not correctly configured. See [[Locale]].<br />
<br />
=== pacman does not honor proxy settings ===<br />
<br />
Make sure that the relevant environment variables ({{ic|$http_proxy}}, {{ic|$ftp_proxy}} etc.) are set up. If you use ''pacman'' with [[sudo]], you need to configure sudo to [[sudo#Environment variables|pass these environment variables to pacman]].<br />
<br />
=== How do I reinstall all packages, retaining information on whether something was explicitly installed or as a dependency? ===<br />
<br />
To reinstall all the native packages: {{ic|<nowiki>pacman -Qnq | pacman -S -</nowiki>}} (the {{ic|-S}} option preserves the installation reason by default).<br />
<br />
You will then need to reinstall all the foreign packages, which can be listed with {{ic|pacman -Qmq}}.<br />
<br />
=== "Cannot open shared object file" error ===<br />
<br />
It looks like previous ''pacman'' transaction removed or corrupted shared libraries needed for pacman itself.<br />
<br />
To recover from this situation you need to unpack required libraries to your filesystem manually. First find what package contains the missed library and then locate it in the ''pacman'' cache ({{ic|/var/cache/pacman/pkg/}}). Unpack required shared library to the filesystem. This will allow to run ''pacman''.<br />
<br />
Now you need to [[#Installing specific packages|reinstall]] the broken package. Note that you need to use {{ic|--force}} flag as you just unpacked system files and ''pacman'' does not know about it. ''pacman'' will correctly replace our shared library file with one from package.<br />
<br />
That's it. Update the rest of the system.<br />
<br />
=== Freeze of package downloads ===<br />
<br />
Some issues have been reported regarding network problems that prevent ''pacman'' from updating/synchronizing repositories. [https://bbs.archlinux.org/viewtopic.php?id&#61;68944] [https://bbs.archlinux.org/viewtopic.php?id&#61;65728] When installing Arch Linux natively, these issues have been resolved by replacing the default ''pacman'' file downloader with an alternative (see [[Improve pacman performance]] for more details). When installing Arch Linux as a guest OS in [[VirtualBox]], this issue has also been addressed by using ''Host interface'' instead of ''NAT'' in the machine properties.<br />
<br />
=== Failed retrieving file 'core.db' from mirror ===<br />
<br />
If you receive this error message with correct [[mirrors]], try setting a different [[Resolv.conf|name server]].<br />
<br />
== See also ==<br />
<br />
* [https://www.archlinux.org/pacman/ Pacman Home Page]<br />
* {{man|3|libalpm}}<br />
* {{man|8|pacman}}<br />
* {{man|5|pacman.conf}}<br />
* {{man|8|repo-add}}</div>Lesmanahttps://wiki.archlinux.org/index.php?title=Java_Runtime_Environment_fonts&diff=473273Java Runtime Environment fonts2017-04-08T03:11:32Z<p>Lesmana: /* Basic settings */ typo</p>
<hr />
<div>[[Category:Fonts]]<br />
[[ja:Java ランタイム環境のフォント]]<br />
[[ru:Java Runtime Environment fonts]]<br />
{{Related articles start}}<br />
{{Related|Fonts}}<br />
{{Related|Font configuration}}<br />
{{Related|MS Fonts}}<br />
{{Related|X Logical Font Description}}<br />
{{Related articles end}}<br />
Some users may find the default Java fonts or the display mode of fonts in Java applications to be unpleasant. Several methods to improve the font display in the Oracle Java Runtime Environment (JRE) are available. These methods may be used separately, but many users will find they achieve better results by combining them.<br />
<br />
TrueType fonts appear to be the best supported format for use with Java.<br />
<br />
==Anti-aliasing==<br />
=== Basic settings ===<br />
<br />
[[wikipedia:Font rasterization|Anti-aliasing]] of fonts is available with Oracle Java 1.6 and OpenJDK on Linux. To do this system-wide, add the following line to {{ic|/etc/environment}}:<br />
<br />
_JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=''setting'''<br />
<br />
Where {{Ic|''setting''}} is one of the values:<br />
<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
|-<br />
| {{Ic|off}}, {{Ic|false}}, {{Ic|default}}<br />
| No anti-aliasing<br />
|-<br />
| {{Ic|on}}<br />
| Full anti-aliasing<br />
|-<br />
| {{Ic|gasp}}<br />
| Use the font's built-in hinting instructions<br />
|-<br />
| {{Ic|lcd}}, {{Ic|lcd_hrgb}}<br />
| Anti-aliasing tuned for many popular LCD monitors<br />
|-<br />
| {{Ic|lcd_hbgr}}, {{Ic|lcd_vrgb}}, {{Ic|lcd_vbgr}}<br />
| Alternative LCD monitor setting<br />
|}<br />
<br />
The {{Ic|gasp}} and {{Ic|lcd}} settings work well in many instances. <br />
<br />
To optionally to use GTK look and feel, add the following line instead:<br />
<br />
_JAVA_OPTIONS='-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel' ''<br />
<br />
{{Note|<br />
* The described Java options only work for applications that draw their GUI in Java, like Jdownloader, and not for applications which utilize Java as backend only, like Openoffice.org and Matlab.<br />
* '''TrueType''' fonts contain a '''g'''rid-fitting '''a'''nd '''s'''can-conversion '''p'''rocedure (''GASP'') table with the designer's recommendations for the font's display at different point sizes. Some sizes are recommended to be fully anti-aliased, others are to be hinted, and some are to be displayed as bitmaps. Combinations are sometimes used for certain point sizes.<br />
}}<br />
<br />
Specify the variable on the command line before the executable to try the new configuration:<br />
<br />
_JAVA_OPTIONS=''options'' ''executable'' <br />
<br />
Re-login for the changes to take effect.<br />
<br />
=== Font hinting ===<br />
<br />
Some java applications are subject to system font hinting changes. Consider choosing one of the following environment variables before launching a java app:<br />
<br />
export FT2_SUBPIXEL_HINTING=0 # Classic mode<br />
export FT2_SUBPIXEL_HINTING=1 # Infinality mode<br />
export FT2_SUBPIXEL_HINTING=2 # Default mode<br />
<br />
For example, the value of <tt>0</tt> makes freetype use non-bold fonts (at least for some apps).<br />
<br />
=== OpenJDK patch ===<br />
<br />
Even with anti-aliasing enforced through Java options, the resulting anti-aliasing may be inferior to native applications. This can be remedied with a patch to OpenJDK, available in the [[AUR]]:<br />
* Patched '''OpenJDK7''' is available as {{AUR|jre7-openjdk-infinality}} (<tt>--enable-infinality=yes</tt>)<br />
* Patched '''OpenJDK8''' is available as {{AUR|jre8-openjdk-infinality}}<br />
The patched version obtains the per-family FreeType rendering/loading flags from fontconfig instead of using OpenJDK heuristics. Although this is an [[Infinality]] package, the patches themselves don't actually depend on {{AUR|fontconfig-infinality}} since only vanilla {{Pkg|fontconfig}} APIs are used.<br />
<br />
==Font selection==<br />
<br />
===TrueType fonts===<br />
<br />
Some Java applications may specify use of a particular TrueType font; these applications must be made aware of the directory path to the desired font. TrueType fonts are installed in the directory {{ic|/usr/share/fonts/TTF}}. Add the following line to {{ic|/etc/environment}} to enable these fonts.<br />
<br />
JAVA_FONTS=/usr/share/fonts/TTF<br />
<br />
Relogin for the change to take effect.<br />
<br />
===Fixing Mojibake (For JRE8)===<br />
Place font files under the directory below. Create the directory if it does not exist.<br />
<br />
/usr/lib/jvm/java-8-openjdk/jre/lib/fonts/fallback/</div>Lesmanahttps://wiki.archlinux.org/index.php?title=PulseAudio/Troubleshooting&diff=468412PulseAudio/Troubleshooting2017-02-16T18:22:27Z<p>Lesmana: /* The only device shown is "dummy output" or newly connected cards are not detected */ add pulseaudio -k</p>
<hr />
<div>[[Category:Sound]]<br />
[[it:PulseAudio/Troubleshooting]]<br />
[[ja:PulseAudio/トラブルシューティング]]<br />
[[ru:PulseAudio/Troubleshooting]]<br />
See [[PulseAudio]] for the main article.<br />
<br />
== Volume ==<br />
<br />
Here you will find some hints on volume issues and why you may not hear anything.<br />
<br />
=== Auto-Mute Mode ===<br />
<br />
Auto-Mute Mode may be enabled. It can be disabled using {{ic|alsamixer}}.<br />
<br />
See http://superuser.com/questions/431079/how-to-disable-auto-mute-mode for more.<br />
<br />
To save your current settings as the default options, run {{ic|alsactl store}} as root.<br />
<br />
=== Muted audio device ===<br />
<br />
If one experiences no audio output via any means while using [[ALSA]], attempt to unmute the sound card. To do this, launch {{ic|alsamixer}} and make sure each column has a green {{ic|00}} under it (this can be toggled by pressing {{ic|m}}):<br />
<br />
$ alsamixer -c 0<br />
<br />
{{Note|alsamixer will not tell you which output device is set as the default. One possible cause of no sound after install is that PulseAudio detects the wrong output device as a default. Install {{Pkg|pavucontrol}} and check if there is any output on the pavucontrol panel when playing a ''.wav'' file.}}<br />
<br />
=== Output stuck muted while Master is toggled ===<br />
<br />
In setups with multiple outputs (e.g. 'Headphone' and 'Speaker') using plain amixer to toggle Master can trigger PulseAudio to mute the active output too, but it does not necessarily unmute it when Master is toggled back to be unmuted. [https://lists.freedesktop.org/archives/pulseaudio-discuss/2015-December/025062.html] To resolve this, amixer must have the device flag set to 'pulse':<br />
<br />
$ amixer -D pulse sset Master toggle<br />
<br />
This will cause amixer to ask PulseAudio to do the toggling rather than toggling it directly.<br />
Because of this, PulseAudio will correctly unmute Master as well as any applicable output.<br />
<br />
=== Muted application ===<br />
<br />
If a specific application is muted or low while all else seems to be in order, it may be due to individual {{ic|sink-input}} settings. With the offending application playing audio, run:<br />
<br />
$ pacmd list-sink-inputs<br />
<br />
Find and make note of the {{ic|index}} of the corresponding {{ic|sink input}}. The {{ic|properties:}} {{ic|application.name}} and {{ic|application.process.binary}}, among others, should help here. Ensure sane settings are present, specifically those of {{ic|muted}} and {{ic|volume}}.<br />
If the sink is muted, it can be unmuted by:<br />
<br />
$ pacmd set-sink-input-mute <index> false<br />
<br />
If the volume needs adjusting, it can be set to 100% by:<br />
<br />
$ pacmd set-sink-input-volume <index> 0x10000<br />
<br />
{{Note|If {{ic|pacmd}} reports {{ic|0 sink input(s)}}, double-check that the application is playing audio. If it is still absent, verify that other applications show up as sink inputs.}}<br />
<br />
=== Volume adjustment does not work properly ===<br />
<br />
Check:<br />
{{ic|/usr/share/pulseaudio/alsa-mixer/paths/analog-output.conf.common}}<br />
<br />
If the volume does not appear to increment/decrement properly using {{ic|alsamixer}} or {{ic|amixer}}, it may be due to PulseAudio having a larger number of increments (65537 to be exact). Try using larger values when changing volume (e.g. {{ic|amixer set Master 655+}}).<br />
<br />
=== Per-application volumes change when the Master volume is adjusted ===<br />
<br />
This is because PulseAudio uses flat volumes by default, instead of relative volumes, relative to an absolute master volume. If this is found to be inconvenient, asinine, or otherwise undesireable, relative volumes can be enabled by disabling flat volumes in the PulseAudio daemon's configuration file:<br />
<br />
{{hc|/etc/pulse/daemon.conf or ~/.config/pulse/daemon.conf|<nowiki><br />
flat-volumes = no<br />
</nowiki>}}<br />
<br />
and then restarting PulseAudio by executing<br />
<br />
$ pulseaudio -k<br />
$ pulseaudio --start<br />
<br />
=== Volume gets louder every time a new application is started ===<br />
<br />
Per default, it seems as if changing the volume in an application sets the global system volume to that level instead of only affecting the respective application. Applications setting their volume on startup will therefore cause the system volume to "jump".<br />
<br />
Fix this by disabling flat volumes, as demonstrated in the previous section. When Pulse comes back after a few seconds, applications will not alter the global system volume anymore but have their own volume level again.<br />
<br />
{{Note|A previously installed and removed pulseaudio-equalizer may leave behind remnants of the setup in {{ic|~/.config/pulse/default.pa}} or {{ic|~/.pulse/default.pa}} which can also cause maximized volume trouble. Comment that out as needed.}}<br />
<br />
=== Sound output is only mono on M-Audio Audiophile 2496 sound card ===<br />
<br />
Add the following:<br />
<br />
{{hc|/etc/pulseaudio/default.pa|<nowiki><br />
load-module module-alsa-sink sink_name=delta_out device=hw:M2496 format=s24le channels=10 channel_map=left,right,aux0,aux1,aux2,aux3,aux4,aux5,aux6,aux7<br />
load-module module-alsa-source source_name=delta_in device=hw:M2496 format=s24le channels=12 channel_map=left,right,aux0,aux1,aux2,aux3,aux4,aux5,aux6,aux7,aux8,aux9<br />
set-default-sink delta_out<br />
set-default-source delta_in<br />
</nowiki>}}<br />
<br />
=== No sound below a volume cutoff ===<br />
<br />
Known issue (won't fix): https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/223133<br />
<br />
If sound does not play when PulseAudio's volume is set below a certain level, try setting {{ic|1=ignore_dB=1}} in {{ic|/etc/pulse/default.pa}}:<br />
{{hc|/etc/pulse/default.pa|<nowiki><br />
load-module module-udev-detect ignore_dB=1<br />
</nowiki>}}<br />
<br />
However, be aware that it may cause another bug preventing PulseAudio to unmute speakers when headphones or other audio devices are unplugged.<br />
<br />
=== Low volume for internal microphone ===<br />
<br />
If you experience low volume on internal notebook microphone, try setting:<br />
{{hc|/etc/pulse/default.pa|<nowiki><br />
set-source-volume 1 300000<br />
</nowiki>}}<br />
<br />
=== Clients alter master output volume (a.k.a. volume jumps to 100% after running application) ===<br />
<br />
If changing the volume in specific applications or simply running an application changes the master output volume this is likely due to flat volumes mode of pulseaudio. Before disabling it, KDE users should try lowering their system notifications volume in ''System Settings -> Application and System Notifications -> Manage Notifications'' under the ''Player Settings'' tab to something reasonable. Changing the ''Event Sounds'' volume in KMix or another volume mixer application will not help here. This should make the flat-volumes mode work out as intended, if it does not work, some other application is likely requesting 100% volume when its playing something. If all else fails, you can try to disable flat-volumes:<br />
<br />
{{hc|/etc/pulse/daemon.conf|<nowiki><br />
flat-volumes = no<br />
</nowiki>}}<br />
<br />
Then restart PulseAudio daemon:<br />
<br />
# pulseaudio -k<br />
# pulseaudio --start<br />
<br />
=== No sound after resume from suspend ===<br />
<br />
If audio generally works, but stops after resume from suspend, try "reloading" PulseAudio by executing:<br />
$ /usr/bin/pasuspender /bin/true<br />
<br />
This is better than completely killing and restarting it ({{ic|pulseaudio -k}} followed by {{ic|pulseaudio --start}}), because it does not break already running applications.<br />
<br />
If the above fixes your problem, you may wish to automate it, by creating a systemd service file.<br />
<br />
1. Create the template service file in {{ic|/etc/systemd/system/resume-fix-pulseaudio@.service}}:<br />
<br />
[Unit]<br />
Description=Fix PulseAudio after resume from suspend<br />
After=suspend.target<br />
<br />
[Service]<br />
User=%I<br />
Type=oneshot<br />
Environment="XDG_RUNTIME_DIR=/run/user/%U"<br />
ExecStart=/usr/bin/pasuspender /bin/true<br />
<br />
[Install]<br />
WantedBy=suspend.target<br />
<br />
2. Enable it for your user account<br />
<br />
# systemctl enable resume-fix-pulseaudio@YOUR_USERNAME_HERE.service<br />
<br />
3. Reload systemd<br />
<br />
# systemctl --system daemon-reload<br />
<br />
=== ALSA channels mute when headphones are plugged/unplugged improperly ===<br />
<br />
If when you unplug your headphones or plug them in the audio remains muted in alsamixer on the wrong channel due to it being set to 0%, you may be able to fix it by opening {{ic|/etc/pulse/default.pa}} and commenting out the line:<br />
<br />
load-module module-switch-on-port-available<br />
<br />
== Microphone ==<br />
<br />
=== Microphone not detected by PulseAudio ===<br />
<br />
Determine the card and device number of your mic:<br />
<br />
$ arecord -l<br />
**** List of CAPTURE Hardware Devices ****<br />
card 0: PCH [HDA Intel PCH], device 0: ALC269VC Analog [ALC269VC Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
In hw:CARD,DEVICE notation, you would specify the above device as {{ic|hw:0,0}}.<br />
<br />
Then, edit {{ic|/etc/pulse/default.pa}} and insert a {{ic|load-module}} line specifying your device as follows:<br />
<br />
load-module module-alsa-source device=hw:0,0<br />
# the line above should be somewhere before the line below<br />
.ifexists module-udev-detect.so<br />
<br />
Finally, restart pulseaudio to apply the new settings:<br />
<br />
$ pulseaudio -k ; pulseaudio -D<br />
<br />
If everything worked correctly, you should now see your mic show up when running {{ic|pavucontrol}} (under the {{ic|Input Devices}} tab).<br />
<br />
=== PulseAudio uses wrong microphone ===<br />
<br />
If PulseAudio uses the wrong microphone, and changing the Input Device with Pavucontrol did not help, take a look at alsamixer. It seems that Pavucontrol does not always set the input source correctly.<br />
<br />
$ alsamixer<br />
<br />
Press {{ic|F6}} and choose your sound card, e.g. HDA Intel. Now press {{ic|F5}} to display all items. Try to find the item: {{ic|Input Source}}. With the up/down arrow keys you are able to change the input source.<br />
<br />
Now try if the correct microphone is used for recording.<br />
<br />
=== No microphone on ThinkPad T400/T500/T420 ===<br />
<br />
Run:<br />
<br />
alsamixer -c 0<br />
<br />
Unmute and maximize the volume of the "Internal Mic".<br />
<br />
Once you see the device with:<br />
<br />
arecord -l<br />
<br />
you might still need to adjust the settings. The microphone and the audio jack are duplexed. Set the configuration of the internal audio in pavucontrol to ''Analog Stereo Duplex''.<br />
<br />
=== No microphone input on Acer Aspire One ===<br />
<br />
Install pavucontrol, unlink the microphone channels and turn down the left one to 0.<br />
Reference: http://getsatisfaction.com/jolicloud/topics/deaf_internal_mic_on_acer_aspire_one#reply_2108048<br />
<br />
=== Static noise in microphone recording ===<br />
<br />
If we are getting static noise in Skype, gnome-sound-recorder, arecord, etc.'s recordings, then the sound card sample rate is incorrect. That is why there is static noise in Linux microphone recordings. To fix this, we need to set the sampling rate in {{ic|/etc/pulse/daemon.conf}} for the sound hardware.<br />
<br />
==== Determine sound cards in the system (1/5) ====<br />
<br />
This requires {{Pkg|alsa-utils}} and related packages to be installed:<br />
{{hc|$ arecord --list-devices|<br />
**** List of CAPTURE Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: ALC888 Analog [ALC888 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 2: ALC888 Analog [ALC888 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
}}<br />
<br />
Sound card is {{ic|hw:0,0}}.<br />
<br />
==== Determine sampling rate of the sound card (2/5) ====<br />
<br />
We aim to find the highest sample rate supported by the {{ic|hw:0,0}} sound card using a ''trial-and-error'' procedure starting from a low value. When the top value is reached, we got a warning message:<br />
<br />
{{hc|1=arecord -f dat -r 60000 -D hw:0,0 -d 5 test.wav|2=<br />
"Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 60000 Hz, Stereo<br />
Warning: rate is not accurate (requested = 60000Hz, '''got = 44100Hz''')<br />
please, try the plug plugin<br />
}}<br />
<br />
observe, the {{ic|1=got = 44100Hz}}. This is the maximum sampling rate of our card.<br />
<br />
==== Setting the sound card's sampling rate into PulseAudio configuration (3/5) ====<br />
<br />
The default sampling rate in PulseAudio:<br />
{{hc|1=$ grep "default-sample-rate" /etc/pulse/daemon.conf|2=<br />
; default-sample-rate = 48000<br />
}}<br />
<br />
{{ic|48000}} is disabled and needs to be changed to {{ic|44100}}:<br />
# sed 's/; default-sample-rate = 48000/default-sample-rate = 44100/g' -i /etc/pulse/daemon.conf<br />
<br />
==== Restart PulseAudio to apply the new settings (4/5) ====<br />
<br />
$ pulseaudio -k<br />
$ pulseaudio --start<br />
<br />
==== Finally check by recording and playing it back (5/5) ====<br />
<br />
Let us record some voice using a microphone for, say, 10 seconds. Make sure the microphone is not muted and all<br />
<br />
$ arecord -f cd -d 10 test-mic.wav<br />
<br />
After 10 seconds, let us play the recording...<br />
<br />
$ aplay test-mic.wav<br />
<br />
Now hopefully, there is no static noise in microphone recording anymore.<br />
<br />
=== No microphone on Steam or Skype with enable-remixing = no ===<br />
<br />
When you set {{ic|1=enable-remixing = no}} on {{ic|/etc/pulse/daemon.conf}} you may find that your microphone has stopped working on certain applications like Skype or Steam. This happens because these applications capture the microphone as mono only and because remixing is disabled, Pulseaudio will no longer remix your stereo microphone to mono.<br />
<br />
To fix this you need to tell Pulseaudio to do this for you:<br />
<br />
1. Find the name of the source <br />
<br />
# pacmd list-sources<br />
<br />
Example output edited for brevity, the name you need is in bold:<br />
<br />
index: 2<br />
name: <'''alsa_input.pci-0000_00_14.2.analog-stereo'''><br />
driver: <module-alsa-card.c><br />
flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY<br />
<br />
2. Add a remap rule to {{ic|/etc/pulse/default.pa}}, use the name you found with the previous command, here we will use '''alsa_input.pci-0000_00_14.2.analog-stereo''' as an example:<br />
<br />
{{hc|/etc/pulse/default.pa|<nowiki><br />
### Remap microphone to mono<br />
load-module module-remap-source master=alsa_input.pci-0000_00_14.2.analog-stereo master_channel_map=front-left,front-right channels=2 channel_map=mono,mono<br />
</nowiki>}}<br />
<br />
3. Restart Pulseaudio<br />
<br />
# pulseaudio -k<br />
<br />
{{Note|Pulseaudio may fail to start if you do not exit a program that was using the microphone (e.g. if you tested on Steam before modifying the file), in which case you should exit the application and manually start Pulseaudio}}<br />
<br />
# pulseaudio --start<br />
<br />
=== Microphone distorted due to automatic adjustment ===<br />
If your microphone volume creeps up automatically and causes the sound to be distorted, you can fix it by disabling mic boost:<br />
<br />
In {{ic|/usr/share/pulseaudio/alsa-mixer/paths/analog-input-internal-mic.conf}} and {{ic|/usr/share/pulseaudio/alsa-mixer/paths/analog-input-mic.conf}},<br />
<br />
* Under {{ic|[Element Internal Mic Boost]}} set {{ic|volume}} to {{ic|zero}}.<br />
* Under {{ic|[Element Int Mic Boost]}} set {{ic|volume}} to {{ic|zero}}.<br />
* Under {{ic|[Element Mic Boost]}} set {{ic|volume}} to {{ic|zero}}.<br />
<br />
Then restart PulseAudio:<br />
<br />
# pulseaudio -k<br />
<br />
== Audio quality ==<br />
<br />
=== Enable Echo/Noise-Cancelation ===<br />
<br />
Arch does not load the Pulseaudio Echo-Cancelation module by default, therefore, we have to add it in {{ic|/etc/pulse/default.pa}}. First you can test if the module is present with {{ic|pacmd}} and entering {{ic|list-modules}}. If you cannot find a line showing {{ic|name: <module-echo-cancel>}} you have to add <br />
<br />
{{hc|/etc/pulse/default.pa|<br />
### Enable Echo/Noise-Cancelation<br />
load-module module-echo-cancel<br />
}}<br />
<br />
then restart Pulseaudio<br />
<br />
pulseaudio -k<br />
pulseaudio --start<br />
<br />
and check if the module is activated by starting {{ic|pavucontrol}}. Under {{ic|Recoding}} the input device should show {{ic|Echo-Cancel Source Stream from"}}<br />
<br />
=== Glitches, skips or crackling ===<br />
<br />
The newer implementation of the PulseAudio sound server uses timer-based audio scheduling instead of the traditional, interrupt-driven approach. <br />
<br />
Timer-based scheduling may expose issues in some ALSA drivers. On the other hand, other drivers might be glitchy without it on, so check to see what works on your system. <br />
<br />
To turn timer-based scheduling off add {{ic|1=tsched=0}} in {{ic|/etc/pulse/default.pa}}:<br />
{{hc|/etc/pulse/default.pa|2=<br />
load-module module-udev-detect tsched=0<br />
}}<br />
<br />
Then restart the PulseAudio server:<br />
<br />
$ pulseaudio -k<br />
$ pulseaudio --start<br />
<br />
Do the reverse to enable timer-based scheduling, if not already enabled by default.<br />
<br />
If you are using Intel's [[Wikipedia:IOMMU|IOMMU]] and experience glitches and/or skips, add {{ic|1=intel_iommu=igfx_off}} to your kernel command line.<br />
<br />
Some Intel audio cards using the {{ic|snd-hda-intel}} module need the otions {{ic|1=vid=8086 pid=8ca0 snoop=0}}. In order to set them permanently, create/modify the following file including the line below.<br />
{{hc|/etc/modprobe.d/sound.conf|2=<br />
options snd-hda-intel vid=8086 pid=8ca0 snoop=0<br />
}}<br />
<br />
Please report any such cards to [http://www.freedesktop.org/wiki/Software/PulseAudio/Backends/ALSA/BrokenDrivers/ PulseAudio Broken Sound Driver page]<br />
<br />
=== Static noise when using headphones ===<br />
<br />
If you are encountering static in your headphone jack, one possible culprit may be ALSA's loopback mixing. In addition to setting tsched=0 as documented above, it may be helpful to disable loopback mixing. This can be accomplished trivially with alsamixer, part of {{Pkg|alsa-utils}}. This should not impact audio playback or microphone recording negatively, unless you require loopback mixing.<br />
<br />
=== Setting the default fragment number and buffer size in PulseAudio ===<br />
<br />
{{Poor writing|Copied from Linux mint topic with few additions}}<br />
<br />
==== Disabling timer-based scheduling (0/4) ====<br />
<br />
By default, PulseAudio uses timer-based scheduling. In this mode, fragments are not used at all, and so the default-fragments and default-fragment-size-msec parameters are ignored.<br />
To turn timer-based scheduling off add {{ic|1=tsched=0}} in {{ic|/etc/pulse/default.pa}}:<br />
{{hc|/etc/pulse/default.pa|2=<br />
load-module module-udev-detect tsched=0<br />
}}<br />
<br />
==== Finding out your audio device parameters (1/4) ====<br />
<br />
To find out what your sound card buffering settings are, use the following command and scroll through the output until you find the correct sink entry.<br />
<br />
{{hc|$ pactl list sinks|<nowiki><br />
Sink #1<br />
State: RUNNING<br />
Name: alsa_output.pci-0000_00_1b.0.analog-stereo<br />
Description: Built-in Audio Analog Stereo<br />
Driver: module-alsa-card.c<br />
Sample Specification: s16le 2ch 44100Hz<br />
Channel Map: front-left,front-right<br />
Owner Module: 7<br />
Mute: no<br />
Volume: front-left: 42600 / 65% / -11.22 dB, front-right: 42600 / 65% / -11.22 dB<br />
balance 0.00<br />
Base Volume: 65536 / 100% / 0.00 dB<br />
Monitor Source: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor<br />
Latency: 70662 usec, configured 85000 usec<br />
Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY <br />
Properties:<br />
alsa.resolution_bits = "16"<br />
device.api = "alsa"<br />
device.class = "sound"<br />
alsa.class = "generic"<br />
alsa.subclass = "generic-mix"<br />
alsa.name = "ALC283 Analog"<br />
alsa.id = "ALC283 Analog"<br />
alsa.subdevice = "0"<br />
alsa.subdevice_name = "subdevice #0"<br />
alsa.device = "0"<br />
alsa.card = "1"<br />
alsa.card_name = "HDA Intel PCH"<br />
alsa.long_card_name = "HDA Intel PCH at 0xe111c000 irq 43"<br />
alsa.driver_name = "snd_hda_intel"<br />
device.bus_path = "pci-0000:00:1b.0"<br />
sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card1"<br />
device.bus = "pci"<br />
device.vendor.id = "8086"<br />
device.vendor.name = "Intel Corporation"<br />
device.product.id = "9ca0"<br />
device.product.name = "Wildcat Point-LP High Definition Audio Controller"<br />
device.form_factor = "internal"<br />
device.string = "front:1"<br />
device.buffering.buffer_size = "352800"<br />
device.buffering.fragment_size = "176400"<br />
device.access_mode = "mmap+timer"<br />
device.profile.name = "analog-stereo"<br />
device.profile.description = "Analog Stereo"<br />
device.description = "Built-in Audio Analog Stereo"<br />
alsa.mixer_name = "Realtek ALC283"<br />
alsa.components = "HDA:10ec0283,10ec0283,00100003"<br />
module-udev-detect.discovered = "1"<br />
device.icon_name = "audio-card-pci"<br />
Ports:<br />
analog-output-speaker: Speakers (priority: 10000, not available)<br />
analog-output-headphones: Headphones (priority: 9000, available)<br />
Active Port: analog-output-headphones<br />
Formats:<br />
pcm<br />
...<br />
</nowiki>}}<br />
<br />
Take note the {{ic|buffer_size}} and {{ic|fragment_size}} values for the relevant sound card.<br />
<br />
==== Calculate your fragment size in msecs and number of fragments (2/4) ====<br />
<br />
PulseAudio's default sampling rate and bit depth are set to {{ic|44100Hz}} @ {{ic|16 bits}}.<br />
<br />
With this configuration, the bit rate we need is {{ic|44100}}*{{ic|16}} = {{ic|705600}} bits per second. That is {{ic|1411200 bps}} for stereo.<br />
<br />
Let us take a look at the parameters we have found in the previous step:<br />
<br />
device.buffering.buffer_size = "352800" => 352800/1411200 = 0.25 s = 250 ms<br />
device.buffering.fragment_size = "176400" => 176400/1411200 = 0.125 s = 125 ms<br />
<br />
==== Modify PulseAudio's configuration file (3/4) ====<br />
<br />
{{hc|/etc/pulse/daemon.conf|<nowiki><br />
; default-fragments = X<br />
; default-fragment-size-msec = Y<br />
</nowiki>}}<br />
<br />
In the previous step, we calculated the fragment size parameter.<br />
The number of fragments is simply buffer_size/fragment_size, which in this case ({{ic|250/125}}) is {{ic|2}}:<br />
<br />
{{hc|/etc/pulse/daemon.conf|2=<br />
; default-fragments = '''2'''<br />
; default-fragment-size-msec = '''125'''<br />
}}<br />
<br />
==== Restart the PulseAudio daemon (4/4) ====<br />
<br />
$ pulseaudio -k<br />
$ pulseaudio --start<br />
<br />
For more information, see: [http://forums.linuxmint.com/viewtopic.php?f=42&t=44862 Linux Mint topic]<br />
<br />
=== Choppy sound with analog surround sound setup ===<br />
<br />
The low-frequency effects (LFE) channel is not remixed per default. To enable it the following needs to be set in {{ic|/etc/pulse/daemon.conf}} :<br />
{{hc|/etc/pulse/daemon.conf|<nowiki><br />
enable-lfe-remixing = yes<br />
</nowiki>}}<br />
<br />
=== Laggy sound ===<br />
<br />
This issue is due to incorrect buffer sizes. First verify that the variables {{ic|default-fragments}} and {{ic|default-fragment-size-msec}} are not being set to non default values in the file {{ic|/etc/pulse/daemon.conf}}. If the issue is still present, try setting them to the following values:<br />
<br />
{{hc|/etc/pulse/daemon.conf|2=<br />
default-fragments = 5<br />
default-fragment-size-msec = 2<br />
}}<br />
<br />
=== Choppy/distorted sound ===<br />
This can result from an incorrectly set sample rate. Try the following setting:<br />
<br />
{{hc|/etc/pulse/daemon.conf|2=<br />
default-sample-rate = 48000<br />
}}<br />
and restart the PulseAudio server.<br />
<br />
If one experiences choppy sound in applications using [[Wikipedia:OpenAL|OpenAL]], change the sample rate in {{ic|/etc/openal/alsoft.conf}}:<br />
{{hc|/etc/openal/alsoft.conf|2=<br />
frequency = 48000<br />
}}<br />
<br />
Setting the PCM volume above 0 dB can cause [[Wikipedia:Clipping_(audio)|clipping]]. Running {{ic|alsamixer}} will allow you to see if this is the problem and if so fix it. Note that ALSA may not [http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/PulseAudioStoleMyVolumes correctly export] the dB information to PulseAudio. Try the following:<br />
<br />
{{hc|/etc/pulse/default.pa|2=<br />
load-module module-udev-detect ignore_dB=1<br />
}}<br />
<br />
and restart the PulseAudio server. See also [[#No sound below a volume cutoff]].<br />
<br />
== Hardware and Cards ==<br />
<br />
=== No HDMI sound output after some time with the monitor turned off ===<br />
<br />
The monitor is connected via HDMI/DisplayPort, and the audio jack is plugged in the headphone jack of the monitor, but PulseAudio insists that it is unplugged:<br />
<br />
{{hc|pactl list sinks|<br />
...<br />
hdmi-output-0: HDMI / DisplayPort (priority: 5900, not available)<br />
...<br />
}}<br />
<br />
This leads to no sound coming from HDMI output. A workaround for this is to switch to another VT and back again. If that does not work, try: turn off your monitor, switch to another VT, turn on your monitor, and switch back. This problem has been reported by ATI/Nvidia/Intel users.<br />
<br />
Another workaround could be to disable the switch-on-port-available module by commenting it in /etc/pulse/default.pa [https://bugs.freedesktop.org/show_bug.cgi?id=93946#c36]:<br />
<br />
{{hc|/etc/pulse/default.pa|<br />
...<br />
### Should be after module-*-restore but before module-*-detect<br />
#load-module module-switch-on-port-available<br />
...<br />
}}<br />
<br />
=== No HDMI sound using a headless server ===<br />
You might want to use HDMI audio with your a/v receiver but no display. HDMI requires a video signal, which we have from the virtual terminal. <br />
<br />
By default, this signal is turned off after 600 seconds, thus the audio sink gets lost as well.<br />
<br />
To prevent screen blanking, add {{ic|consoleblank&#61;0}} to the kernel command line.<br />
<br />
=== No cards ===<br />
<br />
If PulseAudio starts, run {{ic|pacmd list}}. If no cards are reported, make sure that the ALSA devices are not in use:<br />
<br />
$ fuser -v /dev/snd/*<br />
$ fuser -v /dev/dsp<br />
<br />
Make sure any applications using the pcm or dsp files are shut down before restarting PulseAudio.<br />
<br />
=== Starting an application interrupts other app's sound ===<br />
<br />
If you have trouble with some applications (eg. Teamspeak, Mumble) interrupting sound output of already running applications (eg. Deadbeaf), you can solve this by commenting out the line {{ic|load-module module-role-cork}} in {{ic|/etc/pulse/default.pa}} like shown below:<br />
<br />
{{hc|/etc/pulse/default.pa|<br />
### Cork music/video streams when a phone stream is active<br />
# load-module module-role-cork<br />
}}<br />
<br />
Then restart pulseaudo by using your normal user account with<br />
<br />
pulseaudio -k<br />
pulseaudio --start<br />
<br />
=== The only device shown is "dummy output" or newly connected cards are not detected ===<br />
<br />
If the only playback device is the Dummy Output, PulseAudio cannot access your sound devices. It is possible there is an issue with logind giving permissions, see [[General troubleshooting#Session permissions]] for more information.<br />
<br />
Sometimes restarting PulseAudio is enough:<br />
<br />
$ pulseaudio -k<br />
<br />
An application might also not have been configured to work with PulseAudio. This happens with [[FluidSynth#Conflicting_with_PulseAudio|FluidSynth]] for example. To see which application is responsible for a direct access to the sound card via alsa, run the following command:<br />
<br />
# fuser -v /dev/snd/*<br />
<br />
Try to close these applications. pulseaudio, if running, should take again precedence over these applications and all the applications relying on pulseaudio should work again like expected.<br />
<br />
=== No HDMI 5/7.1 Selection for Device ===<br />
<br />
If you are unable to select 5/7.1 channel output for a working HDMI device, then turning off "stream device reading" in {{ic|/etc/pulse/default.pa}} might help. <br />
<br />
See [[#Fallback device is not respected]].<br />
<br />
=== Failed to create sink input: sink is suspended ===<br />
<br />
If you do not have any output sound and receive dozens of errors related to a suspended sink in your {{ic|journalctl -b}} log, then backup first and then delete your user-specific pulse folders:<br />
<br />
$ rm -r ~/.pulse ~/.pulse-cookie ~/.config/pulse<br />
<br />
=== Simultaneous output to multiple sound cards / devices ===<br />
<br />
Simultaneous output to two different devices can be very useful. For example, being able to send audio to your A/V receiver via your graphics card's HDMI output, while also sending the same audio through the analogue output of your motherboard's built-in audio. This is much less hassle than it used to be (in this example, we are using GNOME desktop).<br />
<br />
Using {{Pkg|paprefs}}, simply select "Add virtual output device for simultaneous output on all local sound cards" from under the "Simultaneous Output" tab. Then, under GNOME's "sound settings", select the simultaneous output you have just created.<br />
<br />
If this does not work, try adding the following to {{ic|~/.asoundrc}}:<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
{{Tip|Simultaneous output can also be achieved manually using alsamixer. Disable "auto mute" item, then unmute other output sources you want to hear and increase their volume.}}<br />
<br />
=== Simultaneous output to multiple sinks on the same sound card not working ===<br />
<br />
This can be useful for users who have multiple sound sources and want to play them on different sinks/outputs. <br />
An example use-case for this would be if you play music and also voice chat and want to output music to speakers (in this case Digital S/PDIF) and voice to headphones. (Analog)<br />
<br />
This is sometimes auto detected by PulseAudio but not always. If you know that your sound card can output to both Analog and S/PDIF at the same time and PulseAudio does not have this option in its profiles in pavucontrol, or veromix then you probably need to create a configuration file for your sound card.<br />
<br />
More in detail you need to create a profile-set for your specific sound card.<br />
This is done in two steps mostly.<br />
* Create udev rule to make PulseAudio choose your PulseAudio configuration file specific to the sound card.<br />
* Create the actual configuration.<br />
<br />
Create a pulseadio udev rule.<br />
<br />
{{Note|This is only an example for Asus Xonar Essence STX.<br />
Read [[udev]] to find out the correct values.}}<br />
<br />
{{Note|Your configuration file should have lower number than the original PulseAudio rule to take effect.}}<br />
<br />
{{hc|/usr/lib/udev/rules.d/90-pulseaudio-Xonar-STX.rules|<br />
ACTION&#61;&#61;"change", SUBSYSTEM&#61;&#61;"sound", KERNEL&#61;&#61;"card*", \<br />
ATTRS&#123;subsystem_vendor&#125;&#61;&#61;"0x1043", ATTRS&#123;subsystem_device&#125;&#61;&#61;"0x835c", ENV&#123;PULSE_PROFILE_SET&#125;&#61;"asus-xonar-essence-stx.conf" <br />
}}<br />
<br />
Now, create a configuration file. If you bother, you can start from scratch and make it saucy. However you can also use the default configuration file, rename it, and then add your profile there that you know works. Less pretty but also faster.<br />
<br />
To enable multiple sinks for Asus Xonar Essence STX you need only to add this in.<br />
<br />
{{Note|{{ic|asus-xonar-essence-stx.conf}} also includes all code/mappings from {{ic|default.conf}}.}}<br />
<br />
{{hc|/usr/share/pulseaudio/alsa-mixer/profile-sets/asus-xonar-essence-stx.conf|<br />
[Profile analog-stereo+iec958-stereo]<br />
description &#61; Analog Stereo Duplex + Digital Stereo Output<br />
input-mappings &#61; analog-stereo<br />
output-mappings &#61; analog-stereo iec958-stereo<br />
skip-probe &#61; yes<br />
}}<br />
<br />
This will auto-profile your Asus Xonar Essence STX with default profiles and add your own profile so you can have multiple sinks.<br />
<br />
You need to create another profile in the configuration file if you want to have the same functionality with AC3 Digital 5.1 output.<br />
<br />
[http://www.freedesktop.org/wiki/Software/PulseAudio/Backends/ALSA/Profiles/ See PulseAudio article about profiles]<br />
<br />
=== Some profiles like SPDIF are not enabled by default on the card ===<br />
<br />
Some profiles like IEC-958 (i.e. S/PDIF) may not be enabled by default on the selected sink. Each time the system starts up, the card profile is disabled and the pulseaudio daemon cannot select it.<br />
You have to add the profile selection to you default.pa file. <br />
Verify the card and profile name with :<br />
<br />
$ pacmd list-cards<br />
Then edit the config to add the profile<br />
{{hc|~/.config/pulse/default.pa|<br />
## Replace with your card name and the profile you want to activate<br />
set-card-profile alsa_card.pci-0000_00_1b.0 output:iec958-stereo+input:analog-stereo<br />
}}<br />
<br />
Pulse audio will add this profile the pool of available profiles<br />
<br />
== Bluetooth ==<br />
<br />
=== Disable Bluetooth support ===<br />
<br />
If you do not use Bluetooth, you may experience the following error in your journal:<br />
<br />
bluez5-util.c: GetManagedObjects() failed: org.freedesktop.DBus.Error.ServiceUnknown: The name org.bluez was not provided by any .service files<br />
<br />
To disable Bluetooth support in PulseAudio, make sure that the following lines are commented out in the configuration file in use ({{ic|~/.config/pulse/default.pa}} or {{ic|/etc/pulse/default.pa}}):<br />
<br />
{{hc|~/.config/pulse/default.pa|<br />
### Automatically load driver modules for Bluetooth hardware<br />
#.ifexists module-bluetooth-policy.so<br />
#load-module module-bluetooth-policy<br />
#.endif<br />
<br />
#.ifexists module-bluetooth-discover.so<br />
#load-module module-bluetooth-discover<br />
#.endif<br />
}}<br />
<br />
=== Bluetooth headset replay problems ===<br />
<br />
Some user [https://bbs.archlinux.org/viewtopic.php?id=117420 reports] huge delays or even no sound when the Bluetooth connection does not send any data. This is due to the {{ic|module-suspend-on-idle}} module, which automatically suspends sinks/sources on idle. As this can cause problems with headset, the responsible module can be deactivated.<br />
<br />
To disable loading of the {{ic|module-suspend-on-idle}} module, comment out the following line in the configuration file in use ({{ic|~/.config/pulse/default.pa}} or {{ic|/etc/pulse/default.pa}}):<br />
<br />
{{hc|~/.config/pulse/default.pa|<br />
### Automatically suspend sinks/sources that become idle for too long<br />
#load-module module-suspend-on-idle<br />
}}<br />
<br />
Finally restart PulseAudio to apply the changes.<br />
<br />
=== Automatically switch to Bluetooth or USB headset ===<br />
<br />
Add the following:<br />
{{hc|/etc/pulse/default.pa|<br />
# automatically switch to newly-connected devices<br />
load-module module-switch-on-connect<br />
}}<br />
<br />
=== My Bluetooth device is paired but does not play any sound ===<br />
<br />
[[Bluetooth#My_device_is_paired_but_no_sound_is_played_from_it|See the article in Bluetooth section]]{{Broken section link}}<br />
<br />
Starting from PulseAudio 2.99 and bluez 4.101 you should '''avoid''' using Socket interface. Do NOT use:<br />
<br />
{{hc|/etc/bluetooth/audio.conf|<nowiki><br />
[General]<br />
Enable=Socket<br />
</nowiki>}}<br />
<br />
If you face problems with A2DP and PA 2.99 make sure you have {{Pkg|sbc}} library.<br />
<br />
== Applications ==<br />
<br />
=== Flash content ===<br />
<br />
Since Adobe Flash does not directly support PulseAudio, the recommended way is to [[PulseAudio#ALSA|configure ALSA to use the virtual PulseAudio sound card]].<br />
<br />
If Flash audio is lagging, you may try to have Flash access ALSA directly. See [[PulseAudio#ALSA/dmix without grabbing hardware device]] for details.<br />
<br />
=== Permission errors bug ===<br />
<br />
{{hc|pulseaudio --start|<br />
E: [autospawn] core-util.c: Failed to create secure directory (/run/user/1000/pulse): Operation not permitted<br />
W: [autospawn] lock-autospawn.c: Cannot access autospawn lock.<br />
E: [pulseaudio] main.c: Failed to acquire autospawn lock}}<br />
<br />
Known programs that changes permissions for {{ic|/run/user/''user id''/pulse}} when using [[Polkit]] for root elevation:<br />
<br />
*{{AUR|sakis3g}} <br />
<br />
As a workaround, include {{Pkg|gksu}} or {{Pkg|kdesu}} in a [[desktop entry]], or add {{ic|1=''username'' ALL=NOPASSWD: /usr/bin/''program_name''}} to [[sudoers]] to run it with {{Pkg|sudo}} or {{ic|gksudo}} without a password.<br />
<br />
The other workaround is to uncomment and set {{ic|1=daemonize = yes}} in the {{ic|/etc/pulse/daemon.conf}}.<br />
<br />
See also [https://bbs.archlinux.org/viewtopic.php?id=135955].<br />
<br />
=== Audacity ===<br />
<br />
When starting Audacity you may find that your headphones no longer work. This can be because Audacity is trying to use them as a recording device. To fix this, open Audacity, then set its recording device to {{ic|1=pulse:Internal Mic:0}}.<br />
<br />
Under some circumstances, playback may be distorted, very fast, or freeze, as discussed in the [http://wiki.audacityteam.org/wiki/Linux_Issues#ALSA_and_other_sound_systems Audacity Wiki's Linux Issues page].<br />
<br />
The solution proposed in this page may work: start Audacity with:<br />
<br />
$ env PULSE_LATENCY_MSEC=30 audacity<br />
<br />
If the solution above does not fix this issue, one may wish to temporarily disable pulseaudio while running Audacity by using the {{ic|pasuspender}} command:<br />
<br />
$ pasuspender -- audacity<br />
<br />
Then, be sure to select the appropriate ALSA input and output devices in Audacity.<br />
<br />
See also [[#Setting the default fragment number and buffer size in PulseAudio]].<br />
<br />
== Other Issues ==<br />
<br />
=== Bad configuration files ===<br />
<br />
After starting PulseAudio, if the system outputs no sound, it may be necessary to delete the contents of {{ic|~/.config/pulse}} and/or {{ic|~/.pulse}}. PulseAudio will automatically create new configuration files on its next start.<br />
<br />
=== Cannot update configuration of sound device in pavucontrol ===<br />
<br />
{{Pkg|pavucontrol}} is a handy GUI utility for configuring PulseAudio. Under its 'Configuration' tab, you can select different profiles for each of your sound devices e.g. analogue stereo, digital output (IEC958), HDMI 5.1 Surround etc.<br />
<br />
However, you may run into an instance where selecting a different profile for a card results in the pulse daemon crashing and auto restarting without the new selection "sticking". If this occurs, use the other useful GUI tool, {{Pkg|paprefs}}, to check under the "Simultaneous Output" tab for a virtual simultaneous device. If this setting is active (checked), it will prevent you changing any card's profile in pavucontrol. Uncheck this setting, then adjust your profile in pavucontrol prior to re-enabling simultaneous output in paprefs.<br />
<br />
=== Failed to create sink input: sink is suspended ===<br />
<br />
If you do not have any output sound and receive dozens of errors related to a suspended sink in your {{ic|journalctl -b}} log, then backup first and then delete your user-specific pulse folders:<br />
<br />
$ rm -r ~/.pulse ~/.pulse-cookie ~/.config/pulse<br />
<br />
=== Pulse overwrites ALSA settings ===<br />
<br />
PulseAudio usually overwrites the ALSA settings — for example set with alsamixer — at start-up, even when the ALSA daemon is loaded. Since there seems to be no other way to restrict this behaviour, a workaround is to restore the ALSA settings again after PulseAudio has started. Add the following command to {{ic|.xinitrc}} or {{ic|.bash_profile}} or any other [[autostart]] file:<br />
<br />
restore_alsa() {<br />
while [ -z "$(pidof pulseaudio)" ]; do<br />
sleep 0.5<br />
done<br />
alsactl -f /var/lib/alsa/asound.state restore <br />
}<br />
restore_alsa &<br />
<br />
=== Prevent Pulse from restarting after being killed ===<br />
<br />
Sometimes you may wish to temporarily disable Pulse. In order to do so you will have to prevent Pulse from restarting after being killed.<br />
<br />
{{hc|~/.config/pulse/client.conf|2=<br />
# Disable autospawning the PulseAudio daemon<br />
autospawn = no<br />
}}<br />
<br />
=== Daemon startup failed ===<br />
<br />
Try resetting PulseAudio:<br />
<br />
$ rm -rf /tmp/pulse* ~/.pulse* ~/.config/pulse<br />
$ pulseaudio -k<br />
$ pulseaudio --start<br />
<br />
* Check that options for sinks are set up correctly.<br />
<br />
* If you configured in default.pa to load and use the OSS modules then check with {{Pkg|lsof}} that {{ic|/dev/dsp}} device is not used by another application.<br />
<br />
* Set a preferred working resample method. Use {{ic|pulseaudio --dump-resample-methods}} to see a list with all available resample methods you can use.<br />
<br />
* To get details about currently appeared unfixed errors or just get status of daemon use commands like {{ic|pax11publish -d}} and {{ic|pulseaudio -v}} where {{ic|v}} option can be used multiple time to set verbosity of log output equal to the {{ic|1=--log-level[=LEVEL]}} option where LEVEL is from 0 to 4. See the [[#Outputs by PulseAudio error status check utilities]] section.<br />
<br />
See also man pages for [http://linux.die.net/man/1/pax11publish pax11publish] and [http://linux.die.net/man/1/pulseaudio pulseaudio] for more details.<br />
<br />
==== Outputs by PulseAudio error status check utilities ====<br />
<br />
If the {{ic|pax11publish -d}} shows error like:<br />
<br />
N: [pulseaudio] main.c: User-configured server at "user", refusing to start/autospawn.<br />
<br />
then run {{ic|pax11publish -r}} command then could be also good to logout and login again. This manual cleanup is always required when using LXDM because it does not restart the X server on logout; see [[LXDM#PulseAudio]]{{Broken section link}}.<br />
<br />
If the {{ic|pulseaudio -vvvv}} command shows error like:<br />
<br />
E: [pulseaudio] module-udev-detect.c: You apparently ran out of inotify watches, probably because Tracker/Beagle took them all away. I wished people would do their homework first and fix inotify before using it for watching whole directory trees which is something the current inotify is certainly not useful for. Please make sure to drop the Tracker/Beagle guys a line complaining about their broken use of inotify.<br />
<br />
This can be resolved temporary by:<br />
$ echo 100000 > /proc/sys/fs/inotify/max_user_watches<br />
<br />
For permanent use save settings in the ''99-sysctl.conf'' file:<br />
<br />
{{hc|/etc/sysctl.d/99-sysctl.conf|2=<br />
# Increase inotify max watchs per user<br />
fs.inotify.max_user_watches = 100000}}<br />
<br />
{{Warning|It may cause much bigger consumption of memory by kernel.}}<br />
<br />
'''See also''' <br />
<br />
* [http://www.linuxinsight.com/proc_sys_fs_inotify.html proc_sys_fs_inotify] and [http://lwn.net/Articles/604686/ dnotify, inotify]- more details about ''inotify/max_user_watches''<br />
* [http://stackoverflow.com/questions/535768/what-is-a-reasonable-amount-of-inotify-watches-with-linux?answertab=votes#tab-top reasonable amount of inotify watches with Linux]<br />
* [http://linux.die.net/man/7/inotify inotify] - man page<br />
<br />
=== Daemon already running ===<br />
<br />
On some systems, PulseAudio may be started multiple times. journalctl will report:<br />
<br />
[pulseaudio] pid.c: Daemon already running.<br />
<br />
Make sure to use only one method of autostarting applications. {{Pkg|pulseaudio}} includes these files:<br />
<br />
* {{ic|/etc/X11/xinit/xinitrc.d/pulseaudio}}<br />
* {{ic|/etc/xdg/autostart/pulseaudio.desktop}}<br />
* {{ic|/etc/xdg/autostart/pulseaudio-kde.desktop}}<br />
<br />
Also check user autostart files and directories, such as [[xinitrc]], {{ic|~/.config/autostart/}} etc.<br />
<br />
=== Subwoofer stops working after end of every song ===<br />
<br />
Known issue: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/494099<br />
<br />
To fix this, must edit: {{ic|/etc/pulse/daemon.conf}} and enable {{ic|enable-lfe-remixing}} :<br />
{{hc|/etc/pulse/daemon.conf|<nowiki><br />
enable-lfe-remixing = yes<br />
</nowiki>}}<br />
<br />
=== Unable to select surround configuration other than "Surround 4.0" ===<br />
<br />
If you are unable to set 5.1 surround output in pavucontrol because it only shows "Analog Surround 4.0 Output", open the ALSA mixer and change the output configuration there to 6 channels. Then restart pulseaudio, and pavucontrol will list many more options.<br />
<br />
=== Realtime scheduling ===<br />
<br />
If rtkit does not work, you can manually set up your system to run PulseAudio with real-time scheduling, which can help performance. To do this, add the following lines to {{ic|/etc/security/limits.conf}}:<br />
<br />
@pulse-rt - rtprio 9<br />
@pulse-rt - nice -11<br />
<br />
Afterwards, you need to add your user to the {{ic|pulse-rt}} group:<br />
<br />
# gpasswd -a <user> pulse-rt<br />
<br />
=== pactl "invalid option" error with negative percentage arguments ===<br />
<br />
{{ic|pactl}} commands that take negative percentage arguments will fail with an 'invalid option' error. Use the standard shell '--' pseudo argument<br />
to disable argument parsing before the negative argument. ''e.g.'' {{ic|pactl set-sink-volume 1 -- -5%}}.<br />
<br />
=== Fallback device is not respected ===<br />
<br />
PulseAudio does not have a true default device. Instead it uses a [http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/DefaultDevice/ "fallback"], which only applies to new sound streams. This means previously run applications are not affected by the newly set fallback device.<br />
<br />
{{Pkg|gnome-control-center}}, {{Pkg|mate-media}} and {{AUR|paswitch}} handle this gracefully. Alternatively: <br />
<br />
1. Move the old streams in {{Pkg|pavucontrol}} manually to the new sound card.<br />
<br />
2. Stop Pulse, erase the "stream-volumes" in {{ic|~/.config/pulse}} and/or {{ic|~/.pulse}} and restart Pulse. This also resets application volumes.<br />
<br />
3. Disable stream device reading. This may be not wanted when using different soundcards with different applications.<br />
<br />
{{hc|/etc/pulse/default.pa|<nowiki><br />
load-module module-stream-restore restore_device=false<br />
</nowiki>}}<br />
<br />
=== RTP/UDP packet flood ===<br />
<br />
In some cases the default configuration might flood the network with UDP packets.[https://bugs.freedesktop.org/show_bug.cgi?id=44777] <br />
To fix this problem, launch {{ic|paprefs}} and disable "Multicast/RTP Sender".[https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/411688/comments/36]</div>Lesmanahttps://wiki.archlinux.org/index.php?title=Wine&diff=468154Wine2017-02-11T16:46:19Z<p>Lesmana: /* Unregister existing Wine file associations */ refine delete all wine related stuff command</p>
<hr />
<div>[[Category:Wine]]<br />
[[cs:Wine]]<br />
[[de:Wine]]<br />
[[es:Wine]]<br />
[[fr:Wine]]<br />
[[it:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
[[zh-hans:Wine]]<br />
[[zh-hant:Wine]]<br />
{{Related articles start}}<br />
{{Related|Steam/Wine}}<br />
{{Related|CrossOver}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
[[Wikipedia:Wine (software)|Wine]] is a ''compatibility layer'' capable of running Microsoft Windows applications on Unix-like operating systems. Programs running in Wine act as native programs would, without the performance/memory penalties of an emulator. See the [http://www.winehq.org/ official project home] and [https://wiki.winehq.org/ wiki] pages for longer introduction.<br />
<br />
== Installation ==<br />
{{Warning|If you can access a file or resource with your user account, programs running in Wine can too. Wine prefixes are '''not''' [[wikipedia:Sandbox (computer security)|sandboxes]]. Consider using [[wikipedia:Virtualization|virtualization]] if security is important.}}<br />
<br />
Wine can be installed with the packages {{Pkg|wine}} (stable) or {{Pkg|wine-staging}} (testing). [https://wine-staging.com/ Wine Staging] is a patched version of [https://www.winehq.org/ Wine], which contains bug fixes and features (e.g. [[#CSMT patch|CSMT patch]]), which have not been integrated into the stable branch yet. If you are running a 64-bit system, you will need to enable the [[Multilib]] repository first. See also [[#Sound]].<br />
<br />
You may also want to install {{pkg|wine_gecko}} and {{pkg|wine-mono}} for applications that need support for Internet Explorer and .NET, respectively. These packages are not strictly required as Wine will download the relevant files as needed. However, having the files downloaded in advance allows you to work off-line and makes it so Wine does not download the files for each Wine prefix needing them.<br />
<br />
'''Architectural differences'''<br />
<br />
Wine by default is 32-bit, as is the i686 Arch package. As such, it is unable to execute any 64-bit Windows applications.<br />
<br />
The x86_64 Arch package, however, is built with {{ic|--enable-win64}}. This activates the Wine version of [[Wikipedia:WoW64|WoW64]].<br />
*In Windows, this complicated subsystem allows the user to use 32-bit and 64-bit Windows programs concurrently and even in the same directory.<br />
*In Wine, some 32-bit programs do not work properly in a 64-bit prefix. In that case the user will have to make separate directories/prefixes. See the [https://wiki.winehq.org/FAQ#How_do_I_create_a_32_bit_wineprefix_on_a_64_bit_system.3F Wine FAQ] for specific information on this.<br />
<br />
If you run into problems with {{ic|winetricks}} or programs with a 64-bit environment, try creating a new 32-bit {{ic|WINEPREFIX}}. See below: [[#WINEARCH]]. Using the x86_64 Wine package with {{ic|1=WINEARCH=win32}} should have the same behaviour as using the i686 Wine package.<br />
<br />
== Configuration ==<br />
Configuring Wine is typically accomplished using:<br />
* [https://wiki.winehq.org/Winecfg winecfg] is a GUI configuration tool for Wine. You can run it from a console window with: {{ic|$ wine winecfg}}, or {{ic|1=$ WINEPREFIX=~/.some_prefix wine winecfg}}.<br />
* {{ic|control.exe}} is Wine's implementation of Windows' Control Panel which can be accessed with: {{ic|$ wine control}}.<br />
* [https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit] is Wine's registry editing tool. If ''winecfg'' and the Control Panel are not enough, see WineHQ's article on [https://wiki.winehq.org/Useful_Registry_Keys Useful Registry Keys].<br />
* See WineHQ's [https://wiki.winehq.org/List_of_Commands List of Commands] for the full list.<br />
<br />
=== WINEPREFIX ===<br />
By default, Wine stores its configuration files and installed Windows programs in {{ic|~/.wine}}. This directory is commonly called a "Wine prefix" or "Wine bottle". It is created/updated automatically whenever you run a Windows program or one of Wine's bundled programs such as ''winecfg''. The prefix directory also contains a tree which your Windows programs will see as {{ic|C:}} (the C-drive).<br />
<br />
You can override the location Wine uses for a prefix with the {{ic|WINEPREFIX}} environment variable. This is useful if you want to use separate configurations for different Windows programs. The first time a program is run with a new Wine prefix, Wine will automatically create a directory with a bare C-drive and registry.<br />
<br />
For example, if you run one program with {{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}, and another with {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}, the two programs will each have a separate C-drive and separate registries.<br />
<br />
{{Note|Wine prefixes are not [[Wikipedia:Sandbox (computer security)|sandboxes]]! Programs running under Wine can still access the rest of the system! (for example, {{ic|Z:}} is mapped to {{ic|/}}, regardless of the Wine prefix).}}<br />
<br />
To create a default prefix without running a Windows program or other GUI tool you can use:<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
If you have a 64-bit system, Wine will start an 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 />
{{Note|1=During prefix creation, the 64-bit version of Wine treats all folders as 64-bit prefixes and will not create a 32-bit in any existing folder. To create a 32-bit prefix you have to let Wine create the folder specified in {{ic|WINEPREFIX}}. See WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=29661 29661]}}<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 />
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 />
<br />
=== Graphics drivers ===<br />
<br />
For 64-bit systems, additional [[multilib]] packages are required. Please install the one that is listed in the ''Multilib Package'' 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 />
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''. Currently, the [[Alsa]] driver is the best supported.<br />
<br />
* If you want to use the [[ALSA]] driver in Wine on a 64-bit system, you will need to install {{Pkg|lib32-alsa-lib}} and {{Pkg|lib32-alsa-plugins}}.<br />
* If you want to use the [[PulseAudio]] driver in Wine, you will need to install the {{Pkg|lib32-libpulse}} package.<br />
* If you want to use the [[OSS]] driver in Wine, you will need to install the {{Pkg|lib32-alsa-oss}} package. The OSS driver in the kernel will not suffice.<br />
<br />
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [https://www.winehq.org/docs/wineusr-guide/using-regedit#Configuring_Sound configure it via the registry]. For example, in a case where the microphone wasn't 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, if you are using a 64-bit Arch, it may help to [[#WINEARCH|recreate the prefix]]. <br />
<br />
Games that use advanced sound systems may require installations of {{Pkg|lib32-openal}}.<br />
<br />
==== MIDI support ====<br />
<br />
[[MIDI]] was a quite popular system for video games music in the 90's. If you are trying out old games, it is not uncommon that the music will not play out of the box.<br />
Wine has excellent MIDI support. However you first need to make it work on your host system, as explained in [[MIDI]]. Last but not least you need to make sure Wine will use the correct MIDI output.<br />
<br />
=== Other libraries ===<br />
<br />
*Some applications (e.g. Office 2003/2007) require the MSXML library to parse HTML or XML, in such cases you need to install {{Pkg|lib32-libxml2}}.<br />
<br />
*Some applications that play music may require {{Pkg|lib32-mpg123}}.<br />
<br />
*Some applications that use a color management engine (e.g. pdf viewers, image viewers, etc) may require {{Pkg|lib32-lcms2}}.<br />
<br />
*Some applications that use native image manipulation libraries may require {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}.<br />
<br />
*Some applications that require encryption support may require {{Pkg|lib32-gnutls}}.<br />
<br />
=== Fonts ===<br />
<br />
If Wine applications are not showing easily readable fonts, you may not have Microsoft's Truetype fonts installed. See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
After running such programs, kill all Wine servers and run {{ic|winecfg}}. Fonts should be legible now.<br />
<br />
If the fonts look somehow smeared, import the following text file into the Wine registry with [https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
See also [[Font configuration#Applications without fontconfig support]].<br />
<br />
=== Desktop launcher menus ===<br />
<br />
When a Windows application installer creates a shortcut Wine creates a {{ic|.desktop}} file instead. The default locations for those files in Arch Linux are:<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 {{ic|.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 />
By default, installation of Wine does not create desktop menus/icons for the software which comes with Wine (e.g. for ''winecfg'', ''winebrowser'', etc). These instructions will add entries for these applications.<br />
<br />
First, install a Windows program using Wine to create the base menu. After the base menu is created, you can create the following files in {{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 />
If these settings produce a ugly/non-existent icon, it means that there are no icons for these launchers in the icon set that you have enabled. You should replace the icon settings with the explicit location of the icon that you want. Clicking the icon in the launcher's properties menu will have the same effect. A great icon set that supports these shortcuts is [http://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors].<br />
<br />
==== Removing menu entries ====<br />
<br />
Menu entries created by Wine are located in {{ic|~/.local/share/applications/wine/Programs/}}. Remove the program's ''.desktop'' entry to remove the application from the menu.<br />
<br />
In addition to remove unwanted extensions binding by Wine, execute the following commands (taken from the Wine website):<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 />
=== Mono and Gecko ===<br />
<br />
when initializing a new wineprefix wine will ask to install mono and gecko. or if the packages {{pkg|wine-mono}} and {{pkg|wine_gecko}} are installed wine will silently copy about 450 mb of mono and gecko files in the wineprefix.<br />
<br />
to prevent wine from asking to install mono and gecko start wine like this:<br />
<br />
WINEDLLOVERRIDES=mscoree=d;mshtml=d wine somewineapp<br />
<br />
<br />
== Using Windows applications ==<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 Running Wine as root] for the official statement.}}<br />
<br />
See [https://wiki.winehq.org/FAQ#Installing_Windows_Applications Installing Windows Applications] at WineHQ. See [[#Desktop launcher menus]] for information on where the shortcuts were created.<br />
<br />
See [https://wiki.winehq.org/FAQ#Running_applications Running applications] at WineHQ. The {{ic|.desktop}} files created by the installer should automatically appear as entries in any X menu or file manager applications. They can also be examined to determine what command to use to run the application from a terminal.<br />
<br />
See [https://wiki.winehq.org/FAQ#How_do_I_uninstall_Windows_applications.3F How do I uninstall Windows applications?] at WineHQ.<br />
<br />
== Tips and tricks ==<br />
<br />
{{Tip|In addition to the links provided in the beginning of the article the following may be of interest:<br />
* [http://appdb.winehq.org/ The Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [http://forum.winehq.org/ The WineHQ Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<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 />
=== CSMT patch ===<br />
<br />
Since 2013 Wine developers have been experimenting with [http://www.winehq.org/pipermail/wine-devel/2013-September/101106.html stream/worker thread optimizations]. 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 known as CSMT patch and works with NVidia and AMD graphics cards.<br />
<br />
[http://www.wine-staging.com/ Wine-staging] includes CSMT support (included again since [http://www.wine-staging.com/news/2016-05-18-release-1.9.10.html version 1.9.10]), and can be installed with the {{Pkg|wine-staging}} package.<br />
<br />
CSMT support needs to be enabled in <code>winecfg</code> (Staging tab) before it can be used.<br />
<br />
Further information:<br />
*[http://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 />
*[https://www.youtube.com/playlist?list=PL0P2a_sII2eTd8uq-azTNpQjiFLqBhDjg Here] you find some game videos running with CSMT enabled<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 />
Alternatively you can delete all wine related stuff:<br />
<br />
$ find ~/.local/share -name "*wine*" | xargs --no-run-if-empty rm -r<br />
<br />
And update the cache as above.<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 new Wine file associations ===<br />
<br />
To prevent wine from creating any file associations edit your {{ic|$WINEPREFIX/system.reg}} file, Search for {{ic|winemenubuilder}} and remove {{ic|-a}}, so you'll get:<br />
<br />
{{hc|1=$WINEPREFIX/system.reg|2=<br />
[Software\\Microsoft\\Windows\\CurrentVersion\\RunServices]<br />
"winemenubuilder"="C:\\windows\\system32\\winemenubuilder.exe -r"<br />
}}<br />
<br />
This has to be done for each WINEPREFIX which should not update file associations.<br />
<br />
You can disable winemenubuilder for all WINEPREFIXes by setting an environment variable:<br />
<br />
$ export WINEDLLOVERRIDES="winemenubuilder.exe=d"<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.<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. Install it with the {{AUR|gnome-exe-thumbnailer}} package.<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 />
=== Using Wine as an interpreter for Win16/Win32 binaries ===<br />
<br />
It is also possible to tell the kernel to use Wine as an interpreter for all Win16/Win32 binaries:<br />
# echo ':DOSWin:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register<br />
<br />
To make the setting permanent, create the {{ic|/etc/binfmt.d/wine.conf}} file with the following content:<br />
{{hc|/etc/binfmt.d/wine.conf|2=<br />
# Start WINE on Windows executables<br />
:DOSWin:M::MZ::/usr/bin/wine:<br />
}}<br />
<br />
[[systemd]] automatically mounts the {{ic|/proc/sys/fs/binfmt_misc}} filesystem using {{ic|proc-sys-fs-binfmt_misc.mount}} (and automount) and runs the {{ic|systemd-binfmt.service}} to load your settings.<br />
<br />
Try it out by running a Windows program:<br />
$ chmod +x ''exefile.exe''<br />
$ ./''exefile.exe''<br />
<br />
If all went well, ''exefile.exe'' should run.<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: [http://www.spinics.net/linux/fedora/fedora-users/msg450821.html Fedora Mailing List]<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 />
=== Force OpenGL mode in games ===<br />
<br />
Many games 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 />
$ wine /path/to/3d_game.exe -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [http://appdb.winehq.org AppDB] for such application specific information.<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 />
=== Installing .NET Framework 4.0 ===<br />
<br />
First create a new 32-bit Wine prefix if you are on a 64-bit system.<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
<br />
Then install the following packages using winetricks<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winetricks -q msxml3 dotnet40 corefonts<br />
<br />
=== Installing Microsoft Office ===<br />
==== Office 2010 ====<br />
Microsoft Office 2010 works without any problems (tested with Microsoft Office Home and Student 2010, Wine 1.7.5; Microsoft Office Professional Plus 2010, Wine 1.7.51). Activation over Internet also works.<br />
<br />
Start by installing {{pkg|wine-mono}}, {{pkg|wine_gecko}}, {{pkg|samba}}, {{pkg|lib32-libxslt}} and {{pkg|lib32-libxml2}}.<br />
<br />
Proceed with launching the installer:<br />
$ export WINEPREFIX=~/.wine # Wine prefix to use<br />
$ export WINEARCH=win32<br />
$ wine /path/to/office_cd/setup.exe<br />
<br />
If you do not want to setup Office in the default Wine prefix ({{ic|~/.wine}}), create new one as described in [[#WINEPREFIX]] section. You could also put the above exports into your shell initialization script as also noted there.<br />
<br />
Once installation has completed, open Word or Excel to activate over the Internet. After activation run ''winecfg'' and set {{ic|riched20}} (under libraries) to {{ic|(native,builtin)}}. This will enable PowerPoint to work and makes the drop-down list of countries visible for phone activation.<br />
<br />
For OneNote to work, run {{ic|winetricks wininet}} and then make sure that {{ic|wininet}} is set to {{ic|(native,builtin)}}<br />
<br />
For additional info, see the [http://appdb.winehq.org/appview.php?iVersionId=4992 WineHQ] article.<br />
<br />
As an alternative to the above method, {{Pkg|playonlinux}} provides custom installer scripts that make the installation of Office 2003, 2007 and 2010 an ease. You just have to provide the ''setup.exe'' or ISO and the installer will guide you seamlessly through the installation procedure. You do not have to deal with the underlying Wine at all. The playonlinux installation for Office 2010 improves on the minimum installation instructions provided above by enabling xml conversions for Word documents created with certain earlier versions of Word.<br />
<br />
==== Office 2013 ====<br />
[http://www.phoronix.com/scan.php?page=news_item&px=CodeWeavers-CrossOver-16 Should work] with Wine 2.0 and newer - most likely 32-bit versions only. The exact status for each application should be updated on [https://appdb.winehq.org/objectManager.php?sClass=application&iId=31 this] page once Wine 2.0 is out.<br />
<br />
==== Office 2016 ====<br />
Doesn't work.<br />
<br />
== Third-party interfaces ==<br />
<br />
These have their own sites, and are ''not supported'' in the official Wine forums/bugzilla.<br />
<br />
=== CrossOver ===<br />
<br />
[http://www.codeweavers.com/about/ CrossOver] Has its own [[CrossOver|wiki page]].<br />
<br />
=== PlayOnLinux/PlayOnMac ===<br />
<br />
[http://www.playonlinux.com/ PlayOnLinux] is a graphical Windows and DOS program manager. It contains scripts to assist the configuration and running of programs, it can manage multiple Wine versions and even use a specific version for each executable (e.g. because of regressions). If you need to know which Wine version works best for a certain game, try the [http://appdb.winehq.org/ Wine Application Database]. You can find the {{Pkg|playonlinux}} package in [[community]].<br />
<br />
{{Tip| PlayOnLinux supports Bumblebee. Open POL console, type this command {{ic|POL_Config_Write BEFORE_WINE '''optirun'''}} and hit enter. '''optirun''' command will be used and each application will be run using '''optirun'''. You can even use '''primusrun''' instead!}}<br />
<br />
=== PyWinery ===<br />
<br />
[https://github.com/ergoithz/pywinery PyWinery] is a graphical and simple wine-prefix manager which allows you to launch apps and manage configuration of separate prefixes, also have a button to open winetricks in the same prefix, to open prefix dir, ''winecfg'', application uninstaller and wineDOS. You can install You can install PyWinery with the {{AUR|pywinery}} package. It is especially useful for having differents settings like DirectX games, office, programming, etc, and choose which prefix to use before you open an application or file.<br />
<br />
It is recommended using winetricks by default to open ''.exe'' files, so you can choose between any Wine configuration you have.<br />
<br />
=== Q4wine ===<br />
<br />
[http://sourceforge.net/projects/q4wine/ Q4Wine] is a graphical wine-prefix manager which allows you to manage configuration of prefixes. Notably it allows exporting [[Qt]] themes into the Wine configuration so that they can integrate nicely. You can find the {{Pkg|q4wine}} package in [[multilib]].<br />
<br />
== See also ==<br />
<br />
* [http://www.winehq.com/ Official Wine website]<br />
* [http://appdb.winehq.org/ Wine application database]<br />
* [http://linuxgamingtoday.wordpress.com/2008/02/16/quick-tips-to-speed-up-your-gaming-in-wine/ Advanced configuring of video card and OpenGL in Wine; Speed up Wine]<br />
* [http://wiki.gotux.net/code:perl:fileinfo FileInfo] - Find Win32 PE/COFF headers in exe/dll/ocx files under Linux/Unix environment.<br />
* [https://wiki.gentoo.org/wiki/Wine Gentoo's Wine Wiki Page]</div>Lesmanahttps://wiki.archlinux.org/index.php?title=Python&diff=467321Python2017-01-31T20:53:48Z<p>Lesmana: /* Dealing with version problem in build scripts */ remove words alluding to "easy" because it is not</p>
<hr />
<div>[[Category:Programming languages]]<br />
[[de:Python]]<br />
[[es:Python]]<br />
[[ja:Python]]<br />
[[ko:Python]]<br />
[[ru:Python]]<br />
[[zh-hans:Python]]<br />
{{Related articles start}}<br />
{{Related|Python package guidelines}}<br />
{{Related|Python/Virtual environment}}<br />
{{Related|mod_wsgi}}<br />
{{Related articles end}}<br />
From [[Wikipedia:Python (programming language)|Wikipedia]]:<br />
<br />
:''Python is a widely used high-level, general-purpose, interpreted, dynamic programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than possible in languages such as C++ or Java. The language provides constructs intended to enable writing clear programs on both a small and large scale.''<br />
:''Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive standard library.''<br />
<br />
== Installation ==<br />
<br />
=== Python 3 ===<br />
<br />
Python 3 is the latest version of the language, and is incompatible with Python 2. The language is mostly the same, but many details, especially how built-in objects like dictionaries and strings work, have changed considerably, and a lot of deprecated features have finally been removed. Also, the standard library has been reorganized in a few prominent places. For an overview of the differences, visit [http://wiki.python.org/moin/Python2orPython3 Python2orPython3] and their relevant [http://getpython3.com/diveintopython3/porting-code-to-python-3-with-2to3.html chapter] in Dive into Python 3.<br />
<br />
To install the latest version of Python 3, [[install]] the {{Pkg|python}} package from the [[official repositories]].<br />
<br />
If you would like to build the latest RC/betas from source, visit [http://www.python.org/download/ Python Downloads]. The [[Arch User Repository]] also contains good [[PKGBUILD]]s. If you do decide to build the RC, note that the binary (by default) installs to {{ic|/usr/local/bin/python3.x}}.<br />
<br />
=== Python 2 ===<br />
<br />
To get the latest version of Python 2, [[install]] the {{Pkg|python2}} package from the [[official repositories]].<br />
<br />
Python 2 will happily run alongside Python 3. You need to specify {{ic|python2}} in order to run this version.<br />
<br />
Any program requiring Python 2 needs to point to {{ic|/usr/bin/python2}}, instead of {{ic|/usr/bin/python}}, which points to Python 3. To do so, open the program or script in a [[List of applications/Documents#Text editors|text editor]] and change the first line. The line will show one of the following:<br />
<br />
#!/usr/bin/env python<br />
<br />
or<br />
<br />
#!/usr/bin/python<br />
<br />
In both cases, just change {{ic|python}} to {{ic|python2}} and the program will then use Python 2 instead of Python 3.<br />
<br />
Another way to force the use of python2 without altering the scripts is to call it explicitly with {{ic|python2}}:<br />
<br />
$ python2 ''myScript.py''<br />
<br />
Finally, you may not be able to control the script calls, but there is a way to trick the environment. It only works if the scripts use {{ic|#!/usr/bin/env python}}. It will not work with {{ic|#!/usr/bin/python}}. This trick relies on {{ic|env}} searching for the first corresponding entry in the {{ic|PATH}} variable.<br />
<br />
First create a dummy folder:<br />
<br />
$ mkdir ~/bin<br />
<br />
Then add a symlink {{ic|python}} to ''python2'' and the config scripts in it:<br />
<br />
$ ln -s /usr/bin/python2 ~/bin/python<br />
$ ln -s /usr/bin/python2-config ~/bin/python-config<br />
<br />
Finally put the new folder ''at the beginning'' of your {{ic|PATH}} variable:<br />
<br />
$ export PATH=~/bin:$PATH<br />
<br />
{{Note|This method of changing [[environment variables]] is not permanent and is only active in the current terminal session.}}<br />
<br />
To check which python interpreter is being used by {{ic|env}}, use the following command:<br />
<br />
$ which python<br />
<br />
A similar approach in tricking the environment, which also relies on {{ic|#!/usr/bin/env python}} to be called by the script in question, is to use a [[#Virtual environment]].<br />
<br />
=== Old versions ===<br />
<br />
Old versions of Python are available via the [[AUR]] and may be useful for historical curiosity, old applications that do not run on current versions, or for testing Python programs intended to run on a distribution that comes with an older version (e.g. RHEL 5.x has Python 2.4, or Ubuntu 12.04 has Python 3.2):<br />
<br />
* Python 1.5: {{AUR|python15}}<br />
* Python 2.5: {{AUR|python25}}<br />
* Python 2.6: {{AUR|python26}}<br />
* Python 3.0: {{AUR|python30}}<br />
* Python 3.2: {{AUR|python32}}<br />
* Python 3.3: {{AUR|python33}}<br />
* Python 3.4: {{AUR|python34}}<br />
* Python 3.5: {{AUR|python35}}<br />
<br />
As of October 2016, Python upstream only supports Python 2.7, 3.4, and 3.5 for security fixes. Using older versions for Internet-facing applications or untrusted code may be dangerous and is not recommended.<br />
<br />
Extra modules/libraries for old versions of Python may be found on the AUR by searching for {{ic|python<''version without period''>}}, e.g. searching for "python26" for 2.6 modules.<br />
<br />
== Package management ==<br />
<br />
Although a great number of Python packages are readily available in the [[official repositories]] and the [[AUR]], the Python ecosystem provides its own package managers for use with [https://pypi.python.org/ PyPI], the Python Package Index.<br />
<br />
* {{App|pip|The PyPA tool for installing Python packages.|https://pip.pypa.io/|{{Pkg|python-pip}}, {{Pkg|python2-pip}}}}<br />
* {{App|setuptools|Easily download, build, install, upgrade, and uninstall Python packages.|https://setuptools.readthedocs.io/|{{Pkg|python-setuptools}}, {{Pkg|python2-setuptools}}}}<br />
<br />
For a brief history and feature comparison between the two, see [https://packaging.python.org/pip_easy_install/#pip-vs-easy-install pip vs easy_install].<br />
<br />
Authoritative best practices in Python package management are detailed [https://packaging.python.org/ here].<br />
<br />
== Widget bindings ==<br />
<br />
The following [[Wikipedia:Widget toolkit|widget toolkit]] bindings are available:<br />
<br />
* {{App|TkInter|Tk bindings|http://wiki.python.org/moin/TkInter|standard module}}<br />
* {{App|pyQt|[[Qt]] bindings|http://www.riverbankcomputing.co.uk/software/pyqt/intro|{{Pkg|python2-pyqt4}} {{Pkg|python2-pyqt5}} {{Pkg|python-pyqt4}} {{Pkg|python-pyqt5}}}}<br />
* {{App|pySide|[[Qt]] bindings|http://www.pyside.org/|{{Pkg|python2-pyside}} {{Pkg|python-pyside}}}}<br />
* {{App|pyGTK|[[GTK+|GTK+ 2]] bindings|http://www.pygtk.org/|{{Pkg|pygtk}}}}<br />
* {{App|PyGObject|[[GTK+|GTK+ 2/3]] bindings via GObject Introspection|https://wiki.gnome.org/PyGObject/|{{Pkg|python2-gobject2}} {{Pkg|python2-gobject}} {{Pkg|python-gobject2}} {{Pkg|python-gobject}}}}<br />
* {{App|wxPython|wxWidgets bindings|http://wxpython.org/|{{Pkg|wxpython}}}}<br />
<br />
To use these with Python, you may need to install the associated widget kits.<br />
<br />
== Tips and tricks ==<br />
<br />
=== IPython ===<br />
[http://ipython.org/ IPython] is an enhanced Python command line available in the official repositories as {{Pkg|ipython}} and {{Pkg|ipython2}}.<br />
If you want the IPython notebook, install {{Pkg|jupyter-notebook}} for the IPython3 notebook and {{Pkg|ipython2-notebook}} for the IPython2 notebook. Run <br />
<br />
$ jupyter notebook<br />
<br />
to autostart the browser and run the IPython kernel. You can select the python version when creating the notebook in the browser.<br />
<br />
[http://bpython-interpreter.org/ bpython] is a ncurses interface to the Python interpreter, available in the official repositories as {{Pkg|bpython}} and {{Pkg|bpython2}}.<br />
<br />
=== Virtual environment ===<br />
<br />
Python provides tools to create isolated environments in which you can install packages without interfering with the other virtual environments nor with the system Python's packages. It could change the python interpreter used for a specific application. <br />
<br />
See [[Python/Virtual environment]] for details.<br />
<br />
=== Getting completion in Python2 shell ===<br />
<br />
{{Note|This is relevant only for Python 2, [https://docs.python.org/3/tutorial/interactive.html tab completion] is enabled by default since Python 3.4.}}<br />
<br />
Copy this into Python's interactive shell:<br />
<br />
{{hc|/usr/bin/python2|2=<br />
import rlcompleter<br />
import readline<br />
readline.parse_and_bind("tab: complete")<br />
}}<br />
<br />
Source: http://algorithmicallyrandom.blogspot.com.es/2009/09/tab-completion-in-python-shell-how-to.html.<br />
<br />
== Troubleshooting ==<br />
=== Dealing with version problem in build scripts ===<br />
<br />
Many projects' build scripts assume {{ic|python}} to be Python 2, and that would eventually result in an error — typically complaining that {{ic|print 'foo'}} is invalid syntax. Luckily, many of them call {{ic|python}} from the {{ic|PATH}} instead of hardcoding {{ic|#!/usr/bin/python}} in the shebang line, and the Python scripts are all contained within the project tree. So, instead of modifying the build scripts manually, there is a workaround. Create {{ic|/usr/local/bin/python}} with content like this:<br />
<br />
{{hc|/usr/local/bin/python|<nowiki><br />
#!/bin/bash<br />
script=$(readlink -f -- "$1")<br />
case "$script" in (/path/to/project1/*|/path/to/project2/*|/path/to/project3*)<br />
exec python2 "$@"<br />
;;<br />
esac<br />
<br />
exec python3 "$@"<br />
</nowiki>}}<br />
<br />
Where {{ic|<nowiki>/path/to/project1/*|/path/to/project2/*|/path/to/project3*</nowiki>}} is a list of patterns separated by {{ic|<nowiki>|</nowiki>}} matching all project trees.<br />
<br />
Do not forget to make it executable:<br />
<br />
# chmod +x /usr/local/bin/python<br />
<br />
Afterwards scripts within the specified project trees will be run with Python 2.<br />
<br />
== See also ==<br />
<br />
* [http://shop.oreilly.com/product/9780596158071.do Learning Python, 4th edition]<br />
* [http://www.diveintopython.net/ Dive Into Python], [http://getpython3.com/diveintopython3/ Dive Into Python3]<br />
* [http://www.swaroopch.com/notes/Python A Byte of Python]<br />
* [http://learnpythonthehardway.org Learn Python The Hard Way]<br />
* [http://learnpython.org Learn Python]<br />
* [http://stephensugden.com/crash_into_python/ Crash into Python] (assumes familiarity with other programming languages)<br />
* [http://www.apress.com/book/view/9781590598726 Beginning Game Development with Python and Pygame]<br />
* [http://www.greenteapress.com/thinkpython/ Think Python]<br />
* [https://pythonspot.com Pythonspot]</div>Lesmanahttps://wiki.archlinux.org/index.php?title=Python&diff=467319Python2017-01-31T20:30:34Z<p>Lesmana: /* Dealing with version problem in build scripts */ simpler workaround</p>
<hr />
<div>[[Category:Programming languages]]<br />
[[de:Python]]<br />
[[es:Python]]<br />
[[ja:Python]]<br />
[[ko:Python]]<br />
[[ru:Python]]<br />
[[zh-hans:Python]]<br />
{{Related articles start}}<br />
{{Related|Python package guidelines}}<br />
{{Related|Python/Virtual environment}}<br />
{{Related|mod_wsgi}}<br />
{{Related articles end}}<br />
From [[Wikipedia:Python (programming language)|Wikipedia]]:<br />
<br />
:''Python is a widely used high-level, general-purpose, interpreted, dynamic programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than possible in languages such as C++ or Java. The language provides constructs intended to enable writing clear programs on both a small and large scale.''<br />
:''Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive standard library.''<br />
<br />
== Installation ==<br />
<br />
=== Python 3 ===<br />
<br />
Python 3 is the latest version of the language, and is incompatible with Python 2. The language is mostly the same, but many details, especially how built-in objects like dictionaries and strings work, have changed considerably, and a lot of deprecated features have finally been removed. Also, the standard library has been reorganized in a few prominent places. For an overview of the differences, visit [http://wiki.python.org/moin/Python2orPython3 Python2orPython3] and their relevant [http://getpython3.com/diveintopython3/porting-code-to-python-3-with-2to3.html chapter] in Dive into Python 3.<br />
<br />
To install the latest version of Python 3, [[install]] the {{Pkg|python}} package from the [[official repositories]].<br />
<br />
If you would like to build the latest RC/betas from source, visit [http://www.python.org/download/ Python Downloads]. The [[Arch User Repository]] also contains good [[PKGBUILD]]s. If you do decide to build the RC, note that the binary (by default) installs to {{ic|/usr/local/bin/python3.x}}.<br />
<br />
=== Python 2 ===<br />
<br />
To get the latest version of Python 2, [[install]] the {{Pkg|python2}} package from the [[official repositories]].<br />
<br />
Python 2 will happily run alongside Python 3. You need to specify {{ic|python2}} in order to run this version.<br />
<br />
Any program requiring Python 2 needs to point to {{ic|/usr/bin/python2}}, instead of {{ic|/usr/bin/python}}, which points to Python 3. To do so, open the program or script in a [[List of applications/Documents#Text editors|text editor]] and change the first line. The line will show one of the following:<br />
<br />
#!/usr/bin/env python<br />
<br />
or<br />
<br />
#!/usr/bin/python<br />
<br />
In both cases, just change {{ic|python}} to {{ic|python2}} and the program will then use Python 2 instead of Python 3.<br />
<br />
Another way to force the use of python2 without altering the scripts is to call it explicitly with {{ic|python2}}:<br />
<br />
$ python2 ''myScript.py''<br />
<br />
Finally, you may not be able to control the script calls, but there is a way to trick the environment. It only works if the scripts use {{ic|#!/usr/bin/env python}}. It will not work with {{ic|#!/usr/bin/python}}. This trick relies on {{ic|env}} searching for the first corresponding entry in the {{ic|PATH}} variable.<br />
<br />
First create a dummy folder:<br />
<br />
$ mkdir ~/bin<br />
<br />
Then add a symlink {{ic|python}} to ''python2'' and the config scripts in it:<br />
<br />
$ ln -s /usr/bin/python2 ~/bin/python<br />
$ ln -s /usr/bin/python2-config ~/bin/python-config<br />
<br />
Finally put the new folder ''at the beginning'' of your {{ic|PATH}} variable:<br />
<br />
$ export PATH=~/bin:$PATH<br />
<br />
{{Note|This method of changing [[environment variables]] is not permanent and is only active in the current terminal session.}}<br />
<br />
To check which python interpreter is being used by {{ic|env}}, use the following command:<br />
<br />
$ which python<br />
<br />
A similar approach in tricking the environment, which also relies on {{ic|#!/usr/bin/env python}} to be called by the script in question, is to use a [[#Virtual environment]].<br />
<br />
=== Old versions ===<br />
<br />
Old versions of Python are available via the [[AUR]] and may be useful for historical curiosity, old applications that do not run on current versions, or for testing Python programs intended to run on a distribution that comes with an older version (e.g. RHEL 5.x has Python 2.4, or Ubuntu 12.04 has Python 3.2):<br />
<br />
* Python 1.5: {{AUR|python15}}<br />
* Python 2.5: {{AUR|python25}}<br />
* Python 2.6: {{AUR|python26}}<br />
* Python 3.0: {{AUR|python30}}<br />
* Python 3.2: {{AUR|python32}}<br />
* Python 3.3: {{AUR|python33}}<br />
* Python 3.4: {{AUR|python34}}<br />
* Python 3.5: {{AUR|python35}}<br />
<br />
As of October 2016, Python upstream only supports Python 2.7, 3.4, and 3.5 for security fixes. Using older versions for Internet-facing applications or untrusted code may be dangerous and is not recommended.<br />
<br />
Extra modules/libraries for old versions of Python may be found on the AUR by searching for {{ic|python<''version without period''>}}, e.g. searching for "python26" for 2.6 modules.<br />
<br />
== Package management ==<br />
<br />
Although a great number of Python packages are readily available in the [[official repositories]] and the [[AUR]], the Python ecosystem provides its own package managers for use with [https://pypi.python.org/ PyPI], the Python Package Index.<br />
<br />
* {{App|pip|The PyPA tool for installing Python packages.|https://pip.pypa.io/|{{Pkg|python-pip}}, {{Pkg|python2-pip}}}}<br />
* {{App|setuptools|Easily download, build, install, upgrade, and uninstall Python packages.|https://setuptools.readthedocs.io/|{{Pkg|python-setuptools}}, {{Pkg|python2-setuptools}}}}<br />
<br />
For a brief history and feature comparison between the two, see [https://packaging.python.org/pip_easy_install/#pip-vs-easy-install pip vs easy_install].<br />
<br />
Authoritative best practices in Python package management are detailed [https://packaging.python.org/ here].<br />
<br />
== Widget bindings ==<br />
<br />
The following [[Wikipedia:Widget toolkit|widget toolkit]] bindings are available:<br />
<br />
* {{App|TkInter|Tk bindings|http://wiki.python.org/moin/TkInter|standard module}}<br />
* {{App|pyQt|[[Qt]] bindings|http://www.riverbankcomputing.co.uk/software/pyqt/intro|{{Pkg|python2-pyqt4}} {{Pkg|python2-pyqt5}} {{Pkg|python-pyqt4}} {{Pkg|python-pyqt5}}}}<br />
* {{App|pySide|[[Qt]] bindings|http://www.pyside.org/|{{Pkg|python2-pyside}} {{Pkg|python-pyside}}}}<br />
* {{App|pyGTK|[[GTK+|GTK+ 2]] bindings|http://www.pygtk.org/|{{Pkg|pygtk}}}}<br />
* {{App|PyGObject|[[GTK+|GTK+ 2/3]] bindings via GObject Introspection|https://wiki.gnome.org/PyGObject/|{{Pkg|python2-gobject2}} {{Pkg|python2-gobject}} {{Pkg|python-gobject2}} {{Pkg|python-gobject}}}}<br />
* {{App|wxPython|wxWidgets bindings|http://wxpython.org/|{{Pkg|wxpython}}}}<br />
<br />
To use these with Python, you may need to install the associated widget kits.<br />
<br />
== Tips and tricks ==<br />
<br />
=== IPython ===<br />
[http://ipython.org/ IPython] is an enhanced Python command line available in the official repositories as {{Pkg|ipython}} and {{Pkg|ipython2}}.<br />
If you want the IPython notebook, install {{Pkg|jupyter-notebook}} for the IPython3 notebook and {{Pkg|ipython2-notebook}} for the IPython2 notebook. Run <br />
<br />
$ jupyter notebook<br />
<br />
to autostart the browser and run the IPython kernel. You can select the python version when creating the notebook in the browser.<br />
<br />
[http://bpython-interpreter.org/ bpython] is a ncurses interface to the Python interpreter, available in the official repositories as {{Pkg|bpython}} and {{Pkg|bpython2}}.<br />
<br />
=== Virtual environment ===<br />
<br />
Python provides tools to create isolated environments in which you can install packages without interfering with the other virtual environments nor with the system Python's packages. It could change the python interpreter used for a specific application. <br />
<br />
See [[Python/Virtual environment]] for details.<br />
<br />
=== Getting completion in Python2 shell ===<br />
<br />
{{Note|This is relevant only for Python 2, [https://docs.python.org/3/tutorial/interactive.html tab completion] is enabled by default since Python 3.4.}}<br />
<br />
Copy this into Python's interactive shell:<br />
<br />
{{hc|/usr/bin/python2|2=<br />
import rlcompleter<br />
import readline<br />
readline.parse_and_bind("tab: complete")<br />
}}<br />
<br />
Source: http://algorithmicallyrandom.blogspot.com.es/2009/09/tab-completion-in-python-shell-how-to.html.<br />
<br />
== Troubleshooting ==<br />
=== Dealing with version problem in build scripts ===<br />
<br />
Many projects' build scripts assume {{ic|python}} to be Python 2, and that would eventually result in an error — typically complaining that {{ic|print 'foo'}} is invalid syntax. Luckily, many of them call {{ic|python}} from the {{ic|PATH}} instead of hardcoding {{ic|#!/usr/bin/python}} in the shebang line, and the Python scripts are all contained within the project tree. So, instead of modifying the build scripts manually, there is an easy workaround: create a symlink to {{ic|/usr/bin/python2}} named {{ic|python}} and put the directory in {{ic|$PATH}}.<br />
<br />
Example:<br />
<br />
create some directory:<br />
mkdir python2aspython<br />
cd python2aspython<br />
create symlink:<br />
ln -s /usr/bin/python2 python<br />
add to path:<br />
PATH="$PWD:$PATH"<br />
<br />
Afterwards all scripts started from this terminal calling python will be run with Python 2.<br />
<br />
To reset close terminal. To reinstate add directory to {{ic|PATH}} again.<br />
<br />
== See also ==<br />
<br />
* [http://shop.oreilly.com/product/9780596158071.do Learning Python, 4th edition]<br />
* [http://www.diveintopython.net/ Dive Into Python], [http://getpython3.com/diveintopython3/ Dive Into Python3]<br />
* [http://www.swaroopch.com/notes/Python A Byte of Python]<br />
* [http://learnpythonthehardway.org Learn Python The Hard Way]<br />
* [http://learnpython.org Learn Python]<br />
* [http://stephensugden.com/crash_into_python/ Crash into Python] (assumes familiarity with other programming languages)<br />
* [http://www.apress.com/book/view/9781590598726 Beginning Game Development with Python and Pygame]<br />
* [http://www.greenteapress.com/thinkpython/ Think Python]<br />
* [https://pythonspot.com Pythonspot]</div>Lesmanahttps://wiki.archlinux.org/index.php?title=Wine&diff=461909Wine2017-01-07T17:08:03Z<p>Lesmana: add section about mono and gecko</p>
<hr />
<div>[[Category:Wine]]<br />
[[cs:Wine]]<br />
[[de:Wine]]<br />
[[es:Wine]]<br />
[[fr:Wine]]<br />
[[it:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
[[zh-CN:Wine]]<br />
[[zh-TW:Wine]]<br />
{{Related articles start}}<br />
{{Related|Steam/Wine}}<br />
{{Related|CrossOver}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
[[Wikipedia:Wine (software)|Wine]] is a ''compatibility layer'' capable of running Microsoft Windows applications on Unix-like operating systems. Programs running in Wine act as native programs would, without the performance/memory penalties of an emulator. See the [http://www.winehq.org/ official project home] and [https://wiki.winehq.org/ wiki] pages for longer introduction.<br />
<br />
== Installation ==<br />
{{Warning|If you can access a file or resource with your user account, programs running in Wine can too. Wine prefixes are '''not''' [[wikipedia:Sandbox (computer security)|sandboxes]]. Consider using [[wikipedia:Virtualization|virtualization]] if security is important.}}<br />
<br />
Wine can be installed with the packages {{Pkg|wine}} (stable) or {{Pkg|wine-staging}} (testing). [https://wine-staging.com/ Wine Staging] is a patched version of [https://www.winehq.org/ Wine], which contains bug fixes and features (e.g. [[#CSMT patch|CSMT patch]]), which have not been integrated into the stable branch yet. If you are running a 64-bit system, you will need to enable the [[Multilib]] repository first. See also [[#Sound]].<br />
<br />
You may also want to install {{pkg|wine_gecko}} and {{pkg|wine-mono}} for applications that need support for Internet Explorer and .NET, respectively. These packages are not strictly required as Wine will download the relevant files as needed. However, having the files downloaded in advance allows you to work off-line and makes it so Wine does not download the files for each Wine prefix needing them.<br />
<br />
'''Architectural differences'''<br />
<br />
Wine by default is 32-bit, as is the i686 Arch package. As such, it is unable to execute any 64-bit Windows applications.<br />
<br />
The x86_64 Arch package, however, is built with {{ic|--enable-win64}}. This activates the Wine version of [[Wikipedia:WoW64|WoW64]].<br />
*In Windows, this complicated subsystem allows the user to use 32-bit and 64-bit Windows programs concurrently and even in the same directory.<br />
*In Wine, some 32-bit programs do not work properly in a 64-bit prefix. In that case the user will have to make separate directories/prefixes. See the [https://wiki.winehq.org/FAQ#How_do_I_create_a_32_bit_wineprefix_on_a_64_bit_system.3F Wine FAQ] for specific information on this.<br />
<br />
If you run into problems with {{ic|winetricks}} or programs with a 64-bit environment, try creating a new 32-bit {{ic|WINEPREFIX}}. See below: [[#WINEARCH]]. Using the x86_64 Wine package with {{ic|1=WINEARCH=win32}} should have the same behaviour as using the i686 Wine package.<br />
<br />
== Configuration ==<br />
Configuring Wine is typically accomplished using:<br />
* [https://wiki.winehq.org/Winecfg winecfg] is a GUI configuration tool for Wine. You can run it from a console window with: {{ic|$ wine winecfg}}, or {{ic|1=$ WINEPREFIX=~/.some_prefix wine winecfg}}.<br />
* {{ic|control.exe}} is Wine's implementation of Windows' Control Panel which can be accessed with: {{ic|$ wine control}}.<br />
* [https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit] is Wine's registry editing tool. If ''winecfg'' and the Control Panel are not enough, see WineHQ's article on [https://wiki.winehq.org/Useful_Registry_Keys Useful Registry Keys].<br />
* See WineHQ's [https://wiki.winehq.org/List_of_Commands List of Commands] for the full list.<br />
<br />
=== WINEPREFIX ===<br />
By default, Wine stores its configuration files and installed Windows programs in {{ic|~/.wine}}. This directory is commonly called a "Wine prefix" or "Wine bottle". It is created/updated automatically whenever you run a Windows program or one of Wine's bundled programs such as ''winecfg''. The prefix directory also contains a tree which your Windows programs will see as {{ic|C:}} (the C-drive).<br />
<br />
You can override the location Wine uses for a prefix with the {{ic|WINEPREFIX}} environment variable. This is useful if you want to use separate configurations for different Windows programs. The first time a program is run with a new Wine prefix, Wine will automatically create a directory with a bare C-drive and registry.<br />
<br />
For example, if you run one program with {{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}, and another with {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}, the two programs will each have a separate C-drive and separate registries.<br />
<br />
{{Note|Wine prefixes are not [[Wikipedia:Sandbox (computer security)|sandboxes]]! Programs running under Wine can still access the rest of the system! (for example, {{ic|Z:}} is mapped to {{ic|/}}, regardless of the Wine prefix).}}<br />
<br />
To create a default prefix without running a Windows program or other GUI tool you can use:<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
If you have a 64-bit system, Wine will start an 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 />
{{Note|1=During prefix creation, the 64-bit version of Wine treats all folders as 64-bit prefixes and will not create a 32-bit in any existing folder. To create a 32-bit prefix you have to let Wine create the folder specified in {{ic|WINEPREFIX}}. See WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=29661 29661]}}<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 />
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 />
<br />
=== Graphics drivers ===<br />
<br />
For 64-bit systems, additional [[multilib]] packages are required. Please install the one that is listed in the ''Multilib Package'' 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 />
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''. Currently, the [[Alsa]] driver is the best supported.<br />
<br />
* If you want to use the [[ALSA]] driver in Wine on a 64-bit system, you will need to install {{Pkg|lib32-alsa-lib}} and {{Pkg|lib32-alsa-plugins}}.<br />
* If you want to use the [[PulseAudio]] driver in Wine, you will need to install the {{Pkg|lib32-libpulse}} package.<br />
* If you want to use the [[OSS]] driver in Wine, you will need to install the {{Pkg|lib32-alsa-oss}} package. The OSS driver in the kernel will not suffice.<br />
<br />
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [https://www.winehq.org/docs/wineusr-guide/using-regedit#Configuring_Sound configure it via the registry]. For example, in a case where the microphone wasn't 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, if you are using a 64-bit Arch, it may help to [[#WINEARCH|recreate the prefix]]. <br />
<br />
Games that use advanced sound systems may require installations of {{Pkg|lib32-openal}}.<br />
<br />
==== MIDI support ====<br />
<br />
[[MIDI]] was a quite popular system for video games music in the 90's. If you are trying out old games, it is not uncommon that the music will not play out of the box.<br />
Wine has excellent MIDI support. However you first need to make it work on your host system, as explained in [[MIDI]]. Last but not least you need to make sure Wine will use the correct MIDI output.<br />
<br />
=== Other libraries ===<br />
<br />
*Some applications (e.g. Office 2003/2007) require the MSXML library to parse HTML or XML, in such cases you need to install {{Pkg|lib32-libxml2}}.<br />
<br />
*Some applications that play music may require {{Pkg|lib32-mpg123}}.<br />
<br />
*Some applications that use a color management engine (e.g. pdf viewers, image viewers, etc) may require {{Pkg|lib32-lcms2}}.<br />
<br />
*Some applications that use native image manipulation libraries may require {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}.<br />
<br />
*Some applications that require encryption support may require {{Pkg|lib32-gnutls}}.<br />
<br />
=== Fonts ===<br />
<br />
If Wine applications are not showing easily readable fonts, you may not have Microsoft's Truetype fonts installed. See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
After running such programs, kill all Wine servers and run {{ic|winecfg}}. Fonts should be legible now.<br />
<br />
If the fonts look somehow smeared, import the following text file into the Wine registry with [https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
See also [[Font configuration#Applications without fontconfig support]].<br />
<br />
=== Desktop launcher menus ===<br />
<br />
When a Windows application installer creates a shortcut Wine creates a {{ic|.desktop}} file instead. The default locations for those files in Arch Linux are:<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 {{ic|.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 />
By default, installation of Wine does not create desktop menus/icons for the software which comes with Wine (e.g. for ''winecfg'', ''winebrowser'', etc). These instructions will add entries for these applications.<br />
<br />
First, install a Windows program using Wine to create the base menu. After the base menu is created, you can create the following files in {{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 />
If these settings produce a ugly/non-existent icon, it means that there are no icons for these launchers in the icon set that you have enabled. You should replace the icon settings with the explicit location of the icon that you want. Clicking the icon in the launcher's properties menu will have the same effect. A great icon set that supports these shortcuts is [http://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors].<br />
<br />
==== Removing menu entries ====<br />
<br />
Menu entries created by Wine are located in {{ic|~/.local/share/applications/wine/Programs/}}. Remove the program's ''.desktop'' entry to remove the application from the menu.<br />
<br />
In addition to remove unwanted extensions binding by Wine, execute the following commands (taken from the Wine website):<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 />
=== Mono and Gecko ===<br />
<br />
when initializing a new wineprefix wine will ask to install mono and gecko. or if the packages {{pkg|wine-mono}} and {{pkg|wine_gecko}} are installed wine will silently copy about 450 mb of mono and gecko files in the wineprefix.<br />
<br />
to prevent wine from asking to install mono and gecko start wine like this:<br />
<br />
WINEDLLOVERRIDES=mscoree=d;mshtml=d wine somewineapp<br />
<br />
<br />
== Using Windows applications ==<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 Running Wine as root] for the official statement.}}<br />
<br />
See [https://wiki.winehq.org/FAQ#Installing_Windows_Applications Installing Windows Applications] at WineHQ. See [[#Desktop launcher menus]] for information on where the shortcuts were created.<br />
<br />
See [https://wiki.winehq.org/FAQ#Running_applications Running applications] at WineHQ. The {{ic|.desktop}} files created by the installer should automatically appear as entries in any X menu or file manager applications. They can also be examined to determine what command to use to run the application from a terminal.<br />
<br />
See [https://wiki.winehq.org/FAQ#How_do_I_uninstall_Windows_applications.3F How do I uninstall Windows applications?] at WineHQ.<br />
<br />
== Tips and tricks ==<br />
<br />
{{Tip|In addition to the links provided in the beginning of the article the following may be of interest:<br />
* [http://appdb.winehq.org/ The Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [http://forum.winehq.org/ The WineHQ Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<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 />
=== CSMT patch ===<br />
<br />
Since 2013 Wine developers have been experimenting with [http://www.winehq.org/pipermail/wine-devel/2013-September/101106.html stream/worker thread optimizations]. 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 known as CSMT patch and works with NVidia and AMD graphics cards.<br />
<br />
[http://www.wine-staging.com/ Wine-staging] includes CSMT support (included again since [http://www.wine-staging.com/news/2016-05-18-release-1.9.10.html version 1.9.10]), and can be installed with the {{Pkg|wine-staging}} package.<br />
<br />
CSMT support needs to be enabled in <code>winecfg</code> (Staging tab) before it can be used.<br />
<br />
Further information:<br />
*[http://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 />
*[https://www.youtube.com/playlist?list=PL0P2a_sII2eTd8uq-azTNpQjiFLqBhDjg Here] you find some game videos running with CSMT enabled<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 />
Alternatively you can delete all wine related stuff:<br />
<br />
$ find ~/.local/share | grep wine | xargs rm<br />
<br />
And update the cache as above.<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 new Wine file associations ===<br />
<br />
To prevent wine from creating any file associations edit your {{ic|$WINEPREFIX/system.reg}} file, Search for {{ic|winemenubuilder}} and remove {{ic|-a}}, so you'll get:<br />
<br />
{{hc|1=$WINEPREFIX/system.reg|2=<br />
[Software\\Microsoft\\Windows\\CurrentVersion\\RunServices]<br />
"winemenubuilder"="C:\\windows\\system32\\winemenubuilder.exe -r"<br />
}}<br />
<br />
This has to be done for each WINEPREFIX which should not update file associations.<br />
<br />
You can disable winemenubuilder for all WINEPREFIXes by setting an environment variable:<br />
<br />
$ export WINEDLLOVERRIDES="winemenubuilder.exe=d"<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.<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. Install it with the {{AUR|gnome-exe-thumbnailer}} package.<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 />
=== Using Wine as an interpreter for Win16/Win32 binaries ===<br />
<br />
It is also possible to tell the kernel to use Wine as an interpreter for all Win16/Win32 binaries:<br />
# echo ':DOSWin:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register<br />
<br />
To make the setting permanent, create the {{ic|/etc/binfmt.d/wine.conf}} file with the following content:<br />
{{hc|/etc/binfmt.d/wine.conf|2=<br />
# Start WINE on Windows executables<br />
:DOSWin:M::MZ::/usr/bin/wine:<br />
}}<br />
<br />
[[systemd]] automatically mounts the {{ic|/proc/sys/fs/binfmt_misc}} filesystem using {{ic|proc-sys-fs-binfmt_misc.mount}} (and automount) and runs the {{ic|systemd-binfmt.service}} to load your settings.<br />
<br />
Try it out by running a Windows program:<br />
$ chmod +x ''exefile.exe''<br />
$ ./''exefile.exe''<br />
<br />
If all went well, ''exefile.exe'' should run.<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: [http://www.spinics.net/linux/fedora/fedora-users/msg450821.html Fedora Mailing List]<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 />
=== Force OpenGL mode in games ===<br />
<br />
Many games 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 />
$ wine /path/to/3d_game.exe -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [http://appdb.winehq.org AppDB] for such application specific information.<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 />
=== Installing .NET Framework 4.0 ===<br />
<br />
First create a new 32-bit Wine prefix if you are on a 64-bit system.<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
<br />
Then install the following packages using winetricks<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winetricks -q msxml3 dotnet40 corefonts<br />
<br />
=== Installing Microsoft Office ===<br />
==== Office 2010 ====<br />
Microsoft Office 2010 works without any problems (tested with Microsoft Office Home and Student 2010, Wine 1.7.5; Microsoft Office Professional Plus 2010, Wine 1.7.51). Activation over Internet also works.<br />
<br />
Start by installing {{pkg|wine-mono}}, {{pkg|wine_gecko}}, {{pkg|samba}}, {{pkg|lib32-libxslt}} and {{pkg|lib32-libxml2}}.<br />
<br />
Proceed with launching the installer:<br />
$ export WINEPREFIX=~/.wine # Wine prefix to use<br />
$ export WINEARCH=win32<br />
$ wine /path/to/office_cd/setup.exe<br />
<br />
If you do not want to setup Office in the default Wine prefix ({{ic|~/.wine}}), create new one as described in [[#WINEPREFIX]] section. You could also put the above exports into your shell initialization script as also noted there.<br />
<br />
Once installation has completed, open Word or Excel to activate over the Internet. After activation run ''winecfg'' and set {{ic|riched20}} (under libraries) to {{ic|(native,builtin)}}. This will enable PowerPoint to work and makes the drop-down list of countries visible for phone activation.<br />
<br />
For OneNote to work, run {{ic|winetricks wininet}} and then make sure that {{ic|wininet}} is set to {{ic|(native,builtin)}}<br />
<br />
For additional info, see the [http://appdb.winehq.org/appview.php?iVersionId=4992 WineHQ] article.<br />
<br />
As an alternative to the above method, {{Pkg|playonlinux}} provides custom installer scripts that make the installation of Office 2003, 2007 and 2010 an ease. You just have to provide the ''setup.exe'' or ISO and the installer will guide you seamlessly through the installation procedure. You do not have to deal with the underlying Wine at all. The playonlinux installation for Office 2010 improves on the minimum installation instructions provided above by enabling xml conversions for Word documents created with certain earlier versions of Word.<br />
<br />
==== Office 2013 ====<br />
[http://www.phoronix.com/scan.php?page=news_item&px=CodeWeavers-CrossOver-16 Should work] with Wine 2.0 and newer - most likely 32-bit versions only. The exact status for each application should be updated on [https://appdb.winehq.org/objectManager.php?sClass=application&iId=31 this] page once Wine 2.0 is out.<br />
<br />
==== Office 2016 ====<br />
Doesn't work.<br />
<br />
== Third-party interfaces ==<br />
<br />
These have their own sites, and are ''not supported'' in the official Wine forums/bugzilla.<br />
<br />
=== CrossOver ===<br />
<br />
[http://www.codeweavers.com/about/ CrossOver] Has its own [[CrossOver|wiki page]].<br />
<br />
=== PlayOnLinux/PlayOnMac ===<br />
<br />
[http://www.playonlinux.com/ PlayOnLinux] is a graphical Windows and DOS program manager. It contains scripts to assist the configuration and running of programs, it can manage multiple Wine versions and even use a specific version for each executable (e.g. because of regressions). If you need to know which Wine version works best for a certain game, try the [http://appdb.winehq.org/ Wine Application Database]. You can find the {{Pkg|playonlinux}} package in [[community]].<br />
<br />
{{Tip| PlayOnLinux supports Bumblebee. Open POL console, type this command {{ic|POL_Config_Write BEFORE_WINE '''optirun'''}} and hit enter. '''optirun''' command will used and each application will be run using '''optirun'''. You can even use '''primusrun''' instead!}}<br />
<br />
=== PyWinery ===<br />
<br />
[https://github.com/ergoithz/pywinery PyWinery] is a graphical and simple wine-prefix manager which allows you to launch apps and manage configuration of separate prefixes, also have a button to open winetricks in the same prefix, to open prefix dir, ''winecfg'', application uninstaller and wineDOS. You can install You can install PyWinery with the {{AUR|pywinery}} package. It is especially useful for having differents settings like DirectX games, office, programming, etc, and choose which prefix to use before you open an application or file.<br />
<br />
It is recommended using winetricks by default to open ''.exe'' files, so you can choose between any Wine configuration you have.<br />
<br />
=== Q4wine ===<br />
<br />
[http://sourceforge.net/projects/q4wine/ Q4Wine] is a graphical wine-prefix manager which allows you to manage configuration of prefixes. Notably it allows exporting [[Qt]] themes into the Wine configuration so that they can integrate nicely. You can find the {{Pkg|q4wine}} package in [[multilib]].<br />
<br />
== See also ==<br />
<br />
* [http://www.winehq.com/ Official Wine website]<br />
* [http://appdb.winehq.org/ Wine application database]<br />
* [http://linuxgamingtoday.wordpress.com/2008/02/16/quick-tips-to-speed-up-your-gaming-in-wine/ Advanced configuring of video card and OpenGL in Wine; Speed up Wine]<br />
* [http://wiki.gotux.net/code:perl:fileinfo FileInfo] - Find Win32 PE/COFF headers in exe/dll/ocx files under Linux/Unix environment.<br />
* [https://wiki.gentoo.org/wiki/Wine Gentoo's Wine Wiki Page]</div>Lesmanahttps://wiki.archlinux.org/index.php?title=Wine_package_guidelines&diff=461136Wine package guidelines2017-01-02T13:03:51Z<p>Lesmana: mono in section title</p>
<hr />
<div>[[Category:Package development]]<br />
[[Category:Wine]]<br />
[[it:Wine package guidelines]]<br />
[[ru:Wine package guidelines]]<br />
{{Package guidelines}}<br />
<br />
Many Windows programs may still be useful in Linux and so we may want to have a package for them. The differences between the two operating systems make this task a little complex. In this guideline we will talk about Win32 binaries, since projects where source is available usually are ported to Linux.<br />
<br />
== Things to check outright ==<br />
<br />
* License: does the license allow the program to be repackaged?<br />
* Installer: is it possible to install the program silently? Even better, does an installer-less version exist?<br />
* Portability and cleanness: is the program portable? It is clean?<br />
Here we mean a program is portable if it ''never'' writes in the registry or outside its directory; we mean a program is clean if it ''never'' writes in its directory, but it may write its settings in the user folder. A program can be also both (e.g., it never writes settings) or neither (e.g., it writes in its directory, it writes around, it writes in the registry...)<br />
<br />
=== License ===<br />
<br />
Usually licenses are in a text file in the install directory. If you can't find it, try following the screens during installation. If nothing is said about repackaging, go on. The author does not care. Otherwise the license usually does not allow removing files or does not allow repackaging at all. In the former case just be careful that the [[makepkg]] process does not lose any file, you may delete unneeded files (e.g., uninstallers) in the {{ic|post_install}} phase; in the latter case all the installing process must be done in the {{ic|post_install}} phase. The {{ic|build}} phase will only be for copying the install files.<br />
<br />
=== Installer ===<br />
<br />
It is much easier to work with compressed files like {{ic|.zip}} than with Windows installers. If you have no choice, since the author insists on distributing its program with an installer, search the Internet for if it is possible to silently install the software. [http://unattended.msfn.org/unattended.xp/page/list/switch/ MSFN] is usually a good place to search. If you cannot find a way, try to open the installer with different [[Nonfree applications package guidelines#Unpacking|unpacking utilities]]; it may work.<br />
<br />
=== Portability and cleanness ===<br />
<br />
A portable program does not need its own [[Wine]] emulated file system, so check in [http://www.portablefreeware.com Portable Freeware] if the program you are packaging is portable.<br />
<br />
== The guideline in short ==<br />
<br />
The idea behind packaging a Windows program is to use the program's files as mere data that Wine will interpret, just like JVM and Java bytecode.<br />
<br />
So we will install the program in {{ic|/usr/share/"$pkgname"}} and the program will write all what it needs in {{ic|"$HOME"/."$pkgname"}}. Everything will be prepared by a small script saved in {{ic|/usr/bin/"$pkgname"}} that will create the folder, prepare it if needed, and finally start the program.<br />
<br />
In the next sections we will talk about every step.<br />
<br />
This way every user will have their own settings and their decisions will not bother other users.<br />
<br />
=== Installing ===<br />
<br />
If the program has no installer, the installation is a mere decompression of a file; unpack it to {{ic|"$pkgdir"/usr/share/$pkgname}}, making sure that the permissions are correct. These commands will do:<br />
$ find "$pkgdir"/usr/share -type f -exec chmod 644 "{}" \;<br />
$ find "$pkgdir"/usr/share -type d -exec chmod 755 "{}" \;<br />
If the program cannot be installed the easy way, you need to create a Wine environment:<br />
$ install -m755 -d "$srcdir"/tmp "$srcdir"/tmp/env "$srcdir"/tmp/local<br />
$ export WINEPREFIX="$srcdir"/tmp/env<br />
$ export XDG_DATA_HOME="$srcdir"/tmp/local<br />
$ wine "$srcdir"/installer.exe /silentoptions<br />
We have not discussed portability yet, but if your program does not need the registry keys it modified, you can just copy the directory from the:<br />
"$srcdir"/tmp/env/drive_c/Program\ Files/programname<br />
Otherwise you need to copy all the registry files too and eventually the files the program installed around. The {{ic|"$srcdir"/tmp/local}} will contains menu icons and desktop files, you may want to copy them in the package. If there does not exist a way to install the program silently... Maybe you can make a {{ic|.tar.gz}} file and upload it somewhere? If nothing automated is possible, force the user to follow the installer and hope he does not mess up the installation, write some checks before blindly copying a folder that may not exist (e.g., the user pressed 'Cancel'.)<br />
<br />
=== The /usr/bin script ===<br />
<br />
This script prepares the settings folder and starts the program. If your program is portable, it will look like this:<br />
<br />
#!/bin/bash<br />
unset WINEPREFIX<br />
if [ ! -d "$HOME"/.programname ] ; then<br />
mkdir -p "$HOME"/.programname<br />
#prepare the environment here<br />
fi<br />
WINEDEBUG=-all wine "$HOME"/.programname/programname "$@"<br />
If it is clean, it will look like this:<br />
#!/bin/bash<br />
export WINEPREFIX="$HOME"/.programname/wine<br />
if [ ! -d "$HOME"/.programname ] ; then<br />
mkdir -p "$HOME"/.programname/wine<br />
wineboot -u<br />
#copy the registry file if needed<br />
fi<br />
WINEDEBUG=-all wine /usr/share/programname "$@"<br />
<br />
As you can see, in the second case there is no environment preparation. In fact a clean application will be started directly from {{ic|/usr/share}} since it will not need to write in its folder, so its settings will be written somewhere in the emulated file system.<br />
<br />
If the application is neither clean neither portable the two ideas must be combined.<br />
<br />
If the application does not write settings at all, skip the {{ic|if}} and start it from {{ic|/usr/share}}.<br />
<br />
The task of preparing the environment may differ greatly between applications, but follow these rules of thumb:<br />
If the program:<br />
* just needs to read a file, symlink it.<br />
* needs to write in a file, copy it.<br />
* does not use a file, ignore it.<br />
Of course the minimum is just starting {{ic|1=WINEDEBUG=-all wine /usr/share/programname "$@"}}.<br />
<br />
Usually the environment will be made by symlinking between the {{ic|"$HOME"/.''programname''}} directory and the {{ic|/usr/share/''programname''}} files. But since some Windows programs are very fickle about their paths, you may need to symlink directly in the {{ic|"$HOME"/.''programname''/wine/drive_c/Program\ Files/''programname''}} directory.<br />
<br />
Of course those are just ideas to integrate Win32 applications in the Linux environment, do not forget your intelligence and gumption.<br />
<br />
As example, [[Wikipedia:μTorrent|μTorrent]] is by default a clean application, but with a easy step can be used as a portable one. Since it is a single file and it is pretty small creating its wine environment (about 5MB) it is probably an overkill. It is better to symlink the executable, create the empty '''settings.dat''' in order to use it portable in the {{ic|$HOME/.utorrent}} directory. With the added advantage that just visiting {{ic|.utorrent}} folder an user can see a copy of the {{ic|.torrent}} files she downloaded.<br />
<br />
=== UnionFsFuse ===<br />
<br />
You can consider using the [http://podgorny.cz/moin/UnionFsFuse UnionFsFuse] program available in the [[official repositories]] as {{Pkg|unionfs-fuse}}).<br />
UnionFsFuse allows to keep the base directory in {{ic|/usr/share}} and put a copy of the files the application needed to write inside {{ic|$HOME/.programname}}<br />
almost automatically.<br />
<br />
Using UnionFsFuse means an additional dependency and it requires the fuse module that not all users might load. Yet, it might be worthwhile if the application would need lots of symlinking or if it is unclear exactly what it needs to be written. Just ensure to mount and unmount the UnionFs correctly.<br />
Among others, the {{AUR|GeneRally}}{{Broken package link|{{aur-mirror|generally}}}} package uses this approach.<br />
<br />
== One example ==<br />
<br />
We will make a package for [http://www.emule-project.net/ eMule]. According to [http://www.portablefreeware.com/?q=emule Portable Freeware], eMule is not completely portable since it writes some (useless) keys in the registry.<br />
<br />
On the other hand, it is not clean either since it writes its configuration files and puts its downloads in its installation folder.<br />
<br />
Luckily there is an [http://prdownloads.sourceforge.net/emule/eMule0.49b.zip installer-less version available].<br />
<br />
So we make our [[PKGBUILD]]; the only dependency is {{Pkg|wine}}. The {{ic|md5sums}} should be added.<br />
<br />
{{bc|<nowiki><br />
# Maintainer: You <youremail><br />
pkgname=emule<br />
pkgver=0.49b<br />
pkgrel=1<br />
pkgdesc="One of the biggest and most reliable peer-to-peer file sharing<br />
clients around the world."<br />
arch=(i686 x86_64)<br />
url="http://www.emule-project.net"<br />
license=('GPL')<br />
depends=()<br />
depends=(wine)<br />
makedepends=(unzip)<br />
source=(emule http://prdownloads.sourceforge.net/emule/eMule$pkgver.zip)<br />
noextract=()<br />
options=(!strip)<br />
<br />
build() {<br />
rm -f src/eMule"$pkgver"/license* #It is GPL<br />
<br />
install -d -m755 pkg/usr/share/emule<br />
cp -ra src/eMule"$pkgver"/* pkg/usr/share/emule<br />
find pkg/usr/share/emule -type d -exec chmod 755 "{}" \;<br />
find pkg/usr/share/emule -type f -exec chmod 644 "{}" \;<br />
<br />
install -d -m755 pkg/usr/bin<br />
install -m755 emule pkg/usr/bin <br />
}<br />
</nowiki>}}<br />
<br />
Now we make our '''emule''' file, which according to {{ic|build}}, will be copied and made executable in {{ic|/usr/bin}}.<br />
<br />
#!/bin/bash<br />
export WINEARCH=win32 WINEPREFIX="$HOME/.emule/wine"<br />
<br />
if [ ! -d "$HOME"/.emule ] ; then<br />
mkdir -p "$HOME"/.emule/wine || exit 1<br />
#Each user will have its config, we copy the default file since emule<br />
#needs to write here.<br />
cp -r /usr/share/emule/config "$HOME"/.emule || exit 1<br />
#We symlink the files emule needs to read to work<br />
ln -s /usr/share/emule/emule.exe "$HOME"/.emule/emule || exit 1<br />
ln -s -T /usr/share/emule/lang "$HOME"/.emule/lang || exit 1<br />
ln -s -T /usr/share/emule/webserver "$HOME"/.emule/webserver || exit 1<br />
fi<br />
<br />
wine "$HOME"/.emule/emule "$@"<br />
<br />
If you want to be more precise, you may add a message in the {{ic|.install}} file telling the user that they should disable search history since wine messes up that menu. You may even provide a default config file with the best settings. And that's it... run {{ic|$ makepkg}}, check the package folder to be sure, and install.<br />
<br />
== Gecko and Mono ==<br />
<br />
Unless you know for sure, that software require browser of .NET runtime (packages {{Pkg|wine_gecko}} and {{Pkg|wine-mono}} in official repositories), default wine installation prompts for Gecko/Mono are undesirable.<br />
<br />
To disable HTML rendering, bytecode support and the dialogs, you need to use a dlloverride in your script.<br />
For Gecko:<br />
export WINEDLLOVERRIDES="mshtml="<br />
For Mono:<br />
export WINEDLLOVERRIDES="mscoree="<br />
For both:<br />
export WINEDLLOVERRIDES="mscoree,mshtml="<br />
<br />
You can also disable them via {{ic|winecfg}}: just set mscoree/mshtml to Disable.</div>Lesmanahttps://wiki.archlinux.org/index.php?title=Systemd&diff=441999Systemd2016-07-18T11:55:14Z<p>Lesmana: /* Examples */ add override timer example</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Daemons and system services]]<br />
[[Category:Boot process]]<br />
[[ar:Systemd]]<br />
[[de:Systemd]]<br />
[[el:Systemd]]<br />
[[es:Systemd]]<br />
[[fa:Systemd]]<br />
[[fr:Systemd]]<br />
[[it:Systemd]]<br />
[[ja:Systemd]]<br />
[[pt:Systemd]]<br />
[[ru:Systemd]]<br />
[[zh-CN:Systemd]]<br />
[[zh-TW:Systemd]]<br />
{{Related articles start}}<br />
{{Related|systemd/User}}<br />
{{Related|systemd/Timers}}<br />
{{Related|systemd FAQ}}<br />
{{Related|init}}<br />
{{Related|init Rosetta}}<br />
{{Related|Daemons#List of daemons}}<br />
{{Related|udev}}<br />
{{Related|Improve boot performance}}<br />
{{Related|Allow users to shutdown}}<br />
{{Related articles end}}<br />
<br />
From the [http://freedesktop.org/wiki/Software/systemd project web page]:<br />
<br />
:''systemd'' is a system and service manager for Linux, compatible with SysV and LSB init scripts. systemd provides aggressive parallelization capabilities, uses socket and [[D-Bus]] activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux [[control groups]], supports snapshotting and restoring of the system state, maintains mount and automount points and implements an elaborate transactional dependency-based service control logic.<br />
<br />
{{Note|1=For a detailed explanation as to why Arch has moved to ''systemd'', see [https://bbs.archlinux.org/viewtopic.php?pid=1149530#p1149530 this forum post].}}<br />
<br />
== Basic systemctl usage ==<br />
<br />
The main command used to introspect and control ''systemd'' is ''systemctl''. Some of its uses are examining the system state and managing the system and services. See {{ic|man systemctl}} for more details.<br />
<br />
{{Tip|<br />
* You can use all of the following ''systemctl'' commands with the {{ic|-H ''user''@''host''}} switch to control a ''systemd'' instance on a remote machine. This will use [[SSH]] to connect to the remote ''systemd'' instance.<br />
* ''systemadm'' is the official graphical frontend for ''systemctl'' and is provided by the {{Pkg|systemd-ui}} package.<br />
* [[Plasma]] users can install {{Pkg|systemd-kcm}} as a graphical fronted for ''systemctl''. After installing the module will be added under ''System administration''.}}<br />
<br />
=== Analyzing the system state ===<br />
<br />
Show '''system status''' using:<br />
<br />
$ systemctl status<br />
<br />
'''List running''' units:<br />
<br />
$ systemctl<br />
<br />
or:<br />
<br />
$ systemctl list-units<br />
<br />
'''List failed''' units:<br />
<br />
$ systemctl --failed<br />
<br />
The available unit files can be seen in {{ic|/usr/lib/systemd/system/}} and {{ic|/etc/systemd/system/}} (the latter takes precedence). '''List installed''' unit files with:<br />
<br />
$ systemctl list-unit-files<br />
<br />
=== Using units ===<br />
<br />
Units can be, for example, services (''.service''), mount points (''.mount''), devices (''.device'') or sockets (''.socket'').<br />
<br />
When using ''systemctl'', you generally have to specify the complete name of the unit file, including its suffix, for example {{ic|sshd.socket}}. There are however a few short forms when specifying the unit in the following ''systemctl'' commands:<br />
<br />
* If you do not specify the suffix, systemctl will assume ''.service''. For example, {{ic|netctl}} and {{ic|netctl.service}} are equivalent.<br />
* Mount points will automatically be translated into the appropriate ''.mount'' unit. For example, specifying {{ic|/home}} is equivalent to {{ic|home.mount}}.<br />
* Similar to mount points, devices are automatically translated into the appropriate ''.device'' unit, therefore specifying {{ic|/dev/sda2}} is equivalent to {{ic|dev-sda2.device}}.<br />
<br />
See {{ic|man systemd.unit}} for details.<br />
<br />
{{Note|Some unit names contain an {{ic|@}} sign (e.g. {{ic|name@''string''.service}}): this means that they are [http://0pointer.de/blog/projects/instances.html instances] of a ''template'' unit, whose actual file name does not contain the {{ic|''string''}} part (e.g. {{ic|name@.service}}). {{ic|''string''}} is called the ''instance identifier'', and is similar to an argument that is passed to the template unit when called with the ''systemctl'' command: in the unit file it will substitute the {{ic|%i}} specifier. <br />
<br />
To be more accurate, ''before'' trying to instantiate the {{ic|name@.suffix}} template unit, ''systemd'' will actually look for a unit with the exact {{ic|name@string.suffix}} file name, although by convention such a "clash" happens rarely, i.e. most unit files containing an {{ic|@}} sign are meant to be templates. Also, if a template unit is called without an instance identifier, it will just fail, since the {{ic|%i}} specifier cannot be substituted.<br />
}}<br />
<br />
{{Tip|<br />
* Most of the following commands also work if multiple units are specified, see {{ic|man systemctl}} for more information.<br />
* The {{ic|--now}} switch can be used in conjunction with {{ic|enable}}, {{ic|disable}}, and {{ic|mask}} to respectively start, stop, or mask immediately the unit rather than after the next boot.<br />
* A package may offer units for different purposes. If you just installed a package, {{ic|pacman -Qql ''package'' <nowiki>|</nowiki> grep -Fe .service -e .socket}} can be used to check and find them.}}<br />
<br />
'''Start''' a unit immediately:<br />
<br />
# systemctl start ''unit''<br />
<br />
'''Stop''' a unit immediately:<br />
<br />
# systemctl stop ''unit''<br />
<br />
'''Restart''' a unit:<br />
<br />
# systemctl restart ''unit''<br />
<br />
Ask a unit to '''reload''' its configuration:<br />
<br />
# systemctl reload ''unit''<br />
<br />
Show the '''status''' of a unit, including whether it is running or not:<br />
<br />
$ systemctl status ''unit''<br />
<br />
'''Check''' whether a unit is already enabled or not:<br />
<br />
$ systemctl is-enabled ''unit''<br />
<br />
'''Enable''' a unit to be started on '''bootup''':<br />
<br />
# systemctl enable ''unit''<br />
<br />
'''Disable''' a unit to not start during bootup:<br />
<br />
# systemctl disable ''unit''<br />
<br />
'''Mask''' a unit to make it impossible to start it:<br />
<br />
# systemctl mask ''unit''<br />
<br />
'''Unmask''' a unit:<br />
<br />
# systemctl unmask ''unit''<br />
<br />
Show the '''manual page''' associated with a unit (this has to be supported by the unit file):<br />
<br />
$ systemctl help ''unit''<br />
<br />
Reload ''systemd'', scanning for '''new or changed units''':<br />
<br />
# systemctl daemon-reload<br />
<br />
=== Power management ===<br />
<br />
[[polkit]] is necessary for power management as an unprivileged user. If you are in a local ''systemd-logind'' user session and no other session is active, the following commands will work without root privileges. If not (for example, because another user is logged into a tty), ''systemd'' will automatically ask you for the root password.<br />
<br />
Shut down and reboot the system:<br />
<br />
$ systemctl reboot<br />
<br />
Shut down and power-off the system:<br />
<br />
$ systemctl poweroff<br />
<br />
Suspend the system:<br />
<br />
$ systemctl suspend<br />
<br />
Put the system into hibernation:<br />
<br />
$ systemctl hibernate<br />
<br />
Put the system into hybrid-sleep state (or suspend-to-both):<br />
<br />
$ systemctl hybrid-sleep<br />
<br />
== Writing unit files ==<br />
<br />
The syntax of ''systemd'''s [http://www.freedesktop.org/software/systemd/man/systemd.unit.html unit files] is inspired by XDG Desktop Entry Specification ''.desktop'' files, which are in turn inspired by Microsoft Windows ''.ini'' files. Unit files are loaded from two locations. From lowest to highest precedence they are:<br />
<br />
* {{ic|/usr/lib/systemd/system/}}: units provided by installed packages<br />
* {{ic|/etc/systemd/system/}}: units installed by the system administrator<br />
<br />
{{Note|<br />
* The load paths are completely different when running ''systemd'' in [[systemd/User#How it works|user mode]].<br />
* systemd unit names may only contain ASCII alphanumeric characters, underscores and periods. All other characters must be replaced by C-style "\x2d" escapes. See {{ic|man systemd.unit}} and {{ic|man systemd-escape}} for more information.}}<br />
<br />
Look at the units installed by your packages for examples, as well as the [http://www.freedesktop.org/software/systemd/man/systemd.service.html#Examples annotated example section] of {{ic|man systemd.service}}.<br />
<br />
{{Tip|Comments prepended with {{ic|#}} may be used in unit-files as well, but only in new lines. Do not use end-line comments after ''systemd'' parameters or the unit will fail to activate.}}<br />
<br />
=== Handling dependencies ===<br />
<br />
With ''systemd'', dependencies can be resolved by designing the unit files correctly. The most typical case is that the unit ''A'' requires the unit ''B'' to be running before ''A'' is started. In that case add {{ic|1=Requires=''B''}} and {{ic|1=After=''B''}} to the {{ic|[Unit]}} section of ''A''. If the dependency is optional, add {{ic|1=Wants=''B''}} and {{ic|1=After=''B''}} instead. Note that {{ic|1=Wants=}} and {{ic|1=Requires=}} do not imply {{ic|1=After=}}, meaning that if {{ic|1=After=}} is not specified, the two units will be started in parallel.<br />
<br />
Dependencies are typically placed on services and not on targets. For example, {{ic|network.target}} is pulled in by whatever service configures your network interfaces, therefore ordering your custom unit after it is sufficient since {{ic|network.target}} is started anyway.<br />
<br />
=== Service types ===<br />
<br />
There are several different start-up types to consider when writing a custom service file. This is set with the {{ic|1=Type=}} parameter in the {{ic|[Service]}} section:<br />
<br />
* {{ic|1=Type=simple}} (default): ''systemd'' considers the service to be started up immediately. The process must not fork. Do not use this type if other services need to be ordered on this service, unless it is socket activated.<br />
* {{ic|1=Type=forking}}: ''systemd'' considers the service started up once the process forks and the parent has exited. For classic daemons use this type unless you know that it is not necessary. You should specify {{ic|1=PIDFile=}} as well so ''systemd'' can keep track of the main process.<br />
* {{ic|1=Type=oneshot}}: this is useful for scripts that do a single job and then exit. You may want to set {{ic|1=RemainAfterExit=yes}} as well so that ''systemd'' still considers the service as active after the process has exited.<br />
* {{ic|1=Type=notify}}: identical to {{ic|1=Type=simple}}, but with the stipulation that the daemon will send a signal to ''systemd'' when it is ready. The reference implementation for this notification is provided by ''libsystemd-daemon.so''.<br />
* {{ic|1=Type=dbus}}: the service is considered ready when the specified {{ic|BusName}} appears on DBus's system bus.<br />
* {{ic|1=Type=idle}}: ''systemd'' will delay execution of the service binary until all jobs are dispatched. Other than that behavior is very similar to {{ic|1=Type=simple}}. <br />
<br />
See the [http://www.freedesktop.org/software/systemd/man/systemd.service.html#Type= systemd.service(5)] man page for a more detailed explanation of the {{ic|Type}} values.<br />
<br />
=== Editing provided units ===<br />
<br />
To avoid conflicts with pacman, unit files provided by packages should not be directly edited. There are two safe ways to modify a unit without touching the original file: create a new unit file which overwrites the original unit or create drop-in snippets which are applied on top of the original unit. For both methods, you must reload the unit afterwards to apply your changes. This can be done either by editing the unit with {{ic|systemctl edit}} (which reloads the unit automatically) or by reloading all units with:<br />
<br />
# systemctl daemon-reload<br />
<br />
{{Tip|<br />
* You can use ''systemd-delta'' to see which unit files have been overridden or extended and what exactly has been changed.<br />
* Use {{ic|systemctl cat ''unit''}} to view the content of a unit file and all associated drop-in snippets.<br />
* Syntax highlighting for ''systemd'' unit files within [[Vim]] can be enabled by installing {{Pkg|vim-systemd}}.<br />
}}<br />
<br />
==== Replacement unit files ====<br />
<br />
To replace the unit file {{ic|/usr/lib/systemd/system/''unit''}}, create the file {{ic|/etc/systemd/system/''unit''}} and reenable the unit to update the symlinks:<br />
<br />
# systemctl reenable ''unit''<br />
<br />
Alternatively, run:<br />
<br />
# systemctl edit --full ''unit''<br />
<br />
This opens {{ic|/etc/systemd/system/''unit''}} in your editor (copying the installed version if it does not exist yet) and automatically reloads it when you finish editing.<br />
<br />
{{Note|Pacman does not update the replacement unit files when the originals are updated, so this method can make system maintenance more difficult. For this reason the next approach is recommended.}}<br />
<br />
==== Drop-in files ====<br />
<br />
To create drop-in files for the unit file {{ic|/usr/lib/systemd/system/''unit''}}, create the directory {{ic|/etc/systemd/system/''unit''.d/}} and place ''.conf'' files there to override or add new options. ''systemd'' will parse these ''.conf'' files and apply them on top of the original unit.<br />
<br />
The easiest way to do this is to run:<br />
<br />
# systemctl edit ''unit''<br />
<br />
This opens the file {{ic|/etc/systemd/system/''unit''.d/override.conf}} in your text editor (creating it if necessary) and automatically reloads the unit when you are done editing.<br />
<br />
==== Examples ====<br />
<br />
For example, if you simply want to add an additional dependency to a unit, you may create the following file:<br />
<br />
{{hc|/etc/systemd/system/''unit''.d/customdependency.conf|2=<br />
[Unit]<br />
Requires=''new dependency''<br />
After=''new dependency''<br />
}}<br />
<br />
As another example, in order to replace the {{ic|ExecStart}} directive for a unit that is not of type {{ic|oneshot}}, create the following file:<br />
<br />
{{hc|/etc/systemd/system/''unit''.d/customexec.conf|2=<br />
[Service]<br />
ExecStart=<br />
ExecStart=''new command''<br />
}}<br />
<br />
Note how {{ic|ExecStart}} must be cleared before being re-assigned ([https://bugzilla.redhat.com/show_bug.cgi?id=756787#c9]).<br />
<br />
One more example to automatically restart a service:<br />
<br />
{{hc|/etc/systemd/system/''unit''.d/restart.conf|2=<br />
[Service]<br />
Restart=always<br />
RestartSec=30<br />
}}<br />
<br />
An example to override a timer to weekly (from daily):<br />
<br />
{{hc|/etc/systemd/system/''unit''.d/override.conf|2=<br />
[Timer]<br />
OnCalendar=<br />
OnCalendar=weekly<br />
}}<br />
<br />
Note that {{ic|OnCalendar}} must be cleared before reassigning otherwise the previous setting (for example {{ic|daily}}) will still be in effect.<br />
<br />
== Targets ==<br />
<br />
{{Style|Unclear description, copy-pasted content (explicitly mentions "Fedora").|section=Make section "Targets" more clearly}}<br />
<br />
''systemd'' uses ''targets'' which serve a similar purpose as runlevels but act a little different. Each ''target'' is named instead of numbered and is intended to serve a specific purpose with the possibility of having multiple ones active at the same time. Some ''target''s are implemented by inheriting all of the services of another ''target'' and adding additional services to it. There are ''systemd'' ''target''s that mimic the common SystemVinit runlevels so you can still switch ''target''s using the familiar {{ic|telinit RUNLEVEL}} command.<br />
<br />
=== Get current targets ===<br />
<br />
The following should be used under ''systemd'' instead of running {{ic|runlevel}}:<br />
<br />
$ systemctl list-units --type=target<br />
<br />
=== Create custom target ===<br />
<br />
The runlevels that held a defined meaning under sysvinit (i.e., 0, 1, 3, 5, and 6); have a 1:1 mapping with a specific ''systemd'' ''target''. Unfortunately, there is no good way to do the same for the user-defined runlevels like 2 and 4. If you make use of those it is suggested that you make a new named ''systemd'' ''target'' as {{ic|/etc/systemd/system/''your target''}} that takes one of the existing runlevels as a base (you can look at {{ic|/usr/lib/systemd/system/graphical.target}} as an example), make a directory {{ic|/etc/systemd/system/''your target''.wants}}, and then symlink the additional services from {{ic|/usr/lib/systemd/system/}} that you wish to enable.<br />
<br />
=== Targets table ===<br />
<br />
{| class="wikitable"<br />
! SysV Runlevel !! systemd Target !! Notes<br />
|-<br />
| 0 || runlevel0.target, poweroff.target || Halt the system.<br />
|-<br />
| 1, s, single || runlevel1.target, rescue.target || Single user mode.<br />
|-<br />
| 2, 4 || runlevel2.target, runlevel4.target, multi-user.target || User-defined/Site-specific runlevels. By default, identical to 3.<br />
|-<br />
| 3 || runlevel3.target, multi-user.target || Multi-user, non-graphical. Users can usually login via multiple consoles or via the network.<br />
|-<br />
| 5 || runlevel5.target, graphical.target || Multi-user, graphical. Usually has all the services of runlevel 3 plus a graphical login.<br />
|-<br />
| 6 || runlevel6.target, reboot.target || Reboot<br />
|-<br />
| emergency || emergency.target || Emergency shell<br />
|-<br />
|}<br />
<br />
=== Change current target ===<br />
<br />
In ''systemd'' targets are exposed via ''target units''. You can change them like this:<br />
<br />
# systemctl isolate graphical.target<br />
<br />
This will only change the current target, and has no effect on the next boot. This is equivalent to commands such as {{ic|telinit 3}} or {{ic|telinit 5}} in Sysvinit.<br />
<br />
=== Change default target to boot into ===<br />
<br />
The standard target is {{ic|default.target}}, which is aliased by default to {{ic|graphical.target}} (which roughly corresponds to the old runlevel 5). To change the default target at boot-time, append one of the following [[kernel parameters]] to your bootloader:<br />
<br />
* {{ic|1=systemd.unit=multi-user.target}} (which roughly corresponds to the old runlevel 3),<br />
* {{ic|1=systemd.unit=rescue.target}} (which roughly corresponds to the old runlevel 1).<br />
<br />
Alternatively, you may leave the bootloader alone and change {{ic|default.target}}. This can be done using ''systemctl'':<br />
<br />
# systemctl set-default multi-user.target<br />
<br />
To be able to override the previously set {{ic|default.target}}, use the force option:<br />
<br />
# systemctl set-default -f multi-user.target<br />
<br />
The effect of this command is output by ''systemctl''; a symlink to the new default target is made at {{ic|/etc/systemd/system/default.target}}.<br />
<br />
== Temporary files ==<br />
<br />
"''systemd-tmpfiles'' creates, deletes and cleans up volatile and temporary files and directories." It reads configuration files in {{ic|/etc/tmpfiles.d/}} and {{ic|/usr/lib/tmpfiles.d/}} to discover which actions to perform. Configuration files in the former directory take precedence over those in the latter directory.<br />
<br />
Configuration files are usually provided together with service files, and they are named in the style of {{ic|/usr/lib/tmpfiles.d/''program''.conf}}. For example, the [[Samba]] daemon expects the directory {{ic|/run/samba}} to exist and to have the correct permissions. Therefore, the {{Pkg|samba}} package ships with this configuration:<br />
<br />
{{hc|/usr/lib/tmpfiles.d/samba.conf|<br />
D /run/samba 0755 root root}}<br />
<br />
Configuration files may also be used to write values into certain files on boot. For example, if you used {{ic|/etc/rc.local}} to disable wakeup from USB devices with {{ic|echo USBE > /proc/acpi/wakeup}}, you may use the following tmpfile instead:<br />
<br />
{{hc|/etc/tmpfiles.d/disable-usb-wake.conf|<br />
w /proc/acpi/wakeup - - - - USBE}}<br />
<br />
See the {{ic|systemd-tmpfiles(8)}} and {{ic|tmpfiles.d(5)}} man pages for details.<br />
<br />
{{Note|This method may not work to set options in {{ic|/sys}} since the ''systemd-tmpfiles-setup'' service may run before the appropriate device modules is loaded. In this case you could check whether the module has a parameter for the option you want to set with {{ic|modinfo ''module''}} and set this option with a [[Kernel modules#Setting module options|config file in /etc/modprobe.d]]. Otherwise you will have to write a [[Udev#About_udev_rules|udev rule]] to set the appropriate attribute as soon as the device appears.}}<br />
<br />
== Timers ==<br />
<br />
A timer is a unit configuration file whose name ends with ''.timer'' and encodes information about a timer controlled and supervised by ''systemd'', for timer-based activation. See [[systemd/Timers]].<br />
<br />
{{Note|Timers can replace ''cron'' functionality to a great extent. See [[systemd/Timers#As a cron replacement]].}}<br />
<br />
== Mounting ==<br />
<br />
Since systemd is a replacement for System V init, it is in charge of the mounts specified in {{ic|/etc/fstab}}. In fact, it goes beyond the usual {{ic|fstab}} capabilities, implementing special mount options prefixed with {{ic|x-systemd.}}. See [[Fstab#Automount with systemd]] for an example of ''automounting'' (mounting on-demand) using these extensions. See [https://www.freedesktop.org/software/systemd/man/systemd.mount.html#fstab] for the complete documentation of these extensions.<br />
<br />
== Journal ==<br />
<br />
''systemd'' has its own logging system called the journal; therefore, running a {{ic|syslog}} daemon is no longer required. To read the log, use:<br />
<br />
# journalctl<br />
<br />
In Arch Linux, the directory {{ic|/var/log/journal/}} is a part of the {{Pkg|systemd}} package, and the journal (when {{ic|1=Storage=}} is set to {{ic|auto}} in {{ic|/etc/systemd/journald.conf}}) will write to {{ic|/var/log/journal/}}. If you or some program delete that directory, ''systemd'' will '''not''' recreate it automatically and instead will write its logs to {{ic|/run/systemd/journal}} in a nonpersistent way. However, the folder will be recreated when you set {{ic|1=Storage=persistent}} and run {{ic|systemctl restart systemd-journald}} (or reboot).<br />
<br />
The systemd journal event notification message logging classification corresponds to classical BSD syslog protocol style ([[wikipedia:Syslog|Wikipedia]], [https://tools.ietf.org/html/rfc5424 RFC 5424]). For more info see subsections [[#Facility|Facility]], [[#Priority level|Priority level]], and for examples on how to use it in [[#Filtering output|Filtering output]].<br />
<br />
===Facility===<br />
<br />
A syslog facility code is used to specify the type of program that is logging the message [https://tools.ietf.org/html/rfc5424#section-6.2.1 RFC 5424 Section 6.2.1].<br />
<br />
{| class="wikitable"<br />
! Facility code !! Keyword !! Description !! Info<br />
|-<br />
| 0 || kern || kernel messages<br />
|-<br />
| 1 || user || user-level messages<br />
|-<br />
| 2 || mail || mail system || Archaic POSIX still supported and sometimes used system, for more {{ic|man mail}})<br />
|-<br />
| 3 || daemon || system daemons || All deamons, including systemd and its subsystems<br />
|-<br />
| 4 || auth || security/authorization messages || Also watch for different facility 10<br />
|-<br />
| 5 || syslog || messages generated internally by syslogd || As it standartized for syslogd, not used by systemd (see facility 3)<br />
|-<br />
| 6 || lpr || line printer subsystem (archaic subsystem)<br />
|-<br />
| 7 || news || network news subsystem (archaic subsystem)<br />
|-<br />
| 8 || uucp || UUCP subsystem (archaic subsystem)<br />
|-<br />
| 9 || || clock daemon || systemd-timesyncd<br />
|-<br />
| 10 || authpriv || security/authorization messages || Also watch for different facility 4<br />
|-<br />
| 11 || ftp || FTP daemon<br />
|-<br />
| 12 || - || NTP subsystem<br />
|-<br />
| 13 || - || log audit<br />
|-<br />
| 14 || - || log alert<br />
|-<br />
| 15 || cron || scheduling daemon<br />
|-<br />
| 16 || local0 || local use 0 (local0)<br />
|-<br />
| 17 || local1 || local use 1 (local1)<br />
|-<br />
| 18 || local2 || local use 2 (local2)<br />
|-<br />
| 19 || local3 || local use 3 (local3)<br />
|-<br />
| 20 || local4 || local use 4 (local4)<br />
|-<br />
| 21 || local5 || local use 5 (local5)<br />
|-<br />
| 22 || local6 || local use 6 (local6)<br />
|-<br />
| 23 || local7 || local use 7 (local7)<br />
|}<br />
<br />
So, useful facilities to watch: 0,1,3,4,9,10,15.<br />
<br />
===Priority level===<br />
<br />
A syslog severity code (in systemd called priority) is used to mark the importance of a message [https://tools.ietf.org/html/rfc5424#section-6.2.1 RFC 5424 Section 6.2.1].<br />
<br />
{| class="wikitable"<br />
|-<br />
! Value !! Severity !! Keyword !! Description || Examples<br />
|-<br />
| 0 || Emergency || emerg || System is unusable || Severe Kernel BUG, systemd dumped core.<br>This level should not be used by applications.<br />
|-<br />
| 1 || Alert || alert || Should be corrected immediately || Vital subsystem goes out of work. Data loss. <br>{{ic|kernel: BUG: unable to handle kernel paging request at ffffc90403238ffc|}}.<br />
|-<br />
| 2 || Critical || crit || Critical conditions || Crashes, coredumps. Like familiar flash:<br>{{ic|systemd-coredump[25319]: Process 25310 (plugin-containe) of user 1000 dumped core}}<br>Failure in the system primary application, like X11. <br />
|-<br />
| 3 || Error || err || Error conditions || Not severe error reported:<br>{{ic|kernel: usb 1-3: 3:1: cannot get freq at ep 0x84}},<br>{{ic|systemd[1]: Failed unmounting /var.}},<br>{{ic|libvirtd[1720]: internal error: Failed to initialize a valid firewall backend}}).<br />
|-<br />
| 4 || Warning || warning || May indicate that an error will occur if action is not taken. || A non-root file system has only 1GB free.<br>{{ic|org.freedesktop. Notifications[1860]: (process:5999): Gtk-WARNING **: Locale not supported by C library. Using the fallback 'C' locale}}.<br />
|-<br />
| 5 || Notice || notice || Events that are unusual, but not error conditions. || {{ic|systemd[1]: var.mount: Directory /var to mount over is not empty, mounting anyway}}. {{ic|gcr-prompter[4997]: Gtk: GtkDialog mapped without a transient parent. This is discouraged}}.<br />
|-<br />
| 6 || Informational || info || Normal operational messages that require no action. || {{ic|lvm[585]: 7 logical volume(s) in volume group "archvg" now active}}.<br />
|-<br />
| 7 || Debug || debug || Information useful to developers for debugging the application. || {{ic|kdeinit5[1900]: powerdevil: Scheduling inhibition from ":1.14" "firefox" with cookie 13 and reason "screen"}}.<br />
|}<br />
<br />
If issue you are looking for, was not found on according level, search it on couple of priority levels above and below. This rules are recommendations. Some errors considered a normal occasion for program so they marked low in priority by developer, and on the contrary, sometimes too many messages plaques too high priorities for them, but often it's an arguable situation. And often you really should solve an issue, also to understand architecture and adopt best practices.<br />
<br />
Examples:<br />
* Info message: {{bc|pulseaudio[2047]: W: [pulseaudio] alsa-mixer.c: Volume element Master has 8 channels. That's too much! I can't handle that!}} It is an warning or error by definition.<br />
* Plaguing alert message: {{bc|1=sudo[21711]: user : a password is required ; TTY=pts/0 ; PWD=/home/user ; USER=root ; COMMAND=list /usr/bin/pacman --color auto -Sy}} The [https://bbs.archlinux.org/viewtopic.php?id=184455 reason] - user was manually added to sudoers file, not to wheel group, which is arguably normal action, but sudo produced an alert on every occasion.<br />
<br />
=== Filtering output ===<br />
<br />
''journalctl'' allows you to filter the output by specific fields. Be aware that if there are many messages to display or filtering of large time span has to be done, the output of this command can be delayed for quite some time.<br />
<br />
{{Tip|While the journal is stored in a binary format, the content of stored messages is not modified. This means it is viewable with ''strings'', for example for recovery in an environment which does not have ''systemd'' installed. Example command:<br />
{{bc|$ strings /mnt/arch/var/log/journal/af4967d77fba44c6b093d0e9862f6ddd/system.journal <nowiki>| grep -i</nowiki> ''message''}}<br />
}}<br />
<br />
Examples:<br />
<br />
* Show all messages from this boot: {{bc|# journalctl -b}} However, often one is interested in messages not from the current, but from the previous boot (e.g. if an unrecoverable system crash happened). This is possible through optional offset parameter of the {{ic|-b}} flag: {{ic|journalctl -b -0}} shows messages from the current boot, {{ic|journalctl -b -1}} from the previous boot, {{ic|journalctl -b -2}} from the second previous and so on. See {{ic|man 1 journalctl}} for full description, the semantics is much more powerful.<br />
* Show all messages from date (and optional time): {{bc|1=# journalctl --since="2012-10-30 18:17:16"}}<br />
* Show all messages since 20 minutes ago: {{bc|1=# journalctl --since "20 min ago"}}<br />
* Follow new messages: {{bc|# journalctl -f}}<br />
* Show all messages by a specific executable: {{bc|# journalctl /usr/lib/systemd/systemd}}<br />
* Show all messages by a specific process: {{bc|1=# journalctl _PID=1}}<br />
* Show all messages by a specific unit: {{bc|# journalctl -u netcfg}}<br />
* Show kernel ring buffer: {{bc|1=# journalctl -k}}<br />
* Show auth.log equivalent by filtering on syslog facility: {{bc|1=# journalctl SYSLOG_FACILITY=10}}<br />
* Show only error, critical, and alert priority messages {{bc|# journalctl -p err..alert}} Numbers also can be used, {{ic|journalctl -p 3..1}}. If single number/keyword used, {{ic|journalctl -p 3}} - all higher priority levels also included.<br />
<br />
See {{ic|man 1 journalctl}}, {{ic|man 7 systemd.journal-fields}}, or Lennart's [http://0pointer.de/blog/projects/journalctl.html blog post] for details.<br />
<br />
{{Tip|1=<br />
By default, ''journalctl'' truncates lines longer than screen width, but in some cases, it may be better to enable wrapping instead of truncating. This can be controlled by the {{ic|SYSTEMD_LESS}} [[environment variable]], which contains options passed to [[Core utilities#less|less]] (the default pager) and defaults to {{ic|FRSXMK}} (see {{ic|man 1 less}} and {{ic|man 1 journalctl}} for details).<br />
<br />
By omitting the {{ic|S}} option, the output will be wrapped instead of truncated. For example, start ''journalctl'' as follows:<br />
<br />
$ SYSTEMD_LESS=FRXMK journalctl<br />
<br />
If you would like to set this behaviour as default, [[Environment variables#Per_user|export]] the variable from {{ic|~/.bashrc}} or {{ic|~/.zshrc}}.<br />
}}<br />
<br />
=== Journal size limit ===<br />
<br />
If the journal is persistent (non-volatile), its size limit is set to a default value of 10% of the size of the underlying file system but capped to 4 GiB. For example, with {{ic|/var/log/journal/}} located on a 20 GiB partition, journal data may take up to 2 GiB. On a 50 GiB partition, it would max at 4 GiB.<br />
<br />
The maximum size of the persistent journal can be controlled by uncommenting and changing the following:<br />
<br />
{{hc|/etc/systemd/journald.conf|2=<br />
SystemMaxUse=50M<br />
}}<br />
<br />
It is also possible to use the drop-in snippets configuration override mechanism rather than editing the global configuration file. In this case do not forget to place the overrides under the {{ic|[Journal]}} header:<br />
<br />
{{hc|/etc/systemd/journald.conf.d/00-journal-size.conf|2=<br />
[Journal]<br />
SystemMaxUse=50M<br />
}}<br />
<br />
See {{ic|man journald.conf}} for more info.<br />
<br />
=== Clean journal files manually ===<br />
<br />
Journal files can be globally removed from {{ic|/var/log/journal/}} using ''e.g.'' {{ic|rm}}, or can be trimmed according to various criteria using {{ic|journalctl}}. Examples:<br />
<br />
* Remove archived journal files until the disk space they use falls below 100M: {{bc|1=# journalctl --vacuum-size=100M}}<br />
* Make all journal files contain no data older than 2 weeks. {{bc|1=# journalctl --vacuum-time=2weeks}}<br />
<br />
See {{ic|man journalctl}} for more info.<br />
<br />
=== Journald in conjunction with syslog ===<br />
<br />
Compatibility with a classic, non-journald aware [[Syslog-ng|syslog]] implementation can be provided by letting ''systemd'' forward all messages via the socket {{ic|/run/systemd/journal/syslog}}. To make the syslog daemon work with the journal, it has to bind to this socket instead of {{ic|/dev/log}} ([http://lwn.net/Articles/474968/ official announcement]). <br />
<br />
The default {{ic|journald.conf}} for forwarding to the socket is {{ic|1=ForwardToSyslog=no}} to avoid system overhead, because [[rsyslog]] or [[syslog-ng]] pull the messages from the journal by [http://lists.freedesktop.org/archives/systemd-devel/2014-August/022295.html#journald itself]. <br />
<br />
See [[Syslog-ng#Overview]] and [[Syslog-ng#syslog-ng and systemd journal]], or [[rsyslog]] respectively, for details on configuration.<br />
<br />
=== Forward journald to /dev/tty12 ===<br />
<br />
Create a [[#Editing provided units|drop-in directory]] {{ic|/etc/systemd/journald.conf.d}} and create a {{ic|fw-tty12.conf}} file in it:<br />
<br />
{{hc|1=/etc/systemd/journald.conf.d/fw-tty12.conf|2=<br />
[Journal]<br />
ForwardToConsole=yes<br />
TTYPath=/dev/tty12<br />
MaxLevelConsole=info<br />
}}<br />
<br />
Then [[restart]] systemd-journald.<br />
<br />
=== Specify a different journal to view ===<br />
There may be a need to check the logs of another system that is dead in the water, like booting from a live system to recover a production system. In such case, one can mount the disk in e.g. {{ic|/mnt}}, and specify the journal path via {{ic|-D}}/{{ic|--directory}}, like so:<br />
<br />
$ journalctl -D ''/mnt''/var/log/journal -xe<br />
<br />
== Tips and tricks ==<br />
<br />
=== Enable installed units by default ===<br />
<br />
{{Expansion|How does it work with instantiated units?}}<br />
<br />
Arch Linux ships with {{ic|/usr/lib/systemd/system-preset/99-default.preset}} containing {{ic|disable *}}. This causes ''systemctl preset'' to disable all units by default, such that when a new package is installed, the user must manually enable the unit.<br />
<br />
If this behavior is not desired, simply create a symlink from {{ic|/etc/systemd/system-preset/99-default.preset}} to {{ic|/dev/null}} in order to override the configuration file. This will cause ''systemctl preset'' to enable all units that get installed—regardless of unit type—unless specified in another file in one ''systemctl preset'''s configuration directories. User units are not affected. See the manpage for {{ic|systemd.preset}} for more information.<br />
<br />
{{Note|Enabling all units by default may cause problems with packages that contain two or more mutually exclusive units. ''systemctl preset'' is designed to be used by distributions and spins or system administrators. In the case where two conflicting units would be enabled, you should explicitly specify which one is to be disabled in a preset configuration file as specified in the manpage for {{ic|systemd.preset}}.}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Investigating systemd errors ===<br />
<br />
As an example, we will investigate an error with {{ic|systemd-modules-load}} service:<br />
<br />
'''1.''' Lets find the ''systemd'' services which fail to start:<br />
<br />
{{hc|1=$ systemctl --failed|2=<br />
systemd-modules-load.service loaded '''failed failed''' Load Kernel Modules<br />
}}<br />
<br />
'''2.''' Ok, we found a problem with {{ic|systemd-modules-load}} service. We want to know more:<br />
{{hc|$ systemctl status systemd-modules-load|2=<br />
systemd-modules-load.service - Load Kernel Modules<br />
Loaded: loaded (/usr/lib/systemd/system/systemd-modules-load.service; static)<br />
Active: '''failed''' (Result: exit-code) since So 2013-08-25 11:48:13 CEST; 32s ago<br />
Docs: man:systemd-modules-load.service(8).<br />
man:modules-load.d(5)<br />
Process: '''15630''' ExecStart=/usr/lib/systemd/systemd-modules-load ('''code=exited, status=1/FAILURE''')<br />
}}<br />
If the {{ic|Process ID}} is not listed, just restart the failed service with {{ic|systemctl restart systemd-modules-load}}<br />
<br />
'''3.''' Now we have the process id (PID) to investigate this error in depth. Enter the following command with the current {{ic|Process ID}} (here: 15630):<br />
{{hc|1=$ journalctl _PID=15630|2=<br />
-- Logs begin at Sa 2013-05-25 10:31:12 CEST, end at So 2013-08-25 11:51:17 CEST. --<br />
Aug 25 11:48:13 mypc systemd-modules-load[15630]: '''Failed to find module 'blacklist usblp''''<br />
Aug 25 11:48:13 mypc systemd-modules-load[15630]: '''Failed to find module 'install usblp /bin/false'''' <br />
}}<br />
<br />
'''4.''' We see that some of the kernel module configs have wrong settings. Therefore we have a look at these settings in {{ic|/etc/modules-load.d/}}:<br />
{{hc|$ ls -Al /etc/modules-load.d/|<br />
...<br />
-rw-r--r-- 1 root root 79 1. Dez 2012 blacklist.conf<br />
-rw-r--r-- 1 root root 1 2. Mär 14:30 encrypt.conf<br />
-rw-r--r-- 1 root root 3 5. Dez 2012 printing.conf<br />
-rw-r--r-- 1 root root 6 14. Jul 11:01 realtek.conf<br />
-rw-r--r-- 1 root root 65 2. Jun 23:01 virtualbox.conf<br />
...<br />
}}<br />
<br />
'''5.''' The {{ic|Failed to find module 'blacklist usblp'}} error message might be related to a wrong setting inside of {{ic|blacklist.conf}}. Lets deactivate it with inserting a trailing '''#''' before each option we found via step 3:<br />
{{hc|/etc/modules-load.d/blacklist.conf|<br />
'''#''' blacklist usblp<br />
'''#''' install usblp /bin/false<br />
}}<br />
<br />
'''6.''' Now, try to start {{ic|systemd-modules-load}}:<br />
$ systemctl start systemd-modules-load<br />
If it was successful, this should not prompt anything. If you see any error, go back to step 3 and use the new PID for solving the errors left.<br />
<br />
If everything is ok, you can verify that the service was started successfully with:<br />
{{hc|$ systemctl status systemd-modules-load|2=<br />
systemd-modules-load.service - Load Kernel Modules<br />
Loaded: '''loaded''' (/usr/lib/systemd/system/systemd-modules-load.service; static)<br />
Active: '''active (exited)''' since So 2013-08-25 12:22:31 CEST; 34s ago<br />
Docs: man:systemd-modules-load.service(8)<br />
man:modules-load.d(5)<br />
Process: 19005 ExecStart=/usr/lib/systemd/systemd-modules-load (code=exited, status=0/SUCCESS)<br />
Aug 25 12:22:31 mypc systemd[1]: '''Started Load Kernel Modules'''.<br />
}}<br />
<br />
Often you can solve these kind of problems like shown above. For further investigation look at [[#Diagnosing boot problems]].<br />
<br />
=== Diagnosing boot problems ===<br />
<br />
''systemd'' has several options for diagnosing problems with the boot process. See [[boot debugging]] and the [http://freedesktop.org/wiki/Software/systemd/Debugging/ systemd debugging documentation].<br />
<br />
=== Diagnosing problems with a specific service ===<br />
<br />
{{Accuracy|This may not catch all errors such as missing libraries.|User talk:Alucryd#Plex}}<br />
<br />
If some ''systemd'' service misbehaves and you want to get more information about what is going on, set the {{ic|SYSTEMD_LOG_LEVEL}} [[environment variable]] to {{ic|debug}}. For example, to run the ''systemd-networkd'' daemon in debug mode:<br />
<br />
# systemctl stop systemd-networkd<br />
# SYSTEMD_LOG_LEVEL=debug /lib/systemd/systemd-networkd<br />
<br />
Or, equivalently, modify the service file temporarily for gathering enough output. For example: <br />
<br />
{{hc|/usr/lib/systemd/system/systemd-networkd.service|2=<br />
[Service]<br />
...<br />
Environment=SYSTEMD_LOG_LEVEL=debug<br />
....<br />
}}<br />
<br />
If debug information is required long-term, add the variable the [[#Editing provided units|regular]] way.<br />
<br />
=== Shutdown/reboot takes terribly long ===<br />
<br />
If the shutdown process takes a very long time (or seems to freeze) most likely a service not exiting is to blame. ''systemd'' waits some time for each service to exit before trying to kill it. To find out if you are affected, see [http://freedesktop.org/wiki/Software/systemd/Debugging/#shutdowncompleteseventually this article].<br />
<br />
=== Short lived processes do not seem to log any output ===<br />
<br />
If {{ic|journalctl -u foounit}} does not show any output for a short lived service, look at the PID instead. For example, if {{ic|systemd-modules-load.service}} fails, and {{ic|systemctl status systemd-modules-load}} shows that it ran as PID 123, then you might be able to see output in the journal for that PID, i.e. {{ic|journalctl -b _PID&#61;123}}. Metadata fields for the journal such as {{ic|_SYSTEMD_UNIT}} and {{ic|_COMM}} are collected asynchronously and rely on the {{ic|/proc}} directory for the process existing. Fixing this requires fixing the kernel to provide this data via a socket connection, similar to {{ic|SCM_CREDENTIALS}}.<br />
<br />
=== Boot time increasing over time ===<br />
<br />
After using {{ic|systemd-analyze}} a number of users have noticed that their boot time has increased significantly in comparison with what it used to be. After using {{ic|systemd-analyze blame}} [[NetworkManager]] is being reported as taking an unusually large amount of time to start. <br />
<br />
The problem for some users has been due to {{ic|/var/log/journal}} becoming too large. This may have other impacts on performance, such as for {{ic|systemctl status}} or {{ic|journalctl}}. As such the solution is to remove every file within the folder (ideally making a backup of it somewhere, at least temporarily) and then setting a journal file size limit as described in [[#Journal size limit]].<br />
<br />
=== systemd-tmpfiles-setup.service fails to start at boot ===<br />
<br />
Starting with systemd 219, {{ic|/usr/lib/tmpfiles.d/systemd.conf}} specifies ACL attributes for directories under {{ic|/var/log/journal}} and, therefore, requires ACL support to be enabled for the filesystem the journal resides on.<br />
<br />
See [[Access Control Lists#Enabling ACL]] for instructions on how to enable ACL on the filesystem that houses {{ic|/var/log/journal}}.<br />
<br />
=== systemctl enable fails for symlinks in /etc/systemd/system ===<br />
<br />
If {{ic|/etc/systemd/system/''foo''.service}} is a symlink and {{ic|systemctl enable ''foo''.service}} is run, it will fail with this error:<br />
<br />
Failed to issue method call: No such file or directory<br />
<br />
This is a [https://bugzilla.redhat.com/show_bug.cgi?id=955379#c14 design choice] of systemd. As a workaround, enabling by absolute path works:<br />
<br />
# systemctl enable ''/absolute/path/foo''.service<br />
<br />
=== dependent services are not started when starting a service manually===<br />
<br />
{{Remove|Guesswork instead of actual research, and bug reports belong to the bug tracker, not to the wiki.|section=Subsection .22dependent services are not started when starting a service manually.22}}<br />
<br />
One (in)famous example is {{ic|libvirtd.service}} which needs the {{ic|virtlogd.socket}} to function properly. <br />
<br />
The dependencies in {{ic|/usr/lib/systemd/system/libvirtd.service}} are defined as<br />
[Install]<br />
WantedBy=multi-user.target<br />
Also=virtlockd.socket<br />
Also=virtlogd.socket<br />
This only defines the necessary/dependent sockets to be enabled services(i.e. as "autostart"), too - but does not start them whenever the DISABLED (= non-autostarting) service ist started manually e.g. by running {{ic|systemctl start libvirtd}}<br />
<br />
Thus the correct (?) way to manually start a service with dependent subservices once (instead of at each start of the system) probably is <br />
systemctl enable ServiceWithSubservices<br />
systemctl start ServiceWithSubservices<br />
systemctl disable ServiceWithSubservices<br />
<br />
== See also ==<br />
<br />
*[http://www.freedesktop.org/wiki/Software/systemd Official web site]<br />
*[[Wikipedia:systemd|Wikipedia article]]<br />
*[http://0pointer.de/public/systemd-man/ Manual pages]<br />
*[http://freedesktop.org/wiki/Software/systemd/Optimizations systemd optimizations]<br />
*[http://www.freedesktop.org/wiki/Software/systemd/FrequentlyAskedQuestions FAQ]<br />
*[http://www.freedesktop.org/wiki/Software/systemd/TipsAndTricks Tips and tricks]<br />
*[http://0pointer.de/public/systemd-ebook-psankar.pdf systemd for Administrators (PDF)]<br />
*[http://fedoraproject.org/wiki/Systemd About systemd on Fedora Project]<br />
*[http://fedoraproject.org/wiki/How_to_debug_Systemd_problems How to debug systemd problems]<br />
*[http://www.h-online.com/open/features/Control-Centre-The-systemd-Linux-init-system-1565543.html Two] [http://www.h-online.com/open/features/Booting-up-Tools-and-tips-for-systemd-1570630.html part] introductory article in ''The H Open'' magazine.<br />
*[http://0pointer.de/blog/projects/systemd.html Lennart's blog story]<br />
*[http://0pointer.de/blog/projects/systemd-update.html Status update]<br />
*[http://0pointer.de/blog/projects/systemd-update-2.html Status update2]<br />
*[http://0pointer.de/blog/projects/systemd-update-3.html Status update3]<br />
*[http://0pointer.de/blog/projects/why.html Most recent summary]<br />
*[http://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet Fedora's SysVinit to systemd cheatsheet]<br />
*[http://wiki.gentoo.org/wiki/Systemd Gentoo Wiki systemd page]<br />
*[[Emacs#Syntax highlighting for systemd Files|Emacs Syntax highlighting for Systemd files]]</div>Lesmanahttps://wiki.archlinux.org/index.php?title=Wine&diff=433965Wine2016-05-05T15:04:33Z<p>Lesmana: split prevent from unregister section</p>
<hr />
<div>[[Category:Wine]]<br />
[[cs:Wine]]<br />
[[de:Wine]]<br />
[[es:Wine]]<br />
[[fr:Wine]]<br />
[[it:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
[[zh-CN:Wine]]<br />
[[zh-TW:Wine]]<br />
{{Related articles start}}<br />
{{Related|Steam/Wine}}<br />
{{Related|CrossOver}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
[[Wikipedia:Wine (software)|Wine]] is a ''compatibility layer'' capable of running Microsoft Windows applications on Unix-like operating systems. Programs running in Wine act as native programs would, without the performance/memory penalties of an emulator. See the [http://www.winehq.org/ official project home] and [https://wiki.winehq.org/ wiki] pages for longer introduction.<br />
<br />
== Installation ==<br />
{{Warning|If you can access a file or resource with your user account, programs running in Wine can too. Wine prefixes are '''not''' [[wikipedia:Sandbox (computer security)|sandboxes]]. Consider using [[wikipedia:Virtualization|virtualization]] if security is important.}}<br />
<br />
Wine can be [[pacman|installed]] with the package {{Pkg|wine}}, available in the [[official repositories]]. If you are running a 64-bit system, you will need to enable the [[Multilib]] repository first. See also [[#Sound]].<br />
<br />
You may also want to install {{pkg|wine_gecko}} and {{pkg|wine-mono}} for applications that need support for Internet Explorer and .NET, respectively. These packages are not strictly required as Wine will download the relevant files as needed. However, having the files downloaded in advance allows you to work off-line and makes it so Wine does not download the files for each Wine prefix needing them.<br />
<br />
'''Architectural differences'''<br />
<br />
Wine by default is 32-bit, as is the i686 Arch package. As such, it is unable to execute any 64-bit Windows applications.<br />
<br />
The x86_64 Arch package, however, is built with {{ic|--enable-win64}}. This activates the Wine version of [[Wikipedia:WoW64|WoW64]].<br />
*In Windows, this complicated subsystem allows the user to use 32-bit and 64-bit Windows programs concurrently and even in the same directory.<br />
*In Wine, some 32-bit programs do not work properly in a 64-bit prefix. In that case the user will have to make separate directories/prefixes. See the [https://wiki.winehq.org/FAQ#How_do_I_create_a_32_bit_wineprefix_on_a_64_bit_system.3F Wine FAQ] for specific information on this.<br />
<br />
If you run into problems with {{ic|winetricks}} or programs with a 64-bit environment, try creating a new 32-bit {{ic|WINEPREFIX}}. See below: [[#WINEARCH]]. Using the x86_64 Wine package with {{ic|1=WINEARCH=win32}} should have the same behaviour as using the i686 Wine package.<br />
<br />
== Configuration ==<br />
Configuring Wine is typically accomplished using:<br />
* [https://wiki.winehq.org/Winecfg winecfg] is a GUI configuration tool for Wine. You can run it from a console window with: {{ic|$ wine winecfg}}, or {{ic|1=$ WINEPREFIX=~/.some_prefix wine winecfg}}.<br />
* {{ic|control.exe}} is Wine's implementation of Windows' Control Panel which can be accessed with: {{ic|$ wine control}}.<br />
* [https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit] is Wine's registry editing tool. If ''winecfg'' and the Control Panel are not enough, see WineHQ's article on [https://wiki.winehq.org/Useful_Registry_Keys Useful Registry Keys].<br />
* See WineHQ's [https://wiki.winehq.org/List_of_Commands List of Commands] for the full list.<br />
<br />
=== WINEPREFIX ===<br />
By default, Wine stores its configuration files and installed Windows programs in {{ic|~/.wine}}. This directory is commonly called a "Wine prefix" or "Wine bottle". It is created/updated automatically whenever you run a Windows program or one of Wine's bundled programs such as ''winecfg''. The prefix directory also contains a tree which your Windows programs will see as {{ic|C:}} (the C-drive).<br />
<br />
You can override the location Wine uses for a prefix with the {{ic|WINEPREFIX}} environment variable. This is useful if you want to use separate configurations for different Windows programs. The first time a program is run with a new Wine prefix, Wine will automatically create a directory with a bare C-drive and registry.<br />
<br />
For example, if you run one program with {{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}, and another with {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}, the two programs will each have a separate C-drive and separate registries.<br />
<br />
{{Note|Wine prefixes are not [[Wikipedia:Sandbox (computer security)|sandboxes]]! Programs running under Wine can still access the rest of the system! (for example, {{ic|Z:}} is mapped to {{ic|/}}, regardless of the Wine prefix).}}<br />
<br />
To create a default prefix without running a Windows program or other GUI tool you can use:<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
If you have a 64-bit system, Wine will start an 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 />
{{Note|1=During prefix creation, the 64-bit version of Wine treats all folders as 64-bit prefixes and will not create a 32-bit in any existing folder. To create a 32-bit prefix you have to let Wine create the folder specified in {{ic|WINEPREFIX}}. See WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=29661 29661]}}<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 />
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 />
<br />
=== Graphics drivers ===<br />
<br />
For most games, Wine requires high performance accelerated graphics drivers. This likely means using proprietary [[NVIDIA]] or [[AMD Catalyst]] drivers, although the open source [[ATI]] driver is increasingly become proficient for use with Wine. [[Intel]] drivers should mostly work as well as they are going to out of the box.<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 />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
For 64-bit systems, additional [[multilib]] packages are required. Please install the one that is listed in the ''Multilib Package'' column in the table in [[Xorg#Driver installation]].<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''. Currently, the [[Alsa]] driver is the best supported.<br />
<br />
* If you want to use the [[ALSA]] driver in Wine on a 64-bit system, you will need to install {{Pkg|lib32-alsa-lib}} and {{Pkg|lib32-alsa-plugins}}.<br />
* If you want to use the [[PulseAudio]] driver in Wine, you will need to install the {{Pkg|lib32-libpulse}} package.<br />
* If you want to use the [[OSS]] driver in Wine, you will need to install the {{Pkg|lib32-alsa-oss}} package. The OSS driver in the kernel will not suffice.<br />
<br />
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [https://www.winehq.org/docs/wineusr-guide/using-regedit#Configuring_Sound configure it via the registry]. For example, in a case where the microphone wasn't 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, if you are using a 64-bit Arch, it may help to [[#WINEARCH|recreate the prefix]]. <br />
<br />
Games that use advanced sound systems may require installations of {{Pkg|lib32-openal}}.<br />
<br />
==== MIDI support ====<br />
<br />
[[MIDI]] was a quite popular system for video games music in the 90's. If you are trying out old games, it is not uncommon that the music will not play out of the box.<br />
Wine has excellent MIDI support. However you first need to make it work on your host system, as explained in [[MIDI]]. Last but not least you need to make sure Wine will use the correct MIDI output.<br />
<br />
=== Other libraries ===<br />
<br />
*Some applications (e.g. Office 2003/2007) require the MSXML library to parse HTML or XML, in such cases you need to install {{Pkg|lib32-libxml2}}.<br />
<br />
*Some applications that play music may require {{Pkg|lib32-mpg123}}.<br />
<br />
*Some applications that use a color management engine (e.g. pdf viewers, image viewers, etc) may require {{Pkg|lib32-lcms2}}.<br />
<br />
*Some applications that use native image manipulation libraries may require {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}.<br />
<br />
*Some applications that require encryption support may require {{Pkg|lib32-gnutls}}.<br />
<br />
=== Fonts ===<br />
<br />
If Wine applications are not showing easily readable fonts, you may not have Microsoft's Truetype fonts installed. See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
After running such programs, kill all Wine servers and run {{ic|winecfg}}. Fonts should be legible now.<br />
<br />
If the fonts look somehow smeared, import the following text file into the Wine registry with [https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
See also [[Font configuration#Applications without fontconfig support]].<br />
<br />
=== Desktop launcher menus ===<br />
<br />
When a Windows application installer creates a shortcut Wine creates a {{ic|.desktop}} file instead. The default locations for those files in Arch Linux are:<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 {{ic|.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 />
By default, installation of Wine does not create desktop menus/icons for the software which comes with Wine (e.g. for ''winecfg'', ''winebrowser'', etc). These instructions will add entries for these applications.<br />
<br />
First, install a Windows program using Wine to create the base menu. After the base menu is created, you can create the following files in {{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 />
If these settings produce a ugly/non-existent icon, it means that there are no icons for these launchers in the icon set that you have enabled. You should replace the icon settings with the explicit location of the icon that you want. Clicking the icon in the launcher's properties menu will have the same effect. A great icon set that supports these shortcuts is [http://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors].<br />
<br />
==== Removing menu entries ====<br />
<br />
Menu entries created by Wine are located in {{ic|~/.local/share/applications/wine/Programs/}}. Remove the program's ''.desktop'' entry to remove the application from the menu.<br />
<br />
In addition to remove unwanted extensions binding by Wine, execute the following commands (taken from the Wine website):<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 />
== Using Windows applications ==<br />
<br />
{{Warning|Do not run or install Wine applications as root! See [https://wiki.winehq.org/FAQ#run_as_root Running Wine as root] for the official statement.}}<br />
<br />
See [https://wiki.winehq.org/FAQ#Installing_Windows_Applications Installing Windows Applications] at WineHQ. See [[#Desktop launcher menus]] for information on where the shortcuts were created.<br />
<br />
See [https://wiki.winehq.org/FAQ#Running_applications Running applications] at WineHQ. The {{ic|.desktop}} files created by the installer should automatically appear as entries in any X menu or file manager applications. They can also be examined to determine what command to use to run the application from a terminal.<br />
<br />
See [https://wiki.winehq.org/FAQ#How_do_I_uninstall_Windows_applications.3F How do I uninstall Windows applications?] at WineHQ.<br />
<br />
== Tips and tricks ==<br />
<br />
{{Tip|In addition to the links provided in the beginning of the article the following may be of interest:<br />
* [http://appdb.winehq.org/ The Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [http://forum.winehq.org/ The WineHQ Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<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 />
=== CSMT patch ===<br />
<br />
Since 2013 Wine developers have been experimenting with [http://www.winehq.org/pipermail/wine-devel/2013-September/101106.html stream/worker thread optimizations]. 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 known as CSMT patch and works with NVidia and AMD graphics cards.<br />
<br />
[http://www.wine-staging.com/ Wine-staging] includes CSMT support, and can be installed with the {{Pkg|wine-staging}} package.<br />
<br />
{{Note|CSMT is in the process of being merged into the regular {{pkg|wine}} and is not available in {{pkg|wine-staging}} as of version 1.9.6.[http://www.wine-staging.com/news/2016-03-21-release-1.9.6.html]}}<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 />
*[http://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 />
*[https://www.youtube.com/playlist?list=PL0P2a_sII2eTd8uq-azTNpQjiFLqBhDjg Here] you find some game videos running with CSMT enabled<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 />
Alternatively you can delete all wine related stuff:<br />
<br />
$ find ~/.local/share | grep wine | xargs rm<br />
<br />
And update the cache as above.<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 new Wine file associations ===<br />
<br />
To prevent wine from creating any file associations edit your {{ic|$WINEPREFIX/system.reg}} file, Search for {{ic|winemenubuilder}} and remove {{ic|-a}}, so you'll get:<br />
<br />
{{hc|1=$WINEPREFIX/system.reg|2=<br />
[Software\\Microsoft\\Windows\\CurrentVersion\\RunServices]<br />
"winemenubuilder"="C:\\windows\\system32\\winemenubuilder.exe -r"<br />
}}<br />
<br />
This has to be done for each WINEPREFIX which should not update file associations.<br />
<br />
You can disable winemenubuilder for all WINEPREFIXes by setting an environment variable:<br />
<br />
$ export WINEDLLOVERRIDES="winemenubuilder.exe=d"<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.<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. Install it with the {{AUR|gnome-exe-thumbnailer}} package.<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 />
=== Using Wine as an interpreter for Win16/Win32 binaries ===<br />
<br />
It is also possible to tell the kernel to use Wine as an interpreter for all Win16/Win32 binaries:<br />
# echo ':DOSWin:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register<br />
<br />
To make the setting permanent, create the {{ic|/etc/binfmt.d/wine.conf}} file with the following content:<br />
{{hc|/etc/binfmt.d/wine.conf|2=<br />
# Start WINE on Windows executables<br />
:DOSWin:M::MZ::/usr/bin/wine:<br />
}}<br />
<br />
[[systemd]] automatically mounts the {{ic|/proc/sys/fs/binfmt_misc}} filesystem using {{ic|proc-sys-fs-binfmt_misc.mount}} (and automount) and runs the {{ic|systemd-binfmt.service}} to load your settings.<br />
<br />
Try it out by running a Windows program:<br />
$ chmod +x ''exefile.exe''<br />
$ ./''exefile.exe''<br />
<br />
If all went well, ''exefile.exe'' should run.<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: [http://www.spinics.net/linux/fedora/fedora-users/msg450821.html Fedora Mailing List]<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 />
=== Force OpenGL mode in games ===<br />
<br />
Many games 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 />
$ wine /path/to/3d_game.exe -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [http://appdb.winehq.org AppDB] for such application specific information.<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 />
=== Installing .NET Framework 4.0 ===<br />
<br />
First create a new 32-bit Wine prefix if you are on a 64-bit system.<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
<br />
Then install the following packages using winetricks<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winetricks -q msxml3 dotnet40 corefonts<br />
<br />
=== Installing Microsoft Office ===<br />
==== Office 2010 ====<br />
Microsoft Office 2010 works without any problems (tested with Microsoft Office Home and Student 2010, Wine 1.7.5; Microsoft Office Professional Plus 2010, Wine 1.7.51). Activation over Internet also works.<br />
<br />
Start by installing {{pkg|wine-mono}}, {{pkg|wine_gecko}}, {{pkg|samba}}, {{pkg|lib32-libxslt}} and {{pkg|lib32-libxml2}}.<br />
<br />
Proceed with launching the installer:<br />
$ export WINEPREFIX=~/.wine # Wine prefix to use<br />
$ export WINEARCH=win32<br />
$ wine /path/to/office_cd/setup.exe<br />
<br />
If you do not want to setup Office in the default Wine prefix ({{ic|~/.wine}}), create new one as described in [[#WINEPREFIX]] section. You could also put the above exports into your shell initialization script as also noted there.<br />
<br />
Once installation has completed, open Word or Excel to activate over the Internet. After activation run ''winecfg'' and set {{ic|riched20}} (under libraries) to {{ic|(native,builtin)}}. This will enable PowerPoint to work and makes the drop-down list of countries visible for phone activation.<br />
<br />
For OneNote to work, run {{ic|winetricks wininet}} and then make sure that {{ic|wininet}} is set to {{ic|(native,builtin)}}<br />
<br />
For additional info, see the [http://appdb.winehq.org/appview.php?iVersionId=4992 WineHQ] article.<br />
<br />
As an alternative to the above method, {{Pkg|playonlinux}} provides custom installer scripts that make the installation of Office 2003, 2007 and 2010 an ease. You just have to provide the ''setup.exe'' or ISO and the installer will guide you seamlessly through the installation procedure. You do not have to deal with the underlying Wine at all. The playonlinux installation for Office 2010 improves on the minimum installation instructions provided above by enabling xml conversions for Word documents created with certain earlier versions of Word.<br />
<br />
==== Office 2013 ====<br />
{{Out of date|[https://www.winehq.org/announce/1.7.55 Wine 1.7.55]}}<br />
[https://www.codeweavers.com/ CodeWeawers] managed to install and run Microsoft Office 2013 with many bugs. It is still pretty unusable. You can read more [https://www.codeweavers.com/about/blogs/caron/2015/07/13/two-weeks-in-crossover-microsoft-office-2013-installs-and-launches here].<br />
<br />
==== Office 2016 ====<br />
Doesn't work.<br />
<br />
== Third-party interfaces ==<br />
<br />
These have their own sites, and are ''not supported'' in the official Wine forums/bugzilla.<br />
<br />
=== CrossOver ===<br />
<br />
[http://www.codeweavers.com/about/ CrossOver] Has its own [[CrossOver|wiki page]].<br />
<br />
=== PlayOnLinux/PlayOnMac ===<br />
<br />
[http://www.playonlinux.com/ PlayOnLinux] is a graphical Windows and DOS program manager. It contains scripts to assist the configuration and running of programs, it can manage multiple Wine versions and even use a specific version for each executable (e.g. because of regressions). If you need to know which Wine version works best for a certain game, try the [http://appdb.winehq.org/ Wine Application Database]. You can find the {{Pkg|playonlinux}} package in [[community]].<br />
<br />
{{Tip| PlayOnLinux supports Bumblebee. Open POL console, type this command {{ic|POL_Config_Write PRE_WINE '''optirun'''}} and hit enter. '''optirun''' command will used and each application will be run using '''optirun'''. You can even use '''primusrun''' instead!}}<br />
<br />
=== PyWinery ===<br />
<br />
[https://github.com/ergoithz/pywinery PyWinery] is a graphical and simple wine-prefix manager which allows you to launch apps and manage configuration of separate prefixes, also have a button to open winetricks in the same prefix, to open prefix dir, ''winecfg'', application uninstaller and wineDOS. You can install You can install PyWinery with the {{AUR|pywinery}} package. It is especially useful for having differents settings like DirectX games, office, programming, etc, and choose which prefix to use before you open an application or file.<br />
<br />
It is recommended using winetricks by default to open ''.exe'' files, so you can choose between any Wine configuration you have.<br />
<br />
=== Q4wine ===<br />
<br />
[http://sourceforge.net/projects/q4wine/ Q4Wine] is a graphical wine-prefix manager which allows you to manage configuration of prefixes. Notably it allows exporting [[Qt]] themes into the Wine configuration so that they can integrate nicely. You can find the {{Pkg|q4wine}} package in [[multilib]].<br />
<br />
=== Wine-staging ===<br />
[http://www.wine-staging.com/ Wine-Staging] (formerly wine-compholio) is a special wine version containing bug fixes and features, which are not yet available in regular wine versions. The idea of Wine Staging is to provide new features faster to end users and to give developers the possibility to discuss and improve their patches before they are sent upstream. Available via 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 />
== See also ==<br />
<br />
* [http://www.winehq.com/ Official Wine website]<br />
* [http://appdb.winehq.org/ Wine application database]<br />
* [http://linuxgamingtoday.wordpress.com/2008/02/16/quick-tips-to-speed-up-your-gaming-in-wine/ Advanced configuring of video card and OpenGL in Wine; Speed up Wine]<br />
* [http://wiki.gotux.net/code:perl:fileinfo FileInfo] - Find Win32 PE/COFF headers in exe/dll/ocx files under Linux/Unix environment.<br />
* [https://wiki.gentoo.org/wiki/Wine Gentoo's Wine Wiki Page]</div>Lesmanahttps://wiki.archlinux.org/index.php?title=Wine&diff=404924Wine2015-10-15T19:55:02Z<p>Lesmana: /* Unregister Wine file associations */ add WINEDLLOVERRIDES method</p>
<hr />
<div>[[Category:Wine]]<br />
[[cs:Wine]]<br />
[[de:Wine]]<br />
[[es:Wine]]<br />
[[fr:Wine]]<br />
[[it:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
[[zh-CN:Wine]]<br />
[[zh-TW:Wine]]<br />
{{Related articles start}}<br />
{{Related|Steam/Wine}}<br />
{{Related|CrossOver}}<br />
{{Related articles end}}<br />
[[Wikipedia:Wine (software)|Wine]] is a ''compatibility layer'' capable of running Microsoft Windows applications on Unix-like operating systems. Programs running in Wine act as native programs would, without the performance/memory penalties of an emulator. See the [http://www.winehq.org/ official project home] and [http://wiki.winehq.org/ wiki] pages for longer introduction.<br />
<br />
== Installation ==<br />
{{Warning|If you can access a file or resource with your user account, programs running in Wine can too. Wine prefixes are '''not''' [[wikipedia:Sandbox (computer security)|sandboxes]]. Consider using [[wikipedia:Virtualization|virtualization]] if security is important.}}<br />
<br />
Wine can be [[pacman|installed]] with the package {{Pkg|wine}}, available in the [[official repositories]]. If you are running a 64-bit system, you will need to enable the [[Multilib]] repository first.<br />
<br />
You may also want to install {{pkg|wine_gecko}} and {{pkg|wine-mono}} for applications that need support for Internet Explorer and .NET, respectively. These packages are not strictly required as Wine will download the relevant files as needed. However, having the files downloaded in advance allows you to work off-line and makes it so Wine does not download the files for each Wine prefix needing them.<br />
<br />
'''Architectural differences'''<br />
<br />
Wine by default is 32-bit, as is the i686 Arch package. As such, it is unable to execute any 64-bit Windows applications.<br />
<br />
The x86_64 Arch package, however, is built with {{ic|--enable-win64}}. This activates the Wine version of [[Wikipedia:WoW64|WoW64]].<br />
*In Windows, this complicated subsystem allows the user to use 32-bit and 64-bit Windows programs concurrently and even in the same directory.<br />
*In Wine, the user will have to make separate directories/prefixes. See [http://wiki.winehq.org/Wine64 Wine64] for specific information on this.<br />
<br />
If you run into problems with {{ic|winetricks}} or programs with a 64-bit environment, try creating a new 32-bit {{ic|WINEPREFIX}}. See below: [[#WINEARCH]]. Using the x86_64 Wine package with {{ic|1=WINEARCH=win32}} should have the same behaviour as using the i686 Wine package.<br />
<br />
== Configuration ==<br />
Configuring Wine is typically accomplished using:<br />
* [http://wiki.winehq.org/winecfg winecfg] is a GUI configuration tool for Wine. You can run it from a console window with: {{ic|$ winecfg}}, or {{ic|1=$ WINEPREFIX=~/.some_prefix winecfg}}.<br />
* [http://wiki.winehq.org/control control.exe] is Wine's implementation of Windows' Control Panel which can be accessed with: {{ic|$ wine control}}.<br />
* [http://wiki.winehq.org/regedit regedit] is Wine's registry editing tool. If ''winecfg'' and the Control Panel were not enough, see [http://wiki.winehq.org/UsefulRegistryKeys WineHQ's article on Useful Registry Keys].<br />
<br />
=== WINEPREFIX ===<br />
By default, Wine stores its configuration files and installed Windows programs in {{ic|~/.wine}}. This directory is commonly called a "Wine prefix" or "Wine bottle". It is created/updated automatically whenever you run a Windows program or one of Wine's bundled programs such as ''winecfg''. The prefix directory also contains a tree which your Windows programs will see as {{ic|C:}} (the C-drive).<br />
<br />
You can override the location Wine uses for a prefix with the {{ic|WINEPREFIX}} environment variable. This is useful if you want to use separate configurations for different Windows programs. The first time a program is run with a new Wine prefix, Wine will automatically create a directory with a bare C-drive and registry.<br />
<br />
For example, if you run one program with {{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}, and another with {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}, the two programs will each have a separate C-drive and separate registries.<br />
<br />
{{Note|Wine prefixes are not [[Wikipedia:Sandbox (computer security)|sandboxes]]! Programs running under Wine can still access the rest of the system! (for example, {{ic|Z:}} is mapped to {{ic|/}}, regardless of the Wine prefix).}}<br />
<br />
To create a default prefix without running a Windows program or other GUI tool you can use:<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
If you have a 64-bit system, Wine will start an 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 />
{{Note|During prefix creation, the 64-bit version of Wine treats all folders as 64-bit prefixes and will not create a 32-bit in any existing folder. To create a 32-bit prefix you have to let Wine create the folder specified in {{ic|WINEPREFIX}}.}}<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 />
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 />
<br />
=== Graphics drivers ===<br />
<br />
For most games, Wine requires high performance accelerated graphics drivers. This likely means using proprietary [[NVIDIA]] or [[AMD Catalyst]] drivers, although the open source [[ATI]] driver is increasingly become proficient for use with Wine. [[Intel]] drivers should mostly work as well as they are going to out of the box.<br />
<br />
See [http://www.phoronix.com/scan.php?page=news_item&px=MTI5NjU Gaming On Wine: The Good & Bad Graphics Drivers] for more details.<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 />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
For 64-bit systems, additional [[multilib]] packages are required. Please install the one that is listed in the ''Multilib Package'' column in the table in [[Xorg#Driver installation]].<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''. Currently, the [[Alsa]] driver is the most supported.<br />
<br />
If you want to use [[Alsa]] driver in Wine on a 64-bit system, you will need to install {{Pkg|lib32-alsa-lib}} and {{Pkg|lib32-alsa-plugins}}. If you are also using [[PulseAudio]], you will need to install {{Pkg|lib32-libpulse}}.<br />
<br />
If you want to use [[OSS]] driver in Wine, you will need to install the {{Pkg|lib32-alsa-oss}} package. The OSS driver in the kernel will not suffice.<br />
<br />
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [http://wine-wiki.org/index.php/Wine_Registry#Configuring_Sound configure it via the registry].<br />
<br />
Games that use advanced sound systems may require installations of {{Pkg|lib32-openal}}.<br />
<br />
==== MIDI support ====<br />
<br />
[[MIDI]] was a quite popular system for video games music in the 90's. If you are trying out old games, it is not uncommon that the music will not play out of the box.<br />
Wine has excellent MIDI support. However you first need to make it work on your host system. See the wiki page for more details. Last but not least you need to make sure Wine will use the correct MIDI output. See the [http://wiki.winehq.org/MIDI Wine Wiki] for a detailed setup.<br />
<br />
=== Other libraries ===<br />
<br />
*Some applications (e.g. Office 2003/2007) require the MSXML library to parse HTML or XML, in such cases you need to install {{Pkg|lib32-libxml2}}.<br />
<br />
*Some applications that play music may require {{Pkg|lib32-mpg123}}.<br />
<br />
*Some applications that use a color management engine (e.g. pdf viewers, image viewers, etc) may require {{Pkg|lib32-lcms2}}.<br />
<br />
*Some applications that use native image manipulation libraries may require {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}.<br />
<br />
*Some applications that require encryption support may require {{Pkg|lib32-gnutls}}.<br />
<br />
=== Fonts ===<br />
<br />
If Wine applications are not showing easily readable fonts, you may not have Microsoft's Truetype fonts installed. See [[MS Fonts]]. If this does not help, try running {{ic|winetricks allfonts}}.<br />
<br />
After running such programs, kill all Wine servers and run {{ic|winecfg}}. Fonts should be legible now.<br />
<br />
If the fonts look somehow smeared, import the following text file into the Wine registry with [http://wiki.winehq.org/regedit regedit]:<br />
<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
See also [[Font configuration#Applications without fontconfig support]].<br />
<br />
=== Desktop launcher menus ===<br />
<br />
Installing Windows programs in Wine should result in the appropriate menu/desktop icons being created. For example, if the installation program (e.g. ''setup.exe'') would normally add an icon to your Desktop or "Start Menu" on Windows, then Wine should create corresponding freedesktop.org style ''.desktop'' files for launching your programs with Wine.<br />
<br />
{{Tip|If menu items were ''not'' created while installing software or have been lost, [http://wiki.winehq.org/winemenubuilder winemenubuilder] may be of some use.}}<br />
<br />
==== Creating menu entries for Wine utilities ====<br />
<br />
By default, installation of Wine does not create desktop menus/icons for the software which comes with Wine (e.g. for ''winecfg'', ''winebrowser'', etc). These instructions will add entries for these applications.<br />
<br />
First, install a Windows program using Wine to create the base menu. After the base menu is created, you can create the following files in {{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 />
If these settings produce a ugly/non-existent icon, it means that there are no icons for these launchers in the icon set that you have enabled. You should replace the icon settings with the explicit location of the icon that you want. Clicking the icon in the launcher's properties menu will have the same effect. A great icon set that supports these shortcuts is [http://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors].<br />
<br />
==== Removing menu entries ====<br />
<br />
Menu entries created by Wine are located in {{ic|~/.local/share/applications/wine/Programs/}}. Remove the program's ''.desktop'' entry to remove the application from the menu.<br />
<br />
In addition to remove unwanted extensions binding by Wine, execute the following commands (taken from the Wine website):<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 />
==== KDE 4 menu fix ====<br />
<br />
The Wine menu items [https://bugs.launchpad.net/ubuntu/+source/wine/+bug/263041 may appear] in "Lost & Found" instead of the Wine menu in KDE 4. This is because {{ic|kde-applications.menu}} is missing the {{ic|MergeDir}} option.<br />
<br />
Edit {{ic|/etc/xdg/menus/kde-applications.menu}}<br />
<br />
At the end of the file add {{ic|<MergeDir>applications-merged</MergeDir>}} after {{ic|<DefaultMergeDirs/>}}, it should look like this:<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 />
Alternatively you can create a symlink to a folder that KDE does see:<br />
$ ln -s ~/.config/menus/applications-merged ~/.config/menus/kde-applications-merged<br />
<br />
This has the added bonus that an update to KDE will not change it, but is per user instead of system wide.<br />
<br />
== Running Windows applications ==<br />
<br />
{{Warning|Do not run or install Wine applications as root! See [http://wiki.winehq.org/FAQ#run_as_root Running Wine as root] for the official statement.}}<br />
To run a Windows application:<br />
$ wine ''path_to_exe''<br />
<br />
To install using an MSI installer, use the included ''msiexec'' utility:<br />
$ msiexec /i ''path_to_msi''<br />
<br />
== Tips and tricks ==<br />
<br />
{{Tip|In addition to the links provided in the beginning of the article the following may be of interest:<br />
* [http://appdb.winehq.org/ The Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [http://forum.winehq.org/ The WineHQ Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
}}<br />
<br />
=== Unregister 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 />
Alternatively you can delete all wine related stuff:<br />
<br />
$ find ~/.local/share | grep wine | xargs rm<br />
<br />
And update the cache as above.<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 />
To prevent this, edit your $WINEPREFIX/system.reg file, Search for winemenubuilder and remove '''-a''', so you'll get:<br />
<br />
[Software\\Microsoft\\Windows\\CurrentVersion\\RunServices]<br />
"winemenubuilder"="C:\\windows\\system32\\winemenubuilder.exe -r"<br />
<br />
This has to be done for each WINEPREFIX which should not update file associations.<br />
<br />
You can disable winemenubuilder for all WINEPREFIXes by setting an environment variable:<br />
<br />
WINEDLLOVERRIDES="winemenubuilder.exe=d"<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 at [http://wiki.winehq.org/exe-thumbnailer Wine wiki]. Install it with the {{AUR|gnome-exe-thumbnailer}} package.<br />
<br />
=== CSMT patch ===<br />
{{Out of date|See wine-staging below}}<br />
Currently [http://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 />
[http://www.wine-staging.com/ Wine-staging] includes CSMT support, and can be installed with the {{Pkg|wine-staging}} package.<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 />
*[http://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 />
*[http://wiki.winehq.org/FOSDEM2014?action=AttachFile&do=get&target=d3d-drivers.odp FOSDEM2014 CSMT presentation] of CSMT with benchmarks<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 />
=== Installing Microsoft Office 2010 ===<br />
{{Note|Microsoft Office 2013 does not run at all.}}<br />
{{Note||1=The Microsoft Office 2010 installer is broken in Wine 1.7.49 as reported on the [https://bugs.winehq.org/show_bug.cgi?id=39102 bug tracker]. As of wine 1.7.50 the bug has been fixed and MS Office 2010 and its Installer work fine.}}<br />
Microsoft Office 2010 works without any problems (tested with Microsoft Office Home and Student 2010, Wine 1.5.27 and 1.7.5; Microsoft Office Professional Plus 2010, Wine 1.7.50 and 1.7.51). Activation over Internet also works.<br />
<br />
Start by installing {{pkg|wine-mono}}, {{pkg|wine_gecko}}, {{pkg|samba}}, {{pkg|lib32-libxslt}} and {{pkg|lib32-libxml2}}.<br />
<br />
Proceed with launching the installer:<br />
$ export WINEPREFIX=~/.wine # Wine prefix to use<br />
$ export WINEARCH=win32<br />
$ wine /path/to/office_cd/setup.exe<br />
<br />
If you do not want to setup Office in the default Wine prefix ({{ic|~/.wine}}), create new one as described in [[#WINEPREFIX]] section. You could also put the above exports into your shell initialization script as also noted there.<br />
<br />
Once installation has completed, open Word or Excel to activate over the Internet. After activation run ''winecfg'' and set {{ic|riched20}} (under libraries) to {{ic|(native,builtin)}}. This will enable PowerPoint to work and makes the drop-down list of countries visible for phone activation.<br />
<br />
For OneNote to work, run {{ic|winetricks wininet}} and then make sure that {{ic|wininet}} is set to {{ic|(native,builtin)}}<br />
<br />
For additional info, see the [http://appdb.winehq.org/appview.php?iVersionId=4992 WineHQ] article.<br />
<br />
As an alternative to the above method, {{Pkg|playonlinux}} provides custom installer scripts that make the installation of Office 2003, 2007 and 2010 an ease. You just have to provide the ''setup.exe'' or ISO and the installer will guide you seamlessly through the installation procedure. You do not have to deal with the underlying Wine at all. The playonlinux installation for Office 2010 improves on the minimum installation instructions provided above by enabling xml conversions for Word documents created with certain earlier versions of Word.<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 modes ===<br />
<br />
Many games 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 />
$ wine /path/to/3d_game.exe -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [http://appdb.winehq.org AppDB] for such application specific information.<br />
<br />
=== Using Wine as an interpreter for Win16/Win32 binaries ===<br />
<br />
It is also possible to tell the kernel to use Wine as an interpreter for all Win16/Win32 binaries:<br />
echo ':DOSWin:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register<br />
<br />
To make the setting permanent, create a {{ic|/etc/binfmt.d/wine.conf}} file with the following content:<br />
# Start WINE on Windows executables<br />
:DOSWin:M::MZ::/usr/bin/wine:<br />
<br />
[[systemd]] automatically mounts the {{ic|/proc/sys/fs/binfmt_misc}} filesystem using {{ic|proc-sys-fs-binfmt_misc.mount}} (and automount) and runs the {{ic|systemd-binfmt.service}} to load your settings.<br />
<br />
Try it out by running a Windows program:<br />
$ chmod +x ''exefile.exe''<br />
$ ./''exefile.exe''<br />
<br />
If all went well, ''exefile.exe'' should run.<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 />
[http://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 />
=== Installing .NET Framework 4.0 ===<br />
First create a new 32-bit Wine prefix if you are on a 64-bit system.<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
<br />
Then install the following packages using winetricks<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winetricks -q msxml3 dotnet40 corefonts<br />
<br />
=== Crackling sound when using PulseAudio ===<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 [http://wiki.winehq.org/FAQ#head-58290651b9f85c059a8bfc98118a0262e2cca84b here] for further information.<br />
<br />
=== 16-bit programs ===<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: [http://www.spinics.net/linux/fedora/fedora-users/msg450821.html Fedora Mailing List]<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 />
== Third-party interfaces ==<br />
<br />
These have their own sites, and are ''not supported'' in the official Wine forums/bugzilla.<br />
<br />
=== CrossOver ===<br />
<br />
[http://www.codeweavers.com/about/ CrossOver] Has its own [[CrossOver|wiki page]].<br />
<br />
=== PlayOnLinux/PlayOnMac ===<br />
<br />
[http://www.playonlinux.com/ PlayOnLinux] is a graphical Windows and DOS program manager. It contains scripts to assist the configuration and running of programs, it can manage multiple Wine versions and even use a specific version for each executable (e.g. because of regressions). If you need to know which Wine version works best for a certain game, try the [http://appdb.winehq.org/ Wine Application Database]. You can find the {{Pkg|playonlinux}} package in [[community]].<br />
<br />
=== PyWinery ===<br />
<br />
[https://github.com/ergoithz/pywinery PyWinery] is a graphical and simple wine-prefix manager which allows you to launch apps and manage configuration of separate prefixes, also have a button to open winetricks in the same prefix, to open prefix dir, ''winecfg'', application uninstaller and wineDOS. You can install You can install PyWinery with the {{AUR|pywinery}} package. It is especially useful for having differents settings like DirectX games, office, programming, etc, and choose which prefix to use before you open an application or file.<br />
<br />
It is recommended using winetricks by default to open ''.exe'' files, so you can choose between any Wine configuration you have.<br />
<br />
=== Q4wine ===<br />
<br />
[http://sourceforge.net/projects/q4wine/ Q4Wine] is a graphical wine-prefix manager which allows you to manage configuration of prefixes. Notably it allows exporting [[Qt]] themes into the Wine configuration so that they can integrate nicely. You can find the {{Pkg|q4wine}} package in [[multilib]].<br />
<br />
=== Wine-staging ===<br />
[http://www.wine-staging.com/ Wine-Staging] (formerly wine-compholio) is a special wine version containing bug fixes and features, which are not yet available in regular wine versions. The idea of Wine Staging is to provide new features faster to end users and to give developers the possibility to discuss and improve their patches before they are sent upstream. Available via 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 />
== See also ==<br />
<br />
* [http://www.winehq.com/ Official Wine website]<br />
* [http://appdb.winehq.org/ Wine application database]<br />
* [http://linuxgamingtoday.wordpress.com/2008/02/16/quick-tips-to-speed-up-your-gaming-in-wine/ Advanced configuring of video card and OpenGL in Wine; Speed up Wine]<br />
* [http://wiki.gotux.net/code:perl:fileinfo FileInfo] - Find Win32 PE/COFF headers in exe/dll/ocx files under Linux/Unix environment.<br />
* [https://wiki.gentoo.org/wiki/Wine Gentoo's Wine Wiki Page]</div>Lesmanahttps://wiki.archlinux.org/index.php?title=Wine&diff=404914Wine2015-10-15T19:08:26Z<p>Lesmana: /* Unregister Wine file associations */ alternatively delete all wine stuff</p>
<hr />
<div>[[Category:Wine]]<br />
[[cs:Wine]]<br />
[[de:Wine]]<br />
[[es:Wine]]<br />
[[fr:Wine]]<br />
[[it:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
[[zh-CN:Wine]]<br />
[[zh-TW:Wine]]<br />
{{Related articles start}}<br />
{{Related|Steam/Wine}}<br />
{{Related|CrossOver}}<br />
{{Related articles end}}<br />
[[Wikipedia:Wine (software)|Wine]] is a ''compatibility layer'' capable of running Microsoft Windows applications on Unix-like operating systems. Programs running in Wine act as native programs would, without the performance/memory penalties of an emulator. See the [http://www.winehq.org/ official project home] and [http://wiki.winehq.org/ wiki] pages for longer introduction.<br />
<br />
== Installation ==<br />
{{Warning|If you can access a file or resource with your user account, programs running in Wine can too. Wine prefixes are '''not''' [[wikipedia:Sandbox (computer security)|sandboxes]]. Consider using [[wikipedia:Virtualization|virtualization]] if security is important.}}<br />
<br />
Wine can be [[pacman|installed]] with the package {{Pkg|wine}}, available in the [[official repositories]]. If you are running a 64-bit system, you will need to enable the [[Multilib]] repository first.<br />
<br />
You may also want to install {{pkg|wine_gecko}} and {{pkg|wine-mono}} for applications that need support for Internet Explorer and .NET, respectively. These packages are not strictly required as Wine will download the relevant files as needed. However, having the files downloaded in advance allows you to work off-line and makes it so Wine does not download the files for each Wine prefix needing them.<br />
<br />
'''Architectural differences'''<br />
<br />
Wine by default is 32-bit, as is the i686 Arch package. As such, it is unable to execute any 64-bit Windows applications.<br />
<br />
The x86_64 Arch package, however, is built with {{ic|--enable-win64}}. This activates the Wine version of [[Wikipedia:WoW64|WoW64]].<br />
*In Windows, this complicated subsystem allows the user to use 32-bit and 64-bit Windows programs concurrently and even in the same directory.<br />
*In Wine, the user will have to make separate directories/prefixes. See [http://wiki.winehq.org/Wine64 Wine64] for specific information on this.<br />
<br />
If you run into problems with {{ic|winetricks}} or programs with a 64-bit environment, try creating a new 32-bit {{ic|WINEPREFIX}}. See below: [[#WINEARCH]]. Using the x86_64 Wine package with {{ic|1=WINEARCH=win32}} should have the same behaviour as using the i686 Wine package.<br />
<br />
== Configuration ==<br />
Configuring Wine is typically accomplished using:<br />
* [http://wiki.winehq.org/winecfg winecfg] is a GUI configuration tool for Wine. You can run it from a console window with: {{ic|$ winecfg}}, or {{ic|1=$ WINEPREFIX=~/.some_prefix winecfg}}.<br />
* [http://wiki.winehq.org/control control.exe] is Wine's implementation of Windows' Control Panel which can be accessed with: {{ic|$ wine control}}.<br />
* [http://wiki.winehq.org/regedit regedit] is Wine's registry editing tool. If ''winecfg'' and the Control Panel were not enough, see [http://wiki.winehq.org/UsefulRegistryKeys WineHQ's article on Useful Registry Keys].<br />
<br />
=== WINEPREFIX ===<br />
By default, Wine stores its configuration files and installed Windows programs in {{ic|~/.wine}}. This directory is commonly called a "Wine prefix" or "Wine bottle". It is created/updated automatically whenever you run a Windows program or one of Wine's bundled programs such as ''winecfg''. The prefix directory also contains a tree which your Windows programs will see as {{ic|C:}} (the C-drive).<br />
<br />
You can override the location Wine uses for a prefix with the {{ic|WINEPREFIX}} environment variable. This is useful if you want to use separate configurations for different Windows programs. The first time a program is run with a new Wine prefix, Wine will automatically create a directory with a bare C-drive and registry.<br />
<br />
For example, if you run one program with {{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}, and another with {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}, the two programs will each have a separate C-drive and separate registries.<br />
<br />
{{Note|Wine prefixes are not [[Wikipedia:Sandbox (computer security)|sandboxes]]! Programs running under Wine can still access the rest of the system! (for example, {{ic|Z:}} is mapped to {{ic|/}}, regardless of the Wine prefix).}}<br />
<br />
To create a default prefix without running a Windows program or other GUI tool you can use:<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
If you have a 64-bit system, Wine will start an 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 />
{{Note|During prefix creation, the 64-bit version of Wine treats all folders as 64-bit prefixes and will not create a 32-bit in any existing folder. To create a 32-bit prefix you have to let Wine create the folder specified in {{ic|WINEPREFIX}}.}}<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 />
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 />
<br />
=== Graphics drivers ===<br />
<br />
For most games, Wine requires high performance accelerated graphics drivers. This likely means using proprietary [[NVIDIA]] or [[AMD Catalyst]] drivers, although the open source [[ATI]] driver is increasingly become proficient for use with Wine. [[Intel]] drivers should mostly work as well as they are going to out of the box.<br />
<br />
See [http://www.phoronix.com/scan.php?page=news_item&px=MTI5NjU Gaming On Wine: The Good & Bad Graphics Drivers] for more details.<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 />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
For 64-bit systems, additional [[multilib]] packages are required. Please install the one that is listed in the ''Multilib Package'' column in the table in [[Xorg#Driver installation]].<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''. Currently, the [[Alsa]] driver is the most supported.<br />
<br />
If you want to use [[Alsa]] driver in Wine on a 64-bit system, you will need to install {{Pkg|lib32-alsa-lib}} and {{Pkg|lib32-alsa-plugins}}. If you are also using [[PulseAudio]], you will need to install {{Pkg|lib32-libpulse}}.<br />
<br />
If you want to use [[OSS]] driver in Wine, you will need to install the {{Pkg|lib32-alsa-oss}} package. The OSS driver in the kernel will not suffice.<br />
<br />
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [http://wine-wiki.org/index.php/Wine_Registry#Configuring_Sound configure it via the registry].<br />
<br />
Games that use advanced sound systems may require installations of {{Pkg|lib32-openal}}.<br />
<br />
==== MIDI support ====<br />
<br />
[[MIDI]] was a quite popular system for video games music in the 90's. If you are trying out old games, it is not uncommon that the music will not play out of the box.<br />
Wine has excellent MIDI support. However you first need to make it work on your host system. See the wiki page for more details. Last but not least you need to make sure Wine will use the correct MIDI output. See the [http://wiki.winehq.org/MIDI Wine Wiki] for a detailed setup.<br />
<br />
=== Other libraries ===<br />
<br />
*Some applications (e.g. Office 2003/2007) require the MSXML library to parse HTML or XML, in such cases you need to install {{Pkg|lib32-libxml2}}.<br />
<br />
*Some applications that play music may require {{Pkg|lib32-mpg123}}.<br />
<br />
*Some applications that use a color management engine (e.g. pdf viewers, image viewers, etc) may require {{Pkg|lib32-lcms2}}.<br />
<br />
*Some applications that use native image manipulation libraries may require {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}.<br />
<br />
*Some applications that require encryption support may require {{Pkg|lib32-gnutls}}.<br />
<br />
=== Fonts ===<br />
<br />
If Wine applications are not showing easily readable fonts, you may not have Microsoft's Truetype fonts installed. See [[MS Fonts]]. If this does not help, try running {{ic|winetricks allfonts}}.<br />
<br />
After running such programs, kill all Wine servers and run {{ic|winecfg}}. Fonts should be legible now.<br />
<br />
If the fonts look somehow smeared, import the following text file into the Wine registry with [http://wiki.winehq.org/regedit regedit]:<br />
<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
See also [[Font configuration#Applications without fontconfig support]].<br />
<br />
=== Desktop launcher menus ===<br />
<br />
Installing Windows programs in Wine should result in the appropriate menu/desktop icons being created. For example, if the installation program (e.g. ''setup.exe'') would normally add an icon to your Desktop or "Start Menu" on Windows, then Wine should create corresponding freedesktop.org style ''.desktop'' files for launching your programs with Wine.<br />
<br />
{{Tip|If menu items were ''not'' created while installing software or have been lost, [http://wiki.winehq.org/winemenubuilder winemenubuilder] may be of some use.}}<br />
<br />
==== Creating menu entries for Wine utilities ====<br />
<br />
By default, installation of Wine does not create desktop menus/icons for the software which comes with Wine (e.g. for ''winecfg'', ''winebrowser'', etc). These instructions will add entries for these applications.<br />
<br />
First, install a Windows program using Wine to create the base menu. After the base menu is created, you can create the following files in {{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 />
If these settings produce a ugly/non-existent icon, it means that there are no icons for these launchers in the icon set that you have enabled. You should replace the icon settings with the explicit location of the icon that you want. Clicking the icon in the launcher's properties menu will have the same effect. A great icon set that supports these shortcuts is [http://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors].<br />
<br />
==== Removing menu entries ====<br />
<br />
Menu entries created by Wine are located in {{ic|~/.local/share/applications/wine/Programs/}}. Remove the program's ''.desktop'' entry to remove the application from the menu.<br />
<br />
In addition to remove unwanted extensions binding by Wine, execute the following commands (taken from the Wine website):<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 />
==== KDE 4 menu fix ====<br />
<br />
The Wine menu items [https://bugs.launchpad.net/ubuntu/+source/wine/+bug/263041 may appear] in "Lost & Found" instead of the Wine menu in KDE 4. This is because {{ic|kde-applications.menu}} is missing the {{ic|MergeDir}} option.<br />
<br />
Edit {{ic|/etc/xdg/menus/kde-applications.menu}}<br />
<br />
At the end of the file add {{ic|<MergeDir>applications-merged</MergeDir>}} after {{ic|<DefaultMergeDirs/>}}, it should look like this:<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 />
Alternatively you can create a symlink to a folder that KDE does see:<br />
$ ln -s ~/.config/menus/applications-merged ~/.config/menus/kde-applications-merged<br />
<br />
This has the added bonus that an update to KDE will not change it, but is per user instead of system wide.<br />
<br />
== Running Windows applications ==<br />
<br />
{{Warning|Do not run or install Wine applications as root! See [http://wiki.winehq.org/FAQ#run_as_root Running Wine as root] for the official statement.}}<br />
To run a Windows application:<br />
$ wine ''path_to_exe''<br />
<br />
To install using an MSI installer, use the included ''msiexec'' utility:<br />
$ msiexec /i ''path_to_msi''<br />
<br />
== Tips and tricks ==<br />
<br />
{{Tip|In addition to the links provided in the beginning of the article the following may be of interest:<br />
* [http://appdb.winehq.org/ The Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [http://forum.winehq.org/ The WineHQ Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
}}<br />
<br />
=== Unregister Wine file associations ===<br />
<br />
{{Accuracy|A better workaround would be using WINEDLLOVERRIDES, see [https://github.com/Earnestly/dotfiles/blob/master/.local/bin/mkwineprefix] for an example}}<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 />
Alternatively you can delete all wine related stuff:<br />
<br />
$ find ~/.local/share | grep wine | xargs rm<br />
<br />
And update the cache as above.<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 />
To prevent this, edit your $WINEPREFIX/system.reg file, Search for winemenubuilder and remove '''-a''', so you'll get:<br />
<br />
[Software\\Microsoft\\Windows\\CurrentVersion\\RunServices]<br />
"winemenubuilder"="C:\\windows\\system32\\winemenubuilder.exe -r"<br />
<br />
This will prevent updating file associations on your user account (for that WINEPREFIX).<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 at [http://wiki.winehq.org/exe-thumbnailer Wine wiki]. Install it with the {{AUR|gnome-exe-thumbnailer}} package.<br />
<br />
=== CSMT patch ===<br />
{{Out of date|See wine-staging below}}<br />
Currently [http://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 />
[http://www.wine-staging.com/ Wine-staging] includes CSMT support, and can be installed with the {{Pkg|wine-staging}} package.<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 />
*[http://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 />
*[http://wiki.winehq.org/FOSDEM2014?action=AttachFile&do=get&target=d3d-drivers.odp FOSDEM2014 CSMT presentation] of CSMT with benchmarks<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 />
=== Installing Microsoft Office 2010 ===<br />
{{Note|Microsoft Office 2013 does not run at all.}}<br />
{{Note||1=The Microsoft Office 2010 installer is broken in Wine 1.7.49 as reported on the [https://bugs.winehq.org/show_bug.cgi?id=39102 bug tracker]. As of wine 1.7.50 the bug has been fixed and MS Office 2010 and its Installer work fine.}}<br />
Microsoft Office 2010 works without any problems (tested with Microsoft Office Home and Student 2010, Wine 1.5.27 and 1.7.5; Microsoft Office Professional Plus 2010, Wine 1.7.50 and 1.7.51). Activation over Internet also works.<br />
<br />
Start by installing {{pkg|wine-mono}}, {{pkg|wine_gecko}}, {{pkg|samba}}, {{pkg|lib32-libxslt}} and {{pkg|lib32-libxml2}}.<br />
<br />
Proceed with launching the installer:<br />
$ export WINEPREFIX=~/.wine # Wine prefix to use<br />
$ export WINEARCH=win32<br />
$ wine /path/to/office_cd/setup.exe<br />
<br />
If you do not want to setup Office in the default Wine prefix ({{ic|~/.wine}}), create new one as described in [[#WINEPREFIX]] section. You could also put the above exports into your shell initialization script as also noted there.<br />
<br />
Once installation has completed, open Word or Excel to activate over the Internet. After activation run ''winecfg'' and set {{ic|riched20}} (under libraries) to {{ic|(native,builtin)}}. This will enable PowerPoint to work and makes the drop-down list of countries visible for phone activation.<br />
<br />
For OneNote to work, run {{ic|winetricks wininet}} and then make sure that {{ic|wininet}} is set to {{ic|(native,builtin)}}<br />
<br />
For additional info, see the [http://appdb.winehq.org/appview.php?iVersionId=4992 WineHQ] article.<br />
<br />
As an alternative to the above method, {{Pkg|playonlinux}} provides custom installer scripts that make the installation of Office 2003, 2007 and 2010 an ease. You just have to provide the ''setup.exe'' or ISO and the installer will guide you seamlessly through the installation procedure. You do not have to deal with the underlying Wine at all. The playonlinux installation for Office 2010 improves on the minimum installation instructions provided above by enabling xml conversions for Word documents created with certain earlier versions of Word.<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 modes ===<br />
<br />
Many games 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 />
$ wine /path/to/3d_game.exe -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [http://appdb.winehq.org AppDB] for such application specific information.<br />
<br />
=== Using Wine as an interpreter for Win16/Win32 binaries ===<br />
<br />
It is also possible to tell the kernel to use Wine as an interpreter for all Win16/Win32 binaries:<br />
echo ':DOSWin:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register<br />
<br />
To make the setting permanent, create a {{ic|/etc/binfmt.d/wine.conf}} file with the following content:<br />
# Start WINE on Windows executables<br />
:DOSWin:M::MZ::/usr/bin/wine:<br />
<br />
[[systemd]] automatically mounts the {{ic|/proc/sys/fs/binfmt_misc}} filesystem using {{ic|proc-sys-fs-binfmt_misc.mount}} (and automount) and runs the {{ic|systemd-binfmt.service}} to load your settings.<br />
<br />
Try it out by running a Windows program:<br />
$ chmod +x ''exefile.exe''<br />
$ ./''exefile.exe''<br />
<br />
If all went well, ''exefile.exe'' should run.<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 />
[http://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 />
=== Installing .NET Framework 4.0 ===<br />
First create a new 32-bit Wine prefix if you are on a 64-bit system.<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
<br />
Then install the following packages using winetricks<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winetricks -q msxml3 dotnet40 corefonts<br />
<br />
=== Crackling sound when using PulseAudio ===<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 [http://wiki.winehq.org/FAQ#head-58290651b9f85c059a8bfc98118a0262e2cca84b here] for further information.<br />
<br />
=== 16-bit programs ===<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: [http://www.spinics.net/linux/fedora/fedora-users/msg450821.html Fedora Mailing List]<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 />
== Third-party interfaces ==<br />
<br />
These have their own sites, and are ''not supported'' in the official Wine forums/bugzilla.<br />
<br />
=== CrossOver ===<br />
<br />
[http://www.codeweavers.com/about/ CrossOver] Has its own [[CrossOver|wiki page]].<br />
<br />
=== PlayOnLinux/PlayOnMac ===<br />
<br />
[http://www.playonlinux.com/ PlayOnLinux] is a graphical Windows and DOS program manager. It contains scripts to assist the configuration and running of programs, it can manage multiple Wine versions and even use a specific version for each executable (e.g. because of regressions). If you need to know which Wine version works best for a certain game, try the [http://appdb.winehq.org/ Wine Application Database]. You can find the {{Pkg|playonlinux}} package in [[community]].<br />
<br />
=== PyWinery ===<br />
<br />
[https://github.com/ergoithz/pywinery PyWinery] is a graphical and simple wine-prefix manager which allows you to launch apps and manage configuration of separate prefixes, also have a button to open winetricks in the same prefix, to open prefix dir, ''winecfg'', application uninstaller and wineDOS. You can install You can install PyWinery with the {{AUR|pywinery}} package. It is especially useful for having differents settings like DirectX games, office, programming, etc, and choose which prefix to use before you open an application or file.<br />
<br />
It is recommended using winetricks by default to open ''.exe'' files, so you can choose between any Wine configuration you have.<br />
<br />
=== Q4wine ===<br />
<br />
[http://sourceforge.net/projects/q4wine/ Q4Wine] is a graphical wine-prefix manager which allows you to manage configuration of prefixes. Notably it allows exporting [[Qt]] themes into the Wine configuration so that they can integrate nicely. You can find the {{Pkg|q4wine}} package in [[multilib]].<br />
<br />
=== Wine-staging ===<br />
[http://www.wine-staging.com/ Wine-Staging] (formerly wine-compholio) is a special wine version containing bug fixes and features, which are not yet available in regular wine versions. The idea of Wine Staging is to provide new features faster to end users and to give developers the possibility to discuss and improve their patches before they are sent upstream. Available via 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 />
== See also ==<br />
<br />
* [http://www.winehq.com/ Official Wine website]<br />
* [http://appdb.winehq.org/ Wine application database]<br />
* [http://linuxgamingtoday.wordpress.com/2008/02/16/quick-tips-to-speed-up-your-gaming-in-wine/ Advanced configuring of video card and OpenGL in Wine; Speed up Wine]<br />
* [http://wiki.gotux.net/code:perl:fileinfo FileInfo] - Find Win32 PE/COFF headers in exe/dll/ocx files under Linux/Unix environment.<br />
* [https://wiki.gentoo.org/wiki/Wine Gentoo's Wine Wiki Page]</div>Lesmanahttps://wiki.archlinux.org/index.php?title=Wine&diff=404913Wine2015-10-15T19:07:54Z<p>Lesmana: /* Unregister Wine file associations */ add update-mime-database</p>
<hr />
<div>[[Category:Wine]]<br />
[[cs:Wine]]<br />
[[de:Wine]]<br />
[[es:Wine]]<br />
[[fr:Wine]]<br />
[[it:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
[[zh-CN:Wine]]<br />
[[zh-TW:Wine]]<br />
{{Related articles start}}<br />
{{Related|Steam/Wine}}<br />
{{Related|CrossOver}}<br />
{{Related articles end}}<br />
[[Wikipedia:Wine (software)|Wine]] is a ''compatibility layer'' capable of running Microsoft Windows applications on Unix-like operating systems. Programs running in Wine act as native programs would, without the performance/memory penalties of an emulator. See the [http://www.winehq.org/ official project home] and [http://wiki.winehq.org/ wiki] pages for longer introduction.<br />
<br />
== Installation ==<br />
{{Warning|If you can access a file or resource with your user account, programs running in Wine can too. Wine prefixes are '''not''' [[wikipedia:Sandbox (computer security)|sandboxes]]. Consider using [[wikipedia:Virtualization|virtualization]] if security is important.}}<br />
<br />
Wine can be [[pacman|installed]] with the package {{Pkg|wine}}, available in the [[official repositories]]. If you are running a 64-bit system, you will need to enable the [[Multilib]] repository first.<br />
<br />
You may also want to install {{pkg|wine_gecko}} and {{pkg|wine-mono}} for applications that need support for Internet Explorer and .NET, respectively. These packages are not strictly required as Wine will download the relevant files as needed. However, having the files downloaded in advance allows you to work off-line and makes it so Wine does not download the files for each Wine prefix needing them.<br />
<br />
'''Architectural differences'''<br />
<br />
Wine by default is 32-bit, as is the i686 Arch package. As such, it is unable to execute any 64-bit Windows applications.<br />
<br />
The x86_64 Arch package, however, is built with {{ic|--enable-win64}}. This activates the Wine version of [[Wikipedia:WoW64|WoW64]].<br />
*In Windows, this complicated subsystem allows the user to use 32-bit and 64-bit Windows programs concurrently and even in the same directory.<br />
*In Wine, the user will have to make separate directories/prefixes. See [http://wiki.winehq.org/Wine64 Wine64] for specific information on this.<br />
<br />
If you run into problems with {{ic|winetricks}} or programs with a 64-bit environment, try creating a new 32-bit {{ic|WINEPREFIX}}. See below: [[#WINEARCH]]. Using the x86_64 Wine package with {{ic|1=WINEARCH=win32}} should have the same behaviour as using the i686 Wine package.<br />
<br />
== Configuration ==<br />
Configuring Wine is typically accomplished using:<br />
* [http://wiki.winehq.org/winecfg winecfg] is a GUI configuration tool for Wine. You can run it from a console window with: {{ic|$ winecfg}}, or {{ic|1=$ WINEPREFIX=~/.some_prefix winecfg}}.<br />
* [http://wiki.winehq.org/control control.exe] is Wine's implementation of Windows' Control Panel which can be accessed with: {{ic|$ wine control}}.<br />
* [http://wiki.winehq.org/regedit regedit] is Wine's registry editing tool. If ''winecfg'' and the Control Panel were not enough, see [http://wiki.winehq.org/UsefulRegistryKeys WineHQ's article on Useful Registry Keys].<br />
<br />
=== WINEPREFIX ===<br />
By default, Wine stores its configuration files and installed Windows programs in {{ic|~/.wine}}. This directory is commonly called a "Wine prefix" or "Wine bottle". It is created/updated automatically whenever you run a Windows program or one of Wine's bundled programs such as ''winecfg''. The prefix directory also contains a tree which your Windows programs will see as {{ic|C:}} (the C-drive).<br />
<br />
You can override the location Wine uses for a prefix with the {{ic|WINEPREFIX}} environment variable. This is useful if you want to use separate configurations for different Windows programs. The first time a program is run with a new Wine prefix, Wine will automatically create a directory with a bare C-drive and registry.<br />
<br />
For example, if you run one program with {{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}, and another with {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}, the two programs will each have a separate C-drive and separate registries.<br />
<br />
{{Note|Wine prefixes are not [[Wikipedia:Sandbox (computer security)|sandboxes]]! Programs running under Wine can still access the rest of the system! (for example, {{ic|Z:}} is mapped to {{ic|/}}, regardless of the Wine prefix).}}<br />
<br />
To create a default prefix without running a Windows program or other GUI tool you can use:<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
If you have a 64-bit system, Wine will start an 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 />
{{Note|During prefix creation, the 64-bit version of Wine treats all folders as 64-bit prefixes and will not create a 32-bit in any existing folder. To create a 32-bit prefix you have to let Wine create the folder specified in {{ic|WINEPREFIX}}.}}<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 />
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 />
<br />
=== Graphics drivers ===<br />
<br />
For most games, Wine requires high performance accelerated graphics drivers. This likely means using proprietary [[NVIDIA]] or [[AMD Catalyst]] drivers, although the open source [[ATI]] driver is increasingly become proficient for use with Wine. [[Intel]] drivers should mostly work as well as they are going to out of the box.<br />
<br />
See [http://www.phoronix.com/scan.php?page=news_item&px=MTI5NjU Gaming On Wine: The Good & Bad Graphics Drivers] for more details.<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 />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
For 64-bit systems, additional [[multilib]] packages are required. Please install the one that is listed in the ''Multilib Package'' column in the table in [[Xorg#Driver installation]].<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''. Currently, the [[Alsa]] driver is the most supported.<br />
<br />
If you want to use [[Alsa]] driver in Wine on a 64-bit system, you will need to install {{Pkg|lib32-alsa-lib}} and {{Pkg|lib32-alsa-plugins}}. If you are also using [[PulseAudio]], you will need to install {{Pkg|lib32-libpulse}}.<br />
<br />
If you want to use [[OSS]] driver in Wine, you will need to install the {{Pkg|lib32-alsa-oss}} package. The OSS driver in the kernel will not suffice.<br />
<br />
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [http://wine-wiki.org/index.php/Wine_Registry#Configuring_Sound configure it via the registry].<br />
<br />
Games that use advanced sound systems may require installations of {{Pkg|lib32-openal}}.<br />
<br />
==== MIDI support ====<br />
<br />
[[MIDI]] was a quite popular system for video games music in the 90's. If you are trying out old games, it is not uncommon that the music will not play out of the box.<br />
Wine has excellent MIDI support. However you first need to make it work on your host system. See the wiki page for more details. Last but not least you need to make sure Wine will use the correct MIDI output. See the [http://wiki.winehq.org/MIDI Wine Wiki] for a detailed setup.<br />
<br />
=== Other libraries ===<br />
<br />
*Some applications (e.g. Office 2003/2007) require the MSXML library to parse HTML or XML, in such cases you need to install {{Pkg|lib32-libxml2}}.<br />
<br />
*Some applications that play music may require {{Pkg|lib32-mpg123}}.<br />
<br />
*Some applications that use a color management engine (e.g. pdf viewers, image viewers, etc) may require {{Pkg|lib32-lcms2}}.<br />
<br />
*Some applications that use native image manipulation libraries may require {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}.<br />
<br />
*Some applications that require encryption support may require {{Pkg|lib32-gnutls}}.<br />
<br />
=== Fonts ===<br />
<br />
If Wine applications are not showing easily readable fonts, you may not have Microsoft's Truetype fonts installed. See [[MS Fonts]]. If this does not help, try running {{ic|winetricks allfonts}}.<br />
<br />
After running such programs, kill all Wine servers and run {{ic|winecfg}}. Fonts should be legible now.<br />
<br />
If the fonts look somehow smeared, import the following text file into the Wine registry with [http://wiki.winehq.org/regedit regedit]:<br />
<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
See also [[Font configuration#Applications without fontconfig support]].<br />
<br />
=== Desktop launcher menus ===<br />
<br />
Installing Windows programs in Wine should result in the appropriate menu/desktop icons being created. For example, if the installation program (e.g. ''setup.exe'') would normally add an icon to your Desktop or "Start Menu" on Windows, then Wine should create corresponding freedesktop.org style ''.desktop'' files for launching your programs with Wine.<br />
<br />
{{Tip|If menu items were ''not'' created while installing software or have been lost, [http://wiki.winehq.org/winemenubuilder winemenubuilder] may be of some use.}}<br />
<br />
==== Creating menu entries for Wine utilities ====<br />
<br />
By default, installation of Wine does not create desktop menus/icons for the software which comes with Wine (e.g. for ''winecfg'', ''winebrowser'', etc). These instructions will add entries for these applications.<br />
<br />
First, install a Windows program using Wine to create the base menu. After the base menu is created, you can create the following files in {{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 />
If these settings produce a ugly/non-existent icon, it means that there are no icons for these launchers in the icon set that you have enabled. You should replace the icon settings with the explicit location of the icon that you want. Clicking the icon in the launcher's properties menu will have the same effect. A great icon set that supports these shortcuts is [http://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors].<br />
<br />
==== Removing menu entries ====<br />
<br />
Menu entries created by Wine are located in {{ic|~/.local/share/applications/wine/Programs/}}. Remove the program's ''.desktop'' entry to remove the application from the menu.<br />
<br />
In addition to remove unwanted extensions binding by Wine, execute the following commands (taken from the Wine website):<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 />
==== KDE 4 menu fix ====<br />
<br />
The Wine menu items [https://bugs.launchpad.net/ubuntu/+source/wine/+bug/263041 may appear] in "Lost & Found" instead of the Wine menu in KDE 4. This is because {{ic|kde-applications.menu}} is missing the {{ic|MergeDir}} option.<br />
<br />
Edit {{ic|/etc/xdg/menus/kde-applications.menu}}<br />
<br />
At the end of the file add {{ic|<MergeDir>applications-merged</MergeDir>}} after {{ic|<DefaultMergeDirs/>}}, it should look like this:<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 />
Alternatively you can create a symlink to a folder that KDE does see:<br />
$ ln -s ~/.config/menus/applications-merged ~/.config/menus/kde-applications-merged<br />
<br />
This has the added bonus that an update to KDE will not change it, but is per user instead of system wide.<br />
<br />
== Running Windows applications ==<br />
<br />
{{Warning|Do not run or install Wine applications as root! See [http://wiki.winehq.org/FAQ#run_as_root Running Wine as root] for the official statement.}}<br />
To run a Windows application:<br />
$ wine ''path_to_exe''<br />
<br />
To install using an MSI installer, use the included ''msiexec'' utility:<br />
$ msiexec /i ''path_to_msi''<br />
<br />
== Tips and tricks ==<br />
<br />
{{Tip|In addition to the links provided in the beginning of the article the following may be of interest:<br />
* [http://appdb.winehq.org/ The Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [http://forum.winehq.org/ The WineHQ Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
}}<br />
<br />
=== Unregister Wine file associations ===<br />
<br />
{{Accuracy|A better workaround would be using WINEDLLOVERRIDES, see [https://github.com/Earnestly/dotfiles/blob/master/.local/bin/mkwineprefix] for an example}}<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 />
To prevent this, edit your $WINEPREFIX/system.reg file, Search for winemenubuilder and remove '''-a''', so you'll get:<br />
<br />
[Software\\Microsoft\\Windows\\CurrentVersion\\RunServices]<br />
"winemenubuilder"="C:\\windows\\system32\\winemenubuilder.exe -r"<br />
<br />
This will prevent updating file associations on your user account (for that WINEPREFIX).<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 at [http://wiki.winehq.org/exe-thumbnailer Wine wiki]. Install it with the {{AUR|gnome-exe-thumbnailer}} package.<br />
<br />
=== CSMT patch ===<br />
{{Out of date|See wine-staging below}}<br />
Currently [http://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 />
[http://www.wine-staging.com/ Wine-staging] includes CSMT support, and can be installed with the {{Pkg|wine-staging}} package.<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 />
*[http://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 />
*[http://wiki.winehq.org/FOSDEM2014?action=AttachFile&do=get&target=d3d-drivers.odp FOSDEM2014 CSMT presentation] of CSMT with benchmarks<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 />
=== Installing Microsoft Office 2010 ===<br />
{{Note|Microsoft Office 2013 does not run at all.}}<br />
{{Note||1=The Microsoft Office 2010 installer is broken in Wine 1.7.49 as reported on the [https://bugs.winehq.org/show_bug.cgi?id=39102 bug tracker]. As of wine 1.7.50 the bug has been fixed and MS Office 2010 and its Installer work fine.}}<br />
Microsoft Office 2010 works without any problems (tested with Microsoft Office Home and Student 2010, Wine 1.5.27 and 1.7.5; Microsoft Office Professional Plus 2010, Wine 1.7.50 and 1.7.51). Activation over Internet also works.<br />
<br />
Start by installing {{pkg|wine-mono}}, {{pkg|wine_gecko}}, {{pkg|samba}}, {{pkg|lib32-libxslt}} and {{pkg|lib32-libxml2}}.<br />
<br />
Proceed with launching the installer:<br />
$ export WINEPREFIX=~/.wine # Wine prefix to use<br />
$ export WINEARCH=win32<br />
$ wine /path/to/office_cd/setup.exe<br />
<br />
If you do not want to setup Office in the default Wine prefix ({{ic|~/.wine}}), create new one as described in [[#WINEPREFIX]] section. You could also put the above exports into your shell initialization script as also noted there.<br />
<br />
Once installation has completed, open Word or Excel to activate over the Internet. After activation run ''winecfg'' and set {{ic|riched20}} (under libraries) to {{ic|(native,builtin)}}. This will enable PowerPoint to work and makes the drop-down list of countries visible for phone activation.<br />
<br />
For OneNote to work, run {{ic|winetricks wininet}} and then make sure that {{ic|wininet}} is set to {{ic|(native,builtin)}}<br />
<br />
For additional info, see the [http://appdb.winehq.org/appview.php?iVersionId=4992 WineHQ] article.<br />
<br />
As an alternative to the above method, {{Pkg|playonlinux}} provides custom installer scripts that make the installation of Office 2003, 2007 and 2010 an ease. You just have to provide the ''setup.exe'' or ISO and the installer will guide you seamlessly through the installation procedure. You do not have to deal with the underlying Wine at all. The playonlinux installation for Office 2010 improves on the minimum installation instructions provided above by enabling xml conversions for Word documents created with certain earlier versions of Word.<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 modes ===<br />
<br />
Many games 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 />
$ wine /path/to/3d_game.exe -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [http://appdb.winehq.org AppDB] for such application specific information.<br />
<br />
=== Using Wine as an interpreter for Win16/Win32 binaries ===<br />
<br />
It is also possible to tell the kernel to use Wine as an interpreter for all Win16/Win32 binaries:<br />
echo ':DOSWin:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register<br />
<br />
To make the setting permanent, create a {{ic|/etc/binfmt.d/wine.conf}} file with the following content:<br />
# Start WINE on Windows executables<br />
:DOSWin:M::MZ::/usr/bin/wine:<br />
<br />
[[systemd]] automatically mounts the {{ic|/proc/sys/fs/binfmt_misc}} filesystem using {{ic|proc-sys-fs-binfmt_misc.mount}} (and automount) and runs the {{ic|systemd-binfmt.service}} to load your settings.<br />
<br />
Try it out by running a Windows program:<br />
$ chmod +x ''exefile.exe''<br />
$ ./''exefile.exe''<br />
<br />
If all went well, ''exefile.exe'' should run.<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 />
[http://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 />
=== Installing .NET Framework 4.0 ===<br />
First create a new 32-bit Wine prefix if you are on a 64-bit system.<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
<br />
Then install the following packages using winetricks<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winetricks -q msxml3 dotnet40 corefonts<br />
<br />
=== Crackling sound when using PulseAudio ===<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 [http://wiki.winehq.org/FAQ#head-58290651b9f85c059a8bfc98118a0262e2cca84b here] for further information.<br />
<br />
=== 16-bit programs ===<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: [http://www.spinics.net/linux/fedora/fedora-users/msg450821.html Fedora Mailing List]<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 />
== Third-party interfaces ==<br />
<br />
These have their own sites, and are ''not supported'' in the official Wine forums/bugzilla.<br />
<br />
=== CrossOver ===<br />
<br />
[http://www.codeweavers.com/about/ CrossOver] Has its own [[CrossOver|wiki page]].<br />
<br />
=== PlayOnLinux/PlayOnMac ===<br />
<br />
[http://www.playonlinux.com/ PlayOnLinux] is a graphical Windows and DOS program manager. It contains scripts to assist the configuration and running of programs, it can manage multiple Wine versions and even use a specific version for each executable (e.g. because of regressions). If you need to know which Wine version works best for a certain game, try the [http://appdb.winehq.org/ Wine Application Database]. You can find the {{Pkg|playonlinux}} package in [[community]].<br />
<br />
=== PyWinery ===<br />
<br />
[https://github.com/ergoithz/pywinery PyWinery] is a graphical and simple wine-prefix manager which allows you to launch apps and manage configuration of separate prefixes, also have a button to open winetricks in the same prefix, to open prefix dir, ''winecfg'', application uninstaller and wineDOS. You can install You can install PyWinery with the {{AUR|pywinery}} package. It is especially useful for having differents settings like DirectX games, office, programming, etc, and choose which prefix to use before you open an application or file.<br />
<br />
It is recommended using winetricks by default to open ''.exe'' files, so you can choose between any Wine configuration you have.<br />
<br />
=== Q4wine ===<br />
<br />
[http://sourceforge.net/projects/q4wine/ Q4Wine] is a graphical wine-prefix manager which allows you to manage configuration of prefixes. Notably it allows exporting [[Qt]] themes into the Wine configuration so that they can integrate nicely. You can find the {{Pkg|q4wine}} package in [[multilib]].<br />
<br />
=== Wine-staging ===<br />
[http://www.wine-staging.com/ Wine-Staging] (formerly wine-compholio) is a special wine version containing bug fixes and features, which are not yet available in regular wine versions. The idea of Wine Staging is to provide new features faster to end users and to give developers the possibility to discuss and improve their patches before they are sent upstream. Available via 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 />
== See also ==<br />
<br />
* [http://www.winehq.com/ Official Wine website]<br />
* [http://appdb.winehq.org/ Wine application database]<br />
* [http://linuxgamingtoday.wordpress.com/2008/02/16/quick-tips-to-speed-up-your-gaming-in-wine/ Advanced configuring of video card and OpenGL in Wine; Speed up Wine]<br />
* [http://wiki.gotux.net/code:perl:fileinfo FileInfo] - Find Win32 PE/COFF headers in exe/dll/ocx files under Linux/Unix environment.<br />
* [https://wiki.gentoo.org/wiki/Wine Gentoo's Wine Wiki Page]</div>Lesmanahttps://wiki.archlinux.org/index.php?title=NetworkManager&diff=389985NetworkManager2015-08-04T16:52:10Z<p>Lesmana: /* Sharing internet connection over Wi-Fi */ added sharing internet connection over ethernet</p>
<hr />
<div>[[Category:Network managers]]<br />
[[cs:NetworkManager]]<br />
[[de:Networkmanager]]<br />
[[es:NetworkManager]]<br />
[[fr:NetworkManager]]<br />
[[it:NetworkManager]]<br />
[[ja:NetworkManager]]<br />
[[pt:NetworkManager]]<br />
[[ru:NetworkManager]]<br />
[[tr:NetworkManager]]<br />
[[zh-CN:NetworkManager]]<br />
{{Related articles start}}<br />
{{Related|Network configuration}}<br />
{{Related|Wireless network configuration}}<br />
{{Related|:Category:Network managers}}<br />
{{Related articles end}}<br />
[http://projects.gnome.org/NetworkManager/ NetworkManager] is a program for providing detection and configuration for systems to automatically connect to network. NetworkManager's functionality can be useful for both wireless and wired networks. For wireless networks, NetworkManager prefers known wireless networks and has the ability to switch to the most reliable network. NetworkManager-aware applications can switch from online and offline mode. NetworkManager also prefers wired connections over wireless ones, has support for modem connections and certain types of VPN. NetworkManager was originally developed by Red Hat and now is hosted by the [[GNOME]] project.<br />
<br />
{{Warning|By default, Wi-Fi passwords are stored in clear text. See section [[#Encrypted Wi-Fi passwords]]}}<br />
<br />
== Installation ==<br />
<br />
NetworkManager can be [[install]]ed with the package {{Pkg|networkmanager}}. Since version 1.0 it gained internal functionality for basic DHCP support. For full featured DHCP and if you require IPv6 support, {{Pkg|dhclient}} integrates it. <br />
<br />
{{Note|You must ensure that no other service that wants to configure the network is running; in fact, multiple networking services will conflict. You can find a list of the currently running services with {{ic|1=systemctl --type=service}} and then [[stop]] them. See [[#Configuration]] to enable the NetworkManager service.}}<br />
<br />
=== VPN support ===<br />
<br />
NetworkManager VPN support is based on a plug-in system. If you need VPN support via NetworkManager, you have to install one of the following packages:<br />
<br />
* {{Pkg|networkmanager-openconnect}}<br />
* {{Pkg|networkmanager-openvpn}}<br />
* {{Pkg|networkmanager-pptp}}<br />
* {{Pkg|networkmanager-vpnc}}<br />
* {{AUR|networkmanager-l2tp}}<br />
<br />
=== PPPoE / DSL support ===<br />
<br />
[[Install]] {{pkg|rp-pppoe}} for PPPoE / DSL connection support.<br />
<br />
== Graphical front-ends ==<br />
<br />
To configure and have easy access to NetworkManager, most users will want to install an applet. This GUI front-end usually resides in the system tray (or notification area) and allows network selection and configuration of NetworkManager. Various applets exist for different types of desktops.<br />
<br />
=== GNOME ===<br />
<br />
[[GNOME]]'s {{Pkg|network-manager-applet}} works in all environments.<br />
<br />
To store authentication details for connections (Wireless/DSL) install and configure [[GNOME Keyring]].<br />
<br />
Be aware that after enabling the tick-box option {{ic|Make available to other users}} for a connection, NetworkManager stores the password in plain-text, though the respective file is accessible only to root (or other users via {{ic|nm-applet}}). See [[#Encrypted Wi-Fi passwords]].<br />
<br />
=== KDE ===<br />
<br />
==== Plasma 4 ====<br />
<br />
Install {{Pkg|kdeplasma-applets-plasma-nm}} applet.<br />
<br />
{{Note|The older KNetworkManager is available in the {{AUR|kdeplasma-applets-networkmanagement}} package, but is considered as legacy.}}<br />
<br />
Activate the applet in the KDE Plasma [https://userbase.kde.org/Plasma/SystemTray System Tray]: right click somewhere in the System Tray outside of the service icons, then in the Display page, activate the network management checkbox. The applet can allow you to store encrypted WiFi passwords in [[KDE Wallet]] and will prompt you to do this. As for GNOME, enabling {{ic|all users may connect to this network}} for a connection lets NetworkManager store the password in plain text.<br />
<br />
If you have both the KDE Plasma widget and GNOME's {{ic|nm-applet}} installed and do not want to start {{ic|nm-applet}} when using KDE, add the following line to {{ic|~/.config/autostart/nm-applet.desktop}}:<br />
<br />
NotShowIn=KDE<br />
<br />
See [http://userbase.kde.org/NetworkManagement Userbase page] for more info.<br />
<br />
==== Plasma 5 ====<br />
<br />
[[pacman|Install]] the {{Pkg|plasma-nm}} applet.<br />
<br />
=== Xfce ===<br />
<br />
While {{Pkg|network-manager-applet}} works in [[Xfce]], but in order to see notifications, including error messages, {{ic|nm-applet}} needs an implementation of the Freedesktop desktop notifications specification (see the [http://www.galago-project.org/specs/notification/0.9/index.html Galapago Project]) to display them. To enable notifications install {{Pkg|xfce4-notifyd}}, a package that provides an implementation for the specification.<br />
<br />
Without such a notification daemon, {{ic|nm-applet}} outputs the following errors to stdout/stderr:<br />
<br />
(nm-applet:24209): libnotify-WARNING **: Failed to connect to proxy<br />
** (nm-applet:24209): WARNING **: get_all_cb: couldn't retrieve<br />
system settings properties: (25) Launch helper exited with unknown<br />
return code 1.<br />
** (nm-applet:24209): WARNING **: fetch_connections_done: error<br />
fetching connections: (25) Launch helper exited with unknown return<br />
code 1.<br />
** (nm-applet:24209): WARNING **: Failed to register as an agent:<br />
(25) Launch helper exited with unknown return code 1<br />
<br />
{{ic|nm-applet}} will still work fine, though, but without notifications.<br />
<br />
If {{ic|nm-applet}} is not prompting for a password when connecting to new wifi networks, and is just disconnecting immediately, you may need to install {{Pkg|gnome-keyring}}. <br />
<br />
Should the applet not appear, install the {{AUR|xfce4-indicator-plugin}} package. [http://askubuntu.com/questions/449658/networkmanager-tray-nm-applet-is-gone-after-upgrade-to-14-04-trusty]<br />
<br />
=== Openbox ===<br />
<br />
To work properly in [[Openbox]], the GNOME applet requires the {{Pkg|xfce4-notifyd}} notification daemon for the same reason as in XFCE and the {{Pkg|gnome-icon-theme}} package to be able to display the applet in the systray.<br />
<br />
If you want to store authentication details (Wireless/DSL) install and configure [[gnome-keyring]].<br />
<br />
{{ic|nm-applet}} installs the autostart file at {{ic|/etc/xdg/autostart/nm-applet.desktop}}. If you have issues with it (e.g. {{ic|nm-applet}} is started twice or is not started at all), see [[Openbox#autostart]] or [https://bbs.archlinux.org/viewtopic.php?pid=993738] for solution.<br />
<br />
=== Other desktops and window managers ===<br />
<br />
In all other scenarios it is recommended to use the GNOME applet. You will also need to be sure that the {{Pkg|gnome-icon-theme}} package is installed to be able to display the applet.<br />
<br />
To store connection secrets install and configure [[GNOME Keyring]].<br />
<br />
In order to run {{ic|nm-applet}} without a systray, you can use {{Pkg|trayer}} or {{Pkg|stalonetray}}. For example, you can add a script like this one in your path:<br />
<br />
{{hc|nmgui|<nowiki><br />
#!/bin/sh<br />
nm-applet 2>&1 /dev/null &<br />
stalonetray 2>&1 /dev/null<br />
killall nm-applet<br />
</nowiki>}}<br />
<br />
When you close the ''stalonetray'' window, it closes {{ic|nm-applet}} too, so no extra memory is used once you are done with network settings.<br />
<br />
=== Command line ===<br />
The following applications can be useful for configuring and managing networks without X.<br />
<br />
==== nmcli ====<br />
<br />
A command line frontend, ''nmcli'', is included with {{Pkg|networkmanager}}.<br />
<br />
For usage information, see {{ic|man nmcli}}. Examples:<br />
<br />
* To connect to a wifi network: {{bc|nmcli dev wifi connect <name> password <password>}}<br />
* To connect to a wifi on the {{ic|wlan1}} wifi interface: {{bc|nmcli dev wifi connect <name> password <password> iface wlan1 [profile name]}}<br />
* To disconnect an interface: {{bc|nmcli dev disconnect iface eth0}}<br />
* To reconnect an interface marked as disconnected: {{bc|nmcli con up uuid <uuid>}}<br />
* To get a list of UUIDs: {{bc|nmcli con show}}<br />
* To see a list of network devices and their state: {{bc|nmcli dev}}<br />
* To turn off wifi: {{bc|nmcli r wifi off}}<br />
<br />
==== nmtui ====<br />
<br />
A curses based graphical frontend, ''nmtui'', is included with {{Pkg|networkmanager}}.<br />
<br />
For usage information, see {{ic|man nmtui}}.<br />
<br />
==== nmcli-dmenu ====<br />
<br />
Alternatively there is {{AUR|networkmanager-dmenu-git}} which is a small script to manage NetworkManager connections with ''dmenu'' instead of {{ic|nm-applet}}. It provides all essential features such as connect to existing NetworkManager wifi or wired connections, connect to new wifi connections, requests passphrase if required, connect to existing VPN connections, enable/disable networking, launch ''nm-connection-editor'' GUI.<br />
<br />
== Configuration ==<br />
<br />
NetworkManager will require some additional steps to be able run properly. Make sure you have configured {{ic|/etc/hosts}} as described in [[Network configuration#Set the hostname]] section.<br />
<br />
=== Enable NetworkManager ===<br />
<br />
NetworkManager is [[systemd#Using units|controlled]] via {{ic|NetworkManager.service}}. Once the NetworkManager daemon is started, it will automatically connect to any available "system connections" that have already been configured. Any "user connections" or unconfigured connections will need ''nmcli'' or an applet to configure and connect.<br />
<br />
NetworkManager has a global configuration file at {{ic|/etc/NetworkManager/NetworkManager.conf}}. Usually no configuration needs to be done to the global defaults. <br />
<br />
{{Note|1=NetworkManager will print meaningless warnings ({{Bug|34971}}) to your system log, when [[#Network services with NetworkManager dispatcher|NetworkManager-dispatcher.service]] and [https://www.archlinux.org/packages/?name=modemmanager ModemManager.service] are not enabled. You may enable both to suppress the messages.}}<br />
<br />
=== Enable NetworkManager Wait Online ===<br />
<br />
If you have services which fail if they are started before the network is up, you may use {{ic|NetworkManager-wait-online.service}} in addition to {{ic|NetworkManager.service}}. This is, however, rarely necessary because most networked daemons start up okay, even if the network has not been configured yet.<br />
<br />
In some cases, the service will still fail to start successfully on boot due to the timeout setting in {{ic|/usr/lib/systemd/system/NetworkManager-wait-online.service}} being too short. Change the default timeout from 30 to a higher value.<br />
<br />
=== Set up PolicyKit permissions ===<br />
<br />
See [[General troubleshooting#Session permissions]] for setting up a working session.<br />
<br />
With a working session, you have several options for granting the necessary privileges to NetworkManager:<br />
<br />
* ''Option 1.'' Run a [[Polkit]] authentication agent when you log in, such as {{ic|/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1}} (part of {{Pkg|polkit-gnome}}). You will be prompted for your password whenever you add or remove a network connection.<br />
* ''Option 2.'' [[Users and groups#Group management|Add]] yourself to the {{ic|wheel}} group. You will not have to enter your password, but your user account may be granted other permissions as well, such as the ability to use [[sudo]] without entering the root password.<br />
* ''Option 3.'' [[Users and groups#Group management|Add]] yourself to the {{ic|network}} group and create the following file:<br />
<br />
{{hc|/etc/polkit-1/rules.d/50-org.freedesktop.NetworkManager.rules|<nowiki><br />
polkit.addRule(function(action, subject) {<br />
if (action.id.indexOf("org.freedesktop.NetworkManager.") == 0 && subject.isInGroup("network")) {<br />
return polkit.Result.YES;<br />
}<br />
});<br />
</nowiki>}}<br />
<br />
: All users in the {{ic|network}} group will be able to add and remove networks without a password. This will not work under [[systemd]] if you do not have an active session with ''systemd-logind''.<br />
<br />
=== Network services with NetworkManager dispatcher ===<br />
<br />
There are quite a few network services that you will not want running until NetworkManager brings up an interface. Good examples are [[NTPd]] and network filesystem mounts of various types (e.g. '''netfs'''). NetworkManager has the ability to start these services when you connect to a network and stop them when you disconnect. To activate the feature you need to [[start]] the {{ic|NetworkManager-dispatcher.service}}.<br />
<br />
Once the feature is active, scripts can be added to the {{ic|/etc/NetworkManager/dispatcher.d}} directory. These scripts must be '''owned by root''', otherwise the dispatcher will not execute them. For added security, set group ownership to root as well:<br />
<br />
# chown root:root ''scriptname''<br />
<br />
Also, the script must have '''write permission for owner only''', otherwise the dispatcher will not execute them:<br />
<br />
# chmod 755 ''scriptname''<br />
<br />
The scripts will be run in alphabetical order at connection time, and in reverse alphabetical order at disconnect time. They receive two arguments: the name of the interface (e.g. {{ic|eth0}}) and the status (''up'' or ''down'' for interfaces and ''vpn-up'' or ''vpn-down'' for vpn connections). To ensure what order they come up in, it is common to use numerical characters prior to the name of the script (e.g. {{ic|10_portmap}} or {{ic|30_netfs}} (which ensures that the ''portmapper'' is up before NFS mounts are attempted).<br />
<br />
{{Warning|If you connect to foreign or public networks, be aware of what services you are starting and what servers you expect to be available for them to connect to. You could make a security hole by starting the wrong services while connected to a public network}}<br />
<br />
==== Avoiding the dispatcher timeout ====<br />
<br />
If the above is working, then this section is not relevant. However, there is a general problem related to running dispatcher scripts which take longer to be executed. Initially an internal timeout of three seconds only was used. If the called script did not complete in time, it was killed. Later the timeout was extended to about 20 seconds (see the [https://bugzilla.redhat.com/show_bug.cgi?id=982734 Bugtracker] for more information). If the timeout still creates the problem, a work around may be to modify the dispatcher service file {{ic|/usr/lib/systemd/system/NetworkManager-dispatcher.service}} to remain active after exit: <br />
<br />
{{hc|/etc/systemd/system/NetworkManager-dispatcher.service|2=<br />
.include /usr/lib/systemd/system/NetworkManager-dispatcher.service<br />
[Service]<br />
RemainAfterExit=yes}}<br />
<br />
Now start and enable the modified {{ic|NetworkManager-dispatcher}} service.<br />
<br />
{{Warning|Adding the {{ic|RemainAfterExit}} line to it will prevent the dispatcher from closing. Unfortunately, the dispatcher '''has''' to close before it can run your scripts again. With it the dispatcher will not time out but it also will not close, which means that the scripts will only run once per boot. Therefore, do not add the line unless the timeout is definitely causing a problem.}}<br />
<br />
==== Start OpenNTPD ====<br />
<br />
Install the {{Pkg|networkmanager-dispatcher-openntpd}} package.<br />
<br />
==== Mount remote folder with sshfs ====<br />
<br />
As the script is run in a very restrictive environment, you have to export {{ic|SSH_AUTH_SOCK}} in order to connect to your SSH agent. There are different ways to accomplish this, see [https://bbs.archlinux.org/viewtopic.php?pid=1042030#p1042030 this message] for more information. The example below works with [[GNOME Keyring]], and will ask you for the password if not unlocked already. In case NetworkManager connects automatically on login, it is likely ''gnome-keyring'' has not yet started and the export will fail (hence the sleep). The {{ic|UUID}} to match can be found with the command {{ic|nmcli con status}} or {{ic|nmcli con list}}. <br />
<br />
{{bc|<nowiki><br />
#!/bin/sh<br />
USER='username'<br />
REMOTE='user@host:/remote/path'<br />
LOCAL='/local/path'<br />
<br />
interface=$1 status=$2<br />
if [ "$CONNECTION_UUID" = "</nowiki>''uuid''<nowiki>" ]; then<br />
case $status in<br />
up)<br />
export SSH_AUTH_SOCK=$(find /tmp -maxdepth 1 -type s -user "$USER" -name 'ssh')<br />
su "$USER" -c "sshfs $REMOTE $LOCAL"<br />
;;<br />
down)<br />
fusermount -u "$LOCAL"<br />
;;<br />
esac<br />
fi<br />
</nowiki>}}<br />
<br />
==== Use dispatcher to connect to a VPN after a network connection is established ====<br />
<br />
In this example we want to connect automatically to a previously defined VPN connection after connecting to a specific Wi-Fi network. First thing to do is to create the dispatcher script that defines what to do after we are connected to the network.<br />
<br />
:1. Create the dispatcher script:<br />
<br />
{{hc|/etc/NetworkManager/dispatcher.d/vpn-up|<nowiki><br />
#!/bin/sh<br />
VPN_NAME="name of VPN connection defined in NetworkManager"<br />
ESSID="Wi-Fi network ESSID (not connection name)"<br />
<br />
interface=$1 status=$2<br />
case $status in<br />
up|vpn-down)<br />
if iwgetid | grep -qs ":\"$ESSID\""; then<br />
nmcli con up id "$VPN_NAME"<br />
fi<br />
;;<br />
down)<br />
if iwgetid | grep -qs ":\"$ESSID\""; then<br />
if nmcli con status id "$VPN_NAME" | grep -qs activated; then<br />
nmcli con down id "$VPN_NAME"<br />
fi<br />
fi<br />
;;<br />
esac<br />
</nowiki>}}<br />
<br />
If you would like to attempt to automatically connect to VPN for all Wi-Fi networks, you can use the following definition of the ESSID: {{ic|1=ESSID=$(iwgetid -r)}}. Remember to set the script's permissions [[#Network services with NetworkManager dispatcher|accordingly]]. <br />
<br />
If you require and tick the {{ic|nm-applet}} option to ''Make the VPN connection available to all users'', trying to connect may still fail and NetworkManager will complain about 'no valid VPN secrets', because of [http://developer.gnome.org/NetworkManager/0.9/secrets-flags.html the way VPN secrets are stored], which brings us to step 2:<br />
<br />
:2. Either edit the VPN connection configuration file to make NetworkManager store the secrets by itself rather than inside a keyring [https://bugzilla.redhat.com/show_bug.cgi?id=710552 that will be inaccessible for root]: open up {{ic|/etc/NetworkManager/system-connections/''name of your VPN connection''}} and change the {{ic|password-flags}} and {{ic|secret-flags}} from {{ic|1}} to {{ic|0}}.<br />
<br />
Alternatively put the password directly in the configuration file adding the section {{ic|vpn-secrets}}:<br />
<br />
[vpn]<br />
....<br />
password-flags=0<br />
<br />
[vpn-secrets]<br />
password=''your_password''<br />
<br />
{{Note|It may now be necessary to re-open the NetworkManager connection editor and save the VPN passwords/secrets again.}}<br />
<br />
==== Use dispatcher to handle mounting of CIFS shares ====<br />
<br />
Some CIFS shares are only available on certain networks or locations (e.g. at home). You can use the dispatcher to only mount CIFS shares that are present at your current location.<br />
<br />
The following script will check if we connected to a specific network and mount shares accordingly:<br />
{{hc|/etc/NetworkManager/dispatcher.d/mount_cifs|<nowiki><br />
#!/bin/bash<br />
if [ "$2" = "up" ]<br />
if [ "$CONNECTION_UUID" = "uuid" ]<br />
mount /your/mount/point & <br />
# add more shares as needed<br />
fi<br />
fi<br />
</nowiki>}}<br />
{{Note|You can get a list of uuids using [[#nmcli|nmcli]].}}<br />
<br />
The following script will unmount all CIFS before a disconnect from a specific network:<br />
{{hc|/etc/NetworkManager/dispatcher.d/pre-down.d/mount_cifs|<nowiki><br />
#!/bin/bash<br />
umount -a -l -t cifs<br />
</nowiki>}}<br />
{{Note|Make sure this script is located in the pre-down.d subdirectory as shown above, otherwise it will unmount all shares on any connection state change.}}<br />
{{Note|Ever since NetworkManager 0.9.8, the 'pre-down' and 'down' actions are not executed on shutdown or restart, so the above script will only work if you manually disconnect from the network. See [https://bugzilla.gnome.org/show_bug.cgi?id&#61;701242 this bug report] for more info.}}<br />
<br />
As before, do not forget to set the script permissions [[#Network services with NetworkManager dispatcher|accordingly]].<br />
<br />
See also [[NFS#NetworkManager dispatcher]] for another example script that parses {{ic|/etc/fstab}} mounts during dispatcher actions.<br />
<br />
=== Proxy settings ===<br />
<br />
NetworkManager does not directly handle proxy settings, but if you are using GNOME or KDE, you could use [http://marin.jb.free.fr/proxydriver/ proxydriver] wich handles proxy settings using NetworkManager's informations. proxydriver is found in the package {{AUR|proxydriver}}.<br />
<br />
In order for ''proxydriver'' to be able to change the proxy settings, you would need to execute this command, as part of the GNOME startup process (System -> Preferences -> Startup Applications):<br />
<br />
xhost +si:localuser:''your_username''<br />
<br />
See: [[Proxy settings]].<br />
<br />
=== Disable NetworkManager ===<br />
<br />
It might not be obvious, but the service automatically starts through ''dbus''. To completely disable it you can [[mask]] the services {{ic|NetworkManager}} and {{ic|NetworkManager-dispatcer}}.<br />
<br />
== Testing ==<br />
<br />
NetworkManager applets are designed to load upon login so no further configuration should be necessary for most users. If you have already disabled your previous network settings and disconnected from your network, you can now test if NetworkManager will work. The first step is to [[start]] {{ic|NetworkManager.service}}.<br />
<br />
Some applets will provide you with a {{ic|.desktop}} file so that the NetworkManager applet can be loaded through the application menu. If it does not, you are going to either have to discover the command to use or logout and login again to start the applet. Once the applet is started, it will likely begin polling network connections with for auto-configuration with a DHCP server.<br />
<br />
To start the GNOME applet in non-xdg-compliant window managers like [[awesome]]:<br />
<br />
nm-applet --sm-disable &<br />
<br />
For static IP addresses, you will have to configure NetworkManager to understand them. The process usually involves right-clicking the applet and selecting something like 'Edit Connections'.<br />
<br />
== Troubleshooting ==<br />
<br />
Some fixes to common problems.<br />
<br />
=== No prompt for password of secured Wi-Fi networks ===<br />
<br />
When trying to connect to a secured Wi-Fi network, no prompt for a password is shown and no connection is established. This happens when no keyring package is installed. An easy solution is to install {{Pkg|gnome-keyring}}. If you want the passwords to be stored in encrypted form, follow [[GNOME Keyring]] to set up the ''gnome-keyring-daemon''.<br />
<br />
=== No traffic via PPTP tunnel ===<br />
<br />
PPTP connection logins successfully; you see a ppp0 interface with the correct VPN IP address, but you cannot even ping the remote IP address. It is due to lack of MPPE (Microsoft Point-to-Point Encryption) support in stock Arch pppd. It is recommended to first try with the stock Arch {{Pkg|ppp}} as it may work as intended.<br />
<br />
To solve the problem it should be sufficient to install the {{AUR|ppp-mppe}} package.<br />
<br />
See also [[WPA2 Enterprise#MS-CHAPv2]].<br />
<br />
=== Network management disabled ===<br />
<br />
When NetworkManager shuts down but the pid (state) file is not removed, you will see a {{ic|Network management disabled}} message. If this happens, remove the file manually:<br />
<br />
# rm /var/lib/NetworkManager/NetworkManager.state<br />
<br />
=== Customizing resolv.conf ===<br />
<br />
See the main page: [[resolv.conf]]. If you use {{Pkg|dhclient}}, you may try the {{AUR|networkmanager-dispatch-resolv}} package.<br />
<br />
=== DHCP problems with dhclient ===<br />
<br />
If you have problems with getting an IP address via DHCP, try to add the following to your {{ic|/etc/dhclient.conf}}:<br />
<br />
interface "eth0" {<br />
send dhcp-client-identifier 01:aa:bb:cc:dd:ee:ff;<br />
}<br />
<br />
Where {{ic|aa:bb:cc:dd:ee:ff}} is the MAC address of this NIC. The MAC address can be found using the {{ic|ip link show ''interface''}} command from the {{Pkg|iproute2}} package.<br />
<br />
=== Hostname problems ===<br />
<br />
It depends on the NetworkManager plugins used, whether the hostname is forwarded to a router on connect. The generic "keyfile" plugin does not forward the hostname in default configuration. To make it forward the hostname, add the following to {{ic|/etc/NetworkManager/NetworkManager.conf}}:<br />
<br />
[keyfile]<br />
hostname=''your_hostname''<br />
<br />
The options under {{ic|[keyfile]}} will be applied to network connections in the default {{ic|/etc/NetworkManager/system-connections}} path. <br />
<br />
Another option is to configure the DHCP client, which NetworkManager starts automatically, to forward it. NetworkManager utilizes {{Pkg|dhclient}} in default and falls back to its internal DHCP funtionality, if the former is not installed. To make ''dhclient'' forward the hostname requires to set a non-default option, ''dhcpcd'' forwards the hostname by default. <br />
<br />
First, check which DHCP client is used (''dhclient'' in this example):<br />
<br />
{{hc|<nowiki># journalctl -b | egrep "dhc"</nowiki>|<br />
...<br />
Nov 17 21:03:20 zenbook dhclient[2949]: Nov 17 21:03:20 zenbook dhclient[2949]: Bound to *:546<br />
Nov 17 21:03:20 zenbook dhclient[2949]: Listening on Socket/wlan0<br />
Nov 17 21:03:20 zenbook dhclient[2949]: Sending on Socket/wlan0<br />
Nov 17 21:03:20 zenbook dhclient[2949]: XMT: Info-Request on wlan0, interval 1020ms.<br />
Nov 17 21:03:20 zenbook dhclient[2949]: RCV: Reply message on wlan0 from fe80::126f:3fff:fe0c:2dc.<br />
}}<br />
<br />
==== Configure dhclient to push the hostname to the DHCP server ====<br />
<br />
Copy the example configuration file:<br />
<br />
# cp /usr/share/dhclient/dhclient.conf.example /etc/dhclient.conf<br />
<br />
Take a look at the file - there will only really be one line we want to keep and ''dhclient'' will use it's defaults (as it has been using if you did not have this file) for the other options. This is the important line:<br />
<br />
{{hc|/etc/dhclient.conf|2=send host-name = pick-first-value(gethostname(), "ISC-dhclient");}}<br />
<br />
Force an IP address renewal by your favorite means, and you should now see your hostname on your DHCP server. <br />
<br />
==== Configure NetworkManager to use a specific DHCP client ====<br />
<br />
If you want to explicitly set the DHCP client used by NetworkManager, it can be set in the global configuration: <br />
<br />
{{hc|1=/etc/NetworkManager/NetworkManager.conf|2=dhcp=internal}}<br />
<br />
The alternative {{ic|1=dhcp=dhclient}} is used per default, if this option is not set. <br />
<br />
Then [[restart]] {{ic|NetworkManager.service}}.<br />
<br />
{{Note|1=Support for {{Pkg|dhcpcd}} has been [https://projects.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/networkmanager&id=a1df79cbcebaec0c043789eb31965e57d17b6cdb disabled] in {{Pkg|networkmanager}}-1.0.0-2 (2015-02-14).}}<br />
<br />
=== Missing default route ===<br />
<br />
On at least one KDE4 system, no default route was created when establishing wireless connections with NetworkManager. Changing the route settings of the wireless connection to remove the default selection "Use only for resources on this connection" solved the issue.<br />
<br />
=== 3G modem not detected ===<br />
<br />
See [[USB 3G Modem#Network Manager]].<br />
<br />
=== Switching off WLAN on laptops ===<br />
<br />
Sometimes NetworkManager will not work when you disable your Wi-Fi adapter with a switch on your laptop and try to enable it again afterwards. This is often a problem with ''rfkill''. [[Install]] the {{Pkg|rfkill}} package and use:<br />
<br />
$ watch -n1 rfkill list all<br />
<br />
to check if the driver notifies ''rfkill'' about the wireless adapter's status. If one identifier stays blocked after you switch on the adapter you could try to manually unblock it with (where X is the number of the identifier provided by the above output):<br />
<br />
# rfkill event unblock X<br />
<br />
=== Static IP address settings revert to DHCP ===<br />
<br />
Due to an unresolved bug, when changing default connections to a static IP address, {{ic|nm-applet}} may not properly store the configuration change, and will revert to automatic DHCP.<br />
<br />
To work around this issue you have to edit the default connection (e.g. "Auto eth0") in {{ic|nm-applet}}, change the connection name (e.g. "my eth0"), uncheck the "Available to all users" checkbox, change your static IP address settings as desired, and click '''Apply'''. This will save a new connection with the given name.<br />
<br />
Next, you will want to make the default connection not connect automatically. To do so, run {{ic|nm-connection-editor}} ('''not''' as root). In the connection editor, edit the default connection (e.g. "Auto eth0") and uncheck "Connect automatically". Click '''Apply''' and close the connection editor.<br />
<br />
=== Cannot edit connections as normal user ===<br />
<br />
See [[#Set up PolicyKit permissions]].<br />
<br />
=== Forget hidden wireless network ===<br />
<br />
Since hidden networks are not displayed in the selection list of the Wireless view, they cannot be forgotten (removed) with the GUI. You can delete one with the following command:<br />
<br />
# rm /etc/NetworkManager/system-connections/''SSID''<br />
<br />
This works for any other connection.<br />
<br />
=== VPN not working in GNOME ===<br />
<br />
When setting up OpenConnect or vpnc connections in NetworkManager while using GNOME, you will sometimes never see the dialog box pop up and the following error appears in {{ic|/var/log/errors.log}}:<br />
<br />
localhost NetworkManager[399]: <error> [1361719690.10506] [nm-vpn-connection.c:1405] get_secrets_cb(): Failed to request VPN secrets #3: (6) No agents were available for this request.<br />
<br />
This is caused by the GNOME NM Applet expecting dialog scripts to be at {{ic|/usr/lib/gnome-shell}}, when NetworkManager's packages put them in {{ic|/usr/lib/networkmanager}}.<br />
As a "temporary" fix (this bug has been around for a while now), make the following symlink(s):<br />
<br />
* For OpenConnect: {{ic|ln -s /usr/lib/networkmanager/nm-openconnect-auth-dialog /usr/lib/gnome-shell/}}<br />
* For VPNC (i.e. Cisco VPN): {{ic|ln -s /usr/lib/networkmanager/nm-vpnc-auth-dialog /usr/lib/gnome-shell/}}<br />
<br />
This may need to be done for any other NM VPN plugins as well, but these are the two most common.<br />
<br />
=== Unable to connect to visible European wireless networks ===<br />
<br />
WLAN chips are shipped with a default [[Wireless network configuration#Respecting the regulatory domain|regulatory domain]]. If your access point does not operate within these limitations, you will not be able to connect to the network. Fixing this is easy:<br />
<br />
# [[Install]] {{Pkg|crda}}<br />
# Uncomment the correct Country Code in {{ic|/etc/conf.d/wireless-regdom}}<br />
# Reboot the system, because the setting is only read on boot<br />
<br />
=== Automatic connect to VPN on boot is not working ===<br />
<br />
The problem occurs when the system (i.e. NetworkManager running as the root user) tries to establish a VPN connection, but the password is not accessible because it is stored in the Gnome keyring of a particular user. <br />
<br />
A solution is to keep the password to your VPN in plaintext, as described in step (2.) of [[#Use dispatcher to connect to a VPN after a network connection is established]]. <br />
<br />
You do not need to use the dispatcher described in step (1.) to auto-connect anymore, if you use the new "auto-connect VPN" option from the {{ic|nm-applet}} GUI.<br />
<br />
=== Systemd Bottleneck ===<br />
<br />
Over time the log files ({{ic|/var/log/journal}}) can become very large. This can have a big impact on boot performance when using NetworkManager, see: [[Systemd#Boot time increasing over time]].<br />
<br />
=== Regular network disconnects (WiFi) ===<br />
<br />
Some WiFi drivers have issues when scanning for base stations whilst connected/associated. Symptoms include VPN disconnects/reconnects and lost packets, web pages failing to load and then refresh fine.<br />
<br />
Running {{ic|journalctl -f}} will indicate that this is taking place, messages like the following will be contained in the logs at regular intervals.<br />
<br />
NetworkManager[410]: <info> (wlp3s0): roamed from BSSID 00:14:48:11:20:CF (my-wifi-name) to (none) ((none))<br />
<br />
There is a patched version of NetworkManager which should prevent this type of scanning: {{AUR|networkmanager-noscan}}.<br />
<br />
== Tips and tricks ==<br />
<br />
=== Encrypted Wi-Fi passwords ===<br />
<br />
By default, NetworkManager stores passwords in clear text in the connection files at {{ic|/etc/NetworkManager/system-connections/}}. To print the stored passwords, use the following command:<br />
<br />
# grep -H '^psk=' /etc/NetworkManager/system-connections/*<br />
<br />
The passwords are accessible to the root user in the filesystem and to users with access to settings via the GUI (e.g. {{ic|nm-applet}}). <br />
<br />
If it is preferable to save the passwords in encrypted form instead of clear text, this can be achieved by storing them in a keyring which NetworkManager then queries for the passwords. A suggested keyring daemon is [[GNOME Keyring]] or (for KDE specifically) [[KDE Wallet]]. The keyring daemon has to be started and the keyring needs to be unlocked for the following to work.<br />
<br />
Furthermore, NetworkManager needs to be configured not to store the password for all users. Using GNOME {{ic|nm-applet}}, run {{ic|nm-connection-editor}} from a terminal, select a network connection, click {{ic|Edit}}, select the {{ic|Wifi-Security}} tab and click on the right icon of password and check {{ic|Store the password for this user}}. Using KDE's {{Pkg|kdeplasma-applets-plasma-nm}}, click the applet, click on the top right {{ic|Settings}} icon, double click on a network connection, in the {{ic|General settings}} tab, untick {{ic|all users may connect to this network}}. If the option is ticked, the passwords will still be stored in clear text, even if a keyring daemon is running.<br />
<br />
If the option was selected previously and you un-tick it, you may have to use the {{ic|reset}} option first to make the password disappear from the file. Alternatively, delete the connection first and set it up again. <br />
<br />
The downside of using the keyring is that the connections have to be set up for each user.<br />
<br />
=== Sharing internet connection over Wi-Fi ===<br />
<br />
You can share your internet connection (e.g.: 3G or wired) with a few clicks using nm. You will need a supported Wi-Fi card (Cards based on Atheros AR9xx or at least AR5xx are probably best choice).<br />
<br />
==== Ad-hoc ====<br />
<br />
* [[Install]] the {{Pkg|dnsmasq}} package to be able to actually share the connection.<br />
* Custom {{ic|dnsmasq.conf}} may interfere with NetworkManager (not sure about this, but i think so).<br />
* Click on applet and choose "Create new wireless network".<br />
* Follow wizard (if using WEP, be sure to use 5 or 13 character long password, different lengths will fail).<br />
* Settings will remain stored for the next time you need it.<br />
<br />
==== Real AP ====<br />
<br />
Support of infrastructure mode (which is needed by Android phones as they intentionally do not support ad-hoc) is added by NetworkManager as of late 2012.<br />
<br />
See [https://fedoraproject.org/wiki/Features/RealHotspot Fedora's wiki].<br />
<br />
=== Sharing internet connection over Ethernet ===<br />
<br />
Scenario: your device has internet connection over wi-fi and you want to share the internet connection to other devices over ethernet.<br />
<br />
Requirements:<br />
* [[Install]] the {{Pkg|dnsmasq}} package to be able to actually share the connection.<br />
* You internet connected device and the other devices are connected over a suitable ethernet cable (this usually means a cross over cable or a switch in between).<br />
<br />
Steps:<br />
* Run {{ic|nm-connection-editor}} from terminal.<br />
* Add a new ethernet connection.<br />
* Give it some sensible name. For example "Shared Internet"<br />
* Go to "IPv4 Settings".<br />
* For "Method:" select "Shared to other computers".<br />
* Save<br />
<br />
Now you should have a new option "Shared Internet" under the Wired connections in NetworkManager.<br />
<br />
=== Checking if networking is up inside a cron job or script ===<br />
<br />
Some ''cron'' jobs require networking to be up to succeed. You may wish to avoid running these jobs when the network is down. To accomplish this, add an '''if''' test for networking that queries NetworkManager's ''nm-tool'' and checks the state of networking. The test shown here succeeds if any interface is up, and fails if they are all down. This is convenient for laptops that might be hardwired, might be on wireless, or might be off the network.<br />
<br />
{{bc|<nowiki><br />
if [ $(nm-tool|grep State|cut -f2 -d' ') == "connected" ]; then<br />
#Whatever you want to do if the network is online<br />
else<br />
#Whatever you want to do if the network is offline - note, this and the else above are optional<br />
fi<br />
</nowiki>}}<br />
<br />
This useful for a {{ic|cron.hourly}} script that runs ''fpupdate'' for the F-Prot virus scanner signature update, as an example. Another way it might be useful, with a little modification, is to differentiate between networks using various parts of the output from ''nm-tool''; for example, since the active wireless network is denoted with an asterisk, you could grep for the network name and then grep for a literal asterisk.<br />
<br />
=== Automatically unlock keyring after login ===<br />
<br />
==== GNOME ====<br />
<br />
# Right click on the {{ic|nm-applet}} icon in your panel and select Edit Connections and open the Wireless tab<br />
# Select the connection you want to work with and click the Edit button<br />
# Check the boxes “Connect Automatically” and “Available to all users”<br />
Log out and log back in to complete.<br />
<br />
{{Note|The following method is dated and known not to work on at least one machine!}}<br />
* In {{ic|/etc/pam.d/gdm}} (or your corresponding daemon in {{ic|/etc/pam.d}}), add these lines at the end of the "auth" and "session" blocks if they do not exist already: <br />
auth optional pam_gnome_keyring.so<br />
session optional pam_gnome_keyring.so auto_start<br />
<br />
* In {{ic|/etc/pam.d/passwd}}, use this line for the 'password' block:<br />
password optional pam_gnome_keyring.so<br />
<br />
:Next time you log in, you should be asked if you want the password to be unlocked automatically on login.<br />
<br />
==== KDE ====<br />
<br />
{{Out of date|The described approach seems to be very old. pam_keyring is unmaintained and {{Aur|pam-keyring-tool}} has been flaged out of date since the end of 2012. See if the approach described on the [[KDE Wallet]] page helps you.}}<br />
<br />
{{Note|See https://wiki.gnome.org/Projects/GnomeKeyring/Pam/Manual for reference, and if you are using [[KDE]] with KDM, you can use {{AUR|pam-keyring-tool}}.}}<br />
<br />
Put a script like the following in {{ic|~/.kde4/Autostart}}:<br />
#!/bin/sh<br />
echo PASSWORD | /usr/bin/pam-keyring-tool --unlock --keyring=default -s<br />
Similar should work with Openbox, LXDE, etc.<br />
<br />
==== SLiM login manager ====<br />
<br />
See [[SLiM#SLiM and Gnome Keyring]].<br />
<br />
=== KDE and OpenConnect VPN with password authentication ===<br />
<br />
{{Pkg|kdeplasma-applets-plasma-nm}} now supports configuring username and password for OpenConnect VPN connections. Open your VPN connection, accept the certificate, and connection fields will appear. If not, see the instructions below. Now enter the correct username and password.<br />
<br />
==== Troubleshooting ====<br />
<br />
While you may type both values at connection time, {{Pkg|kdeplasma-applets-plasma-nm}} 0.9.3.2-1 and above are capable of retrieving OpenConnect username and password directly from KWallet.<br />
<br />
Open "KDE Wallet Manager" and look up your OpenConnect VPN connection under "Network Management|Maps". Click "Show values" and <br />
enter your credentials in key "VpnSecrets" in this form (replace ''username'' and ''password'' accordingly):<br />
<br />
form:main:username%SEP%''username''%SEP%form:main:password%SEP%''password''<br />
<br />
Next time you connect, username and password should appear in the "VPN secrets" dialog box.<br />
<br />
=== Ignore specific devices ===<br />
<br />
Sometimes it may be desired that NetworkManager ignores specific devices and does not try to configure addresses and routes for them.You can quickly and easily ignore devices by MAC or interface-name by using the following in {{ic|/etc/NetworkManager/NetworkManager.conf}}:<br />
[keyfile]<br />
unmanaged-devices=mac:00:22:68:1c:59:b1;mac:00:1E:65:30:D1:C4;interface-name:eth0<br />
After you have put this in, [[Daemon|restart]] NetworkManager, and you should be able to configure interfaces without NetworkManager altering what you have set.<br />
<br />
=== Enable DNS Caching ===<br />
<br />
{{Merge|dnsmasq#NetworkManager|should be covered only in one place}}<br />
<br />
DNS requests can be sped up by caching previous requests locally for subsequent lookup. NetworkManager has a plugin to enable DNS caching using dnsmasq, but it is not enabled in the default configuration. It is, however, easy to enable using the following instructions.<br />
<br />
Start by [[pacman|installing]] {{Pkg|dnsmasq}}. Then, edit {{ic|/etc/NetworkManager/NetworkManager.conf}} and add the following line under the {{ic|[main]}} section:<br />
<br />
dns=dnsmasq<br />
<br />
Now restart NetworkManager or reboot. NetworkManager will automatically start dnsmasq and add 127.0.0.1 to {{ic|/etc/resolv.conf}}. The actual DNS servers can be found in {{ic|/var/run/NetworkManager/dnsmasq.conf}}. You can verify dnsmasq is being used by doing the same DNS lookup twice with dig and verifying the server and query times.<br />
<br />
=== Enable IPv6 Privacy Extensions ===<br />
<br />
{{Merge|Ipv6#NetworkManager|Does not warrant a separated section}}<br />
<br />
NetworkManager does not honour the settings placed in {{ic|/etc/sysctl.d/40-ipv6.conf}} when following [[IPv6#Privacy extensions]]. This can be verified by running {{ic|$ ip -6 addr show [device]}} after rebooting: no {{ic|scope global '''temporary'''}} address appears.<br />
<br />
In order to enable IPv6 Privacy Extensions for NetworkManager-managed connections, edit as root the desired connection keyfile in {{ic|/etc/NetworkManager/system-connections/}} and append to its {{ic|[ipv6]}} section the key-value pair {{ic|1=ip6-privacy=2}}:<br />
{{hc|/etc/NetworkManager/system-connections/''example_connection''|2=<br />
...<br />
[ipv6]<br />
method=auto<br />
'''ip6-privacy=2'''<br />
}}<br />
[https://fedoraproject.org/wiki/Tools/NetworkManager/IPv6#IPv6_Privacy_Extensions Source: Fedora wiki]<br />
<br />
== See also ==<br />
<br />
* [http://blogs.gnome.org/dcbw/2015/02/16/networkmanager-for-administrators-part-1/ NetworkManager for Administrators Part 1]</div>Lesmana