https://wiki.archlinux.org/api.php?action=feedcontributions&user=Aaron+chen&feedformat=atom
ArchWiki - User contributions [en]
2024-03-29T06:19:50Z
User contributions
MediaWiki 1.41.0
https://wiki.archlinux.org/index.php?title=Desktop_entries_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=410029
Desktop entries (简体中文)
2015-11-24T14:52:18Z
<p>Aaron chen: </p>
<hr />
<div>{{DISPLAYTITLE:桌面配置项}}<br />
[[Category:简体中文]]<br />
[[Category:Package development]]<br />
[[en:Desktop entries]]<br />
[[ja:デスクトップエントリ]]<br />
{{Related articles start}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Desktop_entries|2015-11-24|409972}}<br />
<br />
桌面配置项(Desktop entries)是 [http://www.freedesktop.org/wiki/ freedesktop.org(自由桌面社区)] 制订的一个用于规范 [[Xorg]] 环境中程序运行行为的标准。它是一个配置文件,描述了某个应用程序如何被启动以及怎样在菜单中以图标形式出现。大部分桌面配置项是 {{ic|.desktop}} 和 {{ic|.directory}} 文件。本文将概述如何创建一个合规可用的桌面配置项,主要面向软件包发布者和维护者,但对软件开发者及其他人也会是有用的。<br />
<br />
桌面配置项大致分为三类:<br />
<br />
; 应用程序 : 指向某个应用程序的快捷方式<br />
; 链接 : 指向某个网址的链接<br />
; 目录 : 某个菜单项元数据的容器<br />
<br />
下列章节概述如何创建它们并使其生效。<br />
<br />
== 应用程序配置项 ==<br />
<br />
Desktop entries for applications, or {{ic|.desktop}} files, are generally a combination of meta information resources and a shortcut of an application. These files usually reside in {{ic|/usr/share/applications}} or {{ic|/usr/local/share/applications}} for applications installed system-wide, or {{ic|~/.local/share/applications}} for user-specific applications. User entries take precedence over system entries.<br />
<br />
=== 范例文件 ===<br />
<br />
Following is an example of its structure with additional comments. The example is only meant to give a quick impression, and does not show how to utilize all possible entry keys. The complete list of keys can be found in the [http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html freedesktop.org specification].<br />
<br />
[Desktop Entry]<br />
Type=Application # Indicates the type as listed above<br />
Version=1.0 # The version of the desktop entry specification to which this file complies<br />
Name=jMemorize # The name of the application<br />
Comment=Flash card based learning tool # A comment which can/will be used as a tooltip<br />
Path=/opt/jmemorise # The path to the folder in which the executable is run<br />
Exec=jmemorize # The executable of the application.<br />
Icon=jmemorize # The name of the icon that will be used to display this entry<br />
Terminal=false # Describes whether this application needs to be run in a terminal or not<br />
Categories=Education;Languages;Java; # Describes the categories in which this entry should be shown<br />
<br />
=== 关键字定义 ===<br />
<br />
All Desktop recognized desktop entries can be found [http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html on the freedesktop.org site].<br />
For example, the {{Ic|Type}} key defines three types of desktop entries: Application (type 1), Link (type 2) and Directory (type 3).<br />
<br />
* {{Ic|Version}} key does not stand for the version of the application, but for the version of the desktop entry specification to which this file complies.<br />
<br />
* {{Ic|Name}}, {{Ic|GenericName}} and {{Ic|Comment}} often contain redundant values in the form of combinations of them, like:<br />
<br />
Name=Pidgin Internet Messenger<br />
GenericName=Internet Messenger<br />
or<br />
Name=NoteCase notes manager<br />
Comment=Notes Manager<br />
<br />
This should be avoided, as it will only be confusing to users. The {{Ic|Name}} key should only contain the name, or maybe an abbreviation/acronym if available.<br />
<br />
* {{Ic|GenericName}} should state what you would generally call an application that does what this specific application offers (i.e. Firefox is a "Web Browser").<br />
* {{Ic|Comment}} is intended to contain any usefull additional information.<br />
<br />
==== 过时的内容 ====<br />
<br />
There are quite some keys that have become deprecated over time as the standard has matured. The best/simplest way is to use the tool {{Ic|desktop-file-validate}} which is part of the package {{Pkg|desktop-file-utils}}. To validate, run<br />
$ desktop-file-validate <your desktop file><br />
This will give you very verbose and useful warnings and error messages.<br />
<br />
== 图标 ==<br />
<br />
=== 通用图像格式 ===<br />
<br />
Here is a short overview of image formats commonly used for icons.<br />
<br />
{| class="wikitable" align="center"<br />
|+ Support for image formats for icons as specified by the [http://standards.freedesktop.org/icon-theme-spec/latest/ar01s02.html freedesktop.org standard].<br />
! Extension<br />
! Full Name and/or Description<br />
! Graphics Type<br />
! Container Format<br />
! Supported<br />
|-<br />
!align="left" | .[[wikipedia:Portable Network Graphics|png]]<br />
| Portable Network Graphics<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| bgcolor="red" | no<br />
| bgcolor="#00cc00"| yes<br />
|-<br />
!align="left" | .[[wikipedia:Scalable Vector Graphics|svg(z)]]<br />
| Scalable Vector Graphics<br />
| [[wikipedia:Vector graphics|Vector]]<br />
| bgcolor="red" | no<br />
| bgcolor="#66cc00"| yes (optional)<br />
|-<br />
!align="left" | .[[wikipedia:X PixMap|xpm]]<br />
| X PixMap<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| bgcolor="red" | no<br />
| bgcolor="yellow"| yes (deprecated)<br />
|-<br />
!align="left" | .[[wikipedia:Graphics Interchange Format|gif]]<br />
| Graphics Interchange Format<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| bgcolor="red" | no<br />
| bgcolor="red"| no<br />
|-<br />
!align="left" | .[[wikipedia:ICO (icon image file format)|ico]]<br />
| MS Windows Icon Format<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| bgcolor="#00cc00" | yes<br />
| bgcolor="red"| no<br />
|-<br />
!align="left" | .[[wikipedia:Apple Icon Image|icns]]<br />
| Apple Icon Image<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| bgcolor="#00cc00"| yes<br />
| bgcolor="red"| no<br />
|-<br />
|}<br />
<br />
=== 图标格式转换 ===<br />
<br />
If you stumble across an icon which is in a format that is not supported by the freedesktop.org standard (like ''gif'' or ''ico''), you can '''convert''' (which is part of the '''imagemagick''' package) it to a supported/recommended format, e.g.:<br />
$ convert <icon name>.gif <icon name>.png<br />
If you convert from a container format like ''ico'', you will get all images that were encapsulated in the ''ico'' file in the form ''<icon name>-<number>.png''.<br />
If you want to know the size of the image, or the number of images in a container file like ''ico'' you can use '''identify''' (also part of the '''imagemagick''' package)<br />
$ identify /usr/share/vlc/vlc48x48.ico<br />
/usr/share/vlc/vlc48x48.ico[0] ICO 32x32 32x32+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[1] ICO 16x16 16x16+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[2] ICO 128x128 128x128+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[3] ICO 48x48 48x48+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[4] ICO 32x32 32x32+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[5] ICO 16x16 16x16+0+0 8-bit DirectClass 84.3kb<br />
As you can see, the example ''ico'' file, although its name might suggest a single image of size 48x48, contains no less than 6 different sizes, of which one is even greater than 48x48, namely 128x128. And to give a bit of motivation on this subject, at the point of writing this section (2008-10-27), the 128x128 size was missing in the ''vlc'' package (0.9.4-2). So the next step would be to look at the vlc PKGBUILD and check whether this icon format was not in the source package to begin with (in that case we would inform the vlc developers), or whether this icon was somehow omitted from the Arch-specific package (in that case we can file a bug report at [https://bugs.archlinux.org/ the Arch Linux bug tracker]).<br />
(''Update:'' this bug has now been [https://bugs.archlinux.org/task/11923 fixed], so as you can see, your work will not be in vain.)<br />
<br />
=== Obtaining icons ===<br />
<br />
Although packages that already ship with a .desktop-file most certainly contain an icon or a set of icons, there is sometimes the case when a developer has not created a .desktop-file, but may ship icons, nonetheless. So a good start is to look for icons in the source package.<br />
You can i.e. first filter for the extension with '''find''' and then use '''grep''' to filter further for certain buzzwords like the package name, "icon", "logo", etc, if there are quite a lot of images in the source package.<br />
$ find /path/to/source/package -regex ".*\.\(svg\|png\|xpm\|gif\|ico\)$"<br />
If the developers of an application do not include icons in their source packages, the next step would be to search on their web sites.<br />
Some projects, like i.e. ''tvbrowser'' have an [http://enwiki.tvbrowser.org/index.php/Banners,_Logos_and_other_Promotion_Material artwork/logo page] where additional icons may be found. If a project is multi-platform, there may be the case that even if the linux/unix package does not come with an icon, the Windows package might provide one. If the project uses a [[wikipedia:Version control system|Version control system]] like CVS/SVN/etc. and you have some experience with it, you also might consider browsing it for icons.<br />
If everything fails, the project might simple have no icon/logo yet.<br />
<br />
== 工具 ==<br />
<br />
=== gendesk ===<br />
{{Pkg|gendesk}} started as an Arch Linux-specific tool for generating .desktop files by fetching the needed information directly from PKGBUILD files. Now it is a general tool that takes command-line arguments.<br />
<br />
Icons can be automatically downloaded from [http://openiconlibrary.sourceforge.net/ openiconlibrary], if available. (The source for icons can easily be changed in the future).<br />
<br />
==== 用法 ====<br />
<br />
* Add {{Ic|gendesk}} to makedepends<br />
<br />
* Start the {{Ic|prepare()}} function with:<br />
<br />
{{bc|gendesk --pkgname "$pkgname" --pkgdesc "$pkgdesc"}}<br />
<br />
* Alternatively, if an icon is already provided ($pkgname.png, for instance). The {{Ic|-n}} flag is for not downloading an icon or using the default icon. Example:<br />
<br />
{{bc|gendesk -n --pkgname "$pkgname" --pkgdesc "$pkgdesc"}}<br />
<br />
* {{Ic|$srcdir/$pkgname.desktop}}&nbsp;will be created and can be installed in the {{Ic|package()}} function with:<br />
<br />
{{bc|install -Dm644 "$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"}}<br />
<br />
* The icon can be installed with:<br />
<br />
{{bc|install -Dm644 "$pkgname.png" "$pkgdir/usr/share/pixmaps/$pkgname.png"}}<br />
<br />
* Use {{Ic|1=--name='Program Name'}} for choosing a name for the menu entry.<br />
<br />
* Use {{Ic|1=--exec='/opt/some_app/elf --with-ponies'}} for setting the exec field.<br />
<br />
* See the [https://github.com/xyproto/gendesk gendesk project] for more information.<br />
<br />
=== lsdsk ===<br />
<br />
The {{AUR|lsdsk}} bash script searching for content in "Categories" or "Exec", if "Categories" doesn't exist then it uses content of "Name". It's main purpose to get a quick overview in console of the available programs with their command lines and categories in *.desktop. It shows coloured existing base path defined in "DskPath" array.<br />
<br />
Examples<br />
# lsdsk<br />
# lsdsk game<br />
# lsdsk gtk<br />
<br />
=== fbrokendesktop ===<br />
<br />
The {{AUR|fbrokendesktop}} bash script using command "which" to detect broken Exec that points to not existing path. Without any parameters it uses preset folders in "DskPath" array. It shows only broken *.desktop with full path and filename that is missing.<br />
<br />
Examples<br />
<br />
# fbrokendesktop<br />
# fbrokendesktop /usr<br />
# fbrokendesktop /usr/share/apps/kdm/sessions/icewm.desktop<br />
<br />
== 提示与技巧 ==<br />
<br />
=== 隐藏桌面配置项 ===<br />
<br />
{{Tip|Desktop entries can be hidden by creating a symbolic link to {{ic|/dev/null}}. For example:<br />
$ ln -s /dev/null ~/.local/share/applications/''foo''.desktop<br />
}}<br />
<br />
Firstly, copy the desktop entry file in question to {{ic|~/.local/share/applications}} to avoid your changes being overwritten.<br />
<br />
Then, to hide the entry in all environments, open the desktop entry file in a text editor and add the following line: {{ic|NoDisplay&#61;true}}.<br />
<br />
To hide the entry in a specific desktop, add the following line to the desktop entry file: {{ic|NotShowIn&#61;''desktop-name''}}<br />
<br />
where ''desktop-name'' can be option such as ''GNOME'', ''Xfce'', ''KDE'' etc. A desktop entry can be hidden in more than desktop at once - simply separate the desktop names with a semi-colon.<br />
<br />
=== 自动启动 ===<br />
<br />
If you use an XDG-compliant desktop environment, such as GNOME or KDE, the desktop environment will automatically start [[Desktop entries|*.desktop]] files found in the following directories:<br />
<br />
* System-wide: {{ic|$XDG_CONFIG_DIRS/autostart/}} ({{ic|/etc/xdg/autostart/}} by default)<br />
:* GNOME also starts files found in {{ic|/usr/share/gnome/autostart/}}<br />
* User-specific: {{ic|$XDG_CONFIG_HOME/autostart/}} ({{ic|~/.config/autostart/}} by default)<br />
<br />
Users can override system-wide {{ic|*.desktop}} files by copying them into the user-specific {{ic|~/.config/autostart/}} folder.<br />
<br />
For an explanation of the desktop file standard refer to [http://standards.freedesktop.org/desktop-entry-spec/latest/ Desktop Entry Specification]. For a more specific description of directories used, [http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html Desktop Application Autostart Specification]. <br />
<br />
{{Note|This method is supported only by XDG-compliant desktop environments. Tools like {{AUR|dapper}}, {{pkg|dex}}, or {{AUR|fbautostart}} can be used to offer XDG autostart in unsupported desktop environments as long as some other autostart mechanism exists. Use the existing mechanism to start the xdg compliant autostart tool.}}<br />
<br />
== 参阅 ==<br />
<br />
* [[DeveloperWiki:Removal of desktop files]]<br />
* [[Wikipedia:.desktop|desktop wikipedia article]]<br />
* [http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html recognized desktop entry keys]<br />
* [http://freedesktop.org/wiki/Specifications/desktop-entry-spec freedesktop.org desktop entry specification]<br />
* [http://freedesktop.org/wiki/Specifications/icon-theme-spec freedesktop.org icon theme specification]<br />
* [http://freedesktop.org/wiki/Specifications/menu-spec freedesktop.org menu specification]<br />
* [http://freedesktop.org/wiki/Specifications/basedir-spec freedesktop.org basedir specification]<br />
* [http://freedesktop.org/wiki/Howto_desktop_files information for developers]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Desktop_entries_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=410028
Desktop entries (简体中文)
2015-11-24T14:51:08Z
<p>Aaron chen: /* 范例文件 */</p>
<hr />
<div>{{DISPLAYTITLE:桌面配置项}}<br />
[[Category:简体中文]]<br />
[[Category:Package development]]<br />
[[en:Desktop entries]]<br />
[[ja:デスクトップエントリ]]<br />
{{Related articles start}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Desktop_entries|2015-11-15|393808}}<br />
<br />
桌面配置项(Desktop entries)是 [http://www.freedesktop.org/wiki/ freedesktop.org(自由桌面社区)] 制订的一个用于规范 [[Xorg]] 环境中程序运行行为的标准。它是一个配置文件,描述了某个应用程序如何被启动以及怎样在菜单中以图标形式出现。大部分桌面配置项是 {{ic|.desktop}} 和 {{ic|.directory}} 文件。本文将概述如何创建一个合规可用的桌面配置项,主要面向软件包发布者和维护者,但对软件开发者及其他人也会是有用的。<br />
<br />
桌面配置项大致分为三类:<br />
<br />
; 应用程序 : 指向某个应用程序的快捷方式<br />
; 链接 : 指向某个网址的链接<br />
; 目录 : 某个菜单项元数据的容器<br />
<br />
下列章节概述如何创建它们并使其生效。<br />
<br />
== 应用程序配置项 ==<br />
<br />
Desktop entries for applications, or {{ic|.desktop}} files, are generally a combination of meta information resources and a shortcut of an application. These files usually reside in {{ic|/usr/share/applications}} or {{ic|/usr/local/share/applications}} for applications installed system-wide, or {{ic|~/.local/share/applications}} for user-specific applications. User entries take precedence over system entries.<br />
<br />
=== 范例文件 ===<br />
<br />
Following is an example of its structure with additional comments. The example is only meant to give a quick impression, and does not show how to utilize all possible entry keys. The complete list of keys can be found in the [http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html freedesktop.org specification].<br />
<br />
[Desktop Entry]<br />
Type=Application # Indicates the type as listed above<br />
Version=1.0 # The version of the desktop entry specification to which this file complies<br />
Name=jMemorize # The name of the application<br />
Comment=Flash card based learning tool # A comment which can/will be used as a tooltip<br />
Path=/opt/jmemorise # The path to the folder in which the executable is run<br />
Exec=jmemorize # The executable of the application.<br />
Icon=jmemorize # The name of the icon that will be used to display this entry<br />
Terminal=false # Describes whether this application needs to be run in a terminal or not<br />
Categories=Education;Languages;Java; # Describes the categories in which this entry should be shown<br />
<br />
=== 关键字定义 ===<br />
<br />
All Desktop recognized desktop entries can be found [http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html on the freedesktop.org site].<br />
For example, the {{Ic|Type}} key defines three types of desktop entries: Application (type 1), Link (type 2) and Directory (type 3).<br />
<br />
* {{Ic|Version}} key does not stand for the version of the application, but for the version of the desktop entry specification to which this file complies.<br />
<br />
* {{Ic|Name}}, {{Ic|GenericName}} and {{Ic|Comment}} often contain redundant values in the form of combinations of them, like:<br />
<br />
Name=Pidgin Internet Messenger<br />
GenericName=Internet Messenger<br />
or<br />
Name=NoteCase notes manager<br />
Comment=Notes Manager<br />
<br />
This should be avoided, as it will only be confusing to users. The {{Ic|Name}} key should only contain the name, or maybe an abbreviation/acronym if available.<br />
<br />
* {{Ic|GenericName}} should state what you would generally call an application that does what this specific application offers (i.e. Firefox is a "Web Browser").<br />
* {{Ic|Comment}} is intended to contain any usefull additional information.<br />
<br />
==== 过时的内容 ====<br />
<br />
There are quite some keys that have become deprecated over time as the standard has matured. The best/simplest way is to use the tool {{Ic|desktop-file-validate}} which is part of the package {{Pkg|desktop-file-utils}}. To validate, run<br />
$ desktop-file-validate <your desktop file><br />
This will give you very verbose and useful warnings and error messages.<br />
<br />
== 图标 ==<br />
<br />
=== 通用图像格式 ===<br />
<br />
Here is a short overview of image formats commonly used for icons.<br />
<br />
{| class="wikitable" align="center"<br />
|+ Support for image formats for icons as specified by the [http://standards.freedesktop.org/icon-theme-spec/latest/ar01s02.html freedesktop.org standard].<br />
! Extension<br />
! Full Name and/or Description<br />
! Graphics Type<br />
! Container Format<br />
! Supported<br />
|-<br />
!align="left" | .[[wikipedia:Portable Network Graphics|png]]<br />
| Portable Network Graphics<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| bgcolor="red" | no<br />
| bgcolor="#00cc00"| yes<br />
|-<br />
!align="left" | .[[wikipedia:Scalable Vector Graphics|svg(z)]]<br />
| Scalable Vector Graphics<br />
| [[wikipedia:Vector graphics|Vector]]<br />
| bgcolor="red" | no<br />
| bgcolor="#66cc00"| yes (optional)<br />
|-<br />
!align="left" | .[[wikipedia:X PixMap|xpm]]<br />
| X PixMap<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| bgcolor="red" | no<br />
| bgcolor="yellow"| yes (deprecated)<br />
|-<br />
!align="left" | .[[wikipedia:Graphics Interchange Format|gif]]<br />
| Graphics Interchange Format<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| bgcolor="red" | no<br />
| bgcolor="red"| no<br />
|-<br />
!align="left" | .[[wikipedia:ICO (icon image file format)|ico]]<br />
| MS Windows Icon Format<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| bgcolor="#00cc00" | yes<br />
| bgcolor="red"| no<br />
|-<br />
!align="left" | .[[wikipedia:Apple Icon Image|icns]]<br />
| Apple Icon Image<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| bgcolor="#00cc00"| yes<br />
| bgcolor="red"| no<br />
|-<br />
|}<br />
<br />
=== 图标格式转换 ===<br />
<br />
If you stumble across an icon which is in a format that is not supported by the freedesktop.org standard (like ''gif'' or ''ico''), you can '''convert''' (which is part of the '''imagemagick''' package) it to a supported/recommended format, e.g.:<br />
$ convert <icon name>.gif <icon name>.png<br />
If you convert from a container format like ''ico'', you will get all images that were encapsulated in the ''ico'' file in the form ''<icon name>-<number>.png''.<br />
If you want to know the size of the image, or the number of images in a container file like ''ico'' you can use '''identify''' (also part of the '''imagemagick''' package)<br />
$ identify /usr/share/vlc/vlc48x48.ico<br />
/usr/share/vlc/vlc48x48.ico[0] ICO 32x32 32x32+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[1] ICO 16x16 16x16+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[2] ICO 128x128 128x128+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[3] ICO 48x48 48x48+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[4] ICO 32x32 32x32+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[5] ICO 16x16 16x16+0+0 8-bit DirectClass 84.3kb<br />
As you can see, the example ''ico'' file, although its name might suggest a single image of size 48x48, contains no less than 6 different sizes, of which one is even greater than 48x48, namely 128x128. And to give a bit of motivation on this subject, at the point of writing this section (2008-10-27), the 128x128 size was missing in the ''vlc'' package (0.9.4-2). So the next step would be to look at the vlc PKGBUILD and check whether this icon format was not in the source package to begin with (in that case we would inform the vlc developers), or whether this icon was somehow omitted from the Arch-specific package (in that case we can file a bug report at [https://bugs.archlinux.org/ the Arch Linux bug tracker]).<br />
(''Update:'' this bug has now been [https://bugs.archlinux.org/task/11923 fixed], so as you can see, your work will not be in vain.)<br />
<br />
=== Obtaining icons ===<br />
<br />
Although packages that already ship with a .desktop-file most certainly contain an icon or a set of icons, there is sometimes the case when a developer has not created a .desktop-file, but may ship icons, nonetheless. So a good start is to look for icons in the source package.<br />
You can i.e. first filter for the extension with '''find''' and then use '''grep''' to filter further for certain buzzwords like the package name, "icon", "logo", etc, if there are quite a lot of images in the source package.<br />
$ find /path/to/source/package -regex ".*\.\(svg\|png\|xpm\|gif\|ico\)$"<br />
If the developers of an application do not include icons in their source packages, the next step would be to search on their web sites.<br />
Some projects, like i.e. ''tvbrowser'' have an [http://enwiki.tvbrowser.org/index.php/Banners,_Logos_and_other_Promotion_Material artwork/logo page] where additional icons may be found. If a project is multi-platform, there may be the case that even if the linux/unix package does not come with an icon, the Windows package might provide one. If the project uses a [[wikipedia:Version control system|Version control system]] like CVS/SVN/etc. and you have some experience with it, you also might consider browsing it for icons.<br />
If everything fails, the project might simple have no icon/logo yet.<br />
<br />
== 工具 ==<br />
<br />
=== gendesk ===<br />
{{Pkg|gendesk}} started as an Arch Linux-specific tool for generating .desktop files by fetching the needed information directly from PKGBUILD files. Now it is a general tool that takes command-line arguments.<br />
<br />
Icons can be automatically downloaded from [http://openiconlibrary.sourceforge.net/ openiconlibrary], if available. (The source for icons can easily be changed in the future).<br />
<br />
==== 用法 ====<br />
<br />
* Add {{Ic|gendesk}} to makedepends<br />
<br />
* Start the {{Ic|prepare()}} function with:<br />
<br />
{{bc|gendesk --pkgname "$pkgname" --pkgdesc "$pkgdesc"}}<br />
<br />
* Alternatively, if an icon is already provided ($pkgname.png, for instance). The {{Ic|-n}} flag is for not downloading an icon or using the default icon. Example:<br />
<br />
{{bc|gendesk -n --pkgname "$pkgname" --pkgdesc "$pkgdesc"}}<br />
<br />
* {{Ic|$srcdir/$pkgname.desktop}}&nbsp;will be created and can be installed in the {{Ic|package()}} function with:<br />
<br />
{{bc|install -Dm644 "$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"}}<br />
<br />
* The icon can be installed with:<br />
<br />
{{bc|install -Dm644 "$pkgname.png" "$pkgdir/usr/share/pixmaps/$pkgname.png"}}<br />
<br />
* Use {{Ic|1=--name='Program Name'}} for choosing a name for the menu entry.<br />
<br />
* Use {{Ic|1=--exec='/opt/some_app/elf --with-ponies'}} for setting the exec field.<br />
<br />
* See the [https://github.com/xyproto/gendesk gendesk project] for more information.<br />
<br />
=== lsdsk ===<br />
<br />
The {{AUR|lsdsk}} bash script searching for content in "Categories" or "Exec", if "Categories" doesn't exist then it uses content of "Name". It's main purpose to get a quick overview in console of the available programs with their command lines and categories in *.desktop. It shows coloured existing base path defined in "DskPath" array.<br />
<br />
Examples<br />
# lsdsk<br />
# lsdsk game<br />
# lsdsk gtk<br />
<br />
=== fbrokendesktop ===<br />
<br />
The {{AUR|fbrokendesktop}} bash script using command "which" to detect broken Exec that points to not existing path. Without any parameters it uses preset folders in "DskPath" array. It shows only broken *.desktop with full path and filename that is missing.<br />
<br />
Examples<br />
<br />
# fbrokendesktop<br />
# fbrokendesktop /usr<br />
# fbrokendesktop /usr/share/apps/kdm/sessions/icewm.desktop<br />
<br />
== 提示与技巧 ==<br />
<br />
=== 隐藏桌面配置项 ===<br />
<br />
{{Tip|Desktop entries can be hidden by creating a symbolic link to {{ic|/dev/null}}. For example:<br />
$ ln -s /dev/null ~/.local/share/applications/''foo''.desktop<br />
}}<br />
<br />
Firstly, copy the desktop entry file in question to {{ic|~/.local/share/applications}} to avoid your changes being overwritten.<br />
<br />
Then, to hide the entry in all environments, open the desktop entry file in a text editor and add the following line: {{ic|NoDisplay&#61;true}}.<br />
<br />
To hide the entry in a specific desktop, add the following line to the desktop entry file: {{ic|NotShowIn&#61;''desktop-name''}}<br />
<br />
where ''desktop-name'' can be option such as ''GNOME'', ''Xfce'', ''KDE'' etc. A desktop entry can be hidden in more than desktop at once - simply separate the desktop names with a semi-colon.<br />
<br />
=== 自动启动 ===<br />
<br />
If you use an XDG-compliant desktop environment, such as GNOME or KDE, the desktop environment will automatically start [[Desktop entries|*.desktop]] files found in the following directories:<br />
<br />
* System-wide: {{ic|$XDG_CONFIG_DIRS/autostart/}} ({{ic|/etc/xdg/autostart/}} by default)<br />
:* GNOME also starts files found in {{ic|/usr/share/gnome/autostart/}}<br />
* User-specific: {{ic|$XDG_CONFIG_HOME/autostart/}} ({{ic|~/.config/autostart/}} by default)<br />
<br />
Users can override system-wide {{ic|*.desktop}} files by copying them into the user-specific {{ic|~/.config/autostart/}} folder.<br />
<br />
For an explanation of the desktop file standard refer to [http://standards.freedesktop.org/desktop-entry-spec/latest/ Desktop Entry Specification]. For a more specific description of directories used, [http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html Desktop Application Autostart Specification]. <br />
<br />
{{Note|This method is supported only by XDG-compliant desktop environments. Tools like {{AUR|dapper}}, {{pkg|dex}}, or {{AUR|fbautostart}} can be used to offer XDG autostart in unsupported desktop environments as long as some other autostart mechanism exists. Use the existing mechanism to start the xdg compliant autostart tool.}}<br />
<br />
== 参阅 ==<br />
<br />
* [[DeveloperWiki:Removal of desktop files]]<br />
* [[Wikipedia:.desktop|desktop wikipedia article]]<br />
* [http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html recognized desktop entry keys]<br />
* [http://freedesktop.org/wiki/Specifications/desktop-entry-spec freedesktop.org desktop entry specification]<br />
* [http://freedesktop.org/wiki/Specifications/icon-theme-spec freedesktop.org icon theme specification]<br />
* [http://freedesktop.org/wiki/Specifications/menu-spec freedesktop.org menu specification]<br />
* [http://freedesktop.org/wiki/Specifications/basedir-spec freedesktop.org basedir specification]<br />
* [http://freedesktop.org/wiki/Howto_desktop_files information for developers]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Help:Style_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409294
Help:Style (简体中文)
2015-11-15T17:09:21Z
<p>Aaron chen: /* 不相关内容 */</p>
<hr />
<div>[[Category:Help (简体中文)]]<br />
[[en:Help:Style]]<br />
[[es:Help:Style]]<br />
[[it:Help:Style]]<br />
[[ru:Help:Style]]<br />
[[zh-tw:Help:Style]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Help:Style/Formatting and punctuation}}<br />
{{Related|Help:Style/White space}}<br />
{{Related|Help:Editing}}<br />
{{Related|Help:Reading}}<br />
{{Related|Help:Discussion}}<br />
{{Related|Help:Template}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Help:Style|2015-06-08|375324}}<br />
这些风格约定鼓励简约、有条理和视觉一致的文章。请在编辑 ArchWiki 时尽量遵守本文的指导。<br />
<br />
==文章页面==<br />
<br />
===标题===<br />
*标题应该[[Wikipedia:Letter case#Usage|首字母大写]], 例如应该使用 "Title for new page" 而不是 "Title for New Page"。如果单词是常见缩写的一部分,则应该使用大写,例如应该使用 "Advanced Linux Sound Architecture" 而不是 "Advanced Linux sound architecture". <br> 名称空间不是标题的一部分,应该使用"ArchWiki:Example article" 而不是 "ArchWiki:example article"。子页面名也应该首字母大写,应该使用 "My page/My subpage" 而不是"My pagee/my subpage".<br />
*默认情况下文章使用英文的单数形式命名,如果文章代表一类问题,则使用复数形式。<br />
*使用全名而不是缩写。如果您认为它们都很常见,可创建一个从缩写到全名的[[Help:Editing (简体中文)#重定向|重定向]] 。不要用括号包含缩写。<br />
*参见 [[Help:Article naming guidelines|文章命名指导]]。<br />
<br />
===布局===<br />
<br />
ArchWiki 上的文章应该分为两部分:'''前言'''和'''主体''',且主要遵循如下顺序: <br />
<br />
* 前言:由分类、[[Help:i18n|i18n]]、文章状态、概览和简介<br />
* 主体: 介绍、安装、配置、技巧、问题解决和更多内容<br />
<br />
*文章各部分的排列顺序应该为:<br />
#[[#特殊字段]] (可选)<br />
#[[#分类]]<br />
#[[#语言间链接]]<br />
#[[#文章状态模板]] (可选)<br />
#[[#相关文章]] (可选)<br />
#[[#前言或介绍]]<br />
#目录 (自动生成)<br />
#文章特有的部分<br />
<br />
=== 特殊字段 ===<br />
*[[mw:Help:Magic words|特殊字段]]会修改文章的显示方式,但并不会添加内容。这些字段应该位于文章的最开始,尤其是这两个:{{ic|<nowiki>{{DISPLAYTITLE:title}}</nowiki>}} 和 [[Template:Lowercase title]]。<br />
<br />
===分类===<br />
*每个文章至少应该属于一个分类。<br />
*一个文章可以属于多个分类,只要分类间没有包含关系。<br />
*分类必须放在文章的顶部,且在特殊字段之后。<br />
{{注意|这点和其它 MediaWiki 项目有时会不一样,后者经常把分类放在文章末尾。}}<br />
*分类与正文第一段(包括语言间链接)之间不要插入空格,否则会有多余的空白。<br />
*参见 [[Help:Category (简体中文)|文章分类]]。<br />
{{小贴士|<br />
*由于分类页面中,MediaWiki会把相同首字母的页面归到一栏中,对于中文标题的页面,会把每个起始汉字归到一类,导致页面很混乱。因此在为名称由中文起始的页面,添加分类时请同时添加汉语拼音的首字母,如官方安装指南可以添加如下分类:{{ic|<nowiki>[[Category:简体中文|G]]</nowiki>}},这样该页面就会归类到字母G一栏的最上方。<br />
*'''不要'''添加多个字母(如:{{ic|<nowiki>[[Category:简体中文|GFAZZN]]</nowiki>}}),否则会出现分类中中英文页面顺序混排的现象,使页面不便于查找。}}<br />
<br />
===语言间链接===<br />
* 如果文章有其他语言的翻译,必须在分类和正文第一段之间加上這些语言间链接。它们将显示在页面的左边。<br />
* 语言间链接和正文第一段之间不应该有空格,否则文章顶部会有多余的空白。<br />
* 除了在当前页面上添加其它语言间链接,您还需要在其它语言的页面上添加当前页面的语言间链接。<br />
* 每个语言的语言间链接应只能有一个。<br />
* 不要加入当前语言的语言间链接。<br />
* 语言间链接需要根据其语言标签,來按字母表顺序排列,不要按语言本身的正式名稱顺序排列。例如,{{ic|}} 就该排在 {{ic|}} 前面,哪怕 “Suomi” 就本来在 “Français” 之后。<br />
* 参见 [[Help:i18n (简体中文)|Help:i18n]] 和 [[Wikipedia:Help:Interlanguage links]].<br />
<br />
===文章状态模板===<br />
*[[Help:Template#Article_status_templates|文章状态模板]] 应放在分类(或语言间链接)和相关文章之间。<br />
*文章的某段落也可以使用文章状态模板。<br />
*每个状态模版都应该包含简要的说明。有必要时,可以在讨论页面加以讨论。<br />
<br />
===相关文章===<br />
*给出相关的文章列表<br />
*放在分类、语言间链接和文章状态模板之后。<br />
*通过组合模板 [[Template:Related articles start (简体中文)]], [[Template:Related]] 和 [[Template:Related articles end]] 实现。详情参阅这几个模板的页面。<br />
*可以使用 [[Template:Related2]] 给出需要显示的标题翻译.<br />
*如果文章较多,或者需要详细描述,请使用参阅段落。<br />
<br />
===前言或介绍===<br />
*描述文章的话题。<br> 不要自己给软件下评论,一般可以访问项目主页,使用作者自己的描述。[[MediaTomb]] 是一个范例。<br />
*放在第一段前面<br />
*不要另外加上 {{Ic|1===Introduction==}} 或 {{Ic|1===Preface==}} 说明:直接在第一段开始时写入即可。如果文章有足够多的段落,在前言和第一段直接会自动加入目录。<br />
*参见 [[Writing Article Introductions]]。<br />
<br />
===段落标题===<br />
*段落标题应该从第二级开始({{Ic|1===}}), 因为第一级已保留给文章标题用。<br />
*使用子标题时不要越级,就像二级标题下面必然是三级标题。<br />
*不要在标题上添加超链接,它们会破坏样式的一致性。<br> 同理,请不要使用任何 html 或 wiki 标记代码,包括 [[#代码格式]]。<br />
*参见 [[Effective Use of Headers]]。<br />
<br />
===代码格式===<br />
*使用 {{ic|<nowiki>{{ic|code}}</nowiki>}} 格式化要嵌入的微代码、文件名、命令名、变量名等。例如: <br> 在终端运行{{ic|sh ./hello_world.sh}}<br />
* 对于单行的代码 (命令行或者代码输出) 可以可以直接在行首加入空格,参考[[Help:Editing#Code]]. 示例:<br />
<br />
$ sh ./hello_world.sh<br />
<br />
Hello World<br />
<br />
*使用 {{ic|<nowiki>{{bc|code}}</nowiki>}} 格式化多行代码(命令行的输入或输出内容、文件内容) 例如:<br />
{{bc|#!/bin/sh<br />
<br />
# Demo<br />
echo "Hello World"}}<br />
*如果代码不长,代替 {{ic|<nowiki>{{bc|code}}</nowiki>}} (参见 [[Help:Editing (简体中文)|编辑帮助]])。<br />
*使用 {{ic|<nowiki>{{hc|input|output}}</nowiki>}} 能同时显示命令行及其输出,例如:<br />
{{hc|$ sh ./hello_world.sh|Hello World}}<br />
*需要显示文件内容时,可以使用 {{ic|<nowiki>{{hc|filename|content}}</nowiki>}} 明确内容属于哪个文件,例如:<br />
{{hc|~/hello_world.sh|<nowiki><br />
#!/bin/sh<br />
<br />
# Demo<br />
echo "Hello World"</nowiki>}}<br />
* 大段的代码,例如配置文件,可以考虑用 {{ic|...}} 略去无关的内容<br />
*关于模板的一些格式上的特殊处理,比如{{ic|1==}} 或 {{ic|<nowiki>|</nowiki>}},请阅读 [[Help:Template]]。<br />
<br />
===命令行文字===<br />
* 使用段落代码 ([[Template:bc]]) 时,需要提示符标注执行权限;使用 [[Template:ic]] 时不需要提示符,但是需要用文字明确指出需要的权限。<br />
*使用 {{Ic|$}} 作为一般用户权限命令的提示符;使用 {{Ic|#}} 作为 root 命令的提示符。{{注意|因为 {{Ic|#}} 也经常表示文本文件中的注释符号,所以经常要澄清是运行命令还是编辑文件,以避免不必要的误解。}}<br />
*引入命令的句子尽量以 {{Ic|:}} 结尾。<br />
*建议使用 {{Ic|# command}} 而不是 {{Ic|$ sudo command}}。<br />
*尽量少假设用户会使用 {{ic|[[sudo]]}} 或其它权限获取工具(例如 {{ic|gksu}}、{{ic|kdesu}})。<br />
*应该避免{{Ic|# sudo command}},唯一的例外是用{{Ic|sudo}}的{{Ic|-u}}选项修改用户,这时提示符可以与其它命令一致,默认使用{{Ic|$}}。<br />
*不要在一行命令的代码框里添加注释,例如{{Ic|# pacman -S foo #Install package foo}}就不好<br />
*代码行不要过长,请尽量换行。<br />
<br />
===文件编辑需求===<br />
*除非必要,请不要特别指定某编辑器(nano, vim, emacs, ...)。<br />
*除非必要,请不要使用隐晦复杂的编辑命令,就像 {{ic|$ echo -e "clear\nreset" >> ~/.bash_logout}} 应该写成这样:<br />
:将下行附加到 {{ic|~/.bash_logout}}:<br />
:{{bc|clear<br>reset}}<br />
<br />
===键盘按键===<br />
*表示按键的标准方法是使用 [[Template:Ic]] 模板。<br />
*字母键应该小写:{{ic|a}}. 大写字母用 {{ic|Shift+a}},不要使用 {{ic|Shift+A}} 或 {{ic|A}}。<br />
*表示按键组合的正确方法是使用 {{ic|+}} 号连接,不要增加额外空格,在一个模板中包含多个按键:{{ic|Ctrl+c}}. <br> 下面格式都应该避免使用:{{ic|Ctrl + c}}, {{ic|Ctrl}}+{{ic|c}}, {{ic|Ctrl-c}}。<br />
*特殊键的标准名称:<br />
**{{ic|Shift}} (不要用 {{ic|SHIFT}})<br />
**{{ic|Ctrl}} (不要用 {{ic|CTRL}} 或 {{ic|Control}})<br />
**{{ic|Alt}} (不要用 {{ic|ALT}})<br />
**{{ic|Super}} (不要用 {{ic|Windows}} 或 {{ic|Mod}})<br />
**{{ic|Enter}} (不要用 {{ic|ENTER}} 或 {{ic|Return}})<br />
**{{ic|Esc}} (不要用 {{ic|ESC}} 或 {{ic|Escape}})<br />
**{{ic|Space}} (不要用 {{ic|SPACE}})<br />
**{{ic|Backspace}}<br />
**{{ic|Tab}}<br />
**{{ic|Ins}} (不要用 {{ic|INS}} 或 {{ic|Insert}})<br />
**{{ic|Del}} (不要用 {{ic|DEL}} 或 {{ic|Delete}})<br />
**{{ic|Print Screen}}<br />
** {{ic|PageUp}}<br />
** {{ic|PageDown}}<br />
<br />
===软件包管理===<br />
====官方软件包====<br />
* 在示意要从官方软件仓库安装软件包时,请避免直接标出 pacman 命令。不仅简化内容(每个 Arch 用户都应该知道如何使用 [[pacman (简体中文)|pacman]])而且避免了 {{Ic|pacman -Sy package}} 之类的键误,以及 {{Ic|pacman -S package}} 和 {{Ic|pacman -Syu package}} 孰好孰坏的无谓争论。同理,也不要引入 pacman 前端或图形界面等。<br> 相反,请像这样简单地示范:安装说明应该使用: {{Ic|<nowiki>[[pacman (简体中文)|安装]] 软件包 {{Pkg|package}}</nowiki>}}。<br />
* 如果安装的是一组软件包,则使用 : [[pacman (简体中文)|安装]] 软件组 {{Grp|foobar}}.<br />
* 必须要用 [[Template:Pkg]]/和[[Template:Grp]] 模板进行格式化,例如{{Ic|<nowiki>{{Pkg|package}}</nowiki>}}.<br />
* 在[[Beginners' Guide (简体中文)|新手指南]]中推荐使用 pacman 命令,新用户还不太熟练。<br />
*不要特意指出软件包是在 [core]、[extra] 或 [community] 中的哪一个仓库,因为一个软件包可能会在不同仓库之间转移。此外如果软件包位于 [multilib] 仓库,请这样示范:<br> <span style="margin:0 1em;">[[pacman (简体中文)|安装]][[Official repositories (简体中文)|官方软件仓库]]的 {{Pkg|package}} 时,需要事先开启 [[multilib]] 仓库。<br><br />
<br />
====AUR 软件包====<br />
*安装 AUR 软件包的语句安装{{Ic|<nowiki>[[Arch User Repository (简体中文)|AUR]] 中的 {{AUR|package}}</nowiki>}}。<br />
*可以适当修改以适应具体文章,但是一定要明确指出软件包并非官方支持。<br />
*千万不要直接示范如何安装 AUR 软件包:因为凡是安装非官方软件包的用户,都得事先充分阅读 [[Arch User Repository (简体中文)|Arch 用户仓库]],并了解使用这些包会给系统带来的风险。<br />
*AUR 软件包的超链接化应该使用 [[Template:AUR]] 模版,例如 {{Ic|<nowiki>{{AUR|package}}</nowiki>}}.<br />
<br />
====非官方软件仓库====<br />
*要使用非官方软件仓库时,请先将其加入[[Unofficial User Repositories|非官方软件仓库]],然后提供一个链接,示例:<br>从 [[Unofficial User Repositories#example|示例]] 软件仓库安装 {{AUR|package}}. <br> 不要在文章内直接给出启用软件仓库的详细信息。<br />
*必须链接到 [[Unofficial User Repositories|非官方软件仓库]],而且请尽量使用段落链接:{{ic|<nowiki>[[Unofficial User Repositories#example|example]]</nowiki>}}.<br />
<br />
===Systemd 单元操作===<br />
*不要用''systemctl'' 命令直接进行 ''start''、 ''restart'' 或 ''stop'' 的操作。正确的说明方法应该是列出需要的单元,以及它们的依赖、冲突关系,描述所要执行的操作。例如:<br />
:: 要在开机时启动 GDM,请 [[enable|启用]] {{ic|gdm.service}}.<br />
: 如果模板需要实例化:<br />
:: 要在无线时自动切换 ''netctl'' 配置,[[enable|启用]] 一个带接口名称的 {{ic|netctl-auto@.service}} 实例,例如 {{ic|netctl-auto@wlan0.service}}.<br />
: 可以根据上下文调整语句,但是请确保有到 [[systemd#Using units]] 文章段落的链接,可以直接引用或通过 [https://wiki.archlinux.org/index.php?title=Special:WhatLinksHere/Systemd&hidelinks=1&hidetrans=1 重定向] 实现,例如 {{ic|<nowiki>[[start]]</nowiki>}}, {{ic|<nowiki>[[enable]]</nowiki>}} or {{ic|<nowiki>[[stop]]</nowiki>}}.<br />
*[[Beginners' Guide (简体中文)|新手指南]] 同样毋须遵守该规范,建议直接使用''systemctl''。<br />
<br />
===注意, 警告, 技巧===<br />
<br />
*[[Template:注意|注意]] 应该用在用户预料不到的地方。包括与文章关系不大的细节知识、软件包名称变动等。<br> 也可以用来强调容易被用户忽略的地方。<br />
*[[Template:警告|警告]] 用来指出需要特别警惕的地方,比如不可逆转的修改、损害系统的可能性等。警告应该直接指出最坏的情况,并给出相应措施。不要滥用警告,如果不确定的时候,用注意即可。<br />
*[[Template:小贴士|小贴士]] 用来给出一个可能会相当有用的小技巧,一般不是必须的,省略也无妨。<br />
*如果多个注意、警告、技巧连用,最好组合到单一模板中,除非彼此毫无相干。例如:<br />
:{{小贴士|<br />
:*Tip example #1.<br />
:*Tip example #2.}}<br />
<br />
===Shells===<br />
*除非必要,不要特别指定用户所用的 shell:撰写文章内容时请尽量做到与所用 shell 无关。<br />
<br />
===超链接===<br />
* 尽可能在该页面和相关页面插入彼此的超链接,实现 wiki 脉络性最大化。<br />
* 像 [[Wikipedia:system call|系统调用]] 之类的文章 ArchWiki 却没有,大可直接用到 Wikipedia 页面的链接。<br />
* 链接到 wiki 中其它页面时,不要用完整地址,而是用 wiki 间链接语法:{{Ic|<nowiki>[[Wiki Article]]</nowiki>}}。 wiki 引擎可以跟踪 wiki 间链接,好让大家更容易维护。<br> 更多 wiki 间链接内容参见 [[Help:Editing (简体中文)#链接]]。<br />
* 请避免使用隐含链接,例如应该使用"参阅 [[systemd]]。" 而不是 "参阅 [[systemd|here]]".<br />
* 仅在文件存在时才创建链接,不要链接到不存在的文件。<br />
* 除极个别情况外,页面不能是死亡页面(没有任何到其它页面的链接)或孤立页面(没有其它文章链接到它).<br />
* 添加内容时,首先请注意是不是已经有现成的文章描述了该详细内容,如果有,请插入它的链接而不是再三重复内容。<br />
* 如果上游的现有文档十分完善且维护程度良好,请只写 Arch 应特有的内容,并再提供到前者文档的链接。<br />
* 不要在同一语言的链接中用 wiki 间链接,它们无法在 [[Special:WhatLinksHere]] 页面正确显示。例如在简体中文页面中不应该使用 {{ic|<nowiki>[[:zh-CN:Main Page]]</nowiki>}},而应该使用 {{ic|<nowiki>[[Main Page (简体中文)]]</nowiki>}}。<br> 在不同语言间则应该使用后者这样的链接,因为这样将他们移动到外部站点时会更加简单。<br> 注意这些链接和[[#语言间链接]]是不同的,语言间链接前面没有冒号。<br />
<br />
===代码规范===<br />
* 添加命令或脚本时,请保持代码风格一致,也可以参考该程序语言的主流编码规范,并加以遵守。<br />
* 避免使用过时的语言功能和风格,例如推荐使用 {{ic|$()}} 做脚本命令,而不是{{ic|``}}.<br />
<br />
===支持的内核版本===<br />
* Arch Wiki 支持的最老内核版本为 {{Pkg|linux-lts}} 和 [https://www.archlinux.org/download/ 安装介质]中的内核版本。<br />
* 仅可以删除比两个版本更老的内核说明或适配信息。<br />
<br />
==="提示与技巧" 段落===<br />
*高级技巧或使用软件的示例<br />
*标准标题应是 ''提示与技巧''<br />
*用子段落分别介绍不同的技巧<br />
<br />
==="问题解决" 段落===<br />
* 软件常见问题的解决办法(与 [[#"已知问题" 段落]] 不同)。<br />
* 标准标题是 ''问题解决''。<br />
* 可以提供绕过已知 bug 的临时解决方法,但是请务必提供该 bug 的链接地址;如果还未得到报告,请自行报告 bug,这样可以让它更容易被修复。<br> 增加 bug 链接对读者和编辑有如下好处:<br />
** 对读者来说,阅读该 Wiki 并非就到此为止了:他们还可以进一步访问链接,获取更多信息。<br />
** 对 Wiki 编辑来说,更好判断 bug 是否已经解决,容易维护;如果读者有得到新信息,他们也可以自主编辑。<br />
<br />
==="已知问题" 段落===<br />
* 已知的 bug 或者使用问题,暂时还没有解决方法(与[[#"问题解决" 段落]]相反)。<br />
* 标准标题是'''已知问题'''.<br />
* 如果这个问题已经报告了 bug,请提供链接;如果没有报告,请报告它,这样会提高问题解决的概率。<br />
<br />
==="参见" 段落===<br />
* 列出参考文档和额外信息.<br />
* 应该是个列表,每行都以 {{Ic|*}} 开头。<br />
* 一般使用 "参见" 作为标题,应该避免使用"外部链接","更多资源",“参阅” 等。<br />
<br />
===不相关内容===<br />
* 请不要署名,甚至把文章归功于自己:ArchWiki 是社区全体的劳动成果,文章的历史已能足够说明个人贡献。<br>直接在 wiki 之外的地方专门撰文、并提供链接也不失为署名的好办法,可以通过 "参见" 段落实现。<br />
* 一般用户没有上传文件的权限,而且不能用图片。作为替代,可以靠外部链接或者用 ASCII 编辑器,如[http://www.asciiflow.com/ Asciiflow] 等绘制简单图形。原因:<br />
**维护性: Arch 是滚动更新的,图片会大幅度地提高维护文章的难度。<br />
**必要性: Arch 之道注定了它并不会开发或维护 GUI,所以没有显示图片的必要。<br />
**资源性: 允许自行上传图片,会需要更多的精力来删除重复和不合适的图片。<br />
**可行性: 有一些用户的网速很慢,纯文字页面不光能其加快访问速度<br />
**效率性: 图片会剧烈消耗服务器的带宽和存储空间。<br />
**简约性: 且界面简约美观。<br />
<br />
===措辞===<br />
* 文章的措辞应做到十分正式、专业且精确。<br />
* 编写时,请注意不光说'''怎么样''',还要回答'''为什么?''' 解释远胜单纯的指导。<br />
* 尽量避免不必要的缩写词。<br />
* 不要加入个人评论,后者应该放到讨论页面,一般不要用第一人称。<br />
* 不要说现在,当前等等,请给出具体的时间。<br />
<br />
==分类页面==<br />
*除了根分类外,每个分类都应该有一个父分类。<br>根分类是 [[:Category:DeveloperWiki]], [[:Category:Languages]] 和 [[:Category:Sandbox]].<br />
*分类可以属于多个父分类,只要父分类之间是平级的。<br />
*避免循环关系: 两个分类不能互相包含。<br />
*分类必须放到在分类页面的顶部。<br />
*分类不能被重定向。<br />
<br />
==重定向页面==<br />
*重定向页面应该只包含重定向链接,除此之外一无所有。<br />
*只重定向到 Wiki 内部的页面,不要重定向到外部页面。<br />
<br />
==用户页面==<br />
*用户页面不能被分类(除非极个别管理员允许的特例)。<br />
*[https://wiki.archlinux.org/index.php?title=Special%3APrefixIndex&prefix=&namespace=2 用户]名称空间中的文章只能链接字用户或者讨论名称空间,除非管理员明确同意。<br />
<br />
==一般规则==<br />
===编辑摘要===<br />
请阅读[[ArchWiki:Contributing_(简体中文)#三个基本原则|Wiki 贡献的基本原则]].<br />
<br />
===HTML 标签===<br />
*尽量不要使用 HTML 标签:尽量使用 wiki 标记和模板,参见 [[Help:Editing (简体中文)]]。<br />
*使用 {{ic|<nowiki><pre>code</pre></nowiki>}} 的地方都改成 {{ic|<nowiki>{{bc|code}}</nowiki>}}。使用 {{ic|<nowiki><tt>text</tt></nowiki>}} 或 {{ic|<nowiki><code>text</code></nowiki>}} 的地方,都改用 {{ic|<nowiki>{{ic|text}}</nowiki>}}。<br />
*特别是避免 HTML 注释({{ic|<nowiki><!-- comment --></nowiki>}}): 一般使用 HTML 注释的文字都可以放到讨论页面。 <br> 可以加入适当的 [[Help:Template#Article_status_templates]]。<br />
*仅在必要时才使用 {{ic|<nowiki><br></nowiki>}}:要开启新段落时,用后面的空行实现。<br> 一个例外是作为一个列表的子项目时,或者在一个模板当中,这时必须使用{{ic|<nowiki><br></nowiki>}}换行。<br />
<br />
==中英文混排==<br />
<br />
{{注意|该原则自然只适用于 Arch Linux wiki 的 Chinese 条目}}<br />
<br />
* 英文和数字使用半角字符<br />
* 中文文字之间不加空格<br />
* 中文文字与英文、阿拉伯数字及 @ # $ % ^ & * . ( ) 等符号之间加空格<br />
* 中文标点之间不加空格<br />
* 中文标点与前后字符(无论全角或半角)之间不加空格<br />
* 如果括号内有中文,则使用中文括号,如果括号中的内容全部都是英文,则使用半角英文括号<br />
* 当半角符号 / 表示“或者”之意时,与前后的字符之间均不加空格</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Help:Style_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409293
Help:Style (简体中文)
2015-11-15T17:06:34Z
<p>Aaron chen: /* 官方软件包 */</p>
<hr />
<div>[[Category:Help (简体中文)]]<br />
[[en:Help:Style]]<br />
[[es:Help:Style]]<br />
[[it:Help:Style]]<br />
[[ru:Help:Style]]<br />
[[zh-tw:Help:Style]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Help:Style/Formatting and punctuation}}<br />
{{Related|Help:Style/White space}}<br />
{{Related|Help:Editing}}<br />
{{Related|Help:Reading}}<br />
{{Related|Help:Discussion}}<br />
{{Related|Help:Template}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Help:Style|2015-06-08|375324}}<br />
这些风格约定鼓励简约、有条理和视觉一致的文章。请在编辑 ArchWiki 时尽量遵守本文的指导。<br />
<br />
==文章页面==<br />
<br />
===标题===<br />
*标题应该[[Wikipedia:Letter case#Usage|首字母大写]], 例如应该使用 "Title for new page" 而不是 "Title for New Page"。如果单词是常见缩写的一部分,则应该使用大写,例如应该使用 "Advanced Linux Sound Architecture" 而不是 "Advanced Linux sound architecture". <br> 名称空间不是标题的一部分,应该使用"ArchWiki:Example article" 而不是 "ArchWiki:example article"。子页面名也应该首字母大写,应该使用 "My page/My subpage" 而不是"My pagee/my subpage".<br />
*默认情况下文章使用英文的单数形式命名,如果文章代表一类问题,则使用复数形式。<br />
*使用全名而不是缩写。如果您认为它们都很常见,可创建一个从缩写到全名的[[Help:Editing (简体中文)#重定向|重定向]] 。不要用括号包含缩写。<br />
*参见 [[Help:Article naming guidelines|文章命名指导]]。<br />
<br />
===布局===<br />
<br />
ArchWiki 上的文章应该分为两部分:'''前言'''和'''主体''',且主要遵循如下顺序: <br />
<br />
* 前言:由分类、[[Help:i18n|i18n]]、文章状态、概览和简介<br />
* 主体: 介绍、安装、配置、技巧、问题解决和更多内容<br />
<br />
*文章各部分的排列顺序应该为:<br />
#[[#特殊字段]] (可选)<br />
#[[#分类]]<br />
#[[#语言间链接]]<br />
#[[#文章状态模板]] (可选)<br />
#[[#相关文章]] (可选)<br />
#[[#前言或介绍]]<br />
#目录 (自动生成)<br />
#文章特有的部分<br />
<br />
=== 特殊字段 ===<br />
*[[mw:Help:Magic words|特殊字段]]会修改文章的显示方式,但并不会添加内容。这些字段应该位于文章的最开始,尤其是这两个:{{ic|<nowiki>{{DISPLAYTITLE:title}}</nowiki>}} 和 [[Template:Lowercase title]]。<br />
<br />
===分类===<br />
*每个文章至少应该属于一个分类。<br />
*一个文章可以属于多个分类,只要分类间没有包含关系。<br />
*分类必须放在文章的顶部,且在特殊字段之后。<br />
{{注意|这点和其它 MediaWiki 项目有时会不一样,后者经常把分类放在文章末尾。}}<br />
*分类与正文第一段(包括语言间链接)之间不要插入空格,否则会有多余的空白。<br />
*参见 [[Help:Category (简体中文)|文章分类]]。<br />
{{小贴士|<br />
*由于分类页面中,MediaWiki会把相同首字母的页面归到一栏中,对于中文标题的页面,会把每个起始汉字归到一类,导致页面很混乱。因此在为名称由中文起始的页面,添加分类时请同时添加汉语拼音的首字母,如官方安装指南可以添加如下分类:{{ic|<nowiki>[[Category:简体中文|G]]</nowiki>}},这样该页面就会归类到字母G一栏的最上方。<br />
*'''不要'''添加多个字母(如:{{ic|<nowiki>[[Category:简体中文|GFAZZN]]</nowiki>}}),否则会出现分类中中英文页面顺序混排的现象,使页面不便于查找。}}<br />
<br />
===语言间链接===<br />
* 如果文章有其他语言的翻译,必须在分类和正文第一段之间加上這些语言间链接。它们将显示在页面的左边。<br />
* 语言间链接和正文第一段之间不应该有空格,否则文章顶部会有多余的空白。<br />
* 除了在当前页面上添加其它语言间链接,您还需要在其它语言的页面上添加当前页面的语言间链接。<br />
* 每个语言的语言间链接应只能有一个。<br />
* 不要加入当前语言的语言间链接。<br />
* 语言间链接需要根据其语言标签,來按字母表顺序排列,不要按语言本身的正式名稱顺序排列。例如,{{ic|}} 就该排在 {{ic|}} 前面,哪怕 “Suomi” 就本来在 “Français” 之后。<br />
* 参见 [[Help:i18n (简体中文)|Help:i18n]] 和 [[Wikipedia:Help:Interlanguage links]].<br />
<br />
===文章状态模板===<br />
*[[Help:Template#Article_status_templates|文章状态模板]] 应放在分类(或语言间链接)和相关文章之间。<br />
*文章的某段落也可以使用文章状态模板。<br />
*每个状态模版都应该包含简要的说明。有必要时,可以在讨论页面加以讨论。<br />
<br />
===相关文章===<br />
*给出相关的文章列表<br />
*放在分类、语言间链接和文章状态模板之后。<br />
*通过组合模板 [[Template:Related articles start (简体中文)]], [[Template:Related]] 和 [[Template:Related articles end]] 实现。详情参阅这几个模板的页面。<br />
*可以使用 [[Template:Related2]] 给出需要显示的标题翻译.<br />
*如果文章较多,或者需要详细描述,请使用参阅段落。<br />
<br />
===前言或介绍===<br />
*描述文章的话题。<br> 不要自己给软件下评论,一般可以访问项目主页,使用作者自己的描述。[[MediaTomb]] 是一个范例。<br />
*放在第一段前面<br />
*不要另外加上 {{Ic|1===Introduction==}} 或 {{Ic|1===Preface==}} 说明:直接在第一段开始时写入即可。如果文章有足够多的段落,在前言和第一段直接会自动加入目录。<br />
*参见 [[Writing Article Introductions]]。<br />
<br />
===段落标题===<br />
*段落标题应该从第二级开始({{Ic|1===}}), 因为第一级已保留给文章标题用。<br />
*使用子标题时不要越级,就像二级标题下面必然是三级标题。<br />
*不要在标题上添加超链接,它们会破坏样式的一致性。<br> 同理,请不要使用任何 html 或 wiki 标记代码,包括 [[#代码格式]]。<br />
*参见 [[Effective Use of Headers]]。<br />
<br />
===代码格式===<br />
*使用 {{ic|<nowiki>{{ic|code}}</nowiki>}} 格式化要嵌入的微代码、文件名、命令名、变量名等。例如: <br> 在终端运行{{ic|sh ./hello_world.sh}}<br />
* 对于单行的代码 (命令行或者代码输出) 可以可以直接在行首加入空格,参考[[Help:Editing#Code]]. 示例:<br />
<br />
$ sh ./hello_world.sh<br />
<br />
Hello World<br />
<br />
*使用 {{ic|<nowiki>{{bc|code}}</nowiki>}} 格式化多行代码(命令行的输入或输出内容、文件内容) 例如:<br />
{{bc|#!/bin/sh<br />
<br />
# Demo<br />
echo "Hello World"}}<br />
*如果代码不长,代替 {{ic|<nowiki>{{bc|code}}</nowiki>}} (参见 [[Help:Editing (简体中文)|编辑帮助]])。<br />
*使用 {{ic|<nowiki>{{hc|input|output}}</nowiki>}} 能同时显示命令行及其输出,例如:<br />
{{hc|$ sh ./hello_world.sh|Hello World}}<br />
*需要显示文件内容时,可以使用 {{ic|<nowiki>{{hc|filename|content}}</nowiki>}} 明确内容属于哪个文件,例如:<br />
{{hc|~/hello_world.sh|<nowiki><br />
#!/bin/sh<br />
<br />
# Demo<br />
echo "Hello World"</nowiki>}}<br />
* 大段的代码,例如配置文件,可以考虑用 {{ic|...}} 略去无关的内容<br />
*关于模板的一些格式上的特殊处理,比如{{ic|1==}} 或 {{ic|<nowiki>|</nowiki>}},请阅读 [[Help:Template]]。<br />
<br />
===命令行文字===<br />
* 使用段落代码 ([[Template:bc]]) 时,需要提示符标注执行权限;使用 [[Template:ic]] 时不需要提示符,但是需要用文字明确指出需要的权限。<br />
*使用 {{Ic|$}} 作为一般用户权限命令的提示符;使用 {{Ic|#}} 作为 root 命令的提示符。{{注意|因为 {{Ic|#}} 也经常表示文本文件中的注释符号,所以经常要澄清是运行命令还是编辑文件,以避免不必要的误解。}}<br />
*引入命令的句子尽量以 {{Ic|:}} 结尾。<br />
*建议使用 {{Ic|# command}} 而不是 {{Ic|$ sudo command}}。<br />
*尽量少假设用户会使用 {{ic|[[sudo]]}} 或其它权限获取工具(例如 {{ic|gksu}}、{{ic|kdesu}})。<br />
*应该避免{{Ic|# sudo command}},唯一的例外是用{{Ic|sudo}}的{{Ic|-u}}选项修改用户,这时提示符可以与其它命令一致,默认使用{{Ic|$}}。<br />
*不要在一行命令的代码框里添加注释,例如{{Ic|# pacman -S foo #Install package foo}}就不好<br />
*代码行不要过长,请尽量换行。<br />
<br />
===文件编辑需求===<br />
*除非必要,请不要特别指定某编辑器(nano, vim, emacs, ...)。<br />
*除非必要,请不要使用隐晦复杂的编辑命令,就像 {{ic|$ echo -e "clear\nreset" >> ~/.bash_logout}} 应该写成这样:<br />
:将下行附加到 {{ic|~/.bash_logout}}:<br />
:{{bc|clear<br>reset}}<br />
<br />
===键盘按键===<br />
*表示按键的标准方法是使用 [[Template:Ic]] 模板。<br />
*字母键应该小写:{{ic|a}}. 大写字母用 {{ic|Shift+a}},不要使用 {{ic|Shift+A}} 或 {{ic|A}}。<br />
*表示按键组合的正确方法是使用 {{ic|+}} 号连接,不要增加额外空格,在一个模板中包含多个按键:{{ic|Ctrl+c}}. <br> 下面格式都应该避免使用:{{ic|Ctrl + c}}, {{ic|Ctrl}}+{{ic|c}}, {{ic|Ctrl-c}}。<br />
*特殊键的标准名称:<br />
**{{ic|Shift}} (不要用 {{ic|SHIFT}})<br />
**{{ic|Ctrl}} (不要用 {{ic|CTRL}} 或 {{ic|Control}})<br />
**{{ic|Alt}} (不要用 {{ic|ALT}})<br />
**{{ic|Super}} (不要用 {{ic|Windows}} 或 {{ic|Mod}})<br />
**{{ic|Enter}} (不要用 {{ic|ENTER}} 或 {{ic|Return}})<br />
**{{ic|Esc}} (不要用 {{ic|ESC}} 或 {{ic|Escape}})<br />
**{{ic|Space}} (不要用 {{ic|SPACE}})<br />
**{{ic|Backspace}}<br />
**{{ic|Tab}}<br />
**{{ic|Ins}} (不要用 {{ic|INS}} 或 {{ic|Insert}})<br />
**{{ic|Del}} (不要用 {{ic|DEL}} 或 {{ic|Delete}})<br />
**{{ic|Print Screen}}<br />
** {{ic|PageUp}}<br />
** {{ic|PageDown}}<br />
<br />
===软件包管理===<br />
====官方软件包====<br />
* 在示意要从官方软件仓库安装软件包时,请避免直接标出 pacman 命令。不仅简化内容(每个 Arch 用户都应该知道如何使用 [[pacman (简体中文)|pacman]])而且避免了 {{Ic|pacman -Sy package}} 之类的键误,以及 {{Ic|pacman -S package}} 和 {{Ic|pacman -Syu package}} 孰好孰坏的无谓争论。同理,也不要引入 pacman 前端或图形界面等。<br> 相反,请像这样简单地示范:安装说明应该使用: {{Ic|<nowiki>[[pacman (简体中文)|安装]] 软件包 {{Pkg|package}}</nowiki>}}。<br />
* 如果安装的是一组软件包,则使用 : [[pacman (简体中文)|安装]] 软件组 {{Grp|foobar}}.<br />
* 必须要用 [[Template:Pkg]]/和[[Template:Grp]] 模板进行格式化,例如{{Ic|<nowiki>{{Pkg|package}}</nowiki>}}.<br />
* 在[[Beginners' Guide (简体中文)|新手指南]]中推荐使用 pacman 命令,新用户还不太熟练。<br />
*不要特意指出软件包是在 [core]、[extra] 或 [community] 中的哪一个仓库,因为一个软件包可能会在不同仓库之间转移。此外如果软件包位于 [multilib] 仓库,请这样示范:<br> <span style="margin:0 1em;">[[pacman (简体中文)|安装]][[Official repositories (简体中文)|官方软件仓库]]的 {{Pkg|package}} 时,需要事先开启 [[multilib]] 仓库。<br><br />
<br />
====AUR 软件包====<br />
*安装 AUR 软件包的语句安装{{Ic|<nowiki>[[Arch User Repository (简体中文)|AUR]] 中的 {{AUR|package}}</nowiki>}}。<br />
*可以适当修改以适应具体文章,但是一定要明确指出软件包并非官方支持。<br />
*千万不要直接示范如何安装 AUR 软件包:因为凡是安装非官方软件包的用户,都得事先充分阅读 [[Arch User Repository (简体中文)|Arch 用户仓库]],并了解使用这些包会给系统带来的风险。<br />
*AUR 软件包的超链接化应该使用 [[Template:AUR]] 模版,例如 {{Ic|<nowiki>{{AUR|package}}</nowiki>}}.<br />
<br />
====非官方软件仓库====<br />
*要使用非官方软件仓库时,请先将其加入[[Unofficial User Repositories|非官方软件仓库]],然后提供一个链接,示例:<br>从 [[Unofficial User Repositories#example|示例]] 软件仓库安装 {{AUR|package}}. <br> 不要在文章内直接给出启用软件仓库的详细信息。<br />
*必须链接到 [[Unofficial User Repositories|非官方软件仓库]],而且请尽量使用段落链接:{{ic|<nowiki>[[Unofficial User Repositories#example|example]]</nowiki>}}.<br />
<br />
===Systemd 单元操作===<br />
*不要用''systemctl'' 命令直接进行 ''start''、 ''restart'' 或 ''stop'' 的操作。正确的说明方法应该是列出需要的单元,以及它们的依赖、冲突关系,描述所要执行的操作。例如:<br />
:: 要在开机时启动 GDM,请 [[enable|启用]] {{ic|gdm.service}}.<br />
: 如果模板需要实例化:<br />
:: 要在无线时自动切换 ''netctl'' 配置,[[enable|启用]] 一个带接口名称的 {{ic|netctl-auto@.service}} 实例,例如 {{ic|netctl-auto@wlan0.service}}.<br />
: 可以根据上下文调整语句,但是请确保有到 [[systemd#Using units]] 文章段落的链接,可以直接引用或通过 [https://wiki.archlinux.org/index.php?title=Special:WhatLinksHere/Systemd&hidelinks=1&hidetrans=1 重定向] 实现,例如 {{ic|<nowiki>[[start]]</nowiki>}}, {{ic|<nowiki>[[enable]]</nowiki>}} or {{ic|<nowiki>[[stop]]</nowiki>}}.<br />
*[[Beginners' Guide (简体中文)|新手指南]] 同样毋须遵守该规范,建议直接使用''systemctl''。<br />
<br />
===注意, 警告, 技巧===<br />
<br />
*[[Template:注意|注意]] 应该用在用户预料不到的地方。包括与文章关系不大的细节知识、软件包名称变动等。<br> 也可以用来强调容易被用户忽略的地方。<br />
*[[Template:警告|警告]] 用来指出需要特别警惕的地方,比如不可逆转的修改、损害系统的可能性等。警告应该直接指出最坏的情况,并给出相应措施。不要滥用警告,如果不确定的时候,用注意即可。<br />
*[[Template:小贴士|小贴士]] 用来给出一个可能会相当有用的小技巧,一般不是必须的,省略也无妨。<br />
*如果多个注意、警告、技巧连用,最好组合到单一模板中,除非彼此毫无相干。例如:<br />
:{{小贴士|<br />
:*Tip example #1.<br />
:*Tip example #2.}}<br />
<br />
===Shells===<br />
*除非必要,不要特别指定用户所用的 shell:撰写文章内容时请尽量做到与所用 shell 无关。<br />
<br />
===超链接===<br />
* 尽可能在该页面和相关页面插入彼此的超链接,实现 wiki 脉络性最大化。<br />
* 像 [[Wikipedia:system call|系统调用]] 之类的文章 ArchWiki 却没有,大可直接用到 Wikipedia 页面的链接。<br />
* 链接到 wiki 中其它页面时,不要用完整地址,而是用 wiki 间链接语法:{{Ic|<nowiki>[[Wiki Article]]</nowiki>}}。 wiki 引擎可以跟踪 wiki 间链接,好让大家更容易维护。<br> 更多 wiki 间链接内容参见 [[Help:Editing (简体中文)#链接]]。<br />
* 请避免使用隐含链接,例如应该使用"参阅 [[systemd]]。" 而不是 "参阅 [[systemd|here]]".<br />
* 仅在文件存在时才创建链接,不要链接到不存在的文件。<br />
* 除极个别情况外,页面不能是死亡页面(没有任何到其它页面的链接)或孤立页面(没有其它文章链接到它).<br />
* 添加内容时,首先请注意是不是已经有现成的文章描述了该详细内容,如果有,请插入它的链接而不是再三重复内容。<br />
* 如果上游的现有文档十分完善且维护程度良好,请只写 Arch 应特有的内容,并再提供到前者文档的链接。<br />
* 不要在同一语言的链接中用 wiki 间链接,它们无法在 [[Special:WhatLinksHere]] 页面正确显示。例如在简体中文页面中不应该使用 {{ic|<nowiki>[[:zh-CN:Main Page]]</nowiki>}},而应该使用 {{ic|<nowiki>[[Main Page (简体中文)]]</nowiki>}}。<br> 在不同语言间则应该使用后者这样的链接,因为这样将他们移动到外部站点时会更加简单。<br> 注意这些链接和[[#语言间链接]]是不同的,语言间链接前面没有冒号。<br />
<br />
===代码规范===<br />
* 添加命令或脚本时,请保持代码风格一致,也可以参考该程序语言的主流编码规范,并加以遵守。<br />
* 避免使用过时的语言功能和风格,例如推荐使用 {{ic|$()}} 做脚本命令,而不是{{ic|``}}.<br />
<br />
===支持的内核版本===<br />
* Arch Wiki 支持的最老内核版本为 {{Pkg|linux-lts}} 和 [https://www.archlinux.org/download/ 安装介质]中的内核版本。<br />
* 仅可以删除比两个版本更老的内核说明或适配信息。<br />
<br />
==="提示与技巧" 段落===<br />
*高级技巧或使用软件的示例<br />
*标准标题应是 ''提示与技巧''<br />
*用子段落分别介绍不同的技巧<br />
<br />
==="问题解决" 段落===<br />
* 软件常见问题的解决办法(与 [[#"已知问题" 段落]] 不同)。<br />
* 标准标题是 ''问题解决''。<br />
* 可以提供绕过已知 bug 的临时解决方法,但是请务必提供该 bug 的链接地址;如果还未得到报告,请自行报告 bug,这样可以让它更容易被修复。<br> 增加 bug 链接对读者和编辑有如下好处:<br />
** 对读者来说,阅读该 Wiki 并非就到此为止了:他们还可以进一步访问链接,获取更多信息。<br />
** 对 Wiki 编辑来说,更好判断 bug 是否已经解决,容易维护;如果读者有得到新信息,他们也可以自主编辑。<br />
<br />
==="已知问题" 段落===<br />
* 已知的 bug 或者使用问题,暂时还没有解决方法(与[[#"问题解决" 段落]]相反)。<br />
* 标准标题是'''已知问题'''.<br />
* 如果这个问题已经报告了 bug,请提供链接;如果没有报告,请报告它,这样会提高问题解决的概率。<br />
<br />
==="参见" 段落===<br />
* 列出参考文档和额外信息.<br />
* 应该是个列表,每行都以 {{Ic|*}} 开头。<br />
* 一般使用 "参见" 作为标题,应该避免使用"外部链接","更多资源",“参阅” 等。<br />
<br />
===不相关内容===<br />
* 请不要署名,甚至把文章归功于自己:ArchWiki 是社区全体的劳动成果,文章的历史已能足够说明个人贡献。<br>直接在 wiki 之外的地方专门撰文、并提供链接也不失为著名的好办法,可以通过 "参见" 段落实现。<br />
* 一般用户没有上传文件的权限,而且不能用图片。作为替代,可以靠外部链接或者用 ASCII 编辑器,如[http://www.asciiflow.com/ Asciiflow] 等绘制简单图形。原因:<br />
**维护性: Arch 是滚动更新的,图片会大幅度地提高维护文章的难度。<br />
**必要性: Arch 之道注定了它并不会开发或维护 GUI,所以没有显示图片的必要。<br />
**资源性: 允许自行上传图片,会需要更多的精力来删除重复和不合适的图片。<br />
**可行性: 有一些用户的网速很慢,纯文字页面不光能其加快访问速度<br />
**效率性: 图片会剧烈消耗服务器的带宽和存储空间。<br />
**简约性: 且界面简约美观。<br />
<br />
===措辞===<br />
* 文章的措辞应做到十分正式、专业且精确。<br />
* 编写时,请注意不光说'''怎么样''',还要回答'''为什么?''' 解释远胜单纯的指导。<br />
* 尽量避免不必要的缩写词。<br />
* 不要加入个人评论,后者应该放到讨论页面,一般不要用第一人称。<br />
* 不要说现在,当前等等,请给出具体的时间。<br />
<br />
==分类页面==<br />
*除了根分类外,每个分类都应该有一个父分类。<br>根分类是 [[:Category:DeveloperWiki]], [[:Category:Languages]] 和 [[:Category:Sandbox]].<br />
*分类可以属于多个父分类,只要父分类之间是平级的。<br />
*避免循环关系: 两个分类不能互相包含。<br />
*分类必须放到在分类页面的顶部。<br />
*分类不能被重定向。<br />
<br />
==重定向页面==<br />
*重定向页面应该只包含重定向链接,除此之外一无所有。<br />
*只重定向到 Wiki 内部的页面,不要重定向到外部页面。<br />
<br />
==用户页面==<br />
*用户页面不能被分类(除非极个别管理员允许的特例)。<br />
*[https://wiki.archlinux.org/index.php?title=Special%3APrefixIndex&prefix=&namespace=2 用户]名称空间中的文章只能链接字用户或者讨论名称空间,除非管理员明确同意。<br />
<br />
==一般规则==<br />
===编辑摘要===<br />
请阅读[[ArchWiki:Contributing_(简体中文)#三个基本原则|Wiki 贡献的基本原则]].<br />
<br />
===HTML 标签===<br />
*尽量不要使用 HTML 标签:尽量使用 wiki 标记和模板,参见 [[Help:Editing (简体中文)]]。<br />
*使用 {{ic|<nowiki><pre>code</pre></nowiki>}} 的地方都改成 {{ic|<nowiki>{{bc|code}}</nowiki>}}。使用 {{ic|<nowiki><tt>text</tt></nowiki>}} 或 {{ic|<nowiki><code>text</code></nowiki>}} 的地方,都改用 {{ic|<nowiki>{{ic|text}}</nowiki>}}。<br />
*特别是避免 HTML 注释({{ic|<nowiki><!-- comment --></nowiki>}}): 一般使用 HTML 注释的文字都可以放到讨论页面。 <br> 可以加入适当的 [[Help:Template#Article_status_templates]]。<br />
*仅在必要时才使用 {{ic|<nowiki><br></nowiki>}}:要开启新段落时,用后面的空行实现。<br> 一个例外是作为一个列表的子项目时,或者在一个模板当中,这时必须使用{{ic|<nowiki><br></nowiki>}}换行。<br />
<br />
==中英文混排==<br />
<br />
{{注意|该原则自然只适用于 Arch Linux wiki 的 Chinese 条目}}<br />
<br />
* 英文和数字使用半角字符<br />
* 中文文字之间不加空格<br />
* 中文文字与英文、阿拉伯数字及 @ # $ % ^ & * . ( ) 等符号之间加空格<br />
* 中文标点之间不加空格<br />
* 中文标点与前后字符(无论全角或半角)之间不加空格<br />
* 如果括号内有中文,则使用中文括号,如果括号中的内容全部都是英文,则使用半角英文括号<br />
* 当半角符号 / 表示“或者”之意时,与前后的字符之间均不加空格</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=ArchWiki:Translation_Team_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409292
ArchWiki:Translation Team (简体中文)
2015-11-15T16:53:02Z
<p>Aaron chen: /* 创建翻译 */</p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:ArchWiki (简体中文)]]<br />
[[ar:ArchWiki Translation Team]]<br />
[[el:ArchWiki Translation Team]]<br />
[[en:ArchWiki Translation Team]]<br />
[[es:ArchWiki Translation Team]]<br />
[[fr:ArchWiki Translation Team]]<br />
[[hr:ArchWiki Translation Team]]<br />
[[it:ArchWiki Translation Team]]<br />
[[ja:ArchWiki 翻訳チーム]]<br />
[[ko:ArchWiki Translation Team]]<br />
[[nl:ArchWiki Translation Team]]<br />
[[pl:ArchWiki Translation Team]]<br />
[[pt:ArchWiki Translation Team]]<br />
[[ru:ArchWiki Translation Team]]<br />
[[tr:ArchWiki Çeviri Ekibi]]<br />
Arch Wiki 上有许多中文页面,这些页面是无数中文志愿者劳动的结晶。随着时间推移,有些页面因为没有及时维护,内容严重过时。而目前的翻译工作缺少组织,效率偏低。所以参照西班牙和意大利翻译组的做法,添加这个页面。<br />
<br />
如果你希望对Arch Wiki做贡献,参与Wiki建设,比如翻译英文页面和对已翻译过的中文页面进行维护,只需要编辑下面的[[#页面维护列表]],添加相应的条目,并将自己加为相关页面的维护者。如果你在列表中还没有找到想要翻译的页面,可以自行添加。另外,如果因为时间原因无法再维护页面,请及时将自己从维护者列表中删除。<br />
<br />
== 创建翻译 ==<br />
{{注意|如果不准备翻译页面的大部分内容,请尽量不要新建简体中文页面。检查英文页面的更新需要花费不少精力,没有翻译的页面会增加维护负担。}}<br />
# 如果还不知道如何编辑 wiki,请阅读 [[Help:Editing (简体中文)|编辑帮助]]。<br />
# 阅读 [[Help:i18n (简体中文)|i18n帮助]],文章给出了 ArchWiki 国际化和本地化的指南。<br />
# [[Special:UserLogin |登录]] 以进行编辑。<br />
# 选择要翻译的页面,例如从 [[Special:Random|随机页面]] 或[[#页面维护列表 | 页面维护列表]] 中选择一个未翻译完成的页面。假设要翻译 [[Some Page]].<br />
# 进入选择的英文页面,点击页面顶部的 '''编辑'''。<br />
# 添加要翻译文件的语言间链接, 中文的话加入<nowiki>[[zh-CN:Some Page]]</nowiki>,其它语言参见[[Help:i18n#Interlanguage links]])。<br />
# 复制所有页面代码。<br />
# 保存页面 (新加了语言链接)<br />
# 访问页面左边新添加的语言链接,应该会进到 [[Some Page (简体中文)]] : {{ic|<nowiki>https://wiki.archlinux.org/index.php/Some_Page_(</nowiki>''简体中文'')}}<br />
# 因为页面不存在,点击 '''创建'''。<br />
# 将显示一个编辑器 - 粘贴复制的英文页面。<br />
# 将文章分类修改为本地化版本,例如将 {{ic|<nowiki>[[Category:Internationalization]]</nowiki>}} 修改为 {{ic|<nowiki>[[Category:Internationalization (简体中文)]]</nowiki>}},参阅[[Help:Category (简体中文)]].<br />
# 修改语言间链接,指向英文页面(将 {{ic|zh-CN}} 修改为 {{ic|en}},并将英文页面移到文章顶部。<br />
# 翻译页面,进行保存。<br />
# (推荐)给翻译完成的页面加上[[Template:TranslationStatus (简体中文)|翻译状态]],后有详细介绍。<br />
# 更新所有其它语言页面,加入刚翻译文章的语言间链接。<br />
# (可选)创建一个简体中文名称的页面,指向新创建的页面:访问 {{ic|<nowiki>https://wiki.archlinux.org/index.php/</nowiki>''页面的中文名称''}}.<br />
# (可选)建立新页面,并加入:{{bc|<nowiki>#REDIRECT [[Some Page (简体中文)</nowiki>]]}}<br />
<br />
== 完善翻译 ==<br />
[https://wiki.archlinux.org/index.php?title=Special:WhatLinksHere/Template:Translateme_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&limit=100 这个页面] 包含了需要完善翻译的简体中文页面。完善翻译的基本步骤:<br />
# 选择自己比较熟悉的文章进行翻译<br />
# 先检查英文页面的对应段落,更新成最新的英文后再翻译,避免翻译过时的内容,减少信息遗漏。<br />
# 翻译完成后删除页面中的 <nowiki>{{translateme (简体中文)}}</nowiki> 标记<br />
# (推荐)给翻译完成的页面加上[[Template:TranslationStatus (简体中文)|翻译状态]],后有详细介绍。<br />
<br />
== 更新过期页面 == <br />
如果发现有 Wiki 页面过期或错误:<br />
* 小的改动,有时间可以立即进行修改同步,维护者并不控制页面的编辑权限,越多的人参与维护越好。如果改动较大,请先联系维护者,避免重复劳动。<br />
* 没有时间查看更改,请给页面加上 {{ic|<nowiki>{{out of date}}</nowiki>}} 模版,这样其他贡献者更容易发现需要更新的页面,而读者看到过期标记就可以直接查看英文页面,以免被错误内容误导,白白耽误时间。<br />
* 没有时间翻译,请将过期的中文部分删去,从英文页面中复制更改的部分到中文页面的相应部分,去掉{{ic|<nowiki>{{out of date}}</nowiki>}}模板(如果页面上有的话)并加上{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他贡献者就更容易发现需要翻译的页面,而读者也不会被过期的内容误导。<br />
如果发现有页面未翻译:<br />
* 有时间的话,请将页面中的英文部分翻译为中文,并去掉{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板。<br />
* 没有时间翻译,请为页面添加{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他的贡献者就能更容易发现需要翻译的页面。<br />
{{注意|在修改页面上的模板时,请同时更新页面维护列表的翻译状态。}}<br />
<br />
== 贡献列表 ==<br />
为翻译做出贡献的用户请加入列表,感谢所有人做出的贡献。<br />
* [[User:Fengchao|Fengchao]] &ndash; [[Special:Contributions/Fengchao|贡献]] &ndash; [[Special:EmailUser/Fengchao|Send Email]] &ndash; [[ArchWiki:Administrators|ArchWiki Administrators]]<br />
* [[User:Skydiver|Skydiver]] &ndash; [[Special:Contributions/Skydiver|贡献]] &ndash; [[Special:EmailUser/Skydiver|Send Email]] &ndash; [[ArchWiki:Maintainers|ArchWiki Maintainers]]<br />
* [[User:Alswl|Alswl]] &ndash; [[Special:Contributions/Alswl|贡献]] &ndash; [[Special:EmailUser/Alswl|Send Email]]<br />
* [[User:Joshua83|Joshua]] &ndash; [[Special:Contributions/Joshua83|贡献]] &ndash; [[Special:EmailUser/Joshua83|Send Email]]<br />
* [[User:Reverland|Reverland]] &ndash; [[Special:Contributions/Reverland|贡献]] &ndash; [[Special:EmailUser/Reverland|Send Email]]<br />
* [[User:Cuihao|cuihao]] &ndash; [[Special:Contributions/Cuihao|贡献]] &ndash; [[Special:EmailUser/Cuihao|Send Email]]<br />
* [[User:Cael|Cael]] &ndash; [[Special:Contributions/Cael|贡献]] &ndash; [[Special:EmailUser/Cael|Send Email]]<br />
* [[User:Flockyrocky|Flockyrocky]] &ndash; [[Special:Contributions/Flockyrocky|贡献]] &ndash; [[Special:EmailUser/Flockyrocky|Send Email]]<br />
* [[User:Tuxzz|Tuxzz]] &ndash; [[Special:Contributions/Tuxzz|贡献]] &ndash; [[Special:EmailUser/Tuxzz|Send Email]]<br />
* [[User:Aaron_chen|Aaron_chen]] &ndash; [[Special:Contributions/Aaron_chen|贡献]] &ndash; [[Special:EmailUser/Aaron_chen|Send Email]]<br />
* [[User:Shibao Zhao|Shibao Zhao]] &ndash; [[Special:Contributions/Shibao Zhao|贡献]] &ndash; [[Special:EmailUser/Shibao Zhao|Send Email]]<br />
* [[User:Radflum|Yk]] &ndash; [[Special:Contributions/Radflum|贡献]] &ndash; [[Special:EmailUser/Radflum|Send Email]]<br />
* [[User:Hang yan|Hang yan]] &ndash; [[Special:Contributions/Hang yan|贡献]] &ndash; [[Special:EmailUser/Hang yan|Send Email]]<br />
* [[User:Acgtyrant|Acgtyrant]] &ndash; [[Special:Contributions/Acgtyrant|贡献]] &ndash; [[Special:EmailUser/Acgtyrant|Send Email]]<br />
* [[User:Xuchunyang|Xuchunyang]] &ndash; [[Special:Contributions/Acgtyrant|贡献]] &ndash; [[Special:EmailUser/Acgtyrant|Send Email]]<br />
* [[User:Stlt1sean|Stlt1sean]] &ndash; [[Special:Contributions/Stlt1sean|贡献]] &ndash; [[Special:EmailUser/Stlt1sean|Send Email]]<br />
* [[User:Carl_tw|Carl X. Su]] &ndash; [[Special:Contributions/Carl_tw|贡献]] &ndash; [[Special:EmailUser/Carl_tw|Send Email]]<br />
* [[User:SteamedFish|SteamedFish]] &ndash; [[Special:Contributions/SteamedFish|贡献]] &ndash; [[Special:EmailUser/SteamedFish|Send Email]]<br />
* [[User:Zer4tul|Zer4tul]] &ndash; [[Special:Contributions/Zer4tul|贡献]] &ndash; [[Special:EmailUser/Zer4tul|Send Email]]<br />
* [[User:Mac_uestc|Mac.Bloom]] &ndash; [[Special:Contributions/Mac_uestc|贡献]] &ndash; [[Special:EmailUser/Mac_uestc|Send Email]]<br />
* [[User:Zguangyu0000|Guangyu Zhang]] &ndash; [[Special:Contributions/Zguangyu0000|贡献]] &ndash; [[Special:EmailUser/Zguangyu0000|Send Email]]<br />
* [[User:Xinkai|Xinkai]] &ndash; [[Special:Contributions/Xinkai|贡献]] &ndash; [[Special:EmailUser/Xinkai|Send Email]]<br />
* [[User:Spaike97|_spaike97]] &ndash; [[Special:Contributions/Spaike97|贡献]] &ndash; [[Special:EmailUser/Spaike97|Send Email]]<br />
* [[User:jazzi|jazzi]] &ndash; [[Special:Contributions/jazzi|贡献]] &ndash; [[Special:EmailUser/jazzi|Send Email]]<br />
* [[User:HelloCode|HelloCode]] &ndash; [[Special:Contributions/HelloCode|贡献]] &ndash; [[Special:EmailUser/HelloCode|Send Email]]<br />
* [[User:Vimtoy|Vimtoy]] &ndash; [[Special:Contributions/Vimtoy|贡献]] &ndash; [[Special:EmailUser/Vimtoy|Send Email]]<br />
* [[User:Cfunc|Cfunc]] &ndash; [[Special:Contributions/Cfunc|贡献]] &ndash; [[Special:EmailUser/Cfunc|Send Email]]<br />
* [[User:Peter|Peter]] &ndash; [[Special:Contributions/Peter|贡献]] &ndash; [[Special:EmailUser/Peter|Send Email]]<br />
<br />
== 翻译任务 ==<br />
=== 模板 Article summary 变更为 Related ===<br />
因为 Summary 中的简介基本上和正文的介绍一样,所以页面左边的介绍栏进行了简化,只保留相关文章功能。英文页面正在进行大规模修改,相应的中文页面也需要同步更新。<br />
<br />
需要注意的地方:<br />
* 将第一行改成<br />
: <nowiki>{{Related articles start (简体中文)}}</nowiki><br />
* 如果英文的相关文章存在中文翻译,则替换为简体中文页面。示例:<br />
: <nowiki>{{Related2|Display Manager (简体中文)|显示管理器}}</nowiki><br />
* 示例:[https://wiki.archlinux.org/index.php?title=Start_X_at_Login&diff=0&oldid=270155 英文变更], [https://wiki.archlinux.org/index.php?title=Start_X_at_Login_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=285643&oldid=242662 对应的翻译]<br />
<br />
== 维护翻译 ==<br />
完成页面的翻译只是初步完成任务,及时同步英文页面改动、更新翻译是一个持续性的工作,可能会耗费更多的时间。<br />
<br />
=== 页面认领 ===<br />
所有人都可以认领页面。认领后的责任包括进行翻译,关注英文页面的改动,及时同步翻译。<br />
<br />
为了更好的跟踪英文页面的修改,请务必在设置中启用监视列表邮件通知,并监视对应的英文页面(从设置中找到监视列表,加入英文页面。或者直接到英文页面点击页面顶端的监视标签。这样只要有改动,就会收到邮件通知)。<br />
<br />
{{小贴士|如果收到邮件通知后没有访问页面或者访问了页面却没有登录用户,下次页面改动时就不会再发邮件通知。可以点击监视列表中的'''标记所有页面为已读'''再次获取更新。}}<br />
<br />
如果页面有维护者但长期得不到更新,将会在维护列表中删除维护者。<br />
<br />
=== 翻译状态模板 ===<br />
Arch 作为滚动发行版,软件变化比较快,对应的文档变化也比较快。许多翻译的文章由于缺乏更新,会产生命令运行出错或不起作用等问题。而由于这些过期页面没有及时标记出来,所以用户无法及时获得更新。[[Template:TranslationStatus (简体中文)|翻译状态模板]]就是为了解决这个问题而创建。<br />
<br />
此模板可以起到如下作用:<br />
* 为用户提供翻译状况,包括翻译时间、英文页面的最后版本等<br />
* 用户可以点击查看翻译后,英文页面的改动,这样英文不是很好的用户可以只查看很小一部分英文内容,并判断出是否影响操作。<br />
* 翻译人员可以跟踪页面状况,通过[https://wiki.archlinux.org/index.php/Special:WhatLinksHere/Template:TranslationStatus_(简体中文) 模板的反向链接]可以查找到所有标记页面,查看需要更新翻译的部分。<br />
<br />
[[Template:TranslationStatus (简体中文)|模板页面]]有详细的使用方法。<br />
<br />
=== 页面维护列表 ===<br />
{{注意|请按照拉丁字母顺序添加页面。}}<br />
<br />
翻译状态说明:<br />
;过期:页面内容未与英文页面同步,对应{{ic|<nowiki>{{out of date}}</nowiki>}} 模版<br />
;未翻译:页面中含有英文内容,对应{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板<br />
;完成:页面已与英文页面同步<br />
<br />
需要优先翻译的页面:<br />
<br />
{| class="wikitable sortable collapsible" border="1"<br />
|-<br />
! 页面<br />
! 翻译状态<br />
! 维护者<br />
! class="unsortable" width="30%" | 备注<br />
|-<br />
| [[acpid (简体中文)]]<br />
| 过期<br />
| Cael<br />
|-<br />
| [[Advanced Linux Sound Architecture (简体中文)]]<br />
| 翻译中<br />
| ihonliu<br />
| 无<br />
|-<br />
| [[Arch Based Distributions (Active) (简体中文)]]<br />
| 完成<br />
| Joshua<br />
| 勘误中<br />
|-<br />
| [[ATI (简体中文)]]<br />
| 完成<br />
| skysailing<br />
| 无<br />
|-<br />
| [[AUR Helpers (简体中文)]]<br />
| 进行中<br />
| Stonex<br />
| 无<br />
|-<br />
| [[awesome (简体中文)]]<br />
| 进行中<br />
| Cael<br />
| 无<br />
|-<br />
| [[BIND (简体中文)]]<br />
| 翻译中<br />
| SteamedFish<br />
| 无<br />
|-<br />
| [[Bumblebee (简体中文)]]<br />
| 完成<br />
| Peter<br />
| 无<br />
|-<br />
| [[AMD Catalyst (简体中文)]]<br />
| 过期<br />
| Shibao Zhao<br />
| 无<br />
|-<br />
| [[Chromium (简体中文)]]<br />
| 翻译中<br />
| Bobby<br />
| 部分未翻译 <br />
|-<br />
| [[Cinnamon (简体中文)]]<br />
| 部分翻译 <br />
| Bobby<br />
| 部分未翻译 <br />
|- <br />
| [[Common Applications (简体中文)]]<br />
| 部分翻译 <br />
| DavidChen<br />
| 翻译中<br />
|-<br />
| [[Common Applications/Science (简体中文)]]<br />
| drop maintain<br />
<br />
| 更新,翻译中<br />
|-<br />
| [[Compiz (简体中文)]]<br />
| 翻译中<br />
| xiii_1991<br />
| 20140813开始<br />
|-<br />
| [[Core Utilities (简体中文)]]<br />
| 翻译中<br />
| rentaro<br />
| 同步翻译至2014年7月23日08:13英文页面,完善中<br />
|-<br />
| [[Disk Cloning (简体中文)]]<br />
| 翻译中<br />
| _spaike97<br />
| 无<br />
|-<br />
| [[Emacs (简体中文)]]<br />
| 翻译中<br />
| Jaurung yuanhang<br />
| 未完成<br />
|-<br />
| [[File recovery (简体中文)]]<br />
| 翻译中<br />
| _spaike97<br />
| 无<br />
|-<br />
| [[Font Configuration (简体中文)]]<br />
| 翻译中<br />
| Jaurung<br />
| 完善中<br />
|-<br />
| [[Fonts (简体中文)]]<br />
| 翻译中<br />
| qqbzg<br />
| 无<br />
|-<br />
| [[LAMP (简体中文)]]<br />
| 完成<br />
| Liuzhengyi<br />
| 勘误中<br />
|-<br />
| [[LibreOffice (简体中文)]]<br />
| 完成<br />
| qqbzg<br />
| 勘误中<br />
|-<br />
| [[Local Mirror (简体中文)]]<br />
| 完成<br />
| Jason Zhang<br />
| 完善中<br />
|-<br />
| [[NetworkManager (简体中文)]]<br />
| 部分翻译 <br />
| Jack-lijing <br />
| 请优先翻译<br />
|-<br />
| [[Network Time Protocol daemon (简体中文)]]<br />
| 未翻译<br />
| 无<br />
| 部分未翻译<br />
|-<br />
| [[OpenOffice (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Opera (简体中文)]]<br />
| 未翻译<br />
| Bobby<br />
| 请优先翻译此文 <br />
|-<br />
| [[Pacman GUI Frontends (简体中文)]]<br />
| 翻译中<br />
| KaiYuan Guo<br />
| 无<br />
|-<br />
| [[Pidgin (简体中文)]]<br />
| 进行中<br />
| Cael<br />
| 无 <br />
|- <br />
| [[Plasma (简体中文)]]<br />
| 未翻译<br />
| 无<br />
| 无<br />
|-<br />
| [[ranger (简体中文)]]<br />
| 完成<br />
| Jason Zhang<br />
| 完善中<br />
|-<br />
| [[Reporting_Bug_Guidelines_(简体中文)]]<br />
| 翻译中<br />
| Jason Zhang<br />
| <br />
|-<br />
| [[Secure Shell (简体中文)]]<br />
| 完成<br />
| HelloCode<br />
| 完成<br />
|-<br />
| [[Smart Common Input Method platform (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-<br />
| [[Systemd-timesyncd (简体中文)]]<br />
| 完成<br />
| Peter<br />
|<br />
|-<br />
| [[Vim (简体中文)]]<br />
| 翻译中<br />
| fxstar1<br />
| 更新中<br />
|-<br />
| [[VirtualBox (简体中文)]] || 翻译中 || Carl X. Su || 请优先翻译此文<br />
|-<br />
| [[VirtualBox Extras (简体中文)]] || 部分翻译 || 无 || 需要合并到 [[VirtualBox (简体中文)]]<br />
|-<br />
| [[VMware (简体中文)]] || 翻译中 || Jason Zhang || 无<br />
|- <br />
| [[Xfce (简体中文)]] || 翻译中 || ZaticWu || 请优先翻译<br />
|-<br />
| [[Xmonad (简体中文)]]<br />
| 未翻译<br />
| Rns<br />
| 翻译中<br />
|-<br />
| [[Xrandr (简体中文)]]<br />
| 过期<br />
| 无<br />
| 无<br />
|-</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Persistent_block_device_naming_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409291
Persistent block device naming (简体中文)
2015-11-15T16:48:59Z
<p>Aaron chen: /* 持久化命名的方法 */</p>
<hr />
<div>{{DISPLAYTITLE:持久化块设备命名}}<br />
[[Category:Boot process (简体中文)]]<br />
[[Category:File systems (简体中文)]]<br />
[[Category:Hardware detection and troubleshooting (简体中文)]]<br />
[[en:Persistent block device naming]]<br />
[[es:Persistent block device naming]]<br />
[[it:Persistent block device naming]]<br />
[[ja:永続的なブロックデバイスの命名]]<br />
[[zh-TW:UUID]]<br />
{{Related articles start}}<br />
{{Related|fstab}}<br />
{{Related|udev}}<br />
{{Related|LVM}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Persistent_block_device_naming|2015-05-14|373601}}<br />
{{Translateme (简体中文)}}<br />
<br />
本文讲述如何为你的块设备提供持久化命名。udev的导入使之成为可能,也使之优于基于总线的命名法。如果你的机器上有不止一个 SATA, SCSI 或 IDE 磁盘控制器,那么它们所对应的设备节点将会依随机次序添加。这样就可能导致每次引导时设备的名字如 {{ic|/dev/'''sda'''}} 与 {{ic|/dev/'''sdb'''}} 互换了,最终导致系统不可引导、kernel panic、或者设备不可见。持久化命名法可以解决这些问题。<br />
{{注意|如果你使用 [[LVM|LVM2]],本文将不适用。因为 LVM 自动处理这一问题。}}<br />
<br />
==持久化命名的方法==<br />
<br />
有四种持久化命名方案:[[#by-label|by-label]]、[[#by-uuid|by-uuid]]、[[#by-id and by-path|by-id 和 by-path]]。对于那些使用[[GUID Partition Table |GUID 分区表(GPT)]]的磁盘,还有额外的两种方案,[[#by-partlabel|by-partlabel]] 和 [[#by-partuuid|by-partuuid]]。你也可以[[#使用 Udev 静态设备名|使用 Udev 静态设备名]]方案。<br />
<br />
下面讲解各种命名方案及其用法。<br />
<br />
{{ic|lsblk -f}} 命令用于以图示方式查看第一种方案:<br />
<br />
{{hc|$ lsblk -f|<nowiki><br />
NAME FSTYPE LABEL UUID MOUNTPOINT<br />
sda <br />
├─sda1 vfat CBB6-24F2 /boot<br />
├─sda2 ext4 SYSTEM 0a3407de-014b-458b-b5c1-848e92a327a3 /<br />
├─sda3 ext4 DATA b411dc99-f0a0-4c87-9e05-184977be8539 /home<br />
└─sda4 swap f9fe0b69-a280-415d-a03a-a32752370dee [SWAP]<br />
</nowiki>}}<br />
<br />
对于 [[GUID Partition Table|GPT 分区表]],应改用 {{ic|blkid}} 命令。字母便于脚本使用但可读性降低。<br />
<br />
{{hc|$ blkid|<nowiki><br />
/dev/sda1: UUID="CBB6-24F2" TYPE="vfat" PARTLABEL="EFI SYSTEM PARTITION" PARTUUID="d0d0d110-0a71-4ed6-936a-304969ea36af" <br />
/dev/sda2: LABEL="SYSTEM" UUID="0a3407de-014b-458b-b5c1-848e92a327a3" TYPE="ext4" PARTLABEL="GNU/LINUX" PARTUUID="98a81274-10f7-40db-872a-03df048df366" <br />
/dev/sda3: LABEL="DATA" UUID="b411dc99-f0a0-4c87-9e05-184977be8539" TYPE="ext4" PARTLABEL="HOME" PARTUUID="7280201c-fc5d-40f2-a9b2-466611d3d49e" <br />
/dev/sda4: UUID="f9fe0b69-a280-415d-a03a-a32752370dee" TYPE="swap" PARTLABEL="SWAP" PARTUUID="039b6c1c-7553-4455-9537-1befbc9fbc5b"<br />
</nowiki><br />
}}<br />
<br />
===by-label===<br />
<br />
几乎每一个文件系统都可以有一个标签。所有有标签的分区都在 {{ic|/dev/disk/by-label}} 目录中列出。这个目录是动态地创建和销毁的,视有无带标签的分区而定。<br />
{{Accuracy|Elements provided in the [[Talk:Persistent_block_device_naming|Talk page]] suggest that /dev/disk/by-label and /dev/disk/by-partlabel may not be suitable for persistent naming in certain configurations, particularly if using [[btrfs]] or [[ZFS]]}}{{Accuracy|Elements provided in the [[Talk:Persistent_block_device_naming|Talk page]] suggest that /dev/disk/by-label and /dev/disk/by-partlabel may not be suitable for persistent naming in certain configurations, particularly if using [[btrfs]] or [[ZFS]]}}<br />
{{hc|$ ls -l /dev/disk/by-label|<nowiki> <br />
total 0<br />
lrwxrwxrwx 1 root root 10 May 27 23:31 DATA -> ../../sda3<br />
lrwxrwxrwx 1 root root 10 May 27 23:31 SYSTEM -> ../../sda2<br />
</nowiki>}}<br />
<br />
The labels of your filesystems can be changed. Following are some methods for changing labels on common filesystems:<br />
<br />
; swap : {{ic|swaplabel -L <label> /dev/XXX}} using {{pkg|util-linux}}<br />
; ext2/3/4 : {{ic|e2label /dev/XXX <label>}} using {{pkg|e2fsprogs}}<br />
; btrfs : {{ic|btrfs filesystem label /dev/XXX <label>}} using {{pkg|btrfs-progs}}<br />
; reiserfs : {{ic|reiserfstune -l <label> /dev/XXX}} using {{pkg|reiserfsprogs}}<br />
; jfs : {{ic|jfs_tune -L <label> /dev/XXX}} using {{pkg|jfsutils}}<br />
; xfs : {{ic|xfs_admin -L <label> /dev/XXX}} using {{pkg|xfsprogs}}<br />
; fat/vfat : {{ic|dosfslabel /dev/XXX <label>}} using {{pkg|dosfstools}}<br />
; fat/vfat : {{ic|mlabel -i /dev/XXX ::<label>}} using {{pkg|mtools}}<br />
; ntfs : {{ic|ntfslabel /dev/XXX <label>}} using {{pkg|ntfs-3g}}<br />
<br />
{{Note|<br />
* Changing the filesystem label of the root partition has to be done from a "live" GNU/Linux distribution because the partition needs to be unmounted first.<br />
* Labels have to be unambiguous to prevent any possible conflicts;<br />
* Labels can be up to 16 characters long.}}<br />
<br />
===by-uuid===<br />
<br />
[[wikipedia:UUID|UUID]] is a mechanism to give each filesystem a unique identifier. These identifiers are generated by filesystem utilities (e.g. {{ic|mkfs.*}}) when the partition gets formatted and are designed so that collisions are unlikely. All GNU/Linux filesystems (including swap and LUKS headers of raw encrypted devices) support UUID. FAT and NTFS filesystems (''fat'' and ''windows'' labels above) do not support UUID, but are still listed in {{ic|/dev/disk/by-uuid}} with a shorter UID (unique identifier):<br />
<br />
{{hc|$ ls -l /dev/disk/by-uuid/|<br />
total 0<br />
lrwxrwxrwx 1 root root 10 May 27 23:31 0a3407de-014b-458b-b5c1-848e92a327a3 -> ../../sda2<br />
lrwxrwxrwx 1 root root 10 May 27 23:31 b411dc99-f0a0-4c87-9e05-184977be8539 -> ../../sda3<br />
lrwxrwxrwx 1 root root 10 May 27 23:31 CBB6-24F2 -> ../../sda1<br />
lrwxrwxrwx 1 root root 10 May 27 23:31 f9fe0b69-a280-415d-a03a-a32752370dee -> ../../sda4<br />
}}<br />
<br />
The advantage of using the UUID method is that it is much less likely that name collisions occur than with labels. Further, it is generated automatically on creation of the filesystem. It will, for example, stay unique even if the device is plugged into another system (which may perhaps have a device with the same label). <br />
<br />
The disadvantage is that UUIDs make long code lines hard to read and break formatting in many configuration files (e.g. fstab or crypttab). Also every time a partition is resized or reformatted a new UUID is generated and configs have to get adjusted (manually).<br />
<br />
{{Tip|In case your swap partition does not have an UUID assigned, you will need to reset the swap partition using [[Swap#Swap partition|mkswap]] utility.}}<br />
<br />
===by-id and by-path===<br />
{{Accuracy|Elements provided in the [[Talk:Persistent_block_device_naming|Talk page]] (since 2011) seems to clearly indicate that {{ic|by-id}} and {{ic|by-path}} are valid ways to state persistent device names. Were they not, this section should be marked for deletion so as to not bring up confusion in this page dedicated to ''persistent device naming''.|section=by-path and by-id unsuitable?}}<br />
{{ic|by-id}} creates a unique name depending on the hardware serial number, {{ic|by-path}} depending on the shortest physical path (according to sysfs). Both contain strings to indicate which subsystem they belong to (i.e. {{ic|-ide-}} for {{ic|by-path}}, and {{ic|-ata-}} for {{ic|by-id}}) and thus are not suitable for solving the problems mentioned in the beginning of this article. They will not be discussed any further here.<br />
<br />
===by-partlabel===<br />
{{Accuracy|Elements provided in the [[Talk:Persistent_block_device_naming|Talk page]] suggest that /dev/disk/by-label and /dev/disk/by-partlabel may not be suitable for persistent naming in certain configurations, particularly if using [[btrfs]] or [[ZFS]]}}<br />
{{Note|This method only concerns disks with [[GUID Partition Table|GUID Partition Table (GPT)]].}}<br />
<br />
Partition labels can be defined in the header of the partition entry on GPT disks.<br />
<br />
See also [[Wikipedia:GUID_Partition_Table#Partition_entries]].<br />
<br />
This method is very similar to the [[#by-label|filesystem labels]], excepted that the dynamic directory is {{ic|/dev/disk/by-partlabel}}.<br />
<br />
{{hc|ls -l /dev/disk/by-partlabel/|<nowiki><br />
total 0<br />
lrwxrwxrwx 1 root root 10 May 27 23:31 EFI\x20SYSTEM\x20PARTITION -> ../../sda1<br />
lrwxrwxrwx 1 root root 10 May 27 23:31 GNU\x2fLINUX -> ../../sda2<br />
lrwxrwxrwx 1 root root 10 May 27 23:31 HOME -> ../../sda3<br />
lrwxrwxrwx 1 root root 10 May 27 23:31 SWAP -> ../../sda4<br />
</nowiki>}}<br />
<br />
{{Note|<br />
* GPT partition labels have also to be different to avoid conflicts. To change your partition label, you can use {{ic|gdisk}} or the ncurse-based version {{ic|cgdisk}}. Both are available from the {{Pkg|gptfdisk}} package. See [[Partitioning#Partitioning_tools]].<br />
* According to the specification, GPT partition labels can be up to 72 characters long.}}<br />
<br />
===by-partuuid===<br />
{{Note|This method only concerns disks with [[GUID Partition Table|GUID Partition Table (GPT)]].}}<br />
<br />
Like [[#by-partlabel|GPT partition labels]], GPT partition UUID are defined in the partition entry on GPT disks. <br />
<br />
See also [[Wikipedia:GUID_Partition_Table#Partition_entries]].<br />
<br />
The dynamic directory is similar to other methods and, like [[#by-uuid|UUID filesystems]], using UUIDs is prefered over labels.<br />
<br />
{{hc|ls -l /dev/disk/by-partuuid/|<nowiki><br />
total 0<br />
lrwxrwxrwx 1 root root 10 May 27 23:31 039b6c1c-7553-4455-9537-1befbc9fbc5b -> ../../sda4<br />
lrwxrwxrwx 1 root root 10 May 27 23:31 7280201c-fc5d-40f2-a9b2-466611d3d49e -> ../../sda3<br />
lrwxrwxrwx 1 root root 10 May 27 23:31 98a81274-10f7-40db-872a-03df048df366 -> ../../sda2<br />
lrwxrwxrwx 1 root root 10 May 27 23:31 d0d0d110-0a71-4ed6-936a-304969ea36af -> ../../sda1<br />
</nowiki><br />
}}<br />
<br />
===使用 Udev 静态设备名===<br />
<br />
See [[Udev#Setting static device names]].<br />
<br />
==使用持久化的命名==<br />
<br />
There are various applications that can be configured using persistent naming. Following are some examples of how to configure them.<br />
<br />
=== fstab ===<br />
<br />
See the main article: [[fstab#UUIDs]]<br />
<br />
===引导管理器===<br />
<br />
To use persistent names in your boot manager, the following prerequisites must be met:<br />
<br />
* You are using a [[Mkinitcpio#Configuration|mkinitcpio]] initial RAM disk image<br />
* You have udev enabled in {{ic|/etc/mkinitcpio.conf}}<br />
<br />
In the above example, {{ic|/dev/sda1}} is the root partition. In the [[GRUB]] {{ic|grub.cfg}} file, the ''linux'' line looks like this:<br />
<br />
linux /boot/vmlinuz-linux root=/dev/sda1 rw quiet<br />
<br />
Depending on which naming scheme you would prefer, change it to one of the following:<br />
<br />
linux /boot/vmlinuz-linux root=/dev/disk/by-label/root_myhost rw quiet<br />
<br />
or:<br />
<br />
linux /boot/vmlinuz-linux root=UUID=2d781b26-0285-421a-b9d0-d4a0d3b55680 rw quiet<br />
<br />
If you are using [[LILO]], then do not try this with the {{ic|1=root=...}} configuration option; it will not work. Use {{ic|1=append="root=..."}} or {{ic|1=addappend="root=..."}} instead. Read the LILO man page for more information on {{ic|append}} and {{ic|addappend}}.<br />
<br />
There is an alternative way to use the label embedded in the filesystem. For example if (as above) the filesystem in {{ic|/dev/sda1}} is labeled {{ic|root_myhost}}, you would give this line to GRUB:<br />
<br />
linux /boot/vmlinuz-linux root=LABEL=root_myhost rw quiet</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Network_configuration_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409288
Network configuration (简体中文)
2015-11-15T16:14:00Z
<p>Aaron chen: /* 设备名称 */</p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Networking (简体中文)]]<br />
[[cs:Network configuration]]<br />
[[el:Network configuration]]<br />
[[en:Network configuration]]<br />
[[es:Network configuration]]<br />
[[fr:Connexions reseau]]<br />
[[it:Network configuration]]<br />
[[ja:ネットワーク設定]]<br />
[[nl:Network configuration]]<br />
[[pt:Network configuration]]<br />
[[ro:Configurare retea]]<br />
[[ru:Network configuration]]<br />
[[sk:Network configuration]]<br />
[[tr:Ağ Yapılandırması]]<br />
[[zh-tw:Network configuration]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Jumbo frames}}<br />
{{Related|Firewalls}}<br />
{{Related|Wireless network configuration (简体中文)}}<br />
{{Related|List of applications#Network Managers}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Network_Configuration|2013-10-25|279517}}<br />
本页解释了如何配置 '''有线''' 网络连接。如果你需要设置 '''无线''' 网络,参见[[Wireless_Setup|无线配置]]页面。<br />
<br />
== 检查连接 ==<br />
<br />
{{注意|如果你在执行 ping 的时候碰到像 {{ic|ping: icmp open socket: Operation not permitted}} 这样的错误,尝试重新安装 {{ic|iputils}} 软件包。}} <br />
<br />
大多数情况下,基本的安装过程已经创建了正确的网络配置。通过运行以下命令来检查:<br />
{{hc|$ ping -c 3 www.google.com|<nowiki><br />
PING www.l.google.com (74.125.224.146) 56(84) bytes of data.<br />
64 bytes from 74.125.224.146: icmp_req=1 ttl=50 time=437 ms<br />
64 bytes from 74.125.224.146: icmp_req=2 ttl=50 time=385 ms<br />
64 bytes from 74.125.224.146: icmp_req=3 ttl=50 time=298 ms<br />
<br />
--- www.l.google.com ping statistics ---<br />
3 packets transmitted, 3 received, 0% packet loss, time 1999ms<br />
rtt min/avg/max/mdev = 298.107/373.642/437.202/57.415 ms<br />
</nowiki>}}<br />
<br />
{{小贴士| 参数 {{ic|-c 3}} 表示执行命令 {{ic|ping}} 3次 。 参见 {{ic|man ping}}。}}<br />
<br />
如果像上面这样成功运行,那么你只需要进行下面这些个人配置。<br />
<br />
如果上面的命令说 unknown hosts,意思是你的机器无法进行域名解析。这可能和你的服务提供商或者你的路由器/网关有关。你可以尝试 ping 一个静态的 IP 地址来验证你的电脑是否能访问 Internet。<br />
<br />
{{注意|选项 {{ic|-c 3}} 表示发送三次。参见 {{ic|man ping}} 获得更多信息。}}<br />
<br />
{{hc|$ ping -c 3 8.8.8.8|<nowiki><br />
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.<br />
64 bytes from 8.8.8.8: icmp_req=1 ttl=53 time=52.9 ms<br />
64 bytes from 8.8.8.8: icmp_req=2 ttl=53 time=72.5 ms<br />
64 bytes from 8.8.8.8: icmp_req=3 ttl=53 time=70.6 ms<br />
<br />
--- 8.8.8.8 ping statistics ---<br />
3 packets transmitted, 3 received, 0% packet loss, time 2002ms<br />
rtt min/avg/max/mdev = 52.975/65.375/72.543/8.803 ms<br />
</nowiki>}}<br />
<br />
{{注意|{{ic|8.8.8.8}} 是一个容易记忆的静态地址。它是 Google 的主 DNS 服务器,因此它可以视为可信的,通常不会被过滤系统或代理屏蔽。}}<br />
<br />
如果你能够 ping 通这个地址,你可以尝试把这个域名服务器添加到 {{ic|/etc/resolv.conf}} 文件中。<br />
<br />
== 设置计算机名 ==<br />
<br />
[[Wikipedia:Hostname|主机名]] 是一个网络中唯一标识一台机器的名称。主机名通过文件 {{ic|/etc/hostname}} 进行配置。这样设置主机名:<br />
<br />
# hostnamectl set-hostname '''myhostname'''<br />
<br />
这将会把 '''myhostname''' 写入 {{ic|/etc/hostname}}。<br />
<br />
详情参见 {{ic|man 5 hostname}} 和 {{ic|man 1 hostnamectl}}。<br />
<br />
{{注意|<br />
* {{ic|hostnamectl}} 支持 FQDNs<br />
* 你不再需要编辑 {{ic|/etc/hosts}}, {{pkg|systemd}} 提供了主机名称的解析,它默认安装在所有系统上。}}<br />
<br />
要临时设置主机名(直到下次重启为止),使用 {{Pkg|inetutils}} 中的 {{ic|hostname}} 命令:<br />
<br />
# hostname ''myhostname''<br />
<br />
== 设备驱动程序 ==<br />
<br />
=== 检测驱动状态 ===<br />
<br />
[[Udev]] 会探测网卡([[Wikipedia:Network_interface_controller|NIC]])并在启动时自动载入必要的模块。 检查 {{ic|lspci -v}} 输出中 "Ethernet controller" (或者类似的)条目,它会告诉你哪个内核模块包含了网络设备的驱动程序。例如:<br />
<br />
{{hc|$ lspci -v|<br />
02:00.0 Ethernet controller: Attansic Technology Corp. L1 Gigabit Ethernet Adapter (rev b0)<br />
...<br />
Kernel driver in use: atl1<br />
Kernel modules: atl1<br />
}}<br />
<br />
接下来, 用 {{ic|dmesg <nowiki>|</nowiki> grep ''module_name''}} 来检查是否已经加载了驱动。例如:<br />
$ dmesg |grep atl1<br />
...<br />
atl1 0000:02:00.0: eth0 link is up 100 Mbps full duplex<br />
<br />
如果驱动加载成功,就跳过下一节,否则,你需要知道您特定型号的网络设备需要哪一个模块。<br />
<br />
=== 加载设备模块 ===<br />
<br />
用 Google 查找芯片组需要的模块/驱动。常见的驱动模块有用于 Realtek 芯片组网卡的 {{ic|8139too}},或者用于 Sis 芯片组网卡的 {{ic|sis900}}。知道要使用什么模块之后,尝试 [[Kernel modules#Manual module handling|手动加载它]]。如果你碰到了未找到模块的错误,可能驱动没有包括在 Arch 的内核中。你可以在 [[AUR]] 中搜索模块名称。<br />
<br />
如果 udev 在引导时不能自动侦测和加载适当的模块,参见 [[Kernel modules#Loading]]。<br />
<br />
== 网络接口 ==<br />
<br />
=== 设备名称 ===<br />
<br />
对于有多块网卡的电脑,固定设备名称很重要。许多配置问题都是由于网络接口名称变化引起的。<br />
<br />
[[udev]] 负责给设备命名。Systemd v197 引入了[http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames 可预测的网络接口名称]自动给网络设备分配静态名称,网络接口现在是以前缀 {{ic|en}}(以太网)、{{ic|wl}}(WLAN)、或者 {{ic|ww}}(WWAN)附上一个自动生成的标识符,产生了一个类似于 {{ic|enp0s25}} 的条目。<br />
<br />
可以添加一个链接来禁用这个行为:<br />
<br />
# ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules<br />
<br />
从以前版本的 systemd 升级的用户会有一份自动创建的空规则文件。因此,如果你想使用固定的设备名称,删除这个文件即可。<br />
<br />
{{小贴士|你可以运行 {{ic|ip link}} 或者 {{ic|ls /sys/class/net}} 列出所有接口。}}<br />
<br />
{{注意|当你改变接口命名规则时,不要忘记更新所有与网络相关的配置文件和自定义的 systemd unit 文件以反映变化。特别是当你启用了 [[netctl#Basic method|netctl 静态配置]] 时,要运行 {{ic|netctl reenable ''profile''}} 来更新生成的服务文件。}}<br />
<br />
==== 更改设备名称 ====<br />
<br />
你可以用 udev-rule 手动定义名称来更改设备名称。例如:<br />
<br />
{{hc|/etc/udev/rules.d/10-network.rules|<nowiki><br />
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="aa:bb:cc:dd:ee:ff", NAME="net1"<br />
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="ff:ee:dd:cc:bb:aa", NAME="net0"<br />
</nowiki>}}<br />
<br />
值得注意的两点:<br />
<br />
* 使用这条命令来获得每张网卡的 MAC 地址:{{ic|cat /sys/class/net/'''设备名'''/address}}<br />
* 确保你的 udev 规则中使用小写的十六进制值,而不是大写。<br />
<br />
{{注意|选择静态名称时,'''应该避免使用形如 "eth''X''" 或 "wlan''X''" 的名称''',因为这可能在引导时导致内核与 udev 之间的竞争状态。相反,最好用内核默认不会使用的接口名称,例如:{{ic|net0}}、{{ic|net1}}、{{ic|wifi0}}、{{ic|wifi1}}。更多细节请查看 [http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames systemd] 文档。}}<br />
<br />
=== 设定设备的 MTU 和队列长度 ===<br />
<br />
你可以手动定义一条 udev 规则来改变队列的 MTU(最大传输单元)和队列长度You can change the device MTU and queue length by defining manually with an udev-rule。举例来说:<br />
<br />
{{hc|/etc/udev/rules.d/10-network.rules|<nowiki><br />
ACTION=="add", SUBSYSTEM=="net", KERNEL=="wl*", ATTR{mtu}="1480", ATTR{tx_queue_len}="2000"<br />
</nowiki>}}<br />
<br />
=== 获取当前网络名 ===<br />
<br />
可以通过 sysfs 找到当前的 NIC 名称:<br />
<br />
{{hc|$ ls /sys/class/net| <br />
lo eth0 eth1 firewire0<br />
}}<br />
<br />
=== 启用和禁用网络接口 ===<br />
<br />
可以通过如下命令启用或禁用接口:<br />
<br />
# ip link set eth0 up<br />
# ip link set eth0 down<br />
<br />
查看结果:<br />
<br />
{{hc|$ ip link show dev eth0|<br />
2: eth0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP mode DEFAULT qlen 1000<br />
...<br />
}}<br />
<br />
== 配置 IP 地址 ==<br />
<br />
有两种配置方式:通过 [[Wikipedia:Dynamic Host Configuration Protocol|DHCP]],或者不变的''静态''地址。<br />
<br />
=== 动态 IP 地址 ===<br />
<br />
==== systemd-networkd ====<br />
<br />
An easy way to setup DHCP for simple requirements is to use [[systemd-networkd]] service provided by systemd. See [[systemd-networkd#Basic DHCP network]].<br />
<br />
==== netctl ====<br />
<br />
[[netctl]] is a CLI-based tool for configuring and managing network connections through user-created profiles. Create a profile as shown in [[netctl#Example profiles]], then enable it as described in [[netctl#Basic method]].<br />
<br />
==== 手工运行 DHCP 客户端守护进程 ====<br />
<br />
请注意,{{ic|dhcpcd}}(DHCP ''客户端'' 守护进程)与 {{ic|dhcpd}}(DHCP ''(服务端)'' 守护进程)的不同。<br />
<br />
{{hc|# dhcpcd eth0|<br />
dhcpcd: version 5.1.1 starting<br />
dhcpcd: eth0: broadcasting for a lease<br />
...<br />
dhcpcd: eth0: leased 192.168.1.70 for 86400 seconds<br />
}}<br />
<br />
现在,{{ic|ip addr show dev eth0}} 将列出你的网络地址。<br />
<br />
对一些人来说,{{ic|dhcpcd}} 失败时,{{ic|dhclient}}(位于软件包 {{Pkg|dhclient}} 中)会有用。<br />
<br />
==== 启动时运行 DHCP ====<br />
<br />
如果你只想在你的以太网连接上使用 DHCP,你可以使用 {{ic|dhcpcd@.service}} (由软件包 {{Pkg|dhcpcd}} 提供)。<br />
<br />
{{ic|eth0}} 上启用 DHCP,只要调用:<br />
<br />
# systemctl start dhcpcd@eth0.service<br />
<br />
你能这样来使这个服务在启动时自动启用:<br />
<br />
# systemctl enable dhcpcd@eth0.service<br />
<br />
如果 dhcpd 服务在你的网卡模块之前启动({{bug|30235}}),手动地把你的网卡添加到 {{ic|/etc/modules-load.d/*.conf}} 中。例如,如果你的 Realtek 网卡需要载入 {{ic|r8169}},创建:<br />
<br />
{{hc|/etc/modules-load.d/realtek.conf|<br />
r8169<br />
}}<br />
<br />
{{小贴士|使用 {{ic|lspci -k}} 来找出你的网卡需要什么模块。}}<br />
<br />
如果你使用 DHCP 自动获取 IP 地址,但是'''不'''想每次启动网络的时候让 DHCP 更改你的 DNS 服务器(域名服务器),在 {{ic|dhcpcd.conf}} 的最后一部分中添加:<br />
<br />
{{hc|/etc/dhcpcd.conf|<br />
nohook resolv.conf<br />
}}<br />
<br />
此外,如果你在一个使用基于 MAC 地址的 Client ID 来过滤的 DHCPv4 网络中,你可能需要把以下这行:<br />
<br />
{{hc|/etc/dhcpcd.conf|<br />
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 Client ID as per RFC4361. <br />
duid<br />
}}<br />
<br />
改为:<br />
<br />
{{hc|/etc/dhcpcd.conf|<br />
# Use the hardware address of the interface for the Client ID (DHCPv4).<br />
clientid<br />
}}<br />
<br />
否则,你可能得不到租凭,因为 DHCP 服务器可能无法正确读取你的 [http://en.wikipedia.org/wiki/DHCPv6 DHCPv6-style] Client ID。更多信息可参见[http://tools.ietf.org/html/rfc4361 RFC 4361]。<br />
<br />
在 {{ic|/etc/dhcpcd.conf}} 中使用 nooption 选项来阻止 dhcpcd 向 {{ic|/etc/resolv.conf}} 添加域名服务器:<br />
<br />
{{hc|/etc/dhcpcd.conf|<br />
nooption domain_name_servers<br />
}}<br />
<br />
然后把你自己的 DNS 服务器添加到 {{ic|/etc/resolv.conf}}.<br />
<br />
如果多个不同进程都会更改{{ic|/etc/resolv.conf}} (例如,{{Pkg|dhcpcd}} 和 VPN 客户端),请安装 {{Pkg|openresolv}} 软件包,使用它不需要额外地配置{{Pkg|dhcpcd}}。<br />
<br />
=== 静态 IP 地址 ===<br />
<br />
使用静态 IP 地址有多种原因,例如通过不变的IP地址获得一定程度的可预测性,或者你没有可用的 DHCP 服务器。<br />
<br />
{{注意|在不使用路由器的情况下和一台安装 Windows 的电脑分享你的网络连接,请确保两台电脑都使用静态 IP ,否则你的局域网将会有问题。}}<br />
<br />
需要确定:<br />
<br />
* 静态IP地址,<br />
* [[Wikipedia:Subnetwork|子网掩码]],<br />
* Subnet mask in [[wikipedia:Classless Inter-Domain Routing#CIDR notation|CIDR notation]], for example {{ic|/24}} is the CIDR notation of {{ic|255.255.255.0}} netmask<br />
* [[Wikipedia:Broadcast_address|广播地址]],<br />
* [[Wikipedia:Default_gateway|网关]]的IP地址<br />
* Name server (DNS) IP addresses. See also [[resolv.conf]].<br />
<br />
如果你想配置一个内部网络,可以将你的 IP 设置成 192.168.*.* ,子网掩码设置成 255.255.255.0 ,广播地址设置成 192.168.*.255 。网关通常是 192.168.*.1 或者 192.168.*.254。<br />
<br />
{{Warning|<br />
* Make sure manually assigned IP addresses do not conflict with DHCP assigned ones. See [http://www.raspberrypi.org/forums/viewtopic.php?f&#61;28&t&#61;16797 this forum thread]<br />
* If you share your Internet connection from a Windows machine without a router, be sure to use static IP addresses on both computers to avoid LAN problems.<br />
}}<br />
<br />
==== systemd-networkd ====<br />
<br />
The [[systemd-networkd]] service provided by systemd can set up a static IP using a simple configuration file. See [[systemd-networkd#Wired adapter using a static IP]].<br />
<br />
==== dhcpcd ====<br />
<br />
See [[dhcpcd#Static profile]].<br />
<br />
==== 手动指定 ====<br />
<br />
你可以在终端中指定一个静态 IP:<br />
<br />
# ip addr add <IP 地址>/<子网掩码> dev <interface><br />
<br />
例如:<br />
<br />
# ip addr add 192.168.1.2/24 dev eth0<br />
<br />
{{注意|子网掩码使用 [[Wikipedia:CIDR_notation|CIDR 表示法]]。}}<br />
<br />
更多选项参见:{{ic|man ip}}<br />
<br />
如此添加你的网关(用你的网关 IP 替换):<br />
<br />
# ip route add default via <默认网关的 IP 地址><br />
<br />
例如:<br />
<br />
# ip route add default via 192.168.1.1<br />
<br />
如要你看到 "No such process" 的错误,这意味着你必须以root权限运行{{ic|ip link set dev eth0 up}}。<br />
<br />
==== 启动时使用 systemd 手动连接 ====<br />
<br />
首先为创建 [[systemd]] 服务的配置文件,使用适当的接口名称替换 {{ic|<interface>}}:<br />
<br />
{{hc|/etc/conf.d/network@<interface>|<nowiki><br />
address=192.168.0.15<br />
netmask=24<br />
broadcast=192.168.0.255<br />
gateway=192.168.0.1<br />
</nowiki>}}<br />
<br />
创建一个 systemd unit 文件:<br />
{{hc|/etc/systemd/system/network@.service|<nowiki><br />
[Unit]<br />
Description=Network connectivity (%i)<br />
Wants=network.target<br />
Before=network.target<br />
BindsTo=sys-subsystem-net-devices-%i.device<br />
After=sys-subsystem-net-devices-%i.device<br />
<br />
[Service]<br />
Type=oneshot<br />
RemainAfterExit=yes<br />
EnvironmentFile=/etc/conf.d/network@%i<br />
<br />
ExecStart=/usr/bin/ip link set dev %i up<br />
ExecStart=/usr/bin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev %i<br />
ExecStart=/usr/bin/ip route add default via ${gateway}<br />
<br />
ExecStop=/usr/bin/ip addr flush dev %i<br />
ExecStop=/usr/bin/ip link set dev %i down<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
启用并启动此 unit, 传入接口的名称:<br />
<br />
# systemctl enable network@eth0.service<br />
# systemctl start network@eth0.service<br />
<br />
===== 使用静态 IP 地址 =====<br />
<br />
用编辑器创建文件 {{ic|/etc/systemd/system/network.service}}。这份示例中使用一个静态 IP 地址和 [[WPA supplicant]]。<br />
<br />
{{hc|/etc/systemd/system/network.service|<nowiki><br />
[Unit]<br />
Description=Network Connectivity<br />
Wants=network.target<br />
Before=network.target<br />
BindsTo=sys-subsystem-net-devices-net0.device<br />
After=sys-subsystem-net-devices-net0.device<br />
<br />
[Service]<br />
Type=oneshot<br />
RemainAfterExit=yes<br />
ExecStart=/usr/bin/ip link set dev net0 up<br />
ExecStart=/usr/bin/wpa_supplicant -B -i net0 -c /etc/wpa_supplicant.conf # Remove this for wired connections<br />
ExecStart=/usr/bin/ip addr add 192.168.0.10/24 dev net0<br />
ExecStart=/usr/bin/ip route add default via 192.168.0.1<br />
<br />
ExecStop=/usr/bin/ip addr flush dev net0<br />
ExecStop=/usr/bin/ip link set dev net0 down<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
不要忘记启用它!<br />
<br />
# systemctl enable network<br />
<br />
要进行测试,重启或保证所有其它网络的守护进程已经停止,并以 root 权限执行:<br />
<br />
# systemctl start network<br />
<br />
==== 计算地址 ====<br />
<br />
可以用 {{Pkg|ipcalc}} 软件包提供的 {{ic|ipcalc}} 工具自动计算 IP 广播、子网掩码、主机范围等。例如通过火线连接视窗系统主机到 Arch。为了安全和网络组织,将它们分到独立的网络中,然后配置子网掩码和广播地址,网络中只有2台主机。要找出掩码和广播地址,我使用了 ipcalc,提供了它 arch firewire nic 的 IP 地址10.66.66.1,并告诉 ipcalc 要建立一个只有2台主机的网络。<br />
<br />
{{hc|$ ipcalc -nb 10.66.66.1 -s 1|<nowiki><br />
Address: 10.66.66.1<br />
<br />
Netmask: 255.255.255.252 = 30<br />
Network: 10.66.66.0/30<br />
HostMin: 10.66.66.1<br />
HostMax: 10.66.66.2<br />
Broadcast: 10.66.66.3<br />
Hosts/Net: 2 Class A, Private Internet<br />
</nowiki>}}<br />
<br />
== 载入设置 ==<br />
<br />
想测试你的设置,可以重启计算机或者重新加载相关的 systemd 服务:<br />
<br />
# systemctl restart dhcpcd@eth0<br />
<br />
试着按照这个顺序 ping 一些网络地址:你的网关, DNS 服务器(域名服务器), ISP 服务提供商,以及其他的网络地址。这样可以检查你的网络连接在哪里出了问题。如:<br />
<br />
$ ping -c 3 www.google.com<br />
<br />
== 更多设置 ==<br />
<br />
=== 笔记本电脑使用 Ifplugd ===<br />
<br />
[[官方仓库]] 中的 {{Pkg|ifplugd}} 是一个守护进程,当网络适配器插入的时候自动配置网络,当网络断开的时候自动取消配置(比如某些3G的usb网络适配器)。这对于笔记本电脑这样的使用移动式的网络适配器的情况很有用,因为他只会在网络实际接入的时候才会配置网络接口。另外一个可能会用得着它的情况是,你需要重启你的网络,可是你既不想重启电脑也不想在 shell 中配置。<br />
<br />
在默认情况下,它会检查 {{ic|eth0}} 设备。要更改这个设置(以及更改其他设置,比如等待时间),可以编辑 {{ic|/etc/ifplugd/ifplugd.conf}}。<br />
<br />
启用 {{ic|net-auto-wired.service}} 就会在开机时启动 ifplugd,否则,你可以使用 {{ic|ifplugd@eth0.service}}。<br />
<br />
{{注意|[[Netctl]] 软件包包含了 {{ic|netctl-ifplugd@.service}},否则你可以使用 {{Pkg|ifplugd}} 软件包中的 {{ic|ifplugd@.service}}。例如 {{ic|systemctl enable ifplugd@eth0.service}}。}}<br />
<br />
=== 绑定和链路聚合 ===<br />
<br />
参见 [[netctl (简体中文)#Bonding(绑定)]]。<br />
<br />
=== IP 别名 ===<br />
<br />
{{Expansion|Manual method using [[Core utilities#ip|ip]] should be added; then move current example using ''netctl'' into [[netctl]].}}<br />
<br />
IP 别名是指给同一个网络接口分配多个 IP 地址。这样一个网络节点可以有多个网络连接,每个实现不同的作用。Typical uses are virtual hosting of Web and FTP servers, or reorganizing servers without having to update any other machines (this is especially useful for nameservers).<br />
<br />
==== 示例 ====<br />
<br />
你需要使用[[官方仓库]]中的{{Pkg|netctl}}。<br />
<br />
准备配置文件<br />
<br />
{{hc|/etc/netctl/mynetwork|<nowiki><br />
<br />
Connection='ethernet'<br />
Description='Five different addresses on the same NIC.'<br />
Interface='eth0'<br />
IP='static'<br />
Address=('192.168.1.10' '192.168.178.11' '192.168.1.12' '192.168.1.13' '192.168.1.14' '192.168.1.15')<br />
Gateway='192.168.1.1'<br />
DNS=('192.168.1.1')<br />
</nowiki>}}<br />
<br />
然后只要执行:<br />
<br />
$ netctl start mynetwork<br />
<br />
=== 更改 MAC/硬件地址 ===<br />
<br />
参见 [[MAC address spoofing|伪造 MAC 地址]]。<br />
<br />
=== 共享网络连接 ===<br />
<br />
参见 [[Internet sharing|共享网络连接]]。<br />
<br />
=== 路由配置 ===<br />
<br />
参见 [[Router|路由]]。<br />
<br />
=== 局域网主机的名称解析 ===<br />
<br />
When setting up a DNS server such as [[BIND]] or [[Unbound]] is overkill, manually editing your {{ic|/etc/hosts}} is too cumbersome, or when you want more flexibility with dynamic leaving and joining of hosts to the network, it is possible to handle hostname resolution on your local network using zero-configuration networking. 你有两个选择:<br />
<br />
*[[Samba]] 通过 Microsoft's '''NetBIOS''' 提供主机名称解析。这只需要安装 {{Pkg|samba}} 并启用 {{ic|nmbd.service}} 服务。运行 Windows、 OS X、或者运行着 {{ic|nmbd}} 的 Linux,将能找到你的机器。<br />
<br />
*[[Avahi]] 通过 '''zeroconf''',提供主机名称解析, 它也被称称作 Avahi 或者 Bonjour。这需要比 Samba 再稍微复杂一点的配置:详细信息参见 [[Avahi#Hostname resolution]]。运行 OS X 的电脑,或者运行着 Avahi 守护进程的 Linux,将能找到你的机器。Windows 没有内置的 Avahi 客户端或者守护进程。<br />
<br />
== 疑难排解 ==<br />
<br />
=== 更换了连接cable modem的计算机 ===<br />
<br />
许多家庭有线电视的运营商(例如加拿大最大的有线电视公司Videotron,还有中国大陆的有线电视宽带公司)都使用记录网卡MAC地址的方法将cable modem配置为只能一台计算机使用。一旦cable modem获得第一台连接它的PC的MAC地址,就不会响应任何其它MAC地址。这样如果你换了台PC(或者路由器),由于新PC(或者路由器)的MAC地址和旧的不同,就没法连接cable modem了。这时候必须复位cable modem以使它重新辨认新的PC。 你得关闭cable modem电源,然后重新打开。一旦cable modem重启并再次登录在线完毕(指示灯熄灭),重启新连接的PC以使它发起一个DHCP请求,或者手动发起DHCP请求。<br />
<br />
如果这个方法不能奏效,你需要克隆原来机器上的MAC地址。参见 [[Configuring Network#Change MAC/hardware address|Change MAC/hardware address]]。<br />
<br />
=== TCP窗口扩缩(window scaling)故障 ===<br />
<br />
TCP包头有个窗口(window)值表明其它主机可以发送多少数据回来。这个值只有16个bit,也就是说窗口打消最多只有64Kb。TCP包会被缓存一段时间(得被记录),如果内存限制(过去经常是)的话,主机很容易会用完内存。<br />
<br />
回到1992年,内存逐渐增加,[http://www.faqs.org/rfcs/rfc1323.html RFC 1323]被发布以改善情况:窗口扩缩(Window Scaling)。所有包里的窗口值,可以被初始连接时定义的一个缩放因子(Scale Factor)所改变。<br />
<br />
8-bit的缩放因子使得窗口可以是初始64Kb的32倍。<br />
<br />
但是Internet上有些有故障的路由器和防火墙会将缩放因子重写为0,这导致主机之间产生误解。<br />
<br />
Linux内核2.6.17引入了新的计算方式生成更高的缩放因子,间接的使得这些有故障的路由器和防火墙引发的后果更明显。<br />
<br />
这导致连接缓慢甚至中断。<br />
<br />
==== 如何诊断故障 ====<br />
<br />
首先,我们要明白:这个问题很怪异。在某些案例中,你根本无法使用(HTTP, FTP, ...),而有时候,你可以连接某些主机(很少)。<br />
<br />
当你碰到这个故障时,{{ic|dmesg}}的输出正确,日志也没问题,{{ic|ip a}}报告状态正常&mdash; 实际上一切都正常。<br />
<br />
如果你无法浏览任何网站,不过你能ping通少部分主机,很可能你是遇到了这个问题。:ping使用ICMP协议所以不受TCP问题的影响。<br />
<br />
你可以尝试使用WireShark。你也许会看到UDP和ICMP通讯成功,但是TCP通讯不成功(仅对外国主机)。<br />
<br />
==== 如何修复(糟糕的方法) ====<br />
<br />
用比较糟糕的方法修复的话,你可以修改缩放因子计算所基于的tcp_rmem值。虽然它对大部分主机有效,但并不担保一定都有效,特别是某些很远的主机。<br />
<br />
# echo "4096 87380 174760" > /proc/sys/net/ipv4/tcp_rmem<br />
<br />
==== 如何修复(好点的方法) ====<br />
<br />
只需要禁止窗口缩放。虽然窗口缩放是个不错的TCP特性,但它也可能令人不安,特别是当你没法修改除了问题的路由器的时候。有几种方法可以禁止窗口缩放,而看来最可靠的(适用于大部分内核)将下面一行加入到你的{{ic|/etc/sysctl.d/99-sysctl.conf}}中 (见 [[sysctl]])<br />
net.ipv4.tcp_window_scaling = 0<br />
<br />
==== 如何修复(最佳的方法) ====<br />
<br />
这个故障是由有毛病的路由器/防火墙引致的,所以最好换了它。有些用户报告说那些有故障的路由是他们自己的DSL路由。<br />
<br />
==== 更多 ====<br />
<br />
本段内容是基于LWN文章[http://lwn.net/Articles/92727/ TCP window scaling and broken routers]和一个Kernel Trap 文章:[http://kerneltrap.org/node/6723 Window Scaling on the Internet]。<br />
<br />
在LKML上也有几篇相关的帖子。<br />
<br />
=== Realtek 没有连接/网络唤醒故障 ===<br />
<br />
使用基于Realtek 8168 8169 8101 8111芯片网卡(独立网卡和板载)的用户也许会发现这个故障,启动时网卡不可用,网卡上的连接指示灯不亮。这通常会发生在安装了Windows的双启动系统上。在windows下使用realtek官方驱动(2007年5月后的版本)会引发故障。新驱动通过在Windows关机时禁止网卡来关闭网络唤醒功能,直到下一次Windows启动前网卡都会一直不可用。通过观察连接指示灯在Windows启动前一直熄灭,而Windows关机时也会熄灭,你可以发现它。正常操作应该是只要系统一直开着,即使在POST加电过程中,连接指示灯也应该一直亮着的。这个故障也会影响其它没有安装新驱动的操作系统(例如Live CD等)。这里给出几种解决方案:<br />
<br />
==== 方法一 还原/变更Win驱动 ====<br />
<br />
你可以将你的Windows网卡驱动还原回Microsoft自带的驱动(如果有的话),或者安装2007年5月份以前的Realtek官方驱动(也许在网卡附带的CD上)。<br />
<br />
==== 方法二 启动Windows驱动里的网络唤醒功能 ====<br />
<br />
也许最好最快的修复方法就是改变Windows驱动里的这个设置。这个方法可以解决很多其它操作系统而不仅仅是Arch的麻烦。在Windows的设备管理器里,找到你的Realtek网卡,双击它。在“高级”标签页中,开启"wake-on-lan after shutdown"选项。<br />
<br />
例如在Windows XP里<br />
右键点击我的电脑-->管理-->设备管理器-->网络适配器-->双击 Realtek ... --> 高级标签页--> Wake-On-Lan After Shutdown --> 启用。<br />
<br />
{{注意|新的 Realtek Windows 驱动程序中(已测试了 2009/01/22 GIGABYTE 上的 ''Realtek 8111/8169 LAN Driver v5.708.1030.2008'')可能与这里的选项稍微有点不同,像 ''Shutdown Wake-On-LAN --> Enable''。似乎把它切换成 {{ic|Disable}} 没有效果(你仍然可以在Windows关闭时看到连接指示灯熄灭)。一个比较不好的解决方法是引导 Windows,然后立即重启系统(执行非正常重启/关机),不给予 Windows 驱动程序关闭 LAN 的机会。连接指示灯将会保持亮着,网卡也会在 POST 之后保持可用 - 直到你再次进入 Windows 并正常关机。}}<br />
<br />
==== 方法三 更新Realtek Linux驱动 ====<br />
<br />
可以在realtek的官方网页上找到新的Linux驱动。(没有测试过,不过相信也能解决问题)。<br />
<br />
==== 方法四 在 BIOS/CMOS 中启用 ''LAN Boot ROM'' ====<br />
<br />
尽管 Windows 驱动程序在系统关闭时禁用了它,但在 BIOS/CMOS 中设置 ''Integrated Peripherals --> Onboard LAN Boot ROM --> Enabled'',系统启动时会重新激活 Realtek LAN 芯片。<br />
{{注意|这个方法多次在 GIGABYTE GA-G31M-ES2L 主板,2009/02/05 发布的 BIOS 版本 F8 上测试成功。YMMV。}}<br />
<br />
=== DLink G604T/DLink G502T DNS 故障 ===<br />
<br />
使用 DLink G604T/DLink G502T 路由器和DHCP,并且固件是 v2.00+(通常是使用 AUS 固件)的用户可能会碰到的某些程序不同解析 DNS 的问题。不幸的是,pacman 就是这些程序其中之一。故障基本上是因为路由器在某些情况下不正确地发送 DNS 给 DHCP,导致程序尝试连接 IP 地址是 1.0.0.0 的服务器,然后因超时错误而失败。<br />
<br />
==== 如何诊断故障 ====<br />
<br />
最好的诊断问题方法是使用 Firefox/Konqueror/links/seamonkey,并用 wget 作为 pacman 下载工具。如果问题发生在全新安装的 Arch Linux上,那么你可能要通过 live CD 来安装 {{ic|links}}。<br />
<br />
首先,用 wget 作为 pacman下载工具,它可以提供 pacman 下载软件包时的信息。<br />
使用你喜欢的编辑器打开 {{ic|/etc/pacman.conf}} 并取消下面这行的注释(如果前面有#的话,就移除它)<br />
<br />
XferCommand=/usr/bin/wget --passive-ftp -c -O %o %u<br />
<br />
当你编辑 {{ic|/etc/pacman.conf}} 时,检查 pacman 用来下载软件包的默认镜像。<br />
<br />
现在用网络浏览器打开默认镜像,检查镜像确实在工作。如果它很正常,那么运行 {{ic|pacman -Syy}} (否则就选取另一个正常运行的镜像,并把它设置为 pacman 的默认镜像)。如果你看到类似于下面这样的信息(注意 1.0.0.0),<br />
<br />
<nowiki>ftp://mirror.pacific.net.au/linux/archlinux/extra/os/i686/extra.db.tar.gz</nowiki> <br />
=> '/var/lib/pacman/community.db.tar.gz.part'<br />
Resolving mirror.pacific.net.au... 1.0.0.0<br />
<br />
那么你很有可能有这个问题。 1.0.0.0 表示不能解析 DNS,因此我们必须把它添加到 {{ic|/etc/resolv.conf}} 中。<br />
<br />
==== 如何修复 ====<br />
<br />
{{Out of date|{{Pkg|dhcpcd}} 不再使用 {{ic|/etc/conf.d/dhcpcd}} 。}}<br />
<br />
基本上我们需要做的就是手动地在 {{ic|/etc/resolv.conf}} 文件中添加 DNS 服务器。问题是 DHCP 会在启动时自动地删除和替换这个文件,所以我们需要编辑 {{ic|/etc/conf.d/dhcpcd}} 并修改标志,阻止 DHCP 这么做。<br />
<br />
当你打开 {{ic|/etc/conf.d/dhcpcd}},你应该看见类似下面的内容:<br />
<br />
DHCPCD_ARGS="-t 30 -h $HOSTNAME"<br />
<br />
在参数中添加 -R 参数,即,<br />
<br />
DHCPCD_ARGS="-R -t 30 -h $HOSTNAME"<br />
<br />
{{注意|1=如果你使用的 {{Pkg|dhcpcd}} >= 4.0.2,标志 {{ic|-R}} 已被弃用。请参考 [[Dhcpcd]] 中关于怎样使用自定义的 {{ic|/etc/resolv.conf}} 文件的信息。}}<br />
<br />
保存并关闭文件;现在打开 {{ic|/etc/resolv.conf}}。你应该看到一行 nameserver(最有可能是 10.1.1.1)。这是你的路由器的网关,我们需要连接它来获取你的 ISP 的 DNS 服务器。在你的浏览器地址栏中粘贴这个IP地址,并登录你的路由器。转到 DNS 部分,然后你将在 Primary DNS Server 一栏中看到一个 IP 地址;复制并粘贴它,作为一行 nameserver 放在现有网关那行的 '''上面'''。<br />
<br />
例如,{{ic|/etc/resolv.conf}} 应该看上去是像这样的<br />
<br />
nameserver 10.1.1.1<br />
<br />
如果我的主 DNS 服务器是 211.29.132.12,那么修改 {{ic|/etc/resolv.conf}} 为<br />
<br />
nameserver 211.29.132.12<br />
nameserver 10.1.1.1<br />
<br />
现在执行{{ic|systemctl restart dhcpcd@<interface>}}重启 network 守护进程并执行 {{ic|pacman -Syy}}。如果它与服务器正常地同步了,那么问题就解决了。<br />
<br />
==== 更多 ====<br />
<br />
这是 whirlpool 论坛(Australian ISP community)中对这个问题的讨论并给出了相同的解决办法。<br />
<br />
http://forums.whirlpool.net.au/forum-replies-archive.cfm/461625.html<br />
<br />
=== 检查 DHCP 问题先释放 IP 地址 ===<br />
<br />
当 DHCP 获得了错误的 IP 分配就可能产生这个问题。举例来说,当两个路由器通过VPN相连,通过VPN与我相连的路由器可能分配IP地址。要修复这个问题,在终端中以 root 权限释放 IP 地址:<br />
<br />
# dhcpcd -k<br />
<br />
然后请求一个新的地址:<br />
<br />
# dhcpcd<br />
<br />
可能你必须运行这两个命令好几次。<br />
<br />
=== Atheros AR8161 没有 eth0 ===<br />
<br />
对于 Atheros AR8161 Gigabit 以太网卡,以太网连接不能立即使用(2013年3月的安装介质)。它需要加载模块 "alx",但其并不存在。<br />
<br />
你需要安装 [https://backports.wiki.kernel.org/index.php/Releases compat-drives] 中的驱动。后缀 "-u" 说明 Qualcomm 可以使用通用的 Driver 模块。<br />
<br />
$ wget https://www.kernel.org/pub/linux/kernel/projects/backports/2013/03/28/compat-drivers-2013-03-28-5-u.tar.bz2<br />
$ tar xjf compat*<br />
$ cd compat*<br />
$ ./scripts/driver-select alx<br />
$ make<br />
$ sudo make install<br />
$ sudo modprobe alx<br />
<br />
alx 驱动由于各种问题且不同内核版本之间的兼容性不佳而没有被加入 Linux 内核。要获得更好的支持,访问 [http://lists.infradead.org/mailman/listinfo/unified-drivers 邮件列表] 和 [http://www.linuxfoundation.org/collaborate/workgroups/networking/alx alx 页面] 获得最新的 alx 可行方案。<br />
<br />
每次内核发生变化时,这个驱动都必须重新编译和安装。<br />
<br />
另外,你可以使用 [https://aur.archlinux.org/packages/compat-drivers-patched/ compat 驱动]的 AUR 软件包,它还会安装许多其它驱动。<br />
<br />
=== Atheros AR9485 没有 eth0 ===<br />
<br />
{{注意|3.10.2-1-ARCH 内核更新的软件包中包括了 alx 以太网驱动模块。}}<br />
<br />
Atheros AR9485 的以太网连接(eth0)不能立即使用(2013年3月的安装介质)。一个可行的解决方法是从 AUR 中安装 [https://aur.archlinux.org/packages/compat-drivers-patched/ compat-drivers-patched] 软件包。<br />
<br />
=== 待机后未接线缆 / 无连接 ===<br />
<br />
待机以后,接入网络电缆后仍找不到连接。这可能是由于 PCI 电源管理引起的。以下命令的输出<br />
<br />
# ip link show eth0<br />
<br />
如果网线接入 eth0 端口之后这一行仍含有,那么可能 the device was auto-suspended and the media sense feature doesn't work。要解决这个问题,首先你需要找到网卡控制器的 PCI 地址,通过<br />
<br />
# lspci<br />
<br />
结果应该类似于这样:<br />
<br />
...<br />
00:19.0 Ethernet controller: Intel Corporation 82577LM Gigabit Network Connection (rev 06)<br />
...<br />
<br />
所以这里的地址是 00:19.0。<br />
现在这样检查设备的电源状态:<br />
<br />
# cat "/sys/bus/pci/devices/0000:00:19.0/power/control"<br />
<br />
使用从 lspci 中获得的地址替换 00:19.0。<br />
如果输出结果为 "auto",你可以尝试让设备不再待机,输入<br />
<br />
# echo on > "/sys/bus/pci/devices/0000:00:19.0/power/control"<br />
<br />
不要忘记再一次替换地址。<br />
<br />
{{注意|1=这是内核 3.8.4.1 的缺陷:[https://bbs.archlinux.org/viewtopic.php?id=159837&p=2 论坛讨论]。在 3.9 中应该会 [https://lkml.org/lkml/2013/1/18/147 修复]。在更新内核前,可以使用上述方法。}}<br />
<br />
=== Broadcom BCM57780 ===<br />
<br />
这个 Broadcom 芯片只有你指定模块的加载顺序后才能正常工作。这些模块是 {{ic|broadcom}} 和 {{ic|tg3}},前者需要首先加载。<br />
<br />
如果你的电脑有这个芯片,这些步骤应该有用:<br />
<br />
$ lspci | grep Ethernet<br />
02:00.0 Ethernet controller: Broadcom Corporation NetLink BCM57780 Gigabit Ethernet PCIe (rev 01)<br />
<br />
如果你的有线网络不能工作,尝试断开网线,然后以 root 权限实施以下步骤:<br />
<br />
# modprobe -r tg3<br />
# modprobe broadcom<br />
# modprobe tg3<br />
<br />
现在接入网线。如果现在你的故障解决了,你可以把 {{ic|broadcom}} 和 {{ic|tg3}} (以此顺序)加入到 {{ic|/etc/mkinitcpio.conf}} 的 {{ic|MODULES}} 一行,使得变更持久化:<br />
<br />
MODULES=".. broadcom tg3 .."<br />
<br />
然后重新编译 initramfs:<br />
<br />
# mkinitcpio -p linux<br />
<br />
{{注意|这些方法可能也适用于其它芯片,例如 BCM57760。}}</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Udev_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409287
Udev (简体中文)
2015-11-15T16:03:52Z
<p>Aaron chen: /* 设置静态设备名 */</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category: 简体中文]]<br />
[[Category:Hardware detection and troubleshooting (简体中文)]]<br />
[[cs:Udev]]<br />
[[de:Udev]]<br />
[[en:Udev]]<br />
[[es:Udev]]<br />
[[fr:Udev]]<br />
[[it:Udev]]<br />
[[ja:Udev]]<br />
[[ru:Udev]]<br />
[[zh-TW:Udev]]<br />
{{TranslationStatus (简体中文)|Udev|2015-10-07|403579}}<br />
摘自[[Wikipedia:Udev|维基百科:Udev]]:<br />
:udev 是 Linux 内核的设备管理器。总的来说,它取代了 devfs 和 hotplug,负责管理 {{ic|/dev}} 中的设备节点。同时,udev 也处理所有用户空间发生的硬件添加、删除事件,以及某些特定设备所需的固件加载。<br />
<br />
{{ic|udev}} 取代了{{ic|hotplug}} 和 {{Ic|hwdetect}}两个工具。<br />
<br />
与传统的顺序加载相比,udev 通过并行加载内核模块提供了潜在的性能优势。异步加载模块的方式也有一个天生的缺点:无法保证每次加载模块的顺序,如果机器具有多个块设备,那么它们的设备节点可能随机变化。例如如果有两个硬盘,{{ic|/dev/sda}} 可能会随机变成{{ic|/dev/sdb}}。后面有更详细的信息。<br />
<br />
== 安装 ==<br />
<br />
Udev 现在是 {{Pkg|systemd}} 的组成部分,默认已安装。有关信息请查阅 {{ic|systemd-udevd.service(8)}} 的[[man page|手册页]]。<br />
<br />
AUR 里有一个独立的 Udev 派生版:[[eudev]]。<br />
<br />
== udev 规则 ==<br />
udev 规则以管理员身份编写并保存在 {{ic|/etc/udev/rules.d/}} 目录,其文件名必须以 {{ic|.rules}} 结尾。各种软件包提供的规则文件位于 {{ic|/lib/udev/rules.d/}}。如果 {{ic|/usr/lib}} 和 {{ic|/etc}} 这两个目录中有同名文件,则 {{ic|/etc}} 中的文件优先。 <br />
<br />
=== 编写 udev 规则 ===<br />
<br />
{{Expansion|You can workaround the FUSE errors (caused by udev killing the mount process) by using a systemd service [https://github.com/Ferk/udev-media-automount] [http://jasonwryan.com/blog/2014/01/20/udev/]}}<br />
<br />
{{Warning|To mount removable drives, do not call {{ic|mount}} from udev rules. In case of FUSE filesystems, you will get {{ic|Transport endpoint not connected}} errors. Instead, you could use [[udisks]] that handles automount correctly or to make mount work inside udev rules, copy {{ic|/usr/lib/systemd/system/systemd-udevd.service}} to {{ic|/etc/systemd/system/systemd-udevd.service}} and replace {{ic|1=MountFlags=slave}} to {{ic|1=MountFlags=shared}}.[http://unix.stackexchange.com/a/154318] Keep in mind though that udev is not intended to invoke long-running processes.}}<br />
<br />
* 要想学习写udev规则,请访问[http://www.reactivated.net/writing_udev_rules.html 编写 udev 规则]。(译注:[http://www.cnitblog.com/luofuchong/archive/2007/12/18/37831.html 这里]有一篇转载的该文简体中文译本)<br />
* 要想查看 udev 规则的例子,请查阅上述文章的 [http://www.reactivated.net/writing_udev_rules.html#example-printer 范例] 章节。<br />
<br />
下面是一个规则的实例,给出的是当接入一个摄像头时创建一个符号链接 {{ic|/dev/video-cam1}} 。首先,我们发现摄像头被接入并且被挂载为 {{ic|/dev/video2}} 设备。写下这条规则的原因是由于下一次引导时这个设备可能会有个不同的名字,比如 {{ic|/dev/video0}}。<br />
<br />
{{hc|# udevadm info -a -p $(udevadm info -q path -n /dev/video2)|<nowiki><br />
Udevadm info starts with the device specified by the devpath and then walks up the chain of parent devices. It prints for every device found, all possible attributes in the udev rules key format. A rule to match, can be composed by the attributes of the device and the attributes from one single parent device.<br />
<br />
looking at device '/devices/pci0000:00/0000:00:04.1/usb3/3-2/3-2:1.0/video4linux/video2':<br />
KERNEL=="video2"<br />
SUBSYSTEM=="video4linux"<br />
...<br />
looking at parent device '/devices/pci0000:00/0000:00:04.1/usb3/3-2/3-2:1.0':<br />
KERNELS=="3-2:1.0"<br />
SUBSYSTEMS=="usb"<br />
...<br />
looking at parent device '/devices/pci0000:00/0000:00:04.1/usb3/3-2':<br />
KERNELS=="3-2"<br />
SUBSYSTEMS=="usb"<br />
...<br />
ATTRS{idVendor}=="05a9"<br />
...<br />
ATTRS{manufacturer}=="OmniVision Technologies, Inc."<br />
ATTRS{removable}=="unknown"<br />
ATTRS{idProduct}=="4519"<br />
ATTRS{bDeviceClass}=="00"<br />
ATTRS{product}=="USB Camera"<br />
...<br />
</nowiki>}}<br />
<br />
From the video4linux device we use {{ic|<nowiki>KERNEL=="video2"</nowiki>}} and {{ic|<nowiki>SUBSYSTEM=="video4linux"</nowiki>}}, then we match the webcam using vendor and product ID's from the usb parent {{ic|<nowiki>SUBSYSTEMS=="usb"</nowiki>}}, {{ic|<nowiki>ATTRS{idVendor}=="05a9"</nowiki>}} and {{ic|<nowiki>ATTRS{idProduct}=="4519"</nowiki>}}.<br />
<br />
{{hc|/etc/udev/rules.d/83-webcam.rules|<nowiki><br />
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="05a9", ATTRS{idProduct}=="4519", SYMLINK+="video-cam1"<br />
</nowiki>}}<br />
<br />
In the example above we create a symlink using {{ic|<nowiki>SYMLINK+="video-cam1"</nowiki>}} but we could easily set user {{ic|<nowiki>OWNER="john"</nowiki>}} or group using {{ic|<nowiki>GROUP="video"</nowiki>}} or set the permissions using {{ic|<nowiki>MODE="0660"</nowiki>}}. However, if you intend to write a rule to do something when a device is being removed, be aware that device attributes may not be accessible. In this case, you will have to work with preset device [[environment variables]]. To monitor those environment variables, execute the following command while unplugging your device:<br />
<br />
# udevadm monitor --environment --udev<br />
<br />
In this command's output, you will see value pairs such as ID_VENDOR_ID and ID_MODEL_ID, which match your previously used attributes "idVendor" and "idProduct". A rule that uses device environment variables may look like this:<br />
<br />
{{hc|/etc/udev/rules.d/83-webcam-removed.rules|<nowiki><br />
ACTION=="remove", SUBSYSTEM=="usb", ENV{ID_VENDOR_ID}=="05a9", ENV{ID_MODEL_ID}=="4519", RUN+="/path/to/your/script"<br />
</nowiki>}}<br />
<br />
=== 列出设备属性 ===<br />
<br />
To get a list of all of the attributes of a device you can use to write rules, run this command:<br />
<br />
# udevadm info -a -n [device name]<br />
<br />
Replace {{ic|[device name]}} with the device present in the system, such as {{ic|/dev/sda}} or {{ic|/dev/ttyUSB0}}.<br />
<br />
If you do not know the device name you can also list all attributes of a specific system path:<br />
<br />
# udevadm info -a -p /sys/class/backlight/acpi_video0<br />
<br />
=== 加载前测试规则 ===<br />
<br />
# udevadm test $(udevadm info -q path -n [device name]) 2>&1<br />
<br />
This will not perform all actions in your new rules but it will however process symlink rules on existing devices which might come in handy if you are unable to load them otherwise. You can also directly provide the path to the device you want to test the udev rule for:<br />
<br />
# udevadm test /sys/class/backlight/acpi_video0/<br />
<br />
=== 加载新规则 ===<br />
<br />
Udev 自动侦测规则文件的变化,所以修改会立即生效,无需重启 udev。但已接入设备的规则不会自动触发。像 USB 这类热插拔设备也许需要重新插拔才能使新规则生效,也可能需要卸载并重载内核的 ohci-hcd 和 ehci-hcd 模块以重新挂载所有 USB 设备。<br />
<br />
如果规则自动重载失败<br />
<br />
# udevadm control --reload<br />
<br />
可以手工强制触发规则<br />
<br />
# udevadm trigger<br />
<br />
== Udisks ==<br />
<br />
参阅 [[Udisks]].<br />
<br />
== 提示与技巧 ==<br />
<br />
=== 访问固件编程器(烧录器)和 USB 虚拟串行设备 ===<br />
<br />
{{Accuracy|Making a device world-writable is not secure.}}<br />
{{Style|One example is enough, others can surely be found with {{ic|lsusb}}.}}<br />
<br />
The following ruleset will allow normal users (within the "users" group) the ability to access the [http://www.ladyada.net/make/usbtinyisp/ USBtinyISP] USB programmer for AVR microcontrollers and a generic (SiLabs [http://www.silabs.com/products/interface/usbtouart CP2102]) USB to UART adapter, the [http://www.atmel.com/tools/AVRDRAGON.aspx?tab=overview Atmel AVR Dragon] programmer, and the [http://www.atmel.com/tools/AVRISPMKII.aspx Atmel AVR ISP mkII]. Adjust the permissions accordingly. Verified as of 31-10-2012.<br />
<br />
{{hc|/etc/udev/rules.d/50-embedded_devices.rules|2=<nowiki><br />
# USBtinyISP Programmer rules<br />
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c9f", GROUP="users", MODE="0666"<br />
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="0479", GROUP="users", MODE="0666"<br />
<br />
# USBasp Programmer rules http://www.fischl.de/usbasp/<br />
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", GROUP="users", MODE="0666"<br />
<br />
# Mdfly.com Generic (SiLabs CP2102) 3.3v/5v USB VComm adapter<br />
SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", GROUP="users", MODE="0666"<br />
<br />
#Atmel AVR Dragon (dragon_isp) rules<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2107", GROUP="users", MODE="0666"<br />
<br />
#Atmel AVR JTAGICEMKII rules<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2103", GROUP="users", MODE="0666"<br />
<br />
#Atmel Corp. AVR ISP mkII<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2104", GROUP="users", MODE="0666"<br />
<br />
#Atmel Copr. JTAGICE3<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2140", GROUP="users", MODE="0666"<br />
</nowiki>}}<br />
<br />
=== USB 插入时执行规则 ===<br />
<br />
See the [[Execute on USB insert]] article or the [http://igurublog.wordpress.com/downloads/script-devmon/ devmon wrapper script].<br />
<br />
=== VGA 线缆接入时执行规则 ===<br />
<br />
Create the rule {{ic|/etc/udev/rules.d/95-monitor-hotplug.rules}} with the following content to launch {{Pkg|arandr}} on plug in of a VGA monitor cable:<br />
<br />
KERNEL=="card0", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/''username''/.Xauthority", RUN+="/usr/bin/arandr"<br />
<br />
=== 侦测新的 eSATA 设备 ===<br />
<br />
If your eSATA drive is not detected when you plug it in, there are a few things you can try. You can reboot with the eSATA plugged in. Or you could try<br />
<br />
# echo 0 0 0 | tee /sys/class/scsi_host/host*/scan<br />
<br />
Or you could install {{AUR|scsiadd}} (from the AUR) and try<br />
<br />
# scsiadd -s<br />
<br />
Hopefully, your drive is now in {{ic|/dev}}. If it is not, you could try the above commands while running<br />
<br />
# udevadm monitor<br />
<br />
to see if anything is actually happening.<br />
<br />
=== 将内置 SATA 接口标记为 eSATA ===<br />
<br />
If you connected a eSATA bay or an other eSATA adapter the system will still recognize this disk as an internal SATA drive. [[GNOME]] and [[KDE]] will ask you for your root password all the time. The following rule will mark the specified SATA-Port as an external eSATA-Port. With that, a normal GNOME user can connect their eSATA drives to that port like a USB drive, without any root password and so on.<br />
<br />
{{hc|/etc/udev/rules.d/10-esata.rules|2=<nowiki><br />
DEVPATH=="/devices/pci0000:00/0000:00:1f.2/host4/*", ENV{UDISKS_SYSTEM}="0"<br />
</nowiki>}}<br />
<br />
{{Note|The {{ic|DEVPATH}} can be found after connection the eSATA drive with the following commands (replace {{ic|sdb}} accordingly):<br />
<br />
# udevadm info -q path -n /dev/sdb<br />
/devices/pci0000:00/0000:00:1f.2/host4/target4:0:0/4:0:0:0/block/sdb<br />
<br />
# find /sys/devices/ -name sdb<br />
/sys/devices/pci0000:00/0000:00:1f.2/host4/target4:0:0/4:0:0:0/block/sdb<br />
}}<br />
<br />
=== 设置静态设备名 ===<br />
<br />
由于 udev 异步加载所有模块,使得它们被初始化的次序不同。这将导致设备会随机改变名称。可以添加一条 udev 规则使得设备使用静态名称。<br />
<br />
对于块设备和网络设备的规则配置,请分别参阅 [[Persistent block device naming (简体中文)|块设备持久化命名 ]]和[[Network configuration (简体中文)#设备名称|网络配置-设备名称]]。<br />
<br />
==== 视频设备 ====<br />
<br />
For setting up the webcam in the first place, refer to [[Webcam setup#Webcam configuration|Webcam configuration]].<br />
<br />
Using multiple webcams, useful for example with {{pkg|motion}} (software motion detector which grabs images from video4linux devices and/or from webcams), will assign video devices as /dev/video0..n randomly on boot. The recommended solution is to create symlinks using an ''udev'' rule (as in the example in [[#Writing udev rules]]):<br />
<br />
{{hc|/etc/udev/rules.d/83-webcam.rules|<nowiki><br />
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="05a9", ATTRS{idProduct}=="4519", SYMLINK+="video-cam1"<br />
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="08f6", SYMLINK+="video-cam2"<br />
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="0840", SYMLINK+="video-cam3"<br />
</nowiki>}}<br />
<br />
{{Note|Using names other than {{ic|/dev/video*}} will break preloading of {{ic|v4l1compat.so}} and perhaps {{ic|v4l2convert.so}}}}<br />
<br />
==== 打印机 ====<br />
<br />
If you use multiple printers, {{ic|/dev/lp[0-9]}} devices will be assigned randomly on boot, which will break e.g. [[CUPS]] configuration. <br />
<br />
You can create following rule, which will create symlinks under {{ic|/dev/lp/by-id}} and {{ic|/dev/lp/by-path}}, similar to [[Persistent block device naming]] scheme:<br />
<br />
{{hc|/etc/udev/rules.d/60-persistent-printer.rules|<nowiki><br />
ACTION=="remove", GOTO="persistent_printer_end"<br />
<br />
# This should not be necessary<br />
#KERNEL!="lp*", GOTO="persistent_printer_end"<br />
<br />
SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id"<br />
ENV{ID_TYPE}!="printer", GOTO="persistent_printer_end"<br />
<br />
ENV{ID_SERIAL}=="?*", SYMLINK+="lp/by-id/$env{ID_BUS}-$env{ID_SERIAL}"<br />
<br />
IMPORT{builtin}="path_id"<br />
ENV{ID_PATH}=="?*", SYMLINK+="lp/by-path/$env{ID_PATH}"<br />
<br />
LABEL="persistent_printer_end"<br />
</nowiki>}}<br />
<br />
==== USB 闪存设备 ====<br />
<br />
USB flash devices usually contain partitions, and partition labels are one way to have a static naming for a device. Another way is to create a udev rule for it. <br />
<br />
Get the serial number and USB ids from the USB flash drive (if you use multiple of the same make, you might have to check the serial is indeed unique):<br />
lsusb -v | grep -A 5 Vendor<br />
<br />
Create a udev rule for it by adding the following to a file in {{ic|/etc/udev/rules.d/}}, such as {{ic|8-usbstick.rules}}:<br />
KERNEL=="sd*", ATTRS{serial}=="$SERIAL", ATTRS{idVendor}=="$VENDOR", ATTRS{idProduct}=="$PRODUCT" SYMLINK+="$SYMLINK%n"<br />
<br />
Replace {{ic|$SERIAL}}, {{ic|$VENDOR}}, {{ic|$PRODUCT}} from above output accordingly and {{ic|$SYMLINK}} with the desired name. {{ic|%n}} will expand to the partition number. For example, if the device has two partitions, two symlinks will be created. You do not need to go with the 'serial' attribute. If you have a custom rule of your own, you can put it in as well (e.g. using the vendor name).<br />
<br />
Rescan sysfs:<br />
udevadm trigger<br />
Now check the contents of {{ic|/dev}}:<br />
ls /dev<br />
It should show the device with the desired name.<br />
<br />
=== 唤醒挂起的 USB 设备 ===<br />
<br />
First, find vendor and product ID of your device, for example<br />
<br />
{{hc|<nowiki># lsusb | grep Logitech</nowiki>|Bus 007 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver}}<br />
<br />
Now change the {{ic|power/wakeup}} attribute of the device and the USB controller it is connected to, which is in this case {{ic|driver/usb7/power/wakeup}}. Use the following rule:<br />
<br />
{{hc|/etc/udev/rules.d/50-wake-on-device.rules|<nowiki><br />
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52b", ATTR{power/wakeup}="enabled", ATTR{driver/usb7/power/wakeup}="enabled"<br />
</nowiki>}}<br />
<br />
{{Note|Also make sure the USB controller is enabled in {{ic|/proc/acpi/wakeup}}.}}<br />
<br />
=== 触发事件 ===<br />
<br />
{{Merge|#Testing rules before loading|similar trick}}<br />
<br />
It can be useful to trigger various udev events. For example, you might want to simulate a USB device disconnect on a remote machine. In such cases, use {{ic|udevadm trigger}}:<br />
<br />
# udevadm trigger -v -t subsystems -c remove -s usb -a "idVendor=abcd"<br />
<br />
This command will trigger a USB remove event on all USB devices with vendor ID {{ic|abcd}}.<br />
<br />
== 排错 ==<br />
<br />
=== 屏蔽模块 ===<br />
极个别情况下,udev 也会犯错或加载错误的模块。为了防止错误的发生,你可以使用模块禁用列表。只要模块加入该列表,无论是启动时,或者是运行时(如usb硬盘等)udev都不会加载这些模块。参见[[blacklisting]].<br />
<br />
=== udevd 引导时挂起 ===<br />
<br />
After migrating to LDAP or updating an LDAP-backed system udevd can hang at boot at the message "Starting UDev Daemon". This is usually caused by udevd trying to look up a name from LDAP but failing, because the network is not up yet. The solution is to ensure that all system group names are present locally.<br />
<br />
Extract the group names referenced in udev rules and the group names actually present on the system:<br />
<br />
# fgrep -r GROUP /etc/udev/rules.d/ /usr/lib/udev/rules.d | perl -nle '/GROUP\s*=\s*"(.*?)"/ && print $1;' | sort | uniq > udev_groups<br />
# cut -f1 -d: /etc/gshadow /etc/group | sort | uniq > present_groups<br />
<br />
To see the differences, do a side-by-side diff:<br />
<br />
# diff -y present_groups udev_groups<br />
...<br />
network <<br />
nobody <<br />
ntp <<br />
optical optical<br />
power | pcscd<br />
rfkill <<br />
root root<br />
scanner scanner<br />
smmsp <<br />
storage storage<br />
...<br />
<br />
In this case, the {{ic|pcscd}} group is for some reason not present in the system. [[Users and groups#Group management|Add the missing groups]]. Also, make sure that local resources are looked up before resorting to LDAP. {{ic|/etc/nsswitch.conf}} should contain the following line:<br />
<br />
group: files ldap<br />
<br />
=== BusLogic ===<br />
<br />
BusLogic 设备被损坏而且导致启动时死机。这是一个内核的Bug目前还没有修正。<br />
<br />
=== 一些移动设备不可移除 ===<br />
创建自定义 udev 规则,设置 UDISKS_SYSTEM_INTERNAL=0。参见 udisks 手册。<br />
<br />
<br />
=== 声音问题和一些不能自动加载的模块 ===<br />
一些用户发现 {{ic|/etc/modprobe.d/sound.conf}} 中的遗留配置会引起这些问题,请清理配置并重试。<br />
{{注意|从 {{Ic|udev>&#61;171}} 开始 OSS 模拟模块({{Ic|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) 默认不会自动装载。}}<br />
<br />
<br />
=== IDE CD/DVD 驱动器的支持 ===<br />
<br />
Starting with version 170, udev does not support CD-ROM/DVD-ROM drives that are loaded as traditional IDE drives with the {{ic|ide_cd_mod}} module and show up as {{ic|/dev/hd*}}. The drive remains usable for tools which access the hardware directly, like ''cdparanoia'', but is invisible for higher userspace programs, like KDE.<br />
<br />
A cause for the loading of the ide_cd_mod module prior to others, like sr_mod, could be e.g. that you have for some reason the module piix loaded with your [[initramfs]]. In that case you can just replace it with ata_piix in your {{ic|/etc/mkinitcpio.conf}}.<br />
<br />
=== 光驱被标识为磁盘 ===<br />
<br />
If the group ID of your optical drive is set to {{ic|disk}} and you want to have it set to {{ic|optical}}, you have to create a custom udev rule:<br />
<br />
{{hc|/etc/udev/rules.d|2=<nowiki><br />
# permissions for IDE CD devices<br />
SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", ATTRS{media}=="cdrom*", GROUP="optical"<br />
<br />
# permissions for SCSI CD devices<br />
SUBSYSTEMS=="scsi", KERNEL=="s[rg][0-9]*", ATTRS{type}=="5", GROUP="optical"</nowiki>}}<br />
<br />
== 参阅 ==<br />
<br />
* [https://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/udev.html udev 主页]<br />
* [https://www.linux.com/news/hardware/peripherals/180950-udev udev 介绍]<br />
* [http://vger.kernel.org/vger-lists.html#linux-hotplug udev 邮件列表]<br />
* [http://jasonwryan.com/blog/2014/01/20/udev/ Scripting with udev]<br />
* [http://www.reactivated.net/writing_udev_rules.html 编写 udev 规则]<br />
* 中文读者可参阅 [http://www.jinbuguo.com/ 金步国]先生翻译的 [http://www.jinbuguo.com/systemd/udev.html udev 中文手册]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Udev_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409286
Udev (简体中文)
2015-11-15T15:50:05Z
<p>Aaron chen: /* 参阅 */</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category: 简体中文]]<br />
[[Category:Hardware detection and troubleshooting (简体中文)]]<br />
[[cs:Udev]]<br />
[[de:Udev]]<br />
[[en:Udev]]<br />
[[es:Udev]]<br />
[[fr:Udev]]<br />
[[it:Udev]]<br />
[[ja:Udev]]<br />
[[ru:Udev]]<br />
[[zh-TW:Udev]]<br />
{{TranslationStatus (简体中文)|Udev|2015-10-07|403579}}<br />
摘自[[Wikipedia:Udev|维基百科:Udev]]:<br />
:udev 是 Linux 内核的设备管理器。总的来说,它取代了 devfs 和 hotplug,负责管理 {{ic|/dev}} 中的设备节点。同时,udev 也处理所有用户空间发生的硬件添加、删除事件,以及某些特定设备所需的固件加载。<br />
<br />
{{ic|udev}} 取代了{{ic|hotplug}} 和 {{Ic|hwdetect}}两个工具。<br />
<br />
与传统的顺序加载相比,udev 通过并行加载内核模块提供了潜在的性能优势。异步加载模块的方式也有一个天生的缺点:无法保证每次加载模块的顺序,如果机器具有多个块设备,那么它们的设备节点可能随机变化。例如如果有两个硬盘,{{ic|/dev/sda}} 可能会随机变成{{ic|/dev/sdb}}。后面有更详细的信息。<br />
<br />
== 安装 ==<br />
<br />
Udev 现在是 {{Pkg|systemd}} 的组成部分,默认已安装。有关信息请查阅 {{ic|systemd-udevd.service(8)}} 的[[man page|手册页]]。<br />
<br />
AUR 里有一个独立的 Udev 派生版:[[eudev]]。<br />
<br />
== udev 规则 ==<br />
udev 规则以管理员身份编写并保存在 {{ic|/etc/udev/rules.d/}} 目录,其文件名必须以 {{ic|.rules}} 结尾。各种软件包提供的规则文件位于 {{ic|/lib/udev/rules.d/}}。如果 {{ic|/usr/lib}} 和 {{ic|/etc}} 这两个目录中有同名文件,则 {{ic|/etc}} 中的文件优先。 <br />
<br />
=== 编写 udev 规则 ===<br />
<br />
{{Expansion|You can workaround the FUSE errors (caused by udev killing the mount process) by using a systemd service [https://github.com/Ferk/udev-media-automount] [http://jasonwryan.com/blog/2014/01/20/udev/]}}<br />
<br />
{{Warning|To mount removable drives, do not call {{ic|mount}} from udev rules. In case of FUSE filesystems, you will get {{ic|Transport endpoint not connected}} errors. Instead, you could use [[udisks]] that handles automount correctly or to make mount work inside udev rules, copy {{ic|/usr/lib/systemd/system/systemd-udevd.service}} to {{ic|/etc/systemd/system/systemd-udevd.service}} and replace {{ic|1=MountFlags=slave}} to {{ic|1=MountFlags=shared}}.[http://unix.stackexchange.com/a/154318] Keep in mind though that udev is not intended to invoke long-running processes.}}<br />
<br />
* 要想学习写udev规则,请访问[http://www.reactivated.net/writing_udev_rules.html 编写 udev 规则]。(译注:[http://www.cnitblog.com/luofuchong/archive/2007/12/18/37831.html 这里]有一篇转载的该文简体中文译本)<br />
* 要想查看 udev 规则的例子,请查阅上述文章的 [http://www.reactivated.net/writing_udev_rules.html#example-printer 范例] 章节。<br />
<br />
下面是一个规则的实例,给出的是当接入一个摄像头时创建一个符号链接 {{ic|/dev/video-cam1}} 。首先,我们发现摄像头被接入并且被挂载为 {{ic|/dev/video2}} 设备。写下这条规则的原因是由于下一次引导时这个设备可能会有个不同的名字,比如 {{ic|/dev/video0}}。<br />
<br />
{{hc|# udevadm info -a -p $(udevadm info -q path -n /dev/video2)|<nowiki><br />
Udevadm info starts with the device specified by the devpath and then walks up the chain of parent devices. It prints for every device found, all possible attributes in the udev rules key format. A rule to match, can be composed by the attributes of the device and the attributes from one single parent device.<br />
<br />
looking at device '/devices/pci0000:00/0000:00:04.1/usb3/3-2/3-2:1.0/video4linux/video2':<br />
KERNEL=="video2"<br />
SUBSYSTEM=="video4linux"<br />
...<br />
looking at parent device '/devices/pci0000:00/0000:00:04.1/usb3/3-2/3-2:1.0':<br />
KERNELS=="3-2:1.0"<br />
SUBSYSTEMS=="usb"<br />
...<br />
looking at parent device '/devices/pci0000:00/0000:00:04.1/usb3/3-2':<br />
KERNELS=="3-2"<br />
SUBSYSTEMS=="usb"<br />
...<br />
ATTRS{idVendor}=="05a9"<br />
...<br />
ATTRS{manufacturer}=="OmniVision Technologies, Inc."<br />
ATTRS{removable}=="unknown"<br />
ATTRS{idProduct}=="4519"<br />
ATTRS{bDeviceClass}=="00"<br />
ATTRS{product}=="USB Camera"<br />
...<br />
</nowiki>}}<br />
<br />
From the video4linux device we use {{ic|<nowiki>KERNEL=="video2"</nowiki>}} and {{ic|<nowiki>SUBSYSTEM=="video4linux"</nowiki>}}, then we match the webcam using vendor and product ID's from the usb parent {{ic|<nowiki>SUBSYSTEMS=="usb"</nowiki>}}, {{ic|<nowiki>ATTRS{idVendor}=="05a9"</nowiki>}} and {{ic|<nowiki>ATTRS{idProduct}=="4519"</nowiki>}}.<br />
<br />
{{hc|/etc/udev/rules.d/83-webcam.rules|<nowiki><br />
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="05a9", ATTRS{idProduct}=="4519", SYMLINK+="video-cam1"<br />
</nowiki>}}<br />
<br />
In the example above we create a symlink using {{ic|<nowiki>SYMLINK+="video-cam1"</nowiki>}} but we could easily set user {{ic|<nowiki>OWNER="john"</nowiki>}} or group using {{ic|<nowiki>GROUP="video"</nowiki>}} or set the permissions using {{ic|<nowiki>MODE="0660"</nowiki>}}. However, if you intend to write a rule to do something when a device is being removed, be aware that device attributes may not be accessible. In this case, you will have to work with preset device [[environment variables]]. To monitor those environment variables, execute the following command while unplugging your device:<br />
<br />
# udevadm monitor --environment --udev<br />
<br />
In this command's output, you will see value pairs such as ID_VENDOR_ID and ID_MODEL_ID, which match your previously used attributes "idVendor" and "idProduct". A rule that uses device environment variables may look like this:<br />
<br />
{{hc|/etc/udev/rules.d/83-webcam-removed.rules|<nowiki><br />
ACTION=="remove", SUBSYSTEM=="usb", ENV{ID_VENDOR_ID}=="05a9", ENV{ID_MODEL_ID}=="4519", RUN+="/path/to/your/script"<br />
</nowiki>}}<br />
<br />
=== 列出设备属性 ===<br />
<br />
To get a list of all of the attributes of a device you can use to write rules, run this command:<br />
<br />
# udevadm info -a -n [device name]<br />
<br />
Replace {{ic|[device name]}} with the device present in the system, such as {{ic|/dev/sda}} or {{ic|/dev/ttyUSB0}}.<br />
<br />
If you do not know the device name you can also list all attributes of a specific system path:<br />
<br />
# udevadm info -a -p /sys/class/backlight/acpi_video0<br />
<br />
=== 加载前测试规则 ===<br />
<br />
# udevadm test $(udevadm info -q path -n [device name]) 2>&1<br />
<br />
This will not perform all actions in your new rules but it will however process symlink rules on existing devices which might come in handy if you are unable to load them otherwise. You can also directly provide the path to the device you want to test the udev rule for:<br />
<br />
# udevadm test /sys/class/backlight/acpi_video0/<br />
<br />
=== 加载新规则 ===<br />
<br />
Udev 自动侦测规则文件的变化,所以修改会立即生效,无需重启 udev。但已接入设备的规则不会自动触发。像 USB 这类热插拔设备也许需要重新插拔才能使新规则生效,也可能需要卸载并重载内核的 ohci-hcd 和 ehci-hcd 模块以重新挂载所有 USB 设备。<br />
<br />
如果规则自动重载失败<br />
<br />
# udevadm control --reload<br />
<br />
可以手工强制触发规则<br />
<br />
# udevadm trigger<br />
<br />
== Udisks ==<br />
<br />
参阅 [[Udisks]].<br />
<br />
== 提示与技巧 ==<br />
<br />
=== 访问固件编程器(烧录器)和 USB 虚拟串行设备 ===<br />
<br />
{{Accuracy|Making a device world-writable is not secure.}}<br />
{{Style|One example is enough, others can surely be found with {{ic|lsusb}}.}}<br />
<br />
The following ruleset will allow normal users (within the "users" group) the ability to access the [http://www.ladyada.net/make/usbtinyisp/ USBtinyISP] USB programmer for AVR microcontrollers and a generic (SiLabs [http://www.silabs.com/products/interface/usbtouart CP2102]) USB to UART adapter, the [http://www.atmel.com/tools/AVRDRAGON.aspx?tab=overview Atmel AVR Dragon] programmer, and the [http://www.atmel.com/tools/AVRISPMKII.aspx Atmel AVR ISP mkII]. Adjust the permissions accordingly. Verified as of 31-10-2012.<br />
<br />
{{hc|/etc/udev/rules.d/50-embedded_devices.rules|2=<nowiki><br />
# USBtinyISP Programmer rules<br />
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c9f", GROUP="users", MODE="0666"<br />
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="0479", GROUP="users", MODE="0666"<br />
<br />
# USBasp Programmer rules http://www.fischl.de/usbasp/<br />
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", GROUP="users", MODE="0666"<br />
<br />
# Mdfly.com Generic (SiLabs CP2102) 3.3v/5v USB VComm adapter<br />
SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", GROUP="users", MODE="0666"<br />
<br />
#Atmel AVR Dragon (dragon_isp) rules<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2107", GROUP="users", MODE="0666"<br />
<br />
#Atmel AVR JTAGICEMKII rules<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2103", GROUP="users", MODE="0666"<br />
<br />
#Atmel Corp. AVR ISP mkII<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2104", GROUP="users", MODE="0666"<br />
<br />
#Atmel Copr. JTAGICE3<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2140", GROUP="users", MODE="0666"<br />
</nowiki>}}<br />
<br />
=== USB 插入时执行规则 ===<br />
<br />
See the [[Execute on USB insert]] article or the [http://igurublog.wordpress.com/downloads/script-devmon/ devmon wrapper script].<br />
<br />
=== VGA 线缆接入时执行规则 ===<br />
<br />
Create the rule {{ic|/etc/udev/rules.d/95-monitor-hotplug.rules}} with the following content to launch {{Pkg|arandr}} on plug in of a VGA monitor cable:<br />
<br />
KERNEL=="card0", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/''username''/.Xauthority", RUN+="/usr/bin/arandr"<br />
<br />
=== 侦测新的 eSATA 设备 ===<br />
<br />
If your eSATA drive is not detected when you plug it in, there are a few things you can try. You can reboot with the eSATA plugged in. Or you could try<br />
<br />
# echo 0 0 0 | tee /sys/class/scsi_host/host*/scan<br />
<br />
Or you could install {{AUR|scsiadd}} (from the AUR) and try<br />
<br />
# scsiadd -s<br />
<br />
Hopefully, your drive is now in {{ic|/dev}}. If it is not, you could try the above commands while running<br />
<br />
# udevadm monitor<br />
<br />
to see if anything is actually happening.<br />
<br />
=== 将内置 SATA 接口标记为 eSATA ===<br />
<br />
If you connected a eSATA bay or an other eSATA adapter the system will still recognize this disk as an internal SATA drive. [[GNOME]] and [[KDE]] will ask you for your root password all the time. The following rule will mark the specified SATA-Port as an external eSATA-Port. With that, a normal GNOME user can connect their eSATA drives to that port like a USB drive, without any root password and so on.<br />
<br />
{{hc|/etc/udev/rules.d/10-esata.rules|2=<nowiki><br />
DEVPATH=="/devices/pci0000:00/0000:00:1f.2/host4/*", ENV{UDISKS_SYSTEM}="0"<br />
</nowiki>}}<br />
<br />
{{Note|The {{ic|DEVPATH}} can be found after connection the eSATA drive with the following commands (replace {{ic|sdb}} accordingly):<br />
<br />
# udevadm info -q path -n /dev/sdb<br />
/devices/pci0000:00/0000:00:1f.2/host4/target4:0:0/4:0:0:0/block/sdb<br />
<br />
# find /sys/devices/ -name sdb<br />
/sys/devices/pci0000:00/0000:00:1f.2/host4/target4:0:0/4:0:0:0/block/sdb<br />
}}<br />
<br />
=== 设置静态设备名 ===<br />
<br />
Because udev loads all modules asynchronously, they are initialized in a different order. This can result in devices randomly switching names. A udev rule can be added to use static device names.<br />
<br />
See also [[Persistent block device naming]] for block devices and [[Network configuration#Device names]] for network devices.<br />
<br />
==== 视频设备 ====<br />
<br />
For setting up the webcam in the first place, refer to [[Webcam setup#Webcam configuration|Webcam configuration]].<br />
<br />
Using multiple webcams, useful for example with {{pkg|motion}} (software motion detector which grabs images from video4linux devices and/or from webcams), will assign video devices as /dev/video0..n randomly on boot. The recommended solution is to create symlinks using an ''udev'' rule (as in the example in [[#Writing udev rules]]):<br />
<br />
{{hc|/etc/udev/rules.d/83-webcam.rules|<nowiki><br />
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="05a9", ATTRS{idProduct}=="4519", SYMLINK+="video-cam1"<br />
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="08f6", SYMLINK+="video-cam2"<br />
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="0840", SYMLINK+="video-cam3"<br />
</nowiki>}}<br />
<br />
{{Note|Using names other than {{ic|/dev/video*}} will break preloading of {{ic|v4l1compat.so}} and perhaps {{ic|v4l2convert.so}}}}<br />
<br />
==== 打印机 ====<br />
<br />
If you use multiple printers, {{ic|/dev/lp[0-9]}} devices will be assigned randomly on boot, which will break e.g. [[CUPS]] configuration. <br />
<br />
You can create following rule, which will create symlinks under {{ic|/dev/lp/by-id}} and {{ic|/dev/lp/by-path}}, similar to [[Persistent block device naming]] scheme:<br />
<br />
{{hc|/etc/udev/rules.d/60-persistent-printer.rules|<nowiki><br />
ACTION=="remove", GOTO="persistent_printer_end"<br />
<br />
# This should not be necessary<br />
#KERNEL!="lp*", GOTO="persistent_printer_end"<br />
<br />
SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id"<br />
ENV{ID_TYPE}!="printer", GOTO="persistent_printer_end"<br />
<br />
ENV{ID_SERIAL}=="?*", SYMLINK+="lp/by-id/$env{ID_BUS}-$env{ID_SERIAL}"<br />
<br />
IMPORT{builtin}="path_id"<br />
ENV{ID_PATH}=="?*", SYMLINK+="lp/by-path/$env{ID_PATH}"<br />
<br />
LABEL="persistent_printer_end"<br />
</nowiki>}}<br />
<br />
==== USB 闪存设备 ====<br />
<br />
USB flash devices usually contain partitions, and partition labels are one way to have a static naming for a device. Another way is to create a udev rule for it. <br />
<br />
Get the serial number and USB ids from the USB flash drive (if you use multiple of the same make, you might have to check the serial is indeed unique):<br />
lsusb -v | grep -A 5 Vendor<br />
<br />
Create a udev rule for it by adding the following to a file in {{ic|/etc/udev/rules.d/}}, such as {{ic|8-usbstick.rules}}:<br />
KERNEL=="sd*", ATTRS{serial}=="$SERIAL", ATTRS{idVendor}=="$VENDOR", ATTRS{idProduct}=="$PRODUCT" SYMLINK+="$SYMLINK%n"<br />
<br />
Replace {{ic|$SERIAL}}, {{ic|$VENDOR}}, {{ic|$PRODUCT}} from above output accordingly and {{ic|$SYMLINK}} with the desired name. {{ic|%n}} will expand to the partition number. For example, if the device has two partitions, two symlinks will be created. You do not need to go with the 'serial' attribute. If you have a custom rule of your own, you can put it in as well (e.g. using the vendor name).<br />
<br />
Rescan sysfs:<br />
udevadm trigger<br />
Now check the contents of {{ic|/dev}}:<br />
ls /dev<br />
It should show the device with the desired name.<br />
<br />
=== 唤醒挂起的 USB 设备 ===<br />
<br />
First, find vendor and product ID of your device, for example<br />
<br />
{{hc|<nowiki># lsusb | grep Logitech</nowiki>|Bus 007 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver}}<br />
<br />
Now change the {{ic|power/wakeup}} attribute of the device and the USB controller it is connected to, which is in this case {{ic|driver/usb7/power/wakeup}}. Use the following rule:<br />
<br />
{{hc|/etc/udev/rules.d/50-wake-on-device.rules|<nowiki><br />
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52b", ATTR{power/wakeup}="enabled", ATTR{driver/usb7/power/wakeup}="enabled"<br />
</nowiki>}}<br />
<br />
{{Note|Also make sure the USB controller is enabled in {{ic|/proc/acpi/wakeup}}.}}<br />
<br />
=== 触发事件 ===<br />
<br />
{{Merge|#Testing rules before loading|similar trick}}<br />
<br />
It can be useful to trigger various udev events. For example, you might want to simulate a USB device disconnect on a remote machine. In such cases, use {{ic|udevadm trigger}}:<br />
<br />
# udevadm trigger -v -t subsystems -c remove -s usb -a "idVendor=abcd"<br />
<br />
This command will trigger a USB remove event on all USB devices with vendor ID {{ic|abcd}}.<br />
<br />
== 排错 ==<br />
<br />
=== 屏蔽模块 ===<br />
极个别情况下,udev 也会犯错或加载错误的模块。为了防止错误的发生,你可以使用模块禁用列表。只要模块加入该列表,无论是启动时,或者是运行时(如usb硬盘等)udev都不会加载这些模块。参见[[blacklisting]].<br />
<br />
=== udevd 引导时挂起 ===<br />
<br />
After migrating to LDAP or updating an LDAP-backed system udevd can hang at boot at the message "Starting UDev Daemon". This is usually caused by udevd trying to look up a name from LDAP but failing, because the network is not up yet. The solution is to ensure that all system group names are present locally.<br />
<br />
Extract the group names referenced in udev rules and the group names actually present on the system:<br />
<br />
# fgrep -r GROUP /etc/udev/rules.d/ /usr/lib/udev/rules.d | perl -nle '/GROUP\s*=\s*"(.*?)"/ && print $1;' | sort | uniq > udev_groups<br />
# cut -f1 -d: /etc/gshadow /etc/group | sort | uniq > present_groups<br />
<br />
To see the differences, do a side-by-side diff:<br />
<br />
# diff -y present_groups udev_groups<br />
...<br />
network <<br />
nobody <<br />
ntp <<br />
optical optical<br />
power | pcscd<br />
rfkill <<br />
root root<br />
scanner scanner<br />
smmsp <<br />
storage storage<br />
...<br />
<br />
In this case, the {{ic|pcscd}} group is for some reason not present in the system. [[Users and groups#Group management|Add the missing groups]]. Also, make sure that local resources are looked up before resorting to LDAP. {{ic|/etc/nsswitch.conf}} should contain the following line:<br />
<br />
group: files ldap<br />
<br />
=== BusLogic ===<br />
<br />
BusLogic 设备被损坏而且导致启动时死机。这是一个内核的Bug目前还没有修正。<br />
<br />
=== 一些移动设备不可移除 ===<br />
创建自定义 udev 规则,设置 UDISKS_SYSTEM_INTERNAL=0。参见 udisks 手册。<br />
<br />
<br />
=== 声音问题和一些不能自动加载的模块 ===<br />
一些用户发现 {{ic|/etc/modprobe.d/sound.conf}} 中的遗留配置会引起这些问题,请清理配置并重试。<br />
{{注意|从 {{Ic|udev>&#61;171}} 开始 OSS 模拟模块({{Ic|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) 默认不会自动装载。}}<br />
<br />
<br />
=== IDE CD/DVD 驱动器的支持 ===<br />
<br />
Starting with version 170, udev does not support CD-ROM/DVD-ROM drives that are loaded as traditional IDE drives with the {{ic|ide_cd_mod}} module and show up as {{ic|/dev/hd*}}. The drive remains usable for tools which access the hardware directly, like ''cdparanoia'', but is invisible for higher userspace programs, like KDE.<br />
<br />
A cause for the loading of the ide_cd_mod module prior to others, like sr_mod, could be e.g. that you have for some reason the module piix loaded with your [[initramfs]]. In that case you can just replace it with ata_piix in your {{ic|/etc/mkinitcpio.conf}}.<br />
<br />
=== 光驱被标识为磁盘 ===<br />
<br />
If the group ID of your optical drive is set to {{ic|disk}} and you want to have it set to {{ic|optical}}, you have to create a custom udev rule:<br />
<br />
{{hc|/etc/udev/rules.d|2=<nowiki><br />
# permissions for IDE CD devices<br />
SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", ATTRS{media}=="cdrom*", GROUP="optical"<br />
<br />
# permissions for SCSI CD devices<br />
SUBSYSTEMS=="scsi", KERNEL=="s[rg][0-9]*", ATTRS{type}=="5", GROUP="optical"</nowiki>}}<br />
<br />
== 参阅 ==<br />
<br />
* [https://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/udev.html udev 主页]<br />
* [https://www.linux.com/news/hardware/peripherals/180950-udev udev 介绍]<br />
* [http://vger.kernel.org/vger-lists.html#linux-hotplug udev 邮件列表]<br />
* [http://jasonwryan.com/blog/2014/01/20/udev/ Scripting with udev]<br />
* [http://www.reactivated.net/writing_udev_rules.html 编写 udev 规则]<br />
* 中文读者可参阅 [http://www.jinbuguo.com/ 金步国]先生翻译的 [http://www.jinbuguo.com/systemd/udev.html udev 中文手册]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Downgrading_packages_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409285
Downgrading packages (简体中文)
2015-11-15T15:19:38Z
<p>Aaron chen: /* 细节 */</p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Package management (简体中文)]]<br />
[[cs:Downgrading packages]]<br />
[[de:Ältere Paketversion installieren (Downgrade)]]<br />
[[en:Downgrading packages]]<br />
[[es:Downgrading packages]]<br />
[[fa:دانگرید]]<br />
[[fr:Downgrade]]<br />
[[it:Downgrading packages]]<br />
[[ja:パッケージのダウングレード]]<br />
[[ru:Downgrading packages]]<br />
[[sk:Downgrading packages]]<br />
[[tr:Paket sürümünü düşürmek]]<br />
[[uk:Downgrading packages]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Arch Build System (简体中文)}}<br />
{{Related|pacman (简体中文)}}<br />
{{Related|Arch Linux Archive (简体中文)}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Downgrading_Packages|2012-09-19|221655}}<br />
本文将会向你展示如何把一个包降级到以前的版本。通常,并不推荐降级包,只有在现有包存在Bug的情况下才推荐降级。<br />
<br />
在降级之前,好好考虑下你为什么要降级。如果是因为现有包有Bug,请花上几分钟帮忙把它报告给Arch的Bug追踪系统或软件包的项目地址。我们和上游的开发者们都会很感激报告Bug的用户。因为Bug 报告中的任何额外信息都有可能节省大量的测试时间,帮助我们发行更加稳定的软件。<br />
<br />
== 原因 ==<br />
<br />
降级一个软件包实质就是卸载当前版本的软件包再安装旧版本的软件包。这个”旧版本“可以是当前版本之前的任何一个版本。<br />
<br />
降级的原因包括:当前软件包有Bug,当前软件包未包含你需要的功能,实验性的目的。不管哪种情况,用户都认为:降级软件包是解决目前包出现问题的一个有效办法。<br />
<br />
降级一个包有时意味着其它包也要跟着它一起降级。对于那些装了一堆实验性或测试性软件包的用户,我们推荐直接重装整个系统而不是一个个降级软件包。<br />
<br />
== 细节 ==<br />
但是,用户必须注意以下几点:<br />
* 注意每个包的依赖性。每个版本的包所需要的库往往是不同的,相关文件的功能跟以前的版本可能完全是不一样的。所以在降级的时候,你也要同时将那些库更改到相应的版本。 <br />
* 注意是否在降级过程中一些必须的文件会被删除。Arch Linux的滚动发行策略使得它不会在软件仓库中保存任何旧软件。下面会详述这个问题。<br />
* 注意在降级过程中对配置文件或脚本做出的更改。在目前,我们会依赖pacman来帮我们处理这个问题。<br />
<br />
== 如何降级软件包 ==<br />
* 问: 当我运行 {{ic|pacman -Syu}} 将软件包从版本甲升级到版本乙之后,发现这个软件包导致系统出现了一些问题,我该怎样将该软件包重新降级到版本甲呢?<br />
* 答: 如果该包不是很重要的话,你可以降级的。先查看你系统的{{ic|/var/cache/pacman/pkg}}目录,看看旧版本的软件包是不是还保存在那儿 (如果你最近没有执行 {{ic|pacman -Scc}}以清空包缓存的话,应该在那儿)。 如果在,你可以执行{{ic|pacman -U pkgname-olderpkgver.pkg.tar.gz}}来安装旧版本。如果pacman提示文件冲突的话,你可以通过加上{{ic|-f}}参数以强制执行,即 {{ic|pacman -U --force pkgname-olderpkgver.pkg.tar.gz}}。<br />
<br />
这个过程会移除现有的包,仔细的计算所有依赖的改变,然后安装你选择的旧版本的软件包以及合适的依赖。<br />
<br />
{{注意|如果你改变了操作系统的一个基本的组件包,你也许需要降级许多包。这些软件包可能在过程中被删除,需要手动一点一点的安装回来;同时,后续升级时要小心,不要重新安装不想要的软件包版本。}}<br />
<br />
在 [[AUR]] 中有一个包叫做{{AUR|downgrade}}。它是一个简单的 Bash 脚本,它会从你的缓存中寻找旧版本的包,如果没有的话它会搜索 [[#ARM|A.R.M.]]。你可以选择一个旧包来安装。它基本上自动化了上面所述的过程。查看 {{Ic|downgrade --help}} 获取使用方法的信息。<br />
<br />
另一个更强大的工具是{{AUR|downgrader}},它可以处理 pacman 的 log,能从 ARM、本地缓存降级,并且可以处理包列表 (如果在升级一些包后不稳定,而你不确定包的名字)<br />
<br />
== 如何找到旧版本 ==<br />
目前有三种方法<br />
<br />
=== 过期源 ===<br />
如果系统上找不到旧版本,请检查未即时同步的源,从里面下载软件包。软件源同步状态可以从[https://www.archlinux.org/mirrors/status/ 这里]获得。<br />
<br />
=== ARM ===<br />
[http://ala.seblu.net/ Arch Rollback Machine] (ARM) 里包含2009年9月1日以来所有仓库的归档。目前(2009年11月21日),这个网站还不稳定,根据以前的报道,丢失了2008年10月1日到目前的一些数据。<br />
<br />
如果你对ARM感兴趣的话,最好是到它的宣传论坛了解一下相关信息,这样可以了解它的最新进度。它的宣传论坛在这里:[https://bbs.archlinux.org/viewtopic.php?id=53665].<br />
<br />
据说,ARM想达到这样一个目的:使得使用wget+pacman可以方便的将你的系统回溯到某个时间点。但他们还没有给出这个自动化过程的具体解释。<br />
<br />
=== 手动编译 ===<br />
最糟糕的情况,如果这些地方都没有找到,那你就需要自己动手编译旧版本的软件包了。如果决定这样做,就可以从abs中先取出该软件包的PKGBUILD文件,然后修改相应的内容(通常是版本号)。或者访问 https://www.archlinux.org/packages/ 搜索你需要的降级的软件包,然后点 "查看修改" 链接,选择“查看日志“。找到你需要的版本然后点击路径。然后下载相应的文件再用makepkg编译即可。<br />
<br />
对于AUR包来说,只能在http://pkgbuild.com/git/aur-mirror.git/ 处找到旧包的PKGBUILD,或者你可以到[Unofficial User Repositories]]处找到旧的二进制包。<br />
<br />
== 更改仓库 ==<br />
要使用ARM仓库的话,注释掉原来的仓库,添加适当的ARM仓库地址即可:<br />
[core]<br />
#<nowiki>Server=http://mirrors.gigenet.com/archlinux/core/os/i686</nowiki><br />
<nowiki>Server=http://arm.konnichi.com/2009/11/01/core/os/i686</nowiki><br />
<br />
在这个例子中,这个配置会把当前系统的包回溯到2009年11月1日的状态。请注意,所有的仓库都是官方仓库的快照。所以你只需要更改{{Ic|/etc/pacman.d/mirrorlist}}处的镜像,把ARM的镜像放在最前头。<br />
然后运行:<br />
pacman -Syy # refresh the sync databases<br />
pacman -Suu # downgrade all packages with a lower version in the repos<br />
<br />
仅仅这样并不能保证无缝的回溯,因为有时候相对于版本号会有包冲突等问题。<br />
<br />
更多信息请参考[[pacman]]<br />
<br />
== FAQ ==<br />
=== 由于依赖问题我无法降级 ===<br />
<br />
你可以使用{{ic|-d}}选项在升级或删除包的时候忽略依赖的限制,比如,{{ic|pacman -Ud pkgpkgname-olderpkgver.pkg.tar.gz}},但这样做有可能破坏你的系统。<br />
<br />
=== 怎么才能阻止Pacman升级我已降级的包? ===<br />
<br />
在{{Ic|pacman.conf}}中设置{{Ic|<nowiki>IgnorePkg = package1 package2</nowiki>}}会使Pacman在更新时忽略你列出的包。<br />
<br />
=== 我想把我的系统回溯到昨天的状态 ===<br />
<br />
如果你使用[[LVM]],并且开启了periodic snapshots的话,这很容易实现。</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Downgrading_packages_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409284
Downgrading packages (简体中文)
2015-11-15T15:18:51Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Package management (简体中文)]]<br />
[[cs:Downgrading packages]]<br />
[[de:Ältere Paketversion installieren (Downgrade)]]<br />
[[en:Downgrading packages]]<br />
[[es:Downgrading packages]]<br />
[[fa:دانگرید]]<br />
[[fr:Downgrade]]<br />
[[it:Downgrading packages]]<br />
[[ja:パッケージのダウングレード]]<br />
[[ru:Downgrading packages]]<br />
[[sk:Downgrading packages]]<br />
[[tr:Paket sürümünü düşürmek]]<br />
[[uk:Downgrading packages]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Arch Build System (简体中文)}}<br />
{{Related|pacman (简体中文)}}<br />
{{Related|Arch Linux Archive (简体中文)}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Downgrading_Packages|2012-09-19|221655}}<br />
本文将会向你展示如何把一个包降级到以前的版本。通常,并不推荐降级包,只有在现有包存在Bug的情况下才推荐降级。<br />
<br />
在降级之前,好好考虑下你为什么要降级。如果是因为现有包有Bug,请花上几分钟帮忙把它报告给Arch的Bug追踪系统或软件包的项目地址。我们和上游的开发者们都会很感激报告Bug的用户。因为Bug 报告中的任何额外信息都有可能节省大量的测试时间,帮助我们发行更加稳定的软件。<br />
<br />
== 原因 ==<br />
<br />
降级一个软件包实质就是卸载当前版本的软件包再安装旧版本的软件包。这个”旧版本“可以是当前版本之前的任何一个版本。<br />
<br />
降级的原因包括:当前软件包有Bug,当前软件包未包含你需要的功能,实验性的目的。不管哪种情况,用户都认为:降级软件包是解决目前包出现问题的一个有效办法。<br />
<br />
降级一个包有时意味着其它包也要跟着它一起降级。对于那些装了一堆实验性或测试性软件包的用户,我们推荐直接重装整个系统而不是一个个降级软件包。<br />
<br />
== 细节 ==<br />
但是,用户必须注意以下几点:<br />
* 注意每个包的依赖性。每个版本的包所需要的库往往是不同的,相关文件的功能跟以前的版本可能完全是不一样的。所以在降级的时候,你也要同时将那些库更改到相应的版本。 <br />
* 注意是否在降级过程中一些必须的文件会被删除。Arch Linux的滚动发行策略使得它不会在软件仓库中保存任何旧软件。下面会详述这个问题。<br />
* 注意在降级过程中对配置文件或脚本做出的更改。在目前,我们会依赖pacman来帮我们处理这个问题。<br />
<br />
Arch回溯机概念正在开发中,等待与pacman的融合。一旦开发融合完成,上面提到的细节问题将会自动完成,不需要你来操心。<br />
<br />
== 如何降级软件包 ==<br />
* 问: 当我运行 {{ic|pacman -Syu}} 将软件包从版本甲升级到版本乙之后,发现这个软件包导致系统出现了一些问题,我该怎样将该软件包重新降级到版本甲呢?<br />
* 答: 如果该包不是很重要的话,你可以降级的。先查看你系统的{{ic|/var/cache/pacman/pkg}}目录,看看旧版本的软件包是不是还保存在那儿 (如果你最近没有执行 {{ic|pacman -Scc}}以清空包缓存的话,应该在那儿)。 如果在,你可以执行{{ic|pacman -U pkgname-olderpkgver.pkg.tar.gz}}来安装旧版本。如果pacman提示文件冲突的话,你可以通过加上{{ic|-f}}参数以强制执行,即 {{ic|pacman -U --force pkgname-olderpkgver.pkg.tar.gz}}。<br />
<br />
这个过程会移除现有的包,仔细的计算所有依赖的改变,然后安装你选择的旧版本的软件包以及合适的依赖。<br />
<br />
{{注意|如果你改变了操作系统的一个基本的组件包,你也许需要降级许多包。这些软件包可能在过程中被删除,需要手动一点一点的安装回来;同时,后续升级时要小心,不要重新安装不想要的软件包版本。}}<br />
<br />
在 [[AUR]] 中有一个包叫做{{AUR|downgrade}}。它是一个简单的 Bash 脚本,它会从你的缓存中寻找旧版本的包,如果没有的话它会搜索 [[#ARM|A.R.M.]]。你可以选择一个旧包来安装。它基本上自动化了上面所述的过程。查看 {{Ic|downgrade --help}} 获取使用方法的信息。<br />
<br />
另一个更强大的工具是{{AUR|downgrader}},它可以处理 pacman 的 log,能从 ARM、本地缓存降级,并且可以处理包列表 (如果在升级一些包后不稳定,而你不确定包的名字)<br />
<br />
== 如何找到旧版本 ==<br />
目前有三种方法<br />
<br />
=== 过期源 ===<br />
如果系统上找不到旧版本,请检查未即时同步的源,从里面下载软件包。软件源同步状态可以从[https://www.archlinux.org/mirrors/status/ 这里]获得。<br />
<br />
=== ARM ===<br />
[http://ala.seblu.net/ Arch Rollback Machine] (ARM) 里包含2009年9月1日以来所有仓库的归档。目前(2009年11月21日),这个网站还不稳定,根据以前的报道,丢失了2008年10月1日到目前的一些数据。<br />
<br />
如果你对ARM感兴趣的话,最好是到它的宣传论坛了解一下相关信息,这样可以了解它的最新进度。它的宣传论坛在这里:[https://bbs.archlinux.org/viewtopic.php?id=53665].<br />
<br />
据说,ARM想达到这样一个目的:使得使用wget+pacman可以方便的将你的系统回溯到某个时间点。但他们还没有给出这个自动化过程的具体解释。<br />
<br />
=== 手动编译 ===<br />
最糟糕的情况,如果这些地方都没有找到,那你就需要自己动手编译旧版本的软件包了。如果决定这样做,就可以从abs中先取出该软件包的PKGBUILD文件,然后修改相应的内容(通常是版本号)。或者访问 https://www.archlinux.org/packages/ 搜索你需要的降级的软件包,然后点 "查看修改" 链接,选择“查看日志“。找到你需要的版本然后点击路径。然后下载相应的文件再用makepkg编译即可。<br />
<br />
对于AUR包来说,只能在http://pkgbuild.com/git/aur-mirror.git/ 处找到旧包的PKGBUILD,或者你可以到[Unofficial User Repositories]]处找到旧的二进制包。<br />
<br />
== 更改仓库 ==<br />
要使用ARM仓库的话,注释掉原来的仓库,添加适当的ARM仓库地址即可:<br />
[core]<br />
#<nowiki>Server=http://mirrors.gigenet.com/archlinux/core/os/i686</nowiki><br />
<nowiki>Server=http://arm.konnichi.com/2009/11/01/core/os/i686</nowiki><br />
<br />
在这个例子中,这个配置会把当前系统的包回溯到2009年11月1日的状态。请注意,所有的仓库都是官方仓库的快照。所以你只需要更改{{Ic|/etc/pacman.d/mirrorlist}}处的镜像,把ARM的镜像放在最前头。<br />
然后运行:<br />
pacman -Syy # refresh the sync databases<br />
pacman -Suu # downgrade all packages with a lower version in the repos<br />
<br />
仅仅这样并不能保证无缝的回溯,因为有时候相对于版本号会有包冲突等问题。<br />
<br />
更多信息请参考[[pacman]]<br />
<br />
== FAQ ==<br />
=== 由于依赖问题我无法降级 ===<br />
<br />
你可以使用{{ic|-d}}选项在升级或删除包的时候忽略依赖的限制,比如,{{ic|pacman -Ud pkgpkgname-olderpkgver.pkg.tar.gz}},但这样做有可能破坏你的系统。<br />
<br />
=== 怎么才能阻止Pacman升级我已降级的包? ===<br />
<br />
在{{Ic|pacman.conf}}中设置{{Ic|<nowiki>IgnorePkg = package1 package2</nowiki>}}会使Pacman在更新时忽略你列出的包。<br />
<br />
=== 我想把我的系统回溯到昨天的状态 ===<br />
<br />
如果你使用[[LVM]],并且开启了periodic snapshots的话,这很容易实现。</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Downgrading_packages_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409283
Downgrading packages (简体中文)
2015-11-15T15:00:11Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Package management (简体中文)]]<br />
[[cs:Downgrading packages]]<br />
[[de:Ältere Paketversion installieren (Downgrade)]]<br />
[[en:Downgrading packages]]<br />
[[es:Downgrading packages]]<br />
[[fa:دانگرید]]<br />
[[fr:Downgrade]]<br />
[[it:Downgrading packages]]<br />
[[ja:パッケージのダウングレード]]<br />
[[ru:Downgrading packages]]<br />
[[sk:Downgrading packages]]<br />
[[tr:Paket sürümünü düşürmek]]<br />
[[uk:Downgrading packages]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Arch Build System (简体中文)}}<br />
{{Related|pacman (简体中文)}}<br />
{{Related|Arch Rollback Machine (简体中文)}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Downgrading_Packages|2012-09-19|221655}}<br />
本文将会向你展示如何把一个包降级到以前的版本。通常,并不推荐降级包,只有在现有包存在Bug的情况下才推荐降级。<br />
<br />
在降级之前,好好考虑下你为什么要降级。如果是因为现有包有Bug,请花上几分钟帮忙把它报告给Arch的Bug追踪系统或软件包的项目地址。我们和上游的开发者们都会很感激报告Bug的用户。因为Bug 报告中的任何额外信息都有可能节省大量的测试时间,帮助我们发行更加稳定的软件。<br />
<br />
== 原因 ==<br />
<br />
降级一个软件包实质就是卸载当前版本的软件包再安装旧版本的软件包。这个”旧版本“可以是当前版本之前的任何一个版本。<br />
<br />
降级的原因包括:当前软件包有Bug,当前软件包未包含你需要的功能,实验性的目的。不管哪种情况,用户都认为:降级软件包是解决目前包出现问题的一个有效办法。<br />
<br />
降级一个包有时意味着其它包也要跟着它一起降级。对于那些装了一堆实验性或测试性软件包的用户,我们推荐直接重装整个系统而不是一个个降级软件包。<br />
<br />
== 细节 ==<br />
但是,用户必须注意以下几点:<br />
* 注意每个包的依赖性。每个版本的包所需要的库往往是不同的,相关文件的功能跟以前的版本可能完全是不一样的。所以在降级的时候,你也要同时将那些库更改到相应的版本。 <br />
* 注意是否在降级过程中一些必须的文件会被删除。Arch Linux的滚动发行策略使得它不会在软件仓库中保存任何旧软件。下面会详述这个问题。<br />
* 注意在降级过程中对配置文件或脚本做出的更改。在目前,我们会依赖pacman来帮我们处理这个问题。<br />
<br />
Arch回溯机概念正在开发中,等待与pacman的融合。一旦开发融合完成,上面提到的细节问题将会自动完成,不需要你来操心。<br />
<br />
== 如何降级软件包 ==<br />
* 问: 当我运行 {{ic|pacman -Syu}} 将软件包从版本甲升级到版本乙之后,发现这个软件包导致系统出现了一些问题,我该怎样将该软件包重新降级到版本甲呢?<br />
* 答: 如果该包不是很重要的话,你可以降级的。先查看你系统的{{ic|/var/cache/pacman/pkg}}目录,看看旧版本的软件包是不是还保存在那儿 (如果你最近没有执行 {{ic|pacman -Scc}}以清空包缓存的话,应该在那儿)。 如果在,你可以执行{{ic|pacman -U pkgname-olderpkgver.pkg.tar.gz}}来安装旧版本。如果pacman提示文件冲突的话,你可以通过加上{{ic|-f}}参数以强制执行,即 {{ic|pacman -U --force pkgname-olderpkgver.pkg.tar.gz}}。<br />
<br />
这个过程会移除现有的包,仔细的计算所有依赖的改变,然后安装你选择的旧版本的软件包以及合适的依赖。<br />
<br />
{{注意|如果你改变了操作系统的一个基本的组件包,你也许需要降级许多包。这些软件包可能在过程中被删除,需要手动一点一点的安装回来;同时,后续升级时要小心,不要重新安装不想要的软件包版本。}}<br />
<br />
在 [[AUR]] 中有一个包叫做{{AUR|downgrade}}。它是一个简单的 Bash 脚本,它会从你的缓存中寻找旧版本的包,如果没有的话它会搜索 [[#ARM|A.R.M.]]。你可以选择一个旧包来安装。它基本上自动化了上面所述的过程。查看 {{Ic|downgrade --help}} 获取使用方法的信息。<br />
<br />
另一个更强大的工具是{{AUR|downgrader}},它可以处理 pacman 的 log,能从 ARM、本地缓存降级,并且可以处理包列表 (如果在升级一些包后不稳定,而你不确定包的名字)<br />
<br />
== 如何找到旧版本 ==<br />
目前有三种方法<br />
<br />
=== 过期源 ===<br />
如果系统上找不到旧版本,请检查未即时同步的源,从里面下载软件包。软件源同步状态可以从[https://www.archlinux.org/mirrors/status/ 这里]获得。<br />
<br />
=== ARM ===<br />
[http://ala.seblu.net/ Arch Rollback Machine] (ARM) 里包含2009年9月1日以来所有仓库的归档。目前(2009年11月21日),这个网站还不稳定,根据以前的报道,丢失了2008年10月1日到目前的一些数据。<br />
<br />
如果你对ARM感兴趣的话,最好是到它的宣传论坛了解一下相关信息,这样可以了解它的最新进度。它的宣传论坛在这里:[https://bbs.archlinux.org/viewtopic.php?id=53665].<br />
<br />
据说,ARM想达到这样一个目的:使得使用wget+pacman可以方便的将你的系统回溯到某个时间点。但他们还没有给出这个自动化过程的具体解释。<br />
<br />
=== 手动编译 ===<br />
最糟糕的情况,如果这些地方都没有找到,那你就需要自己动手编译旧版本的软件包了。如果决定这样做,就可以从abs中先取出该软件包的PKGBUILD文件,然后修改相应的内容(通常是版本号)。或者访问 https://www.archlinux.org/packages/ 搜索你需要的降级的软件包,然后点 "查看修改" 链接,选择“查看日志“。找到你需要的版本然后点击路径。然后下载相应的文件再用makepkg编译即可。<br />
<br />
对于AUR包来说,只能在http://pkgbuild.com/git/aur-mirror.git/ 处找到旧包的PKGBUILD,或者你可以到[Unofficial User Repositories]]处找到旧的二进制包。<br />
<br />
== 更改仓库 ==<br />
要使用ARM仓库的话,注释掉原来的仓库,添加适当的ARM仓库地址即可:<br />
[core]<br />
#<nowiki>Server=http://mirrors.gigenet.com/archlinux/core/os/i686</nowiki><br />
<nowiki>Server=http://arm.konnichi.com/2009/11/01/core/os/i686</nowiki><br />
<br />
在这个例子中,这个配置会把当前系统的包回溯到2009年11月1日的状态。请注意,所有的仓库都是官方仓库的快照。所以你只需要更改{{Ic|/etc/pacman.d/mirrorlist}}处的镜像,把ARM的镜像放在最前头。<br />
然后运行:<br />
pacman -Syy # refresh the sync databases<br />
pacman -Suu # downgrade all packages with a lower version in the repos<br />
<br />
仅仅这样并不能保证无缝的回溯,因为有时候相对于版本号会有包冲突等问题。<br />
<br />
更多信息请参考[[pacman]]<br />
<br />
== FAQ ==<br />
=== 由于依赖问题我无法降级 ===<br />
<br />
你可以使用{{ic|-d}}选项在升级或删除包的时候忽略依赖的限制,比如,{{ic|pacman -Ud pkgpkgname-olderpkgver.pkg.tar.gz}},但这样做有可能破坏你的系统。<br />
<br />
=== 怎么才能阻止Pacman升级我已降级的包? ===<br />
<br />
在{{Ic|pacman.conf}}中设置{{Ic|<nowiki>IgnorePkg = package1 package2</nowiki>}}会使Pacman在更新时忽略你列出的包。<br />
<br />
=== 我想把我的系统回溯到昨天的状态 ===<br />
<br />
如果你使用[[LVM]],并且开启了periodic snapshots的话,这很容易实现。</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Arch_Linux_Archive_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409282
Arch Linux Archive (简体中文)
2015-11-15T14:59:28Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Package management (简体中文)]]<br />
[[fr:Arch Linux Archive]]<br />
[[ja:Arch Linux Archive]]<br />
[[en:Arch Linux Archive]]<br />
{{TranslationStatus (简体中文)|Arch_Linux_Archive|2015-11-11|408495}}<br />
{{Related articles start}}<br />
{{Related|Downgrading packages (简体中文)}}<br />
{{Related articles end}}<br />
<br />
Arch Linux 存档('''A'''rch '''L'''inux '''Archive''',''简称 ala''),以前称为 ''Arch Linux 回滚机器(Arch Linux Rollback Machine'',''简称 ARM''),保存了 ''官方仓库快照''、''iso 镜像'' 和 ''引导程序包'' 的历史版本。<br />
<br />
'''用途'''<br />
* 将某个包降级到某个早期版本(最新版本不能用,我需要之前的版本)<br />
* 将所有包恢复到某个指定的历史时刻(所有包都不能用,我要恢复到两个月之前的状态)<br />
* 查找某个历史版本的 ISO 镜像<br />
<br />
== 位置 ==<br />
<br />
Arch Linux 存档目前位于 http://ala.seblu.net/ 。<br />
<br />
此前的下列网址即将关闭,建议不要再使用:<br />
* http://seblu.net/a/archive<br />
* ftp://seblu.net/archlinux/archive<br />
<br />
下列网址已关闭:<br />
* http://seblu.net/a/arm<br />
* ftp://seblu.net/archlinux/arm<br />
<br />
== 目录 ==<br />
<br />
'''存档'''分为下列三个主目录:<br />
<br />
├── iso<br />
├── packages<br />
└── repos<br />
<br />
=== /repos ===<br />
<br />
[http://ala.seblu.net/repos repos] 这个目录包含官方仓库镜像的每日快照,按下例结构组织:<br />
<br />
repos<br />
├── 2013<br />
│ ├── 08<br />
│ │ └── 31<br />
│ │ ├── community<br />
│ │ ├── community-staging<br />
│ │ ├── community-testing<br />
│ │ ├── core<br />
│ │ ├── extra<br />
│ │ ├── gnome-unstable<br />
│ │ ├── kde-unstable<br />
│ │ ├── lastsync<br />
│ │ ├── multilib<br />
│ │ ├── multilib-staging<br />
│ │ ├── multilib-testing<br />
│ │ ├── pool<br />
│ │ ├── staging<br />
│ │ └── testing<br />
│ ├── 09<br />
│ │ ├── 01<br />
│ │ ├── 02<br />
│ │ ├── ...<br />
│ │ ├── 21<br />
│ │ └── 22<br />
│ ├── 10<br />
│ │ ├── 01<br />
│ │ ├── 02<br />
│ │ ├── ...<br />
│ │<br />
│ ├── 11<br />
│ └── 12<br />
├── 2014<br />
│ ├── 01<br />
│ │ ├── 01<br />
│ │ ├── 02<br />
│ │ ├── ...<br />
│ │<br />
│ ├── 02<br />
│ ├── 03<br />
│ ├── ...<br />
│ └── 09<br />
│ ├── 01<br />
│ ├── ...<br />
│ └── 28<br />
├── last<br />
├── month<br />
└── week<br />
<br />
注意: 最下面的三个特定目录('''last'''、'''week''' 和 '''month''')分别链接到'''已同步的最新仓库版本'''、'''本周星期一版本'''和'''本月一日版本'''。<br />
<br />
=== /packages ===<br />
<br />
[http://ala.seblu.net/packages packages] 这个目录包含每个包的所有版本及其相应的数字签名。每个包一个目录,按首字母排序。<br />
<br />
├── packages<br />
│ ├── a<br />
│ │ ├── awesome<br />
│ │ │ ├── awesome-3.5.0-1-i686.pkg.tar.xz<br />
│ │ │ ├── awesome-3.5.0-1-i686.pkg.tar.xz.sig<br />
│ │ │ ├── awesome-3.5.0-1-x86_64.pkg.tar.xz<br />
│ │ │ ├── awesome-3.5.0-1-x86_64.pkg.tar.xz.sig<br />
│ │ │ ├── awesome-3.5.1-1-i686.pkg.tar.xz<br />
│ │ │ ├── awesome-3.5.1-1-i686.pkg.tar.xz.sig<br />
│ │ │ ├── ...<br />
│ │ │ <br />
│ │ ├── ...<br />
│ │ ├── awstats<br />
│ │ └── axel<br />
│ │ <br />
│ ├── b<br />
│ ├── ...<br />
│ └── z<br />
<br />
你可以使用“魔法目录”[http://ala.seblu.net/packages/.all .all] 按包名访问所有包。In a nutshell, all versions of each package in one flat directory. No clear-text listing allowed here.<br />
<br />
├── packages<br />
│ ├── .all<br />
│ │ ├── awesome-3.5.1-1-i686.pkg.tar.xz<br />
│ │ ├── ...<br />
│ │ ├── zsh-5.0.2-3-i686.pkg.tar.xz<br />
│ │ ├── zsh-5.0.2-4-i686.pkg.tar.xz<br />
│ │ └── ...<br />
<br />
An lightweight index, named [http://ala.seblu.net/packages/.all/index.0.xz index.0.xz] is available to list all package in once.<br />
<br />
=== /iso ===<br />
<br />
The [http://ala.seblu.net/iso iso] directory contains official ISO images and bootstrap tarballs sorted by release date.<br />
<br />
├── 2014.09.03<br />
├── 2014.10.01<br />
├── 2014.11.01<br />
├── 2014.12.01<br />
├── 2015.07.01<br />
├── 2015.08.01<br />
├── 2015.09.01<br />
└── 2015.10.01<br />
├── arch<br />
├── archlinux-2015.10.01-dual.iso<br />
├── archlinux-2015.10.01-dual.iso.sig<br />
├── archlinux-2015.10.01-dual.iso.torrent<br />
├── archlinux-bootstrap-2015.10.01-i686.tar.gz<br />
├── archlinux-bootstrap-2015.10.01-i686.tar.gz.sig<br />
├── archlinux-bootstrap-2015.10.01-x86_64.tar.gz<br />
├── archlinux-bootstrap-2015.10.01-x86_64.tar.gz.sig<br />
├── md5sums.txt<br />
└── sha1sums.txt<br />
<br />
== agetpkg ==<br />
<br />
{{Move|Downgrading packages||Talk:Archive#agetpkg}}<br />
{{Out of date|As of October 2015, the fate of the package is discussed in [https://lists.archlinux.org/pipermail/arch-dev-public/2015-October/027480.html arch-dev-public].}}<br />
<br />
{{Pkg|agetpkg}}{{Broken package link|package not found}} is a command line tool used to quickly list/get/install packages stored in the Archive.<br />
<br />
===== Download a previous version of ferm package =====<br />
agetpkg ferm<br />
<br />
===== Download xterm version 296 =====<br />
agetpkg ^xterm 296<br />
<br />
===== List all zsh versions =====<br />
agetpkg -l zsh$<br />
<br />
===== Install all gvfs packages in version 1.26.0 release 3 =====<br />
agetpkg -i gvfs 1.26.0 3<br />
<br />
===== Download all pwgen packages =====<br />
agetpkg -g -a pwgen<br />
<br />
== 常见问题 ==<br />
<br />
=== 如何降级某个包 ===<br />
<br />
You can use [[#agetpkg]] to easily download a specific package version from the Archive.<br />
<br />
Or you can do it manually:<br />
<br />
# Run your favorite internet browser and go to http://ala.seblu.net/packages;<br />
# Go to the package you need and download it;<br />
# Run {{Ic|pacman -U ''pkgname''.pkg.tar.xz}} as root.<br />
<br />
=== 如何恢复所有包到指定日期 ===<br />
<br />
如果想恢复所有包到指定日期(比如2014年3月30日),你必须如下例所示编辑 {{ic|/etc/pacman.conf}},从而让 [[pacman]] 保持在这个时间点并且直接使用指定的服务器:<br />
<br />
{{bc|<nowiki><br />
[core]<br />
SigLevel = PackageRequired<br />
Server=http://ala.seblu.net/repos/2014/03/30/$repo/os/$arch<br />
<br />
[extra]<br />
SigLevel = PackageRequired<br />
Server=http://ala.seblu.net/repos/2014/03/30/$repo/os/$arch<br />
<br />
[community]<br />
SigLevel = PackageRequired<br />
Server=http://ala.seblu.net/repos/2014/03/30/$repo/os/$arch<br />
</nowiki>}}<br />
<br />
或者如下例编辑 {{ic|/etc/pacman.d/mirrorlist}}:<br />
<br />
{{bc|<nowiki><br />
## <br />
## Arch Linux repository mirrorlist <br />
## Generated on 2042-01-01 <br />
##<br />
Server=http://ala.seblu.net/repos/2014/03/30/$repo/os/$arch<br />
</nowiki>}}<br />
<br />
然后同步包数据库以强制降级:<br />
# pacman -Syyuu<br />
<br />
{{注意|混用归档和更新镜像很不安全。万一降级失败,In case of download failure, you can fall-back on an upstream package and you will have packages not from the same epoch as the rest of the system.}}<br />
<br />
== 源码 ==<br />
<br />
* [https://github.com/seblu/archivetools archivetools] -- Software to run an Archive server<br />
* [https://github.com/seblu/agetpkg agetpkg] -- Software to easy downgrade package from the Archive<br />
<br />
== 未来计划 ==<br />
<br />
* Move to official infrastructure.<br />
* Automatic clean-up after a defined amount of time?<br />
* Archive more stuff?<br />
<br />
== 历史 ==<br />
<br />
* New URL and closing the old ARM hierarchy on 2015-10-13. A new software, agetpkg was introduced.<br />
* The original ARM (''Archlinux Rollback Machine'') was closed on 2013-08-18 [https://bbs.archlinux.org/viewtopic.php?pid=1313360#p1313360].<br />
* The new one is hosted on [http://seblu.net seblu.net] since 2013-08-31.</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Wicd_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409281
Wicd (简体中文)
2015-11-15T14:48:20Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category: Networking (简体中文)]]<br />
[[Category:Wireless networking (简体中文)]]<br />
[[de:Wicd]]<br />
[[en:Wicd]]<br />
[[es:Wicd]]<br />
[[fr:Wicd]]<br />
[[it:Wicd]]<br />
[[ja:Wicd]]<br />
[[tr:Wicd]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Network configuration}}<br />
{{Related|Wireless network configuration}}<br />
{{Related|Netctl}}<br />
{{Related|NetworkManager}}<br />
{{Related articles end}}<br />
[http://www.wicd.net/ Wicd]是一个既能管理有线网络又能管理无线网络的网络接入管理器,是 [[NetworkManager]] 的一个功能相似的替代。Wicd是用[[Python (简体中文)|Python]]和[[GTK+ (简体中文)|GTK+]]写成的。另外,一个用[[Qt (简体中文)|Qt]]写成的在[[KDE (简体中文)|KDE]]中工作的版本,可以从 [[Arch User Repository]]得到。Wicd 也可以从终端中用 curses 界面运行,不需要 X server 会话或者任务面板 (参见 [[#运行 Wicd]])。<br />
<br />
==安装==<br />
=== 基础软件包 ===<br />
[[pacman|安装]]位于[[Official repositories|官方软件仓库]]的 {{Pkg|wicd}}。这个基础软件包包含了运行 wicd 守护进程所需程序和 {{ic|wicd-cli}} 和 {{ic|wicd-curses}} 界面。<br />
<br />
=== GTK 客户端 ===<br />
使用 GTK 前端,请安装位于[[Official repositories|官方软件仓库]]的 {{Pkg|wicd-gtk}}。这个软件包提供了 GTK 图形前端和自动启动程序文件。<br />
<br />
=== KDE 客户端 ===<br />
KDE 前端,请安装[[AUR]]中的{{AUR|wicd-kde}}{{Broken package link|{{aur-mirror|wicd-kde}}}}。<br />
<br />
=== 通知程序 ===<br />
要获得网络状态变化的通知,请安装 {{Pkg|notification-daemon}}.<br />
<br />
如果你没有使用 [[GNOME]],可以安装 {{Pkg|xfce4-notifyd}}已避免安装许多不需要的 GNOME 依赖程序。<br />
<br />
=== 其他软件包安装方法 ===<br />
<br />
如果想安装最新开发版本,可到[[AUR]]中找 {{AUR|wicd-bzr}}。<br />
<br />
如果你要完全定制安装或者制作自己的包,可使用 [[ABS]] 编译。<br />
<br />
==开始使用==<br />
===初始设置===<br />
Wicd 提供了一个需要启动的守护进程。<br />
<br />
{{警告|使用多种网络管理工具'''容易'''产生各种问题,因此,请只用一种网络管理工具来管理网络连接。所以,在使用wicd前,必须先'''关闭其他网络管理工具'''。}}<br />
<br />
首先,使用以下命令手动关闭network、dhcpbd和networkmanager这些守护程序。<br />
# systemctl stop netcfg<br />
# systemctl stop dhcpcd@.service<br />
# systemctl stop NetworkManager.service<br />
<br />
然后,禁用各种网络管理守护进程,包括'''network''', '''dhcdbd''', 和 '''networkmanager''':<br />
# systemctl disable netcfg<br />
# systemctl disable dhcpcd@.service<br />
# systemctl disable NetworkManager.service<br />
<br />
添加服务<br />
# systemctl enable wicd.service<br />
<br />
把你帐号加入到{{ic|users}}组中,把{{ic|$USERNAME}}替换成你自己帐号名称。<br />
<br />
gpasswd -a $USERNAME users<br />
<br />
{{注意| 可以访问'''wicd'''的用户组是能更改的,可能不是 ''users''. 检查{{ic|/etc/dbus-1/system.d/wicd.conf}}中指定的用户组,并将你的用户加入该组。}}<br />
<br />
最后,启动'''wicd''' :<br />
# systemctl start wicd<br />
<br />
如果你添加了自己的用户到新组中,登出再登入。<br />
<br />
===运行 Wicd===<br />
<br />
命令行输入:<br />
$ wicd-client<br />
如果你不需要wicd出现在通知区,使用下面命令:<br />
$ wicd-client -n<br />
<br />
{{注意|这只有在你安装了 wicd-gtk 之后才可以使用。如果你没有安装 wicd-gtk 那么可以使用 wicd-cli 或者 wicd-curses}}<br />
<br />
你也可以把'''wicd-client'''添加到你所使用的DE/WM 自启动列表中,这样每次登录就能自动启动图形管理界面。<br />
<br />
{{注意|一些用户当使用这种方法会遇到运行两个 {{ic|wicd-client}} 进程的问题。在 Arch forums 和 Arch bug reports 有关于此的讨论(参见 [[#相关链接]])。貌似是 wicd 包会在 {{ic|/etc/xdg/autostart/wicd-tray.desktop}} 放置一个文件,这会在登入桌面环境/窗口管理器时自动启动 wicd-client。如果是这个问题,如果你在桌面环境/窗口管理器的启动文件中添加了一个 {{ic|wicd-client}} 的话你会有两个 {{ic|wicd-client}} 同时运行。如果发生这种情况,确认 {{ic|wicd-tray.desktop}} 文件存在于 {{ic|/etc/xdg/autostart}}; 如果是,只需要在守护进程列表中有 {{ic|wicd}} 就可以了。}}<br />
<br />
你也可以在终端中运行 wicd 作为一个 curses 程序:<br />
<br />
$ wicd-curses<br />
<br />
{{注意 | Wicd 不会向你请求密码。要使用加密连接 (WPA/WEP),展开你想访问的网络,点击'''高级'''然后输入必要的信息。}}<br />
<br />
==常见问题解决方法==<br />
=== GUI 图形界面===<br />
如果在你点击了wicd的状态栏图标后,wicd的GUI没有出现,那么请你确保你是单击了图标而不是双击,因为单击一下图标是显示GUI,再单击一个图标就是关闭GUI,双击正好被程序误认为是开了又关了。<br />
<br />
=== Hidden Wireless Networks and Autoconnection HACK ===<br />
I had problems with my hidden network and the autoconnection function of wicd. It seems that the essid of my hidden network is not "<hidden>", but an empty string. Connect manually to the network and run:<br />
$ iwlist scan<br />
Output of my hidden network:<br />
...<br />
wlan0 Scan completed :<br />
Cell 01 - Address: xx:xx:xx:xx:xx:xx<br />
ESSID:""<br />
Mode:Master<br />
Channel:11<br />
...<br />
If you have the same problems and your iwlist output shows ESSID:"", change /usr/lib/wicd/networking.py:<br />
cd /usr/lib/wicd<br />
sed -i.orig -e 's/if CurrentNetwork\["essid"\] == "<hidden>":/if CurrentNetwork\["essid"\] \<br />
== "<hidden>" or CurrentNetwork\["essid"\] == "":/' networking.py<br />
This changes /usr/lib/wicd/networking.py and saves a backup of the original file to /usr/lib/wicd/networking.py.orig.<br />
<br />
Based on wicd version 1.4.1-4<br />
<br />
==相关链接==<br />
*[https://bbs.archlinux.org/viewtopic.php?id=40337 Note on the network daemon and interfaces]<br />
*[http://www.wicd.net/download.php Note on interfaces at the official site]<br />
*[http://www.wicd.net/phpbb/viewtopic.php?p=1420 KDE Autostart Issue]<br />
*[http://www.wicd.net/phpbb/viewtopic.php?f=5&t=263&sid=90b13d4cec6ce6109515532267d39ae0&p=2005 Common Bugs]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=VLAN_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409280
VLAN (简体中文)
2015-11-15T14:45:41Z
<p>Aaron chen: </p>
<hr />
<div>{{DISPLAYTITLE:Network bridge (简体中文)}}<br />
[[Category:简体中文]]<br />
[[Category:Networking (简体中文)]]<br />
[[en:VLAN]]<br />
[[ru:VLAN]]<br />
{{Related articles start}}<br />
{{Related|Network Configuration}}<br />
{{Related|systemd-networkd}}<br />
{{Related|Netctl}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|VLAN|2015-04-28|371497}}<br />
{{Translateme (简体中文)}}<br />
<br />
Virtual LANs give you the ability to sub-divide a LAN. Linux can accept '''VLAN''' tagged traffic and presents each '''VLAN ID''' as a different network interface (eg: {{ic|eth0.100}} for '''VLAN ID''' {{ic|100}})<br />
<br />
本文介绍如何通过 {{Pkg|iproute2}} 和 [[systemd-networkd]] 或 [[netctl]] 配置 VLAN 。<br />
<br />
==配置==<br />
此前 Arch Linux 用 {{ic|vconfig}} 命令设置 VLANs ,该命令已被 {{ic|ip}} 命令取代。请确认 {{Pkg|iproute2}} 已安装。<br />
<br />
下面的范例假定 '''网口''' 是 {{ic|eth0}},'''名字''' 是 {{ic|eth0.100}} ,'''vlan id''' 是 {{ic|100}}。<br />
===创建 VLAN 设备===<br />
<br />
用下列命令添加 VLAN 网口:<br />
<br />
# ip link add link eth0 name eth0.100 type vlan id 100<br />
<br />
执行 {{ic|ip link}} 命令确认 VLAN 已创建。<br />
<br />
这个 VLAN 网口就像一个普通的物理网口,所有流经这个网口的数据包将被加上 VLAN tag 并流经它关联的物理网口(本例中的 {{ic|eth0}})。仅配置为相同 VLAN 的设备可接收这些数据包,否则将被丢弃。 <br />
Using a '''name''' like {{ic|eth0.100}} is just convention and not enforced; you can alternatively use {{ic|eth0_100}} or something descriptive like {{ic|IPTV}}. To see the VLAN ID on an interface, in case you used an unconventional name:<br />
<br />
# ip -d link show eth0.100<br />
<br />
The {{ic|-d}} flag shows full details on an interface:<br />
<br />
# ip -d addr show<br />
4: eno1.100@eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default <br />
link/ether 96:4a:9c:84:36:51 brd ff:ff:ff:ff:ff:ff promiscuity 0 <br />
'''vlan protocol 802.1Q id 100 <REORDER_HDR>''' <br />
inet6 fe80::944a:9cff:fe84:3651/64 scope link <br />
valid_lft forever preferred_lft forever<br />
<br />
===添加 IP===<br />
Now add an IPv4 address to the just created vlan link, and activate the link:<br />
{{bc|<br />
# ip addr add 192.168.100.1/24 brd 192.168.100.255 dev eth0.100<br />
# ip link set dev eth0.100 up<br />
}}<br />
===关闭设备===<br />
To cleanly shutdown the setting before you remove the link, you can do:<br />
{{bc|# ip link set dev eth0.100 down}}<br />
===移除设备===<br />
Removing a VLAN interface is significantly less convoluted<br />
{{bc|# ip link delete eth0.100}}<br />
<br />
=== 开机启动 ===<br />
<br />
==== systemd-networkd ====<br />
<br />
Use the following configuration files:<br />
<br />
{{hc|/etc/systemd/network/''eno1''.network|<nowiki><br />
[Match]<br />
Name=eno1<br />
<br />
[Network]<br />
DHCP=v4<br />
VLAN=eno1.100<br />
VLAN=eno1.200<br />
</nowiki>}}<br />
<br />
{{hc|/etc/systemd/network/'eno1.100''.netdev|<nowiki><br />
[Netdev]<br />
Name=eno1.100<br />
Kind=vlan<br />
<br />
[VLAN]<br />
Id=100<br />
</nowiki>}}<br />
<br />
{{hc|/etc/systemd/network/'eno1.200''.netdev|<nowiki><br />
[Netdev]<br />
Name=eno1.200<br />
Kind=vlan<br />
<br />
[VLAN]<br />
Id=200<br />
</nowiki>}}<br />
<br />
Then [[enable]] {{ic|systemd-networkd.service}}. See [[systemd-networkd]] for details.<br />
<br />
==== netctl ====<br />
<br />
You can use [[netctl]] for this purpose, see the self-explanatory example profiles in {{ic|/etc/netctl/examples/vlan-{dhcp,static} }}.<br />
<br />
==排错==<br />
===udev 重命名虚拟设备===<br />
An annoyance is that [[udev]] may try to rename virtual devices as they are added, thus ignoring the '''name''' configured for them (in this case {{ic|eth0.100}}).<br />
<br />
For instance, if the following commands are issued: <br />
{{bc|<br />
# ip link add link eth0 name eth0.100 type vlan id 100<br />
# ip link show <br />
}}<br />
This could generate the following output: <br />
{{bc|<nowiki><br />
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN <br />
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00<br />
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000<br />
link/ether aa:bb:cc:dd:ee:ff brd ff:ff:ff:ff:ff:ff<br />
3: rename1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state DOWN <br />
link/ether aa:bb:cc:dd:ee:ff brd ff:ff:ff:ff:ff:ff<br />
</nowiki>}}<br />
'''udev''' has ignored the configured virtual interface name {{ic|eth0.100}} and autonamed it '''rename1'''.<br />
<br />
The solution is to edit {{ic|/etc/udev/rules.d/network_persistent.rules}} and append '''DRIVERS=="?*"''' to the end of the physical interface's configuration line.<br />
<br />
For example, for the interface '''aa:bb:cc:dd:ee:ff''' (eth0): <br />
{{hc|/etc/udev/rules.d/network_persistent.rules|<nowiki><br />
SUBSYSTEM=="net", ATTR{address}=="aa:bb:cc:dd:ee:ff", NAME="eth0", DRIVERS=="?*"<br />
</nowiki>}}<br />
<br />
A reboot should mean that VLANs configure correctly with the names assigned to them.</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Systemd_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)/Timers_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409279
Systemd (简体中文)/Timers (简体中文)
2015-11-15T14:44:07Z
<p>Aaron chen: </p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:简体中文]]<br />
[[Category:Daemons_and_system_services_(简体中文)]]<br />
[[Category:Boot process_(简体中文)]]<br />
[[en:Systemd/Timers]]<br />
[[fr:Systemd/cron]]<br />
[[ja:Systemd/タイマー]]<br />
{{Related articles start}}<br />
{{Related|systemd_(简体中文)}}<br />
{{Related|systemd/User}}<br />
{{Related|systemd FAQ_(简体中文)}}<br />
{{Related|cron_(简体中文)}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Systemd/Timers|2014-10-25|340100}}<br />
Timers 是以 {{ic|.timer}} 为后缀名的 [[systemd]] 单元文件,用于控制 {{ic|.service}} 文件或事件。Timers 可用来替换 [[cron]](阅读 [[#替换 cron]])。Timers 内置了日历定时事件和单调定时事件的支持,并可以异步执行这些事件。<br />
<br />
== 定时器单元 ==<br />
<br />
Timers 是以 {{ic|.timer}} 为后缀的 ''systemd'' 单元文件。Timers 和其他 [[systemd_(简体中文)#自己编写 .service 文件|单元配置文件]] 是类似的,它通过相同的路径加载,不同的是包含了 {{ic|[Timer]}} 部分。 {{ic|[Timer]}} 部分定义了何时以及如何激活定时事件。Timers 可以被定义成以下两种类型:<br />
<br />
* '''单调定时器''' 即从一个时间点过一段时间后激活定时任务。所有的单调计时器都遵循如下形式: {{ic|1=On''Type''Sec=}}。 {{ic|OnBootSec}} 和 {{ic|OnActiveSec}} 是常用的单调定时器。<br />
* '''实时定时器''' (亦称"挂钟定时器") 通过日历事件激活(类似于 cronjobs )定时任务。 使用 {{ic|1=OnCalender=}} 来定义实时定时器。<br />
<br />
要查阅完整的定时器选项,参见 {{ic|systemd.timer(5)}} [[man page]]。 关于日历事件和时间段的定义参见 {{ic|systemd.time(7)}} [[man page]].<br />
<br />
== 服务单元 ==<br />
<br />
每个 {{ic|.timer}} 文件所在目录都得有一个对应的 {{ic|.service}} 文件(如 {{ic|foo.timer}} 和 {{ic|foo.service}})。{{ic|.timer}} 用于激活并控制 {{ic|.service}} 文件。 {{ic|.service}} 文件中不需要包含 {{ic|[Install]}} 部分,因为这由 ''timer'' 单元接管。必要时通过在定时器的 {{ic|[Timer]}} 部分指定 {{ic|1=Unit=}} 选项来控制一个与定时器不同名的服务单元。<br />
<br />
== 管理 ==<br />
<br />
使用 ''timer'' 单元时像其他单元一样 [[enable]] 或 start 即可(别忘了添加 {{ic|.timer}} 后缀)。要查看所有已启用的定时器,运行:<br />
<br />
{{hc|$ systemctl list-timers|<br />
NEXT LEFT LAST PASSED UNIT ACTIVATES<br />
Thu 2014-07-10 19:37:03 CEST 11h left Wed 2014-07-09 19:37:03 CEST 12h ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service<br />
Fri 2014-07-11 00:00:00 CEST 15h left Thu 2014-07-10 00:00:13 CEST 8h ago logrotate.timer logrotate.service<br />
}}<br />
<br />
{{注意|<br />
* 列出所有定时器(包括非活动的),使用下列命令: {{ic|systemctl list-timers --all}}.<br />
* 一个由定时器启动的服务的状态看上去会是 inactive 的,除非它当前正被触发。<br />
* 若一个定时器不再同步,它可能会删除它在 {{ic|/var/lib/systemd/timers}} 下的 {{ic|stamp-*}} 文件。这些空文件只用于表示每个定时器上次运行的时间。删除后,他们将在下次定时器运行时自动重建。}}<br />
<br />
== 示例 ==<br />
<br />
通过定时器预定执行的服务文件一般无需任何修改。以下示例将预定执行 {{ic|foo.service}},因此它的定时器应该被命名为 {{ic|foo.timer}}。<br />
<br />
=== 单调定时器 ===<br />
<br />
定义一个在系统启动 15 分钟后执行,且之后每周都执行一次的定时器。<br />
<br />
{{hc|/etc/systemd/system/foo.timer|<nowiki><br />
[Unit]<br />
Description=Run foo weekly and on boot<br />
<br />
[Timer]<br />
OnBootSec=15min<br />
OnUnitActiveSec=1w <br />
<br />
[Install]<br />
WantedBy=timers.target<br />
</nowiki>}}<br />
<br />
=== 实时定时器 ===<br />
<br />
定义一个每周执行一次(明确时间为周一上午十二点)且上次未执行就立即执行的定时器。<br />
<br />
{{hc|/etc/systemd/system/foo.timer|<nowiki><br />
[Unit]<br />
Description=Run foo weekly<br />
<br />
[Timer]<br />
OnCalendar=weekly<br />
Persistent=true <br />
<br />
[Install]<br />
WantedBy=timers.target</nowiki>}}<br />
<br />
{{提示|特殊的事件表达式如 {{ic|daily}} 和 {{ic|weekly}} 表示 ''特定的启动时间'',因此任何共享该日历事件的定时器将同时启动。如果该定时器的服务会计算系统资源,那么定时器共享启动事件可能会引起系统性能下降。可以考虑手动错开该定时器运行特定事件的时间,如 {{ic|1=OnCalendar=Wed, 23:15}}。参见 [[#注意事项]].}}<br />
<br />
== 替换 cron ==<br />
<br />
尽管 [[cron]] 毋庸置疑是最有名的计划任务管理器, 但 ''systemd'' 定时器仍可以作为一个替代品。<br />
<br />
=== 优势 ===<br />
<br />
使用定时器的最主要的优势在于每个任务都有它自己的 ''systemd'' 服务。这样做的好处包括:<br />
<br />
* 任务可以简单地独立于他们的定时器启动,简化调试。<br />
* 每个任务可配置运行于特定的环境中(参见 {{ic|systemd.exec(5)}} [[man page]])。<br />
* 任务可以使用 [[cgroups]] 特性。<br />
* 任务可以配置依赖于其他 ''systemd'' 单元。<br />
* 任务记录于 ''systemd'' 日志,便于调试。<br />
<br />
=== 注意事项 ===<br />
<br />
* 附注:使用 ''systemd'' 配置计划任务相比于在 crontab 中只需添加一行任务来说,你需要创建两个文件并运行几次 {{ic|systemctl}} 命令。 {{aur|systemd-crontab-generator}} 和 {{aur|systemd-cron}} 可以帮助你使用 crontab 来管理定时器服务。如果你喜欢 crontabs 只是因为它提供了查看所有计划任务的统一视图,{{ic|systemctl}} 同样可以。参见 [[#管理]]。<br />
* 邮件:目前还没有内置与 cron {{ic|MAILTO}} 类似的任务失败时发送邮件的功能。 可以在每个服务文件中配置 {{ic|1=OnFailure=}} 实现同样的功能。<br />
* 随机延时:目前没还有内置与 cron 类似的 {{ic|RANDOM_DELAY}} 功能来指定一个数字用于定时器延时执行。(参见 [https://bugs.freedesktop.org/show_bug.cgi?id=82084 bug report])。 你不想同时执行的服务必须手动设置它们的定时器。<br />
<br />
:{{注意|{{ic|AccuracySec}} 选项对于随机错开定时器执行时间是 '''没有''' 作用的,因为它"会在所有本地定时器单元间同步" ({{ic|systemd.timer(5)}})。换句话说, {{ic|AccuracySec}} 会以相同的量改变所有定时器激活时间。例如,所有 {{ic|1=OnCalendar=daily}} 的定时器单元,指定 {{ic|1=AccuracySec=15m}} 将同时在 00:00 到 00:15 触发相关的服务。}}<br />
<br />
=== 发送邮件 ===<br />
<br />
像 Cron 的 {{ic|MAILTO}} 一样,也可以配置 systemd 在单元失效时发送一个电子邮件。首先,这需要两个文件:一个可执行文件用来发送邮件;一个 ''.service'' 文件启动这个可执行文件。在本例中,可执行文件只是一个调用 {{ic|sendmail}} 的shell 脚本:<br />
<br />
{{hc|/usr/local/bin/systemd-email|<nowiki>#!/bin/bash<br />
<br />
/usr/bin/sendmail -t <<ERRMAIL<br />
To: $1<br />
From: systemd <root@$HOSTNAME><br />
Subject: $2<br />
Content-Transfer-Encoding: 8bit<br />
Content-Type: text/plain; charset=UTF-8<br />
<br />
$(systemctl status --full "$2")<br />
ERRMAIL</nowiki>}}<br />
<br />
Whatever executable you use, it should probably take at least two arguments as this shell script does: the address to send to and the unit file to get the status of. The ''.service'' we create will pass these arguments:<br />
<br />
{{hc|/etc/systemd/system/status-email-user1@.service|<nowiki>[Unit]<br />
Description=status email for %I to user1<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/usr/local/bin/systemd-email user1@mailhost %i<br />
User=nobody<br />
Group=systemd-journal<br />
</nowiki>}}<br />
<br />
First notice that the unit to send email about is an instance parameter, so this one service can be used to send email for many other units. However the recipient is hard-coded (since unit templates can only take a single parameter) so you will need to create multiple services if you want to send emails to different sets of recipients. At this point you should test the service to verify that you can receive the emails:<br />
<br />
{{bc|# systemctl start status-email-user1@dbus.service}}<br />
<br />
Then simply add {{ic|1=OnFailure=status-email-user1@%n.service}} to the {{ic|[Unit]}} section of any unit you want emails for. {{ic|%n}} passes the unit's name to the template.<br />
<br />
=== 使用 crontab ===<br />
<br />
Several of the caveats can be worked around by installing a package that parses a traditional crontab to configure the timers. {{aur|systemd-crontab-generator}} and {{aur|systemd-cron}} from the [[AUR]] are two such packages. These can provide the missing {{ic|MAILTO}} and {{ic|RANDOM_DELAY}} features.<br />
<br />
If you like crontabs just because they provide a unified view of all scheduled jobs, {{ic|systemctl}} can provide this. See [[#Management]].<br />
<br />
== 参见 ==<br />
<br />
* [http://www.freedesktop.org/software/systemd/man/systemd.timer.html systemd.timer man page] on freedesktop.org<br />
* [https://fedoraproject.org/wiki/Features/SystemdCalendarTimers Fedora Project wiki page] on ''systemd'' calendar timers<br />
* [https://wiki.gentoo.org/wiki/Systemd#Timer_services Gentoo wiki section] on ''systemd'' timer services<br />
* {{App|systemd-crontab-generator|一个从 crontab 和 anacrontab 文件生成 timers/services 文件的工具|https://github.com/kstep/systemd-crontab-generator|{{Aur|systemd-crontab-generator}}}}<br />
* {{App|systemd-cron|提供 systemd 单元运行 cron 脚本;使用 ''systemd-crontab-generator'' 转换 crontabs|https://github.com/systemd-cron/systemd-cron|{{Aur|systemd-cron}}}}</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=PostgreSQL_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409278
PostgreSQL (简体中文)
2015-11-15T14:43:05Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Networking (简体中文)]]<br />
[[Category:Database management systems (简体中文)]]<br />
[[en:PostgreSQL]]<br />
[[it:PostgreSQL]]<br />
[[ja:PostgreSQL]]<br />
[[ru:PostgreSQL]]<br />
{{translateme (简体中文)}}<br />
PostgreSQL是一个开源的,社区驱动的,符合标准的 对象-关系型 数据库系统。<br />
<br />
本文档介绍如何安装PostgreSql。同时,也介绍了如何配置PostgreSql,以使得远程服务端能够操作之。如果你需要帮助建立一个网络栈的其余部分,请参照 [[LAMP]] 的所有部分,除了涉及到 [[MySQL]] 的那一部分。<br />
<br />
<br />
== 开始之前 ==<br />
有些地方会有“以 postgres 用户身份”的指示。请执行以下操作,以 postgres 用户获得一个 shell:<br />
<br />
su root<br />
su - postgres<br />
<br />
否则,使用 sudo 命令:<br />
<br />
sudo -i -u postgres<br />
<br />
<br />
==安装PostgreSQL==<br />
<br />
[[pacman|安装]] {{Pkg|postgresql}} 。在PostgreSQL可以正确使用之前,'''postgres''' 用户需要被赋予几个文件与目录的所有权,以及数据库集群必须被初始化。以下步骤使用了默认配置。<br />
<br />
Create "volatile and temporary files and directories". 具体信息参考[[Systemd#Temporary_files]]:<br />
# systemd-tmpfiles --create postgresql.conf<br />
<br />
创建数据文件夹,赋予正确的权限以及初始化数据库集群:<br />
# mkdir /var/lib/postgres/data<br />
# chown -c -R postgres:postgres /var/lib/postgres<br />
# sudo su - postgres -c "initdb --locale en_US.UTF-8 -E UTF8 -D '/var/lib/postgres/data'"<br />
<br />
启动PostgreSQL,(可选),添加 PostgreSQL 到daemons列表里作为守护进程同时启动:<br />
# systemctl start postgresql<br />
# systemctl enable postgresql<br />
<br />
==创建第一个数据库/用户==<br />
以postgres用户身份, 添加一个新的数据库用户使用[http://www.postgresql.org/docs/9.0/static/app-createuser.html createuser] 命令<br />
<br />
如果一个创建与你的Arch用户($USER)同名的数据库用户,并允许访问PostgreSQL数据库的shell,那么在使用PostgreSQL数据库shell的时候无需指定用户登录(这样做会比较方便)。<br />
<br />
例如:创建一个超级用户<br />
<br />
{{hc|$ createuser -s -U postgres --interactive|<br />
输入要增加的角色名称: 我登录Arch的用户名}}<br />
<br />
以具备读写权限的用户身份,创建一个新的数据库,使用[http://www.postgresql.org/docs/9.0/static/app-createdb.html createdb] 命令。<br />
<br />
从你的shell ('''不是''' 以postrgres用户的身份)<br />
<br />
$ createdb myDatabaseName<br />
<br />
==熟悉PostgreSQL==<br />
<br />
===Access the database shell===<br />
<br />
Become the postgres user. Start the primary db shell, [http://www.postgresql.org/docs/8.3/static/app-psql.html psql], where you can do all your creation of databases/tables, deletion, set permissions, and run raw SQL commands. Use the "-d" option to connect to the database you created (without specifying a database, psql will try to access a database that matches your username)<br />
$ psql -d myDatabaseName<br />
<br />
一些有用的命令:<br />
<br />
*帮助<br />
=> \help<br />
*连接到数据库<database><br />
=> \c <database><br />
*列出所有用户以及他们的权限<br />
=> \du<br />
*展示当前数据库中所有的表相关的汇总信息<br />
=> \dt<br />
*退出psql<br />
=> \q or CTRL+d<br />
<br />
当然也有更多元命令,但这些应该能够帮助您开始。<br />
<br />
==配置 PostgreSQL 被远程访问==<br />
<br />
PostgreSQL Server 的配置文件是 {{ic|postgresql.conf}}。此文件在数据库数据目录中,通常在 {{ic|/var/lib/postgres/data}}. 这个目录也包含其他主要的配置文件,包括 {{ic|pg_hba.conf}}。<br />
<br />
{{Note|默认这个目录不能被普通用户浏览或进入,这就是 {{ic|find}} 或 {{ic|locate}} 没有找到这些配置文件的原因。}}<br />
<br />
As root user edit the file {{ic|/var/lib/postgres/data/postgresql.conf}}.<br />
In the connections and authentications section uncomment or edit the {{ic|listen_addresses}} line to your needs:<br />
listen_addresses = '*'<br />
Take a careful look at the other lines.<br />
Hereafter insert the following line in the host-based authentication file {{ic|/var/lib/postgres/data/pg_hba.conf}}. This file controls which hosts are allowed to connect, so '''be careful'''.<br />
# IPv4 local connections:<br />
host all all your_desired_ip_address/32 trust<br />
where {{ic|your_desired_ip_address}} is the IP address of the client.<br />
After this you should restart the daemon process for the changes to take effect with:<br />
# systemctl restart postgresql<br />
<br />
{{Note|Postgresql uses port 5432 by default for remote connections. So make sure this port is open and able to receive incoming connections.}}<br />
<br />
For troubleshooting take a look in the server log file<br />
tail /var/log/postgresql.log<br />
<br />
<br />
== Configure PostgreSQL to work with PHP==<br />
<br />
Install the PHP-PostgreSQL modules {{Pkg|php-pgsql}}.<br />
Edit the file {{ic|/etc/php/php.ini}}. Find the line that starts with:<br />
;extension=pgsql.so<br />
Change it to:<br />
extension=pgsql.so<br />
If you need PDO, do the same thing with {{ic|;extension&#61;pdo.so}} and {{ic|;extension&#61;pdo_pgsql.so}}. If these lines are not present, add them. These lines may be in the "Dynamic Extensions" section of the file, or toward the very end of the file.<br />
Restart the Apache web server:<br />
# systemctl restart httpd<br />
<br />
== Change default data dir (optional) ==<br />
<br />
The default directory where all your newly created databases will be stored is {{ic|/var/lib/postgres/data}}. To change this, follow these steps:<br />
<br />
Create the new directory and assign it to user {{ic|postgres}} (you eventually have to become root):<br />
mkdir -p /pathto/pgroot/data<br />
chown -R postgres:postgres /pathto/pgroot<br />
Become the postgres user(change to root, then postgres user), and initialize the new cluster:<br />
initdb -D /pathto/pgroot/data<br />
If not using systemd, edit {{ic|/etc/conf.d/postgresql}} and change the PGROOT variable(optionally PGLOG) to point to your new pgroot directory:<br />
#PGROOT="/var/lib/postgres/"<br />
PGROOT="''/pathto/pgroot/''"<br />
If using systemd, edit {{ic|/etc/systemd/system/multi-user.target.wants/postgresql.service}}, which links to {{ic|/usr/lib/systemd/system/postgresql.service}}, and change the default PGROOT path.<br />
#Environment=PGROOT=/var/lib/postgres/<br />
Environment=PGROOT=''/pathto/pgroot/''<br />
You will also need to change the default PIDFile path.<br />
PIDFile=/pathto/pgroot/data/postmaster.pid<br />
<br />
== Change default encoding of new databases to UTF-8 (optional) ==<br />
{{Note|If you ran initdb with -E UTF8 these steps are not required}}<br />
When creating a new database (e.g. with {{ic|createdb blog}}) PostgreSQL actually copies a template database. There are two predefined templates: template0 is vanilla, while template1 is meant as an on-site template changeable by the administrator and is used by default. In order to change the encoding of new database, one of the options is to change on-site template1. To do this, log into PostgresSQL shell (psql) and execute the following:<br />
<br />
First, we need to drop template1. Templates cannot be dropped, so we first modify it so it is an ordinary database:<br />
UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';<br />
Now we can drop it:<br />
DROP DATABASE template1;<br />
The next step is to create a new database from template0, with a new default encoding:<br />
CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE';<br />
Now modify template1 so it is actually a template:<br />
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';<br />
(OPTIONAL) If you do not want anyone connecting to this template, set datallowconn to FALSE:<br />
UPDATE pg_database SET datallowconn = FALSE WHERE datname = 'template1';<br />
<br />
{{Note|this last step can create problems when upgrading via {{ic|pg_upgrade}}.}}<br />
<br />
Now you can create a new database by running from regular shell:<br />
su -<br />
su - postgres<br />
createdb blog;<br />
<br />
If you log in back to psql and check the databases, you should see the proper encoding of your new database:<br />
\l<br />
returns<br />
List of databases<br />
Name | Owner | Encoding | Collation | Ctype | Access privileges<br />
-----------+----------+-----------+-----------+-------+----------------------<br />
blog | postgres | UTF8 | C | C |<br />
postgres | postgres | SQL_ASCII | C | C |<br />
template0 | postgres | SQL_ASCII | C | C | =c/postgres<br />
: postgres=CTc/postgres<br />
template1 | postgres | UTF8 | C | C |<br />
<br />
== 管理工具 ==<br />
<br />
* {{App|[[phpPgAdmin]]|Web-based administration tool for PostgreSQL.|http://phppgadmin.sourceforge.net|{{Pkg|phppgadmin}}}}<br />
* {{App|pgAdmin|GUI-based administration tool for PostgreSQL.|http://www.pgadmin.org/|{{Pkg|pgadmin3}}}}<br />
<br />
<br />
==Postgresql升级配置 ==<br />
<br />
=== 快速指南 ===<br />
<br />
This is for upgrading from 9.2 to 9.3.<br />
<br />
pacman -S --needed postgresql-old-upgrade<br />
su -<br />
su - postgres -c 'mv /var/lib/postgres/data /var/lib/postgres/data-9.2'<br />
su - postgres -c 'mkdir /var/lib/postgres/data'<br />
su - postgres -c 'initdb --locale en_US.UTF-8 -E UTF8 -D /var/lib/postgres/data'<br />
<br />
If you had custom settings in configuration files like pg_hba.conf and postgresql.conf, merge them into the new ones. Then:<br />
<br />
su - postgres -c 'pg_upgrade -b /opt/pgsql-9.2/bin/ -B /usr/bin/ -d /var/lib/postgres/data-9.2 -D /var/lib/postgres/data'<br />
<br />
If the "pg_upgrade" step fails with:<br />
* ''cannot write to log file pg_upgrade_internal.log<br /> Failure, exiting'' <br />Make sure you're in a directory that the "postgres" user has enough rights to write the log file to ({{ic|/tmp}} for example). Or use "su - postgres" instead of "sudo -u postgres".<br />
* ''LC_COLLATE error that says that old and new values are different''<br />Figure out what the old locale was, C or en_US.UTF-8 for example, and force it when calling initdb.<br />
sudo -u postgres LC_ALL=C initdb -D /var/lib/postgres/data<br />
<br />
* ''There seems to be a postmaster servicing the old cluster.<br/>Please shutdown that postmaster and try again.''<br/>Make sure postgres isn't running. If you still get the error then chances are these an old PID file you need to clear out.<br />
> sudo -u postgres ls -l /var/lib/postgres/data-9.2<br />
total 88<br />
-rw------- 1 postgres postgres 4 Mar 25 2012 PG_VERSION<br />
drwx------ 8 postgres postgres 4096 Jul 17 00:36 base<br />
drwx------ 2 postgres postgres 4096 Jul 17 00:38 global<br />
drwx------ 2 postgres postgres 4096 Mar 25 2012 pg_clog<br />
-rw------- 1 postgres postgres 4476 Mar 25 2012 pg_hba.conf<br />
-rw------- 1 postgres postgres 1636 Mar 25 2012 pg_ident.conf<br />
drwx------ 4 postgres postgres 4096 Mar 25 2012 pg_multixact<br />
drwx------ 2 postgres postgres 4096 Jul 17 00:05 pg_notify<br />
drwx------ 2 postgres postgres 4096 Mar 25 2012 pg_serial<br />
drwx------ 2 postgres postgres 4096 Jul 17 00:53 pg_stat_tmp<br />
drwx------ 2 postgres postgres 4096 Mar 25 2012 pg_subtrans<br />
drwx------ 2 postgres postgres 4096 Mar 25 2012 pg_tblspc<br />
drwx------ 2 postgres postgres 4096 Mar 25 2012 pg_twophase<br />
drwx------ 3 postgres postgres 4096 Mar 25 2012 pg_xlog<br />
-rw------- 1 postgres postgres 19169 Mar 25 2012 postgresql.conf<br />
-rw------- 1 postgres postgres 48 Jul 17 00:05 postmaster.opts<br />
-rw------- 1 postgres postgres 80 Jul 17 00:05 postmaster.pid # <-- This is the problem<br />
<br />
> sudo -u postgres mv /var/lib/postgres/data-9.2/postmaster.pid /tmp<br />
* ''ERROR: could not access file "$libdir/postgis-2.0": No such file or directory'' <br> Retrieve postgis-2.0.so from postgis package for version postgresql 9.2 () and copy it to /opt/pgsql-9.2/lib (make sure the privileges are right)<br />
<br />
<br />
=== 详细说明 ===<br />
<br />
{{Note|Official PostgreSQL [http://www.postgresql.org/docs/current/static/upgrading.html upgrade documentation] should be followed.}}<br />
<br />
需要注意的是,这些指令可能会导致数据丢失。 '''后果自负'''.<br />
<br />
推荐把下面的加入你的 {{ic|/etc/pacman.conf}} 文件中:<br />
IgnorePkg = postgresql postgresql-libs<br />
这将确保你不会不小心将数据库升级到不兼容的版本中。当一个升级可用时,pacman将通知你,因为在pacman.conf中的设置,它跳过了升级。小版本升级 (e.g., 9.0.3 to 9.0.4) 可以被安全地执行。不过,当如果你突然做一个不同的主版本升级时,(e.g., 9.0.X to 9.1.X), 您可能无法访问你的任何数据。请务必检查PostgreSQL的主页 (http://www.postgresql.org/) ,以确认每次升级所需要的步骤。对于为什么是这种情况见 [http://www.postgresql.org/support/versioning versioning policy]。<br />
<br />
主要有两种方式来升级您的PostgreSQL数据库。阅读官方文档细节。<br />
<br />
For those wishing to use {{ic|pg_upgrade}}, a {{Pkg|postgresql-old-upgrade}} package is available in the repositories that will always run one major version behind the real PostgreSQL package. This can be installed side by side with the new version of PostgreSQL. When you are ready to perform the upgrade, you can do<br />
pacman -Syu postgresql postgresql-libs postgresql-old-upgrade<br />
Note also that the data directory does not change from version to version, so before running pg_upgrade it is necessary to rename your existing data directory and migrate into a new directory. The new database must be initialized by starting the server, as described near the top of this page. The server then needs to be stopped before running pg_upgrade.<br />
<br />
# systemctl stop postgresql<br />
# su - postgres -c 'mv /var/lib/postgres/data /var/lib/postgres/olddata'<br />
# systemctl start postgresql<br />
# systemctl stop postgresql<br />
<br />
Reference the [http://www.postgresql.org/docs/current/static/pgupgrade.html upstream pg_upgrade documentation] for details.<br />
<br />
The upgrade invocation will likely look something like the following (run as the postgres user). '''Do not run this command blindly without understanding what it does!'''<br />
<br />
# su - postgres -c 'pg_upgrade -d /var/lib/postgres/olddata/ -D /var/lib/postgres/data/ -b /opt/pgsql-8.4/bin/ -B /usr/bin/'<br />
<br />
You could also do something like this (after the upgrade and install of postgresql-old-upgrade) (NB: these instructions DON'T seem to work for 9.2 -> 9.3 upgrades)<br />
<br />
# systemctl stop postgresql<br />
# /opt/pgsql-8.4/bin/pg_ctl -D /var/lib/postgres/olddata/ start<br />
# pg_dumpall >> old_backup.sql<br />
# /opt/pgsql-8.4/bin/pg_ctl -D /var/lib/postgres/olddata/ stop<br />
# systemctl start postgresql<br />
# psql -f old_backup.sql postgres<br />
<br />
== Troubleshooting ==<br />
<br />
=== Improve performance of small transactions ===<br />
<br />
If you are using PostgresSQL on a local machine for development and it seems slow, you could try turning [http://www.postgresql.org/docs/current/static/runtime-config-wal.html#GUC-SYNCHRONOUS-COMMIT synchronous_commit off] in the configuration ({{ic|/var/lib/postgres/data/postgresql.conf}}). Beware of the [http://www.postgresql.org/docs/current/static/runtime-config-wal.html#GUC-SYNCHRONOUS-COMMIT caveats], however.<br />
<br />
synchronous_commit = off<br />
<br />
=== 空闲时防止磁盘写入 ===<br />
<br />
PostgreSQL periodically updates its internal "statistics" file. By default, this file is stored on disk, which prevents disks spinning down on laptops and causes hard drive seek noise. It's simple and safe to relocate this file to a memory-only file system with the following configuration option:<br />
<br />
stats_temp_directory = '/run/postgresql'<br />
<br />
== See also ==<br />
<br />
* [http://www.postgresql.org/ Official PostgreSQL Homepage]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=OpenLDAP_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409277
OpenLDAP (简体中文)
2015-11-15T14:42:26Z
<p>Aaron chen: </p>
<hr />
<div>{{DISPLAYTITLE:openLDAP (简体中文)}}<br />
[[Category:简体中文]]<br />
[[Category:Networking (简体中文)]]<br />
[[en:OpenLDAP]]<br />
[[ja:openLDAP]]<br />
[[ru:OpenLDAP]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|LDAP Authentication}}<br />
{{Related|LDAP Hosts}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|openLDAP|2015-06-01|317024}}<br />
<br />
OpenLDAP 是 LDAP 协议的一个开源实现。LDAP 服务器基本上是一个为只读访问而优化的非关系型数据库。它主要用做地址簿查询(如 email 客户端)或对各种服务访问做后台认证以及用户数据权限管控。(例如,访问 Samba 时,LDAP 可以起到域控制器的作用;或者 [[LDAP Authentication|Linux 系统认证]] 时代替 {{ic|/etc/passwd}} 的作用。)<br />
<br />
{{注意|以 {{ic|ldap}} 开头的命令(如: {{ic|ldapsearch}})是客户端工具,以 {{ic|slap}} 开头的命令(如: {{ic|slapcat}} {{ic|slapcat}})是服务端工具。}}<br />
<br />
本页面内容仅基于一个基本的 OpenLDAP 安装做简要配置说明。<br />
<br />
{{小贴士|目录服务是一个庞大的主题,其配置可以非常复杂。如果你是一个完全的新手,[http://www.brennan.id.au/20-Shared_Address_Book_LDAP.html 这里]有一份详尽的介绍文档。该文档通俗易懂,即使你对 LDAP 一窍不通也完全可以引领你入门。}}<br />
<br />
== 安装 ==<br />
<br />
OpenLDAP 软件包同时包含了服务器和客户端。可以从 [[official repositories|官方源]] 安装 {{Pkg|openldap}}。<br />
<br />
== 配置 ==<br />
<br />
=== 服务端 ===<br />
<br />
{{注意|系统中现有的 OpenLDAP 数据库要通过清空 {{ic|/var/lib/openldap/openldap-data/}}目录的方法将其删除。}}<br />
<br />
服务器的配置文件位于 {{ic|/etc/openldap/slapd.conf}}。<br />
<br />
Edit the suffix and rootdn. The suffix typically is your domain name but it does not have to be. It depends on how you use your directory. We will use ''example'' for the domain name, and ''com'' for the tld. The rootdn is your LDAP administrator's name (we will use ''root'' here).<br />
{{bc|<nowiki><br />
suffix "dc=example,dc=com"<br />
rootdn "cn=root,dc=example,dc=com"<br />
</nowiki>}}<br />
<br />
Now we delete the default root password and create a strong one:<br />
# sed -i "/rootpw/ d" /etc/openldap/slapd.conf #find the line with rootpw and delete it<br />
# echo "rootpw $(slappasswd)" >> /etc/openldap/slapd.conf #add a line which includes the hashed password output from slappasswd<br />
<br />
You will likely want to add some typically used [http://www.openldap.org/doc/admin24/schema.html schemas] to the top of {{ic|slapd.conf}}:<br />
{{bc|<br />
include /etc/openldap/schema/cosine.schema<br />
include /etc/openldap/schema/inetorgperson.schema<br />
include /etc/openldap/schema/nis.schema<br />
}}<br />
<br />
You will likely want to add some typically used [http://www.openldap.org/doc/admin24/tuning.html#Indexes indexes] to the bottom of {{ic|slapd.conf}}:<br />
{{bc|<br />
index uid pres,eq<br />
index mail pres,sub,eq<br />
index cn pres,sub,eq<br />
index sn pres,sub,eq<br />
index dc eq<br />
}}<br />
<br />
Now prepare the database directory. You will need to copy the default config file and set the proper ownership:<br />
# cp /etc/openldap/DB_CONFIG.example /var/lib/openldap/openldap-data/DB_CONFIG<br />
# chown ldap:ldap /var/lib/openldap/openldap-data/DB_CONFIG<br />
<br />
{{Note|With OpenLDAP 2.4 the configuration of {{ic|slapd.conf}} is deprecated. From this version on all configuration settings are stored in {{ic|/etc/openldap/slapd.d/}}.}}<br />
<br />
To store the recent changes in {{ic|slapd.conf}} to the new {{ic|/etc/openldap/slapd.d/}} configuration settings, we have to delete the old configuration files first, do this every time you change the configuration:<br />
<br />
# rm -rf /etc/openldap/slapd.d/*<br />
<br />
<br />
(if you do not have a database yet, you might need to create one by starting and stopping the {{ic|slapd.service}} [[systemd#Using units|using systemd]] )<br />
<br />
Then we generate the new configuration with:<br />
<br />
# slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d/<br />
<br />
The above command has to be run every time you change {{ic|slapd.conf}}. Check if everything succeeded. Ignore message "bdb_monitor_db_open: monitoring disabled; configure monitor database to enable". <br />
<br />
Change ownership recursively on the new files and directory in /etc/openldap/slapd.d:<br />
<br />
# chown -R ldap:ldap /etc/openldap/slapd.d<br />
<br />
{{note|Index the directory after you populate it. You should stop slapd before doing this.<br />
# slapindex<br />
# chown ldap:ldap /var/lib/openldap/openldap-data/*<br />
}}<br />
<br />
Finally, start the slapd daemon with {{ic|slapd.service}} using systemd.<br />
<br />
=== 客户端 ===<br />
The client config file is located at {{ic|/etc/openldap/ldap.conf}}. <br />
<br />
It is quite simple: you'll only have to alter {{ic|BASE}} to reflect the suffix of the server, and {{ic|URI}} to reflect the address of the server, like:<br />
<br />
{{hc|/etc/openldap/ldap.conf|2=<br />
BASE dc=example,dc=com<br />
URI ldap://localhost<br />
}}<br />
<br />
If you decide to use SSL:<br />
<br />
* The protocol (ldap or ldaps) in the {{ic|URI}} entry has to conform with the slapd configuration <br />
* If you decide to use self-signed certificates, add a {{ic|TLS_REQCERT allow}} line to {{ic|ldap.conf}}<br />
<br />
=== 测试安装好的系统 ===<br />
<br />
This is easy, just run the command below:<br />
$ ldapsearch -x '(objectclass=*)'<br />
<br />
Or authenticating as the rootdn (replacing {{ic|-x}} by {{ic|-D <user> -W}}), using the example configuration we had above:<br />
$ ldapsearch -D "cn=root,dc=example,dc=com" -W '(objectclass=*)'<br />
<br />
Now you should see some information about your database.<br />
<br />
=== 基于TLS的OpenLDAP ===<br />
{{Note|[http://web.archive.org/web/20130211222328/http://www.openldap.org/pub/ksoper/OpenLDAP_TLS.html#4.0 upstream documentation] is much more useful/complete than this section}}<br />
<br />
If you access the OpenLDAP server over the network and especially if you have sensitive data stored on the server you run the risk of someone sniffing your data which is sent clear-text. The next part will guide you on how to setup an SSL connection between the LDAP server and the client so the data will be sent encrypted.<br />
<br />
In order to use TLS, you must have a certificate. For testing purposes, a ''self-signed'' certificate will suffice. To learn more about certificates, see [[OpenSSL]].<br />
<br />
{{Warning|OpenLDAP cannot use a certificate that has a password associated to it.}}<br />
<br />
==== 创建一个自签署的证书 ====<br />
To create a ''self-signed'' certificate, type the following:<br />
$ openssl req -new -x509 -nodes -out slapdcert.pem -keyout slapdkey.pem -days 365<br />
<br />
You will be prompted for information about your LDAP server. Much of the information can be left blank. The most important information is the common name. This must be set to the DNS name of your LDAP server. If your LDAP server's IP address resolves to example.org but its server certificate shows a CN of bad.example.org, LDAP clients will reject the certificate and will be unable to negotiate TLS connections (apparently the results are wholly unpredictable).<br />
<br />
Now that the certificate files have been created copy them to {{ic|/etc/openldap/ssl/}} (create this directory if it doesn't exist) and secure them. <br />
{{ic|slapdcert.pem}} must be world readable because it contains the public key. {{ic|slapdkey.pem}} on the other hand should only be readable for the ldap user for security reasons:<br />
# mv slapdcert.pem slapdkey.pem /etc/openldap/ssl/<br />
# chmod -R 755 /etc/openldap/ssl/<br />
# chmod 400 /etc/openldap/ssl/slapdkey.pem<br />
# chmod 444 /etc/openldap/ssl/slapdcert.pem<br />
# chown ldap /etc/openldap/ssl/slapdkey.pem<br />
<br />
==== 配置基于SSL的slapd ====<br />
Edit the daemon configuration file ({{ic|/etc/openldap/slapd.conf}}) to tell LDAP where the certificate files reside by adding the following lines:<br />
{{bc|<br />
# Certificate/SSL Section<br />
TLSCipherSuite HIGH:MEDIUM:-SSLv2<br />
TLSCertificateFile /etc/openldap/ssl/slapdcert.pem<br />
TLSCertificateKeyFile /etc/openldap/ssl/slapdkey.pem<br />
}}<br />
<br />
The TLSCipherSuite specifies a list of OpenSSL ciphers from which slapd will choose when negotiating TLS connections, in decreasing order of preference. In addition to those specific ciphers, you can use any of the wildcards supported by OpenSSL. '''NOTE:''' HIGH, MEDIUM, and +SSLv2 are all wildcards. <br />
<br />
{{Note|To see which ciphers are supported by your local OpenSSL installation, type the following: {{ic|openssl ciphers -v ALL}} }}<br />
<br />
Regenerate the configuration directory:<br />
# rm -rf /etc/openldap/slapd.d/* # erase old config settings<br />
# slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d/ # generate new config directory from config file<br />
# chown -R ldap:ldap /etc/openldap/slapd.d # Change ownership recursively to ldap on the config directory<br />
<br />
==== 启动基于SSL的slapd ====<br />
You will have to edit {{ic|slapd.service}} to change to protocol slapd listens on.<br />
<br />
First, disable {{ic|slapd.service}} if it's enabled.<br />
<br />
Then, copy the stock service to {{ic|/etc/systemd/system/}}:<br />
# cp /usr/lib/systemd/system/slapd.service /etc/systemd/system/<br />
<br />
Edit it, and add change {{ic|ExecStart}} to:<br />
{{hc|/etc/systemd/system/slapd.service|<nowiki><br />
ExecStart=/usr/bin/slapd -u ldap -g ldap -h "ldaps:///"</nowiki>}}<br />
<br />
Localhost connections don't need to use SSL. So, if you want to access the server locally you should change the {{ic|ExecStart}} line to:<br />
ExecStart=/usr/bin/slapd -u ldap -g ldap -h "ldap://127.0.0.1 ldaps:///"<br />
<br />
Then reenable and start it:<br />
# systemctl daemon-reload<br />
# systemctl restart slapd.service<br />
<br />
If {{ic|slapd}} started successfully you can enable it.<br />
<br />
{{Note|If you created a self-signed certificate above, be sure to add {{ic|TLS_REQCERT allow}} to {{ic|/etc/openldap/ldap.conf}} on the client, or it won't be able connect to the server.}}<br />
<br />
== 下一步 ==<br />
<br />
You now have a basic LDAP installation. The next step is to design your directory. The design is heavily dependent on what you are using it for. If you are new to LDAP, consider starting with a directory design recommended by the specific client services that will use the directory (PAM, [[Postfix]], etc).<br />
<br />
A directory for system authentication is the [[LDAP Authentication]] article.<br />
<br />
A nice web frontend is [[phpLDAPadmin]].<br />
<br />
== 排错 ==<br />
<br />
=== 检查客户端认证 ===<br />
If you can't connect to your server for non-secure authentication<br />
<br />
$ ldapsearch -x -H ldap://ldaservername:389 -D cn=Manager,dc=example,dc=exampledomain<br />
<br />
and for TLS secured authentication with:<br />
<br />
$ ldapsearch -x -H ldaps://ldaservername:636 -D cn=Manager,dc=example,dc=exampledomain<br />
<br />
=== LDAP服务突然停止 ===<br />
<br />
If you notice that slapd seems to start but then stops, try running:<br />
<br />
# chown ldap:ldap /var/lib/openldap/openldap-data/*<br />
<br />
to allow slapd write access to its data directory as the user "ldap".<br />
<br />
== 参阅 ==<br />
* [http://www.openldap.org/doc/admin24/ Official OpenLDAP Software 2.4 Administrator's Guide]<br />
* [[phpLDAPadmin]] is a web interface tool in the style of phpMyAdmin.<br />
* [[LDAP Authentication]]<br />
* {{AUR|apachedirectorystudio}} from the [[Arch User Repository]] is an Eclipse-based LDAP viewer. Works perfect with OpenLDAP installations.</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Network_configuration_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409276
Network configuration (简体中文)
2015-11-15T14:41:28Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Networking (简体中文)]]<br />
[[cs:Network configuration]]<br />
[[el:Network configuration]]<br />
[[en:Network configuration]]<br />
[[es:Network configuration]]<br />
[[fr:Connexions reseau]]<br />
[[it:Network configuration]]<br />
[[ja:ネットワーク設定]]<br />
[[nl:Network configuration]]<br />
[[pt:Network configuration]]<br />
[[ro:Configurare retea]]<br />
[[ru:Network configuration]]<br />
[[sk:Network configuration]]<br />
[[tr:Ağ Yapılandırması]]<br />
[[zh-tw:Network configuration]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Jumbo frames}}<br />
{{Related|Firewalls}}<br />
{{Related|Wireless network configuration (简体中文)}}<br />
{{Related|List of applications#Network Managers}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Network_Configuration|2013-10-25|279517}}<br />
本页解释了如何配置 '''有线''' 网络连接。如果你需要设置 '''无线''' 网络,参见[[Wireless_Setup|无线配置]]页面。<br />
<br />
== 检查连接 ==<br />
<br />
{{注意|如果你在执行 ping 的时候碰到像 {{ic|ping: icmp open socket: Operation not permitted}} 这样的错误,尝试重新安装 {{ic|iputils}} 软件包。}} <br />
<br />
大多数情况下,基本的安装过程已经创建了正确的网络配置。通过运行以下命令来检查:<br />
{{hc|$ ping -c 3 www.google.com|<nowiki><br />
PING www.l.google.com (74.125.224.146) 56(84) bytes of data.<br />
64 bytes from 74.125.224.146: icmp_req=1 ttl=50 time=437 ms<br />
64 bytes from 74.125.224.146: icmp_req=2 ttl=50 time=385 ms<br />
64 bytes from 74.125.224.146: icmp_req=3 ttl=50 time=298 ms<br />
<br />
--- www.l.google.com ping statistics ---<br />
3 packets transmitted, 3 received, 0% packet loss, time 1999ms<br />
rtt min/avg/max/mdev = 298.107/373.642/437.202/57.415 ms<br />
</nowiki>}}<br />
<br />
{{小贴士| 参数 {{ic|-c 3}} 表示执行命令 {{ic|ping}} 3次 。 参见 {{ic|man ping}}。}}<br />
<br />
如果像上面这样成功运行,那么你只需要进行下面这些个人配置。<br />
<br />
如果上面的命令说 unknown hosts,意思是你的机器无法进行域名解析。这可能和你的服务提供商或者你的路由器/网关有关。你可以尝试 ping 一个静态的 IP 地址来验证你的电脑是否能访问 Internet。<br />
<br />
{{注意|选项 {{ic|-c 3}} 表示发送三次。参见 {{ic|man ping}} 获得更多信息。}}<br />
<br />
{{hc|$ ping -c 3 8.8.8.8|<nowiki><br />
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.<br />
64 bytes from 8.8.8.8: icmp_req=1 ttl=53 time=52.9 ms<br />
64 bytes from 8.8.8.8: icmp_req=2 ttl=53 time=72.5 ms<br />
64 bytes from 8.8.8.8: icmp_req=3 ttl=53 time=70.6 ms<br />
<br />
--- 8.8.8.8 ping statistics ---<br />
3 packets transmitted, 3 received, 0% packet loss, time 2002ms<br />
rtt min/avg/max/mdev = 52.975/65.375/72.543/8.803 ms<br />
</nowiki>}}<br />
<br />
{{注意|{{ic|8.8.8.8}} 是一个容易记忆的静态地址。它是 Google 的主 DNS 服务器,因此它可以视为可信的,通常不会被过滤系统或代理屏蔽。}}<br />
<br />
如果你能够 ping 通这个地址,你可以尝试把这个域名服务器添加到 {{ic|/etc/resolv.conf}} 文件中。<br />
<br />
== 设置计算机名 ==<br />
<br />
[[Wikipedia:Hostname|主机名]] 是一个网络中唯一标识一台机器的名称。主机名通过文件 {{ic|/etc/hostname}} 进行配置。这样设置主机名:<br />
<br />
# hostnamectl set-hostname '''myhostname'''<br />
<br />
这将会把 '''myhostname''' 写入 {{ic|/etc/hostname}}。<br />
<br />
详情参见 {{ic|man 5 hostname}} 和 {{ic|man 1 hostnamectl}}。<br />
<br />
{{注意|<br />
* {{ic|hostnamectl}} 支持 FQDNs<br />
* 你不再需要编辑 {{ic|/etc/hosts}}, {{pkg|systemd}} 提供了主机名称的解析,它默认安装在所有系统上。}}<br />
<br />
要临时设置主机名(直到下次重启为止),使用 {{Pkg|inetutils}} 中的 {{ic|hostname}} 命令:<br />
<br />
# hostname ''myhostname''<br />
<br />
== 设备驱动程序 ==<br />
<br />
=== 检测驱动状态 ===<br />
<br />
[[Udev]] 会探测网卡([[Wikipedia:Network_interface_controller|NIC]])并在启动时自动载入必要的模块。 检查 {{ic|lspci -v}} 输出中 "Ethernet controller" (或者类似的)条目,它会告诉你哪个内核模块包含了网络设备的驱动程序。例如:<br />
<br />
{{hc|$ lspci -v|<br />
02:00.0 Ethernet controller: Attansic Technology Corp. L1 Gigabit Ethernet Adapter (rev b0)<br />
...<br />
Kernel driver in use: atl1<br />
Kernel modules: atl1<br />
}}<br />
<br />
接下来, 用 {{ic|dmesg <nowiki>|</nowiki> grep ''module_name''}} 来检查是否已经加载了驱动。例如:<br />
$ dmesg |grep atl1<br />
...<br />
atl1 0000:02:00.0: eth0 link is up 100 Mbps full duplex<br />
<br />
如果驱动加载成功,就跳过下一节,否则,你需要知道您特定型号的网络设备需要哪一个模块。<br />
<br />
=== 加载设备模块 ===<br />
<br />
用 Google 查找芯片组需要的模块/驱动。常见的驱动模块有用于 Realtek 芯片组网卡的 {{ic|8139too}},或者用于 Sis 芯片组网卡的 {{ic|sis900}}。知道要使用什么模块之后,尝试 [[Kernel modules#Manual module handling|手动加载它]]。如果你碰到了未找到模块的错误,可能驱动没有包括在 Arch 的内核中。你可以在 [[AUR]] 中搜索模块名称。<br />
<br />
如果 udev 在引导时不能自动侦测和加载适当的模块,参见 [[Kernel modules#Loading]]。<br />
<br />
== 网络接口 ==<br />
<br />
=== 设备名称 ===<br />
<br />
对于有多块网卡的电脑,固定设备名称很重要。许多配置问题都是由于网络接口名称变化引起的。<br />
<br />
[[udev]] 负责给设备命名。Systemd v197 引入了[http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames 可预测的网络接口名称]自动给网络设备分配静态名称,网络接口现在是以前缀 {{ic|en}}(以太网)、{{ic|wl}}(WLAN)、或者 {{ic|ww}}(WWAN)附上一个自动生成的标识符,产生了一个类似于 {{ic|enp0s25}} 的条目。<br />
<br />
可以添加一个链接来禁用这个行为:<br />
<br />
# ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules<br />
<br />
从以前版本的 systemd 升级的用户会有一份自动创建的空规则文件。因此,如果你想使用固定的设备名称,删除这个文件即可。<br />
<br />
{{小贴士|你可以运行 {{ic|ip link}} 或者 {{ic|ls /sys/class/net}} 列出所有接口。}<br />
<br />
{{注意|当你改变接口命名规则时,不要忘记更新所有与网络相关的配置文件和自定义的 systemd unit 文件以反映变化。特别是当你启用了 [[netctl#Basic method|netctl 静态配置]] 时,要运行 {{ic|netctl reenable ''profile''}} 来更新生成的服务文件。}}<br />
<br />
==== 更改设备名称 ====<br />
<br />
你可以用 udev-rule 手动定义名称来更改设备名称。例如:<br />
<br />
{{hc|/etc/udev/rules.d/10-network.rules|<nowiki><br />
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="aa:bb:cc:dd:ee:ff", NAME="net1"<br />
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="ff:ee:dd:cc:bb:aa", NAME="net0"<br />
</nowiki>}}<br />
<br />
值得注意的两点:<br />
<br />
* 使用这条命令来获得每张网卡的 MAC 地址:{{ic|cat /sys/class/net/'''设备名'''/address}}<br />
* 确保你的 udev 规则中使用小写的十六进制值,而不是大写。<br />
<br />
{{注意|选择静态名称时,'''应该避免使用形如 "eth''X''" 或 "wlan''X''" 的名称''',因为这可能在引导时导致内核与 udev 之间的竞争状态。相反,最好用内核默认不会使用的接口名称,例如:{{ic|net0}}、{{ic|net1}}、{{ic|wifi0}}、{{ic|wifi1}}。更多细节请查看 [http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames systemd] 文档。}}<br />
<br />
=== 设定设备的 MTU 和队列长度 ===<br />
<br />
你可以手动定义一条 udev 规则来改变队列的 MTU(最大传输单元)和队列长度You can change the device MTU and queue length by defining manually with an udev-rule。举例来说:<br />
<br />
{{hc|/etc/udev/rules.d/10-network.rules|<nowiki><br />
ACTION=="add", SUBSYSTEM=="net", KERNEL=="wl*", ATTR{mtu}="1480", ATTR{tx_queue_len}="2000"<br />
</nowiki>}}<br />
<br />
=== 获取当前网络名 ===<br />
<br />
可以通过 sysfs 找到当前的 NIC 名称:<br />
<br />
{{hc|$ ls /sys/class/net| <br />
lo eth0 eth1 firewire0<br />
}}<br />
<br />
=== 启用和禁用网络接口 ===<br />
<br />
可以通过如下命令启用或禁用接口:<br />
<br />
# ip link set eth0 up<br />
# ip link set eth0 down<br />
<br />
查看结果:<br />
<br />
{{hc|$ ip link show dev eth0|<br />
2: eth0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP mode DEFAULT qlen 1000<br />
...<br />
}}<br />
<br />
== 配置 IP 地址 ==<br />
<br />
有两种配置方式:通过 [[Wikipedia:Dynamic Host Configuration Protocol|DHCP]],或者不变的''静态''地址。<br />
<br />
=== 动态 IP 地址 ===<br />
<br />
==== systemd-networkd ====<br />
<br />
An easy way to setup DHCP for simple requirements is to use [[systemd-networkd]] service provided by systemd. See [[systemd-networkd#Basic DHCP network]].<br />
<br />
==== netctl ====<br />
<br />
[[netctl]] is a CLI-based tool for configuring and managing network connections through user-created profiles. Create a profile as shown in [[netctl#Example profiles]], then enable it as described in [[netctl#Basic method]].<br />
<br />
==== 手工运行 DHCP 客户端守护进程 ====<br />
<br />
请注意,{{ic|dhcpcd}}(DHCP ''客户端'' 守护进程)与 {{ic|dhcpd}}(DHCP ''(服务端)'' 守护进程)的不同。<br />
<br />
{{hc|# dhcpcd eth0|<br />
dhcpcd: version 5.1.1 starting<br />
dhcpcd: eth0: broadcasting for a lease<br />
...<br />
dhcpcd: eth0: leased 192.168.1.70 for 86400 seconds<br />
}}<br />
<br />
现在,{{ic|ip addr show dev eth0}} 将列出你的网络地址。<br />
<br />
对一些人来说,{{ic|dhcpcd}} 失败时,{{ic|dhclient}}(位于软件包 {{Pkg|dhclient}} 中)会有用。<br />
<br />
==== 启动时运行 DHCP ====<br />
<br />
如果你只想在你的以太网连接上使用 DHCP,你可以使用 {{ic|dhcpcd@.service}} (由软件包 {{Pkg|dhcpcd}} 提供)。<br />
<br />
{{ic|eth0}} 上启用 DHCP,只要调用:<br />
<br />
# systemctl start dhcpcd@eth0.service<br />
<br />
你能这样来使这个服务在启动时自动启用:<br />
<br />
# systemctl enable dhcpcd@eth0.service<br />
<br />
如果 dhcpd 服务在你的网卡模块之前启动({{bug|30235}}),手动地把你的网卡添加到 {{ic|/etc/modules-load.d/*.conf}} 中。例如,如果你的 Realtek 网卡需要载入 {{ic|r8169}},创建:<br />
<br />
{{hc|/etc/modules-load.d/realtek.conf|<br />
r8169<br />
}}<br />
<br />
{{小贴士|使用 {{ic|lspci -k}} 来找出你的网卡需要什么模块。}}<br />
<br />
如果你使用 DHCP 自动获取 IP 地址,但是'''不'''想每次启动网络的时候让 DHCP 更改你的 DNS 服务器(域名服务器),在 {{ic|dhcpcd.conf}} 的最后一部分中添加:<br />
<br />
{{hc|/etc/dhcpcd.conf|<br />
nohook resolv.conf<br />
}}<br />
<br />
此外,如果你在一个使用基于 MAC 地址的 Client ID 来过滤的 DHCPv4 网络中,你可能需要把以下这行:<br />
<br />
{{hc|/etc/dhcpcd.conf|<br />
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 Client ID as per RFC4361. <br />
duid<br />
}}<br />
<br />
改为:<br />
<br />
{{hc|/etc/dhcpcd.conf|<br />
# Use the hardware address of the interface for the Client ID (DHCPv4).<br />
clientid<br />
}}<br />
<br />
否则,你可能得不到租凭,因为 DHCP 服务器可能无法正确读取你的 [http://en.wikipedia.org/wiki/DHCPv6 DHCPv6-style] Client ID。更多信息可参见[http://tools.ietf.org/html/rfc4361 RFC 4361]。<br />
<br />
在 {{ic|/etc/dhcpcd.conf}} 中使用 nooption 选项来阻止 dhcpcd 向 {{ic|/etc/resolv.conf}} 添加域名服务器:<br />
<br />
{{hc|/etc/dhcpcd.conf|<br />
nooption domain_name_servers<br />
}}<br />
<br />
然后把你自己的 DNS 服务器添加到 {{ic|/etc/resolv.conf}}.<br />
<br />
如果多个不同进程都会更改{{ic|/etc/resolv.conf}} (例如,{{Pkg|dhcpcd}} 和 VPN 客户端),请安装 {{Pkg|openresolv}} 软件包,使用它不需要额外地配置{{Pkg|dhcpcd}}。<br />
<br />
=== 静态 IP 地址 ===<br />
<br />
使用静态 IP 地址有多种原因,例如通过不变的IP地址获得一定程度的可预测性,或者你没有可用的 DHCP 服务器。<br />
<br />
{{注意|在不使用路由器的情况下和一台安装 Windows 的电脑分享你的网络连接,请确保两台电脑都使用静态 IP ,否则你的局域网将会有问题。}}<br />
<br />
需要确定:<br />
<br />
* 静态IP地址,<br />
* [[Wikipedia:Subnetwork|子网掩码]],<br />
* Subnet mask in [[wikipedia:Classless Inter-Domain Routing#CIDR notation|CIDR notation]], for example {{ic|/24}} is the CIDR notation of {{ic|255.255.255.0}} netmask<br />
* [[Wikipedia:Broadcast_address|广播地址]],<br />
* [[Wikipedia:Default_gateway|网关]]的IP地址<br />
* Name server (DNS) IP addresses. See also [[resolv.conf]].<br />
<br />
如果你想配置一个内部网络,可以将你的 IP 设置成 192.168.*.* ,子网掩码设置成 255.255.255.0 ,广播地址设置成 192.168.*.255 。网关通常是 192.168.*.1 或者 192.168.*.254。<br />
<br />
{{Warning|<br />
* Make sure manually assigned IP addresses do not conflict with DHCP assigned ones. See [http://www.raspberrypi.org/forums/viewtopic.php?f&#61;28&t&#61;16797 this forum thread]<br />
* If you share your Internet connection from a Windows machine without a router, be sure to use static IP addresses on both computers to avoid LAN problems.<br />
}}<br />
<br />
==== systemd-networkd ====<br />
<br />
The [[systemd-networkd]] service provided by systemd can set up a static IP using a simple configuration file. See [[systemd-networkd#Wired adapter using a static IP]].<br />
<br />
==== dhcpcd ====<br />
<br />
See [[dhcpcd#Static profile]].<br />
<br />
==== 手动指定 ====<br />
<br />
你可以在终端中指定一个静态 IP:<br />
<br />
# ip addr add <IP 地址>/<子网掩码> dev <interface><br />
<br />
例如:<br />
<br />
# ip addr add 192.168.1.2/24 dev eth0<br />
<br />
{{注意|子网掩码使用 [[Wikipedia:CIDR_notation|CIDR 表示法]]。}}<br />
<br />
更多选项参见:{{ic|man ip}}<br />
<br />
如此添加你的网关(用你的网关 IP 替换):<br />
<br />
# ip route add default via <默认网关的 IP 地址><br />
<br />
例如:<br />
<br />
# ip route add default via 192.168.1.1<br />
<br />
如要你看到 "No such process" 的错误,这意味着你必须以root权限运行{{ic|ip link set dev eth0 up}}。<br />
<br />
==== 启动时使用 systemd 手动连接 ====<br />
<br />
首先为创建 [[systemd]] 服务的配置文件,使用适当的接口名称替换 {{ic|<interface>}}:<br />
<br />
{{hc|/etc/conf.d/network@<interface>|<nowiki><br />
address=192.168.0.15<br />
netmask=24<br />
broadcast=192.168.0.255<br />
gateway=192.168.0.1<br />
</nowiki>}}<br />
<br />
创建一个 systemd unit 文件:<br />
{{hc|/etc/systemd/system/network@.service|<nowiki><br />
[Unit]<br />
Description=Network connectivity (%i)<br />
Wants=network.target<br />
Before=network.target<br />
BindsTo=sys-subsystem-net-devices-%i.device<br />
After=sys-subsystem-net-devices-%i.device<br />
<br />
[Service]<br />
Type=oneshot<br />
RemainAfterExit=yes<br />
EnvironmentFile=/etc/conf.d/network@%i<br />
<br />
ExecStart=/usr/bin/ip link set dev %i up<br />
ExecStart=/usr/bin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev %i<br />
ExecStart=/usr/bin/ip route add default via ${gateway}<br />
<br />
ExecStop=/usr/bin/ip addr flush dev %i<br />
ExecStop=/usr/bin/ip link set dev %i down<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
启用并启动此 unit, 传入接口的名称:<br />
<br />
# systemctl enable network@eth0.service<br />
# systemctl start network@eth0.service<br />
<br />
===== 使用静态 IP 地址 =====<br />
<br />
用编辑器创建文件 {{ic|/etc/systemd/system/network.service}}。这份示例中使用一个静态 IP 地址和 [[WPA supplicant]]。<br />
<br />
{{hc|/etc/systemd/system/network.service|<nowiki><br />
[Unit]<br />
Description=Network Connectivity<br />
Wants=network.target<br />
Before=network.target<br />
BindsTo=sys-subsystem-net-devices-net0.device<br />
After=sys-subsystem-net-devices-net0.device<br />
<br />
[Service]<br />
Type=oneshot<br />
RemainAfterExit=yes<br />
ExecStart=/usr/bin/ip link set dev net0 up<br />
ExecStart=/usr/bin/wpa_supplicant -B -i net0 -c /etc/wpa_supplicant.conf # Remove this for wired connections<br />
ExecStart=/usr/bin/ip addr add 192.168.0.10/24 dev net0<br />
ExecStart=/usr/bin/ip route add default via 192.168.0.1<br />
<br />
ExecStop=/usr/bin/ip addr flush dev net0<br />
ExecStop=/usr/bin/ip link set dev net0 down<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
不要忘记启用它!<br />
<br />
# systemctl enable network<br />
<br />
要进行测试,重启或保证所有其它网络的守护进程已经停止,并以 root 权限执行:<br />
<br />
# systemctl start network<br />
<br />
==== 计算地址 ====<br />
<br />
可以用 {{Pkg|ipcalc}} 软件包提供的 {{ic|ipcalc}} 工具自动计算 IP 广播、子网掩码、主机范围等。例如通过火线连接视窗系统主机到 Arch。为了安全和网络组织,将它们分到独立的网络中,然后配置子网掩码和广播地址,网络中只有2台主机。要找出掩码和广播地址,我使用了 ipcalc,提供了它 arch firewire nic 的 IP 地址10.66.66.1,并告诉 ipcalc 要建立一个只有2台主机的网络。<br />
<br />
{{hc|$ ipcalc -nb 10.66.66.1 -s 1|<nowiki><br />
Address: 10.66.66.1<br />
<br />
Netmask: 255.255.255.252 = 30<br />
Network: 10.66.66.0/30<br />
HostMin: 10.66.66.1<br />
HostMax: 10.66.66.2<br />
Broadcast: 10.66.66.3<br />
Hosts/Net: 2 Class A, Private Internet<br />
</nowiki>}}<br />
<br />
== 载入设置 ==<br />
<br />
想测试你的设置,可以重启计算机或者重新加载相关的 systemd 服务:<br />
<br />
# systemctl restart dhcpcd@eth0<br />
<br />
试着按照这个顺序 ping 一些网络地址:你的网关, DNS 服务器(域名服务器), ISP 服务提供商,以及其他的网络地址。这样可以检查你的网络连接在哪里出了问题。如:<br />
<br />
$ ping -c 3 www.google.com<br />
<br />
== 更多设置 ==<br />
<br />
=== 笔记本电脑使用 Ifplugd ===<br />
<br />
[[官方仓库]] 中的 {{Pkg|ifplugd}} 是一个守护进程,当网络适配器插入的时候自动配置网络,当网络断开的时候自动取消配置(比如某些3G的usb网络适配器)。这对于笔记本电脑这样的使用移动式的网络适配器的情况很有用,因为他只会在网络实际接入的时候才会配置网络接口。另外一个可能会用得着它的情况是,你需要重启你的网络,可是你既不想重启电脑也不想在 shell 中配置。<br />
<br />
在默认情况下,它会检查 {{ic|eth0}} 设备。要更改这个设置(以及更改其他设置,比如等待时间),可以编辑 {{ic|/etc/ifplugd/ifplugd.conf}}。<br />
<br />
启用 {{ic|net-auto-wired.service}} 就会在开机时启动 ifplugd,否则,你可以使用 {{ic|ifplugd@eth0.service}}。<br />
<br />
{{注意|[[Netctl]] 软件包包含了 {{ic|netctl-ifplugd@.service}},否则你可以使用 {{Pkg|ifplugd}} 软件包中的 {{ic|ifplugd@.service}}。例如 {{ic|systemctl enable ifplugd@eth0.service}}。}}<br />
<br />
=== 绑定和链路聚合 ===<br />
<br />
参见 [[netctl (简体中文)#Bonding(绑定)]]。<br />
<br />
=== IP 别名 ===<br />
<br />
{{Expansion|Manual method using [[Core utilities#ip|ip]] should be added; then move current example using ''netctl'' into [[netctl]].}}<br />
<br />
IP 别名是指给同一个网络接口分配多个 IP 地址。这样一个网络节点可以有多个网络连接,每个实现不同的作用。Typical uses are virtual hosting of Web and FTP servers, or reorganizing servers without having to update any other machines (this is especially useful for nameservers).<br />
<br />
==== 示例 ====<br />
<br />
你需要使用[[官方仓库]]中的{{Pkg|netctl}}。<br />
<br />
准备配置文件<br />
<br />
{{hc|/etc/netctl/mynetwork|<nowiki><br />
<br />
Connection='ethernet'<br />
Description='Five different addresses on the same NIC.'<br />
Interface='eth0'<br />
IP='static'<br />
Address=('192.168.1.10' '192.168.178.11' '192.168.1.12' '192.168.1.13' '192.168.1.14' '192.168.1.15')<br />
Gateway='192.168.1.1'<br />
DNS=('192.168.1.1')<br />
</nowiki>}}<br />
<br />
然后只要执行:<br />
<br />
$ netctl start mynetwork<br />
<br />
=== 更改 MAC/硬件地址 ===<br />
<br />
参见 [[MAC address spoofing|伪造 MAC 地址]]。<br />
<br />
=== 共享网络连接 ===<br />
<br />
参见 [[Internet sharing|共享网络连接]]。<br />
<br />
=== 路由配置 ===<br />
<br />
参见 [[Router|路由]]。<br />
<br />
=== 局域网主机的名称解析 ===<br />
<br />
When setting up a DNS server such as [[BIND]] or [[Unbound]] is overkill, manually editing your {{ic|/etc/hosts}} is too cumbersome, or when you want more flexibility with dynamic leaving and joining of hosts to the network, it is possible to handle hostname resolution on your local network using zero-configuration networking. 你有两个选择:<br />
<br />
*[[Samba]] 通过 Microsoft's '''NetBIOS''' 提供主机名称解析。这只需要安装 {{Pkg|samba}} 并启用 {{ic|nmbd.service}} 服务。运行 Windows、 OS X、或者运行着 {{ic|nmbd}} 的 Linux,将能找到你的机器。<br />
<br />
*[[Avahi]] 通过 '''zeroconf''',提供主机名称解析, 它也被称称作 Avahi 或者 Bonjour。这需要比 Samba 再稍微复杂一点的配置:详细信息参见 [[Avahi#Hostname resolution]]。运行 OS X 的电脑,或者运行着 Avahi 守护进程的 Linux,将能找到你的机器。Windows 没有内置的 Avahi 客户端或者守护进程。<br />
<br />
== 疑难排解 ==<br />
<br />
=== 更换了连接cable modem的计算机 ===<br />
<br />
许多家庭有线电视的运营商(例如加拿大最大的有线电视公司Videotron,还有中国大陆的有线电视宽带公司)都使用记录网卡MAC地址的方法将cable modem配置为只能一台计算机使用。一旦cable modem获得第一台连接它的PC的MAC地址,就不会响应任何其它MAC地址。这样如果你换了台PC(或者路由器),由于新PC(或者路由器)的MAC地址和旧的不同,就没法连接cable modem了。这时候必须复位cable modem以使它重新辨认新的PC。 你得关闭cable modem电源,然后重新打开。一旦cable modem重启并再次登录在线完毕(指示灯熄灭),重启新连接的PC以使它发起一个DHCP请求,或者手动发起DHCP请求。<br />
<br />
如果这个方法不能奏效,你需要克隆原来机器上的MAC地址。参见 [[Configuring Network#Change MAC/hardware address|Change MAC/hardware address]]。<br />
<br />
=== TCP窗口扩缩(window scaling)故障 ===<br />
<br />
TCP包头有个窗口(window)值表明其它主机可以发送多少数据回来。这个值只有16个bit,也就是说窗口打消最多只有64Kb。TCP包会被缓存一段时间(得被记录),如果内存限制(过去经常是)的话,主机很容易会用完内存。<br />
<br />
回到1992年,内存逐渐增加,[http://www.faqs.org/rfcs/rfc1323.html RFC 1323]被发布以改善情况:窗口扩缩(Window Scaling)。所有包里的窗口值,可以被初始连接时定义的一个缩放因子(Scale Factor)所改变。<br />
<br />
8-bit的缩放因子使得窗口可以是初始64Kb的32倍。<br />
<br />
但是Internet上有些有故障的路由器和防火墙会将缩放因子重写为0,这导致主机之间产生误解。<br />
<br />
Linux内核2.6.17引入了新的计算方式生成更高的缩放因子,间接的使得这些有故障的路由器和防火墙引发的后果更明显。<br />
<br />
这导致连接缓慢甚至中断。<br />
<br />
==== 如何诊断故障 ====<br />
<br />
首先,我们要明白:这个问题很怪异。在某些案例中,你根本无法使用(HTTP, FTP, ...),而有时候,你可以连接某些主机(很少)。<br />
<br />
当你碰到这个故障时,{{ic|dmesg}}的输出正确,日志也没问题,{{ic|ip a}}报告状态正常&mdash; 实际上一切都正常。<br />
<br />
如果你无法浏览任何网站,不过你能ping通少部分主机,很可能你是遇到了这个问题。:ping使用ICMP协议所以不受TCP问题的影响。<br />
<br />
你可以尝试使用WireShark。你也许会看到UDP和ICMP通讯成功,但是TCP通讯不成功(仅对外国主机)。<br />
<br />
==== 如何修复(糟糕的方法) ====<br />
<br />
用比较糟糕的方法修复的话,你可以修改缩放因子计算所基于的tcp_rmem值。虽然它对大部分主机有效,但并不担保一定都有效,特别是某些很远的主机。<br />
<br />
# echo "4096 87380 174760" > /proc/sys/net/ipv4/tcp_rmem<br />
<br />
==== 如何修复(好点的方法) ====<br />
<br />
只需要禁止窗口缩放。虽然窗口缩放是个不错的TCP特性,但它也可能令人不安,特别是当你没法修改除了问题的路由器的时候。有几种方法可以禁止窗口缩放,而看来最可靠的(适用于大部分内核)将下面一行加入到你的{{ic|/etc/sysctl.d/99-sysctl.conf}}中 (见 [[sysctl]])<br />
net.ipv4.tcp_window_scaling = 0<br />
<br />
==== 如何修复(最佳的方法) ====<br />
<br />
这个故障是由有毛病的路由器/防火墙引致的,所以最好换了它。有些用户报告说那些有故障的路由是他们自己的DSL路由。<br />
<br />
==== 更多 ====<br />
<br />
本段内容是基于LWN文章[http://lwn.net/Articles/92727/ TCP window scaling and broken routers]和一个Kernel Trap 文章:[http://kerneltrap.org/node/6723 Window Scaling on the Internet]。<br />
<br />
在LKML上也有几篇相关的帖子。<br />
<br />
=== Realtek 没有连接/网络唤醒故障 ===<br />
<br />
使用基于Realtek 8168 8169 8101 8111芯片网卡(独立网卡和板载)的用户也许会发现这个故障,启动时网卡不可用,网卡上的连接指示灯不亮。这通常会发生在安装了Windows的双启动系统上。在windows下使用realtek官方驱动(2007年5月后的版本)会引发故障。新驱动通过在Windows关机时禁止网卡来关闭网络唤醒功能,直到下一次Windows启动前网卡都会一直不可用。通过观察连接指示灯在Windows启动前一直熄灭,而Windows关机时也会熄灭,你可以发现它。正常操作应该是只要系统一直开着,即使在POST加电过程中,连接指示灯也应该一直亮着的。这个故障也会影响其它没有安装新驱动的操作系统(例如Live CD等)。这里给出几种解决方案:<br />
<br />
==== 方法一 还原/变更Win驱动 ====<br />
<br />
你可以将你的Windows网卡驱动还原回Microsoft自带的驱动(如果有的话),或者安装2007年5月份以前的Realtek官方驱动(也许在网卡附带的CD上)。<br />
<br />
==== 方法二 启动Windows驱动里的网络唤醒功能 ====<br />
<br />
也许最好最快的修复方法就是改变Windows驱动里的这个设置。这个方法可以解决很多其它操作系统而不仅仅是Arch的麻烦。在Windows的设备管理器里,找到你的Realtek网卡,双击它。在“高级”标签页中,开启"wake-on-lan after shutdown"选项。<br />
<br />
例如在Windows XP里<br />
右键点击我的电脑-->管理-->设备管理器-->网络适配器-->双击 Realtek ... --> 高级标签页--> Wake-On-Lan After Shutdown --> 启用。<br />
<br />
{{注意|新的 Realtek Windows 驱动程序中(已测试了 2009/01/22 GIGABYTE 上的 ''Realtek 8111/8169 LAN Driver v5.708.1030.2008'')可能与这里的选项稍微有点不同,像 ''Shutdown Wake-On-LAN --> Enable''。似乎把它切换成 {{ic|Disable}} 没有效果(你仍然可以在Windows关闭时看到连接指示灯熄灭)。一个比较不好的解决方法是引导 Windows,然后立即重启系统(执行非正常重启/关机),不给予 Windows 驱动程序关闭 LAN 的机会。连接指示灯将会保持亮着,网卡也会在 POST 之后保持可用 - 直到你再次进入 Windows 并正常关机。}}<br />
<br />
==== 方法三 更新Realtek Linux驱动 ====<br />
<br />
可以在realtek的官方网页上找到新的Linux驱动。(没有测试过,不过相信也能解决问题)。<br />
<br />
==== 方法四 在 BIOS/CMOS 中启用 ''LAN Boot ROM'' ====<br />
<br />
尽管 Windows 驱动程序在系统关闭时禁用了它,但在 BIOS/CMOS 中设置 ''Integrated Peripherals --> Onboard LAN Boot ROM --> Enabled'',系统启动时会重新激活 Realtek LAN 芯片。<br />
{{注意|这个方法多次在 GIGABYTE GA-G31M-ES2L 主板,2009/02/05 发布的 BIOS 版本 F8 上测试成功。YMMV。}}<br />
<br />
=== DLink G604T/DLink G502T DNS 故障 ===<br />
<br />
使用 DLink G604T/DLink G502T 路由器和DHCP,并且固件是 v2.00+(通常是使用 AUS 固件)的用户可能会碰到的某些程序不同解析 DNS 的问题。不幸的是,pacman 就是这些程序其中之一。故障基本上是因为路由器在某些情况下不正确地发送 DNS 给 DHCP,导致程序尝试连接 IP 地址是 1.0.0.0 的服务器,然后因超时错误而失败。<br />
<br />
==== 如何诊断故障 ====<br />
<br />
最好的诊断问题方法是使用 Firefox/Konqueror/links/seamonkey,并用 wget 作为 pacman 下载工具。如果问题发生在全新安装的 Arch Linux上,那么你可能要通过 live CD 来安装 {{ic|links}}。<br />
<br />
首先,用 wget 作为 pacman下载工具,它可以提供 pacman 下载软件包时的信息。<br />
使用你喜欢的编辑器打开 {{ic|/etc/pacman.conf}} 并取消下面这行的注释(如果前面有#的话,就移除它)<br />
<br />
XferCommand=/usr/bin/wget --passive-ftp -c -O %o %u<br />
<br />
当你编辑 {{ic|/etc/pacman.conf}} 时,检查 pacman 用来下载软件包的默认镜像。<br />
<br />
现在用网络浏览器打开默认镜像,检查镜像确实在工作。如果它很正常,那么运行 {{ic|pacman -Syy}} (否则就选取另一个正常运行的镜像,并把它设置为 pacman 的默认镜像)。如果你看到类似于下面这样的信息(注意 1.0.0.0),<br />
<br />
<nowiki>ftp://mirror.pacific.net.au/linux/archlinux/extra/os/i686/extra.db.tar.gz</nowiki> <br />
=> '/var/lib/pacman/community.db.tar.gz.part'<br />
Resolving mirror.pacific.net.au... 1.0.0.0<br />
<br />
那么你很有可能有这个问题。 1.0.0.0 表示不能解析 DNS,因此我们必须把它添加到 {{ic|/etc/resolv.conf}} 中。<br />
<br />
==== 如何修复 ====<br />
<br />
{{Out of date|{{Pkg|dhcpcd}} 不再使用 {{ic|/etc/conf.d/dhcpcd}} 。}}<br />
<br />
基本上我们需要做的就是手动地在 {{ic|/etc/resolv.conf}} 文件中添加 DNS 服务器。问题是 DHCP 会在启动时自动地删除和替换这个文件,所以我们需要编辑 {{ic|/etc/conf.d/dhcpcd}} 并修改标志,阻止 DHCP 这么做。<br />
<br />
当你打开 {{ic|/etc/conf.d/dhcpcd}},你应该看见类似下面的内容:<br />
<br />
DHCPCD_ARGS="-t 30 -h $HOSTNAME"<br />
<br />
在参数中添加 -R 参数,即,<br />
<br />
DHCPCD_ARGS="-R -t 30 -h $HOSTNAME"<br />
<br />
{{注意|1=如果你使用的 {{Pkg|dhcpcd}} >= 4.0.2,标志 {{ic|-R}} 已被弃用。请参考 [[Dhcpcd]] 中关于怎样使用自定义的 {{ic|/etc/resolv.conf}} 文件的信息。}}<br />
<br />
保存并关闭文件;现在打开 {{ic|/etc/resolv.conf}}。你应该看到一行 nameserver(最有可能是 10.1.1.1)。这是你的路由器的网关,我们需要连接它来获取你的 ISP 的 DNS 服务器。在你的浏览器地址栏中粘贴这个IP地址,并登录你的路由器。转到 DNS 部分,然后你将在 Primary DNS Server 一栏中看到一个 IP 地址;复制并粘贴它,作为一行 nameserver 放在现有网关那行的 '''上面'''。<br />
<br />
例如,{{ic|/etc/resolv.conf}} 应该看上去是像这样的<br />
<br />
nameserver 10.1.1.1<br />
<br />
如果我的主 DNS 服务器是 211.29.132.12,那么修改 {{ic|/etc/resolv.conf}} 为<br />
<br />
nameserver 211.29.132.12<br />
nameserver 10.1.1.1<br />
<br />
现在执行{{ic|systemctl restart dhcpcd@<interface>}}重启 network 守护进程并执行 {{ic|pacman -Syy}}。如果它与服务器正常地同步了,那么问题就解决了。<br />
<br />
==== 更多 ====<br />
<br />
这是 whirlpool 论坛(Australian ISP community)中对这个问题的讨论并给出了相同的解决办法。<br />
<br />
http://forums.whirlpool.net.au/forum-replies-archive.cfm/461625.html<br />
<br />
=== 检查 DHCP 问题先释放 IP 地址 ===<br />
<br />
当 DHCP 获得了错误的 IP 分配就可能产生这个问题。举例来说,当两个路由器通过VPN相连,通过VPN与我相连的路由器可能分配IP地址。要修复这个问题,在终端中以 root 权限释放 IP 地址:<br />
<br />
# dhcpcd -k<br />
<br />
然后请求一个新的地址:<br />
<br />
# dhcpcd<br />
<br />
可能你必须运行这两个命令好几次。<br />
<br />
=== Atheros AR8161 没有 eth0 ===<br />
<br />
对于 Atheros AR8161 Gigabit 以太网卡,以太网连接不能立即使用(2013年3月的安装介质)。它需要加载模块 "alx",但其并不存在。<br />
<br />
你需要安装 [https://backports.wiki.kernel.org/index.php/Releases compat-drives] 中的驱动。后缀 "-u" 说明 Qualcomm 可以使用通用的 Driver 模块。<br />
<br />
$ wget https://www.kernel.org/pub/linux/kernel/projects/backports/2013/03/28/compat-drivers-2013-03-28-5-u.tar.bz2<br />
$ tar xjf compat*<br />
$ cd compat*<br />
$ ./scripts/driver-select alx<br />
$ make<br />
$ sudo make install<br />
$ sudo modprobe alx<br />
<br />
alx 驱动由于各种问题且不同内核版本之间的兼容性不佳而没有被加入 Linux 内核。要获得更好的支持,访问 [http://lists.infradead.org/mailman/listinfo/unified-drivers 邮件列表] 和 [http://www.linuxfoundation.org/collaborate/workgroups/networking/alx alx 页面] 获得最新的 alx 可行方案。<br />
<br />
每次内核发生变化时,这个驱动都必须重新编译和安装。<br />
<br />
另外,你可以使用 [https://aur.archlinux.org/packages/compat-drivers-patched/ compat 驱动]的 AUR 软件包,它还会安装许多其它驱动。<br />
<br />
=== Atheros AR9485 没有 eth0 ===<br />
<br />
{{注意|3.10.2-1-ARCH 内核更新的软件包中包括了 alx 以太网驱动模块。}}<br />
<br />
Atheros AR9485 的以太网连接(eth0)不能立即使用(2013年3月的安装介质)。一个可行的解决方法是从 AUR 中安装 [https://aur.archlinux.org/packages/compat-drivers-patched/ compat-drivers-patched] 软件包。<br />
<br />
=== 待机后未接线缆 / 无连接 ===<br />
<br />
待机以后,接入网络电缆后仍找不到连接。这可能是由于 PCI 电源管理引起的。以下命令的输出<br />
<br />
# ip link show eth0<br />
<br />
如果网线接入 eth0 端口之后这一行仍含有,那么可能 the device was auto-suspended and the media sense feature doesn't work。要解决这个问题,首先你需要找到网卡控制器的 PCI 地址,通过<br />
<br />
# lspci<br />
<br />
结果应该类似于这样:<br />
<br />
...<br />
00:19.0 Ethernet controller: Intel Corporation 82577LM Gigabit Network Connection (rev 06)<br />
...<br />
<br />
所以这里的地址是 00:19.0。<br />
现在这样检查设备的电源状态:<br />
<br />
# cat "/sys/bus/pci/devices/0000:00:19.0/power/control"<br />
<br />
使用从 lspci 中获得的地址替换 00:19.0。<br />
如果输出结果为 "auto",你可以尝试让设备不再待机,输入<br />
<br />
# echo on > "/sys/bus/pci/devices/0000:00:19.0/power/control"<br />
<br />
不要忘记再一次替换地址。<br />
<br />
{{注意|1=这是内核 3.8.4.1 的缺陷:[https://bbs.archlinux.org/viewtopic.php?id=159837&p=2 论坛讨论]。在 3.9 中应该会 [https://lkml.org/lkml/2013/1/18/147 修复]。在更新内核前,可以使用上述方法。}}<br />
<br />
=== Broadcom BCM57780 ===<br />
<br />
这个 Broadcom 芯片只有你指定模块的加载顺序后才能正常工作。这些模块是 {{ic|broadcom}} 和 {{ic|tg3}},前者需要首先加载。<br />
<br />
如果你的电脑有这个芯片,这些步骤应该有用:<br />
<br />
$ lspci | grep Ethernet<br />
02:00.0 Ethernet controller: Broadcom Corporation NetLink BCM57780 Gigabit Ethernet PCIe (rev 01)<br />
<br />
如果你的有线网络不能工作,尝试断开网线,然后以 root 权限实施以下步骤:<br />
<br />
# modprobe -r tg3<br />
# modprobe broadcom<br />
# modprobe tg3<br />
<br />
现在接入网线。如果现在你的故障解决了,你可以把 {{ic|broadcom}} 和 {{ic|tg3}} (以此顺序)加入到 {{ic|/etc/mkinitcpio.conf}} 的 {{ic|MODULES}} 一行,使得变更持久化:<br />
<br />
MODULES=".. broadcom tg3 .."<br />
<br />
然后重新编译 initramfs:<br />
<br />
# mkinitcpio -p linux<br />
<br />
{{注意|这些方法可能也适用于其它芯片,例如 BCM57760。}}</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Network_bridge_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409275
Network bridge (简体中文)
2015-11-15T14:40:53Z
<p>Aaron chen: </p>
<hr />
<div>{{DISPLAYTITLE:Network bridge (简体中文)}}<br />
[[Category:简体中文]]<br />
[[Category:Networking (简体中文)]]<br />
[[en:Network bridge]]<br />
[[ja:ネットワークブリッジ]]<br />
{{TranslationStatus (简体中文)|Network_bridge|2015-05-07|367464}}<br />
<br />
{{Related articles start}}<br />
{{Related|Bridge with netctl}}<br />
{{Related articles end}}<br />
网桥是一种软件配置,用于连结两个或更多个不同网段。网桥的行为就像是一台虚拟的网络交换机,工作于透明模式(即其他机器不必关注网桥的存在与否)。任意的真实物理设备(例如 {{ic|eth0}})和虚拟设备(例如 {{ic|tap0}})都可以连接到网桥。<br />
<br />
本文讲述如何创建至少包含一个以太网设备的网桥,这种应用常见于[[QEMU]]、设置基于软件的访问点等场景。<br />
<br />
== 创建网桥 ==<br />
<br />
创建网桥有多种途径。<br />
<br />
=== 通过 bridge-utils ===<br />
<br />
本节讲述用 {{Pkg|bridge-utils}} 软件包里面的 ''brctl'' 工具管理网桥。该软件包已进入官方仓库([[official repositories]])。''brctl'' 的完整选项清单请参阅 {{ic|man brctl}}。<br />
<br />
新建一个网桥:<br />
<br />
# brctl addbr ''bridge_name''<br />
<br />
添加一个设备(例如{{ic|eth0}})到网桥:<br />
<br />
# brctl addif ''bridge_name'' eth0<br />
<br />
显示当前存在的网桥及其所连接的网络端口:<br />
<br />
$ brctl show<br />
<br />
启动网桥:<br />
<br />
# ip link set up dev ''bridge_name''<br />
<br />
删除网桥,需要先关闭它:<br />
<br />
# ip link set dev ''bridge_name'' down<br />
# brctl delbr ''bridge_name''<br />
<br />
=== 通过 iproute2 ===<br />
<br />
本节讲述用 {{Pkg|iproute2}} 软件包里面的 ''ip'' 工具管理网桥。该软件包包含在 {{Grp|base}} 包组中。<br />
<br />
创建一个网桥并设置其状态为已启动:<br />
<br />
# ip link add name ''bridge_name'' type bridge<br />
# ip link set dev ''bridge_name'' up<br />
<br />
添加一个网络端口(比如 eth0)到网桥中,要求先将该端口设置为混杂模式并启动该端口:<br />
<br />
# ip link set dev eth0 promisc on<br />
# ip link set dev eth0 up<br />
<br />
把该端口添加到网桥中,再将其所有者设置为 {{ic|''bridge_name''}} 就完成了配置:<br />
<br />
# ip link set dev eth0 master ''bridge_name''<br />
<br />
要显示现存的网桥及其关联的端口,可以用 ''bridge'' 工具(它也是 {{Pkg|iproute2}} 的组成部分)。详阅 {{ic|man bridge}}。<br />
<br />
# bridge link show<br />
<br />
若要删除网桥,应首先移除它所关联的所有端口,同时关闭端口的混杂模式并关闭端口以将其恢复至原始状态。<br />
<br />
# ip link set eth0 promisc off<br />
# ip link set eth0 down<br />
# ip link set dev eth0 nomaster<br />
<br />
当网桥的配置清空后就可以将其删除:<br />
<br />
# ip link delete ''bridge_name'' type bridge<br />
<br />
=== 通过 netctl ===<br />
<br />
参阅 [[Bridge with netctl]].<br />
<br />
=== 通过 systemd-networkd ===<br />
<br />
参阅 [[systemd-networkd#Bridge interface]].<br />
<br />
=== 通过 NetworkManager ===<br />
<br />
Gnome's NetworkManager can create bridges, but currently will not auto-connect to them. Open Network Settings, add a new interface of type Bridge, add a new bridged connection, and select the MAC address of the device to attach to the bridge.<br />
<br />
Now, find the UUID of the attached device (by default named "bridge0 slave 1"):<br />
<br />
$ nmcli connection<br />
<br />
Finally, enable that connection:<br />
<br />
$ nmcli con up <UUID><br />
<br />
If NetworkManager's default interface for the device you added to the bridge connects automatically, you may want to disable that by clicking the gear next to it in Network Settings, and unchecking "Connect automatically" under "Identity."<br />
<br />
== 分配 IP 地址 ==<br />
<br />
When the bridge is fully set up, it can be assigned an IP address:<br />
<br />
# ip addr add dev ''bridge_name'' 192.168.66.66/24<br />
<br />
{{Expansion|This section needs to be connected to the link-level part described in [[QEMU#Tap networking with QEMU]]. For now, see the instructions given there.}}<br />
<br />
== 提示与技巧 ==<br />
<br />
=== 网桥使用无线网络端口 ===<br />
<br />
To add a wireless interface to a bridge, you first have to assign the wireless interface to an access point or start an access point with [[Software_access_point|hostapd]]. Otherwise the wireless interface won't be added to the bridge.<br />
<br />
See also [https://wiki.debian.org/BridgeNetworkConnections#Bridging_with_a_wireless_NIC Bridging with a wireless NIC] on Debian wiki.<br />
<br />
== 参阅 ==<br />
<br />
* [http://www.linuxfoundation.org/collaborate/workgroups/networking/bridge Official documentation for bridge-utils]<br />
* [http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2 Official documentation for iproute2]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Network_Time_Protocol_daemon_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409274
Network Time Protocol daemon (简体中文)
2015-11-15T14:40:29Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Networking (简体中文)]]<br />
[[Category:Daemons and system services (简体中文)]]<br />
[[en:Network Time Protocol daemon]]<br />
[[es:Network Time Protocol daemon]]<br />
[[fr:ntp]]<br />
[[it:Network Time Protocol daemon]]<br />
[[ja:Network Time Protocol daemon]]<br />
[[ru:Network Time Protocol daemon]]<br />
{{TranslationStatus (简体中文)|Network_Time_Protocol_daemon|2015-08-19|390018}} <br />
{{translateme (简体中文)}}<br />
[[Wikipedia:Network Time Protocol|Network Time Protocol]] (网络时间协议)是 GNU/Linux 系统通过Internet 时间服务器同步系统[[Time (简体中文)|软件时钟]]的最常见方法。设计时考虑到了各种网络延迟,通过公共网络同步时,误差可以降低到10毫秒以内;通过本地网络同步时,误差可以降低到 1 毫秒。<br />
<br />
[http://support.ntp.org/bin/view/Main/WebHome#The_NTP_Project NTP 项目]提供了一个名为简单 NTP 的参考实现。本文介绍如何设置和运行服务器和客户端 NTP 进程。<br />
<br />
==安装==<br />
[[安装]] {{pkg|ntp}} 软件包。如果不做任何配置, ''ntpd'' 默认工作于客户端模式。如果使用 Arch Linux 默认的配置,请跳转到 [[#使用]]。作为服务器的配置,请参阅 [[#NTP 服务器模式]]。<br />
<br />
==配置==<br />
<br />
主要的后台进程是 ''ntpd'', 可以通过 {{ic|/etc/ntp.conf}} 配置。详细信息可以参考手册 {{ic|man ntp.conf}} 和相关的 {{ic|man <nowiki>{ntpd|ntp_auth|ntp_mon|ntp_acc|ntp_clock|ntp_misc}</nowiki>}}.<br />
<br />
=== 连接到 NTP 服务器 ===<br />
<br />
NTP 服务器通过一个层级系统进行分类,不同的层级称为 ''strata'': 独立的时间源为''stratum 0''; 直接连接到 ''stratum 0'' 的设备为 ''stratum 1'';直接连接到 ''stratum 1'' 的源为 ''stratum 2'',以此类推。<br />
<br />
服务器的 stratum 并不能完全等同于它的精度和可靠度。通常的时间同步都使用 stratum 2 服务器。通过[http://www.pool.ntp.org/ pool.ntp.org] 服务器或[http://support.ntp.org/bin/view/Servers/NTPPoolServers 这个链接] 可以选择比较近的服务器池。<br />
<br />
下面几行仅仅是例子:<br />
{{hc|/etc/ntp.conf|<br />
server 0.fr.pool.ntp.org iburst<br />
server 1.fr.pool.ntp.org iburst<br />
server 2.fr.pool.ntp.org iburst<br />
server 3.fr.pool.ntp.org iburst<br />
}}<br />
<br />
推荐使用{{ic|iburst}}选项,如果第一次尝试无法建立连接,程序会发送一系列的包。{{ic|burst}} 选项则总是发送一系列的包,即使第一次也是这样。如果没有明确的允许的话不要使用 ''burst'' 选项,有可能被封禁。<br />
<br />
===NTP 服务器模式===<br />
如果建立一个 NTP 服务器,你需要添加 [http://www.ntp.org/ntpfaq/NTP-s-refclk.htm#Q-LOCAL-CLOCK ''local clock''] 作为一个服务器,这样,即便它失去网络连接,它也可以继续为网络提供服务;添加 ''local clock'' 作为一个 stratum 10 服务器 (使用 ''fudge'' 命令)这样它就只会在失去连接时使用本地时钟:<br />
<br />
server 127.127.1.0<br />
fudge 127.127.1.0 stratum 10<br />
<br />
下一步,定义规则允许客户端连接你的服务(''localhost'' 也被认为是一个客户端)。使用 ''restrict'' 命令;你应该在文件中已经有一行:<br />
<br />
restrict default nomodify nopeer noquery<br />
<br />
这限制了每个人做任何修改并阻止每个人请求你的时间服务器状态:{{ic|nomodify}} 防止重新配置你的ntpd(使用''ntpq'' 或 ''ntpdc'' ),{{ic|noquery}} 防止从你的nptd(或是''ntpq'' 和 ''ntpdc'')获取状态数据。<br />
<br />
你也能添加其它选项:<br />
<br />
restrict default kod nomodify notrap nopeer noquery<br />
<br />
{{注意|这会允许其他人查询你的时间服务器。你需要添加 {{ic|noserve}} 来停止提供时间。}}<br />
<br />
"restrict"选项的完整文档可以从 {{ic|man ntp_acc}} 中查找到。详见 https://support.ntp.org/bin/view/Support/AccessRestrictions 。<br />
<br />
你需要在这一行之后告诉 ''ntpd'' 什么可以访问你的服务器;如果你不是在配置一台 NTP 服务器的话,下面一行就足够了。<br />
<br />
restrict 127.0.0.1<br />
<br />
如果你想要强制DNS解析到IPv6域名,在IP地址或域名前写上 {{ic|-6}}({{ic|-4}} 则强制使用IPv4域名),例如:<br />
<br />
restrict -6 default kod nomodify notrap nopeer noquery<br />
restrict -6 ::1 # ::1 is the IPv6 equivalent for 127.0.0.1<br />
<br />
最后,指定drift文件(它能时刻监控你的时钟的时间漂移)和log文件的位置:<br />
<br />
driftfile /var/lib/ntp/ntp.drift<br />
logfile /var/log/ntp.log<br />
<br />
一份基础的配置文件是这样的 ('''为了清晰起见,已删掉了所有的注释'''):<br />
<br />
{{hc|/etc/ntp.conf|<br />
server 0.pool.ntp.org iburst<br />
server 1.pool.ntp.org iburst<br />
server 2.pool.ntp.org iburst<br />
server 3.pool.ntp.org iburst<br />
<br />
restrict default kod nomodify notrap nopeer noquery<br />
restrict -6 default kod nomodify notrap nopeer noquery<br />
<br />
restrict 127.0.0.1<br />
restrict -6 ::1 <br />
<br />
driftfile /var/lib/ntp/ntp.drift<br />
logfile /var/log/ntp.log<br />
}}<br />
<br />
{{注意|定义日志文件不是必须的,但是它对于反馈 ''ntpd'' 操作是有好处的。}}<br />
<br />
===其他关于配置 NTP 的资源===<br />
总之,永远不要忘记手册页: {{ic|man ntp.conf}} 有可能可以回答你仍旧有的任何疑问。(见相关的手册页: {{ic|man <nowiki>{ntpd|ntp_auth|ntp_mon|ntp_acc|ntp_clock|ntp_misc}</nowiki>}})。<br />
<br />
==不以守护进程使用==<br />
想要仅仅同步时钟一次,不想启动守护进程的话,运行:<br />
# ntpd -qg<br />
# hwclock -w<br />
<br />
{{ic|ntpd -qg}} 与 {{ic|ntpdate}} 程序效果相同,而ntpdate 已经[http://support.ntp.org/bin/view/Dev/DeprecatingNtpdate 不推荐使用]. {{ic|hwclock -w}} 把时间存储到硬件时钟上,这样重启的时候就不会丢失了。<br />
<br />
{{ic|ntpd}} 的 {{ic|-g}} 选项允许时钟漂移大于警报级别(默认是 15 分钟)而不发出警告。注意这种误差是不正常的,也许意味着失去设置错误,时钟芯片错误,或仅仅是长时间的忽略。如果在这些情况下你不想设置时钟而且输出错误到 syslog,删除 {{ic|-g}}:<br />
# ntpd -q<br />
<br />
===启动时同步一次时钟===<br />
{{警告|这种方法不推荐在服务器上或是需要连续运行2到3天的普通机器上使用,因为系统时钟仅会在启动时更新一次。}}<br />
<br />
写一个 ''oneshot'' [[systemd]] 模块:<br />
{{hc|/etc/systemd/system/ntp-once.service|2=<br />
[Unit]<br />
Description=Network Time Service (once)<br />
After=network.target nss-lookup.target <br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/usr/bin/ntpd -q -g -u ntp:ntp ; /sbin/hwclock -w<br />
<br />
[Install]<br />
WantedBy=multi-user.target}}<br />
<br />
并启动它: {{bc|# systemctl enable ntp-once}}<br />
<br />
==作为守护进程运行==<br />
===启动 ntpd===<br />
启动:<br />
# systemctl start ntpd<br />
<br />
开机启动:<br />
# systemctl enable ntpd<br />
<br />
或者使用:<br />
# timedatectl set-ntp 1<br />
<br />
===NetworkManager===<br />
{{Note|ntpd should still be running when the network is down if the hwclock daemon is disabled, so you should not use this.}}<br />
''ntpd'' can be brought up/down along with a network connection through the use of [[NetworkManager#Network Services with NetworkManager Dispatcher|NetworkManager's dispatcher scripts]]. You can install the needed script from [community]:<br />
<br />
{{bc|# pacman -S networkmanager-dispatcher-ntpd}}<br />
<br />
===Running in a chroot===<br />
{{Note|Before attempting this, complete the previous section on running as non-root, since chroots are relatively useless at securing processes running as root.}}<br />
<br />
Edit {{ic|/etc/conf.d/ntpd.conf}} and change<br />
<br />
NTPD_ARGS="-g -u ntp:ntp"<br />
<br />
to<br />
<br />
NTPD_ARGS="-g -i /var/lib/ntp -u ntp:ntp"<br />
<br />
Then, edit {{ic|/etc/ntp.conf}} to change the driftfile path such that it is relative to the chroot directory, rather than to the real system root. Change:<br />
<br />
driftfile /var/lib/ntp/ntp.drift<br />
<br />
to<br />
<br />
driftfile /ntp.drift<br />
<br />
Create a suitable chroot environment so that getaddrinfo() will work by creating pertinent directories and files (as root):<br />
<br />
{{bc|<nowiki># mkdir /var/lib/ntp/etc /var/lib/ntp/lib /var/lib/ntp/proc<br />
# touch /var/lib/ntp/etc/resolv.conf /var/lib/ntp/etc/services</nowiki>}}<br />
<br />
and by bind-mounting the aformentioned files:<br />
<br />
{{hc|/etc/fstab|<br />
...<br />
#ntpd chroot mounts<br />
/etc/resolv.conf /var/lib/ntp/etc/resolv.conf none bind 0 0<br />
/etc/services /var/lib/ntp/etc/services none bind 0 0<br />
/lib /var/lib/ntp/lib none bind 0 0<br />
/proc /var/lib/ntp/proc none bind 0 0<br />
}}<br />
<br />
{{bc|# mount -a}}<br />
<br />
Finally, restart the daemon again:<br />
<br />
{{bc|# rc.d restart ntpd}}<br />
<br />
It is relatively difficult to be sure that your driftfile configuration is actually working without waiting a while, as ntpd does not read or write it very often. If you get it wrong, it will log an error; if you get it right, it will update the timestamp. If you do not see any errors about it after a full day of running, and the timestamp is updated, you should be confident of success.<br />
<br />
==Alternatives==<br />
Available alternative to NTPd are [[Chrony]], a dial-up friendly and specifically designed for systems that are not online all the time, and [[OpenNTPD]], part of the OpenBSD project and currently not maintained for Linux.<br />
<br />
==参见==<br />
* [[Time (简体中文)]] (更多关于计算机计时的信息)<br />
<br />
==外部链接==<br />
* http://www.ntp.org/<br />
* http://support.ntp.org/<br />
* http://www.pool.ntp.org/<br />
* http://www.eecis.udel.edu/~mills/ntp/html/index.html<br />
* http://www.akadia.com/services/ntp_synchronize.html</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Laptop_Mode_Tools_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409273
Laptop Mode Tools (简体中文)
2015-11-15T14:38:51Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Power management (简体中文)]]<br />
[[de:Laptop Mode Tools]]<br />
[[en:Laptop Mode Tools]]<br />
[[fr:Laptop Mode Tools]]<br />
[[it:Laptop Mode Tools]]<br />
[[ja:Laptop Mode Tools]]<br />
[[ru:Laptop Mode Tools]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|acpid}}<br />
{{Related|systemd}}<br />
{{Related|cpufrequtils}}<br />
{{Related|Laptop}}<br />
{{Related|pm-utils}}<br />
{{Related|Powertop}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Laptop_Mode_Tools|2013-12-25|290267}}<br />
''[http://samwel.tk/laptop_mode/ Laptop Mode Tools] 是一个 Linux 系统下的笔记本电源管理软件。它是让内核开启笔记本电脑模式功能的主要方法,它会让硬盘降速。另外,它允许你通过一个简单的配置文件调整一些其他的节能相关的设置。''<br />
<br />
与 [[acpid]]、 [[CPU frequency scaling|CPU frequency scaling]]、 和 [[pm-utils]] 结合,LMT 提供大多数用户一个完整的笔记本电脑电源管理方案。<br />
<br />
==安装==<br />
{{AUR|laptop-mode-tools}} 可以从 [[AUR]] 中 [[安装]]。<br />
<br />
==配置==<br />
<br />
<br />
配置是通过下列文件来控制的:<br />
<br />
* {{ic|/etc/laptop-mode/laptop-mode.conf}} - 主要配置文件<br />
* {{ic|/etc/laptop-mode/conf.d/*}} - 许多特定功能的模块. <br />
<br />
每个模块都可以通过修改对应的{{ic|conf.d/*}}文件中的{{ic|CONTROL_*}}的值来启用或禁用。<br />
<br />
如果在 {{ic|/etc/laptop-mode/laptop-mode.conf}} 中设置了 {{ic|ENABLE_AUTO_MODULES}},LMT会自动启用那些{{ic|CONTROL_*}}设为{{ic|auto}}的模块。<br />
<br />
下面的命令可以用来列出模块的启用配置(启用、禁用或自动):<br />
<br />
$ grep -r '^\(CONTROL\&#124;ENABLE\)_' /etc/laptop-mode/conf.d<br />
<br />
{{注意|{{ic|auto-hibernate.conf}} 和 {{ic|battery-level-polling.conf}} 例外地采用 {{ic|ENABLE_*}} 变量而不是 {{ic|CONTROL_*}}。}}<br />
<br />
最后启用{{ic|laptop-mode}}服务:<br />
# systemctl enable laptop-mode.service<br />
=== 硬盘 ===<br />
为了使用该功能您需要安装 hdparm 或者 sdparm。 查看 [[Hdparm]].<br />
<br />
通过 {{Ic|hdparm -S}} 命令来降低硬盘转速可以让计算机更省电同时更安静. 即是您正在使用电脑您依然可以使用磁盘预读功能让硬盘经常降低转速。LMT(笔记本电脑工具包)也可以使用{{Ic|hdparm -B}} 命令。硬盘省电级别最高(最省电)为1,最低是254,使用交流电源供电时默认为254,使用电池供电时默认为1。如果你觉得硬盘减速使得一些操作变慢的话,把它设置为一个高一点的值(比如128)是个好主意,这会让它不会太频繁的减速。 {{Ic|hdparm -S}} 和 {{Ic|hdparm -B}} 命令的一些参数设置在 {{ic|/etc/laptop-mode/laptop-mode.conf}}文件中。<br />
<br />
如果 {{ic|CONTROL_MOUNT_OPTIONS}} 选项为 on (默认即为 on), laptop-mode-tools 会自动重新挂载你的分区, 并在挂载选项中增加了 'commit=600,noatime'。这会让磁盘日志程序jbd2每10分钟更新一次磁盘日志,而不是通常情况下的几秒钟更新一次 (注意:使用该设置你可能会丢掉前10分钟的工作成果(当系统意外关闭时)). 同时请确保不要使用 {{Ic|atime}} 的挂载参数, 使用 {{Ic|noatime}} 或 {{Ic|relatime}} 来替代。<br />
<br />
{{注意|1={{ic|CONTROL_MOUNT_OPTIONS}} 的值不应该在nilfs2分区上被设置为 on (原因可查看 https://bbs.archlinux.org/viewtopic.php?id=134656) (也可以查看 http://www.ibm.com/developerworks/cn/linux/l-cn-nilfs2/index.html 对nilfs2文件系统的中文介绍)}}<br />
<br />
==== 固态硬盘 ====<br />
来自 [http://samwel.tk/laptop_mode/faq 官方上游 FAQ]:<br />
<br />
'''问题:'''我电脑里装了一个固态硬盘,那么那些硬盘相关的配置还有效吗? <br />
<br />
'''回答:'''它们有可能有效,原因有两个:1)laptop mode 会减少写次数,从而延长SSD的寿命;2)laptop mode 会让写操作变成突发形式,从而会使一些节电机制(例如ALPM)更好地介入。然而,效果可能会因硬件不同而有差别。有些硬件可能完全没效果,有些则效果显著。<br />
<br />
=== CPU 频率调节 ===<br />
使用该功能你需要安装调节CPU频率的驱动模块。 查看 [[CPU frequency scaling]].<br />
<br />
# cpufreq.conf<br />
# ThinkPad T40/T42/T60 Example<br />
#<br />
CONTROL_CPU_FREQUENCY=1<br />
BATT_CPU_MAXFREQ=fastest<br />
BATT_CPU_MINFREQ=slowest<br />
BATT_CPU_GOVERNOR=ondemand<br />
BATT_CPU_IGNORE_NICE_LOAD=1<br />
LM_AC_CPU_MAXFREQ=fastest<br />
LM_AC_CPU_MINFREQ=slowest<br />
LM_AC_CPU_GOVERNOR=ondemand<br />
LM_AC_CPU_IGNORE_NICE_LOAD=1<br />
NOLM_AC_CPU_MAXFREQ=fastest<br />
NOLM_AC_CPU_MINFREQ=slowest<br />
NOLM_AC_CPU_GOVERNOR=ondemand<br />
NOLM_AC_CPU_IGNORE_NICE_LOAD=0<br />
CONTROL_CPU_THROTTLING=0<br />
<br />
===设备和总线===<br />
====Intel SATA====<br />
* 开启Intel SATA AHCI控制器的ALPM特性使磁盘空闲时让磁盘工作在非常低的功耗模式。<br />
# intel-sata-powermgmt.conf<br />
# ThinkPad T40/T42/T60 Example<br />
#<br />
DEBUG=0<br />
CONTROL_INTEL_SATA_POWER=1<br />
BATT_ACTIVATE_SATA_POWER=1<br />
LM_AC_ACTIVATE_SATA_POWER=1<br />
NOLM_AC_ACTIVATE_SATA_POWER=0<br />
<br />
{{Note|更多详细配置信息请参阅 {{ic|/etc/laptop-mode/conf.d/intel-sata-powermgmt.conf}} 文件。}}<br />
<br />
====USB 自动休眠====<br />
# usb-autosuspend.conf<br />
# ThinkPad T40/T42/T60 Example<br />
#<br />
DEBUG=0<br />
CONTROL_USB_AUTOSUSPEND=1<br />
BATT_SUSPEND_USB=1<br />
LM_AC_SUSPEND_USB=1<br />
NOLM_AC_SUSPEND_USB=0<br />
AUTOSUSPEND_TIMEOUT=2<br />
<br />
{{注意|更多详细配置信息请参阅 {{ic|/etc/laptop-mode/conf.d/usb-autosuspend.conf}} 文件。如果你有一个经常使用的USB设备(比如USB鼠标),把它们禁用可以防止它们自动休眠。}}<br />
<br />
===显示和图形===<br />
====LCD 显示器亮度====<br />
* 可以通过以下命令来查看可用的笔记本电脑屏幕亮度数值:<br />
$ cat /proc/acpi/video/VID/LCD/brightness<br />
<br />
===== ThinkPad T40/T42 =====<br />
对于 [http://en.wikipedia.org/wiki/ThinkPad ThinkPad] T40/T42 笔记本,最小和最大亮度的查看要通过以下命令:<br />
$ cat /sys/class/backlight/acpi_video0/brightness<br />
$ cat /sys/class/backlight/acpi_video0/max_brightness<br />
<br />
# lcd-brightness.conf<br />
# ThinkPad T40/T42 Example<br />
#<br />
DEBUG=0<br />
CONTROL_BRIGHTNESS=1<br />
BATT_BRIGHTNESS_COMMAND="echo 0"<br />
LM_AC_BRIGHTNESS_COMMAND="echo 7"<br />
NOLM_AC_BRIGHTNESS_COMMAND="echo 7"<br />
BRIGHTNESS_OUTPUT="/sys/class/backlight/thinkpad_screen/brightness"<br />
<br />
===== ThinkPad T60 =====<br />
* 对于 [http://en.wikipedia.org/wiki/ThinkPad ThinkPad] T60 笔记本,最小和最大亮度的查看要通过以下命令:<br />
$ cat /sys/class/backlight/thinkpad_screen/max_brightness<br />
$ cat /sys/class/backlight/thinkpad_screen/brightness<br />
<br />
# lcd-brightness.conf<br />
# ThinkPad T60 Example<br />
#<br />
DEBUG=0<br />
CONTROL_BRIGHTNESS=1<br />
BATT_BRIGHTNESS_COMMAND="echo 0"<br />
LM_AC_BRIGHTNESS_COMMAND="echo 7"<br />
NOLM_AC_BRIGHTNESS_COMMAND="echo 7"<br />
BRIGHTNESS_OUTPUT="/sys/class/backlight/acpi_video0/brightness"<br />
<br />
{{注意|更多配置细节请阅读 {{ic|/etc/laptop-mode/conf.d/lcd-brightness.conf}} 文件。}}<br />
<br />
====终端黑屏时间====<br />
<br />
# terminal-blanking.conf<br />
# ThinkPad T40/T42/T60 Example<br />
#<br />
DEBUG=0<br />
CONTROL_TERMINAL=1<br />
TERMINALS="/dev/tty1"<br />
BATT_TERMINAL_BLANK_MINUTES=1<br />
BATT_TERMINAL_POWERDOWN_MINUTES=2<br />
LM_AC_TERMINAL_BLANK_MINUTES=10<br />
LM_AC_TERMINAL_POWERDOWN_MINUTES=10<br />
NOLM_AC_TERMINAL_BLANK_MINUTES=10<br />
NOLM_AC_TERMINAL_POWERDOWN_MINUTES=10<br />
<br />
{{注意|更多配置细节请参阅 {{ic|/etc/laptop-mode/conf.d/terminal-blanking.conf}} 文件。}}<br />
<br />
===网络===<br />
====以太网====<br />
# ethernet.conf<br />
# ThinkPad T40/T42/T60 Example<br />
#<br />
DEBUG=0<br />
CONTROL_ETHERNET=1<br />
LM_AC_THROTTLE_ETHERNET=0<br />
NOLM_AC_THROTTLE_ETHERNET=0<br />
DISABLE_WAKEUP_ON_LAN=1<br />
DISABLE_ETHERNET_ON_BATTERY=1<br />
ETHERNET_DEVICES="eth0"<br />
<br />
====无线局域网====<br />
无线网络设备的电源管理是设备相关的,因此配置时更需要一些技巧。依赖于无线芯片,设置通过下面三个文件中的一个来管理:<br />
#{{ic|/etc/laptop-mode/conf.d/wireless-power.conf}} 用于的电源管理的通用方法 (通过 "iwconfig wlan0 power on/off"). 这个适用于大多数芯片(除了Intel芯片集之外)。<br />
#{{ic|/etc/laptop-mode/conf.d/wireless-ipw-power.conf}} 通过老的ipw驱动来管理 Intel 芯片集。这适用于 IPW3945、IPW2200 和 IPW2100. 现在(到LMT 1.55-1为止)它用 iwpriv 来管理 IPW3945,以及用 iwconfig 结合 iwpriv来管理 IPW2100 和 IPW220。详细信息请参见 {{ic|/usr/share/laptop-mode-tools/modules/wireless-ipw-power}} 文件。(注意,ipw3945模块已经废弃了,见下面)<br />
#{{ic|/etc/laptop-mode/conf.d/wireless-iwl-power.conf}} 用于管理 iwl4965、iwl3945 和 iwlagn 驱动的Intel芯片集(iwlagn 支持 4965, 5100, 5300, 5350, 5150, 1000, 和 6000 芯片集)<br />
<br />
{{注意|三个模块全开通常不会带来问题,因为LMT会自动检测设备对应的模块。}}<br />
<br />
每个配置文件所支持的模块是直接源自LMT的。但是有些已经过时了,因为从Linux内核版本2.6.34开始就不再提供ipw3945和iwl4965模块(3945采用iwl3945,4965采用通用模块iwlagn)。这并不影响LMT的正常工作。<br />
<br />
对于iwlagn驱动的一些芯片集(包括5300或其它),有一个已知的问题。在这些芯片集上,文件 {{ic|/etc/laptop-mode/conf.d/wireless-iwl-power.conf}}中的下列配置:<br />
IWL_AC_POWER<br />
IWL_BATT_POWER<br />
会被忽略,因为文件 {{ic|/sys/class/net/wlan*/device/power_level}} 不存在。于是通用方法(通过 "iwconfig wlan0 power on/off" )会被自动启用。<br />
<br />
===音频设备===<br />
====AC97====<br />
<br />
# ac97-powersave.conf<br />
# ThinkPad T40/T42/T60 Example<br />
#<br />
DEBUG=0<br />
CONTROL_AC97_POWER=1<br />
<br />
====Intel HDA====<br />
<br />
# intel-hda-powersave.conf<br />
# ThinkPad T40/T42/T60 Example<br />
#<br />
DEBUG=0<br />
CONTROL_INTEL_HDA_POWER=1<br />
BATT_INTEL_HDA_POWERSAVE=1<br />
LM_AC_INTEL_HDA_POWERSAVE=1<br />
NOLM_AC_INTEL_HDA_POWERSAVE=0<br />
INTEL_HDA_DEVICE_TIMEOUT=10<br />
INTEL_HDA_DEVICE_CONTROLLER=0<br />
<br />
==提示和技巧==<br />
===Aliases===<br />
===lm-profiler===<br />
===Disabling===<br />
<br />
==疑难问题==<br />
===Laptop-mode-tools 不能收到事件===<br />
对于使用 [[systemd (简体中文)|systemd]] 的系统,开启并使其开机自动加载[[acpid (简体中文)|acpid]] 请运行以下命令:<br />
# systemctl enable acpid<br />
# systemctl start acpid<br />
<br />
如果这样不管用的话,请仔细检查一边 laptop-mode 的配置文件并确定需要开启的服务被设置成 1 了。许多服务,包括cpu频率控制服务 (cpufreq control) 默认设置都是'自动'("auto"),所以可能没有开启。<br />
<br />
===连接电源后Laptop-mode-tools并没有停止===<br />
这可能是因为同时安装有laptop-mode-tools和pm-utils两个软件包,它们互相会冲突,从而导致laptop-mode-tools不能准确的设定自己的状态。<br />
<br />
这可以通过禁用pm-utils中带有重复功能的脚本来解决。问题的主要原因是位于{{ic|/usr/lib/pm-utils/power.d}}中的laptop-mode脚本。可以通过在 {{ic|/etc/pm/power.d}}中添加一个同名的空文件来禁用这个脚本,例如,如果想禁用laptop-mode:<br />
<br />
# touch /etc/pm/power.d/laptop-mode<br />
<br />
{{注意|不要在这个文件上设置可执行标记。}}<br />
<br />
建议浏览一下{{ic|/usr/lib/pm-utils/power.d}}中的所有脚本并把其中提供了与laptop-mode-tools同样功能的脚本全都禁用掉。<br />
<br />
== 相关链接 ==<br />
* [http://samwel.tk/laptop_mode/ Laptop Mode Tools]<br />
* [http://mailman.samwel.tk/pipermail/laptop-mode/ Mailing List Archives]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=ISCSI_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)/LIO_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409272
ISCSI (简体中文)/LIO (简体中文)
2015-11-15T14:38:02Z
<p>Aaron chen: </p>
<hr />
<div>{{DISPLAYTITLE:ISCSI Target (简体中文)}}<br />
[[Category:简体中文]]<br />
[[Category:Storage (简体中文)]]<br />
[[Category:Networking (简体中文)]]<br />
[[en:ISCSI Target]]<br />
{{Related articles start}}<br />
{{Related|iSCSI initiator (简体中文)}}<br />
{{Related|iSCSI Boot}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|ISCSI_Target|2015-06-11|373078}}<br />
<br />
使用 [[Wikipedia:iSCSI|iSCSI]] 可以通过 IP 网络访问磁盘。<br />
<br />
接受来访的实体称为 '''目标(target)''',发起访问的实体称为 '''[[iSCSI Initiator|发起者(initiator)]]'''。有多种设置目标的方式:<br />
* [http://stgt.berlios.de/ SCSI Target Framework (STGT/TGT)] 是 Linux 2.6.38 之前的标准。<br />
* [http://linux-iscsi.org/ LIO target] 是现在的标准。<br />
* [http://iscsitarget.sourceforge.net/ iSCSI Enterprise Target (IET)] 是旧版本的实现,[http://scst.sourceforge.net/ SCSI Target Subsystem (SCST)] 是 IET 的升级版本,曾是 LIO 最终入选内核之前的候选方案之一。<br />
<br />
== 启用 LIO Target ==<br />
LIO target 包含在2.6.38及以后版本的内核中。但从3.1版才开始包含 iSCSI target fabric。<br />
<br />
关键的内核模块是 ''target_core_mod'' 和 ''iscsi_target_mod'',它们应该已内置并自动加载。<br />
<br />
强烈建议使用 LIO 的免费分支版本:{{AUR|targetcli-fb}},{{AUR|python-rtslib-fb}} 和 {{AUR|python-configshell-fb}}。原生包 {{AUR|targetcli}}{{Broken package link|{{aur-mirror|targetcli}}}} 虽也有效,但其使用另外的方法保存配置,该方法使用不再推荐的 ''lio-utils'' 及依赖 ''epydoc''。<br />
<br />
如果使用免费分支版本,则 {{AUR|python-rtslib-fb}} 中包含一个 systemd {{ic|target.service}} 文件。如果直接使用原生的 ''targetcli'' 或 ''lio-utils'',则在 {{AUR|lio-utils}}{{Broken package link|{{aur-mirror|lio-utils}}}} 中包含一个 {{ic|/etc/rc.d/target}}文件。<br />
<br />
用下列命令启动 LIO target:{{bc|# systemctl start target}} <br />
这样会加载必要的模块,挂载 configfs 并加载之前保存的 iscsi target 配置。<br />
<br />
用下列命令可以显示运行中的配置信息(仅免费分支版有效):{{bc|# targetcli status}}<br />
<br />
若要 lio target 随系统引导时启动,可用下列命令:{{bc|# systemctl enable target}}<br />
<br />
可以用 '''targetcli''' 创建全部配置。不推荐直接使用 '''lio utils''' 中的 tcm_* 和 lio_* 。<br />
<br />
=== 使用 targetcli ===<br />
外部使用手册仅对免费分支版有效。[https://github.com/agrover/targetd targetd] 尚未进入 AUR ,这取决于该免费分支。<br />
<br />
用命令行式的配置工具可以自动生成绝大部分的名称和数值,但也支持自定义。<br />
在配置工具中随时可以输入 {{ic|help}} 命令查看当前状态可用的命令。<br />
{{提示|配置工具命令行支持 TAB 键命令补全}}<br />
{{提示|配置工具命令行支持 {{ic|cd}} 命令查看和选择路径}}<br />
<br />
target 启动以后,用下列命令进入配置工具:{{bc|# targetcli}}<br />
在配置工具中,用下列命令启用一个块设备(此例为:{{ic|/dev/disk/by-id/md-name-nas:iscsi}})作为 target:<br />
{{bc|/> cd backstores/block<br>/backstores/block> create md_block0 /dev/disk/by-id/md-name-nas:iscsi}}<br />
{{注意|任何块设备都可以用做 target,包括 RAID 和 LVM 设备。如果用 fileio 替换了 block,也可以将文件用作 target。}}<br />
<br />
然后,用下列命令创建一个“iSCSI 合格名称“(iSCSI Qualified Name,即 iqn)和一个 target 入口组(target portal group,tpg)<br />
{{bc|...> cd /iscsi<br>/iscsi> create}}<br />
{{注意|With appending an iqn of your choice to create you can keep targetcli from automatically creating an iqn}}<br />
<br />
In order to tell LIO that your block device should get used as ''backstore'' for the target you issue<br />
{{注意|别忘了可以用 {{ic|cd}} 命令选择 <iqn>/tpg1 路径}}<br />
{{bc|.../tpg1> cd luns<br>.../tpg1/luns> create /backstores/block/md_block0}}<br />
<br />
接下来需要创建一个''入口(portal)'',以使守护进程监听传入连接:<br />
{{bc|.../luns/lun0> cd ../../portals<br>.../portals> create}}<br />
Targetcli 将会告诉你 LIO 监听传入连接的 IP 地址和端口(默认是 0.0.0.0,即全部地址)。<br />
需要为客户端提供至少一个 IP 地址。端口应当是标准的 3260 。<br />
<br />
为了让客户端/[[iSCSI Initiator|发起者]]能够连接,需要把发起者的 iqn 写入 target 的配置中:<br />
{{bc|...> cd ../../acls<br>.../acls> create iqn.2005-03.org.open-iscsi:SERIAL}}<br />
将上面命令中的 {{ic|iqn.2005-03.org.open-iscsi:SERIAL}} 换成所用的发起者的 iqn ,通常位于 {{ic|/etc/iscsi/initiatorname.iscsi}}。<br />
每个将要接入的发起者都必须如此配置一遍。<br />
Targetcli 将自动把最新创建的 acl 映射到已创建的 lun 。<br />
{{注意|所映射的 lun 及其访问权限为 rw 或是 ro 都是可修改的。在配置工具中用 {{ic|help create}} 命令查阅说明。}}<br />
<br />
所有配置工作完成后的最后一步是保存配置:<br />
...> cd /<br />
/> saveconfig<br />
配置数据将保存在 {{ic|/etc/target/saveconfig.json}} 文件中。<br />
现在就可以安全地启动或停止 {{ic|target.service}} 而不会丢失做好的配置数据了。<br />
{{提示|可以给出一个文件名作为 {{ic|saveconfig}} 命令的参数,也可以用 {{ic|clearconfig}} 命令清除配置}}<br />
<br />
==== 认证 ====<br />
Authentication per CHAP is enabled per default for your targets.<br />
也可以设置口令或禁用认证。<br />
<br />
===== 禁用认证 =====<br />
在配置工具中进入所创建的 target 路径(例如 /iscsi/iqn.../tpg1),输入下列命令:<br />
.../tpg1> set attribute authentication=0<br />
{{警告|这样设置会导致任何获得了任一客户端(发起者)iqn 的人都可以访问 target。因此仅可用于测试或自用。}}<br />
===== 设置证书 =====<br />
在配置工具中进入某个选定 target 的 acl 路径 (例如 /iscsi/iqn.../tpg1/acls/iqn.../) 。下列命令将显示当前的认证证书:<br />
...> get auth<br />
下列命令将以 foo:bar 启用认证:<br />
...> set auth userid=foo<br />
...> set auth password=bar<br />
<br />
=== 使用原生 LIO 工具 ===<br />
You have to install {{AUR|lio-utils}}{{Broken package link|{{aur-mirror|lio-utils}}}} from [[AUR]] and the dependencies (python2).<br />
<br />
=== 提示与技巧 ===<br />
* 使用 {{ic|targetcli sessions}} 命令可以列出当前已打开的会话。这个命令包含在 {{AUR|targetcli-fb}} 软件包中,但没有包含在 ''lio-utils'' 或原生的 ''targetcli'' 中。<br />
<br />
=== 上游文档 ===<br />
* [http://www.linux-iscsi.org/wiki/Targetcli targetcli]<br />
* [http://www.linux-iscsi.org/wiki/Lio-utils_HOWTO LIO utils]<br />
* You can also use {{ic|man targetcli}} when you installed the ''free branch'' version {{AUR|targetcli-fb}}.<br />
<br />
== 使用 SCSI Target Framework (STGT/TGT) ==<br />
You will need the Package {{AUR|tgt}} from [[AUR]].<br />
<br />
See: [[TGT iSCSI Target]]<br />
<br />
== 使用 iSCSI Enterprise Target (IET) ==<br />
You will need {{AUR|iscsitarget-kernel}}{{Broken package link|{{aur-mirror|iscsitarget-kernel}}}} and {{AUR|iscsitarget-usr}}{{Broken package link|{{aur-mirror|iscsitarget-usr}}}} from [[AUR]].<br />
<br />
=== 创建 Target === <br />
Modify /etc/iet/ietd.conf accordingly<br />
<br />
==== 基于硬盘的 Target ====<br />
Target iqn.2010-06.ServerName:desc<br />
Lun 0 Path=/dev/sdX,Type=blockio<br />
<br />
==== 基于文件的 Target ====<br />
Use "dd" to create a file of the required size, this example is 10GB.<br />
<br />
dd if=/dev/zero of=/root/os.img bs=1G count=10<br />
<br />
Target iqn.2010-06.ServerName:desc<br />
Lun 0 Path=/root/os.img,Type=fileio<br />
<br />
=== 启动服务 ===<br />
{{Out of date|Mentions rc.d scripts and rc.conf.}}<br />
rc.d start iscsi-target<br />
<br />
Also you can "iscsi-target" to DAEMONS in /etc/rc.conf so that it starts up during boot.<br />
<br />
== 参阅 ==<br />
* [[iSCSI Boot]] Booting Arch Linux with / on an iSCSI target.<br />
* [[Persistent block device naming (简体中文)]] 给 target 赋予正确的块设备名称</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Fonts_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409271
Fonts (简体中文)
2015-11-15T14:36:57Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Fonts (简体中文)]]<br />
[[Category:Graphics and desktop publishing (简体中文)]]<br />
[[cs:Fonts]]<br />
[[de:Schriftarten]]<br />
[[en:Fonts]]<br />
[[es:Fonts]]<br />
[[it:Fonts]]<br />
[[ja:フォント]]<br />
[[ru:Fonts]]<br />
[[tr:Yazıtipleri]]<br />
[[zh-TW:Fonts]]<br />
{{translateme (简体中文)}}<br />
{{Related articles start (简体中文)}}<br />
{{Related2|Font Configuration (简体中文)|字体设定}}<br />
{{Related2|MS Fonts (简体中文)|微软字体}}<br />
{{Related2|Java Fonts - Sun JRE|Java 环境字体(英文)}}<br />
{{Related2|Infinality|Infinality(英文)}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Fonts|2014-05-24|312432}}<br />
引自 [[Wikipedia:zh:计算机字体|维基百科]]:<br />
:「'''计算机字体'''(computer font),简称'''字体'''(font),是包含有一套字形与字符的电子数据文件。」<br />
<br />
注意,部分字体在许可协议中规定了使用时的法律限制。<br />
<br />
== 字体类型 ==<br />
<br />
现今计算机使用的绝大多数字体,都是属于'''点阵字体'''或者'''轮廓字体'''二者之一。<br />
;点阵字体: 每种字形的每种形式和每种尺寸的图像都由点或者像素组成的矩阵构成。由于位图的原故,点阵字体很难进行缩放,特定的点阵字体只能清晰地显示在相应的字号下。但对于 12-16 px 的小号汉字来说,点阵字体往往比其它类型的字体在屏幕上有更好的显示效果。<br />
;轮廓字体或称矢量字体: 使用贝塞尔曲线、绘图指令和数学公式来描述每种字形,使得字体可以适应各种尺寸。<br />
<br />
=== 常见格式 ===<br />
<br />
* {{ic|bdf}} 与 {{ic|bdf.gz}} – 点阵字体,'''b'''itmap '''d'''istribution '''f'''ormat(位图布局格式)的缩写,后者表示以 gzip 压缩的 {{ic|bdf}}。<br />
* {{ic|pcf}} 与 {{ic|pcf.gz}} – 点阵字体, '''p'''ortable '''c'''ompiled '''f'''ont(可移植编译字体)的缩写,后者表示以 gzip 压缩的 {{ic|pcf}}。<br />
* {{ic|psf}},{{ic|psfu}}与{{ic|psf.gz}},{{ic|psfu.gz}} – 点阵字体,前两者分别是 '''P'''C '''s'''creen '''f'''ont(电脑屏幕字体)与 '''P'''C '''s'''creen '''f'''ont '''U'''nicode(Unicode 电脑屏幕字体)的缩写。两者分别表示用 gzip 压缩的 {{ic|psf}} 与 {{ic|psfu}(不适用于 X.Org)。<br />
* {{ic|pfa}} 与 {{ic|pfb}} – 矢量字体,分别是 '''P'''ostScript '''f'''ont '''A'''SCII 与 '''P'''ostScript '''f'''ont '''b'''inary 的缩写。PostScript 字体内带有打印指令。<br />
* {{ic|ttf}} – outline,'''T'''rue'''T'''ype 字体。作为 PostScript 字体的替代。<br />
* {{ic|otf}} – outline,'''O'''pen'''T'''ype 字体。带有 PostScript 打印指令的 TrueType 字体。<br />
<br />
在多数情况下,TrueType 和 OpenType 的技术差异可以忽略,一些带有 {{ic|ttf}} 扩展的字体实际上是 OpenType 字体。<br />
<br />
=== 其它格式 ===<br />
<br />
排版程序 '''TeX''' 和配套的字体软件 '''Metafont''' 用它们自己的方法渲染字体。部分用于这两个程序的字体的文件后缀有 {{ic|*pk}}, {{ic|*gf}}, {{ic|mf}} 与 {{ic|vf}}。<br />
<br />
'''FontForge''',一个字体编辑程序,可以用自己的格式来储存字体,例如 {{ic|sfd}} (''s''pline ''f''ont ''d''atabase)。<br />
<br />
[http://www.w3.org/TR/SVG/fonts.html SVG] 格式也有自己的字体描述方法。<br />
<br />
== 安装 ==<br />
<br />
你可以使用多种方法安装字体。<br />
<br />
=== Pacman ===<br />
<br />
有效的源中的字体和字体集可以使用 [[Pacman|pacman]] 来安装。 可以使用以下方式查找字体:<br />
$ pacman -Ss font<br />
或者也可以只查找 {{ic|ttf}} 字体:<br />
$ pacman -Ss ttf<br />
<br />
=== 创建字体包 ===<br />
<br />
如果您想用 pacman 来管理你自己的字体,可以创建一个 Arch 软件包。这些包也可以在 [[Arch User Repository (简体中文)|AUR]] 中与社区成员分享。下面是一个创建软件包的基本样例。您还可以参考 [[PKGBUILD (简体中文)|PKGBUILD]] 来获取更多有关创建软件包的资料。<br />
<br />
{{bc|<nowiki><br />
pkgname=ttf-fontname<br />
pkgver=1.0<br />
pkgrel=1<br />
pkgdesc="custom fonts"<br />
arch=(any)<br />
depends=(fontconfig xorg-font-utils)<br />
source=("http://someurl.org/$pkgname.tar.bz2")<br />
install=$pkgname.install<br />
<br />
package() {<br />
install -d "$pkgdir/usr/share/fonts/TTF"<br />
install -m644 "$srcdir/$pkgname/"*.ttf "$pkgdir/usr/share/fonts/TTF/"<br />
}<br />
</nowiki>}}<br />
<br />
PKGBUILD 推断这些字体是 TrueType 字体。需要创建一个安装文件 ({{ic|ttf-fontname.install}}) 以便更新字体缓存:<br />
<br />
{{bc|<nowiki><br />
post_install() {<br />
echo -n "Updating font cache... "<br />
fc-cache >/dev/null -f<br />
mkfontscale /usr/share/fonts/TTF<br />
mkfontdir /usr/share/fonts/TTF<br />
echo done<br />
}<br />
<br />
post_upgrade() {<br />
post_install<br />
}<br />
<br />
post_remove() {<br />
post_install<br />
}<br />
</nowiki>}}<br />
<br />
如果想更方便地从TTFs创建自己的包,可以使用 [[Arch User Repository (简体中文)|AUR]] 中的 {{AUR|makefontpkg}}。<br />
<br />
=== 手动安装字体 ===<br />
<br />
要安装不在源中的字体,推荐的方法请参考[[#创建字体包]]。这样使得 pacman 在以后能够更新或者移除它们。当然字体也可以通过手工方式安装。<br />
<br />
要在系统范围内(对所有用户有效)安装字体,请将文件夹移动到 {{ic|/usr/share/fonts/}} 目录。这些文件需要对每个用户而言都是可读的,使用 [[chmod]] 来设置合理的权限 (比如,文件至少为 {{ic|0444}} ,而目录至少为 {{ic|0555}})。要为单个用户安装字体,请使用 {{ic|~/.local/share/fonts}} ({{ic|~/.fonts/}} 现在已经过时了)。<br />
要让 Xserver 能直接载入字体(而不使用某些'''字体服务'''),就需要将新增字体的目录加入到 FontPath 中。它位于[[Xorg#Configuration|您的 Xorg 设置目录]]中(例如 {{ic|/etc/X11/xorg.conf}} 或 {{ic|/etc/xorg.conf}}) 中。更多详细内容请查阅[[#X.Org 中的字体]]<br />
<br />
然后更新 fontconfig 的字体缓存:<br />
<br />
$ fc-cache -vf<br />
<br />
==== 手动安装:高级模式 ====<br />
<br />
如果您有特殊的字体收集需求,例如使用商业字体、使用不同格式的字体、安装/删除字体相当频繁,或只是希望可以更能够控制访问自己的字体资源,那就相当适合用手动的方式来安装维护字体。采用这种方案会获得很多好处:<br />
<br />
* 避免重复安装不同版本、格式的同一种字体集 (经常容易导致渲染问题)。<br />
* 字体可使用多个非标准的实体来源 (例如额外的硬盘、分区)。<br />
* 避免依赖隐晦又占体积的本地字体来源(例如 TeX Live & {{ic|09-texlive-fonts.conf}},或是 AUR 中的某个字体包);使用这些字体来源时,您可能只需要其中的 5 种字体,却必须连带安装其它 55 种不需要的字体。<br />
* 避免字体渲染问题,在您的 fontconfig 配置文件已被修改成与安装在系统的那份不同的格式。<br />
* 只要观察主字体目录下的内容,就能够确定系统上有哪种格式的字体集可供应用程序使用。您不需要复杂、占用大量资源的字体管理程序;{{Pkg|gtk2fontsel}} 和基本的指令工具 (如 {{Pkg|fontconfig}} 软件包下的 {{ic|fc-query}}) 就可以将这件差事办得又快又好。<br />
* 当您安装或升级单一字体,所有应用程序都可以使用新版本字体,包括 LaTeX 相关软件。<br />
* 有必要的话,可以快速启用 / 停用某个字体集,因为您知道它们在哪个目录下(调试时很好用)。<br />
* 不需担心有任何多余的 {{ic|/etc/fonts/conf.avail/nn-foo.conf}} fontconfig 文件会可能与您的渲染设置起冲突 (特别是当您使用[[Font Configuration (简体中文)#补丁包|自定的字体设置与修补过的函式库]]时)。<br />
* 长远来看,可以省下那些因软件包管理器的失误,解决问题和清除冲突所浪费的宝贵时间。<br />
<br />
实际操作上有几种方式,有必要的话可任由软件包管理员采用。以下所举出的操作方式相当有效率,即使字体数目众多也相当安全。<br />
<br />
* 我们要将字体来源位置 (例如 {{ic|/usr/share/fonts.avail}}:这是我们要存放字体的位置) 和包含字体集软链接的目录 ({{ic|/usr/share/fonts}}) 给分隔开来。<br />
<br />
* 将每个字体集分别放在一个明确命名的子目录下。命名规则必须一致且明确,例如这样:<br />
<br />
{{bc|<nowiki><br />
<ttf|otf|t1>-<字体作者或组织(选用)>-<字体集名称><br />
</nowiki>}}<br />
<br />
字体来源目录的内容会长得像这样:<br />
<br />
{{bc|<nowiki><br />
$ ls /usr/share/fonts.avail<br />
<br />
/usr/share/fonts.avail/otf-heuristica<br />
/usr/share/fonts.avail/ttf-liberation<br />
/usr/share/fonts.avail/ttf-ms-arial<br />
...<br />
</nowiki>}}<br />
<br />
* 我们不会涉及到 TeX Live 的字体目录,以避免 LaTeX 软件发生任何问题。既然我们可以使用多个位置,我们将在 {{ic|/usr/share/fonts}} 创建软链接,让应用程序可以访问特定的字体集:<br />
<br />
{{bc|<nowiki><br />
# cd /usr/share/fonts<br />
# ln -s ../fonts.avail/otf-heuristica .<br />
# ln -s /opt/texlive/texmf-dist/fonts/truetype/public/opensans ttf-texlive-open.sans<br />
</nowiki>}}<br />
<br />
结果如下:<br />
<br />
{{bc|<nowiki><br />
$ ls /usr/share/fonts<br />
<br />
ttf-liberation -> ..fonts.avail/ttf-liberation<br />
ttf-ms-arial -> ..fonts.avail/ttf-ms-arial<br />
otf-heuristica -> ..fonts.avail/otf-heuristica<br />
otf-texlive-tex.gyre -> /opt/texlive/texmf-dist/fonts/opentype/public/tex-gyre<br />
ttf-texlive-open.sans -> /opt/texlive/texmf-dist/fonts/truetype/public/opensans<br />
...<br />
</nowiki>}}<br />
<br />
最后,依照惯例执行:<br />
<br />
{{bc|<nowiki><br />
# fc-cache && mkfontscale && mkfontdir<br />
</nowiki>}}<br />
<br />
[[TeXLive (简体中文)|TeX Live]] Wiki 文章内也有一个类似做法,比较简单,但更适用于单一用户的情形,而非全局设置。<br />
<br />
==== 过老的应用程序 ====<br />
<br />
过老而不支持 fontconfig 的应用程序(例如 GTK+ 1.x 应用,及 {{ic|xfontsel}}),需要在字体目录创建索引:<br />
<br />
$ mkfontscale<br />
$ mkfontdir<br />
<br />
或在一条命令中包含多个目录:<br />
<br />
$ for dir in /font/dir1/ /font/dir2/; do xset +fp $dir; done && xset fp rehash<br />
<br />
或者如果字体被安装在一个不同的子文件夹,比如在 {{ic|/usr/share/fonts}} 下:<br />
<br />
$ for dir in * ; do if [ -d "$dir" ]; then cd "$dir";xset +fp "$PWD" ;mkfontscale; mkfontdir;cd .. ;fi; done && xset fp rehash<br />
<br />
有时候 X server 可能会不能成功加载字体目录,这时你需要重新扫描 {{ic|fonts.dir}} 文件:<br />
<br />
# xset +fp /usr/share/fonts/misc # Inform the X server of new directories<br />
# xset fp rehash # Forces a new rescan<br />
<br />
查询字体是否已经生效,可以使用:<br />
<br />
$ xlsfonts | grep fontname<br />
<br />
{{注意|许多软件包会自动配置 Xorg 安装时需要的字体。若这样,便可跳过此步。}}<br />
<br />
为了让 [[Xorg]] 找到并使用你新安装的字体,你必须把字体路径加入到 {{ic|/etc/X11/xorg.conf}}(另一个 X.Org 配置文件或许也可以)。<br />
<br />
这个例子演示了必须加入到 {{ic|/etc/X11/xorg.conf}} 中的代码片断。请根据你的实际需要添加或删除路径。<br />
# 让 X.Org 知道自定义字体目录<br />
Section "Files"<br />
FontPath "/usr/share/fonts/100dpi"<br />
FontPath "/usr/share/fonts/75dpi"<br />
FontPath "/usr/share/fonts/cantarell"<br />
FontPath "/usr/share/fonts/cyrillic"<br />
FontPath "/usr/share/fonts/encodings"<br />
FontPath "/usr/share/fonts/local"<br />
FontPath "/usr/share/fonts/misc"<br />
FontPath "/usr/share/fonts/truetype"<br />
FontPath "/usr/share/fonts/TTF"<br />
FontPath "/usr/share/fonts/util"<br />
EndSection<br />
<br />
=== Pango 警告 ===<br />
当你的系统中安装了[http://www.pango.org/ Pango],它会从 [http://www.freedesktop.org/wiki/Software/fontconfig fontconfig] 查找字体来源。<br />
<br />
(process:5741): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderFc', script='common'<br />
(process:5741): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderFc', script='latin'<br />
<br />
如果你看到类似的错误,或在应用程序中看到方块而不是文字,这表示你需要添加字体并更新字体缓存。以下示例使用{{Pkg|ttf-liberation}}字体讲解如何解决这个问题。使用 root 权限运行如下命令可以使字体在系统范围内生效。<br />
<br />
# pacman -S ttf-liberation<br />
-- output abbreviated, assumes installation succeeded -- <br />
<br />
# fc-cache -vfs<br />
/usr/share/fonts: caching, new cache contents: 0 fonts, 3 dirs<br />
/usr/share/fonts/TTF: caching, new cache contents: 16 fonts, 0 dirs<br />
/usr/share/fonts/encodings: caching, new cache contents: 0 fonts, 1 dirs<br />
/usr/share/fonts/encodings/large: caching, new cache contents: 0 fonts, 0 dirs<br />
/usr/share/fonts/util: caching, new cache contents: 0 fonts, 0 dirs<br />
/var/cache/fontconfig: cleaning cache directory <br />
fc-cache: succeeded<br />
<br />
你可以这样测试一个正在设置的默认字体:<br />
<br />
# fc-match<br />
LiberationMono-Regular.ttf: "Liberation Mono" "Regular"<br />
<br />
== 终端字体 ==<br />
<br />
{{注意|这部分是关于 [[Wikipedia:Linux console|Linux console]]。如果您想获取其它的更加丰富的关于终端的解决方案 (完备的 Unicode 字体, 现代的图形化配适器,等等。), 请参照 [[fbterm]], [[KMSCON]] 或者类似的项目.}}<br />
<br />
默认情况下, [[Wikipedia:Virtual console|virtual console]] 使用内核的内置字体,其包含 [[Wikipedia:CP437|CP437]] 字体集,<sup>[https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/tty/vt/Makefile#n4]</sup> 但是这个设置可以非常容易改变.<br />
<br />
[[Wikipedia:Linux console|Linux console]] 默认使用 UTF-8 编码, 但是由于使用的是标准的兼容 VGA 的帧缓存, 终端字体限定为 256 或 512 个字形。如果字体超出了256个字形, 那么颜色的数量就会从 16 减少到 8。为了针对给定的 Unicode z值分配正确的可显示符号,一种特殊的翻译映射,通常叫做 ''unimap'',是必须的。 就目前来看大多数终端字体都具有内置的 ''unimap'', 但是历史上它是需要被单独载入的。<br />
<br />
{{Pkg|kbd}} 包提供了改变虚拟终端字体和字体映射的工具。可以使用的字体存储在 {{ic|/usr/share/kbd/consolefonts/}} 目录下, 那些以 ''.psfu'' 或者 ''.psfu.gz'' 结尾的具有一个内嵌的 Unicode 翻译映射。<br />
<br />
键盘映射 (Keymap) 是按键和计算机使用字符的对应关系表,可以在 {{ic|/usr/share/kbd/keymaps/}} 的子目录下找到,详情请查看 [[Keyboard configuration in console]] 。<br />
<br />
{{注意|Replacing the font can cause issues with programs that expect a standard VGA-style font, such as those using line drawing graphics.}}<br />
<br />
=== 预览和测试 ===<br />
<br />
{{提示|这里有一个整理过的预览影像数据库:[http://alexandre.deverteuil.net/pages/consolefonts/ Linux 终端字体截图]。}}<br />
<br />
''showconsolefont'' 指令会以表格形式显示可用字与字符:<br />
<br />
$ showconsolefont<br />
<br />
''setfont'' 工具可以暂时改变字体,让用户可以决定是否要设为永久性设置。只要指定字体名称即可 (这些字体位于 {{ic|/usr/share/kbd/consolefonts/}}),比如:<br />
<br />
$ setfont lat2-16<br />
<br />
如果对新换的字体不满意,可以用以下指令撤消至默认字体 (就算终端显示乱码,这个指令依然可以执行,将指令「盲打」进去即可):<br />
<br />
$ setfont<br />
<br />
{{注意|''setfont'' 只作用于当前正在使用的终端。其它终端无论活跃与否都不受影响。}}<br />
<br />
=== 持久性配置 ===<br />
<br />
{{ic|/etc/vconsole.conf}} 的 {{ic|FONT}} 变量可以用来在启动时设置字体, 对于所有的终端都具有持久性作用。详情请查看 {{ic|man 5 vconsole.conf}} 。<br />
<br />
若要显示 ''Č, ž, đ, š'' 或 ''Ł, ę, ą, ś'' 之类的字符,请使用 {{ic|lat2-16.psfu.gz}} 这个字体:<br />
<br />
{{hc|/etc/vconsole.conf|2=<br />
...<br />
FONT=lat2-16<br />
<br />
}}<br />
<br />
这代表使用 ISO/IEC 8859 字符的第二部分,尺寸设置为 16。您可以使用其它值更改字体尺寸 (如 {{ic|lat2-08}})。您可以在[[wikipedia:ISO/IEC_8859#The_Parts_of_ISO.2FIEC_8859|Wikipedia的这张表]]查询 8859 规范定义的本地。<br />
<br />
若要为早期的用户空间套用指定字体,请在 {{ic|/etc/mkinitcpio.conf}} 使用 {{ic|consolefont}} 勾子。更多信息请参阅 [[Mkinitcpio (简体中文)#钩子(HOOKS)]]。<br />
<br />
如果开机时字体没有任何变化,或只变化一下就恢复原样,则有可能是因为显卡驱动引导时字体被复位,然后终端被切至帧缓冲 (framebuffer)。提早装入图形驱动可以避免这个问题。若要在套用 {{ic|/etc/vconsole.conf}} 之前将帧缓冲准备好,请参阅[[Kernel Mode Setting (简体中文)#KMS 早启动|核心模式设置#提早引导 KMS]]、[https://bbs.archlinux.org/viewtopic.php?id=145765] 或其它方式。<br />
<br />
==字体包==<br />
以下是官方源和 [[Arch User Repository (简体中文)|AUR]] 中提供的安装包列表以供参考。支持 Unicode 的字体都标注上了“Unicode”字样。欲知详情请查看具体项目或维基百科。<br />
<br />
Github用户Ternstor编写了一段python脚本,可以通过在 AUR 和官方源中所有字体的 PNG 图像产生 HTML 文件: [https://github.com/ternstor/distrofonts/blob/master/archfonts.py].<br />
=== 盲文点字 ===<br />
*{{Pkg|ttf-ubraille}} - 包含 Unicode '''盲文点字'''符号的字体。<br />
<br />
=== 非英文使用者 ===<br />
应用程序与浏览器会根据 fontconfig 设置和 Unicode 文字可用的字体来选择其显示字体。用指令 {{ic|<nowiki>fc-list :lang="双字母的语言代码"</nowiki>}} 枚举系统安装了哪些可对应该语言的字体。例如,枚举已经安装的阿拉伯文字体,以及支持阿拉伯字的字体:<br />
{{hc|$ fc-list :lang&#61;ar &#124; cut -d: -f1|2=<br />
<nowiki><br />
/usr/share/fonts/TTF/FreeMono.ttf<br />
/usr/share/fonts/TTF/DejaVuSansCondensed.ttf<br />
/usr/share/fonts/truetype/custom/DroidKufi-Bold.ttf<br />
/usr/share/fonts/TTF/DejaVuSansMono.ttf<br />
/usr/share/fonts/TTF/FreeSerif.ttf<br />
</nowiki><br />
}}<br />
<br />
若要在多国语言的网站(如维基百科、Arch Linux wiki)中正确显示字形,请安装这些软件包:{{Pkg|ttf-freefont}}, {{Pkg|ttf-arphic-uming}}, {{Pkg|ttf-baekmuk}}<br />
<br />
==== 阿拉伯和乌尔都文字 ====<br />
*{{AUR|ttf-qurancomplex-fonts}} - 位于麦地那的 King Fahd Glorious Quran Printing Complex 制作的字体 ''(AUR)''<br />
*{{AUR|ttf-amiri}} - 一个典型的阿拉伯文誊抄体 (Naskh) 字体,一开始由 Amiria Press 采用 ''(AUR)''<br />
*{{AUR|ttf-sil-lateef}} - 来自 SIL 的 Unicode 阿拉伯文字体 ''(AUR)''<br />
*{{AUR|ttf-sil-scheherazade}} - 来自 SIL 的 Unicode 阿拉伯文字体 ''(AUR)''<br />
*{{AUR|ttf-arabeyes-fonts}} - 自由的阿拉伯文字体集合 ''(AUR)''<br />
<br />
==== 波斯文字 ====<br />
*{{AUR|ttf-persian-irfonts}}{{Broken package link|{{aur-mirror|ttf-persian-irfonts}}}} - 伊朗信息与通信技术高级理事会(SCICT)的官方标准波斯字体集 ''(AUR)''<br />
*{{AUR|ttf-persian-borna}}{{Broken package link|{{aur-mirror|ttf-persian-borna}}}} - Borna Rayaneh 波斯 B 字体系列 ''(AUR)''<br />
*{{AUR|ttf-persian-x2}}{{Broken package link|{{aur-mirror|ttf-persian-x2}}}} - X 系列 2 字体是建立在开源可使用的字体基础上并扩展支持波斯语,阿拉伯语,乌尔都语,普什图语,达里语,乌兹别克语,库尔德语,维吾尔语,老土耳其(奥斯曼)和现代土耳其(罗马). ''(AUR)''<br />
*{{AUR|ttf-iran-nastaliq}} - 由伊朗信息高级理事会公布的一款 Unicode 书法字体 ''(AUR)''<br />
<br />
==== 缅甸文字 ====<br />
*{{AUR|ttf-myanmar3}}{{Broken package link|{{aur-mirror|ttf-myanmar3}}}} - 缅甸手写体字体 ''(AUR)''<br />
*{{AUR|ttf-myanmar-fonts}} - 源自myordbok.com的121款字体''(AUR)''<br />
<br />
==== 中日韩越文字 ====<br />
<br />
===== Pan-CJK =====<br />
*{{Pkg|adobe-source-han-sans-otc-fonts}} - '''思源黑体''' 是由 Adobe 与 Google 合资开发的,囊括简体中文、繁体中文、日文、韩文字形和来自 Source Sans 字体家族的拉丁文、希腊文和西里尔文字形的高质量无衬线 OpenType 字体<br />
<br />
===== 中文字 =====<br />
*{{Pkg|adobe-source-han-sans-cn-fonts}} - 思源黑体简体中文部分<br />
*{{Pkg|adobe-source-han-sans-twhk-fonts}}{{Broken package link|replaced by {{Pkg|adobe-source-han-sans-tw-fonts}}}} - 思源黑体繁体中文部分<br />
*{{AUR|ttf-tw}} - (繁体)台湾教育部发行的标准楷书、宋体字体 ''(AUR)''<br />
*{{Pkg|wqy-microhei}} - 文泉驿微米黑:无衬线形式的高质量中日韩越 (CJKV) 轮廓字体,自 Google Droid 字体衍生而来。<br />
*{{Pkg|wqy-zenhei}} - 文泉驿正黑:黑体 (无衬线) 的中文轮廓字体,附带文泉驿点阵宋体 (也支持部分日韩字符)。<br />
*{{Pkg|ttf-arphic-ukai}} - '''楷书''' (带有笔触) Unicode 字体 (推荐启用反锯齿)<br />
*{{Pkg|ttf-arphic-uming}} - '''明体''' (印刷) Unicode 字体<br />
*{{Pkg|opendesktop-fonts}} - '''新宋'''字体,之前为 ttf-fireflysung<br />
*{{Pkg|wqy-bitmapfont}} - 文泉驿点阵宋体 (衬线) 中文字体<br />
*{{Pkg|ttf-hannom}} - 中文、越南文 TrueType 字体<br />
<br />
===== 日文字 =====<br />
*{{Pkg|adobe-source-han-sans-jp-fonts}} - 思源黑体日文部分<br />
*{{Pkg|otf-ipafont}} - 正规的日文哥特体 (无衬线) 与明朝体 (衬线) 字形集;其中一项高质量的开放原始码字形。openSUSE-ja 的缺省字形。<br />
*{{AUR|ttf-vlgothic}} - 日文哥特体字形。Debian/Fedora/Vine Linux 的缺省字体 ''(AUR)''<br />
*{{AUR|ttf-mplus}} - 现代哥特体的日文轮廓字体。包含所有日文平假名/片假名、Basic Latin、Latin-1 Supplement、Latin Extended-A、IPA Extensions。另外还有大部分日文汉字、希腊字母、西里尔字与越南文字,可以 7 磅 (等比例) 或 5 磅 (等宽) 字重显示。 ''(AUR)''<br />
*{{AUR|ttf-ipa-mona}}{{Broken package link|{{aur-mirror|ttf-ipa-mona}}}}, {{AUR|ttf-monapo}} - 日文字体,可正确显示 [[wikipedia:2channel_Shift_JIS_art|2ch 的 Shift JIS 艺术创作]]。 ''(AUR)''<br />
*{{Pkg|ttf-sazanami}} - 自由的日文 TrueType 字体。已经过期无人维护,但在某些环境下可当作备案字体使用。<br />
*{{Pkg|ttf-hanazono}} - 一款免费的日文汉字字体,Mincho (serif)风格。<br />
<br />
===== 韩文字 =====<br />
*{{Pkg|adobe-source-han-sans-kr-fonts}} - 思源黑体韩文部分<br />
*{{Pkg|ttf-baekmuk}} - 韩文 TrueType 字体集合<br />
*{{AUR|ttf-alee}}{{Broken package link|{{aur-mirror|ttf-alee}}}} - 自由的韩文 (谚文;Hangul) TrueType 字体 (''AUR'')<br />
*{{AUR|ttf-unfonts-core}}{{Broken package link|{{aur-mirror|ttf-unfonts-core}}}} - Un 字体 (缺省的 Baekmuk 字体较让人不满意) (''AUR'')<br />
*{{AUR|ttf-nanum}} - 共享体 (Nanum) 系列 TrueType 字体 (''AUR'')<br />
*{{AUR|ttf-nanumgothic_coding}} - 共享体 (Nanum) 系列 TrueType 等宽字体 (''AUR'')<br />
<br />
==== 西里尔文字 ====<br />
另请参阅[[#等宽字体]]、[[#无衬线字体]]和[[#衬线字体]]<br />
*{{AUR|ttf-paratype}} - ParaType类别的字体: sans, serif, mono, 扩展的西里尔和拉丁文字, OFL 认证 (''AUR'')<br />
*{{AUR|font-arhangai}}{{Broken package link|{{aur-mirror|font-arhangai}}}} - 蒙古文西里尔字 (''AUR'')<br />
*{{AUR|ttf-pingwi-typography}}{{Broken package link|{{aur-mirror|ttf-pingwi-typography}}}} - PingWi Typography (PWT) 字体 (''AUR'')<br />
<br />
==== 希腊文字 ====<br />
几乎所有 Unicode 字体都包含希腊代码集 (也包含多调变音符号)。某些额外的字体软件包未包含完整的 Unicode 集,但拥有高质量的希腊字字形 (当然包含拉丁字):<br />
*{{AUR|otf-gfs}} - 由 Greek Font Society 选用的 OpenType 字体 ''(AUR)''<br />
*{{AUR|ttf-mgopen}} - 来自 Magenta 的专业 TrueType 字体 ''(AUR)''<br />
<br />
==== 希伯来文字 ====<br />
*{{AUR|culmus}} - 自由的希伯来文字体集合 ''(AUR)''<br />
<br />
==== 印地文字 ====<br />
*{{Pkg|ttf-freebanglafont}} - 孟加拉文字体<br />
*{{Pkg|ttf-indic-otf}} - 印地文 OpenType 字体集合 (包含 ttf-freebanglafont)<br />
:(This one contains a "look of disapproval" that might be more to your liking than the {{Pkg|bdf-unifont}} one mentioned elsewhere in this document)<br />
* {{AUR|lohit-fonts}} - 来自 Fedora 专案的印地文 TrueType 字体 (包含 Oriya 字体以及更多) ''(AUR)''<br />
* {{AUR|ttf-devanagarifonts}} - 梵文TrueType字体(包含 283 种字体) ''(AUR)''<br />
* {{AUR|ttf-gujrati-fonts}} - TTF 古吉拉特 fonts (Avantika,Gopika,Shree768) ''(AUR)'' <br />
* {{AUR|ttf-gurmukhi-fonts_sikhnet}} - TrueType Gurmukhi fonts (gurbaniwebthick,prabhki) ''(AUR)''<br />
* {{AUR|ttf-gurmukhi_punjabi}} - TTF Gurmukhi / Punjabi (contains 252 fonts) ''(AUR)''<br />
* {{AUR|ttf-kannada-font}} - Kannada, the language of Karnataka state in India ''(AUR)''<br />
* {{AUR|ttf-tamil}} - Tamil Unicode fonts (''AUR'')<br />
<br />
==== 高棉文字 ====<br />
*{{Pkg|ttf-khmer}} - 涵盖高棉语 (Khmer) 文字的字体<br />
*[https://www.google.com/fonts/specimen/Hanuman Hanuman] ({{AUR|ttf-google-fonts-hg}}{{Broken package link|{{aur-mirror|ttf-google-fonts-hg}}}} or {{AUR|ttf-google-fonts-git}})<br />
<br />
==== 僧伽罗文字 ====<br />
*{{AUR|ttf-lklug}} - 僧伽罗文 (Sinhala) Unicode 字体 (''AUR'')<br />
<br />
==== 塔米尔文字 ====<br />
*{{AUR|ttf-tamil}} - 塔米尔文 (Tamil) Unicode 字体 (''AUR'')<br />
<br />
==== 藏文字 ====<br />
*{{Pkg|ttf-tibetan-machine}} - 藏文 (Tibetan) Machine TTFont<br />
<br />
=== 数学字体 ===<br />
*{{Pkg|font-mathematica}} - Wolfram 公司的 Mathematica 字体<br />
*{{AUR|ttf-mathtype}} - MathType 字体 ''(AUR)''<br />
*{{AUR|ttf-computer-modern-fonts}} - ''(AUR)''<br />
<br />
=== Microsoft 字体 ===<br />
参阅[[Microsoft Fonts (简体中文)|微软字体]]。<br />
<br />
=== Apple OS X 字体 ===<br />
<br />
* {{AUR|ttf-mac-fonts}} - Mac OS X TrueType 字体<br />
* {{AUR|ttf-mac}}{{Broken package link|{{aur-mirror|ttf-mac}}}} - Mac OS X TrueType 字体。这个软件包没有内含 ttf 字体 (只有 otf 字体),用户必须自备这些字体。<br />
<br />
=== 等宽字体 ===<br />
建议:每位用户偏爱的字体不尽不同,如想找到您心目中的理想字体,还请多加尝试。 <br />
如果您没有太多时间,可以阅读 Dan Benjamin 博客的文章:[http://hivelogic.com/articles/top-10-programming-fonts 十大最适合编程的字体](英文)。<br />
<br />
这里内还有 Trevor Lowing 整理的一长串字体清单:http://www.lowing.org/fonts/ (英文)。<br />
<br />
Slant 上的字体图片比较: [http://www.slant.co/topics/67/~what-are-the-best-programming-fonts 最好的编程字体是什么?](英文)<br />
<br />
还有 Stack Overflow 上的带一些图片的回答: [http://stackoverflow.com/questions/4689/recommended-fonts-for-programming 推荐编程字体](英文)。<br />
<br />
==== TrueType 字体 ====<br />
* Agave ({{AUR|ttf-agave}}{{Broken package link|{{aur-mirror|ttf-agave}}}})<br />
* [[Wikipedia:zh:Andalé Mono|Andalé Mono]] ({{AUR|ttf-ms-fonts}})<br />
* Anka/Coder ({{AUR|ttf-anka-coder}}{{Broken package link|{{aur-mirror|ttf-anka-coder}}}})<br />
* [http://www.marksimonson.com/fonts/view/anonymous-pro Anonymous Pro] ({{Pkg|ttf-anonymous-pro}},也包含在 {{AUR|ttf-google-fonts-hg}}{{Broken package link|{{aur-mirror|ttf-google-fonts-hg}}}} 和 {{AUR|ttf-google-fonts-git}})<br />
* [[Wikipedia:zh:Bitstream Vera|Bitstream Vera Mono]] ({{Pkg|ttf-bitstream-vera}})<br />
* [[Wikipedia:zh:Consolas|Consolas]] ({{AUR|ttf-vista-fonts}}) - Windows 下的编程用字体<br />
* [[Wikipedia:zh:Courier|Courier New]] ({{AUR|ttf-ms-fonts}})<br />
* Cousine ({{AUR|ttf-chromeos-fonts}} 或 {{AUR|ttf-google-fonts-hg}}{{Broken package link|{{aur-mirror|ttf-google-fonts-hg}}}} 或 {{AUR|ttf-google-fonts-git}}) - Chrome/Chromium OS 的 Courier New 替换 (metric-compatible)<br />
* [[Wikipedia:zh:DejaVu字体|DejaVu Sans Mono]] ({{Pkg|ttf-dejavu}}) - Unicode<br />
* [[Wikipedia:zh:Droid|Droid Sans Mono]] ({{Pkg|ttf-droid}},也包含在 {{AUR|ttf-google-fonts-hg}}{{Broken package link|{{aur-mirror|ttf-google-fonts-hg}}}} 和 {{AUR|ttf-google-fonts-git}})<br />
* Envy Code R ({{AUR|ttf-envy-code-r}})<br />
* Fantasque Sans Mono ({{AUR|ttf-fantasque-sans}} 或 {{AUR|ttf-fantasque-sans-git}})<br />
* [[Wikipedia:GNU FreeFont|FreeMono]] ({{Pkg|ttf-freefont}}) - Unicode<br />
* [[Wikipedia:Inconsolata|Inconsolata]] ({{Pkg|ttf-inconsolata}}) - 极佳的编程用字体<br />
* [[Wikipedia:Inconsolata|Inconsolata-g]] ({{AUR|ttf-inconsolata-g}}) - 加入一些亲近编程人员的调整<br />
* [[Wikipedia:Liberation fonts|Liberation Mono]] ({{Pkg|ttf-liberation}}) - 取代 Courier New,基于Cousine (metric-compatible)。<br />
* [[Wikipedia:Lucida Typewriter|Lucida Typewriter]] (包含于 {{AUR|jre}} 软件包)<br />
* [[Wikipedia:zh:Monaco|Monaco]] ({{AUR|ttf-monaco}}) - OSX/Textmate 下知名的编程用字体<br />
* Monofur ({{AUR|ttf-monofur}}) <br />
* [[Wikipedia:Source_Code_Pro|Source Code Pro]] ({{pkg|adobe-source-code-pro-fonts}})<br />
<br />
==== 点阵字体 ====<br />
*Default 8x16<br />
*Dina ({{Pkg|dina-font}})<br />
*[http://font.gohu.org/ Gohu] ({{AUR|gohufont}})<br />
*Lime ({{Pkg|artwiz-fonts}})<br />
*[[Wikipedia:ProFont|ProFont]] ({{Pkg|profont}})<br />
*[[Wikipedia:Proggy Programming Fonts|Proggy Programming Fonts]] ({{AUR|proggyfonts}}{{Broken package link|{{aur-mirror|proggyfonts}}}})<br />
*Proggy opti cyrillic ({{AUR|proggyopticyr-font}}{{Broken package link|{{aur-mirror|proggyopticyr-font}}}})<br />
*Tamsyn ({{Pkg|tamsyn-font}})<br />
*[http://terminus-font.sourceforge.net/ Terminus] ({{Pkg|terminus-font}})<br />
*Unifont (glyphs like (look of disapproval)) ({{Pkg|bdf-unifont}})<br />
<br />
=== 无衬线字体 ===<br />
<br />
*[http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=andika Andika] ({{AUR|ttf-andika}},包含于 {{AUR|ttf-sil-fonts}}{{Broken package link|{{aur-mirror|ttf-sil-fonts}}}})<br />
*[[Wikipedia:zh:Arial|Arial]] ({{AUR|ttf-ms-fonts}})<br />
*[[Wikipedia:zh:Arial|Arial Black]] ({{AUR|ttf-ms-fonts}})<br />
*Arimo ({{AUR|ttf-chromeos-fonts}} 或 {{AUR|ttf-google-fonts-hg}}{{Broken package link|{{aur-mirror|ttf-google-fonts-hg}}}} 或 {{AUR|ttf-google-fonts-git}}) - Chrome/Chromium OS 的 Arial 替换 (metric-compatible)<br />
*[[Wikipedia:zh:Calibri|Calibri]] ({{AUR|ttf-vista-fonts}})<br />
*[[Wikipedia:zh:Candara|Candara]] ({{AUR|ttf-vista-fonts}})<br />
*[[Wikipedia:Constantia (typeface)|Constantia]] ({{AUR|ttf-vista-fonts}})<br />
*[[Wikipedia:Corbel (typeface)|Corbel]] ({{AUR|ttf-vista-fonts}})<br />
*[[Wikipedia:zh:DejaVu字体|DejaVu Sans]] ({{Pkg|ttf-dejavu}}) - Unicode<br />
*[[Wikipedia:zh:Droid|Droid Sans]] ({{Pkg|ttf-droid}},包含于 {{AUR|ttf-google-fonts-hg}}{{Broken package link|{{aur-mirror|ttf-google-fonts-hg}}}} 和 {{AUR|ttf-google-fonts-git}})<br />
*[[Wikipedia:GNU FreeFont|FreeSans]] ({{Pkg|ttf-freefont}}) - Unicode<br />
*[[Wikipedia:Impact (typeface)|Impact]] ({{AUR|ttf-ms-fonts}})<br />
*[[Wikipedia:Liberation fonts|Liberation Sans]] ({{Pkg|ttf-liberation}},取代 Arial, 基于 Arimo (metric-compatible)<br />
*[[Wikipedia:Linux Libertine|Linux Biolinum]] ({{Pkg|ttf-linux-libertine}})<br />
*[[Wikipedia:Lucida Sans|Lucida Sans]] ({{AUR|ttf-ms-fonts}})<br />
*[[Wikipedia:Microsoft Sans Serif|Microsoft Sans Serif]] ({{AUR|ttf-ms-fonts}})<br />
*[[Wikipedia:PT Sans|PT Sans]] ({{AUR|ttf-google-fonts-hg}}{{Broken package link|{{aur-mirror|ttf-google-fonts-hg}}}} 或 {{AUR|ttf-google-fonts-git}}) - 3 种主要变体:正常、变窄与标题 - Unicode:拉丁字、西里尔字<br />
*[[Wikipedia:Source Sans Pro|Source Sans Pro]] ({{pkg|adobe-source-sans-pro-fonts}})<br />
*[[Wikipedia:zh:Tahoma (typeface)|Tahoma]] ({{AUR|ttf-tahoma}})<br />
*[[Wikipedia:Trebuchet MS|Trebuchet]] ({{AUR|ttf-ms-fonts}})<br />
*[[Wikipedia:Ubuntu-Title|Ubuntu-Title]] ({{AUR|ttf-ubuntu-title}}{{Broken package link|{{aur-mirror|ttf-ubuntu-title}}}})<br />
*[[Wikipedia:Ubuntu Font Family|Ubuntu Font Family]] ({{Pkg|ttf-ubuntu-font-family}})<br />
*[[Wikipedia:zh:Verdana|Verdana]] ({{AUR|ttf-ms-fonts}})<br />
<br />
=== 手写体 ===<br />
<br />
*[[Wikipedia:zh:Comic Sans|Comic Sans]] ({{AUR|ttf-ms-fonts}})<br />
<br />
=== 衬线字体 ===<br />
*[[Wikipedia:Cambria (typeface)|Cambria]] ({{AUR|ttf-vista-fonts}})<br />
*[[Wikipedia:Charis SIL|Charis]] ({{AUR|ttf-charis}}{{Broken package link|{{aur-mirror|ttf-charis}}}},包含于 {{AUR|ttf-sil-fonts}}{{Broken package link|{{aur-mirror|ttf-sil-fonts}}}}) - Unicode:拉丁字、西里尔字<br />
*[[Wikipedia:zh:DejaVu字体|DejaVu Serif]] ({{Pkg|ttf-dejavu}}) - Unicode<br />
*[[Wikipedia:Doulos SIL|Doulos]] ({{AUR|doulos-sil}}{{Broken package link|{{aur-mirror|doulos-sil}}}},包含于 {{AUR|ttf-sil-fonts}}{{Broken package link|{{aur-mirror|ttf-sil-fonts}}}}) - Unicode:拉丁字、西里尔字<br />
*[[Wikipedia:zh:Droid|Droid Serif]] ({{Pkg|ttf-droid}},包含于 {{AUR|ttf-google-fonts-hg}}{{Broken package link|{{aur-mirror|ttf-google-fonts-hg}}}} 和 {{AUR|ttf-google-fonts-git}})<br />
*[[Wikipedia:GNU FreeFont|FreeSerif]] ({{Pkg|ttf-freefont}}) - Unicode<br />
*[[Wikipedia:Gentium|Gentium]] ({{Pkg|ttf-gentium}},包含于 {{AUR|ttf-sil-fonts}}{{Broken package link|{{aur-mirror|ttf-sil-fonts}}}}) - Unicode:拉丁字、希腊字、西里尔字、音标字母<br />
*[[Wikipedia:zh:Georgia (字型)|Georgia]] ({{AUR|ttf-ms-fonts}})<br />
*[[Wikipedia:Liberation fonts|Liberation Serif]] ({{Pkg|ttf-liberation}}) - 取代 Times New Roman,基于Tinos (metric-compatible)<br />
*[[Wikipedia:Linux Libertine|Linux Libertine]] ({{Pkg|ttf-linux-libertine}}) - Unicode:拉丁字、希腊字、西里尔字、希伯来字<br />
*[[Wikipedia:zh:Times New Roman|Times New Roman]] ({{AUR|ttf-ms-fonts}})<br />
*Tinos ({{AUR|ttf-chromeos-fonts}} 或 {{AUR|ttf-google-fonts-hg}}{{Broken package link|{{aur-mirror|ttf-google-fonts-hg}}}} 或 {{AUR|ttf-google-fonts-git}}) - Chrome/Chromium OS 的 Times New Roman 替换 (metric-compatible)<br />
<br />
=== 未分类字体 ===<br />
<!--这里的内容应该被分类放入衬线字体,无衬线字体和等宽字体小节内--><br />
*{{AUR|ttf-google-fonts-git}} 与 {{AUR|ttf-google-fonts-hg}}{{Broken package link|{{aur-mirror|ttf-google-fonts-hg}}}} — 一个免费字体的大合集(囊括里 ubuntu、inconsolata、droid 等字体)-注意:如果安装这个包,您的系统内将添加 100 多个字体,这将会使您的字体对话框变得很长。{{AUR|ttf-google-fonts-hg}}{{Broken package link|{{aur-mirror|ttf-google-fonts-hg}}}} 会从上游网络字体项目中拖下整个 Mercurial 库。{{AUR|ttf-google-fonts-git}}则会从 Git 中拖下一个更小,更精简的非官方库。''(AUR)''<br />
*{{Pkg|ttf-mph-2b-damase}} — Covers full plane 1 and several scripts<br />
*{{Pkg|ttf-symbola}} — 提供了绘文字及其它一些符号。<br />
*{{AUR|ttf-sil-fonts}}{{Broken package link|{{aur-mirror|ttf-sil-fonts}}}} — STL 内的 Gentium, Charis, Doulos, Andika and Abyssinica ''(AUR)''<br />
*{{Pkg|font-bh-ttf}} — X.Org Luxi 字体<br />
*{{Pkg|ttf-cheapskate}} — 从 ''dustismo.com'' 收集来的字体库<br />
*{{AUR|ttf-isabella}}{{Broken package link|{{aur-mirror|ttf-isabella}}}} — 一款书法字体,基于 1497 年的 ''Isabella Breviary''<br />
*{{Pkg|ttf-junicode}} — Junius 字体,几乎包括了所有中世纪的拉丁文字形<br />
*arkpandorafonts {{AUR|ttf-arkpandora}}{{Broken package link|{{aur-mirror|ttf-arkpandora}}}} — Arial 与 Times New Roman 字体的一个替代字体 ''(AUR)''<br />
*{{Pkg|xorg-fonts-type1}} — IBM Courier 和 Adobe Utopia 的 [[Wikipedia:PostScript fonts|PostScript 字体]]<br />
<br />
== X11中的字体回滚顺序 ==<br />
Fontconfig 会自动选择一个符合当前场景的字体。也就是说,如果有人正在浏览一个既有英文又有中文的窗口,而默认的字体不支持中文,它会自动切换到另一种字体以便显示中文。<br />
<br />
Fontconfig 让每个用户能够通过{{ic|$XDG_CONFIG_HOME/fontconfig/fonts.conf}}来调整字体被使用的顺序。<br />
如果你想要在最喜欢的Serif字体之后使用某个特定的中文字体,你的配置文件看起来会是这样:<br />
<?xml version="1.0"?><br />
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"><br />
<fontconfig><br />
<alias><br />
<family>serif</family><br />
<prefer><br />
<family>你喜欢的拉丁衬线字体名称</family><br />
<family>你的中文衬线字体名称</family><br />
</prefer><br />
</alias><br />
</fontconfig><br />
<br />
当然你也可以为 Sans-serif和 monospace 字体像上面一样添加一段。更多信息请参考 fontconfig 说明。<br />
<br />
== 字体别名 ==<br />
在 Linux 系统中有几种字体别名,它们实际代表着别的字体,这样以达到让应用程序的字体看起来类似。最常见的别名有:{{ic|serif}} 代表一种衬线体(关于衬线体与非衬线体概念请参考[http://hanyu.iciba.com/wiki/2198016.shtml 这里]——译注)(例如 DejaVu Serif、宋体);{{ic|sans-serif}}代表一种非衬线体(例如 DejaVu Sans、黑体);而{{ic|monospace}} 则代表等宽字体(例如 DejaVu Sans Mono)。 然而,这些别名所代表的字体有可能会变化,而且通常 KDE 和其他桌面环境中的字体管理工具不会显示其内在联系。<br />
<br />
如果想通过别名反向查找是哪种字体被展现出来,运行:<br />
$ fc-match monospace<br />
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"<br />
<br />
在这种情况下 Monospace 别名展现的是 DejaVuSansMono.ttf 字体。<br />
<br />
== 小提示 ==<br />
<br />
=== 列出已安装字体 ===<br />
你可以使用以下命令来列出当前系统中所有已安装字体的字体:<br />
<br />
$ fc-list<br />
<br />
=== 应用程序专用的字体高速缓冲 ===<br />
<br />
Matplotlib ({{pkg|python-matplotlib}} 或 {{pkg|python2-matplotlib}}) 使用自己的字体高速缓冲,因此更新字体后记得删除 {{ic|$HOME/.matplotlib/fontList.cache}},{{ic|$HOME/.cache/matplotlib/fontList.cache}}, {{ic|$HOME/.sage/matplotlib-1.2.1/fontList.cache}} 等文件。这样它才会再一次产生高速缓冲并找到新字体 [http://matplotlib.1069221.n5.nabble.com/getting-matplotlib-to-recognize-a-new-font-td40500.html]。</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Downgrading_packages_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409270
Downgrading packages (简体中文)
2015-11-15T14:33:27Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Package management (简体中文)]]<br />
[[cs:Downgrading packages]]<br />
[[de:Ältere Paketversion installieren (Downgrade)]]<br />
[[en:Downgrading packages]]<br />
[[es:Downgrading packages]]<br />
[[fa:دانگرید]]<br />
[[fr:Downgrade]]<br />
[[it:Downgrading packages]]<br />
[[ja:パッケージのダウングレード]]<br />
[[ru:Downgrading packages]]<br />
[[sk:Downgrading packages]]<br />
[[tr:Paket sürümünü düşürmek]]<br />
[[uk:Downgrading packages]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Arch Build System (简体中文)}}<br />
{{Related|pacman (简体中文)}}<br />
{{Related|Arch Rollback Machine}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Downgrading_Packages|2012-09-19|221655}}<br />
本文将会向你展示如何把一个包降级到以前的版本。通常,并不推荐降级包,只有在现有包存在Bug的情况下才推荐降级。<br />
<br />
在降级之前,好好考虑下你为什么要降级。如果是因为现有包有Bug,请花上几分钟帮忙把它报告给Arch的Bug追踪系统或软件包的项目地址。我们和上游的开发者们都会很感激报告Bug的用户。因为Bug 报告中的任何额外信息都有可能节省大量的测试时间,帮助我们发行更加稳定的软件。<br />
<br />
== 原因 ==<br />
<br />
降级一个软件包实质就是卸载当前版本的软件包再安装旧版本的软件包。这个”旧版本“可以是当前版本之前的任何一个版本。<br />
<br />
降级的原因包括:当前软件包有Bug,当前软件包未包含你需要的功能,实验性的目的。不管哪种情况,用户都认为:降级软件包是解决目前包出现问题的一个有效办法。<br />
<br />
降级一个包有时意味着其它包也要跟着它一起降级。对于那些装了一堆实验性或测试性软件包的用户,我们推荐直接重装整个系统而不是一个个降级软件包。<br />
<br />
== 细节 ==<br />
但是,用户必须注意以下几点:<br />
* 注意每个包的依赖性。每个版本的包所需要的库往往是不同的,相关文件的功能跟以前的版本可能完全是不一样的。所以在降级的时候,你也要同时将那些库更改到相应的版本。 <br />
* 注意是否在降级过程中一些必须的文件会被删除。Arch Linux的滚动发行策略使得它不会在软件仓库中保存任何旧软件。下面会详述这个问题。<br />
* 注意在降级过程中对配置文件或脚本做出的更改。在目前,我们会依赖pacman来帮我们处理这个问题。<br />
<br />
Arch回溯机概念正在开发中,等待与pacman的融合。一旦开发融合完成,上面提到的细节问题将会自动完成,不需要你来操心。<br />
<br />
== 如何降级软件包 ==<br />
* 问: 当我运行 {{ic|pacman -Syu}} 将软件包从版本甲升级到版本乙之后,发现这个软件包导致系统出现了一些问题,我该怎样将该软件包重新降级到版本甲呢?<br />
* 答: 如果该包不是很重要的话,你可以降级的。先查看你系统的{{ic|/var/cache/pacman/pkg}}目录,看看旧版本的软件包是不是还保存在那儿 (如果你最近没有执行 {{ic|pacman -Scc}}以清空包缓存的话,应该在那儿)。 如果在,你可以执行{{ic|pacman -U pkgname-olderpkgver.pkg.tar.gz}}来安装旧版本。如果pacman提示文件冲突的话,你可以通过加上{{ic|-f}}参数以强制执行,即 {{ic|pacman -U --force pkgname-olderpkgver.pkg.tar.gz}}。<br />
<br />
这个过程会移除现有的包,仔细的计算所有依赖的改变,然后安装你选择的旧版本的软件包以及合适的依赖。<br />
<br />
{{注意|如果你改变了操作系统的一个基本的组件包,你也许需要降级许多包。这些软件包可能在过程中被删除,需要手动一点一点的安装回来;同时,后续升级时要小心,不要重新安装不想要的软件包版本。}}<br />
<br />
在 [[AUR]] 中有一个包叫做{{AUR|downgrade}}。它是一个简单的 Bash 脚本,它会从你的缓存中寻找旧版本的包,如果没有的话它会搜索 [[#ARM|A.R.M.]]。你可以选择一个旧包来安装。它基本上自动化了上面所述的过程。查看 {{Ic|downgrade --help}} 获取使用方法的信息。<br />
<br />
另一个更强大的工具是{{AUR|downgrader}},它可以处理 pacman 的 log,能从 ARM、本地缓存降级,并且可以处理包列表 (如果在升级一些包后不稳定,而你不确定包的名字)<br />
<br />
== 如何找到旧版本 ==<br />
目前有三种方法<br />
<br />
=== 过期源 ===<br />
如果系统上找不到旧版本,请检查未即时同步的源,从里面下载软件包。软件源同步状态可以从[https://www.archlinux.org/mirrors/status/ 这里]获得。<br />
<br />
=== ARM ===<br />
[http://ala.seblu.net/ Arch Rollback Machine] (ARM) 里包含2009年9月1日以来所有仓库的归档。目前(2009年11月21日),这个网站还不稳定,根据以前的报道,丢失了2008年10月1日到目前的一些数据。<br />
<br />
如果你对ARM感兴趣的话,最好是到它的宣传论坛了解一下相关信息,这样可以了解它的最新进度。它的宣传论坛在这里:[https://bbs.archlinux.org/viewtopic.php?id=53665].<br />
<br />
据说,ARM想达到这样一个目的:使得使用wget+pacman可以方便的将你的系统回溯到某个时间点。但他们还没有给出这个自动化过程的具体解释。<br />
<br />
=== 手动编译 ===<br />
最糟糕的情况,如果这些地方都没有找到,那你就需要自己动手编译旧版本的软件包了。如果决定这样做,就可以从abs中先取出该软件包的PKGBUILD文件,然后修改相应的内容(通常是版本号)。或者访问 https://www.archlinux.org/packages/ 搜索你需要的降级的软件包,然后点 "查看修改" 链接,选择“查看日志“。找到你需要的版本然后点击路径。然后下载相应的文件再用makepkg编译即可。<br />
<br />
对于AUR包来说,只能在http://pkgbuild.com/git/aur-mirror.git/ 处找到旧包的PKGBUILD,或者你可以到[Unofficial User Repositories]]处找到旧的二进制包。<br />
<br />
== 更改仓库 ==<br />
要使用ARM仓库的话,注释掉原来的仓库,添加适当的ARM仓库地址即可:<br />
[core]<br />
#<nowiki>Server=http://mirrors.gigenet.com/archlinux/core/os/i686</nowiki><br />
<nowiki>Server=http://arm.konnichi.com/2009/11/01/core/os/i686</nowiki><br />
<br />
在这个例子中,这个配置会把当前系统的包回溯到2009年11月1日的状态。请注意,所有的仓库都是官方仓库的快照。所以你只需要更改{{Ic|/etc/pacman.d/mirrorlist}}处的镜像,把ARM的镜像放在最前头。<br />
然后运行:<br />
pacman -Syy # refresh the sync databases<br />
pacman -Suu # downgrade all packages with a lower version in the repos<br />
<br />
仅仅这样并不能保证无缝的回溯,因为有时候相对于版本号会有包冲突等问题。<br />
<br />
更多信息请参考[[pacman]]<br />
<br />
== FAQ ==<br />
=== 由于依赖问题我无法降级 ===<br />
<br />
你可以使用{{ic|-d}}选项在升级或删除包的时候忽略依赖的限制,比如,{{ic|pacman -Ud pkgpkgname-olderpkgver.pkg.tar.gz}},但这样做有可能破坏你的系统。<br />
<br />
=== 怎么才能阻止Pacman升级我已降级的包? ===<br />
<br />
在{{Ic|pacman.conf}}中设置{{Ic|<nowiki>IgnorePkg = package1 package2</nowiki>}}会使Pacman在更新时忽略你列出的包。<br />
<br />
=== 我想把我的系统回溯到昨天的状态 ===<br />
<br />
如果你使用[[LVM]],并且开启了periodic snapshots的话,这很容易实现。</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Dnsmasq_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409269
Dnsmasq (简体中文)
2015-11-15T14:32:37Z
<p>Aaron chen: </p>
<hr />
<div>{{Lowercase_title}}<br />
[[Category:简体中文]]<br />
[[Category:Domain Name System (简体中文)]]<br />
[[en:Dnsmasq]]<br />
[[es:Dnsmasq]]<br />
[[it:Dnsmasq]]<br />
[[ja:Dnsmasq]]<br />
[[pt:Dnsmasq]]<br />
[[ru:Dnsmasq]]<br />
{{TranslationStatus (简体中文)|Dnsmasq|2015-10-25|406967}}<br />
Dnsmasq 提供 DNS 缓存和 DHCP 服务功能。作为域名解析服务器(DNS),dnsmasq可以通过缓存 DNS 请求来提高对访问过的网址的连接速度。作为DHCP 服务器,{{pkg|dnsmasq}} 可以用于为局域网电脑分配内网ip地址和提供路由。DNS和DHCP两个功能可以同时或分别单独实现。dnsmasq轻量且易配置,适用于个人用户或少于50台主机的网络。此外它还自带了一个 [[PXE]] 服务器。<br />
<br />
== 安装 ==<br />
<br />
从[[官方仓库]] 中[[安装]] {{pkg|dnsmasq}}。<br />
<br />
== DNS 缓存设置 ==<br />
<br />
要在单台电脑上以守护进程方式启动dnsmasq做DNS缓存服务器,编辑{{ic|/etc/dnsmasq.conf}},添加监听地址:<br />
<br />
listen-address=127.0.0.1<br />
<br />
如果用此主机为局域网提供默认 DNS,请用为该主机绑定固定 IP 地址,设置:<br />
<br />
listen-address=192.168.x.x<br />
这种情况建议配置静态IP<br />
<br />
多个ip地址设置:<br />
listen-address=127.0.0.1,192.168.x.x <br />
<br />
=== DNS 地址文件 ===<br />
{{Merge|resolv.conf|主题相同。本文或本节候选与[[resolv.conf]]合并。此处绝大部分功能可以在原生的{{ic|/etc/resolvconf.conf}}文件中通过配置{{ic|name_servers}} 和 {{ic|name_servers_append}}选项实现。}}<br />
在配置好dnsmasq后,你需要编辑{{ic|/etc/resolv.conf}}让DHCP客户端首先将本地地址(localhost)加入 DNS 文件({{ic|/etc/resolv.conf}}),然后再通过其他DNS服务器解析地址。配置好DHCP客户端后需要重新启动网络来使设置生效。<br />
==== resolv.conf ====<br />
<br />
一种选择是一个纯粹的 {{ic|resolv.conf}} 配置。要做到这一点,才使第一个域名服务器在{{ic|/etc/resolv.conf}} 中指向localhost:<br />
<br />
{{hc|/etc/resolv.conf|<br />
nameserver 127.0.0.1<br />
# External nameservers<br />
...<br />
}}<br />
<br />
现在,DNS查询将首先解析dnsmasq,只检查外部的服务器如果DNSMasq无法解析查询. {{Pkg|dhcpcd}}, 不幸的是,往往默认覆盖 {{ic|/etc/resolv.conf}}, 所以如果你使用DHCP,这是一个好主意来保护 {{ic|/etc/resolv.conf}},要做到这一点,追加 {{ic|nohook resolv.conf}}到dhcpcd的配置文件:<br />
<br />
{{hc|/etc/dhcpcd.conf|<br />
...<br />
nohook resolv.conf}}<br />
<br />
也可以保护您的resolv.conf不被修改:<br />
<br />
# chattr +i /etc/resolv.conf<br />
<br />
===== 三个以上域名服务器 =====<br />
<br />
Linux 处理 DNS 请求时有个限制,在 {{ic|resolv.conf}} 中最多只能配置三个域名服务器(nameserver)。作为一种变通方法,可以在 {{ic|resolv.conf}} 文件中只保留 localhost 作为域名服务器,然后为外部域名服务器另外创建 {{ic|resolv-file}} 文件。首先,为 dnsmasq 新建一个域名解析文件:<br />
<br />
{{hc|/etc/resolv.dnsmasq.conf|<br />
# Google's nameservers, for example<br />
nameserver 8.8.8.8<br />
nameserver 8.8.4.4<br />
}}<br />
<br />
然后编辑 {{ic|/etc/dnsmasq.conf}} 让 dnsmasq 使用新创建的域名解析文件:<br />
<br />
{{hc|/etc/dnsmasq.conf|<br />
...<br />
resolv-file&#61;/etc/resolv.dnsmasq.conf<br />
...<br />
}}<br />
<br />
==== 使用dhcpcd ====<br />
<br />
{{Pkg|dhcpcd}} 可以是通过创建(或编辑){{ic|/etc/resolv.conf.head}}文件或 {{ic|/etc/resolv.conf.tail}}文件来指定dns服务器,使{{ic|/etc/resolv.conf}}不会被每次都被dhcpcd重写<br />
echo "nameserver 127.0.0.1" > /etc/resolv.conf.head #设置dns服务器为127.0.0.1<br />
<br />
==== 使用dhclient ====<br />
<br />
要使用 dhclient, 取消 {{ic|/etc/dhclient.conf}} 文件中如下行的注释:<br />
<br />
prepend domain-name-servers 127.0.0.1;<br />
<br />
=== 使用NetworkManager ===<br />
<br />
[[Networkmanager]] 可以靠自身配置文件的设置项启动 ''dnsmasq'' 。在 {{ic|NetworkManager.conf}} 文件的 {{ic|[main]}} 节段添加 {{ic|1=dns=dnsmasq}} 配置语句,然后禁用由 [[systemd]] 启动的 {{ic|dnsmasq.service}}:<br />
<br />
{{hc|/etc/NetworkManager/NetworkManager.conf|<nowiki><br />
[main]<br />
plugins=keyfile<br />
dns=dnsmasq<br />
</nowiki>}}<br />
<br />
可以在 {{ic|/etc/NetworkManager/dnsmasq.d/}} 目录下为 ''dnsmasq'' 创建自定义配置文件。例如,调整 DNS 缓存大小(保存在内存中):<br />
<br />
{{hc|/etc/NetworkManager/dnsmasq.d/cache|2=<br />
cache-size=1000<br />
}}<br />
<br />
''dnsmasq'' 被 {{ic|NetworkManager}} 启动后,此目录下配置文件中的配置将取代默认配置。<br />
<br />
{{提示|这种方法可以让你启用特定域名的自定义DNS设置。例如: {{ic|server&#61;/example1.com/exemple2.com/xx.xxx.xxx.x}} 改变第一个DNS地址,浏览以下网站{{ic|example1.com, example2.com}}使用{{ic|xx.xxx.xxx.xx}}。This method is preferred to a global DNS configuration when using particular DNS nameservers which lack of speed, stability, privacy and security.}}<br />
<br />
<br />
==== IPv6 ==== <br />
<br />
启用 {{ic|dnsmasq}} 在 NetworkManager 可能会中断仅持IPv6的DNS查询 (例如 {{ic|dig -6 [hostname]}}) 否则将工作。 为了解决这个问题,创建以下文件将配置 ''dnsmasq'' 总是监听IPv6的loopback:<br />
<br />
{{hc|/etc/NetworkManager/dnsmasq.d/ipv6_listen.conf|2=<br />
listen-address=::1<br />
}}<br />
此外, {{ic|dnsmasq}}不优先考虑上游IPv6的DNS。不幸的是NetworkManager已不这样做 ([https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/936712 Ubuntu Bug])。 <br />
一种解决方法是将禁用IPv4 DNS的NetworkManager的配置,假设存在。<br />
<br />
==== 其他方式 ====<br />
另一种选择是在NetworkManagers“设置(通常通过右键单击小程序)和手动输入设置。设置将取决于前端中使用的类型;这个过程通常涉及右击小程序,编辑(或创建)一个配置文件,然后选择DHCP类型为“自动(指定地址)。”DNS地址将需要输入,通常以这种形式:{{ic|127.0.0.1, DNS-server-one, ...}}.<br />
<br />
== DHCP 服务器设置 ==<br />
<br />
dnsmasq默认关闭DHCP功能,如果该主机需要为局域网中的其他设备提供IP和路由,应该对dnsmasq 配置文件({{ic|/etc/dnsmasq.conf}})必要的配置如下:<br />
<br />
{{bc|<nowiki><br />
# Only listen to routers' LAN NIC. Doing so opens up tcp/udp port 53 to<br />
# localhost and udp port 67 to world:<br />
interface=<LAN-NIC><br />
<br />
# dnsmasq will open tcp/udp port 53 and udp port 67 to world to help with<br />
# dynamic interfaces (assigning dynamic ips). Dnsmasq will discard world<br />
# requests to them, but the paranoid might like to close them and let the <br />
# kernel handle them:<br />
bind-interfaces<br />
<br />
# Dynamic range of IPs to make available to LAN pc<br />
dhcp-range=192.168.111.50,192.168.111.100,12h<br />
<br />
# If you’d like to have dnsmasq assign static IPs, bind the LAN computer's<br />
# NIC MAC address:<br />
dhcp-host=aa:bb:cc:dd:ee:ff,192.168.111.50<br />
</nowiki>}}<br />
<br />
==启动守护进程==<br />
<br />
设置为开机启动:<br />
# systemctl enable dnsmasq<br />
<br />
立即启动 dnsmashq:<br />
<br />
# systemctl start dnsmasq<br />
<br />
查看dnsmasq是否启动正常,查看系统日志:<br />
<br />
# journalctl -u dnsmasq<br />
<br />
需要重启网络服务以使 DHCP 客户端重建一个新的 {{ic|/etc/resolv.conf}}。<br />
<br />
== 测试 ==<br />
<br />
===DNS 缓存===<br />
要测试查询速度,请访问一个 dnsmasq 启动后没有访问过的网站,执行 ({{ic|dig}} (位于 {{Pkg|dnsutils}}{{Broken package link|replaced by {{Pkg|bind-tools}}}} 软件包):<br />
<br />
$ dig archlinux.org | grep "Query time"<br />
<br />
再次运行命令,因为使用了缓存,查询时间应该大大缩短。<br />
<br />
=== DHCP 服务器 ===<br />
<br />
从一个连接到使用了 dnsmasq 的计算机的计算机,配置它使用 DHCP 自动获取 IP 地址,然后尝试连接到你平时使用的网络。<br />
<br />
== 小技巧 ==<br />
<br />
=== 避免 OpenDNS 重定向 Google 请求 ===<br />
<br />
要避免 OpenDNS 重定向所有 Google 请求到他们自己的搜索服务器,添加以下内容到 {{ic|/etc/dnsmasq.conf}}:<br />
<br />
server=/www.google.com/X.X.X.X<br />
<br />
用你的 ISP 的 DNS 服务器/路由器的 IP 替代 X.X.X.X 。<br />
<br />
=== 查看租约 === <br />
cat /var/lib/misc/dnsmasq.leases<br />
<br />
=== 添加自定义域 ===<br />
它可以将一个自定义域添加到主机中的(本地)网络:<br />
local=/home.lan/<br />
domain=home.lan<br />
<br />
<br />
在这个例子中可以ping主机/设备 (例如:您的主机文件中的定义) {{ic|hostname.home.lan}}.<br />
<br />
取消扩展主机添加自定义域的主机条目:存在<br />
expand-hosts<br />
<br />
如果没有这个设置,你必须域添加到/ etc/ hosts中的条目。</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Ceph_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409268
Ceph (简体中文)
2015-11-15T14:31:48Z
<p>Aaron chen: </p>
<hr />
<div>{{DISPLAYTITLE:Ceph (简体中文)}}<br />
[[Category:简体中文]]<br />
[[Category:File systems (简体中文)]]<br />
[[Category:Networking (简体中文)]]<br />
[[en:Ceph]]<br />
{{TranslationStatus (简体中文)|Ceph|2015-06-08|377867}}<br />
<br />
Ceph 是一个专注于分布式的、弹性可扩展的、高可靠的、性能优异的存储系统平台,可用于为[[Wikipedia:Virtual Machine|虚拟机]]提供块存储方案或通过 [[File Systems#FUSE-based file systems|FUSE]] 提供常规的文件系统。Ceph 是个高度可配置的系统,管理者可以控制系统的各个方面。它提供了一个命令行界面用于监视和控制其存储集群。Ceph 也包含鉴证和授权功能,可兼容多种存储网关接口如 [[Wikipedia: OpenStack#Swift|OpenStack Swift]] 和 [[Wikipedia: Amazon S3| Amazon S3]].<br />
<br />
引自 [[Wikipedia: Ceph (software)]]:<br />
:Ceph is a free software storage platform designed to present object, block, and file storage from a single distributed computer cluster. Ceph's main goals are to be completely distributed without a single point of failure, scalable to the exabyte level, and freely-available. The data is replicated, making it fault tolerant.<br />
<br />
引自 [https://ceph.com/ Ceph.com]:<br />
:Ceph is a distributed object store and file system designed to provide excellent performance, reliability and scalability.<br />
<br />
{{警告|推荐使用[https://github.com/ceph/ceph-deploy 官方部署工具]安装 Ceph 。该工具通过 [[SSH]] 连接到目标机器并自动完成安装、配置和系统管理。官方部署工具(ceph-deploy)目前尚不支持 [[Arch Linux]] ,不能使用 [http://ceph.com/docs/master/start/ 快速安装方式] 部署,只能按官方文档[http://ceph.com/docs/master/install/manual-deployment/ 手工部署]。因此本文目前仅介绍手工部署方法。<br />
<br />
The official documentation [http://ceph.com/docs/master/install/#deploy-a-cluster-manually states] "the manual procedure is primarily for exemplary purposes for those developing deployment scripts with Chef, Juju, Puppet, etc.".<br />
}}<br />
<br />
== 术语 ==<br />
<br />
{{提示|[http://ceph.com/docs/master/glossary/ 官方文档]提供了完整的术语表}}<br />
<br />
* '''Client''' : Something which connects to a Ceph cluster to access data but is not part of the Ceph cluster itself.<br />
* '''MONs''' : Also known as monitors, these store cluster state and maps containing information about the cluster such as running services and data locations.<br />
* '''MDSs''' : Also known as metadata servers, these store metadata for the Ceph filesystem to reduce load on the storage cluster (e.g. information for commands such as {{ic|ls}}).<br />
* '''Node''' : A machine which is running Ceph services, such as OSDs or MONs.<br />
* '''OSDs''' : Also known as OSD daemons, these are responsible for the storage of data within the cluster and also conduct various related operations such as replication, recovery, and rebalancing.<br />
* '''Storage cluster''' : The core set of software responsible for storing data (OSDs+MONs).<br />
<br />
== 安装 ==<br />
<br />
=== 软件包 ===<br />
<br />
可以从 [[official repositories|官方源]] 安装{{Pkg|ceph}}。如果愿意冒险,也可以安装开发版的 {{AUR|ceph-git}}。<br />
<br />
{{AUR|ceph-deploy}}提供了 Ceph 的官方部署工具。<br />
<br />
存储集群的所有节点都要安装 {{Pkg|ceph}}。<br />
<br />
=== NTP 客户端 ===<br />
<br />
{{警告|应当同步监视器节点的时钟以避免时钟偏移(详见 [[Time_(简体中文)#时间偏移]]),否则将导致集群性能下降甚至停止工作。[http://docs.ceph.com/docs/master/rados/configuration/mon-config-ref/#clock: 官方文档] 建议所有节点都应采取某种方式同步时钟。}}<br />
<br />
在节点上安装并运行时钟同步客户端,可参阅 [[Time#Time synchronization]]。<br />
<br />
== 启动一个存储集群 ==<br />
<br />
Before a storage cluster can operate, the monitors for that cluster must be bootstrapped with several identifiers and keyrings.<br />
<br />
The upstream Ceph documentation is well-written and kept updated with the latest releases.<br />
<br />
To boostrap a storage cluster, follow the steps documented in the [http://ceph.com/docs/master/install/manual-deployment/#monitor-bootstrapping official manual deployment guide].<br />
<br />
=== 启动一个监视器 ===<br />
<br />
Since your system most likely uses [[systemd]], you can enable a monitor as a systemd unit.<br />
<br />
As an example, for a monitor named {{ic|node1}} start and enable {{ic|ceph-mon@node1.service}} as detailed in [[Systemd#Using units]].<br />
<br />
== 参阅==<br />
<br />
* 官方网站<br />
** [https://ceph.com Homepage]<br />
** [http://ceph.com/docs/master/ Documentation]<br />
* 官方源码下载<br />
** [https://github.com/ceph GitHub organization]<br />
** [https://github.com/ceph/ceph Ceph]<br />
* 官方文档非官方中文版<br />
** [http://mirrors.myccdn.info/ceph/doc/docs_zh/output/html/]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Bluetooth_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409267
Bluetooth (简体中文)
2015-11-15T14:31:13Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Bluetooth (简体中文)]]<br />
[[cs:Bluetooth]]<br />
[[de:Bluetooth]]<br />
[[en:Bluetooth]]<br />
[[es:Bluetooth]]<br />
[[fr:Bluetooth]]<br />
[[it:Bluetooth]]<br />
[[ja:Bluetooth]]<br />
[[ru:Bluetooth]]<br />
[http://www.bluetooth.org/ 蓝牙]是一个短距离无线通信标准,适用于手机、计算机和其他电子设备之间的通信。在 Linux 中,通常使用的蓝牙协议栈实现是 [http://www.bluez.org/ BlueZ].<br />
<br />
==安装==<br />
[[Install|安装]] {{Pkg|bluez}} 和 {{Pkg|bluez-utils}} 软件包。{{Pkg|bluez}} 软件包提供蓝牙协议栈,{{Pkg|bluez-utils}} 软件包提供 {{ic|bluetoothctl}} 工具。<br />
如果尚未加载通用蓝牙驱动则需先加载:<br />
# modprobe btusb<br />
<br />
然后 [[start|启动]] {{ic|bluetooth.service}} systemd 单元。可以在系统引导时自动 [[enable|启用]] 它。<br />
<br />
{{注意|<br />
* 默认情况下,蓝牙仅为 {{ic|lp}} 用户组中的用户启用 bnep0 设备。如果想要加入蓝牙系统,需确认已将用户加入该组。可以修改{{ic|/etc/dbus-1/system.d/bluetooth.conf}}文件中相应的组配置来实现。<br />
* 有些蓝牙适配器是与无线网卡绑定在一起的(比如:[http://www.intel.com/content/www/us/en/wireless-products/centrino-advanced-n-6235.html 英特尔迅驰])。这就要求无线网卡先被启用(典型情况是在笔记本电脑上用快捷键启用)以便蓝牙适配器对内核可见。<br />
* 有些厂家(如 Broadcom)的蓝牙卡与网卡有冲突(不兼容)。这就需要确认在网络服务引导之前蓝牙设备已连接。}}<br />
<br />
== 通过命令行工具配置蓝牙 ==<br />
=== Bluetoothctl ===<br />
通过命令行配对是最可靠的选择。准确的配对过程依不同设备类型及其所提供的输入功能而各不相同。下面提供使用{{ic|/usr/bin/bluetoothctl}}配对的一般过程:<br />
<br />
启动 {{ic|bluetoothctl}} 交互命令。可以输入 {{ic|help}} 列出所有有效的命令。<br />
* 输入{{ic|power on}} 命令打开控制器电源。默认是关闭的。<br />
* 输入{{ic|devices}} 命令获取要配对设备的 MAC 地址。<br />
* 如果设备未在清单中列出,输入 {{ic|scan on}} 命令设置设备发现模式。<br />
* 输入{{ic|agent on}} 命令打开代理。<br />
* 输入 {{ic|pair ''MAC Address''}} 开始配对(支持 tab 键补全)。<br />
* 如果使用无 PIN 码设备,再次连接可能需要手工认证。输入 {{ic|trust ''MAC Address''}} 命令。<br />
* 最后,用 {{ic|connect ''MAC_address''}} 命令建立连接。<br />
<br />
以下为一个交互实例:<br />
# bluetoothctl <br />
[NEW] Controller 00:10:20:30:40:50 pi [default]<br />
[bluetooth]# agent KeyboardOnly <br />
Agent registered<br />
[bluetooth]# default-agent <br />
Default agent request successful<br />
[bluetooth]# scan on<br />
Discovery started<br />
[CHG] Controller 00:10:20:30:40:50 Discovering: yes<br />
[NEW] Device 00:12:34:56:78:90 myLino<br />
[CHG] Device 00:12:34:56:78:90 LegacyPairing: yes<br />
[bluetooth]# pair 00:12:34:56:78:90<br />
Attempting to pair with 00:12:34:56:78:90<br />
[CHG] Device 00:12:34:56:78:90 Connected: yes<br />
[CHG] Device 00:12:34:56:78:90 Connected: no<br />
[CHG] Device 00:12:34:56:78:90 Connected: yes<br />
Request PIN code<br />
[agent] Enter PIN code: 1234<br />
[CHG] Device 00:12:34:56:78:90 Paired: yes<br />
Pairing successful<br />
[CHG] Device 00:12:34:56:78:90 Connected: no<br />
<br />
为使系统重启后激活设备,需添加一条 udev 规则:<br />
<br />
{{hc|/etc/udev/rules.d/10-local.rules|2=<br />
# Set bluetooth power up<br />
ACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfig hci0 up"}}<br />
<br />
为使设备在系统挂起后唤醒时自动上电,应使用如下例所示 ''systemd'' 服务:<br />
<br />
{{hc|/etc/systemd/system/bluetooth-auto-power@.service|<nowiki><br />
[Unit]<br />
Description=Bluetooth auto power on<br />
After=bluetooth.service sys-subsystem-bluetooth-devices-%i.device suspend.target<br />
<br />
[Service]<br />
Type=oneshot<br />
#We could also do a 200 char long call to bluez via dbus. Except this does not work since bluez does not react to dbus at this point of the resume sequence and I do not know how I get this service to run at a time it does. So we just ignore bluez and force %i up using hciconfig. Welcome to the 21st century.<br />
#ExecStart=/usr/bin/dbus-send --system --type=method_call --dest=org.bluez /org/bluez/%I org.freedesktop.DBus.Properties.Set string:org.bluez.Adapter1 string:Powered variant:boolean:true<br />
ExecStart=/usr/bin/hciconfig %i up<br />
<br />
[Install]<br />
WantedBy=suspend.target<br />
</nowiki>}}<br />
<br />
== 图形化前端 ==<br />
<br />
下面的软件包提供了一个图形化的界面来自定义蓝牙。<br />
<br />
=== GNOME Bluetooth ===<br />
<br />
[https://wiki.gnome.org/Projects/GnomeBluetooth GNOME Bluetooth] 是 [[GNOME]] 的 蓝牙管理工具。{{Pkg|gnome-bluetooth}} 软件包提供后端。{{Pkg|gnome-shell}} 提供状态监视小部件。{{Pkg|gnome-control-center}} 提供图形化配置前端工具,可以在'''活动概览'''中输入'''Bluetooth'''或者用 {{ic|gnome-control-center bluetooth}} 命令打开。可以用 {{ic|bluetooth-sendto}} 命令直接向远端设备发送文件。<br />
<br />
要接收文件,必须安装 {{Pkg|gnome-user-share}} 软件包。然后在 ''设置 -> 共享'' 中授权配对的设备通过蓝牙接收文件。<br />
<br />
{{小贴士|若要在 Thunar 中文件属性的''发送到''菜单中增加蓝牙选项,参阅[http://docs.xfce.org/xfce/thunar/send-to 这里]的命令。(需要设置的命令是 {{ic|bluetooth-sendto %F}})。}}<br />
<br />
=== Bluedevil ===<br />
<br />
bluedevil 是 [[KDE (简体中文)|KDE]] 的蓝牙管理工具,可以用 {{Pkg|bluedevil}}(KDE Plasma 5)或 {{Pkg|bluedevil4}}(KDE 4)[[安装]]。<br />
<br />
确认{{ic|bluetooth}}守护进程在运行。你可以在dolphin和系统通知区域里得到一个蓝牙图标,你可以通过点击这个图标来设置bluedevil、检测蓝牙设备等等。你也可以通过KDE的系统设置来配置bluedevil。<br />
<br />
=== Blueberry ===<br />
<br />
''Blueberry'' 是 GNOME Bluetooth 的另一替代方案,可工作于所有桌面环境。可安装 {{Pkg|blueberry}} 软件包。它提供了配置工具(''blueberry'')和系统托盘程序(''blueberry-tray'')。<br />
=== Blueman ===<br />
参阅 [[Blueman]]<br />
<br />
== 手工配置 ==<br />
<br />
你需要编辑 {{ic|/etc/bluetooth}} 下的配置文件来实现人工配置Bluez。它们是:<br />
audio.conf<br />
input.conf<br />
main.conf<br />
network.conf<br />
rfcomm.conf<br />
<br />
默认的配置文件在绝大多数情况下都能都正常工作。绝大多数的配置选项在她们的文件里都有丰富的文档注释,所以自定义成为了一个简单到阅读配置选项的描述和注释的工作。全局设置从{{ic|main.conf}}开始<br />
<br />
=== 音频流 ===<br />
如果你想启用从你的设备到计算机的音频流,你必须更改 {{ic|audio.conf}} 然后添加这个到 {{ic|[General]}} 部分:<br />
Enable=Socket<br />
<br />
== 配对 ==<br />
{{注意| 这一部分描述可能不是完全的准确。感谢'''Gattschardo'''解决了'''个人验证码'''部分}}<br />
<br />
许多蓝牙(Bluetooth)设备要求在使用时[http://en.wikipedia.org/wiki/Bluetooth#Pairing 配对]。<br />
实际上的过程取决于配对涉及到的设备和这些设备的输入功能。<br />
在移动电话上的配对过程可能会像下面那样:<br />
* 计算机向移动电话发送一个配对请求<br />
* 移动电话上会提示输入一个由计算机给出的PIN(个人识别码)码<br />
* 必须在计算机上重新输入同一个序列(指上文中的PIN)。<br />
<br />
通过执行一下命令来搜索外部设备<br />
$ hcitool scan<br />
<br />
在不使用gnome-bluez包的情况下配对设备,你需要使用一个包含在bluez包里的,叫做''bluez-simple-agent''的工具。你需要从常用的软件仓库里获取几个跟python相关的工具来使这种方法可用:dbus-python和pygobject。 如果你准备好了,你可以以root身份执行这个脚本:<br />
<br />
# bluez-simple-agent<br />
<br />
如果它工作正常,你应当会在控制台得到消息:"Agent registered" 。<br />
<br />
现在你可以开始从你的移动电话开始配对工作,这个脚本会在控制台询问你PIN码,你输入进去然后按回车键确认,这样就完成了配对工作。接下来可以通过^C-c终止这个脚本的执行,只需要在配对的时候使用这个脚本,而连接设备时不需要用到它。<br />
<br />
需要查看例子.请向下翻页到示例部分。<br />
<br />
== 使用 Obex 发送接收文件 ==<br />
除了KDE和Gnome Bluetooth软件包之外,Obexfs是另一个选择,它可以允许你挂载你的移动电话作为文件系统的一部分。注意,如果要使用Obex,你需要一个能够提供Obex FTP服务的设备。<br />
安装Obex;<br />
# pacman -S obexfs<br />
<br />
然后你可以以root权限运行如下命令来挂载你的移动电话<br />
# obexfs -b <devices mac address> /mountpoint<br />
<br />
单看更多挂载选项,参阅http://dev.zuckschwerdt.org/openobex/wiki/ObexFs<br />
<br />
<br />
== 示例 ==<br />
<br />
=== 西门子 S55 ===<br />
<br />
这是我链接我的S55的过程。(我还没搞明白怎么样通过电话来初始化连接。)<br />
* 根据安装步骤<br />
* <br />
$> hcitool scan<br />
Scanning ...<br />
XX:XX:XX:XX:XX:XX NAME<br />
$> B=XX:XX:XX:XX:XX:XX<br />
在另一个终端启动simple-agent<br />
$> su -c bluez-simple-agent <br />
Password: <br />
Agent registered<br />
回到上一个终端<br />
$> obexftp -b $B -l "Address book"<br />
# Phone ask for pin, I enter it and answer yes when asked if I want to save the device<br />
...<br />
<file name="5F07.adr" size="78712" modified="20030101T001858" user-perm="WD" group-perm="" /><br />
...<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -g "Address book/5F07.adr"<br />
Browsing 00:01:E3:6B:FF:D7 ...<br />
Channel: 5<br />
Connecting...done<br />
Receiving "Address book/5F07.adr"... Sending "Address book"... done<br />
Disconnecting...done<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -p a <br />
...<br />
Sending "a"... done<br />
Disconnecting...done<br />
<br />
=== 罗技鼠标 MX Laser / M555b ===<br />
<br />
快速测试连接<br />
<br />
$> hidd --connect XX:XX:XX:XX:XX:XX<br />
<br />
通过桌面想到设置鼠标一实现自动重连。<br />
如果你的桌面环境不提供对此任务的支持,参阅[[Bluetooth mouse manual configuration]]向导.<br />
<br />
=== 摩托罗拉 V900 ===<br />
<br />
在安装blueman并且运行blueman-applet之后,在摩托罗拉设备的菜单connections -> bluetooth下单击"find me"。在blueman-applet搜索设备,找到摩托罗拉,然后单击blueman-applet中的“添加。单击“bond”,输入pin码,根据摩托罗达上的提示输入相同的pin码,在终端执行:<br />
<br />
cd ~/<br />
mkdir bluetooth-temp<br />
obexfs -n xx:yy:zz:... ~/bluetooth-temp<br />
cd ~/bluetooth-temp<br />
<br />
然后浏览... 这样操作时只能访问音频、视频和图片。<br />
<br />
=== 摩托罗拉 RAZ ===<br />
<br />
> pacman -S obextool obexfs obexftp openobex bluez<br />
<br />
> lsusb<br />
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 002 Device 002: ID 03f0:171d Hewlett-Packard Wireless (Bluetooth + WLAN) Interface [Integrated Module]<br />
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
<br />
> hciconfig hci0 up<br />
<br />
> hciconfig<br />
hci0: Type: BR/EDR Bus: USB<br />
BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8<br />
UP RUNNING<br />
RX bytes:348 acl:0 sco:0 events:11 errors:0<br />
TX bytes:38 acl:0 sco:0 commands:11 errors:0<br />
<br />
> hcitool dev<br />
Devices:<br />
hci0 00:16:41:97:BA:5E<br />
<br />
'''注意:确保手机上的蓝牙处于打开状态并且是可见的<br />
'''<br />
<br />
> hcitool scan<br />
Scanning ...<br />
00:1A:1B:82:9B:6D [quirxi]<br />
<br />
> hcitool inq<br />
Inquiring ...<br />
00:1A:1B:82:9B:6D clock offset: 0x1ee4 class: 0x522204<br />
<br />
> l2ping 00:1A:1B:82:9B:6D<br />
Ping: 00:1A:1B:82:9B:6D from 00:16:41:97:BA:5E (data size 44) ...<br />
44 bytes from 00:1A:1B:82:9B:6D id 0 time 23.94ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 1 time 18.85ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 2 time 30.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 3 time 18.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 4 time 17.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 5 time 17.88ms<br />
6 sent, 6 received, 0% loss<br />
<br />
> hcitool name 00:1A:1B:82:9B:6D<br />
[quirxi]<br />
<br />
# hciconfig -a hci0<br />
hci0: Type: BR/EDR Bus: USB<br />
BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8<br />
UP RUNNING<br />
RX bytes:9740 acl:122 sco:0 events:170 errors:0<br />
TX bytes:2920 acl:125 sco:0 commands:53 errors:0<br />
Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80<br />
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3<br />
Link policy:<br />
Link mode: SLAVE ACCEPT<br />
Name: 'BCM2045'<br />
Class: 0x000000<br />
Service Classes: Unspecified<br />
Device Class: Miscellaneous,<br />
HCI Version: 2.0 (0x3) Revision: 0x204a<br />
LMP Version: 2.0 (0x3) Subversion: 0x4176<br />
Manufacturer: Broadcoml / Corporation (15)<br />
<br />
> hcitool info 00:1A:1B:82:9B:6D<br />
Requesting information ...<br />
BD Address: 00:1A:1B:82:9B:6D<br />
Device Name: [quirxi]<br />
LMP Version: 1.2 (0x2) LMP Subversion: 0x309<br />
Manufacturer: Broadcom Corporation (15)<br />
Features: 0xff 0xfe 0x0d 0x00 0x08 0x08 0x00 0x00<br />
<3-slot packets> <5-slot packets> <encryption> <slot offset><br />
<timing accuracy> <role switch> <hold mode> <sniff mode><br />
<RSSI> <channel quality> <SCO link> <HV2 packets><br />
<HV3 packets> <A-law log> <CVSD> <power control><br />
<transparent SCO> <AFH cap. slave> <AFH cap. master><br />
<br />
<br />
'''编辑你的main.conf并且输入对应与你手机的class( Class = 0x100100 ):'''<br />
> vim /etc/bluetooth/main.conf<br />
<br />
# Default device class. Only the major and minor device class bits are<br />
# considered.<br />
#Class = 0x000100<br />
Class = 0x100100<br />
<br />
> /etc/rc.d/dbus start<br />
:: Starting D-BUS system messagebus <br />
[DONE]<br />
<br />
> /etc/rc.d/bluetooth start<br />
:: Stopping bluetooth subsystem: pand dund rfcomm hidd bluetoothd<br />
[DONE]<br />
:: Starting bluetooth subsystem: bluetoothd<br />
<br />
<br />
'''通过bluez-simple-agent配对只需要做一次。当你的手机要求输入pin码时,输入0000'''<br />
> /usr/bin/bluez-simple-agent hci0 00:1A:1B:82:9B:6D<br />
RequestPinCode (/org/bluez/10768/hci0/dev_00_1A_1B_82_9B_6D)<br />
Enter PIN Code: 0000<br />
Release<br />
New device (/org/bluez/10768/hci0/dev_00_1A_1B_82_9B_6D)<br />
<br />
'''现在你可以动过ObexFTP来访问你手机上的文件了:'''<br />
> obexftp -v -b 00:1A:1B:82:9B:6D -B 9 -l<br />
Connecting..\done<br />
Tried to connect for 448ms<br />
Receiving "(null)"...-<?xml version="1.0" ?><br />
<!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd"><br />
<folder-listing><br />
<parent-folder /><br />
<folder name="audio" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
<folder name="video" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
<folder name="picture" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
</folder-listing><br />
done<br />
Disconnecting..\done<br />
<br />
'''你也可以把你的手机作为文件系统的一部分挂载在你的计算机上:'''<br />
<br />
> groupadd bluetooth<br />
> mkdir /mnt/bluetooth<br />
> chown root:bluetooth /mnt/bluetooth<br />
> chmod 775 /mnt/bluetooth<br />
> usermod -a -G bluetooth arno<br />
<br />
> obexfs -b 00:1A:1B:82:9B:6D /mnt/bluetooth/<br />
> l /mnt/bluetooth/<br />
total 6<br />
drwxr-xr-x 1 root root 0 10. Okt 13:25 .<br />
drwxr-xr-x 5 root root 4096 10. Okt 10:08 ..<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 audio<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 picture<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 video<br />
<br />
=== 使用bluez-simple-agent来跟iPhone配对 ===<br />
<br />
假设有一个叫做hci0的蓝牙设备和一个在hcitool里显示为'00:00:DE:AD:BE:EF'的iPhone:<br />
<br />
# bluez-simple-agent hci0 00:00:DE:AD:BE:EF<br />
Passcode:<br />
<br />
== 疑难解答 ==<br />
<br />
=== passkey-agent ===<br />
$> passkey-agent --default 1234<br />
Can't register passkey agent<br />
The name org.bluez was not provided by any .service files<br />
你可能在启动<tt>/etc/rc.d/dbus</tt>之前启动了 <tt>/etc/rc.d/bluetooth</tt> <br />
$> hciconfig dev<br />
# (no listing)<br />
尝试运行 <tt>hciconfig hc0 up</tt><br />
<br />
=== Blueman ===<br />
如果blueman-applet启动失败,试着删除整个''/var/lib/bluetooth''目录然后重新启动电脑(或者仅仅重启hal、dbus和bluetooth这几个服务)。<br />
# rm -rf /var/lib/bluetooth<br />
# reboot<br />
<br />
=== gnome-bluetooth ===<br />
如果你通过在蓝牙属性里接受文件时受到如下消息:<br />
Bluetooth OBEX start failed: Invalid path<br />
Bluetooth FTP start failed: Invalid path<br />
<br />
那么运行<br />
# pacman -S xdg-user-dirs<br />
$ xdg-user-dirs-update<br />
你可以通过下列方式修改路径:<br />
$ vi ~/.config/user-dirs.dirs<br />
<br />
=== Bluetooth USB 适配器 ===<br />
如果你在使用USB适配器,你应当确认你的适配器被正确识别。你可以在插入适配器时通过查看<tt>/var/log/messages.log</tt>,这应当会出现类似于下面所示的信息:<br />
<br />
# tail -f /var/log/messages.log<br />
May 2 23:36:40 tatooine usb 4-1: new full speed USB device using uhci_hcd and address 9<br />
May 2 23:36:40 tatooine usb 4-1: configuration #1 chosen from 1 choice<br />
May 2 23:36:41 tatooine hcid[8109]: HCI dev 0 registered<br />
May 2 23:36:41 tatooine hcid[8109]: HCI dev 0 up<br />
May 2 23:36:41 tatooine hcid[8109]: Device hci0 has been added<br />
May 2 23:36:41 tatooine hcid[8109]: Starting security manager 0<br />
May 2 23:36:41 tatooine hcid[8109]: Device hci0 has been activated<br />
<br />
查看支持的硬件列表,请参考本页的[[Bluetooth#Resources|resources]]。<br />
<br />
如果你只得到了前面两行,说明了电脑发现了这个设备,但是你需要手动启动它。<br />
例如:<br />
<br />
hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0<br />
DOWN <br />
RX bytes:0 acl:0 sco:0 events:0 errors:0<br />
TX bytes:0 acl:0 sco:0 commands:0 errors:<br />
sudo hciconfig hci0 up<br />
hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:02:72:C4:7C:06 ACL MTU: 377:10 SCO MTU: 64:8<br />
UP RUNNING <br />
RX bytes:348 acl:0 sco:0 events:11 errors:0<br />
TX bytes:38 acl:0 sco:0 commands:11 errors:0<br />
<br />
要验证这个设备被正确检测,你可以使用<tt>bluez-utils</tt>当中的<tt>hcitool</tt>。你可以通过下面方式获得受支持的设备、它们的识别码和硬件地址:<br />
<br />
$ hcitool dev<br />
Devices:<br />
hci0 00:1B:DC:0F:DB:40<br />
<br />
可以通过<tt>hciconfig</tt>获得关于这个设备更详细的信息。<br />
<br />
$ hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:1B:DC:0F:DB:40 ACL MTU: 310:10 SCO MTU: 64:8<br />
UP RUNNING PSCAN ISCAN <br />
RX bytes:1226 acl:0 sco:0 events:27 errors:0<br />
TX bytes:351 acl:0 sco:0 commands:26 errors:0<br />
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80<br />
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 <br />
Link policy: RSWITCH HOLD SNIFF PARK <br />
Link mode: SLAVE ACCEPT <br />
Name: 'BlueZ (0)'<br />
Class: 0x000100<br />
Service Classes: Unspecified<br />
Device Class: Computer, Uncategorized<br />
HCI Ver: 2.0 (0x3) HCI Rev: 0xc5c LMP Ver: 2.0 (0x3) LMP Subver: 0xc5c<br />
Manufacturer: Cambridge Silicon Radio (10)<br />
<br />
=== hcitool scan: 没找到设备 ===<br />
* 在某些Dell的笔记本电脑(比如 Studio 15)上,你必须把蓝牙模式由HID改成HCI<br />
# hid2hci<br />
<br />
* 有时候这个简单的命令也会有用:<br />
# hciconfig hci0 up<br />
<br />
=== 我的电脑不可见 ===<br />
如果不能从你的移动电话上找到你的电脑,打开PSCAN和ISCAN:<br />
# 打开 PSCAN 和 ISCAN<br />
$ hciconfig hci0 piscan <br />
# 确认操作有效<br />
$ hciconfig <br />
hci0: Type: USB<br />
BD Address: 00:12:34:56:78:9A ACL MTU: 192:8 SCO MTU: 64:8<br />
'''UP RUNNING PSCAN ISCAN'''<br />
RX bytes:20425 acl:115 sco:0 events:526 errors:0<br />
TX bytes:5543 acl:84 sco:0 commands:340 errors:0<br />
<br />
{{注意 | 检查/etc/bluetooth/main.conf中的发现倒计时和配对倒计时}}<br />
<br />
试着在 /etc/bluetooth/main.conf 改变设备的class<br />
# Default device class. Only the major and minor device class bits are<br />
# considered.<br />
#Class = 0x000100 (from default config)<br />
Class = 0x100100<br />
<br />
This was the only solution to make my computer visible for my phone. <br />
<br />
=== Nautilus cannot browse files ===<br />
If nautilus doesn't open and show this error:<br />
Nautilus cannot handle obex: locations. Couldn't display "obex://[XX:XX:XX:XX:XX:XX]/".<br />
Install gvfs-obexftp package:<br />
# pacman -S gvfs-obexftp<br />
<br />
== 资源 ==<br />
*[http://www.bluez.org Official Linux Bluetooth protocol stack]<br />
*[http://www.holtmann.org/linux/bluetooth/devices.html List of Linux supported Bluetooth Hardware] >> The list is not available anymore!<br />
*[http://en.opensuse.org/HCL/Bluetooth_Adapters openSUSE Bluetooth Hardware Compatibility List (HCL)]<br />
*[http://www.gentoo.org/doc/en/bluetooth-guide.xml Gentoo wiki is usually good]<br />
*[http://linuxgazette.net/109/oregan3.html Accessing a Bluetooth phone on Linux Gazette]<br />
*[http://www.adamish.com/blog/#a000361 Bluetooth computer visibility]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Arch-based_distributions_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409266
Arch-based distributions (简体中文)
2015-11-15T14:30:37Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:About Arch (简体中文)]]<br />
[[en:Arch based distributions (active)]]<br />
[[es:Arch based distributions (active)]]<br />
[[fr:LiveCD]]<br />
[[ja:Arch ベースのディストリビューション (活動中)]]<br />
[[ru:Arch based distributions (active)]]<br />
{{TranslationStatus (简体中文)|Arch_Based_Distributions_(Active)|2015-10-20|401757}}<br />
[[Arch Based Distributions (Inactive) (简体中文)|非活跃发行版页面]] 包含了已经不再维护的发行版。<br />
<br />
== 特色发行版 ==<br />
<br />
以下列表所包含的发行版都是使用 Arch Linux [[official repositories|官方软件仓库]] 并且大致遵守 [[The Arch Way (简体中文)|Arch 之道]]的发行版。<br />
<br />
=== Antergos ===<br />
<br />
Antergos 是高雅的,可定制的,面向桌面的操作系统,甚至可以使用 base 安装服务器。<br />
<br />
它起初名为 Cinnarch,集成 Cinnamon 桌面环境的 Arch Linux 发行版,但是后来它了改变初衷,而现在则提供不同的桌面环境:KDE ,GNOME 3(默认) ,MATE ,Cinnamon ,Openbox 和 Xfce。<br />
<br />
*主页: http://www.antergos.com/<br />
*论坛: http://forum.antergos.com/<br />
*IRC: irc://irc.freenode.net/antergos<br />
*Wiki: http://wiki.antergos.com/<br />
*桌面截图: http://www.linuxscreenshots.org/?distro=antergos<br />
<br />
=== Apricity OS ===<br />
<br />
Apricity OS uses the Pamac graphical package manager, PushBullet, Syncthing, the ICE SSB manager, and a modified [[GNOME]] environment. It may be downloaded as a live image, and can be installed graphically.<br />
<br />
* 主页: http://apricityos.com/<br />
* 论坛 http://apricityos.com/forum<br />
* Blog: http://apricityos.com/blog<br />
* IRC: irc://irc.freenode.net/apricityos<br />
* GitHub: https://github.com/agajews/apricityos<br />
<br />
=== ArchAssault ===<br />
<br />
ArchAssault,你爱着 Arch Linux 的每一样东西,但认为是安全专业人员或是黑客使用的。现在支持 i686, x86_64, armv6h, armv7h 构架。你可以使用安装镜像或是只需把协议添加到你正在进行的 Arch Linux 安装中。你根据需要可以很简单的添加或是除去协议,并使你的安装恢复至纯净的 Vanilla 安装器。这里有增长工具列表并且遵守 Arch 标准。<br />
<br />
ARM 线程帮助你构建你梦想中的安全设备,正如市场上别的开源设备一样。项目同时支持一些开源的自动驾驶仪。这个允许你将有效荷载的大脑很容易的装进你的无人驾驶飞机中并且添加能力。<br />
<br />
*主页: https://archassault.org/<br />
*IRC: irc://irc.freenode.net/ArchAssault<br />
*Wiki: http://wiki.archassault.org/<br />
<br />
=== ArchBang ===<br />
<br />
ArchBang 使用小而功能强大的 Openbox 作为图形桌面。它以 Live CD 的形式下载,并基于 Archlinux 并使用 Arch 的软件仓库,而且使用一款非常棒的全屏安装工具。它的名字受到 CrunchBang Linux 的启发,CrunchBang Linux 是一款快速且最小化的同样也使用 Openbox 的 Debian 发行版。<br />
<br />
*主页: http://www.archbang.org/<br />
*论坛: http://bbs.archbang.org/<br />
*IRC: irc://irc.freenode.net/archbang<br />
*Wiki: http://wiki.archbang.org/<br />
*桌面截图: http://www.linuxscreenshots.org/?distro=archbang<br />
<br />
=== BBQLinux ===<br />
<br />
BBQLinux 一款对由安卓开放人员制作,对用户友好的喜欢随时准备被使用的 Linux 发行版。它已经编译好了自动操作和调度程序或是基于自动操作和调度程序的发行版类似于 OmniROM 或者 CyanogenMod。<br />
默认桌面环境是 "MATE"。它使用普通的 Arch 协议,AUR 和 一份 BBQLinux 特别协议。<br />
BBQLinux 可以使用 Live DVD 启动安装,使用我们名为 "BBQLinux Installer" 的图形化安装器进行安装。<br />
<br />
*主页: http://bbqlinux.org/<br />
*IRC: irc://irc.freenode.net/bbqlinux<br />
*桌面截图: http://bbqlinux.org/screenshots<br />
<br />
=== BlackArch Linux ===<br />
<br />
BlackArch Linux 是为渗透性测试和安全研究员准备的发行版。它支持600多种工具并集成多窗口管理器在一张 live ISO 中。BlackArch 的软件包仓库兼容常规的/现有的/你的 Arch 安装。<br />
<br />
*主页: http://blackarch.org/<br />
*IRC:irc://irc.freenode.net/blackarch<br />
*文档: http://blackarch.org/guide.html<br />
<br />
=== Bluestar Linux ===<br />
<br />
Bluestar Linux 目标在于桌面并专注于提供一款对用户友好的 KDE 桌面环境,提供一套完整的图形工具和应用软件。2种版本开箱即用并且都提供全球范围的多语种支持。Bluestar 全能版提供一个完整的开放环境,一个增强型的多媒体,网络,图形和办公工具集。2种版本也有一款相关的版本支持Intel GMA3600 (GMA500)图形处理器,其默认的本地分辨率为1024x600 ,而且有根据设置需要的,不同的分辨率可供选择。虽然还处于开放阶段,但 Bluestar Linux 可以轻松支持日常使用,定期更改及升级已经被证实可靠。更新会在后继版本中加入而且至少一个月两次。<br />
<br />
*主页: http://bluestarlinux.org/<br />
*论坛: http://bluestarlinux.org/index.php?action=forum<br />
*文档: http://bluestarlinux.org/index.php?action=articles<br />
*桌面截图: http://bluestarlinux.org/index.php?action=gallery<br />
<br />
=== Bridge Linux ===<br />
<br />
Bridge Linux 是基于Arch的衍生发行版,提供开箱即用的可工作环境,并且使用原有的 Arch 源和 AUR。这次可能的桌面环境是 LXDE, Openbox, GNOME, Cinnamon, Xfce, 和 KDE。<br />
<br />
*主页: http://millertechnologies.net<br />
*论坛: http://millertechnologies.net/forum<br />
*桌面截图: http://www.linuxscreenshots.org/?distro=bridge<br />
<br />
=== Papyros ===<br />
<br />
Papyros是一个操作系统,它遵守谷歌的材料设计方案,并基于Arch Linux,KDE和Wayland。<br />
<br />
*主页: http://papyros.io/<br />
<br />
=== Evo/Lution Linux ===<br />
<br />
Evo 是基于 Arch Linux 的不可安装的 live CD。它是一款非常简单的基于网络的 Lution-AIS 安装器平台。Lution-AIS 从 Arch 源下载最新的软件包并给系统提供最新的更新。Lution-AIS 是功能强大的命令行安装器,并且提供多样的桌面环境/窗口管理器,显示管理器,网络管理器和启动选项。<br />
<br />
*主页: http://www.evolutionlinux.com<br />
*论坛: http://www.evolutionlinux.com/forums/index.php<br />
*Wiki: http://www.evolutionlinux.info<br />
<br />
=== TalkingArch ===<br />
<br />
TalkingArch 是 Arch Linux 的 live CD/USB 衍生版,经过修改之后包含语音和盲文输出,针对用户是盲人和有视觉障碍的用户。<br />
<br />
*主页: http://talkingarch.tk/<br />
<br />
=== Tux Hat Linux ===<br />
<br />
Tux Hat Linux的是一种轻型AwesomeWM的GNU/Linux LiveCD/DVD/USB ISO<br />
<br />
*主页: http://sourceforge.net/projects/tuxhatlinux/<br />
<br />
== 移植到别的内核和构架 ==<br />
<br />
以下列表所包含的发行版由于使用的内核和硬件构架都已不再使用 Arch Linux [[official repositories|官方软件仓库]] 但大致遵守 [[Arch Linux (简体中文)|Arch 之道]]的发行版。<br />
<br />
=== Arch BSD ===<br />
<br />
Arch BSD 开始于2010年7月,尝试将 pacman 应用到 FreeBSD,为了减轻升级的痛苦和维护系统接口,或者过期的软件包。<br />
遵循 The Arch Way 哲学, Arch BSD 是轻量级的,灵活的,简单的目标在于类 UNIX 系统。<br />
<br />
*主页: http://www.archbsd.net/<br />
*论坛: https://bbs.archbsd.net/<br />
*IRC: irc://irc.freenode.net/archbsd<br />
*Wiki: https://wiki.archbsd.net/<br />
<br />
=== Arch Linux ARM ===<br />
<br />
[https://bbs.archlinux.org/viewtopic.php?id=117251 Arch Linux ARM 有新的统一工作目标是插件应用和 Arch 移动]。<br />
<br />
*主页: http://archlinuxarm.org/<br />
*论坛: http://archlinuxarm.org/forum/<br />
*IRC: irc://irc.freenode.net/archlinux-arm<br />
<br />
=== Arch Linux MIPS ===<br />
<br />
Arch Linux MIPS 是一款用 Arch Linux 源码编译的发行版,目标在于使用最小的必须编译的变化从而能成功的在每秒百万条指令构架的机器上使用的发行版。现在这个发行版可以在机器上执行困难的浮点二进制计算。<br />
<br />
*主页: http://archlinuxmips.org/<br />
*下载: https://github.com/Arch-Linux-MIPS<br />
<br />
=== MSYS2 ===<br />
<br />
''"MSYS2 是一款更新的,现代版本的 MSYS,都使用 Cygwin (POSIX 兼容层) 目标在于更好的本地 Windows软件互操作性。''<br />
<br />
''名字是 Minimal SYStem 2 的缩写,目标是提供方便使用脚本的支持,自动工具,版本控制系统和使用 MinGW-w64 工具组编译本地 Windows 应用软件。''<br />
<br />
''我们想要一种包管理系统提供简单的软件包安装,并且对接 Arch Linux 的 Pacman。它带来了许多强大的特点,例如依赖性的解决和简单的全面系统升级,以及使用编译(makepkg)系统安装软件包。"''<br />
<br />
源码: [http://sourceforge.net/projects/msys2/ MSYS2 | SourceForge.net]<br />
<br />
*主页: http://sourceforge.net/p/msys2/<br />
*论坛: http://sourceforge.net/p/msys2/discussion/<br />
*Wiki: http://sourceforge.net/p/msys2/wiki/<br />
*桌面截图: http://msys2.github.io/<br />
<br />
=== Parabola GNU/Linux ===<br />
<br />
Parabola GNU/Linux 是完全免费的(完全自由)的发行版 [http://www.gnu.org/distros/free-distros.html 获得自由软件基金会批准的]。软件包针对 i686, x86_64, and Loongson 2F (mips64el) 的 CPU 进行优化。<br />
<br />
Parabola 使用 [https://wiki.parabolagnulinux.org/自己的软件库],几乎与 Arch's [[official repositories|官方软件库]]相同,但非自由或有问题的软件包被移除(查看 [https://repo.parabolagnulinux.org/docs/blacklist.txt 黑名单] 里的不同)以及可用的自由软件的替换品。<br />
<br />
*主页: http://parabolagnulinux.org/<br />
*Wiki: http://wiki.parabolagnulinux.org/<br />
*IRC: irc://irc.freenode.net/parabola<br />
<br />
=== UBOS ===<br />
<br />
UBOS focuses on making it easier and less time-consuming to install and maintain web applications on headless, personal servers and IoT devices. It currently exists for x86 and the Raspberry Pi. UBOS has several different release channels for different levels of maturity.<br />
<br />
UBOS only contains those Arch packages that are needed for its purpose. But is also contains a range of web applications that owners of personal servers and/or IoT devices may want to run. Unusually, installation, upgrade, backup and other management operations of the included web applications are part of the "full-stack" tests performed in the UBOS release process.<br />
<br />
Web applications can be fully deployed at a virtual host with a single command. This includes provisioning of databases, configuring web server, restarting daemons etc. depending on the needs of the application. Other single-command management includes undeployment, per-app or per-site or per-host backup and restore, and single-command full-system upgrade (code, data, and configuration of web apps). <br />
<br />
*主页: http://ubos.net/<br />
<br />
== 元发行版 ==<br />
<br />
=== Archiso ===<br />
<br />
[[Archiso]] 一个非常简单的 bash 脚本,它允许构建基于 Arch Linux 的可启动 live CD/DVD/USB 镜像。它使用一款小而简单的源码 bash 脚本集并且正在被积极开放中。archiso 是用于 Arch Linux 生成官方 CD/USB 镜像的工具。它是一款通用工具,所以它有潜力用于生成任何急救系统,安装光碟,特别的 live 系统,以及知道另有他用的人。简单地说,只要包含Arch在内,就能什么都能做到。<br />
<br />
*文档: [[Archiso|Archiso - ArchWiki]]<br />
<br />
== Live 发行版 ==<br />
<br />
=== alphaOS ===<br />
<br />
alphaOS 是一款为 x86-64 构架制作的简单且简约的 Linux 发行版,由 Tomas M 使用 Linux Live Kit 脚本集编译而成。它基于 Arch Linux 并使用 pacman 作为默认包管理器。这款操作系统特征是使用高度可定制性和及其轻便型的 Openbox 窗口管理器。模块化设计,alphaOS 使添加所需的功能变的简单。<br />
<br />
*主页: http://alphaos.tuxfamily.org/<br />
*论坛: http://alphaos.tuxfamily.org/forum/<br />
*桌面截图: [http://alphaos.tuxfamily.org/forum/viewtopic.php?f=13&t=705 forum thread]<br />
<br />
=== Archboot ===<br />
<br />
Archboot 被设计成安装或是急救系统。它同时提供 i686 and x86_64 构架启动盘于一张 CD 。它使用 hwdetect 和不同于官方 Arch Linux 镜像的安装脚本。它使用 iniramfs 运行于 RAM ,就像 squashfs 一样不使用任何特别的文件系统,因此它只在 RAM 安装你的系统。<br />
<br />
*文档: [[Archboot|Archboot - ArchWiki]]<br />
<br />
=== ArchEX ===<br />
<br />
ArchEX,,基于 Arch Linux,是由 C.A. Exton 制作的一款 Linux Live,桌面环境使用的是 LXDE.<br />
<br />
*主页: http://archex.exton.net/<br />
<br />
=== DidJiX ===<br />
<br />
DidJiX 是一款自由开放的源码数字 DJ 软件 Mixxx (http://www.mixxx.org/), 它是基于一款简单的、轻量级的名为 ArchLinux (https://www.archlinux.org/) 的 usb live 系统! DidJiX 是使用 Archiso([[Archiso]]) 项目编译的。<br />
<br />
*主页: http://easy.open.and.free.fr/didjix/<br />
*桌面截图: http://easy.open.and.free.fr/didjix/screenshots.html<br />
<br />
=== PoliArch ===<br />
<br />
PoliArch 是来自意大利的一款用于急救和数据恢复的 live 。<br />
<br />
*主页: http://www.poliarch.org/<br />
*桌面截图: http://www.linuxscreenshots.org/?distro=poliarch<br />
<br />
== 受 Arch 影响的发行版 ==<br />
<br />
===Alpine Linux===<br />
<br />
Alpine Linux 是运行于 RAM 的 linux 发行版。原来是用作小型设备例如路由器,VPN 网关,或是 x86 嵌入式设备的系统。尽管如此,它支持在虚拟服务器下的各种 Linux 客户端操作系统,使它成为一个有吸引力的客户解决方案。虽然 Alpine Linux 可能算不上正真基于 Arch,但它的 [http://git.alpinelinux.org/cgit/aports/tree/main/abuild/APKBUILD 编译系统] 是受 Arch 的激发形成的。 [http://lists.busybox.net/pipermail/busybox/2009-January/068280.html 2][http://wiki.alpinelinux.org/w/index.php?title=Creating_an_Alpine_package&oldid=2701#depends_.26_makedepends 3]<br />
<br />
*主页: http://alpinelinux.org/<br />
*论坛: http://alpinelinux.org/forum/<br />
*IRC: irc://irc.freenode.net/alpine-linux<br />
*Wiki: http://wiki.alpinelinux.org/<br />
<br />
=== Arquetype CRT ===<br />
<br />
''"Our CRT "Continuous Release Term" is a rolling release with pacman as package manager, with a complete software suite ( internet, multimedia files, office, cloud-storage, development... )."''<br />
<br />
*主页: https://arquetype.org/<br />
*论坛: https://arquetype.org/forums/<br />
*桌面截图: https://arquetype.org/sections/screenshots/kde-pictures.html<br />
<br />
=== Chakra ===<br />
<br />
Chakra 是一款以极力揉合 KDE4 为目标的发行版。现行安装是遵循 GTK-free 的。所有 GTK 应用软件以沙河的形式安装 [http://chakraos.org/wiki/index.php?title=Bundles bundles]。项目寻求简单的使用,使用多种自产的图形运用进行安装和维护。警告:它还处于开放阶段,然而已经完全适合每日的应用。预期在不久的将来要改变其基本系统,例如将 Pacman 改为 Akabei 。<br />
<br />
*主页: http://chakraos.org/<br />
*论坛: http://chakraos.org/forum/<br />
*IRC: irc://irc.freenode.net/chakra<br />
*Wiki: http://chakraos.org/wiki/<br />
*桌面截图: http://www.linuxscreenshots.org/?distro=chakra<br />
<br />
=== Enlisy ===<br />
<br />
Enlisy 是针对基于 Pentium 2 及其以上处理器的并对 i686 优化过的 Linux 发行版。它尽可能的让核心化建设简单化。Enlisy 使用它自己的基于 Libpysrc 和 Libpypac 的包管理器及接口,而它也是受到 Arch 的包管理器 Pacman 的启发。 Enlisy 也使用 InitNG 初始化系统。<br />
<br />
*主页: http://www.enlisy.net/en/<br />
<br />
=== Frugalware ===<br />
<br />
''"Frugalware Linux 是为熟悉命令行的中级用户而设计的多用途 Linux 发行版。它基于 Slackware,但使用不同的包管理器系统, Pacman。"''<br />
<br />
:源码: [[Wikipedia:Frugalware|Wikipedia]]<br />
<br />
*主页: http://frugalware.org/<br />
*论坛: http://forums.frugalware.org/<br />
*IRC: irc://irc.freenode.net/frugalware<br />
*Wiki: http://wiki.frugalware.org/<br />
*文档: http://frugalware.org/docs/<br />
*桌面截图: http://frugalware.org/screenshots/<br />
<br />
=== Kademar ===<br />
<br />
Kademar distribution is a complete desktop Linux operating system based on Arch Linux (starting from version 5, previously it was based on Debian GNU/Linux). It comes in two editions - "Escritorio" is a full-featured variant with the latest KDE Plasma desktop, while "Khronos" is a lightweight flavour featuring the Xfce desktop environment.<br />
<br />
*主页: http://www.kademar.org/<br />
*桌面截图: http://www.kademar.org/en/capturas/kademar-linux/<br />
<br />
=== KaOS ===<br />
<br />
''"KaOS 背后的理念是一个紧密集成的滚动和透明的现代桌面发行版,以一个非常具体的目标从头编译。重点在一种桌面环境 (KDE),一种工具包 (Qt),一种构架(x86_64),外加评价和选择最适合的工具和应用软件。所有的工作都是揉合各种软件包,而不是开发新的工具和应用软件。"''<br />
<br />
:源码: [http://kaosx.us/ KaOS A lean KDE distribution]<br />
<br />
*主页: http://kaosx.us/<br />
*论坛: http://kaosx.us/phpBB3/<br />
*IRC: irc://irc.freenode.net/kaosx<br />
*桌面截图: http://kaosx.us/gallery/<br />
<br />
=== LinHES ===<br />
<br />
LinHES ('''Lin'''ux '''H'''ome '''E'''ntertainment '''S'''ystem) 是很大程度上基于 Arch 并围绕 [http://mythtv.org MythTV] 的发行版,它表达的目标是 HES-appliance (家庭娱乐应用)。利用开源软件和现成的硬件,你可以配置一个个人视频录像,自动点唱机,图像浏览器,以及游戏机。用户可以使用差不多 15-20 分钟在一个空白的硬盘驱动器上安装好功能完全的 MythTV 系统。想了解更多的信息,请浏览 [[LinHES]] wiki 页面。<br />
<br />
*主页: http://linhes.org/<br />
*论坛: http://forum.linhes.org/<br />
*Wiki: http://linhes.org/<br />
<br />
=== Manjaro Linux ===<br />
<br />
Manjaro Linux 是用户友好的基于 Xfce, KDE, 和 Openbox 环境的发行版。LXDE, Cinnamon, GNOME, i3, MATE 和 e17 环境也被社区支持。它使用自定义安装程序和附加脚本安装预设置好的开箱即用的工作系统。<br />
<br />
*主页: http://manjaro.org/<br />
*论坛: http://forum.manjaro.org/<br />
*IRC: irc://irc.freenode.net/manjaro<br />
*Wiki: http://wiki.manjaro.org/<br />
<br />
=== Netrunner Rolling ===<br />
<br />
Manjaro-based operating system developed by Blue Systems. Offers customised KDE desktop with extra applications, multimedia codecs, Flash and Java plugins.<br />
<br />
*主页: http://www.netrunner.com/<br />
*论坛: http://forums.netrunner.com/<br />
*桌面截图: http://www.netrunner.com/screenshots/<br />
<br />
=== Mesk Linux ===<br />
<br />
Mesk Linux 是一个以阿拉伯语用户为目标的项目。这个项目的工作也有 Arch 工具和文档的本地化,提供一个综合的可安装 live 介质 (usb, dvds ... )。这个发行版使用 OpenRC。<br />
<br />
*主页: http://mesklinux.org/<br />
*论坛: http://forum.mesklinux.org/<br />
*Wiki: http://wiki.mesklinux.org/</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Arch_Linux_Archive_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409265
Arch Linux Archive (简体中文)
2015-11-15T14:29:11Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Package management (简体中文)]]<br />
[[fr:Arch Linux Archive]]<br />
[[ja:Arch Linux Archive]]<br />
[[en:Arch Linux Archive]]<br />
{{TranslationStatus (简体中文)|Arch_Linux_Archive|2015-11-11|408495}}<br />
{{Related articles start}}<br />
{{Related|Downgrading packages}}<br />
{{Related articles end}}<br />
<br />
Arch Linux 存档('''A'''rch '''L'''inux '''Archive''',''简称 ala''),以前称为 ''Arch Linux 回滚机器(Arch Linux Rollback Machine'',''简称 ARM''),保存了 ''官方仓库快照''、''iso 镜像'' 和 ''引导程序包'' 的历史版本。<br />
<br />
'''用途'''<br />
* 将某个包降级到某个早期版本(最新版本不能用,我需要之前的版本)<br />
* 将所有包恢复到某个指定的历史时刻(所有包都不能用,我要恢复到两个月之前的状态)<br />
* 查找某个历史版本的 ISO 镜像<br />
<br />
== 位置 ==<br />
<br />
Arch Linux 存档目前位于 http://ala.seblu.net/ 。<br />
<br />
此前的下列网址即将关闭,建议不要再使用:<br />
* http://seblu.net/a/archive<br />
* ftp://seblu.net/archlinux/archive<br />
<br />
下列网址已关闭:<br />
* http://seblu.net/a/arm<br />
* ftp://seblu.net/archlinux/arm<br />
<br />
== 目录 ==<br />
<br />
'''存档'''分为下列三个主目录:<br />
<br />
├── iso<br />
├── packages<br />
└── repos<br />
<br />
=== /repos ===<br />
<br />
[http://ala.seblu.net/repos repos] 这个目录包含官方仓库镜像的每日快照,按下例结构组织:<br />
<br />
repos<br />
├── 2013<br />
│ ├── 08<br />
│ │ └── 31<br />
│ │ ├── community<br />
│ │ ├── community-staging<br />
│ │ ├── community-testing<br />
│ │ ├── core<br />
│ │ ├── extra<br />
│ │ ├── gnome-unstable<br />
│ │ ├── kde-unstable<br />
│ │ ├── lastsync<br />
│ │ ├── multilib<br />
│ │ ├── multilib-staging<br />
│ │ ├── multilib-testing<br />
│ │ ├── pool<br />
│ │ ├── staging<br />
│ │ └── testing<br />
│ ├── 09<br />
│ │ ├── 01<br />
│ │ ├── 02<br />
│ │ ├── ...<br />
│ │ ├── 21<br />
│ │ └── 22<br />
│ ├── 10<br />
│ │ ├── 01<br />
│ │ ├── 02<br />
│ │ ├── ...<br />
│ │<br />
│ ├── 11<br />
│ └── 12<br />
├── 2014<br />
│ ├── 01<br />
│ │ ├── 01<br />
│ │ ├── 02<br />
│ │ ├── ...<br />
│ │<br />
│ ├── 02<br />
│ ├── 03<br />
│ ├── ...<br />
│ └── 09<br />
│ ├── 01<br />
│ ├── ...<br />
│ └── 28<br />
├── last<br />
├── month<br />
└── week<br />
<br />
注意: 最下面的三个特定目录('''last'''、'''week''' 和 '''month''')分别链接到'''已同步的最新仓库版本'''、'''本周星期一版本'''和'''本月一日版本'''。<br />
<br />
=== /packages ===<br />
<br />
[http://ala.seblu.net/packages packages] 这个目录包含每个包的所有版本及其相应的数字签名。每个包一个目录,按首字母排序。<br />
<br />
├── packages<br />
│ ├── a<br />
│ │ ├── awesome<br />
│ │ │ ├── awesome-3.5.0-1-i686.pkg.tar.xz<br />
│ │ │ ├── awesome-3.5.0-1-i686.pkg.tar.xz.sig<br />
│ │ │ ├── awesome-3.5.0-1-x86_64.pkg.tar.xz<br />
│ │ │ ├── awesome-3.5.0-1-x86_64.pkg.tar.xz.sig<br />
│ │ │ ├── awesome-3.5.1-1-i686.pkg.tar.xz<br />
│ │ │ ├── awesome-3.5.1-1-i686.pkg.tar.xz.sig<br />
│ │ │ ├── ...<br />
│ │ │ <br />
│ │ ├── ...<br />
│ │ ├── awstats<br />
│ │ └── axel<br />
│ │ <br />
│ ├── b<br />
│ ├── ...<br />
│ └── z<br />
<br />
你可以使用“魔法目录”[http://ala.seblu.net/packages/.all .all] 按包名访问所有包。In a nutshell, all versions of each package in one flat directory. No clear-text listing allowed here.<br />
<br />
├── packages<br />
│ ├── .all<br />
│ │ ├── awesome-3.5.1-1-i686.pkg.tar.xz<br />
│ │ ├── ...<br />
│ │ ├── zsh-5.0.2-3-i686.pkg.tar.xz<br />
│ │ ├── zsh-5.0.2-4-i686.pkg.tar.xz<br />
│ │ └── ...<br />
<br />
An lightweight index, named [http://ala.seblu.net/packages/.all/index.0.xz index.0.xz] is available to list all package in once.<br />
<br />
=== /iso ===<br />
<br />
The [http://ala.seblu.net/iso iso] directory contains official ISO images and bootstrap tarballs sorted by release date.<br />
<br />
├── 2014.09.03<br />
├── 2014.10.01<br />
├── 2014.11.01<br />
├── 2014.12.01<br />
├── 2015.07.01<br />
├── 2015.08.01<br />
├── 2015.09.01<br />
└── 2015.10.01<br />
├── arch<br />
├── archlinux-2015.10.01-dual.iso<br />
├── archlinux-2015.10.01-dual.iso.sig<br />
├── archlinux-2015.10.01-dual.iso.torrent<br />
├── archlinux-bootstrap-2015.10.01-i686.tar.gz<br />
├── archlinux-bootstrap-2015.10.01-i686.tar.gz.sig<br />
├── archlinux-bootstrap-2015.10.01-x86_64.tar.gz<br />
├── archlinux-bootstrap-2015.10.01-x86_64.tar.gz.sig<br />
├── md5sums.txt<br />
└── sha1sums.txt<br />
<br />
== agetpkg ==<br />
<br />
{{Move|Downgrading packages||Talk:Archive#agetpkg}}<br />
{{Out of date|As of October 2015, the fate of the package is discussed in [https://lists.archlinux.org/pipermail/arch-dev-public/2015-October/027480.html arch-dev-public].}}<br />
<br />
{{Pkg|agetpkg}}{{Broken package link|package not found}} is a command line tool used to quickly list/get/install packages stored in the Archive.<br />
<br />
===== Download a previous version of ferm package =====<br />
agetpkg ferm<br />
<br />
===== Download xterm version 296 =====<br />
agetpkg ^xterm 296<br />
<br />
===== List all zsh versions =====<br />
agetpkg -l zsh$<br />
<br />
===== Install all gvfs packages in version 1.26.0 release 3 =====<br />
agetpkg -i gvfs 1.26.0 3<br />
<br />
===== Download all pwgen packages =====<br />
agetpkg -g -a pwgen<br />
<br />
== 常见问题 ==<br />
<br />
=== 如何降级某个包 ===<br />
<br />
You can use [[#agetpkg]] to easily download a specific package version from the Archive.<br />
<br />
Or you can do it manually:<br />
<br />
# Run your favorite internet browser and go to http://ala.seblu.net/packages;<br />
# Go to the package you need and download it;<br />
# Run {{Ic|pacman -U ''pkgname''.pkg.tar.xz}} as root.<br />
<br />
=== 如何恢复所有包到指定日期 ===<br />
<br />
如果想恢复所有包到指定日期(比如2014年3月30日),你必须如下例所示编辑 {{ic|/etc/pacman.conf}},从而让 [[pacman]] 保持在这个时间点并且直接使用指定的服务器:<br />
<br />
{{bc|<nowiki><br />
[core]<br />
SigLevel = PackageRequired<br />
Server=http://ala.seblu.net/repos/2014/03/30/$repo/os/$arch<br />
<br />
[extra]<br />
SigLevel = PackageRequired<br />
Server=http://ala.seblu.net/repos/2014/03/30/$repo/os/$arch<br />
<br />
[community]<br />
SigLevel = PackageRequired<br />
Server=http://ala.seblu.net/repos/2014/03/30/$repo/os/$arch<br />
</nowiki>}}<br />
<br />
或者如下例编辑 {{ic|/etc/pacman.d/mirrorlist}}:<br />
<br />
{{bc|<nowiki><br />
## <br />
## Arch Linux repository mirrorlist <br />
## Generated on 2042-01-01 <br />
##<br />
Server=http://ala.seblu.net/repos/2014/03/30/$repo/os/$arch<br />
</nowiki>}}<br />
<br />
然后同步包数据库以强制降级:<br />
# pacman -Syyuu<br />
<br />
{{注意|混用归档和更新镜像很不安全。万一降级失败,In case of download failure, you can fall-back on an upstream package and you will have packages not from the same epoch as the rest of the system.}}<br />
<br />
== 源码 ==<br />
<br />
* [https://github.com/seblu/archivetools archivetools] -- Software to run an Archive server<br />
* [https://github.com/seblu/agetpkg agetpkg] -- Software to easy downgrade package from the Archive<br />
<br />
== 未来计划 ==<br />
<br />
* Move to official infrastructure.<br />
* Automatic clean-up after a defined amount of time?<br />
* Archive more stuff?<br />
<br />
== 历史 ==<br />
<br />
* New URL and closing the old ARM hierarchy on 2015-10-13. A new software, agetpkg was introduced.<br />
* The original ARM (''Archlinux Rollback Machine'') was closed on 2013-08-18 [https://bbs.archlinux.org/viewtopic.php?pid=1313360#p1313360].<br />
* The new one is hosted on [http://seblu.net seblu.net] since 2013-08-31.</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Android_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409264
Android (简体中文)
2015-11-15T14:28:16Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Development (简体中文)]]<br />
[[Category:Mobile devices (简体中文)]]<br />
[[en:Android]]<br />
[[it:Android]]<br />
[[ja:Android]]<br />
[[ru:Android]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Android notifier}}<br />
{{Related|Android tethering}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Android|2015-11-03|406154}}<br />
<br />
== 浏览安卓设备 ==<br />
<br />
有多种方法浏览安卓设备:<br />
*[[MTP]] 协议可以用USB传输文件。<br />
*[[#Alternative connection methods|其他连接方法]] (比如 FTP, SSH)。<br />
<br />
更高阶的用法,开发、刷机和恢复等:<br />
*[[#连接一台真实设备 —— 安卓调试桥 (ADB)|ADB 工具包]] 广泛用于开发。<br />
*[[#Restoring Android|恢复系统]] 用于刷机和恢复安卓固件(包括 fastboot)。<br />
<br />
== 安卓开发 ==<br />
<br />
在Archlinux中开发安卓程序,需如下三步:<br />
# 安装 Android SDK 核心组件,<br />
# 安装一个或数个 Android SDK 特定平台软件包,<br />
# 安装一个兼容 Android SDK 的 IDE<br />
<br />
=== 安卓 SDK 核心组件 ===<br />
<br />
{{注意|如果运行 64 位操作系统,你需要启用[[Pacman#Repositories|pacman.conf]]中的[[multilib]]软件源。否则,安装时出现的"error: target not found: lib32-zlib"报错信息会烦死你。}}<br />
<br />
在开发安卓程序之前,需要安装安卓 SDK。它由下方三组软件包组成,均可从 [[Arch User Repository (简体中文)|AUR]] 安装:<br />
<br />
# {{AUR|android-sdk}}<br />
# {{AUR|android-sdk-platform-tools}}<br />
# {{AUR|android-sdk-build-tools}}<br />
<br />
软件包会安装到{{Ic|/opt/android-sdk}}。<br />
这个目录需要 root 权限,所以你需要以 root 用户运行 sdk manager,否则你将无法安装/更新/修改 /opt/android-sdk 中的内容。<br />
如果打算以一般用户权限来访问,需要创建一个 android sdk 用户组(名称任意):<br />
<br />
# groupadd sdkusers<br />
<br />
然后将用户添加到这个组中:<br />
<br />
# gpasswd -a <user> sdkusers<br />
<br />
修改目录所属的用户组:<br />
<br />
# chown -R :sdkusers /opt/android-sdk/<br />
<br />
修改目录的权限,使得刚加入组中的用户也能在目录中写入:<br />
<br />
# chmod -R g+w /opt/android-sdk/<br />
<br />
重新登录或者以 <user> 登录终端的用户组变为新建的组:<br />
<br />
$ newgrp sdkusers<br />
<br />
{{注意|除了上述 [[AUR]] 全局安装的方式,还可以参考[https://developer.android.com/sdk/index.html 上游说明]将 SDK 安装到用户 home 目录。}}<br />
<br />
=== 获取 Android SDK 特定平台 API ===<br />
<br />
从[[Arch User Repository (简体中文)|AUR]]安装所需的 Android SDK 特定平台软件包:<br />
<br />
* {{aur|android-platform}} (最新)<br />
* {{aur|android-platform-23}}<br />
* {{aur|android-platform-22}}<br />
* {{aur|android-platform-21}}<br />
* {{aur|android-platform-20}}<br />
* {{aur|android-platform-19}}{{Broken package link|{{aur-mirror|android-platform-19}}}}<br />
* {{aur|android-platform-18}}{{Broken package link|{{aur-mirror|android-platform-18}}}}<br />
* {{aur|android-platform-17}}{{Broken package link|{{aur-mirror|android-platform-17}}}}<br />
* {{aur|android-platform-16}}{{Broken package link|{{aur-mirror|android-platform-16}}}}<br />
* {{aur|android-platform-15}}{{Broken package link|{{aur-mirror|android-platform-15}}}}<br />
* {{aur|android-platform-14}}{{Broken package link|{{aur-mirror|android-platform-14}}}}<br />
* {{aur|android-platform-13}}{{Broken package link|{{aur-mirror|android-platform-13}}}}<br />
* {{aur|android-platform-12}}{{Broken package link|{{aur-mirror|android-platform-12}}}}<br />
* {{aur|android-platform-11}}{{Broken package link|{{aur-mirror|android-platform-11}}}}<br />
* {{aur|android-platform-10}}{{Broken package link|{{aur-mirror|android-platform-10}}}}<br />
* {{aur|android-platform-9}}{{Broken package link|{{aur-mirror|android-platform-9}}}}<br />
* {{aur|android-platform-8}}{{Broken package link|{{aur-mirror|android-platform-8}}}}<br />
* {{aur|android-platform-7}}{{Broken package link|{{aur-mirror|android-platform-7}}}}<br />
* {{aur|android-platform-7}}{{Broken package link|{{aur-mirror|android-platform-7}}}}<br />
* {{aur|android-platform-6}}{{Broken package link|{{aur-mirror|android-platform-6}}}}<br />
* {{aur|android-platform-5}}{{Broken package link|{{aur-mirror|android-platform-5}}}}<br />
* {{aur|android-platform-4}}{{Broken package link|{{aur-mirror|android-platform-4}}}}<br />
* {{aur|android-platform-3}}{{Broken package link|{{aur-mirror|android-platform-3}}}}<br />
* {{aur|android-platform-2}}{{Broken package link|{{aur-mirror|android-platform-2}}}}<br />
<br />
=== 开发环境 ===<br />
<br />
如下所述,基于 IntelliJ IDEA 的 Android Studio 是新的官方开发环境,也可以使用 [[Eclipse]] + 官方不再支持的 ADT 插件,或者结合 NBAndroid 插件使用 [[Netbeans]] 进行开发。<br />
<br />
==== Android Studio ====<br />
<br />
[http://developer.android.com/sdk/installing/studio.html Android Studio] 是基于 [https://www.jetbrains.com/idea/ IntelliJ Idea] 的 Android 开发环境。它替代了原来的 [https://developer.android.com/tools/help/adt.html Eclipse Android Developer Tools] 插件,为开发和调试提供了集成环境。<br />
<br />
你可以通过 [[AUR]] 中的 {{AUR|android-studio}} 软件包下载并安装。若提示缺少 SDK,参考上节获取 Android SDK 特定平台 API。<br />
<br />
{{注意|1=如果使用了除i3wm之外的平铺窗口管理器,可能需要按 [https://code.google.com/p/android/issues/detail?id=57675 这里] 描述的修复方法进行处理。}}<br />
{{注意|1=确保[[Java#Change_default_Java_environment|配置了 Java 环境]] 已正确配置,否则无法启动 android-studio。}}<br />
{{注意|1=如 [https://youtrack.jetbrains.com/issue/IDEA-57233#comment=27-876236 这个] 页面所述,安装 [[Infinality#Installation_2|infinality-bundle]] 并使用 AUR 中 infinality 打完补丁的 openJDK7 ({{AUR|jdk7-openjdk-infinality}})或者 openJDK 8 ({{AUR|jdk8-openjdk-infinality}})能修复 Android Studio 中糟糕的字体渲染问题,也可以使用 [[Unofficial user repositories#infinality-bundle|Infinality 非官方软件库]] 中打完补丁的 OpenJDK8。}}<br />
<br />
{{注意|1=在 {{ic|~/.AndroidStudio1.2/studio64.vmoptions}} 文件中添加 {{ic|1=-Dhidpi=true}} 能修复 HiDPI 缩放情况下文本超出控件边界的问题。}}<br />
<br />
一般会在 Android Studio 图形界面下编译应用,如果需要通过命令行编译应用 (使用诸如 {{ic|./gradlew assembleDebug}}),需要在 {{ic|~/.bashrc}} 中添加:<br />
<br />
export ANDROID_HOME=/opt/android-sdk<br />
<br />
==== Eclipse ====<br />
<br />
{{注意|自 2014-12-08 起,官方已经不再建议使用 ADT 插件,官方的开发环境是 Android Studio。}}<br />
<br />
在 Eclipse 中开发 Android 所需的大部分软件在 AUR 已经有了:<br />
<br />
谷歌官方插件 &ndash; [http://developer.android.com/sdk/eclipse-adt.html Eclipse ADT]:<br />
# {{AUR|eclipse-android}}<br />
<br />
依赖:<br />
# {{AUR|eclipse-emf}}<br />
# {{AUR|eclipse-gef}}<br />
# {{AUR|eclipse-wtp}}<br />
<br />
{{注意|<br />
* 如果你遇到了不可解析的依赖的错误信息,手动安装 [[Java]] 并重试。<br />
* 另外,你也可以通过 eclipse 内置的 "add new software" 方法来安装 ADT(详见 ADT 网站的帮助)。<br />
* 如果实在不行,你可以下载 Android SDK 并使用捆绑的 Eclipse,通常不再会有问题。<br />
* 如果你需要安装不在 AUR 中的额外 SDK 组件,你必须先改变 /opt/android-sdk 中文件的所有者和权限,运行 {{ic|# chgrp -R users /opt/android-sdk ; chmod -R 0775 /opt/android-sdk}} (详细信息可参见 [[File Permissions|文件权限]])。<br />
}}<br />
<br />
在下面设置中设置 Android SDK 路径:<br />
<br />
Windows -> Preferences -> Android<br />
<br />
{{注意|如果 AUR 软件包升级之后插件无法在 Eclipse 中显示出来,eclipse 可能使用了过期缓存。执行一次 {{ic|sudo eclipse -clean}}。如果还是不行,就删除 Eclipse 及其所有插件,删除 {{ic|/usr/share/eclipse}} 再重装。}}<br />
<br />
==== Netbeans ====<br />
<br />
如果想用 Netbeans 作为 Android 开发的 IDE,需要下载 [http://www.nbandroid.org NBAndroid]:<br />
<br />
Tools -> Plugins -> Settings<br />
<br />
添加如下 URL:http://nbandroid.org/updates/updates.xml<br />
<br />
然后到 '''Available Plugins''' 安装 IDE 版本对应的 '''Android''' 和 '''Junit''' 插件,安装后到:<br />
<br />
Tools -> Options -> Miscellaneous -> Android<br />
<br />
设置 SDK 安装路径(默认是 /opt/android-sdk)。这样就行了,现在你可以在 Netbeans 里面创建和开发新的 Android 项目。<br />
<br />
=== 连接一台真实设备 —— 安卓调试桥 (ADB) ===<br />
<br />
{{小贴士|有些设备需要先启用 MTP 才能使用 ADB,而另一些设备需要启用 PTP。}}<br />
<br />
要使用 安卓调试桥(ADB) 在 Arch 下连接真实设备,必须:<br />
<br />
* 安装 {{Pkg|android-tools}}。<br />
* 在手机或设备上启用 USB 调试:<br />
** Jelly Bean (4.2)或更新版本:访问 {{ic|Settings(设置) --> About Phone(关于手机)}},不停点击 “Build Number(版本号)” (约10次),直到弹出消息提示开启了开发者选项。然后访问 {{ic|Settings(设置) --> Developer(开发者选项) --> USB debugging(USB 调式)}} 并启用它。<br />
** 旧版本: 通常能通过 {{ic|Settings(设置) --> Applications (应用程序)--> Development(开发者选项) --> USB debugging(USB调试)}}。勾选后重启手机,确保 USB 调试已启用。<br />
* 安装软件包 {{Pkg|android-udev}},为设备在 {{ic|/dev/}} 中建立正确的节点。<br />
* 将用户加入组 ''adbusers''。 ({{ic|gpasswd -a ''username'' adbusers}})<br />
<br />
如果 [[#Does it work?|ADB 能识别你的设备]] (在IDE中可以看见和访问)就行了,否则见下面的内容。<br />
<br />
==== 手动查找设备 ID ====<br />
<br />
每一个手机供应商都提供了 usb 厂商ID和产品ID,比如 HTC Evo 为:<br />
<br />
vendor id: 0bb4<br />
product id: 0c8d<br />
<br />
连接设备并执行:<br />
<br />
$ lsusb<br />
<br />
应该会出现类似的结果:<br />
<br />
Bus 002 Device 006: ID 0bb4:0c8d High Tech Computer Corp.<br />
<br />
==== 添加 udev 规则 ====<br />
<br />
使用 [http://source.android.com/source/initializing.html#configuring-usb-access Android developer] 的规则,或者下面的模板,并用你的 [VENDOR ID] 和 [PRODUCT ID] 替换里面的值。<br />
然后把这些规则复制到 {{ic|/etc/udev/rules.d/51-android.rules}}:<br />
<br />
{{hc|/etc/udev/rules.d/51-android.rules|2=<nowiki>SUBSYSTEM=="usb", ATTR{idVendor}=="[VENDOR ID]", MODE="0666", GROUP="adbusers"<br />
SUBSYSTEM=="usb",ATTR{idVendor}=="[VENDOR ID]",ATTR{idProduct}=="[PRODUCT ID]",SYMLINK+="android_adb"<br />
SUBSYSTEM=="usb",ATTR{idVendor}=="[VENDOR ID]",ATTR{idProduct}=="[PRODUCT ID]",SYMLINK+="android_fastboot"</nowiki>}}<br />
<br />
再加载刚定义的规则,运行:<br />
<br />
# udevadm control --reload-rules<br />
<br />
==== 配置 adb ====<br />
<br />
除了使用 udev 规则外,也可以创建/编辑 {{ic|~/.android/adb_usb.ini}},里面包含了一个 vendor ID 的列表。<br />
<br />
$ cat ~/.android/adb_usb.ini <br />
0x27e8<br />
<br />
==== 它有效吗? ====<br />
<br />
配置了 udev 规则之后,拔掉设备然后重新连接,再运行:<br />
<br />
$ adb devices<br />
<br />
可以看到类似的结果:<br />
<br />
List of devices attached <br />
HT07VHL00676 device<br />
<br />
现在可以通过 adb 在设备和计算机间传输文件了。使用:<br />
<br />
$ adb push ''<what-to-copy>'' ''<where-to-place>''<br />
<br />
向设备传送文件,使用:<br />
<br />
$ adb pull ''<what-to-pull>'' ''<where-to-place>''<br />
<br />
从设备获取文件。<br />
如果没有找到 '''adb''' 程序,可能是因为没有安装 [[#Android SDK platform API|平台工具]](通常位于{{Ic|/opt/android-sdk/platform-tools/}})及 {{Pkg|android-tools}}(位于{{Ic|/usr/bin/}})。<br />
<br />
如果列表为空(设备没有找到),可能是因为设备上没有启用 USB 调试。可以到 设置 => 应用程序 => 开发 (Settings => Applications => Development) 来启用 USB 调试。Android 4.2 (Jelly Bean) 隐藏了开发者选项菜单,到 设置 => 关于手机 (Settings => About phone),然后点击 Build number (版本号) 7 次来启用它。<br />
<br />
若仍有问题,比如 ''adb'' 显示 {{ic|???????? no permissions}},尝试以 root 权限重启 adb 服务。<br />
<br />
# adb kill-server<br />
# adb start-server<br />
<br />
=== NVIDIA Tegra 平台专用工具 ===<br />
<br />
如果应用程序的目标平台是 NVIDIA Tegra 平台,可以安装 NVIDIA 提供的工具、文档和示例。[http://developer.nvidia.com/category/zone/mobile-development NVIDIA 移动开发者] 提供了两个工具:<br />
<br />
# [http://developer.nvidia.com/tegra-resources Tegra 安卓开发包] 提供了与[http://developer.android.com/sdk/eclipse-adt.html Eclipse ADT]相关的工具(NVIDIA 调试管理器)及文档。<br />
# [http://developer.nvidia.com/tegra-resources Tegra Toolkit] 提供了工具(大部分是 CPU 和 GPU 优化相关),示例和文档。<br />
<br />
因为 NVIDIA 现在需要先注册登录才能下载,所以两者均无法再从 [[AUR]] 获取。<br />
<br />
== 构建 Android ==<br />
<br />
请注意如下说明文档是基于[http://source.android.com/source/building.html 官方 AOSP 构建说明]的。其他基于 Android 的系统,如 CyanogenMod,通常需要额外的步骤。<br />
<br />
=== OS 位数 ===<br />
<br />
只有安卓 2.2.x (Froyo) 和更早的版本需要在 32 位系统中构建。而2.3.x (Gingerbread) 之后,则需要 64 位系统。 <br />
<br />
=== 需要的软件包 ===<br />
<br />
编译任意版本的安卓系统,都需要安装下列软件包:<br />
<br />
* 32位和64位系统:{{Pkg|gcc}} {{Pkg|git}} {{Pkg|gnupg}} {{Pkg|flex}} {{Pkg|bison}} {{Pkg|gperf}} {{Pkg|sdl}} {{Pkg|wxgtk}} {{Pkg|squashfs-tools}} {{Pkg|curl}} {{Pkg|ncurses}} {{Pkg|zlib}} {{Pkg|schedtool}} {{Pkg|perl-switch}} {{Pkg|zip}} {{Pkg|unzip}} {{Pkg|libxslt}} {{Pkg|python2-virtualenv}} {{Pkg|bc}} <br />
<br />
* 仅64位系统:{{Pkg|gcc-multilib}} {{Pkg|lib32-zlib}} {{Pkg|lib32-ncurses}} {{Pkg|lib32-readline}}<br />
<br />
* AUR 软件包:{{Aur|libtinfo}}<br />
<br />
{{注意|由于 ncurses 已经更新到 ncurses6,而 android 预编译的 clang 还依赖于 ncurses5,现在还必须安装 {{Aur|lib32-ncurses5-compat-libs}}。通过<br />
{{ic|ldd prebuilts/clang/linux-x86/host/3.6/bin/clang}} 和 {{ic|`ldd prebuilts/clang/linux-x86/host/3.6/bin/clang}} 能查看还需要哪些库。<br />
}}<br />
<br />
=== Java Development Kit ===<br />
<br />
Android 5 (Lollipop) 可以使用 {{Pkg|jdk7-openjdk}} 编译。<br />
<br />
旧版本 [http://source.android.com/source/initializing.html 需要] '''Oracle JDK''' 才能编译,'''不支持''' OpenJDK。<br />
<br />
* Gingerbread 到 KitKat (2.3 - 4.4) 需要 Java 6,可以通过 [[AUR]] 软件包 {{AUR|jdk6}} 安装,详情参阅 [[Java]]。<br />
* Cupcake 到 Froyo (1.5 - 2.2) 需要 Java 5, Arch Linux 已经不再支持。<br />
<br />
=== 配置构建环境 ===<br />
<br />
按 [https://source.android.com/source/downloading.html Android Downloading the Source guide] 下载 {{ic|repo}} 工具。<br />
<br />
$ mkdir ~/bin<br />
$ export PATH=~/bin:$PATH<br />
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo<br />
$ chmod a+x ~/bin/repo<br />
<br />
创建一个用于构建的目录:<br />
<br />
$ mkdir ~/android<br />
$ cd ~/android<br />
<br />
需要把默认的 python 从 3.X 版切换到 2.X 版:<br />
<br />
$ virtualenv2 venv # 创建一个包含 Virtualenv 的目录 venv<br />
<br />
{{注意|编译时可能报缺少 python 模块,可以通过链接 /usr/lib/python2.7/* 到 ~/android/venv/python2.7/ 来解决,实际路径按照虚拟环境的路径确定。<br />
<br />
激活 Virtualenv,使得 $PATH 指向 Python 2。<br />
<br />
{{Note|虚拟环境仅在当前终端有效。}}<br />
<br />
$ source venv/bin/activate<br />
<br />
=== 下载源代码 ===<br />
<br />
克隆整个代码库。你 '''仅''' 需在初次构建安卓或者切换分支时执行这一步。<br />
<br />
* {{ic|repo}} 有一个 {{ic|-j}} 选项,用法与 {{ic|make}} 的相似。它决定了下载的线程数,你可以根据下载带宽进行调整。<br />
<br />
* 你需要通过 {{ic|-b}} 选项指定要检出的'''分支'''(安卓版本)。若不指定,会检出所谓的'''master 分支'''。<br />
<br />
$ repo init -u https://android.googlesource.com/platform/manifest -b master<br />
$ repo sync -j4<br />
<br />
{{注意|为尽一步减少下载时间,可以像下面使用repo 命令的 -c 开关:<br />
<br />
$ repo sync -j8 -c<br />
<br />
{{ic|-c}} 开关仅同步在 manifest 中指定的分支,它的内容由 {{ic|-b}} 开关中指定的分支或者使用版本库维护者设置的默认分支来决定,。}}<br />
<br />
静候多时。未编译的源代码加上这些代码的 {{ic|.repo}}、{{ic|.git}} 目录,大小会超过 10 GB。<br />
<br />
{{注意|若之后要更新本地的安卓代码,只要进入编译目录,载入 Virtualenv,然后重新同步:<br />
<br />
$ repo sync<br />
}}<br />
<br />
=== 开始构建 ===<br />
<br />
AOSP 中需执行下列命令:<br />
<br />
$ source build/envsetup.sh<br />
$ lunch full-eng<br />
$ make -j4<br />
<br />
如果不添加任何参数运行 '''lunch''',则会被询问想要创建什么样的 build。使用 -j 参e数加一个数字进行并行构建,数值介于CPU核数或线程数的 1 至 2 倍。<br />
<br />
编译很耗时。<br />
<br />
{{注意|确保你有足够的内存,推荐 4GB 以上的内存。Android 会大量使用 /tmp 目录。默认情况下,/tmp 目录所挂载的分区大小是内存的一半,分区满时编译会失败。<br />
* 另外,你也可以不使用 [[Fstab|fstab]] 里的 tmpfs 。<br />
}}<br />
<br />
<br />
{{注意|根据 [https://source.android.com/source/building-running.html#build-the-code Android Building and Running guide]:<br />
"GNU make 使用 -jN 参数处理并行任务,编译时通常会使用界于 1 到 2 倍计算机硬件的线程数。例如,在 dual-E5520 机器上 (2 个 CPU, 每个 CPU 4核,每个核双线程),使用界于 make -j16 到 make -j32 的命令进行编译会最快。"<br />
}}<br />
<br />
=== 测试镜像 ===<br />
<br />
完成之后,运行并测试最终的映像。<br />
<br />
$ emulator<br />
<br />
=== 创建可烧录镜像 ===<br />
<br />
通过下列命令创建可烧录的镜像:<br />
<br />
make -j8 updatepackage<br />
<br />
它会在 '''out/target/product/hammerhead''' (其中的 hammerhead 是设备名)生成一个可烧录的文件.<br />
<br />
== 恢复 Android ==<br />
<br />
{{Expansion}}<br />
<br />
某些情况下,Android 设备刷了某些定制 ROM 后想刷回官方的 Android 固件,可以访问 [http://forum.xda-developers.com/ XDA 论坛] 获取刷机的帮助。<br />
<br />
=== Fastboot ===<br />
<br />
[[official repositories]] 中的 {{Pkg|android-tools}} 软件包提供了 Fastboot(以及[[#Connecting_to_a_real_device_-_Android_Debug_Bridge_.28ADB.29|ADB]])。<br />
<br />
{{注意|Restoring firmwares using {{ic|fastboot}} can be quite tricky, but you might want to browse [http://www.xda-developers.com/ XDA developers forums] for a stock firmware, which is mostly a {{ic|*.zip}} file, but inside of it, comes with the firmware files and {{ic|flash-all.sh}} script. For example, [https://developers.google.com/android/nexus/images Google Nexus] firmwares include {{ic|flash-all.sh}} script or another example could be for OnePlus One - [http://forum.xda-developers.com/oneplus-one/general/guide-return-opo-to-100-stock-t2826541 XDA thread], where you can find firmwares with included {{ic|flash-all.sh}} script.}}<br />
<br />
=== Samsung ===<br />
<br />
Samsung 不支持 fastboot。Odin 比 Heimdall 用起来更容易安全和容易.<br />
<br />
==== Heimdall ====<br />
<br />
[http://glassechidna.com.au/heimdall/ Heimdall] is a cross-platform open-source tool suite used to flash firmware (also known as ROMs) onto Samsung mobile devices and is also known as an alternative to [http://odindownload.com/ Odin]. It can be installed as {{Pkg|heimdall}} or {{AUR|heimdall-git}}.<br />
<br />
The flashing instructions can be found on Heimdall's [https://github.com/Benjamin-Dobell/Heimdall/tree/master/Linux GitHub page] or on [http://forum.xda-developers.com/showthread.php?t=1922461 XDA forums].<br />
<br />
==== Odin (Virtualbox) ====<br />
<br />
It is also possible to restore stock Android on the Samsung devices using [http://odindownload.com/ Odin], but inside the [[VirtualBox]]. For more information, see [http://forum.xda-developers.com/showthread.php?t=758634 XDA thread].<br />
<br />
Arch Linux related steps:<br />
# Install [[VirtualBox]] together with its [[VirtualBox#Extension_pack|extension pack]]. Optionally, install [[VirtualBox#Guest_additions_disc|guest additions]].<br />
# Install your preferred, but compatible with Odin, Windows operating system into a virtual hard drive using VirtualBox. Optionally, install guest additions to the Windows operating system.<br />
# Open VirtualBox settings of your Windows operating system, navigate to '''USB''', then tick (or make sure it is ticked) '''Enable USB 2.0 (EHCI) Controller'''.<br />
# At VirtualBox running Windows operating system, click in the menu bar '''Devices''', then '''USB Devices''', then click on your Samsung mobile device connected to your computer via USB.<br />
<br />
Windows related links:<br />
# Samsung drivers can be downloaded from [http://androidxda.com/download-samsung-usb-drivers here].<br />
# Odin can be downloaded from [https://www.androidfilehost.com/?fid=23501681358557126 here].<br />
# Samsung Android firmwares can be downloaded from [http://www.sammobile.com/firmwares/ here].<br />
<br />
If you want to make sure that everything is working and ready, connect your Samsung device turned on into a Download mode, and open Odin. The white box (a big one at the bottom-left) named '''Message''', should print a line similar to this:<br />
<ID:0/003> Added!!<br />
which means that your device is visible to Odin and is ready to be flashed.<br />
<br />
{{注意|There are no general instructions of restoring stock firmware on Samsung mobile devices. You have to use [https://www.google.com Google] and [http://www.xda-developers.com XDA developers forums] to find a flashing instructions for specific device. For example, this is how the [http://goo.gl/cZLyF8 thread] about the Samsung Galaxy S4 looks like}}<br />
<br />
== 其它连接方法 ==<br />
<br />
=== AirDroid ===<br />
<br />
[http://goo.gl/EZQ9GQ AirDroid] 可以通过网页浏览器访问设备。<br />
<br />
=== FTP ===<br />
<br />
在 Arch 上建立 FTP 服务器并通过手机访问,或者在手机上运行 FTP 服务并在 Arch 上连接。<br />
参阅 [[List of applications/Internet#FTP]]。Android 上有许多 FTP 客户端/服务端应用。<br />
<br />
=== SSH 服务器 ===<br />
<br />
Android 上有很多 SSH 服务器(应用),可以通过 {{ic|scp}} 命令传输文件,参见 [[SSH]].<br />
<br />
=== Samba ===<br />
<br />
See [[Samba]].<br />
<br />
== 技巧和提示 ==<br />
<br />
=== 调试时出现 "Source not found" ===<br />
<br />
一般这时调试器正在单步进入(Step into) Java 代码。而 Android SDK 并不提供 Java 源代码,所以导致了错误。最好的解决方法是设置单步过滤器,不要跳转到(jump into) Java 源代码。单步过滤器默认没有启动,通过如下方式设置:<br />
<br />
Window -> Preferences -> Java -> Debug -> Step Filtering<br />
<br />
可以全选,此外还可以酌情添加 android.* 软件包。以下的论坛贴有更详细信息:<br />
<br />
http://www.eclipsezone.com/eclipse/forums/t83338.rhtml<br />
<br />
=== 在 sd 卡上安装 Linux 发行版 ===<br />
<br />
可以参照这篇 [http://forum.xda-developers.com/showthread.php?t=631389 贴子] 安装 Debian,[http://archlinuxarm.org/forum/viewtopic.php?f=27&t=1361&start=40 archlinuxarm.org上]有在 chroot 环境下安装(与 Android 并存)的详细介绍。<br />
<br />
== 疑难杂症 ==<br />
<br />
=== aapt: No such file or directory ===<br />
<br />
安装工具包含 32 位程序,需要 32 位的库。如果是手动安装 SDK,还需要安装 multilib/{{Pkg|lib32-libstdc++5}} 和 multilib/{{Pkg|lib32-zlib}}。<br />
<br />
=== ValueError: unsupported pickle protocol ===<br />
<br />
一种修复方法:<br />
<br />
rm ~/.repopickle_.gitconfig<br />
<br />
如果不起效,试试这样:<br />
<br />
rm `find /path/to/android-root -name .repopickle_config`</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Acpid_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409263
Acpid (简体中文)
2015-11-15T14:27:28Z
<p>Aaron chen: </p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:简体中文]]<br />
[[Category:Power management (简体中文)]]<br />
[[en:Acpid]]<br />
[[es:Acpid]]<br />
[[it:Acpid]]<br />
[[ja:Acpid]]<br />
[[ru:Acpid]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|ACPI modules}}<br />
{{Related|DSDT}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Acpid|2013-10-13|277906}}<br />
[http://acpid.sourceforge.net/ acpid]是用于处理电源相关事件的守护进程,它非常灵活且易于扩展。它侦听{{ic|/proc/acpi/event}},当某个事件发生时,执行相关程序来处理该事件。这些事件是由某些动作触发的,比如:<br />
* 按下电源按钮<br />
* 按下睡眠/挂起按钮<br />
* 合上笔记本盖子<br />
* 拔下/插上笔记本外接电源<br />
<br />
{{警告|请注意[[Desktop Environment (简体中文)|桌面环境]]比如[[GNOME (简体中文)|GNOME]]倾向于使用自己的电源事件管理方法(独立于acpid),[[systemd (简体中文)|systemd]]的登陆管理器也有它自己的一套管理方法。同时运行多套系统可能产生意想不到的结果,比如,当按下电源键时电脑同时执行挂起和关机;或者当按下睡眠按钮时电脑执行了两次挂起操作。所以,使用多套系统时你应只激活一套系统的电源事件管理方法,以免引起冲突。}}<br />
<br />
== 安装 ==<br />
<br />
{{Pkg|acpid}}在[[Official repositories (简体中文)|官方软件仓库]]中,你可以使用[[pacman (简体中文)|Pacman]]来安装它。<br />
<br />
To have ''acpid'' started on boot, [[systemd#Using units|enable]] {{ic|acpid.service}}.<br />
<br />
== 配置 ==<br />
<br />
{{Pkg|acpid}}预置了许多事件触发行为,比如它定义了当你按下电源按钮时应当发生什么。这些触发行为默认在{{ic|/etc/acpi/handler.sh}}中定义。在{{ic|/etc/acpi/events/anything}})规定:任何侦测到的电源事件都会按照{{ic|/etc/acpi/handler.sh}}中定义的触发行为执行相关动作。<br />
<br />
下面是一个定义触发行为的简单例子。在这个例子中,当按下睡眠按钮时acpid运行命令{{ic|echo -n mem >/sys/power/state}},这将会使你的电脑挂起:<br />
<br />
button/sleep)<br />
case "$2" in<br />
SLPB) echo -n mem >/sys/power/state ;;<br />
*) logger "ACPI action undefined: $2" ;;<br />
esac<br />
;;<br />
<br />
不幸的是计算机上的这些电源事件标识并不统一,比如,在一些计算机上睡眠按钮可能被标识为''SLPB'',而在另一些计算机上为''SBTN''。<br />
<br />
要想确定各种按钮或{{ic|Fn}}快捷键在你的计算机上是如何定义的,以root身份在终端运行: <br />
# journalctl -f<br />
<br />
现在在你计算机上按下电源按钮或睡眠按钮(比如{{ic|Fn+Esc}}),你会得到类似以下的结果: <br />
logger: ACPI action undefined: PBTN<br />
logger: ACPI action undefined: SBTN<br />
<br />
如果这不起作用的话,运行:<br />
# acpi_listen<br />
<br />
或者{{Pkg|openbsd-netcat}}: <br />
$ netcat -U /var/run/acpid.socket<br />
<br />
然后按下电源按钮,你会看到类似以下输出:<br />
power/button PBTN 00000000 00000b31<br />
<br />
{{ic|acpi_listen}}的输出会被作为$1, $2 , $3 & $4参数发送给{{ic|/etc/acpi/handler.sh}}。<br />
举例:<br />
$1 power/button<br />
$2 PBTN<br />
$3 00000000<br />
$4 00000b31<br />
<br />
像你看到的那样,在这个例子中睡眠按钮被识别为''SBTN'',而不是''SLPB''(这是{{ic|/etc/acpi/handler.sh}}中默认定义的标识符)。所以,要想让你的睡眠按钮正常工作的话,你需要编辑{{ic|/etc/acpi/handler.sh}}把''SLPB)''替换为''SBTN)''。 <br />
<br />
参照上面的例子,你应该可以很容易的通过定制{{ic|/etc/acpi/handler.sh}}来根据侦测到的电源时间来执行不同的命令。更多例子可参考下面的[[Acpid_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)#.E5.B0.8F.E6.8A.80.E5.B7.A7 | 小技巧]]部分。<br />
<br />
=== 其它配置方案 ===<br />
<br />
默认所有的电源事件都是交由{{ic|/etc/acpi/handler.sh}}处理的。这是由{{ic|/etc/acpi/events/anything}}规定的:<br />
# Pass all events to our one handler script<br />
event=.*<br />
action=/etc/acpi/handler.sh %e<br />
<br />
尽管这样配置工作起来没有任何问题,但一些用户可能更喜欢使用各自独立的脚本来定义不同的电源事件。下面举例说明了如何使用不同的事件定义文件和行为定义文件:<br />
<br />
作为root,创建以下文件:<br />
{{hc|/etc/acpi/events/sleep-button|2=<br />
event=button sleep.*<br />
action=/etc/acpi/actions/sleep-button.sh %e<br />
}}<br />
<br />
然后建立以下文件:<br />
{{hc|/etc/acpi/actions/sleep-button.sh|2=<br />
#!/bin/sh<br />
case "$3" in<br />
SLPB) echo -n mem >/sys/power/state ;;<br />
*) logger "ACPI action undefined: $3" ;;<br />
esac<br />
}}<br />
<br />
最后,给脚本加上可执行权限: <br />
# chmod +x /etc/acpi/actions/sleep-button.sh<br />
<br />
用这种方法,你可以任意的独立的事件/行为脚本。<br />
<br />
==小技巧==<br />
<br />
{{Tip|一些在这里描述的动作,例如无线网络切换和背光控制,可能已经由驱动直接管理。在这种情况下,您应该查询相应的内核模块。}}<br />
<br />
===脚本示例===<br />
<br />
下面给出的例子可以用在你的{{ic|/etc/acpi/handler.sh}}脚本中,只是在使用的时候记得将事件变量更改为{{ic|acpi_listen}}侦测到的那个。<br />
<br />
实现合上笔记本盖子时使用{{ic|xscreensaver}}锁屏:<br />
<br />
button/lid)<br />
case $3 in<br />
close)<br />
# The lock command need to be run as the user who owns the xscreensaver process and not as root.<br />
# See: man xscreensaver-command. $xs will have the value of the user owning the process, if any.<br />
<br />
xs=$(ps -C xscreensaver -o user=)<br />
if test $xs; then su $xs -c "xscreensaver-command -lock"; fi<br />
;;<br />
<br />
实现合上笔记本盖子时挂起系统并用{{ic|slimlock}}锁屏:<br />
<br />
button/lid)<br />
case $3 in<br />
close)<br />
#echo "LID switched!">/dev/tty5<br />
/usr/sbin/pm-suspend &<br />
DISPLAY=:0.0 su -c - username /usr/bin/slimlock<br />
;;<br />
<br />
实现插拔外接电源时自动设置屏幕亮度(数值可能需要调整,参考{{ic|/sys/class/backlight/acpi_video0/max_brightness}}):<br />
<br />
ac_adapter)<br />
case "$2" in<br />
AC*|AD*)<br />
case "$4" in<br />
00000000)<br />
echo -n 50 > /sys/class/backlight/acpi_video0/brightness<br />
;;<br />
00000001)<br />
echo -n 100 > /sys/class/backlight/acpi_video0/brightness<br />
;;<br />
esac<br />
<br />
=== 音量调整 ===<br />
<br />
下面的一系列脚本是用来控制音量的(假设你用的是[[Advanced Linux Sound Architecture (简体中文)|ALSA]])。用上面讲到的方法找到音量键的标识符,然后替换掉下面文件中的事件标识就可以用在自己电脑上了:<br />
<br />
{{hc|/etc/acpi/actions/volume_up.sh|<nowiki><br />
#!/bin/bash<br />
/usr/bin/amixer set Master 5%+<br />
</nowiki>}}<br />
<br />
{{hc|/etc/acpi/actions/volume_down.sh|<nowiki><br />
#!/bin/bash<br />
/usr/bin/amixer set Master 5%-<br />
</nowiki>}}<br />
<br />
定义事件的文件:<br />
<br />
{{hc|/etc/acpi/events/volume_up|<nowiki><br />
event=button[ /]volumeup<br />
action=/etc/acpi/actions/volume_up.sh<br />
</nowiki>}}<br />
<br />
{{hc|/etc/acpi/events/volume_down|<nowiki><br />
event=button[ /]volumedown<br />
action=/etc/acpi/actions/volume_down.sh<br />
</nowiki>}}<br />
<br />
用于切换静音的配置文件:<br />
<br />
{{hc|/etc/acpi/events/volume_mute|<nowiki><br />
event=button[ /]volumemute<br />
action=/usr/bin/amixer set Master toggle<br />
</nowiki>}}<br />
<br />
=== 关闭笔记本显示器 ===<br />
<br />
下面这个小技巧修改自[http://en.gentoo-wiki.com/wiki/ACPI/Configuration Gentoo Wiki]。把下面的内容添加到{{ic|/etc/acpi/actions/lm_lid.sh}}最后,或者添加到{{ic|/etc/acpi/handler.sh}}的''button/lid''部分。这个配置会实现当合上笔记本盖子时自动切断LCD背光,揭开盖子时自动打开LCD背光。<br />
case $(cat /proc/acpi/button/lid/LID0/state | awk '{print $2}') in<br />
closed) XAUTHORITY=$(ps -C xinit -f --no-header | sed -n 's/.*-auth //; s/ -[^ ].*//; p') xset -display :0 dpms force off ;;<br />
open) XAUTHORITY=$(ps -C xinit -f --no-header | sed -n 's/.*-auth //; s/ -[^ ].*//; p') xset -display :0 dpms force on ;;<br />
esac<br />
<br />
如果你想提高、降低亮度或做其他一些跟X有关的事情,你应当明确指定你的X显示接口以及那个神奇的MIT cookie文件(一个用于对X服务器和其它输入设备进行读写访问的安全凭证)。 <br />
<br />
下面的脚本没有用到XAUTHORITY,使用了sudo:<br />
<br />
case $(cat /proc/acpi/button/lid/LID0/state | awk '{print $2}') in<br />
closed) sudo -u `ps -o ruser= -C xinit` xset -display :0 dpms force off ;;<br />
open) sudo -u `ps -o ruser= -C xinit` xset -display :0 dpms force on ;;<br />
esac<br />
<br />
在一些难缠的硬件上当使用某些版本的[[Xorg (简体中文)|Xorg]]时,{{ic|xset dpms force off}}只会使屏幕变黑并不会关闭屏幕背光。这个bug可以用 {{Pkg|vbetool}}(来自[[Official repositories (简体中文)|official repositories]])来修复。做以下更改:<br />
case $(cat /proc/acpi/button/lid/LID0/state | awk '{print $2}') in<br />
closed) vbetool dpms off ;;<br />
open) vbetool dpms on ;;<br />
esac<br />
<br />
如果显示器只是快速的关闭然后又打开,很可能是xscreensaver自带的电源管理跟''dpms''的设置冲突了。<br />
<br />
=== 获取当前登陆的用户名 ===<br />
你可以使用{{ic|getuser}}函数来获取当前登陆的用户名:<br />
getuser ()<br />
{<br />
export DISPLAY=`echo $DISPLAY | cut -c -2`<br />
user=`who | grep " $DISPLAY" | awk '{print $1}' | tail -n1`<br />
export XAUTHORITY=/home/$user/.Xauthority<br />
eval $1=$user<br />
}<br />
<br />
然后这个函数就可以被用在下面的例子中,它可以在你按下电源按钮时正常的关闭[[KDE (简体中文)|KDE]]:<br />
button/power)<br />
case "$2" in<br />
PBTN)<br />
getuser "$user"<br />
echo $user > /dev/tty5<br />
su $user -c "dcop ksmserver ksmserver logout 0 2 0"<br />
;;<br />
*) logger "ACPI action undefined $2" ;;<br />
esac<br />
;;<br />
<br />
=== ACPI 快捷键 ===<br />
您可以直接编辑{{ic|/etc/acpi/handler.sh}}, 将快捷键反应到ACPI事件, 或者您也可以将这些快捷键指向别的自己定义的一些脚本 (例如: /etc/acpi/hotkeys.sh)<br />
<br />
在这行之下<br />
case "$1" in<br />
<br />
添加如下行的内容:<br />
hkey)<br />
case "$4" in<br />
00000b31)<br />
echo "PreviousButton pressed!"<br />
exailectl p<br />
;;<br />
00000b32)<br />
echo "NextButton pressed!"<br />
exailectl n<br />
;;<br />
00000b33)<br />
echo "Play/PauseButton pressed!"<br />
exailectl pp<br />
echo "executed.."<br />
;;<br />
00000b30)<br />
echo "StopButton pressed!"<br />
exailectl s<br />
;;<br />
*)<br />
echo "Hotkey Else: $4"<br />
;;<br />
esac<br />
;;<br />
<br />
这个 '00000b31' 之类的值就是通过acpi_listen监听到的快捷键的值.<br />
在acpi_listen监听到的值中'hkey VALZ 00000000 00000b31', $4也就是最后部分, 就是区别于其他键的部分.<br />
<br />
并且,我为了控制Exaile音乐播放器写了一个简单的 exailectl 脚本. 因为ACPID是在root级别的守护进程, 所以您需要用下面方式来写控制脚本<br />
sudo -u (用户名) exaile<br />
不然的话,快捷键的动作不会检测到您的用户正在运行的程序,它就会去重新启动另一个程序而不是对当前的程序作出反应.<br />
<br />
==参考==<br />
<br />
* http://acpid.sourceforge.net/ - acpid homepage<br />
* http://www.gentoo-wiki.info/ACPI/Configuration - RIP Gentoo wiki entry - New Gentoo Wiki Archives<br />
* [[ACPI hotkeys (简体中文)|ACPI hotkeys]]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=AMD_Catalyst_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409262
AMD Catalyst (简体中文)
2015-11-15T14:26:57Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Graphics (简体中文)]]<br />
[[Category:X server (简体中文)]]<br />
[[en:AMD Catalyst]]<br />
[[es:AMD Catalyst]]<br />
[[fr:ATI#Catalyst]]<br />
[[it:AMD Catalyst]]<br />
[[ja:AMD Catalyst]]<br />
[[ru:AMD Catalyst]]<br />
{{TranslationStatus (简体中文)|AMD_Catalyst|2015-11-05|406475}}<br />
{{Related articles start (简体中文)}}<br />
{{Related|ATI (简体中文)}}<br />
{{Related|Xorg (简体中文)}}<br />
{{Related articles end}}<br />
AMD的显卡驱动有两种:一是官方私有驱动(catalyst,译为催化剂),二是开源驱动(xf86-video-ati).本文主要介绍私有驱动。<br />
<br />
AMD曾经将“catalyst”驱动命名为“fglrx” ('''F'''ire'''GL''' and '''R'''adeon '''X'''). 现在虽然名为“catalyst”,但内核模块名称依然为“fglrx.ko”. 因此,下文中任何提及fglrx 都是指“内核模块”,而不是指软件包.<br />
<br />
'''官方仓库不再提供Catalyst。''' Catalyst [https://www.archlinux.org/news/ati-catalyst-support-dropped/ 曾被移出Arch官方支持],原因是对质量与开发速度的不满。该项目于2013年4月被再次丢弃,截止现在还没有进一步的消息.<br />
<br />
与开源驱动相比, Catalyst 在2D,3D渲染和电源管理上更胜一筹,但缺乏高效的多显支持.支持设备为 [[wikipedia:Radeon|ATI/AMD Radeon]]显卡,芯片组 R600 及以上(Radeon HD 2xxx或者更新). ''model''名称 (如X1900, HD4850) 与 ''chip''名称 (分别是R580, RV770)间的对照请参见Xorg [http://www.x.org/wiki/RadeonFeature/#index5h2 decoder ring]或者[[wikipedia:Comparison of AMD graphics processing units|这个表格]].<br />
<br />
== 安装 ==<br />
<br />
共有三种途径安装Catalyst。第一种是用[https://aur.archlinux.org/account/Vi0l0/ Vi0L0](Arch非官方Catalyst维护人员)维护的软件库.此库包涵了所有可用的软件包.第二种方式就是通过AUR,Vi0L0提供的PKGBUILDs跟他用于构建他仓库的PKGBUILDs完全一样。最后你还可以直接通过AMD官方下载Catalyst.<br />
<br />
自Catalyst 12.4, AMD已将针对Radeon HD 5xxx 和 Radeon HD 2xxx, 3xxx and 4xxx 显卡驱动分开开发,因此在你选择何种安装方式之前,应查看你的显卡型号。Radeon HD 2xxx, 3xxx and 4xxx 显卡用 '''legacy'''驱动,Radeon HD 5xxx(以及更新的)用普通Catalyst。但无论你需要哪种驱动,都应安装Catalyst utilities。<br />
<br />
{{注意|你会发现,每种安装方式都会进行的一个相同的操作,无论你采用哪种安装方式,你都应了解一些通用的安装说明。}}<br />
<br />
=== 安装Catalyst ===<br />
<br />
==== 从非官方软件库 ====<br />
<br />
如果你不喜欢通过[[AUR]]来安装,则使用此方法。此软件库由我们的[[User:Vi0L0|Vi0l0]]维护。所有的包都经过签名,所以安全方面无需担心。下文提及的很多其他与AMD显卡有关的包也是由Vi0L0维护。<br />
<br />
Vi0L0有三个不同的Catalyst软件库:<br />
* [[Unofficial user repositories#catalyst|catalyst]]:Radeon HD 5xxx及更新的显卡使用的普通Catalyst驱动。包含了最新的 (稳定版或者beta版) Catalyst.<br />
* ''catalyst-stable'':Radeon HD 5xxx及更新的显卡使用的普通Catalyst驱动。包含了最新的稳定版 Catalyst.<br />
* [[Unofficial user repositories#catalyst-hd234k|catalyst-hd234k]]:Radeon HD 2xxx, 3xxx and 4xxx显卡使用的legacy Catalyst驱动.<br />
<br />
要启用上述软件库的话,参见[[Unofficial user repositories]]中所述方法. 记得在{{ic|pacman.conf}}中的'''其他软件库之前'''添加相应软件库.<br />
{{注意|''catalyst''和''catalyst-stable''软件库的URL相同.若要启用''catalyst-stable'',步骤与启用''catalyst''相同,并在{{ic|pacman.conf}}中将{{ic|[catalyst]}}替换成{{ic|[catalyst-stable]}}.如果你需要某个旧版本,这儿也有并且URL也相同,比如''catalyst-stable-13.4''.}}<br />
{{警告|<br />
* legacy Catalyst不支持Xorg Server 1.17. 要使用此驱动的话,参见 [[#Xorg repositories]] 来回滚到 Xorg Server 1.16.<br />
}}<br />
<br />
{{小贴士|有时 catalyst.wirephire.com 因为超出带宽上限而不能提供下载(曾发生过这个问题),或者你到这个服务器的连接很慢.这时,你可以尝试另外的镜像服务器: [http://mirror.rts-informatique.fr/archlinux-catalyst/] (rtsinformatique 提供,法国) 和 [http://mirror.hactar.bz/Vi0L0/] (goll 提供,德国). 不过,这些服务器不保证随时可用.需要的话就反注释掉,多准备一个替代品以防镜像临时不可用也是好习惯.<br />
<br />
Repository mirroring can be easily achieved using {{ic|rsync://mirror.rts-informatique.fr::archlinux-catalyst}}.<br />
}}<br />
<br />
完成后更新pacman数据库并[[pacman|安装]]这些软件包(更多信息参见[[#工具]]):<br />
<br />
* ''catalyst-hook''<br />
* ''catalyst-utils''<br />
* ''catalyst-libgl''<br />
* ''opencl-catalyst'' - 可选,OpenCL支持<br />
* ''lib32-catalyst-utils'' - 可选,64-bit系统上32-bit的OpenGL支持<br />
* ''lib32-catalyst-libgl'' - 可选,64-bit系统上32-bit的OpenGL支持<br />
* ''lib32-opencl-catalyst'' - 可选,64-bit系统上32-bit的OpenCL支持<br />
<br />
如果你是一台Intel/AMD双显卡笔记本,参考下这个:<br />
<br />
* ''catalyst-hook''<br />
* ''catalyst-utils-pxp''<br />
* ''lib32-catalyst-utils-pxp'' - 可选,64-bit系统上32-bit的OpenGL支持<br />
<br />
{{注意|如果pacman询问是否移除'''libgl''',尽管回答"是".}}<br />
<br />
{{警告|软件包catalyst已从Vi0L0的仓库移除,catalyst-hook取而代之.}}<br />
<br />
==== 通过AUR安装 ====<br />
<br />
还可以通过[[AUR]]安装。如果你需为你的电脑进行定制安装,则用此方法。此方法极为繁琐,因为它需要的工作量最大,而且每次内核更新后你得手动更新Catalyst。<br />
<br />
{{警告|若通过AUR安装 Catalyst, 每次内核更新你都得重新编译Catalyst,否则X将不能启动。}}<br />
<br />
在 Vi0L0's 软件库中提到的一切软件包[[AUR]]中也可用::<br />
* {{AUR|Catalyst}}<br />
* {{AUR|Catalyst-generator}}<br />
* {{AUR|Catalyst-hook}}<br />
* {{AUR|Catalyst-utils}}<br />
* {{AUR|Lib32-catalyst-utils}}<br />
<br />
AUR还提供些独家软件包。它含有被称为 ''Catalyst-total''的包和一些beta阶段的软件:<br />
* {{AUR|Catalyst-total}}<br />
* {{AUR|Catalyst-total-pxp}}<br />
* {{AUR|Catalyst-total-hd234k}}<br />
* {{AUR|Catalyst-test}}<br />
<br />
{{AUR|catalyst-total}}包能让AUR用户更为方便。它能构建驱动、内核工具、32位内核工具和{{AUR|catalyst-hook}}(参见[[#工具]]).<br />
<br />
{{AUR|catalyst-total-pxp}}让Catalyst对powerXpress提供实验性支持。<br />
<br />
=== 配置驱动 ===<br />
安装完毕后,要配置 X,让其使用Catalyst。要确保fglrx模块在启动阶段加载,而且要禁用[[kernel mode setting]].<br />
<br />
==== 配置X ====<br />
你需要创建 {{ic|xorg.conf}} 文件来配置X. Catalyst提供了{{ic|aticonfig}}工具来创建和(或)修改此文件。<br />
通过访问{{ic|/etc/ati/amdpcsdb}}文件它几乎能配置显卡的各项参数。了解完整的配置选项{{ic|aticonfig}}可运行:<br />
<br />
# aticonfig --help | less<br />
<br />
{{警告|在将各项配置参数提交到{{ic|/etc/X11/xorg.conf}}之前使用{{ic|--output}}选项,{{ic|/etc/X11/xorg.conf.d}}中的所有内容都会被覆盖。(Use the {{ic|--output}} option before committing to {{ic|/etc/X11/}} as an {{ic|xorg.conf}} file will override anything in {{ic|/etc/X11/xorg.conf.d/}})}}<br />
<br />
{{注意|如果坚持使用{{ic|xorg.conf.d}}下的新配置文件:为了让{{ic|Device}}部分与{{ic|/etc/X11/xorg.conf.d/20-radeon.conf}}相匹配,则使用{{ic|# aticonfig [...] --output}}.但这有一个缺点,很多依赖xorg.conf的{{ic|aticonfig}}选项都无法使用。}}<br />
<br />
现在来配置 Catalyst. 若只有一个显示器,运行:<br />
<br />
# aticonfig --initial<br />
<br />
{{注意| 如果对PowerXpress有疑问,安装 {{AUR|catalyst-total-pxp}}.}}<br />
<br />
注意,若你使用双显示器则使用下面的命令。 此命令会成两个配置文件,第二个显示器的配置文件在第一个前面<br />
<br />
# aticonfig --initial=dual-head --screen-layout=above<br />
<br />
{{注意|了解与设置双显有关的更多信息可查看[[#双屏显示]]}}<br />
<br />
你可与[[Xorg#Sample configurations|Sample Xorg.conf]]上的任何一个示例文件进行对照。<br />
<br />
虽然目前的版本的Xorg启动时能自动探测大多数选项,但不同Xorg版本的默认参数可能会有所不同,最好明确指定一些参数.<br />
<br />
给一个示例配置 (注意) '''仅供参考'''. 标{{ic|#}}必须有,标{{ic|##}}很可能会用到:<br />
<br />
{{hc|/etc/X11/xorg.conf|2=<br />
Section "ServerLayout"<br />
Identifier "Arch"<br />
Screen 0 "Screen0" 0 0 # 0's are necessary.<br />
EndSection<br />
Section "Module"<br />
Load [...]<br />
[...]<br />
EndSection<br />
Section "Monitor"<br />
Identifier "Monitor0"<br />
...<br />
EndSection<br />
Section "Device"<br />
Identifier "Card0"<br />
Driver "fglrx" # Essential.<br />
BusID "PCI:1:0:0" # Recommended if autodetect fails.<br />
Option "OpenGLOverlay" "0" ##<br />
Option "XAANoOffscreenPixmaps" "false" ##<br />
EndSection<br />
Section "Screen"<br />
Identifier "Screen0"<br />
Device "Card0"<br />
Monitor "Monitor0"<br />
DefaultDepth 24<br />
SubSection "Display"<br />
Viewport 0 0<br />
Depth 24 # Should not change from '24'<br />
Modes "1280x1024" "2048x1536" ## 1st value=default resolution, 2nd=maximum.<br />
Virtual 1664 1200 ## (x+64, y) to workaround potential OGL rect. artifacts/<br />
EndSubSection ## fixed in Catalyst 9.8<br />
EndSection<br />
Section "DRI"<br />
Mode 0666 # May help enable direct rendering.<br />
EndSection<br />
}}<br />
<br />
{{注意|一旦升级Catalyst就要通过后面的方法删除{{ic|amdpcsdb}}文件: 关闭X,删除{{ic|/etc/ati/amdpcsdb}},启动X然后运行{{ic|amdcccle}} -否则{{ic|amdcccle}}将会显示错误的Catalyst版本号}}<br />
<br />
''更多信息参考[https://bbs.archlinux.org/viewtopic.php?id=57084 这里].''<br />
<br />
==== 启动时加载模块 ====<br />
禁用{{ic|radeon}}以防其自动加载. 在{{ic|/etc/modprobe.d/modprobe.conf}}里禁用''radeon'',同时保证它不被{{ic|/etc/modules-load.d/}}里的文件加载. 详见[[kernel modules#Blacklisting]]. <br />
<br />
接下来,使模块{{ic|fglrx}}自动加载. 添加{{ic|fglrx}}到{{ic|/etc/modules-load.d/}}下已有的模块文件的新一行,或者创建一个新的模块文件并添加{{ic|fglrx}}.<br />
<br />
==== 禁用KMS ====<br />
<br />
{{注意|使用{{ic|catalyst-utils-pxp}}或者{{ic|catalyst-total-pxp}}的用户不要这样做,因为intel驱动需要KMS.}}<br />
<br />
禁用KMS很重要.由于Catalyst根本不使用[[KMS]],得将其禁用。否则,当系统切换至TTY或在桌面环境下关机时,系统可能会冻结。<br />
<br />
添加 {{ic|nomodeset}} 到你的 [[kernel parameters|内核参数]]. <br />
<br />
==== 检查安装是否成功 ====<br />
<br />
重启电脑并登录, 运行下列命令可查看{{ic|fglrx}}是否正确运行:<br />
<br />
$ lsmod | grep fglrx<br />
<br />
若有输出, 则证明安装成功。可以尝试用 {{ic|$ startx}} 或者显示管理器来启动X (参见 [[Xorg#Running]]).<br />
<br />
下面的命令可以输出你的显卡型号信息:<br />
<br />
$ fglrxinfo<br />
<br />
运行以下命令检查直接渲染模式是否启用:<br />
<br />
$ glxinfo | grep direct<br />
<br />
若显示{{ic|"direct rendering: yes"}},恭喜你,到位了! 若无{{ic|$ glxinfo}}命令,安装{{Pkg|mesa-demos}} package。<br />
<br />
{{注意|对于{{ic|glxgears}},你也可以使用:<br />
$ fgl_glxgears<br />
来测试fglrx.<br />
}}<br />
<br />
{{警告|最近几版Xorg,库函数路径变了,因此即使安装{{ic|libGL.so}}也不一定能正确人加载。请检查GL是否工作,可阅读"故障排除"段落}}<br />
<br />
=== 自己编译内核 ===<br />
<br />
在手动编译的内核上,你必须构建你自己的{{ic|catalyst-$kernel}}包.<br />
<br />
{{注意|如果你讨厌打包或毫无经验,可先阅读[[ABS]]。}}<br />
<br />
#从[[AUR|Catalyst]]上获取{{ic|PKGBUILD}} 和 {{ic|catalyst.install}}文件。<br />
# 编辑PKGBUILD. 两个地方需要修改:<br />
## 将{{ic|1=pkgname=catalyst}} 修改为 {{ic|1=pkgname=catalyst-$kernel_name}},{{ic|$kernel_name}}可以随意取(如:custom, mm)。<br />
## 将{{ic|linux}}的依赖修改为{{ic|$kernel_name}}。<br />
# 构建并安装软件包;运行{{ic|makepkg -i}} 和 {{ic|makepkg}},接着运行 {{ic|# pacman -U pkgname.pkg.tar.gz}}<br />
<br />
{{注意|<br />
*如果在安装有多内核的系统上,你必须为所有内核安装 {{AUR|catalyst-utils}} 包。这不会引起冲突.<br />
<br />
*{{AUR|catalyst-generator}}能为你自动构建{{ic|<nowiki>catalyst-{kernver}</nowiki>}},因此这些步骤根本就可省略。 请参考[[#工具|工具 部分]].}}<br />
<br />
=== PowerXpress support ===<br />
<br />
PowerXpress technology 允许支持dual-graphic功能(以前叫做AMD Hybrid CrossFire technology)的笔记本电脑从集成显卡(IGP) 切换到独立显卡,以增加电池寿命或者实现更好的3D渲染效能。<br />
<br />
为了在archlinux上用上这个功能,你j将需要:<br />
* 从 [[AUR]] 获取并编译 {{AUR|catalyst-total-pxp}} 这个软件包,或者<br />
* 从 [catalyst] 软件仓库安装 '''catalyst-utils-pxp''' 软件包 (如果需要,还有 lib32-catalyst-utils-pxp)。<br />
<br />
对于intel集成显卡的切换,你还需要安装 {{pkg|mesa-libgl}} 软件包和intel的驱动:{{pkg|xf86-video-intel}} 。<br />
{{注意|'''对最新的13.1版本的Catalyst(不是Catalyst legacy) ChrisXY 能够兼容最新的 {{pkg|xorg-server}} (版本 1.13.1), {{Pkg|mesa}} 9.0.1 和 {{pkg|xf86-video-intel}} 2.20.18'''.<br />
<br />
对于所有版本低于13.1的Catalyst(和任何版本的Catalyst legacy),和新的intel驱动存在一些兼容问题。'''最近的{{pkg|xf86-video-intel}}开发版本是2.20.2-2''',所以你可能必须从Arch软件仓库中的最新版本降级(尽管我们推荐你试验性地使用最新的驱动,因为有可能它在你这里没有问题)<br />
<br />
{{pkg|xf86-video-intel}} 2.20.2-2 只兼容 xorg-server 1.12 并且特它是 '''xorg112 repository'''的一部分. 如果你想使用它,你必须降级xorg-server。具体信息见 [[#Xorg repositories]].}}<br />
<br />
现在你可以用下面这些命令切换集成显卡和独立显卡:<br />
<br />
{{bc|1=<br />
# aticonfig --px-igpu #for integrated GPU<br />
# aticonfig --px-dgpu #for discrete GPU<br />
}}<br />
<br />
Just remember that fglrx needs {{ic|/etc/X11/xorg.conf}} configured for AMD's card with {{ic|fglrx}} inside.<br />
要记着对含有 {{ic|fglrx}} 模块的AMD显卡,fglrx需要 {{ic|/etc/X11/xorg.conf}} 这个文件<br />
<br />
你也可以用{{ic|pxp_switch_catalyst}} 这个切换脚本完成一些其他有用的操作:<br />
* Switching {{ic|xorg.conf}} - it will rename {{ic|xorg.conf}} into {{ic|xorg.conf.cat}} (if there is fglrx inside) or {{ic|xorg.conf.oth}} (if there is intel inside) and then it will create a symlink to {{ic|xorg.conf}}, depending on what you chose.<br />
* Running {{ic|aticonfig --px-Xgpu}}.<br />
* Running {{ic|switchlibGL}}.<br />
* Adding/removing {{ic|fglrx}} into/from {{ic|/etc/modules-load.d/catalyst.conf}}.<br />
<br />
Usage:<br />
{{bc|1=<br />
# pxp_switch_catalyst amd<br />
# pxp_switch_catalyst intel<br />
}}<br />
<br />
如果你试图在装有intel驱动的设备上运行X图形界面时遇到问题,你可以尝试强制开启"UXA" acceleration: 在{{ic|xorg.conf}}中写{{ic|Option "AccelMethod" "uxa"}},就象这样:<br />
{{hc|/etc/X11/xorg.conf|2=<br />
Section "Device"<br />
Identifier "Intel Graphics"<br />
Driver "intel"<br />
#Option "AccelMethod" "sna"<br />
'''Option "AccelMethod" "uxa"'''<br />
#Option "AccelMethod" "xaa"<br />
EndSection<br />
}}<br />
<br />
==== 同时运行两个X server(一个使用Intel驱动, 一个使用 fglrx) ====<br />
<br />
因为fglrx容易崩溃(考虑到PowerXpress),主要X server使用Intel驱动,另一个使用需要3D加速的fglrx驱动是个不错的选择。但是在开启第二个X server的时候,简单地从集成显卡 {{ic|aticonfig}} 或者 {{ic|amdcccle}}切换到独立显卡将引发一系列不正常的bugs。<br />
<br />
为了同时运行两个X server(每个用不同的驱动),你首先需要设置出一个可以和Catalyst一起正常工作的X图形环境,然后把它的 {{ic|xorg.conf}}移动到一个临时的地方(比如{{ic|/etc/X11/xorg.conf.fglrx}})。下次X图形环境启动时,它将默认使用intel驱动来代替fglrx。<br />
<br />
在开启第二个使用fglrx的X server,只需要在运行X之前,把{{ic|xorg.conf}} 移回合适的地方({{ic|/etc/X11/xorg.conf}})。这个方法甚至允许你在两个运行的X sessions之间来回切换。当你不需要使用fglrx时,再把 {{ic|xorg.conf}} 移动到其他地方。<br />
<br />
这种方法唯一的坏处是不能使用intel驱动的3D加速。但它的2D却能完全发挥作用。除此之外,它还能给我们一个非常稳定的桌面环境。<br />
<br />
==== 多显示器的PowerXpress笔记本运行于AMD模式时(pxp_switch_catalyst amd)的问题 ====<br />
当PowerXpress笔记本工作于AMD-only模式时(比如设置全部渲染工作交给独显),你有可能会遇到显示器伪影/重复的情况.这是一个已知的问题,发生于7xxxM系列显卡.<br />
<br />
当旋转或者缩放一个显示器时现象会消失,所以你可以使用xrandr来解决这个问题:<br />
<br />
{{bc|1=<br />
xrandr --output HDMI1 --left-of LVDS1 --primary --scale 1x1 --output LVDS1 --scale 1.0001x1.0001<br />
}}<br />
<br />
== Xorg软件库 ==<br />
Catalyst由于其缓慢的更新而被人大为诟病。因升级Xorg而造成两者不兼容是稀松平常的事。也就意味着Catalyst用户要么自己编译Xorg的包要么使用一个只包含Xorg包的回溯软件库,该库中不提供更新版Xorg以确保兼容性。 Vi0L0提供好几个这样的库. <br />
<br />
要启用上述软件库的话,参见[[Unofficial user repositories]]中所述方法. 记得在{{ic|pacman.conf}}中的'''其他软件库之前(甚至在你的catalyst仓库前,如果你有的话)'''添加相应软件库(使用和[[Unofficial user repositories#catalyst|catalyst]]库相同的PGP密匙).<br />
<br />
=== xorg117 ===<br />
Catalyst 不支持 xorg-server 1.18<br />
{{bc|<nowiki><br />
[xorg117]<br />
Server = http://catalyst.wirephire.com/repo/xorg117/$arch<br />
## Mirrors, if the primary server does not work or is too slow:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg117/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg117/$arch<br />
</nowiki>}}<br />
<br />
=== xorg116 ===<br />
Catalyst < 15.7 不支持 xorg-server 1.17<br />
{{bc|<nowiki><br />
[xorg116]<br />
Server = http://catalyst.wirephire.com/repo/xorg116/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg116/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg116/$arch<br />
</nowiki>}}<br />
<br />
=== xorg115 ===<br />
Catalyst < 14.9 不支持 xorg-server 1.16<br />
<br />
{{bc|<nowiki><br />
[xorg115]<br />
Server = http://catalyst.wirephire.com/repo/xorg115/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg115/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg115/$arch<br />
</nowiki>}}<br />
<br />
=== xorg114 ===<br />
Catalyst < 14.1 不支持 xorg-server 1.15.<br />
<br />
{{bc|<nowiki><br />
[xorg114]<br />
Server = http://catalyst.wirephire.com/repo/xorg114/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg114/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg114/$arch<br />
</nowiki>}}<br />
<br />
=== xorg113 ===<br />
Catalyst < 13.6 不支持 xorg-server 1.14.<br />
<br />
{{bc|<nowiki><br />
[xorg113]<br />
Server = http://catalyst.wirephire.com/repo/xorg113/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg113/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg113/$arch<br />
</nowiki>}}<br />
<br />
=== xorg112 ===<br />
Catalyst < 12.10 和 Catalyst Legacy 不支持 xorg-server 1.13.<br />
<br />
{{bc|<nowiki><br />
[xorg112]<br />
Server = http://catalyst.wirephire.com/repo/xorg112/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg112/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg112/$arch<br />
</nowiki>}}<br />
<br />
== 工具 ==<br />
<br />
=== Catalyst-hook ===<br />
{{AUR|Catalyst-hook}} 是一个 [[systemd]] 服务,它在系统关机或重启后重新构建{{ic|fglrx}}模块(如果需要的话,比如内核升级后).<br />
<br />
使用之前请保证 {{Grp|base-devel}} 组和 {{Pkg|linux-headers}} 包(对应你的内核)已经安装.<br />
<br />
只需激活{{ic|catalyst-hook.service}}服务即可:<br />
<br />
# systemctl enable catalyst-hook<br />
# systemctl start catalyst-hook<br />
<br />
你也可以用这个软件包来手动构建{{ic|fglrx}}模块. 在内核更新后运行 {{ic|catalyst_build_module}} 脚本即可:<br />
<br />
# catalyst_build_module all<br />
<br />
'''一些技术细节:'''<br />
<br />
The {{ic|catalyst-hook.service}} is stopping the systemd "river" and is forcing systemd to wait until catalyst-hook finishes its job.<br />
<br />
{{ic|catalyst-hook.service}} 调用 {{ic|catalyst_build_module check}} 来检查是否有必要重构建fglrx.<br />
<br />
{{ic|check}} 检查{{ic|fglrx}}模块是否存在:<br />
<br />
*不存在,将构建它;<br />
<br />
*存在,它将比较两个参数来确定是否有必要重构建{{ic|fglrx}}.<br />
<br />
这里的参数是 {{ic|/usr/lib/modules/<kernel_version>/build/Module.symvers}} 的md5值. (因为我(这里指Vi0L0)发现每一个版本的这个文件都不一样). 第一个参数是现有的 {{ic|Module.symvers}} 文件md5.第二个参数是{{ic|fglrx}}模块构建时 {{ic|Module.symvers}} 文件的md5. 这个参数被{{ic|catalyst_build_module}}脚本编译到{{ic|fglrx}}模块.<br />
<br />
如果参数不同,将编译新的{{ic|fglrx}}模块.<br />
<br />
check 检查整个 {{ic|/usr/lib/modules/}} 目录 ,为安装的所有内核编译fglrx模块(如果需要的话). 如果没有必要构建或重构建,进程将很快结束.<br />
<br />
=== Catalyst-generator ===<br />
<br />
{{AUR|catalyst-generator}}包能构建并安装{{ic|fglrx}}模块,该模块与pacman兼容的{{ic|<nowiki>catalyst-${kernver}</nowiki>}}相适应。与[[#Catalyst-hook]]的区别是必须手动使用此命令,而Catalyst-hook则不需。<br />
<br />
通过[[makepkg]],它能构建{{ic|<nowiki>catalyst-${kernver}</nowiki>}}二进制包并用[[pacman]]安装。{{ic|<nowiki>${kernver}</nowiki>}} 是软件包的目标内核版本 (例如 catalyst-2.6.35-ARCH 适用于 2.6.35-ARCH 内核).<br />
<br />
非特权用户使用{{ic|catalyst_build_module}}来构建并安装{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包。安装时会提示输入root密码。<br />
<br />
简单说一下如何使用此包:<br />
<br />
# root用户: 使用{{ic|catalyst_build_module remove}}。此举会删除无用的{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包。<br />
# 非特权用户: 使用{{ic|<nowiki>catalyst_build_module ${kernver}</nowiki>}}, {{ic|<nowiki>${kernver}</nowiki>}}是指升级过后的内核版本。也可通过{{ic|catalyst_build_module all}}为所有安装的内核构建{{ic|<nowiki>catalyst-{kernver}</nowiki>}}。<br />
# 若要删除{{ic|catalyst-generator}}, 在使用{{ic|catalyst_build_module remove_all}}命令删除catalyst-generator之前最好切换到root用户,'''这会删除所有{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包.'''<br />
<br />
当删除{{ic|Catalyst-generator}}时,{{ic|Catalyst-generator}}不能自动删除那些{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包,这是因为pacman不允许有一个以上的实例同时运行。若在使用{{ic|# pacman -R catalyst-generator}}前忘记运行{{ic|# catalyst_build_module remove_all}},catalyst-generator将会询问删除catalyst-generator自身后要删除哪个{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包。<br />
<br />
Catalyst-generator 是最安全的,最符合KISS原则的,因为:<br />
<br />
# 你可以使用非特权用户来构建包;<br />
# 它在 fakeroot 环境构建包;<br />
# 它不乱丢文件,[[pacman]]知道文件们在哪;<br />
# 你需要做的只是,记得去使用它<br />
<br />
{{注意|在构建 {{ic|<nowiki>catalyst-{kernver}</nowiki>}} 时,若看到下列警告,乃正常情况,不必莫名惊诧:<br />
<br />
'''WARNING:''' Package contains reference to $srcdir<br />
<br />
'''WARNING:''' '.pkg' is not a valid archive extension<br />
}}<br />
<br />
=== OpenCL / OpenGL 开发 ===<br />
<br />
这几年AMD一直在为OpenCL and OpenGL的开发做一套工具集。<br />
<br />
现在AMD在'''"Heterogeneous Computing"'''的旗帜下提供了更多的工具集,幸运的是它们也在Linux下可用。<br />
<br />
在AUR和 [catalyst] 软件仓库,你可以找到这些代表了AMD最重要工作的工具软件包:<br />
<br />
* {{AUR|amdapp-aparapi}}<br />
* {{AUR|amdapp-sdk}}<br />
* {{AUR|amdapp-codexl}}<br />
<br />
APP 这个缩写代表 Accelerated Parallel Processing(加速并行处理)。<br />
<br />
==== amdapp-aparapi ====<br />
AMD的Aparapi是一个用java实现的API,用于并行地表达图像数据,它同时也是一个能把java字节码翻译成能被OpenCL识别的运行时组件。所以它能够被很多种图形处理器(GPU)执行。如果Aparapi在GPU上不能执行,那将在java的线程池中执行。<br />
<br />
更多关于Aparapi的信息:[http://developer.amd.com/tools/heterogeneous-computing/aparapi/ here]。<br />
<br />
==== amdapp-sdk (以前的amdstream) ====<br />
AMD APP 软件开发工具套件,是一个由AMD制作地一套完整的开发平台。它让你能够快速和容易地使用AMD APP技术,使得你的程序得到加速。这个SDK提供了代码实例,技术文档和其他资料,让您可以在你的C\C++程序中使用 OpenCL, Bolt, or C++ AMP等技术实现计算加速。<br />
<br />
从2.8版本开始,amdapp-sdk 提供了 aparapiUtil 和 aparapi 的代码实例。有一个包已经加入到了[catalyst]软件仓库。它依赖于{{AUR|amdapp-aparapi}}。AUR中的软件包让你选择需不需要aparapi's additions。<br />
<br />
2.8 版本没有提供探查功能( Profiler functionality),它已经被移到CodeXL中了。<br />
<br />
关于 AMD APP SDK 的更多信息: [http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/ here]。<br />
<br />
==== amdapp-codexl ====<br />
CodeXL 是一个带有静态OpenCl内核分析器的OpenCL and OpenGL调试器和探查器。它具有GUI界面,是在著名的{{AUR|gdebugger}} 基础上完成的。它只支持 x86_64 系统。<br />
<br />
关于CodeXL的更多信息: [http://developer.amd.com/tools/heterogeneous-computing/codexl/ 这里]。<br />
<br />
== 功能 ==<br />
=== Tear Free Rendering ===<br />
<br />
在'''Catalyst 11.1'''中,很可能是添加了三重缓存和v-sync,''Tear Free Desktop''减少了2D,3D视频应用的屏幕撕裂毛病。但这需要额外的GPU处理。<br />
<br />
要启用'Tear Free Desktop',运行{{ic|amdcccle}},然后设置{{ic|Display Options}} → {{ic|Tear Free}}。<br />
<br />
或以root身份运行:<br />
<br />
# aticonfig --set-pcs-u32=DDX,EnableTearFreeDesktop,1<br />
<br />
若禁用,使用{{ic|amdcccle}}或以root身份运行:<br />
<br />
# aticonfig --del-pcs-key=DDX,EnableTearFreeDesktop<br />
<br />
=== 视频加速 ===<br />
<br />
'''[[wikipedia:Video_Acceleration_API|Video Acceleration API]] (VA API)'''是为基于Linux/UNIX操作系统提供利用GPU加速视频处理的一个开源函数库和应用程序接口规范。启用视频加速后,通过各种入口(VLD, IDCT, Motion Compensation, deblocking)它能加速常用编码标准(MPEG-2, MPEG-4 ASP/H.263, MPEG-4 AVC/H.264, and VC-1/WMV3)视频文件的解码过程(俗称硬解)。<br />
<br />
VA-API在{{AUR|xvba-video}}上有一个私有后端(2009年10月), 它允许使用VA-API的程序通过[[wikipedia:XvBA|XvBA (X-Video Bitstream Acceleration API designed by AMD)]]函数库来充分利用拥有uvd2(第二代通用视频解码单元)芯片组的视频加速功能.<br />
<br />
{{注意|使用 {{ic|catalyst-test}} 或者 {{ic|catalyst-total}} 时不需要安装 {{AUR|xvba-video}} , 因为有已经创建好的符号链接代替.}}<br />
xvba-video和支持XvBA的软件仍还在开发,'''但在大多数情况下它都能很好的工作'''. 通过AUR构建(或通过Vi0L0的仓库直接安装)专有{{AUR|xvba-video}}包,若这个版本对你来说有问题,用{{AUR|libva-xvba-driver}}取代; 并安装{{AUR|mplayer-vaapi}} and {{Pkg|libva}}。然后将视频播放器的视频输出设置为vaapi:gl:<br />
<br />
$ mplayer -vo vaapi:gl movie.avi<br />
<br />
此选项可添加到mplayer的配置文件,参考[[MPlayer]]。<br />
<br />
针对 '''smplayer''':<br />
<br />
Options → Preferences → General → Video (tab) → Output driver: User Defined : vaapi:gl<br />
Options → Preferences → General → Video (tab) → Double buffering '''on'''<br />
Options → Preferences → General → General → Screenshots → Turn screenshots '''off'''<br />
Options → Preferences → Performance → Threads for decoding: '''1''' (to turn off -lavdopts parameter)<br />
<br />
{{注意|如果启用了Tear Free Desktop,则按下列步骤:<br />
Options -> Preferences -> General -> Video (tab) -> Output driver: vaapi<br />
若视频输出中没有'''vaapi:gl'''选项 - 可使用:<br />
'''vaapi''', '''vaapi:gl2''' or 简单的 '''xv(0 - AMD Radeon [[wikipedia:Avivo|AVIVO Video]])'''.<br />
}}<br />
<br />
针对 '''VLC''':<br />
<br />
Tools → Preferences → Input & Codecs → Use GPU accelerated decoding<br />
<br />
它有助于在'''amdcccle'''中启用v-sync:<br />
<br />
3D → More Settings → Wait for vertical refresh = Always On<br />
<br />
{{注意|若使用'''Compiz/KWin''',消除'''画面抖动'''的唯一方法就是切换至'''全屏'''并且 '''关闭Redirected Fullscreen'''。<br />
<br />
使用'''compiz''',需在ccsm的General Options中设置'''Redirected Direct Rendering'''。若此举无效,则将其关闭。'''KWin'''默认关闭此功能,若出现画面抖动则通过{{ic|System Settings}} → {{ic|Desktop Effects}} → {{ic|Advanced}}.}}将"Suspend desktop effects for fullscreen windows"开启或关闭。}}<br />
<br />
=== 显卡/显存频率, 温度, 风扇转速, 超频工具 ===<br />
<br />
{{ic|$ aticonfig --od-getclocks}}可以获知当前显卡/显存频率。<br />
<br />
{{ic|$ aticonfig --pplib-cmd "get fanspeed 0"}}可以获知风扇转速(显卡);<br />
<br />
{{ic|$ aticonfig --odgt}}可以获知显卡温度。<br />
<br />
{{ic|$ aticonfig --pplib-cmd "set fanspeed 0 50"}}可以设置风扇转速,其中查询索引50代表速度百分比。<br />
<br />
若超频或与之相反,则使用图形工具反而相对容易些,如需要qt的'''ATi Overclocking Utility'''。你可以从[http://kde-apps.org/content/show.php/ATI+Overclock?content=47796 这儿]找到(不过它可能过时了).<br />
<br />
更复杂的{{AUR|amdoverdrivectrl}}也能达到此目的,它的主页是[http://sourceforge.net/projects/amdovdrvctrl here]。可通过[https://aur.archlinux.org/packages.php?ID=45298 AUR]或Vi0L0's非官方软件库构建安装包。<br />
<br />
=== 双屏显示 ===<br />
<br />
==== 介绍 ====<br />
<br />
{{警告|由于安装方式的不同,并且每种安装方式需要与其相对应进行配置,因此设置双屏显示并没有特定的方法,你必须根据你自己的需要采用相应的步骤。当然可以多尝试几种方法。'''所以,在修改之前,请务必将你现在能正常使用的{{ic|/etc/X11/xorg.conf}}备份,以便遇到问题时可以从命令行恢复.'''}}<br />
<br />
* 本节讲述如何配置"BIG Desktop"效果。主要是不同尺寸的屏幕如何通过两个不同的输出接口(DVI + HDMI)共享一个显卡。<br />
<br />
* Xinerama解决办法有些不便,尤其是不能与XrandR兼容。因为XrandR对于我们所讲的来说是必须的,所以不使用Xinerama。<br />
<br />
* 双头显示能让你有两个不同的会话(一个屏幕一个)。你可以随心所欲地干任何事情,但不能将窗口从一个屏幕移动到另一个屏幕。若只有一个屏幕,你得在Xorg会话里为Server Layout section的每个会话定义鼠标,具体方法查看:<br />
<br />
[http://support.amd.com/us/kbarticles/Pages/1105-HowCanIConfigureMultip.aspx ATI Documentation]<br />
<br />
==== ATI Catalyst Control Center ====<br />
<br />
ATI的图形工具非常有用,我们将尽可能地使用它。运行下面命令可启用它:<br />
<br />
$ {kdesu/gksu} amdcccle<br />
<br />
{{警告|'''千万不要'''直接使用sudo。 Sudo虽能给予管理员权限,却使用用户账户的信息(如环境变量)。GNOME下使用''gksu'',KDE下使用''kdesu''。}}<br />
<br />
==== 安装 ====<br />
<br />
开始之前,确保你的硬件接插正确,电源开启,而且你得你的硬件属性(2D还是3D屏,屏幕尺寸,刷新率等)。通常情况下,在启动阶段两个显示器都会被识别却不需正确区分先后顺序,而是依赖热插拔功能。尤其在不使用({{ic|/etc/X11/xorg.conf}})配置时。<br />
<br />
首先要让你的桌面环境和X认识你的显示器。为此,要为你两个显示器生成基本的Xorg配置文件:<br />
<br />
# aticonfig --initial --desktop-setup=horizontal --overlay-on=1<br />
<br />
或<br />
<br />
# aticonfig --initial=dual-head --screen-layout=left<br />
<br />
{{注意|{{ic|overlay}}非常重要,因为它能让两个显示器拥有1种(多种)像素。<br />
{{提示|运行{{ic|aticonfig --help}}了解所有可用的命令。}}<br />
<br />
现在可编辑基本的Xorg配置文件(如:添加分辨率)。分辨率一定要正确,尤其是使用不同尺寸的显示器。分辨率在"Screen" section:<br />
<br />
SubSection "Display"<br />
Depth 24<br />
Modes "X-resolution screen 1xY-resolution screen 1" "Xresolution screen 2xY-resolution screen 2"<br />
EndSubSection<br />
<br />
这以后就不需手动编辑{{ic|xorg.conf}},而ATI的图形化工具。重启X,确保正确支持两个显示器和识别屏幕分辨率(两个屏幕相互独立而不是完全一样。<br />
<br />
==== 设置 ====<br />
<br />
现在只需以root身份启动ATI控制中心,在显示菜单设置你需要的选项(下拉菜单中的小箭头)。设置好后重启X就大功造成(你和我都可松口气了,这段翻译有点难度,呵呵)!<br />
<br />
重启X之前,不要忘了核实{{ic|xorg.conf}}。主要是核实"Display"下的"Screen"节, 在"Virtual"行里,两个显示器的分辨率应该一样。"Server Layout"节则是剩下的参数。<br />
<br />
== 卸载 ==<br />
<br />
你可能会因为catalyst不工作或者是想试试开源驱动而要卸载掉catalyst:移除 {{ic|catalyst}} 和 {{ic|catalyst-utils}} 包. 当然你也应该移除 {{AUR|catalyst-generator}}, {{AUR|catalyst-hook}} 和 {{AUR|lib32-catalyst-utils}} 包(如果你安装了的话).<br />
<br />
{{警告|<br />
*你也许需要使用 {{ic|# pacman -Rdd}} 来移除 {{AUR|catalyst-utils}} (和/或 {{AUR|lib32-catalyst-utils}}) 因为它(们)包含了 ''gl'' 相关文件,许多包会依赖他们. 这些依赖关系将在安装{{Pkg|xf86-video-ati}}时被满足.<br />
*你也许会需要移除 {{ic|/etc/profile.d/ati-flgrx.sh}} 和 {{ic|/etc/profile.d/lib32-catalyst}} (如果他们存在), 否则 {{ic|r600_dri.so}} 将会载入失败,你将得不到3D支持.}}<br />
<br />
{{注意|你应该从 {{ic|/etc/pacman.conf}} 移除非官方仓库,然后运行 {{ic|# pacman -Syu}}, 因为那些仓库包含过时的Xorg包(为了兼容{{ic|catalyst}}),而 {{Pkg|xf86-video-ati}} 包需要来自[[Official repositories|官方仓库]]的最新的Xorg包.}}<br />
<br />
按如下步骤:<br />
<br />
* 如果你有 {{ic|/etc/modprobe.d/blacklist-radeon.conf}} ,删除文件或者注释掉文件中的{{ic|blacklist radeon}}.<br />
* 如果你在 {{ic|/etc/modules-load.d}} 下有配置文件要在启动时载入 {{ic|fglrx}} 模块, 删除掉或者注释掉 {{ic|fglrx}} 那一行.<br />
* 记住删除/备份 {{ic|/etc/X11/xorg.conf}}.<br />
* 如果安装了 {{AUR|catalyst-hook}} 包,记得关掉它的systemd服务的自启动.<br />
* 如果你在 [[kernel parameters|内核参数]] 中指定了{{ic|nomodeset}}而现在你打算使用KMS,那么删除{{ic|nomodeset}}.<br />
<br />
* 安装另一个驱动之前记得'''重启''' .<br />
<br />
== 故障排除 ==<br />
<br />
若能启动到命令行,问题很可能出在{{ic|/etc/X11/xorg.conf}}<br />
<br />
可阅读{{ic|/var/log/Xorg.0.log}}或通过下列命令查找线索:<br />
<br />
$ grep '(EE)' /var/log/Xorg.0.log<br />
$ grep '(WW)' /var/log/Xorg.0.log<br />
<br />
若看不懂显示的是什么东东,请先搜索论坛,没有结果的话,可将其提交到[https://bbs.archlinux.org/viewtopic.php?pid=1166052#p1166052/ thread specific to ATI/AMD],注意要提交两者显示的信息。<br />
<br />
=== 运行 atieventsd.service 失败 ===<br />
从 [[official repositories_(简体中文)|官方仓库]] 安装 {{Pkg|acpid}}. 启用并运行acpid[[Daemon_(简体中文)|守护进程]].<br />
<br />
如果还不行, 编辑 {{ic|/usr/lib/systemd/system/atieventsd.service}} ,把 {{ic|acpid.socket}} 改成 {{ic|acpid.service}}.<br />
<br />
=== 无法打开 fglrx_dri.so ===<br />
创建从 {{ic|/usr/lib/xorg/modules/dri/fglrx_dri.so}} 到 {{ic|/usr/X11R6/lib64/modules/dri/fglrx_dri.so}} 或其它需要路径的链接:<br />
<br />
# mkdir -p /usr/X11R6/lib64/modules/dri<br />
# ln -s /usr/lib/xorg/modules/dri/fglrx_dri.so /usr/X11R6/lib64/modules/dri/fglrx_dri.so<br />
<br />
=== 启动 GDM 失败 ===<br />
降级 {{pkg|xorg-server}} 或者试试其它 [[Display manager_(简体中文)|显示管理器]] 比如 [[LightDM]].<br />
<br />
=== 在Wine上3D应用冻结 ===<br />
若在Wine上3D应用挂起,禁用TLS。使用{{ic|aticonfig}}或编辑{{ic|/etc/X11/xorg.conf}}。使用{{ic|aticonfig}}:<br />
<br />
# aticonfig --tls=off<br />
<br />
或以root身份打开{{ic|/etc/X11/xorg.conf}},在''Device''段添加{{ic|Option "UseFastTLS" "off"}}。<br />
<br />
只需来个二选一,然后重启X让其生效。<br />
<br />
=== 视频颜色不正常 ===<br />
<br />
仍然使用{{ic|vaapi:gl}}来防止画面抖动,但这样不会有视频加速:<br />
<br />
* 不使用{{ic|-vo vaapi}}运行'''mplayer'''。<br />
<br />
* 若是'''smplayer''',在Options → Preferences → Advanced → Options for MPlayer → Options:中删除{{ic|-vo vaapi}}。<br />
<br />
此后还可以启动'''smplayer'''的截屏功能。<br />
<br />
=== KWin 与混成 ===<br />
<br />
根据你的显卡,在OpenGL和XRender渲染方式中选择一种更快的。<br />
在某些情况下,XRender还可以解决一些人为的错误(比如调整命令行大小)。<br />
<br />
=== 重启或启动x后,黑屏并且一直不退出 ===<br />
<br />
检查在启动加载器的内核参数行是否添加了{{ic|nomodeset}}(参考 [[#禁用KMS]])。<br />
你如果在使用legacy驱动 ({{ic|catalyst-hd234k}}) 黑屏的话, 尝试降级 xorg-server 到 1.12 (使用 [[#xorg112]] 库).<br />
<br />
==== 错误的ACPI硬件调用 ====<br />
<br />
出现此种错误很可能是fglrx模块与系统的ACPI硬件调用配合不够默契而自身禁用,屏幕也就不会有输出。<br />
<br />
果真那样,运行:<br />
<br />
$ aticonfig --acpi-services=off<br />
<br />
=== 注销后KDM消失 ===<br />
<br />
若使用Catalyst,当注销后你会获取tty1这个控制台而不是KDM的欢迎界面。每次注销后你必须让kdm重启X服务器. 将标题为{{ic|[X-:*-Core]}}段里下面行前的注释删掉:<br />
<br />
{{hc|/usr/share/config/kdm/kdmrc|2=<br />
TerminateServer=True<br />
}}<br />
<br />
<br />
<br />
当前注销KDE后KDM就会出现。<br />
<br />
=== 直接渲染无效 ===<br />
<br />
{{警告|在安装或升级catalyst后却没重启系统,也有可能出现此种错误,因为系统需要加载fglrx.ko模块来让驱动正常工作。}}<br />
若直接渲染有问题,运行:<br />
<br />
$ LIBGL_DEBUG=verbose glxinfo > /dev/null<br />
<br />
从此命令输出的第一行至末尾都与直接渲染无效有关,且非常详细。<br />
<br />
常见错误提示和解决办法:<br />
<br />
libGL error: XF86DRIQueryDirectRenderingCapable returned false<br />
<br />
* Ensure that you are loading the correct agp modules for your AGP chipset before you load the {{ic|fglrx}} kernel module. To determine which agp modules you will need, run {{ic|# hwdetect --show-agp}}. Then open your {{ic|/etc/modules-load.d/fglrx.conf}} and add the agp module on a line '''before''' the {{ic|fglrx}} line.<br />
* 若使用AGP的芯片组,确保加载fglrx模块之前加载正确的agp模块。要确定哪些agp模块,运行{{ic|hwdetect --show-agp}},然后打开{{ic|/etc/modules-load.d}}下的{{ic|fglrx.conf}},将agp模块添加到fglrx行'''之前'''。<br />
<br />
libGL error: failed to open DRM: Operation not permitted<br />
libGL error: reverting to (slow) indirect rendering<br />
<br />
libGL: OpenDriver: trying /usr/lib/xorg/modules/dri//fglrx_dri.so<br />
libGL error: dlopen /usr/lib/xorg/modules/dri//fglrx_dri.so failed<br />
(/usr/lib/xorg/modules/dri//fglrx_dri.so: cannot open shared object file: No such file or directory)<br />
libGL error: unable to find driver: fglrx_dri.so<br />
<br />
* 某些软件未正确安装。在错误提示中,若路径为{{ic|/usr/X11R6/lib/modules/dri/fglrx_dri.so}},彻底注销,然后重新登录。若使用图形化的登录管理器(gdm, kdm, xdm),确保每次登录时{{ic|/etc/profile}}都会被读取。将{{ic|source /etc/profile}}添加到{{ic|~/.xsession}}或{{ic|~/.xinitrc}}通过都达到以上目的(不同的登录管理器修改的文件不一样)。<br />
<br />
* 若路径为{{ic|/usr/lib/xorg/modules/dri/fglrx_dri.so}},试着重装{{AUR|catalyst}}包。<br />
<br />
若错误信息为:<br />
<br />
fglrx: libGL version undetermined - OpenGL module is using glapi fallback<br />
<br />
可能是因为系统装了多个版本的{{ic|libGL.so}}.下面的命令应该得到这样的回显:<br />
<br />
{{hc|$ locate libGL.s|<br />
<br />
/usr/lib/libGL.so<br />
/usr/lib/libGL.so.1<br />
/usr/lib/libGL.so.1.2}}<br />
<br />
系统应只有3个libGL.so文件,若不止(例如{{ic|/usr/X11R6/lib/libGL.so.1.2}}),则将其删除。<br />
<br />
若使用X11R7且系统中有下列文件,系统并不会给出任何错误提示,一定要将他们删除:<br />
<br />
/usr/X11R6/lib/libGL.so.1.2<br />
/usr/X11R6/lib/libGL.so.1<br />
<br />
=== 休眠问题 ===<br />
<br />
==== 视频播放不能从休眠状态中恢复 ====<br />
<br />
若启动了framebuffer,Catalyst不能从挂机状态中恢复。在[[kernel parameters|内核参数]]中添加 {{ic|1=vga=0}} 可禁用framebuffer。<br />
<br />
其他加载器,参考[[#禁用KMS]]。<br />
<br />
=== 系统冻结或硬件锁死 ===<br />
<br />
* 过去,{{ic|radeonfb}}的framebuffer驱动很容易导致这个问题。若内核编译时启用对radeonfb的支持,应换内核看是否能解决此问题。<br />
<br />
* 若退出桌面环境(关机、挂机和切换到tty等)时系统冻结,很可能忘记禁用KMS。(参见 [[#禁用KMS]])<br />
<br />
=== 硬件冲突 ===<br />
<br />
当和某些版本的nForce3芯片组一起使用时,Radeon不能3D加速。目前虽还未找到具体原因,但有资料表明: indicate that it may be possible to get acceleration with this combination of hardware by booting with the drivers from 先用nVIDIA驱动启动到Windows然后再重启系统就可能获得3D加速。在root控制台使用下列命令可识别此问题(会得到与下列相似(使用基于nForce3系统)的输出:):<br />
<br />
{{hc|<nowiki>$ dmesg | grep agp</nowiki>|<br />
agpgart: Detected AGP bridge 0<br />
agpgart: Setting up Nforce3 AGP.<br />
agpgart: aperture base > 4G<br />
}}<br />
<br />
或者还有下面的命令得到如下的回显:<br />
<br />
{{hc|<nowiki>$ tail -n 100 /var/log/Xorg.0.log | grep agp</nowiki>|<br />
(EE) fglrx(0): [agp] unable to acquire AGP, error "xf86_ENODEV"}}<br />
<br />
则就有问题。<br />
<br />
有些资料说在某些情形下降级主板的BIOS可能有助于解决问题,但注意此方法并不是在各种情况下都适用,而且'''方法不对则很可能让显卡报废。'''<br />
<br />
参考[http://bugzilla.kernel.org/show_bug.cgi?id=6350 这个错误报告]。<br />
<br />
=== 播放视频时系统短时间死机 ===<br />
<br />
使用Catalyst可导致此问题。<br />
<br />
当用mplayer,若不定时出现几秒到几分钟的死机。查看日志,若有与下面相似的信息:<br />
<br />
{{hc|/var/log/messages.log|2=<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium [<f8bc628c>] ? ip_firegl_ioctl+0x1c/0x30 [fglrx]<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium [<c0197038>] ? vfs_ioctl+0x78/0x90<br />
Nov 28 18:31:56 pandemonium [<c01970b7>] ? do_vfs_ioctl+0x67/0x2f0<br />
Nov 28 18:31:56 pandemonium [<c01973a6>] ? sys_ioctl+0x66/0x70<br />
Nov 28 18:31:56 pandemonium [<c0103ef3>] ? sysenter_do_call+0x12/0x33<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium =======================<br />
}}<br />
<br />
给内核参数添加{{ic|nopat}}和/或{{ic|nomodeset}}到[[kernel parameters|内核参数]]应该能行<br />
<br />
=== "aticonfig: No supported adaptaters detected" ===<br />
<br />
若得到:<br />
<br />
{{hc|# aticonfig --initial|<br />
aticonfig: No supported adapters detected<br />
}}<br />
<br />
可以在{{ic|etc/X11/xorg.conf}}中设置device,或者复制以前的能工作的 {{ic|/etc/ati/control}} 文件 (推荐 - 这也能解决水印的问题),这可能让Catalyst正常工作.<br />
<br />
从AMD下载先前版本的fglrx,使用{{ic|--extract driver}}参数运行. 文件将提取到{{ic|driver/common/etc/ati/control}}. 用它覆盖原来的control文件后重启X. 你可以试试不同版本的.<br />
<br />
设置型号的方法:在{{ic|/etc/X11/xorg.conf}}将device段设置为:<br />
<br />
{{hc|/etc/X11/xorg.conf|<br />
Section "Device"<br />
Identifier "ATI radeon '''****'''"<br />
Driver "fglrx"<br />
EndSection<br />
}}<br />
<br />
此处{{ic|****}}为设备型号(6870 for the HD 6870的显卡为6870,APU E-350为6310,通过网络是很容易查到的).<br />
<br />
Xorg启动后很可能使用{{ic|amdcccle}}而不是{{ic|aticonfig}}。这里会有一个"AMD不支持硬件"水印。<br />
<br />
用下面脚本可将此水印删除:<br />
<br />
#!/bin/sh<br />
DRIVER=/usr/lib/xorg/modules/drivers/fglrx_drv.so<br />
for x in $(objdump -d $DRIVER|awk '/call/&&/EnableLogo/{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6}'); do<br />
sed -i "s/$x/\x90\x90\x90\x90\x90/g" $DRIVER<br />
done<br />
<br />
然后重启。<br />
<br />
=== 让chromium支持WebGL ===<br />
<br />
在Google的Chromium/Chrome浏览器里,Linux的Catalyst驱动被列入了黑名单。参见 [[Chromium#WebGL]] .<br />
<br />
=== 用Adobe的flashplugin观看flash,画面迟滞或冻结 ===<br />
<br />
编辑:<br />
<br />
{{hc|/etc/adobe/mms.cfg|2=<br />
#EnableLinuxHWVideoDecode=1<br />
OverrideGPUValidation=true<br />
}}<br />
<br />
如果你使用KDE,请确保 系统设置->工作空间外观与行为->桌面效果->高级 里,"为全屏窗口挂起桌面特效" 没有勾选.<br />
<br />
=== GNOME3中移动窗口延迟/很慢 ===<br />
你可以试试这么做,有报告称大多数情况下此方法有效。<br />
<br />
将下面行添加到{{ic|~/.profile}}或{{ic|/etc/profile}}:<br />
<br />
export CLUTTER_VBLANK=none<br />
<br />
重启X或操作系统。<br />
<br />
=== 在1920x1080分辨率下不能全屏(欠扫描,屏幕周围有黑边) ===<br />
<br />
这经常会在使用HDMI连接显示器/电视时发生.<br />
<br />
这似乎是AMD/ATI为适应所有HDTV的一项新功能,可以在amdccle中调整.<br />
<br />
使用amdcccle(图形界面)你可以选择要修改的显示输出,将欠扫描设置成0% (aticonfig默认15%欠扫描). (至少)版本14.10有时也会出现显示调整的下面没有欠扫描的滑块的情况.(It is possible as well that the underscan slider won't show under the display's adjustments, as sometimes in (at least) version 14.10.)<br />
<br />
这不是永久的配置,重启X,重启系统,挂起后唤醒甚至切换tty之后都会失效.<br />
<br />
要使这成为永久配置的话,你需要以root身份在console下使用aticonfig来调整欠扫描设置,或者手动编辑 {{ic|/etc/ati/amdpcsdb}} (也是以root身份)<br />
<br />
'''用aticonfig的方法:'''<br />
<br />
# aticonfig --set-pcs-u32=MCIL,DigitalHDTVDefaultUnderscan,0<br />
<br />
改变设置后重启.<br />
<br />
新版本的话(比如12.11), 要是ccc总不能保存过扫描设置,你可以试试:<br />
<br />
# aticonfig --set-pcs-u32=MCIL,TVEnableOverscan,0<br />
<br />
'''手动编辑/etc/ati/amdpcsdb的方法:'''<br />
<br />
在 {{ic|[AMDPCSROOT/SYSTEM/MCIL]}} 之下的任意位置添加<br />
<br />
# DigitalHDTVDefaultUnderscan=V0<br />
<br />
新版本的话(比如12.11), 要是ccc总不能保存过扫描设置,你可以试试:<br />
在 {{ic|[AMDPCSROOT/SYSTEM/MCIL]}} 之下找到这一行<br />
<br />
# TVEnableOverscan=V1<br />
<br />
然后把它变成<br />
<br />
# TVEnableOverscan=V0<br />
<br />
改变设置后重启.<br />
<br />
{{note|也许你会发现,无论你怎么干,登录/注销/重启后, {{ic|/etc/ati/amdpcsdb}} 总是被覆写/还原, 于是你的修改就不见了 _(:з」∠)_.(You might find that the file /etc/ati/amdpcsdb will be overwritten and revert no matter what you do as user or as root even with log in/log out/reboot, ergo the modification will not stick.)<br />
所以你得在fglrx没运行的时候改它.<br />
可以试着重启进入什么不需要运行fglrx的"安全模式"什么的,或者是直接进console模式}}<br />
<br />
'''应对措施:'''<br />
要是因某些原因你不想动ATI的配置文件,你可以设置面板的位置与分辨率来规避问题<br />
以普通用户运行:<br />
<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,positionX:0<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,positionY:0<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,sizeX:1920<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,sizeY:1080<br />
<br />
{{ic|DISPLAYTYPE}}代表你想改的显示器,比如"dfp9".<br />
用如下命令获得你的 {{ic|DISPLAYTYPE}} :<br />
<br />
# xrandr --current<br />
<br />
如果没启用RandR的话,你可以用这个:<br />
<br />
# aticonfig --query-monitor<br />
<br />
也许需要用显示开关或 DISPLAY 变量来设置适当的显示/屏幕(比如 :0.1).<br />
<br />
这将告诉你目前哪一个显示正连接着或断开着,以及它的详情<br />
<br />
这个应对措施不是永久配置,不过是个让面板及上边内容看起来合适的方便快捷的方法<br />
<br />
{{note|新版驱动不应再使用{{ic|<nowiki>aticonfig --set-pcs-val=MCIL,DigitalHDTVDefaultUnderscan,0</nowiki>}}, ATI声明过这已被弃用并即将被移除.}}<br />
<br />
用 {{ic|<nowiki>aticonfig --help | grep set-pcs-val</nowiki>}} 来阅读ATI的说明.<br />
<br />
=== 双屏设置: 关于加速,OpenGL,合成,效能的一般问题 ===<br />
试着禁用 xinerama 和 xrandr12. 如下:<br />
<br />
输入:<br />
# aticonfig --initial<br />
# aticonfig --set-pcs-str="DDX,EnableRandR12,FALSE"<br />
然后重启系统. 在 {{ic|/etc/X11/xorg.conf}} 中检查 xinerama 是不是被禁用了, 如果没有,禁用它,然后重启系统.( In /etc/X11/xorg.conf check that xinerama is disabled, if it's not disable it and reboot your system. )<br />
<br />
接下来运行{{ic|amdcccle}},如下: amdcccle→显示管理→多屏幕显示→以display(s) 2多屏显示桌面(amdcccle->display manager->multi-display->multidisplay desktop with display(s) 2. ).<br />
<br />
再次重启,再按你的想法设置显示.<br />
<br />
=== 禁用VariBright功能 ===<br />
[http://support.hp.com/vn-en/document/c02848104 Vari-Bright] 动态调整显示面板用电量以节能.<br />
输入以下命令以禁用 VariBright:<br />
# aticonfig --set-pcs-u32=MCIL,PP_UserVariBrightEnable,0<br />
<br />
=== Hybrid/PowerXpress: 关掉独立GPU ===<br />
当你使用 {{AUR|catalyst-total-pxp}} 或 catalyst-utils-pxp 时,你也许会发现切换到集成GPU时,独立GPU仍在工作,又耗电又使得系统温度很高. <br />
<br />
对于集显是intel的话你可以通过 {{ic|vgaswitcheroo}} 来关掉独立GPU.<br />
不过很不幸有些时候不行...<br />
<br />
然后这时你可以试试 {{Pkg|acpi_call}}. MrDeepPurple准备好了脚本来完成这个任务.脚本在启动和恢复系统的时候通过systemd服务调用.<br />
这是他的脚本:<br />
#!/bin/sh<br />
libglx=$(/usr/lib/fglrx/switchlibglx query)<br />
modprobe acpi_call<br />
if [ "$libglx" = "intel" ]; then<br />
echo '\_SB.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call<br />
fi<br />
<br />
=== 从X会话切换到TTY黑屏/低分辨率TTY ===<br />
接受这个"功能"吧,这出现在catalys 13.2 beta,解决方法是使用{{ic|1=vga=}}内核选项,比如{{ic|1=vga=792}}。<br />
使用<br />
$ hwinfo --framebuffer<br />
来得到支持的分辨率列表<br />
选择最适合你的分辨率,粘贴到启动引导器的内核行,比如 {{ic|1=vga=0x03d4}}<br />
<br />
=== 从X会话切换到TTY黑屏,背光并没有关闭 ===<br />
使用 [[uvesafb]] 作为 framebuffer 驱动. 而且, {{ic|uvesafb}} 可以为 TTY 设置任意分辨率.<br />
<br />
=== 切换TTY后切换回X会话时,只有一个带鼠标的黑屏 ===<br />
如果你遇到了这个bug的话,试着添加<br />
Option "XAANoOffscreenPixmaps" "true"<br />
到你的 xorg.conf 的 'Device' 部分.<br />
<br />
同时, 确认已安装有 [[Polkit#Authentication agents|polkit 认证代理]] 并正在运行, 因为这种情况可能会在某程序想要请求密码但没有认证代理来显示密码对话框时出现.<br />
<br />
=== 30 FPS / Tear-Free / V-Sync bug ===<br />
这个Bug发生于Catalyst 13.6 beta, 到现在(13.9)还没修复.<br />
<br />
激活 "Tear Free"(防撕裂) 功能之后,所有新启动的OpenGL程序都出现延迟,常表现为只有30 FPS,复合桌面环境也是.("After enabling "Tear Free" functionality every freshly started OpenGL application is lagging, often generates only 30 FPS, it also touches composited desktop.")<br />
<br />
M132找到一个解决方法.在 "AMD Catalyst Control Center" (amdcccle) 里完成这些操作:<br />
<br />
1. 开启 Tear-Free, 这将设置 3D V-Sync 为"总是开启".<br />
2. 设置 3D V-Sync 为"总是关闭".<br />
3. 确认 Tear-Free 仍为"开启".<br />
4. 重启X/重登录.<br />
<br />
这在KDE 4.11.x下有效.M132的建议: "试着关闭 "Detect refresh rate" ,并为复合插件("Composite plugin")指定显示器刷新率."<br />
<br />
=== 背光调节不起效 ===<br />
如果你的背光调节有问题, 你可以试试:<br />
# aticonfig --set-pcs-u32=MCIL,PP_PhmUseDummyBackEnd,1<br />
一些用户报告说这导致FPS降低.要恢复默认的话:<br />
# aticonfig --set-pcs-u32=MCIL,PP_PhmUseDummyBackEnd,0<br />
[http://ati.cchtml.com/show_bug.cgi?id=711 更多信息见此]<br />
<br />
=== 使用 plasma 时 Chromium 出现毛刺(glitching) ===<br />
添加 --disable-gpu 参数来启动 chromium, 比如,对 /usr/share/applications/chromium.desktop, 改成这样:<br />
# cat /usr/share/applications/chromium.desktop | grep -i exec<br />
Exec=chromium %U --disable-gpu<br />
<br />
== 参见 ==<br />
<br />
* [http://wiki.cchtml.com/index.php/Main_Page Unofficial Wiki for the ATI Linux Driver]<br />
* [http://ati.cchtml.com/query.cgi Unofficial ATI Linux Driver Bugzilla]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Netctl_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409261
Netctl (简体中文)
2015-11-15T14:25:27Z
<p>Aaron chen: </p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:简体中文]]<br />
[[Category:Networking (简体中文)]]<br />
[[cs:Netctl]]<br />
[[en:Netctl]]<br />
[[es:Netctl]]<br />
[[fr:Netctl]]<br />
[[it:Netcfg]]<br />
[[ja:Netctl]]<br />
[[ru:Netctl]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Network Configuration (简体中文)}}<br />
{{Related|Wireless network configuration (简体中文)}}<br />
{{Related|NetworkManager (简体中文)}}<br />
{{Related|Wicd (简体中文)}}<br />
{{Related|Network bridge (简体中文)}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Netctl|2015-06-04|376935}}<br />
Netctl 是基于命令行的网络管理器,支持场景配置。它是 Arch Linux 网络管理方面的原生项目。<br />
<br />
==安装==<br />
从[[Official repositories (简体中文)|官方软件仓库]]安装{{Pkg|netctl}} 软件包。<br />
下表列出了 netctl 的可选依赖包<br />
{| class="wikitable"<br />
! Feature<br />
! Dependency<br />
! netctl program <br /> (if relevant)<br />
|-<br />
| Automatic wireless connections || {{Pkg|wpa_actiond}} || {{ic|netctl-auto}}<br />
|-<br />
| Automatic wired connections || {{Pkg|ifplugd}} || {{ic|netctl-ifplugd}}<br />
|-<br />
| WPA || {{Pkg|wpa_supplicant}} ||<br />
|-<br />
| DHCP || {{Pkg|dhcpcd}} or {{Pkg|dhclient}} ||<br />
|-<br />
| Wifi menus || {{Pkg|dialog}} ||<br />
|-<br />
| PPPoE || {{Pkg|ppp}} ||<br />
|-<br />
|}<br />
<br />
<br />
<br />
{{警告|请使用{{ic|1=systemctl --type=service}}确保其它可以配置网络的服务都没有运行,同时使用多个网络配置工具会导致冲突。}}<br />
<br />
==使用==<br />
<br />
建议用户使用前阅读如下文档:<br />
*[https://github.com/joukewitteveen/netctl/blob/master/docs/netctl.1.txt netctl]<br />
*[https://github.com/joukewitteveen/netctl/blob/master/docs/netctl.profile.5.txt netctl.profile]<br />
*[https://github.com/joukewitteveen/netctl/blob/master/docs/netctl.special.7.txt netctl.special]<br />
<br />
==配置==<br />
<br />
{{ic|netctl}} 使用配置文件来管理网络连接,并按需自动或手动启动不同的操作模式<br />
<br />
===编辑配置===<br />
''netctl''的配置文件保存在 {{ic|/etc/netctl/}} 。一些配置文件的示例位于 {{ic|/etc/netctl/examples/}}。通用的配置项包括:<br />
* ethernet-dhcp<br />
* ethernet-static<br />
* wireless-wpa<br />
* wireless-wpa-static<br />
<br />
若要使用上述示例配置文件,只需将其从 {{ic|/etc/netctl/examples/}} 复制到 {{ic|/etc/netctl/}}。参见下述 配置示例。编辑配置文件所需的首要参数是网络''端口(interface)'',详阅 网络配置 设备名称。<br />
<br />
{{Tip|<br />
如要配置无线网络,可以root身份运行 {{ic|wifi-menu -o}} 来自动在 {{ic|/etc/netctl/}} 中生成配置文件。<br />
如要在有线网络接口上启用静态IP,并忽略线缆连接状况,可以在配置文件中添加 {{ic|SkipNoCarrier=yes}} 配置项<br />
}}<br />
<br />
在创建好你自己的配置文件之后,可以尝试运行(仅需写出文件名,不包含完整路径):<br />
<br />
# netctl start ''profile''<br />
<br />
如果上述命令出错,可使用 {{ic|journalctl -xn}} 和 {{ic|netctl status ''profile''}} 来获得对错误的详细描述。<br />
<br />
=== 自动化操作 ===<br />
<br />
如果使用单一配置文件(对每个网络接口)或想人工切换配置文件,请看 [[#基本方法|基本方法]] 。使用这种配置方法的多为服务器、工作站和路由器等。<br />
<br />
如果需要经常在多个配置文件间切换,请看 [[#自动切换配置|自动切换配置]]。常用于笔记本电脑。<br />
<br />
==== 基本方法 ====<br />
<br />
使用此种方式,可以为每个网络接口固定地启用一个配置文件。首先需手动检查该配置文件可以正常使用,那么可以用下面的命令启用它:<br />
<br />
# netctl enable ''profile''<br />
<br />
这将创建并启用一个随计算机启动而自动运行的 [[systemd (简体中文)|systemd]] 服务。对配置文件本身的修改无法自动关联到前述创建的服务文件,修改之后,需用下述命令重新启用该配置。 <br />
<br />
# netctl reenable ''profile''<br />
<br />
{{Note|只有在计算机启动时(或服务启动时),配置文件可以被成功地启用,连接才可以建立。特别地,对于有线连接,需插好电缆;对于无线连接,需处于信号覆盖范围内。}}<br />
<br />
{{Tip|若要无视线缆是否插好,强制对有线网络接口启用一个固定IP的配置,可以在配置文件中加入 {{ic|1=SkipNoCarrier=yes}} 。}}<br />
<br />
==== 自动切换配置 ====<br />
<br />
{{ic|netctl}} 提供了两个特殊的 [[systemd (简体中文)|systemd]] 服务来自动切换配置:<br />
<br />
* 有线网络: {{ic|netctl-ifplugd@''interface''.service}}。使用它,将在你插入和拔出电缆时自动切换配置文件。<br />
* 无线网络: {{ic|netctl-auto@''interface''.service}}。使用它,将在你从一个无线网络的覆盖范围进入另一个无线网络的范围时自动切换配置文件。<br />
<br />
首先 [[pacman (简体中文)|安装]] 下列软件包:<br />
* {{Pkg|wpa_actiond}} 用来支持使用 {{ic|netctl-auto@''interface''.service}} 命令。<br />
* {{Pkg|ifplugd}} 用来支持使用 {{ic|netctl-ifplugd@''interface''.service}} 命令。<br />
<br />
然后将 {{ic|netctl-auto@''interface''.service}} 或 {{ic|netctl-ifplugd@''interface''.service}} 需要启动的所有配置文件编辑好。<br />
<br />
如果希望某些无线网络配置'''不要'''被 {{ic|netctl-auto@''interface''.service}}自动启用,需要专门在该配置文件中加入 {{ic|1=ExcludeAuto=yes}} 。存在多个可用配置时,可以通过设置 {{ic|1=Priority=}} 来为某些文件设置优先级。 {{ic|netctl-ifplugd@''interface''.service}} 优先启用使用了 [[Wikipedia:DHCP|DHCP]] 的配置文件,如要优先启用一个使用固定IP的配置,可以设置 {{ic|1=AutoWired=yes}} 。详细内容参见 {{ic|netctl.profile(5)}} 。<br />
<br />
{{Warning|不能通过选项{{ic|1=Security=wpa-config}}来让netctl-auto自动选择一个启用了WPA的配置文件。请使用 {{ic|1=Security=wpa-configsection}} 来代替。}}<br />
<br />
在设置好你的配置文件并且确认它们可以正常工作后,使用systemctl启动这些服务:<br />
<br />
# systemctl enable netctl-auto@''interface''.service <br />
# systemctl enable netctl-ifplugd@''interface''.service <br />
<br />
{{Warning|<br />
* 如果任何一个配置文件包含错误,例如包含空变量 {{ic|1=Key=}},这个文件将无法在开机时自动启用。<br />
* 本方法与 [[#基本方法|基本方法]] 矛盾。如果你之前已经通过netctl启用了一个配置文件,运行 {{ic|netctl disable ''profile''}} 来防止这个配置在计算机启动时被启用两次。}}<br />
<br />
从netctl 1.3开始,允许在不停止netctl-auto服务的情况下手工控制一个不受netctl-auto管理的网络接口。这可以通过netctl-auto命令完成。若要获得可用行为的列表,运行:<br />
# netctl-auto --help<br />
<br />
===配置文件示例===<br />
====有线连接====<br />
For a DHCP connection, only the {{ic|Interface}} has to be configured after copying the {{ic|/etc/netctl/examples/ethernet-dhcp}} example profile to {{ic|/etc/netctl}}. <br />
<br />
For example:<br />
{{hc|/etc/netctl/''my_dhcp_rofile''|<nowiki><br />
Interface=enp1s0<br />
IP=dhcp</nowiki><br />
}}<br />
<br />
For a static IP configuration copy the {{ic|/etc/netctl/examples/ethernet-static}} example profile to {{ic|/etc/netctl}} and modify {{ic|Interface}}, {{ic|Address}}, {{ic|Gateway}} and {{ic|DNS}}) as needed. <br />
<br />
For example:<br />
{{hc|/etc/netctl/''my_static_profile''|<nowiki><br />
Interface=enp1s0<br />
Connection=ethernet<br />
IP=static<br />
Address=('10.1.10.2/24')<br />
Gateway='10.1.10.1'<br />
DNS=('10.1.10.1')</nowiki><br />
}}<br />
<br />
For the {{ic|Address}} take care to include the correct netmask (the {{ic|/24}} in the sample profile equates to a netmask of {{ic|255.255.255.0}}) or the profile will fail to start. See also [[wikipedia:Classless Inter-Domain Routing#CIDR notation|CIDR notation]].<br />
<br />
====无线连接(WPA-PSK)====<br />
密码加密(256-bit PSK)<br />
<br />
{{Note|尽管进行了“加密”,你写进配置文件的密码依然可以让你连接到一个WPA-PSK网络。也即,这个加密过程只用来将密码变得“让人看不懂”,但无法阻止对这个文件有阅读权限的人使用它来连接网络。而且将这个密码再用到其他的地方变得极其不安全,你应当考虑是否有这样做的必要。}}<br />
<br />
那些'''不想'''让自己的无线网络密钥以“明文”的形式保存的用户可以选择使用256位预先共享密钥(PSK)来代替,它由密钥和SSID经由标准算法计算而成。<br />
<br />
* 方法 1: 使用 {{ic|wifi-menu -o}} 在目录 {{ic|/etc/netctl/}} 中生成一个配置文件。<br />
* 方法 2: 按照如下方法手工配置。<br />
<br />
无论采用何种方法,建议运行 {{ic|chmod 600 /etc/netctl/<config_file>}} 来禁止其他用户访问密码。<br />
<br />
用[[WPA_supplicant#Configuration_file|wpa_passphrase]]中的方法生成你的256位PSK:<br />
{{hc|$ wpa_passphrase ''your_essid'' ''passphrase''|2=<br />
network={<br />
ssid="''your_essid''"<br />
#psk="''passphrase''"<br />
psk=64cf3ced850ecef39197bb7b7b301fc39437a6aa6c6a599d0534b16af578e04a<br />
}<br />
}}<br />
<br />
{{Note|运行后不要关闭终端,这里的结果将在之后的配置中用到。}}<br />
<br />
在另一个终端窗口中,将示例文件 {{ic|wireless-wpa}} 从 {{ic|/etc/netctl/examples}} 复制到 {{ic|/etc/netctl}}:<br />
<br />
# cp /etc/netctl/examples/wireless-wpa /etc/netctl/wireless-wpa<br />
<br />
你需要用常用的文本编辑器编辑 {{ic|/etc/netctl/wireless-wpa}},将你刚才生成的PSK码添加到 {{ic|Key}} 变量。<br />
<br />
完成后,你的配置文件 {{ic|wireless-wpa}} 应当像下面这样:<br />
<br />
{{hc|/etc/netctl/wireless-wpa|2=<br />
Description='A simple WPA encrypted wireless connection using 256-bit PSK'<br />
Interface=wlp2s2<br />
Connection=wireless<br />
Security=wpa<br />
IP=dhcp<br />
ESSID=''your_essid''<br />
Key=\"64cf3ced850ecef39197bb7b7b301fc39437a6aa6c6a599d0534b16af578e04a<br />
}}<br />
<br />
{{Note|<br />
* 注意对变量 {{ic|Key}} 使用 '''special quoting rules''',详细的描述参见[https://github.com/joukewitteveen/netctl/blob/master/docs/netctl.profile.5.txt netctl.profile(5)]末尾。<br />
* 如果密码没有起作用,从变量 {{ic|Key}} 中删除 {{ic|\"}} 。}}<br />
<br />
== 提示与技巧 ==<br />
<br />
=== Eduroam ===<br />
<br />
有些大学使用一个叫做"Eduroam"的系统管理其无线网络。(鉴于未发现此节对于中文用户的作用,不做翻译)For this system, a WPA config-section profile with the following format is often useful:<br />
<br />
{{hc|/etc/netctl/wlan0-eduroam|<nowiki><br />
Description='Eduroam-profile for <user>'<br />
Interface=wlan0<br />
Connection=wireless<br />
Security=wpa-configsection<br />
IP=dhcp<br />
WPAConfigSection=(<br />
'ssid="eduroam"'<br />
'proto=RSN'<br />
'key_mgmt=WPA-EAP'<br />
'pairwise=CCMP'<br />
'auth_alg=OPEN'<br />
'eap=PEAP'<br />
'identity="<user>"'<br />
'password="<password>"'<br />
)</nowiki><br />
}}<br />
<br />
{{Tip|To prevent storing your password as plaintext, you can generate a password hash with {{ic|$ echo -n <password> &#124; iconv -t utf16le &#124; openssl md4}}. Then use it as {{ic|'password&#61;hash:<hash>'}}.}}<br />
<br />
For TTLS and certified universities this setup works:<br />
<br />
{{hc|/etc/netctl/wlan0-eduroam|<nowiki><br />
Description='Eduroam university'<br />
Interface=wlan0 <br />
Connection=wireless<br />
Security=wpa-configsection<br />
IP=dhcp<br />
ESSID=eduroam<br />
WPAConfigSection=(<br />
'ssid="eduroam"'<br />
'key_mgmt=WPA-EAP'<br />
'eap=TTLS'<br />
'group=TKIP'<br />
'anonymous_identity="anonymous@domain_university"'<br />
'identity="XXX@domain_university"'<br />
'password="XXX"'<br />
'ca_cert="Path/to/the/certificate"'<br />
'phase2="auth=PAP"'<br />
)</nowiki><br />
}}<br />
<br />
=== 绑定(Bonding) ===<br />
<br />
引自 [https://www.kernel.org/doc/Documentation/networking/bonding.txt kernel documentation]:<br />
<br />
:''The Linux bonding driver provides a method for aggregating multiple network interfaces into a single logical "bonded" interface. The behavior of the bonded interfaces depends on the mode. Generally speaking, modes provide either hot standby or load balancing services. Additionally, link integrity monitoring may be performed.''<br />
<br />
(Linux bonding驱动提供了一个把多个网络接口“绑定”成一个逻辑接口的途径。绑定后的接口的行为取决于绑定的模式,一般来说,提供“随时收发”和“均衡负载”两种模式。另外,可以提供对连接的总体情况的监测功能。)<br />
<br />
==== 均衡负载 ====<br />
<br />
要用netctl配合bonding, 需要从官方软件源安装 {{Pkg|ifenslave}}。<br />
<br />
复制 {{ic|/etc/netctl/examples/bonding}} 到 {{ic|/etc/netctl/bonding}} 然后进行编辑。例如: <br />
<br />
{{hc|/etc/netctl/bonding|2=<br />
Description='Bond Interface'<br />
Interface='bond0'<br />
Connection=bond<br />
BindsToInterfaces=('eth0' 'eth1')<br />
IP=dhcp<br />
IP6=stateless}}<br />
<br />
现在你可以停用之前的配置文件。然后设置bonding为自动启动,切换到新的配置。例如:<br />
<br />
# netctl switch-to bonding<br />
<br />
{{Note|这将使用{{ic|bonding}}驱动的默认策略round-robin。更多信息参见 [https://www.kernel.org/doc/Documentation/networking/bonding.txt 官方文档]。}}<br />
<br />
{{Tip|查看状态和绑定模式: {{bc|$ cat /proc/net/bonding/bond0}}}}<br />
<br />
==== 有线 -> 无线故障切换 ====<br />
<br />
这一部分探讨怎样用bonding来实现当有线以太网无法工作时自动切换至无线网络。我们假设所有的网络接口默认启动dhcdpcd服务。<br />
<br />
你需要从官方源安装软件包: <s>{{Pkg|ifplugd}}</s>, {{Pkg|ifenslave}} 和 {{Pkg|wpa_supplicant}}.<br />
<br />
首先设置 {{ic|bonding}} 驱动使用 {{ic|active-backup}}:<br />
<br />
{{hc|/etc/modprobe.d/bonding.conf|2=<br />
options bonding mode=active-backup<br />
options bonding miimon=100<br />
options bonding primary=eth0<br />
options bonding max_bonds=0<br />
}}<br />
<br />
{{ic|max_bonds}} 选项避免了 {{ic|Interface bond0 already exists}} 错误。如果使用了MAC过滤,应当添加设置 {{ic|fail_over_mac<nowiki>=</nowiki>active}}。<br />
<br />
接下来,编写一个netctl配置文件来绑定两个网络接口:<br />
<br />
{{hc|/etc/netctl/failover|2=<br />
Description='A wired connection with failover to wireless'<br />
Interface='bond0'<br />
Connection=bond<br />
BindsToInterfaces=('eth0' 'wlan0')<br />
IP='dhcp'<br />
SkipNoCarrier='no'<br />
}}<br />
<br />
设置该配置文件自启动:<br />
<br />
# netctl enable failover<br />
<br />
将 wpa_supplicant 配置为关联一个已知网络,可以通过 netctl profile (记得设置 IP='no'), 和一个长期运行的 wpa_supplicant 服务或者 wpa_cli 命令实现。具体方法请访问 [[wpa_supplicant]] 页面。想要长期运行 wpa_supplicant 服务,创建一个wpa_supplicant配置文件{{ic|/etc/wpa_supplicant/wpa_supplicant-wlan0.conf}} 然后运行:<br />
<br />
# systemctl enable wpa_supplicant@wlan0<br />
<br />
在有线网络配置中设置{{ic|1=IP='no'}}。IP地址应当只被分配到bond0接口。<br />
<br />
如果你有一个有线连接和无线连接连接到同一个网络,现在可以将有线网络断开连接,然后重新连接而依然保持网络通畅。在大多数情况下,甚至连流媒体音乐都不会卡顿。<br />
<br />
=== 使用任意接口 ===<br />
In some cases it may be desirable to allow a profile to use any interface on the system. A common example use case is using a common disk image across many machines with differing hardware (this is especially useful if they are headless). If you use the kernel's naming scheme, and your machine has only one ethernet interface, you can probably guess that eth0 is the right interface. If you use udev's [http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ Predictable Network Interface Names], however, names will be assigned based on the specific hardware itself (e.g. enp1s0), rather than simply the order that the hardware was detected (e.g. eth0, eth1). This means that a netctl profile may work on one machine and not another, because they each have different interface names.<br />
<br />
A quick and dirty solution is to make use of the {{ic|/etc/netctl/interfaces/}} directory. Choose a name for your interface alias ({{ic|en-any}} in this example), and write the following to a file with that name (making sure it is executable).<br />
{{hc|/etc/netctl/interfaces/en-any|<nowiki><br />
#!/bin/bash<br />
for interface in /sys/class/net/en*; do<br />
break;<br />
done<br />
Interface=$(basename $interface)<br />
echo "en-any: using interface $Interface";<br />
</nowiki>}}<br />
Then create a profile that uses the interface. Pay special attention to the {{ic|Interface}} directive. The rest are only provided as examples.<br />
{{hc|/etc/netctl/wired|<nowiki><br />
Description='Wired'<br />
Interface=en-any<br />
Connection=ethernet<br />
IP=static<br />
Address=('192.168.1.15/24')<br />
Gateway='192.168.1.1'<br />
DNS=('192.168.1.1')<br />
</nowiki>}}<br />
<br />
When the {{ic|wired}} profile is started, any machine using the two files above will automatically bring up and configure the first ethernet interface found on the system, regardless of what name udev assigned to it. Note that this is not the most robust way to go about configuring interfaces. If you use multiple interfaces, netctl may try to assign the same interface to them, and will likely cause a disruption in connectivity. If you do not mind a more complicated solution, {{ic|netctl-auto}} is likely to be more reliable.<br />
<br />
=== 使用钩子 ===<br />
<br />
netctl supports hooks in {{ic|/etc/netctl/hooks/}} and per interface hooks in {{ic|/etc/netctl/interfaces/}}. You can set any option in a hook/interface that you can<br />
in a profile. They are read the same way! Most importantly this includes {{ic|ExecUpPost}} and {{ic|ExecDownPre}}. <br />
<br />
When a profile is read, netctl sources ''all executable'' scripts in {{ic|hooks}}, then it reads the profile file for the connection and finally it sources an executable script with the name of the interface used in the profile from the {{ic|interfaces}} directory. Therefore, declarations in an interface script override declarations in the profile, which override declarations in hooks. <br />
<br />
The variables {{ic|$INTERFACE}}, {{ic|$SSID}}, {{ic|$ACTION}} and {{ic|$Profile}} are available in hooks/interfaces '''only''' when using {{ic|netctl-auto}} <br />
<br />
==== 范例 ====<br />
<br />
===== 在已有连接上执行命令 =====<br />
{{hc|/etc/netctl/hooks/myservices|<nowiki><br />
#!/bin/sh<br />
ExecUpPost="systemctl start crashplan.service; systemctl start dropbox@<username>.service"<br />
ExecDownPre="systemctl stop crashplan.service; systemctl stop dropbox@<username>.service"<br />
</nowiki>}}<br />
<br />
===== 激活 network-online.target =====<br />
<br />
{{hc|/etc/netctl/hooks/status|<nowiki><br />
#!/bin/sh<br />
ExecUpPost="systemctl start network-online.target"<br />
ExecDownPre="systemctl stop network-online.target"<br />
</nowiki>}} <br />
<br />
Using this, systemd services requiring an active network connection can be [[Systemd#Handling_dependencies|ordered]] to start only after the {{ic|network-online.target}} is reached, and can be stopped before the connection is brought down. <br />
<br />
===== 设置默认 DHCP 客户端 =====<br />
<br />
To set or change the DHCP client used for all profiles: <br />
<br />
{{hc|/etc/netctl/hooks/dhcp|<nowiki><br />
#!/bin/sh<br />
DHCPClient='dhclient'<br />
</nowiki>}}<br />
<br />
Alternatively, it may also be specified for a specific network interface by creating an executable file {{ic|/etc/netctl/interfaces/<interface>}} with the following line:<br />
<br />
DHCPClient='dhclient'<br />
<br />
{{Expansion|It would be useful to replace the example with a general hook that executes different actions depending on {{ic|$ACTION}} being CONNECT and DISCONNECT.}}<br />
<br />
<br />
== 排错 ==<br />
<br />
=== Job for netctl@wlan(...).service failed ===<br />
<br />
Some people have an issue when they connect to a network with ''netctl'', for example:<br />
<br />
{{hc|# netctl start wlan0-ssid|<nowiki><br />
Job for netctl@wlan0\x2ssid.service failed. See 'systemctl status netctl@wlan0\x2ssid.service' and 'journalctl -xn' for details.<br />
</nowiki>}}<br />
<br />
When then looking at {{ic|journalctl -xn}}, either of the following are shown:<br />
<br />
1. If your device ({{ic|wlan0}} in this case) is up:<br />
network[2322]: The interface of network profile 'wlan0-ssid' is already up<br />
<br />
Setting the interface down should resolve the problem:<br />
# ip link set wlan0 down<br />
<br />
Then retry:<br />
# netctl start wlan0-ssid<br />
<br />
{{Accuracy|The following is an unsolved issue, using different DHCP client is just a poor/unexplained workaround.}}<br />
<br />
2. If it is down:<br />
dhcpcd[261]: wlan0: ipv4_sendrawpacket: Network is down<br />
<br />
One way to solve this is to use a different DHCP client, for example {{Pkg|dhclient}}. After installing the package configure ''netctl'' to use it:<br />
<br />
{{hc|/etc/netctl/wlan0-ssid|<nowiki><br />
...<br />
DHCPClient='dhclient'<br />
</nowiki>}}<br />
<br />
Adding the {{ic|ForceConnect}} option may also be helpful:<br />
<br />
{{hc|/etc/netctl/wlan0-ssid|<nowiki><br />
<br />
...<br />
<br />
ForceConnect=yes<br />
</nowiki>}}<br />
<br />
Save it and try to connect with the profile:<br />
# netctl start wlan0-ssid<br />
<br />
=== dhcpcd: ipv4_addroute: File exists ===<br />
<br />
On some systems dhcpcd in combination with netctl causes timeout issues on resume, particularly when having switched networks in the meantime. netctl will report that you are successfully connected but you still receive timeout issues. In this case, the old default route still exists and is not being renewed. A workaround to avoid this misbehaviour is to switch to [[#Set default dhcp client for all profiles|dhclient]] as the default dhcp client. More information on the issue can be found [https://bbs.archlinux.org/viewtopic.php?pid=1399842#p1399842 here].<br />
<br />
=== DHCP timeout issues ===<br />
<br />
If you are having timeout issues when requesting leases via DHCP you can set the timeout value higher than netctl's 30 seconds by default. Create a file in {{ic|/etc/netctl/hooks/}} or {{ic|/etc/netctl/interfaces/}}, add {{ic|1=TimeoutDHCP=40}} to it for a timeout of 40 seconds and make the file executable.<br />
<br />
=== Connection timeout issues ===<br />
<br />
If you are having timeout issues that are unrelated to DHCP (on a static ethernet connection for example), and are experiencing errors similar to the following when starting your profile:<br />
{{hc|# journalctl _SYSTEMD_UNIT&#61;netctl@''profile''.service|<br />
Starting network profile &#39;''profile''&#39;...<br />
No connection found on interface 'eth0' (timeout)<br />
Failed to bring the network up for profile &#39;''profile''&#39;<br />
}}<br />
Then you should increase carrier and up timeouts by adding {{ic|1=TimeoutUp=}} and {{ic|1=TimeoutCarrier=}} to your profile file:<br />
{{hc|/etc/netctl/''profile''|<nowiki><br />
...<br />
TimeoutUp=300<br />
TimeoutCarrier=300</nowiki><br />
}}<br />
Do not forget to reenable your profile:<br />
<br />
# netctl reenable ''profile''<br />
<br />
=== Problems with netctl-auto on resume ===<br />
Sometimes ''netctl-auto'' fails to reconnect when the system resumes from suspend. An easy solution is to restart the service for ''netctl-auto''. <br />
This can be automated with an additional service like the following:<br />
<br />
{{hc|/etc/systemd/system/netctl-auto-resume@.service|<nowiki><br />
[Unit]<br />
Description=restart netctl-auto on resume.<br />
Requisite=netctl-auto@%i.service<br />
After=suspend.target<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/usr/bin/systemctl restart netctl-auto@%i.service<br />
<br />
[Install]<br />
WantedBy=suspend.target<br />
</nowiki>}}<br />
<br />
To [[enable]] this service for your wireless card, for example, enable {{ic|netctl-auto-resume@wlan0.service}} as root. Change {{ic|wlan0}} to the required network interface.<br />
<br />
<br />
=== 移除过时的dhcpcd租期 ===<br />
<br />
{{Expansion|missing description}}<br />
<br />
# rm /var/lib/dhcpcd/dhcpcd-wlan0.lease<br />
<br />
=== DHCP超时问题 ===<br />
<br />
如果在通过DHCP申请租期时有超时问题,你可以设置超时的时限大于netctl默认的30秒。Create a file in 在{{ic|/etc/netctl/hooks/}}或者{{ic|/etc/netctl/interfaces/}}中创建一个文件,在其中加入 {{ic|1=TimeoutDHCP=40}} 可以使时限设置为40秒。然后为这个文件加上可执行权限。<br />
<br />
== 参见 ==<br />
<br />
* [https://lists.archlinux.org/pipermail/arch-projects/2012-December/003473.html Initial mailing list announcement]<br />
* [https://bbs.archlinux.org/viewtopic.php?id=157670 官方陈述页面]<br />
* 在AUR中有一个可用的cinnamon applet: {{AUR|cinnamon-applet-netctl-systray-menu}}{{Broken package link|{{aur-mirror|cinnamon-applet-netctl-systray-menu}}}}</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=LXQt_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409260
LXQt (简体中文)
2015-11-15T14:24:26Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:简体中文]]<br />
[[Category:Desktop environments (简体中文)]]<br />
[[en:LXQt]]<br />
[[ja:LXQt]]<br />
[[ru:Razor-qt]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|LXDE (简体中文)}}<br />
{{Related|Desktop environment (简体中文)}}<br />
{{Related|Window manager (简体中文)}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|LXQt|2015-11-15|408422}}<br />
2013年间,洪任諭(“PCMan”)启动了将 LXDE 移植到 Qt 的项目。LXDE-Qt 的首个预览版发布于2013年7月3日。而在2013年7月21日,Razor-qt(一个与LXDE类似的桌面)与 LXDE 宣布合并,产生了 LXQt。这个桌面集合了 Razor-qt 和 LXDE 的组件。尽管 LXDE 目前的精力已经集中到 LXQt,GTK+ 2 的版本依然在维护。<br />
<br />
== 安装 ==<br />
<br />
[[安装]] {{Grp|lxqt}} 包组。<br />
你还需要安装一个图标主题。 默认的是 ''Oxygen'', 可以从 {{Pkg|oxygen-icons}} 包安装。<br />
<br />
你还可以安装以下附加功能包:<br />
<br />
* {{App|Connman|类似 [[NetworkManager]] 的网络管理器。| http://git.kernel.org/cgit/network/connman | {{Pkg|connman}}}}<br />
* {{App|LXQt Connman applet|LXQt [[Connman]] 的系统托盘小程序。| https://github.com/surlykke/lxqt-connman-applet | {{AUR|lxqt-connman-applet-git}}}}<br />
* {{App|LXImage-Qt|LXQt 的图像查看器和截图工具。| https://github.com/lxde/lximage-qt | {{AUR|lximage-qt}}}}<br />
* {{App|ObConf-Qt|Qt 版 ObConf,[[Openbox]] 的配置工具。 | https://github.com/lxde/obconf-qt | {{AUR|obconf-qt}}}}<br />
* {{App|QTerminal|基于 Qt 的轻量级终端模拟器。| https://github.com/qterminal/qterminal | {{AUR|qterminal}}}}<br />
* {{App|[[SDDM]]|LXQt 推荐的显示管理器。| https://github.com/sddm/sddm | {{Pkg|sddm}}}}<br />
<br />
== 启动桌面 ==<br />
<br />
=== 使用 xinit ===<br />
<br />
在[[Xinitrc]]中添加:<br />
<br />
exec startlxqt<br />
<br />
=== 图形界面登入 ===<br />
<br />
在[[display manager|显示管理器]]的桌面菜单中选择 ''LXQt Desktop''.<br />
<br />
== 配置 ==<br />
<br />
LXQt 尝试提供 GUI 应用程序修改其设置。配置文件位于 {{ic|~/.config/lxqt}} 目录中。这个目录被自动初始化,新用户的默认配置可在 {{ic|/etc/xdg/lxqt}} 中找到。<br />
<br />
=== 替换 Openbox ===<br />
<br />
虽然 [[Openbox]] 是 LXQt 默认的 [[window manager]],你仍可以在“会话设置”中指定一个不同的窗口管理器用于 LXQt。也可以编辑 {{ic|~/.config/lxqt/session.conf}},将下面这行:<br />
window_manager=openbox<br />
<br />
改为你所选择的某个[[窗口管理器]]:<br />
<br />
window_manager=''你选择的窗口管理器''<br />
<br />
=== 自动启动应用程序===<br />
<br />
要在登录的时候启动 X 程序,在 LXQt 主菜单中依次点击 -> 首选项 -> LXQt 设置 -> LXQt 会话设置。此外也可以通过下面命令启动:<br />
lxqt-config-session<br />
<br />
从这个窗口中,点击左侧的"自动启动",添加程序到全局自动启动(使用这个规范的所有会话都将启动此程序) <br />
或本地自动启动(标签 LXQt 自动启动)(这个选项有个 Bug,见[https://github.com/lxde/lxqt/issues/746 issue 746]).<br />
<br />
=== 编辑应用程序菜单 ===<br />
<br />
可以通过编辑{{ic|/usr/share/applications/lxqt-*.desktop}}中的桌面文件修改菜单,参阅 [[Desktop entries (简体中文)|桌面配置项]]。<br />
<br />
== 建议应用 ==<br />
<br />
LXQt是一个轻量级桌面,作一个简单的安装不会提供很多桌面应用程序。它留给用户选择他们想要安装的应用程序。[https://github.com/Razor-qt/razor-qt/wiki/3rd-party-applications Razor-qt wiki] 上有一个网页,其中列出了一些有用的 Qt 应用程序,您可能想要安装。另请参阅 [[List of applications]] 的页面中Arch可用应用程序的完整列表。<br />
<br />
== 参阅 ==<br />
<br />
* [http://lxqt.org LXQt homepage]<br />
* [https://github.com/lxde/lxqt LXQt development]<br />
* [http://lxqt-de.deviantart.com/ LXQt on deviantART]<br />
* [https://github.com/lxde/lxqt/wiki LXQt wiki on GitHUb]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=LXQt_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409259
LXQt (简体中文)
2015-11-15T14:13:05Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:Desktop environments (简体中文)]]<br />
[[en:LXQt]]<br />
[[ja:LXQt]]<br />
[[ru:Razor-qt]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|LXDE}}<br />
{{Related|Desktop environment (简体中文)}}<br />
{{Related|Window manager}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|LXQt|2015-11-15|408422}}<br />
2013年间,洪任諭(“PCMan”)启动了将 LXDE 移植到 Qt 的项目。LXDE-Qt 的首个预览版发布于2013年7月3日。而在2013年7月21日,Razor-qt(一个与LXDE类似的桌面)与 LXDE 宣布合并,产生了 LXQt。这个桌面集合了 Razor-qt 和 LXDE 的组件。尽管 LXDE 目前的精力已经集中到 LXQt,GTK+ 2 的版本依然在维护。<br />
<br />
== 安装 ==<br />
<br />
[[安装]] {{Grp|lxqt}} 包组。<br />
你还需要安装一个图标主题。 默认的是 ''Oxygen'', 可以从 {{Pkg|oxygen-icons}} 包安装。<br />
<br />
你还可以安装以下附加功能包:<br />
<br />
* {{App|Connman|类似 [[NetworkManager]] 的网络管理器。| http://git.kernel.org/cgit/network/connman | {{Pkg|connman}}}}<br />
* {{App|LXQt Connman applet|LXQt [[Connman]] 的系统托盘小程序。| https://github.com/surlykke/lxqt-connman-applet | {{AUR|lxqt-connman-applet-git}}}}<br />
* {{App|LXImage-Qt|LXQt 的图像查看器和截图工具。| https://github.com/lxde/lximage-qt | {{AUR|lximage-qt}}}}<br />
* {{App|ObConf-Qt|Qt 版 ObConf,[[Openbox]] 的配置工具。 | https://github.com/lxde/obconf-qt | {{AUR|obconf-qt}}}}<br />
* {{App|QTerminal|基于 Qt 的轻量级终端模拟器。| https://github.com/qterminal/qterminal | {{AUR|qterminal}}}}<br />
* {{App|[[SDDM]]|LXQt 推荐的显示管理器。| https://github.com/sddm/sddm | {{Pkg|sddm}}}}<br />
<br />
== 启动桌面 ==<br />
<br />
=== 使用 xinit ===<br />
<br />
在[[Xinitrc]]中添加:<br />
<br />
exec startlxqt<br />
<br />
=== 图形界面登入 ===<br />
<br />
在[[display manager|显示管理器]]的桌面菜单中选择 ''LXQt Desktop''.<br />
<br />
== 配置 ==<br />
<br />
LXQt 尝试提供 GUI 应用程序修改其设置。配置文件位于 {{ic|~/.config/lxqt}} 目录中。这个目录被自动初始化,新用户的默认配置可在 {{ic|/etc/xdg/lxqt}} 中找到。<br />
<br />
=== 替换 Openbox ===<br />
<br />
虽然 [[Openbox]] 是 LXQt 默认的 [[window manager]],你仍可以在“会话设置”中指定一个不同的窗口管理器用于 LXQt。也可以编辑 {{ic|~/.config/lxqt/session.conf}},将下面这行:<br />
window_manager=openbox<br />
<br />
改为你所选择的某个[[窗口管理器]]:<br />
<br />
window_manager=''你选择的窗口管理器''<br />
<br />
=== 自动启动应用程序===<br />
<br />
要在登录的时候启动 X 程序,在 LXQt 主菜单中依次点击 -> 首选项 -> LXQt 设置 -> LXQt 会话设置。此外也可以通过下面命令启动:<br />
lxqt-config-session<br />
<br />
从这个窗口中,点击左侧的"自动启动",添加程序到全局自动启动(使用这个规范的所有会话都将启动此程序) <br />
或本地自动启动(标签 LXQt 自动启动)(这个选项有个 Bug,见[https://github.com/lxde/lxqt/issues/746 issue 746]).<br />
<br />
=== 编辑应用程序菜单 ===<br />
<br />
可以通过编辑{{ic|/usr/share/applications/lxqt-*.desktop}}中的桌面文件修改菜单,参阅 [[Desktop entries (简体中文)|桌面配置项]]。<br />
<br />
== 建议应用 ==<br />
<br />
LXQt是一个轻量级桌面,作一个简单的安装不会提供很多桌面应用程序。它留给用户选择他们想要安装的应用程序。[https://github.com/Razor-qt/razor-qt/wiki/3rd-party-applications Razor-qt wiki] 上有一个网页,其中列出了一些有用的 Qt 应用程序,您可能想要安装。另请参阅 [[List of applications]] 的页面中Arch可用应用程序的完整列表。<br />
<br />
== 参阅 ==<br />
<br />
* [http://lxqt.org LXQt homepage]<br />
* [https://github.com/lxde/lxqt LXQt development]<br />
* [http://lxqt-de.deviantart.com/ LXQt on deviantART]<br />
* [https://github.com/lxde/lxqt/wiki LXQt wiki on GitHUb]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=LXQt_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409258
LXQt (简体中文)
2015-11-15T14:11:06Z
<p>Aaron chen: /* 配置 */</p>
<hr />
<div>[[Category:Desktop environments (简体中文)]]<br />
[[en:LXQt]]<br />
[[ja:LXQt]]<br />
[[ru:Razor-qt]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|LXDE}}<br />
{{Related|Desktop environment (简体中文)}}<br />
{{Related|Window manager}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|LXQt|2015-11-06|408290}}<br />
2013年间,洪任諭(“PCMan”)启动了将 LXDE 移植到 Qt 的项目。LXDE-Qt 的首个预览版发布于2013年7月3日。而在2013年7月21日,Razor-qt(一个与LXDE类似的桌面)与 LXDE 宣布合并,产生了 LXQt。这个桌面集合了 Razor-qt 和 LXDE 的组件。尽管 LXDE 目前的精力已经集中到 LXQt,GTK+ 2 的版本依然在维护。<br />
<br />
== 安装 ==<br />
<br />
[[安装]] {{Grp|lxqt}} 包组。<br />
你还需要安装一个图标主题。 默认的是 ''Oxygen'', 可以从 {{Pkg|oxygen-icons}} 包安装。<br />
<br />
你还可以安装以下附加功能包:<br />
<br />
* {{App|Connman|类似 [[NetworkManager]] 的网络管理器。| http://git.kernel.org/cgit/network/connman | {{Pkg|connman}}}}<br />
* {{App|LXQt Connman applet|LXQt [[Connman]] 的系统托盘小程序。| https://github.com/surlykke/lxqt-connman-applet | {{AUR|lxqt-connman-applet-git}}}}<br />
* {{App|LXImage-Qt|LXQt 的图像查看器和截图工具。| https://github.com/lxde/lximage-qt | {{AUR|lximage-qt}}}}<br />
* {{App|ObConf-Qt|Qt 版 ObConf,[[Openbox]] 的配置工具。 | https://github.com/lxde/obconf-qt | {{AUR|obconf-qt}}}}<br />
* {{App|QTerminal|基于 Qt 的轻量级终端模拟器。| https://github.com/qterminal/qterminal | {{AUR|qterminal}}}}<br />
* {{App|[[SDDM]]|LXQt 推荐的显示管理器。| https://github.com/sddm/sddm | {{Pkg|sddm}}}}<br />
<br />
== 启动桌面 ==<br />
<br />
=== 使用 xinit ===<br />
<br />
在[[Xinitrc]]中添加:<br />
<br />
exec startlxqt<br />
<br />
=== 图形界面登入 ===<br />
<br />
在[[display manager|显示管理器]]的桌面菜单中选择 ''LXQt Desktop''.<br />
<br />
== 配置 ==<br />
<br />
LXQt 尝试提供 GUI 应用程序修改其设置。配置文件位于 {{ic|~/.config/lxqt}} 目录中。这个目录被自动初始化,新用户的默认配置可在 {{ic|/etc/xdg/lxqt}} 中找到。<br />
<br />
=== 替换 Openbox ===<br />
<br />
虽然 [[Openbox]] 是 LXQt 默认的 [[window manager]],你仍可以在“会话设置”中指定一个不同的窗口管理器用于 LXQt。也可以编辑 {{ic|~/.config/lxqt/session.conf}},将下面这行:<br />
window_manager=openbox<br />
<br />
改为你所选择的某个[[窗口管理器]]:<br />
<br />
window_manager=''你选择的窗口管理器''<br />
<br />
=== 自动启动应用程序===<br />
<br />
要在登录的时候启动 X 程序,在 LXQt 主菜单中依次点击 -> 首选项 -> LXQt 设置 -> LXQt 会话设置。此外也可以通过下面命令启动:<br />
lxqt-config-session<br />
<br />
从这个窗口中,点击左侧的"自动启动",添加程序到全局自动启动(使用这个规范的所有会话都将启动此程序) <br />
或本地自动启动(标签 LXQt 自动启动)(这个选项有个 Bug,见[https://github.com/lxde/lxqt/issues/746 issue 746]).<br />
<br />
=== 编辑应用程序菜单 ===<br />
<br />
可以通过编辑{{ic|/usr/share/applications/lxqt-*.desktop}}中的桌面文件修改菜单,参阅 [[Desktop entries (简体中文)|桌面配置项]]。<br />
<br />
== 建议应用 ==<br />
<br />
LXQt是一个轻量级桌面,作一个简单的安装不会提供很多桌面应用程序。它留给用户选择他们想要安装的应用程序。[https://github.com/Razor-qt/razor-qt/wiki/3rd-party-applications Razor-qt wiki] 上有一个网页,其中列出了一些有用的 Qt 应用程序,您可能想要安装。另请参阅 [[List of applications]] 的页面中Arch可用应用程序的完整列表。<br />
<br />
== 参阅 ==<br />
<br />
* [http://lxqt.org LXQt homepage]<br />
* [https://github.com/lxde/lxqt LXQt development]<br />
* [http://lxqt-de.deviantart.com/ LXQt on deviantART]<br />
* [https://github.com/lxde/lxqt/wiki LXQt wiki on GitHUb]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Desktop_entries_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409257
Desktop entries (简体中文)
2015-11-15T14:09:03Z
<p>Aaron chen: </p>
<hr />
<div>{{DISPLAYTITLE:桌面配置项}}<br />
[[Category:简体中文]]<br />
[[Category:Package development]]<br />
[[en:Desktop entries]]<br />
[[ja:デスクトップエントリ]]<br />
{{Related articles start}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Desktop_entries|2015-11-15|393808}}<br />
<br />
桌面配置项(Desktop entries)是 [http://www.freedesktop.org/wiki/ freedesktop.org(自由桌面社区)] 制订的一个用于规范 [[Xorg]] 环境中程序运行行为的标准。它是一个配置文件,描述了某个应用程序如何被启动以及怎样在菜单中以图标形式出现。大部分桌面配置项是 {{ic|.desktop}} 和 {{ic|.directory}} 文件。本文将概述如何创建一个合规可用的桌面配置项,主要面向软件包发布者和维护者,但对软件开发者及其他人也会是有用的。<br />
<br />
桌面配置项大致分为三类:<br />
<br />
; 应用程序 : 指向某个应用程序的快捷方式<br />
; 链接 : 指向某个网址的链接<br />
; 目录 : 某个菜单项元数据的容器<br />
<br />
下列章节概述如何创建它们并使其生效。<br />
<br />
== 应用程序配置项 ==<br />
<br />
Desktop entries for applications, or {{ic|.desktop}} files, are generally a combination of meta information resources and a shortcut of an application. These files usually reside in {{ic|/usr/share/applications}} or {{ic|/usr/local/share/applications}} for applications installed system-wide, or {{ic|~/.local/share/applications}} for user-specific applications. User entries take precedence over system entries.<br />
<br />
=== 范例文件 ===<br />
<br />
Following is an example of its structure with additional comments. The example is only meant to give a quick impression, and does not show how to utilize all possible entry keys. The complete list of keys can be found in the [http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html freedesktop.org specification].<br />
<br />
[Desktop Entry]<br />
Type=Application # Indicates the type as listed above<br />
Version=1.0 # The version of the desktop entry specification to which this file complies<br />
Name=jMemorize # The name of the application<br />
Comment=Flash card based learning tool # A comment which can/will be used as a tooltip<br />
Exec=jmemorize # The executable of the application.<br />
Icon=jmemorize # The name of the icon that will be used to display this entry<br />
Terminal=false # Describes whether this application needs to be run in a terminal or not<br />
Categories=Education;Languages;Java; # Describes the categories in which this entry should be shown<br />
<br />
=== 关键字定义 ===<br />
<br />
All Desktop recognized desktop entries can be found [http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html on the freedesktop.org site].<br />
For example, the {{Ic|Type}} key defines three types of desktop entries: Application (type 1), Link (type 2) and Directory (type 3).<br />
<br />
* {{Ic|Version}} key does not stand for the version of the application, but for the version of the desktop entry specification to which this file complies.<br />
<br />
* {{Ic|Name}}, {{Ic|GenericName}} and {{Ic|Comment}} often contain redundant values in the form of combinations of them, like:<br />
<br />
Name=Pidgin Internet Messenger<br />
GenericName=Internet Messenger<br />
or<br />
Name=NoteCase notes manager<br />
Comment=Notes Manager<br />
<br />
This should be avoided, as it will only be confusing to users. The {{Ic|Name}} key should only contain the name, or maybe an abbreviation/acronym if available.<br />
<br />
* {{Ic|GenericName}} should state what you would generally call an application that does what this specific application offers (i.e. Firefox is a "Web Browser").<br />
* {{Ic|Comment}} is intended to contain any usefull additional information.<br />
<br />
==== 过时的内容 ====<br />
<br />
There are quite some keys that have become deprecated over time as the standard has matured. The best/simplest way is to use the tool {{Ic|desktop-file-validate}} which is part of the package {{Pkg|desktop-file-utils}}. To validate, run<br />
$ desktop-file-validate <your desktop file><br />
This will give you very verbose and useful warnings and error messages.<br />
<br />
== 图标 ==<br />
<br />
=== 通用图像格式 ===<br />
<br />
Here is a short overview of image formats commonly used for icons.<br />
<br />
{| class="wikitable" align="center"<br />
|+ Support for image formats for icons as specified by the [http://standards.freedesktop.org/icon-theme-spec/latest/ar01s02.html freedesktop.org standard].<br />
! Extension<br />
! Full Name and/or Description<br />
! Graphics Type<br />
! Container Format<br />
! Supported<br />
|-<br />
!align="left" | .[[wikipedia:Portable Network Graphics|png]]<br />
| Portable Network Graphics<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| bgcolor="red" | no<br />
| bgcolor="#00cc00"| yes<br />
|-<br />
!align="left" | .[[wikipedia:Scalable Vector Graphics|svg(z)]]<br />
| Scalable Vector Graphics<br />
| [[wikipedia:Vector graphics|Vector]]<br />
| bgcolor="red" | no<br />
| bgcolor="#66cc00"| yes (optional)<br />
|-<br />
!align="left" | .[[wikipedia:X PixMap|xpm]]<br />
| X PixMap<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| bgcolor="red" | no<br />
| bgcolor="yellow"| yes (deprecated)<br />
|-<br />
!align="left" | .[[wikipedia:Graphics Interchange Format|gif]]<br />
| Graphics Interchange Format<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| bgcolor="red" | no<br />
| bgcolor="red"| no<br />
|-<br />
!align="left" | .[[wikipedia:ICO (icon image file format)|ico]]<br />
| MS Windows Icon Format<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| bgcolor="#00cc00" | yes<br />
| bgcolor="red"| no<br />
|-<br />
!align="left" | .[[wikipedia:Apple Icon Image|icns]]<br />
| Apple Icon Image<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| bgcolor="#00cc00"| yes<br />
| bgcolor="red"| no<br />
|-<br />
|}<br />
<br />
=== 图标格式转换 ===<br />
<br />
If you stumble across an icon which is in a format that is not supported by the freedesktop.org standard (like ''gif'' or ''ico''), you can '''convert''' (which is part of the '''imagemagick''' package) it to a supported/recommended format, e.g.:<br />
$ convert <icon name>.gif <icon name>.png<br />
If you convert from a container format like ''ico'', you will get all images that were encapsulated in the ''ico'' file in the form ''<icon name>-<number>.png''.<br />
If you want to know the size of the image, or the number of images in a container file like ''ico'' you can use '''identify''' (also part of the '''imagemagick''' package)<br />
$ identify /usr/share/vlc/vlc48x48.ico<br />
/usr/share/vlc/vlc48x48.ico[0] ICO 32x32 32x32+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[1] ICO 16x16 16x16+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[2] ICO 128x128 128x128+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[3] ICO 48x48 48x48+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[4] ICO 32x32 32x32+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[5] ICO 16x16 16x16+0+0 8-bit DirectClass 84.3kb<br />
As you can see, the example ''ico'' file, although its name might suggest a single image of size 48x48, contains no less than 6 different sizes, of which one is even greater than 48x48, namely 128x128. And to give a bit of motivation on this subject, at the point of writing this section (2008-10-27), the 128x128 size was missing in the ''vlc'' package (0.9.4-2). So the next step would be to look at the vlc PKGBUILD and check whether this icon format was not in the source package to begin with (in that case we would inform the vlc developers), or whether this icon was somehow omitted from the Arch-specific package (in that case we can file a bug report at [https://bugs.archlinux.org/ the Arch Linux bug tracker]).<br />
(''Update:'' this bug has now been [https://bugs.archlinux.org/task/11923 fixed], so as you can see, your work will not be in vain.)<br />
<br />
=== Obtaining icons ===<br />
<br />
Although packages that already ship with a .desktop-file most certainly contain an icon or a set of icons, there is sometimes the case when a developer has not created a .desktop-file, but may ship icons, nonetheless. So a good start is to look for icons in the source package.<br />
You can i.e. first filter for the extension with '''find''' and then use '''grep''' to filter further for certain buzzwords like the package name, "icon", "logo", etc, if there are quite a lot of images in the source package.<br />
$ find /path/to/source/package -regex ".*\.\(svg\|png\|xpm\|gif\|ico\)$"<br />
If the developers of an application do not include icons in their source packages, the next step would be to search on their web sites.<br />
Some projects, like i.e. ''tvbrowser'' have an [http://enwiki.tvbrowser.org/index.php/Banners,_Logos_and_other_Promotion_Material artwork/logo page] where additional icons may be found. If a project is multi-platform, there may be the case that even if the linux/unix package does not come with an icon, the Windows package might provide one. If the project uses a [[wikipedia:Version control system|Version control system]] like CVS/SVN/etc. and you have some experience with it, you also might consider browsing it for icons.<br />
If everything fails, the project might simple have no icon/logo yet.<br />
<br />
== 工具 ==<br />
<br />
=== gendesk ===<br />
{{Pkg|gendesk}} started as an Arch Linux-specific tool for generating .desktop files by fetching the needed information directly from PKGBUILD files. Now it is a general tool that takes command-line arguments.<br />
<br />
Icons can be automatically downloaded from [http://openiconlibrary.sourceforge.net/ openiconlibrary], if available. (The source for icons can easily be changed in the future).<br />
<br />
==== 用法 ====<br />
<br />
* Add {{Ic|gendesk}} to makedepends<br />
<br />
* Start the {{Ic|prepare()}} function with:<br />
<br />
{{bc|gendesk --pkgname "$pkgname" --pkgdesc "$pkgdesc"}}<br />
<br />
* Alternatively, if an icon is already provided ($pkgname.png, for instance). The {{Ic|-n}} flag is for not downloading an icon or using the default icon. Example:<br />
<br />
{{bc|gendesk -n --pkgname "$pkgname" --pkgdesc "$pkgdesc"}}<br />
<br />
* {{Ic|$srcdir/$pkgname.desktop}}&nbsp;will be created and can be installed in the {{Ic|package()}} function with:<br />
<br />
{{bc|install -Dm644 "$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"}}<br />
<br />
* The icon can be installed with:<br />
<br />
{{bc|install -Dm644 "$pkgname.png" "$pkgdir/usr/share/pixmaps/$pkgname.png"}}<br />
<br />
* Use {{Ic|1=--name='Program Name'}} for choosing a name for the menu entry.<br />
<br />
* Use {{Ic|1=--exec='/opt/some_app/elf --with-ponies'}} for setting the exec field.<br />
<br />
* See the [https://github.com/xyproto/gendesk gendesk project] for more information.<br />
<br />
=== lsdsk ===<br />
<br />
The {{AUR|lsdsk}} bash script searching for content in "Categories" or "Exec", if "Categories" doesn't exist then it uses content of "Name". It's main purpose to get a quick overview in console of the available programs with their command lines and categories in *.desktop. It shows coloured existing base path defined in "DskPath" array.<br />
<br />
Examples<br />
# lsdsk<br />
# lsdsk game<br />
# lsdsk gtk<br />
<br />
=== fbrokendesktop ===<br />
<br />
The {{AUR|fbrokendesktop}} bash script using command "which" to detect broken Exec that points to not existing path. Without any parameters it uses preset folders in "DskPath" array. It shows only broken *.desktop with full path and filename that is missing.<br />
<br />
Examples<br />
<br />
# fbrokendesktop<br />
# fbrokendesktop /usr<br />
# fbrokendesktop /usr/share/apps/kdm/sessions/icewm.desktop<br />
<br />
== 提示与技巧 ==<br />
<br />
=== 隐藏桌面配置项 ===<br />
<br />
{{Tip|Desktop entries can be hidden by creating a symbolic link to {{ic|/dev/null}}. For example:<br />
$ ln -s /dev/null ~/.local/share/applications/''foo''.desktop<br />
}}<br />
<br />
Firstly, copy the desktop entry file in question to {{ic|~/.local/share/applications}} to avoid your changes being overwritten.<br />
<br />
Then, to hide the entry in all environments, open the desktop entry file in a text editor and add the following line: {{ic|NoDisplay&#61;true}}.<br />
<br />
To hide the entry in a specific desktop, add the following line to the desktop entry file: {{ic|NotShowIn&#61;''desktop-name''}}<br />
<br />
where ''desktop-name'' can be option such as ''GNOME'', ''Xfce'', ''KDE'' etc. A desktop entry can be hidden in more than desktop at once - simply separate the desktop names with a semi-colon.<br />
<br />
=== 自动启动 ===<br />
<br />
If you use an XDG-compliant desktop environment, such as GNOME or KDE, the desktop environment will automatically start [[Desktop entries|*.desktop]] files found in the following directories:<br />
<br />
* System-wide: {{ic|$XDG_CONFIG_DIRS/autostart/}} ({{ic|/etc/xdg/autostart/}} by default)<br />
:* GNOME also starts files found in {{ic|/usr/share/gnome/autostart/}}<br />
* User-specific: {{ic|$XDG_CONFIG_HOME/autostart/}} ({{ic|~/.config/autostart/}} by default)<br />
<br />
Users can override system-wide {{ic|*.desktop}} files by copying them into the user-specific {{ic|~/.config/autostart/}} folder.<br />
<br />
For an explanation of the desktop file standard refer to [http://standards.freedesktop.org/desktop-entry-spec/latest/ Desktop Entry Specification]. For a more specific description of directories used, [http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html Desktop Application Autostart Specification]. <br />
<br />
{{Note|This method is supported only by XDG-compliant desktop environments. Tools like {{AUR|dapper}}, {{pkg|dex}}, or {{AUR|fbautostart}} can be used to offer XDG autostart in unsupported desktop environments as long as some other autostart mechanism exists. Use the existing mechanism to start the xdg compliant autostart tool.}}<br />
<br />
== 参阅 ==<br />
<br />
* [[DeveloperWiki:Removal of desktop files]]<br />
* [[Wikipedia:.desktop|desktop wikipedia article]]<br />
* [http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html recognized desktop entry keys]<br />
* [http://freedesktop.org/wiki/Specifications/desktop-entry-spec freedesktop.org desktop entry specification]<br />
* [http://freedesktop.org/wiki/Specifications/icon-theme-spec freedesktop.org icon theme specification]<br />
* [http://freedesktop.org/wiki/Specifications/menu-spec freedesktop.org menu specification]<br />
* [http://freedesktop.org/wiki/Specifications/basedir-spec freedesktop.org basedir specification]<br />
* [http://freedesktop.org/wiki/Howto_desktop_files information for developers]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=LXQt_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409253
LXQt (简体中文)
2015-11-15T13:29:01Z
<p>Aaron chen: /* 开始桌面 */</p>
<hr />
<div>[[Category:Desktop environments (简体中文)]]<br />
[[en:LXQt]]<br />
[[ja:LXQt]]<br />
[[ru:Razor-qt]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|LXDE}}<br />
{{Related|Desktop environment (简体中文)}}<br />
{{Related|Window manager}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|LXQt|2015-11-06|408290}}<br />
2013年间,洪任諭(“PCMan”)启动了将 LXDE 移植到 Qt 的项目。LXDE-Qt 的首个预览版发布于2013年7月3日。而在2013年7月21日,Razor-qt(一个与LXDE类似的桌面)与 LXDE 宣布合并,产生了 LXQt。这个桌面集合了 Razor-qt 和 LXDE 的组件。尽管 LXDE 目前的精力已经集中到 LXQt,GTK+ 2 的版本依然在维护。<br />
<br />
== 安装 ==<br />
<br />
[[安装]] {{Grp|lxqt}} 包组。<br />
你还需要安装一个图标主题。 默认的是 ''Oxygen'', 可以从 {{Pkg|oxygen-icons}} 包安装。<br />
<br />
你还可以安装以下附加功能包:<br />
<br />
* {{App|Connman|类似 [[NetworkManager]] 的网络管理器。| http://git.kernel.org/cgit/network/connman | {{Pkg|connman}}}}<br />
* {{App|LXQt Connman applet|LXQt [[Connman]] 的系统托盘小程序。| https://github.com/surlykke/lxqt-connman-applet | {{AUR|lxqt-connman-applet-git}}}}<br />
* {{App|LXImage-Qt|LXQt 的图像查看器和截图工具。| https://github.com/lxde/lximage-qt | {{AUR|lximage-qt}}}}<br />
* {{App|ObConf-Qt|Qt 版 ObConf,[[Openbox]] 的配置工具。 | https://github.com/lxde/obconf-qt | {{AUR|obconf-qt}}}}<br />
* {{App|QTerminal|基于 Qt 的轻量级终端模拟器。| https://github.com/qterminal/qterminal | {{AUR|qterminal}}}}<br />
* {{App|[[SDDM]]|LXQt 推荐的显示管理器。| https://github.com/sddm/sddm | {{Pkg|sddm}}}}<br />
<br />
== 启动桌面 ==<br />
<br />
=== 使用 xinit ===<br />
<br />
在[[Xinitrc]]中添加:<br />
<br />
exec startlxqt<br />
<br />
=== 图形界面登入 ===<br />
<br />
在[[display manager|显示管理器]]的桌面菜单中选择 ''LXQt Desktop''.<br />
<br />
== 配置 ==<br />
<br />
一般LXQt试图提供GUI应用程序改变其设置。配置文件中{{ic|~/.config/lxqt}},这个目录是自动初始化,新用户的默认配置是{{ic|/etc/xdg/lxqt}}中找到。<br />
<br />
=== 取代 Openbox ===<br />
<br />
虽然[[Openbox]]是LXQt 默认[[window manager]],你可以指定一个不同的窗口管理器,通过“会话设置”与LXQt使用,<br />
或编辑 {{ic|~/.config/lxqt/session.conf}}. 更改以下行:<br />
window_manager=openbox<br />
<br />
选择[[window manager]]:<br />
<br />
window_manager=''your_window_manager''<br />
<br />
=== 自动启动应用程序===<br />
<br />
要在登录的时候启动 X 程序,从LXQt单击主菜单-> 首选项 -> LXQt 设置 -> 会话设置。可以通过下面命令启动:<br />
lxqt-config-session<br />
<br />
从这个窗口中,点击左侧"AutoStart" ,添加程序到全局自动启动(使用这个规范的所有回话都会启动此程序) <br />
或本地自动启动 (标签 LXQt Autostart) (这个选项有个 Bug,见[https://github.com/lxde/lxqt/issues/746 issue 746]).<br />
<br />
=== 编辑程序菜单 ===<br />
<br />
可以通过编辑{{ic|/usr/share/applications/lxqt-*.desktop}}中的桌面文件修改菜单,参阅 [[Desktop entries]]。<br />
<br />
== 建议应用 ==<br />
<br />
LXQt是一个轻量级桌面,作一个简单的安装不会提供很多桌面应用程序。它留给用户选择他们想要安装的应用程序。[https://github.com/Razor-qt/razor-qt/wiki/3rd-party-applications Razor-qt wiki] 上有一个网页,其中列出了一些有用的 Qt 应用程序,您可能想要安装。另请参阅 [[List of applications]] 的页面中Arch可用应用程序的完整列表。<br />
<br />
== 参阅 ==<br />
<br />
* [http://lxqt.org LXQt homepage]<br />
* [https://github.com/lxde/lxqt LXQt development]<br />
* [http://lxqt-de.deviantart.com/ LXQt on deviantART]<br />
* [https://github.com/lxde/lxqt/wiki LXQt wiki on GitHUb]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=LXQt_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409252
LXQt (简体中文)
2015-11-15T13:27:29Z
<p>Aaron chen: /* 安装 */</p>
<hr />
<div>[[Category:Desktop environments (简体中文)]]<br />
[[en:LXQt]]<br />
[[ja:LXQt]]<br />
[[ru:Razor-qt]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|LXDE}}<br />
{{Related|Desktop environment (简体中文)}}<br />
{{Related|Window manager}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|LXQt|2015-11-06|408290}}<br />
2013年间,洪任諭(“PCMan”)启动了将 LXDE 移植到 Qt 的项目。LXDE-Qt 的首个预览版发布于2013年7月3日。而在2013年7月21日,Razor-qt(一个与LXDE类似的桌面)与 LXDE 宣布合并,产生了 LXQt。这个桌面集合了 Razor-qt 和 LXDE 的组件。尽管 LXDE 目前的精力已经集中到 LXQt,GTK+ 2 的版本依然在维护。<br />
<br />
== 安装 ==<br />
<br />
[[安装]] {{Grp|lxqt}} 包组。<br />
你还需要安装一个图标主题。 默认的是 ''Oxygen'', 可以从 {{Pkg|oxygen-icons}} 包安装。<br />
<br />
你还可以安装以下附加功能包:<br />
<br />
* {{App|Connman|类似 [[NetworkManager]] 的网络管理器。| http://git.kernel.org/cgit/network/connman | {{Pkg|connman}}}}<br />
* {{App|LXQt Connman applet|LXQt [[Connman]] 的系统托盘小程序。| https://github.com/surlykke/lxqt-connman-applet | {{AUR|lxqt-connman-applet-git}}}}<br />
* {{App|LXImage-Qt|LXQt 的图像查看器和截图工具。| https://github.com/lxde/lximage-qt | {{AUR|lximage-qt}}}}<br />
* {{App|ObConf-Qt|Qt 版 ObConf,[[Openbox]] 的配置工具。 | https://github.com/lxde/obconf-qt | {{AUR|obconf-qt}}}}<br />
* {{App|QTerminal|基于 Qt 的轻量级终端模拟器。| https://github.com/qterminal/qterminal | {{AUR|qterminal}}}}<br />
* {{App|[[SDDM]]|LXQt 推荐的显示管理器。| https://github.com/sddm/sddm | {{Pkg|sddm}}}}<br />
<br />
== 开始桌面 ==<br />
<br />
=== 图形界面登入 ===<br />
<br />
在[[display manager|显示管理器]]的桌面菜单中选择 ''LXQt Desktop''.<br />
<br />
=== 使用 xinit ===<br />
<br />
在[[Xinitrc]]中添加:<br />
<br />
exec startlxqt<br />
<br />
== 配置 ==<br />
<br />
一般LXQt试图提供GUI应用程序改变其设置。配置文件中{{ic|~/.config/lxqt}},这个目录是自动初始化,新用户的默认配置是{{ic|/etc/xdg/lxqt}}中找到。<br />
<br />
=== 取代 Openbox ===<br />
<br />
虽然[[Openbox]]是LXQt 默认[[window manager]],你可以指定一个不同的窗口管理器,通过“会话设置”与LXQt使用,<br />
或编辑 {{ic|~/.config/lxqt/session.conf}}. 更改以下行:<br />
window_manager=openbox<br />
<br />
选择[[window manager]]:<br />
<br />
window_manager=''your_window_manager''<br />
<br />
=== 自动启动应用程序===<br />
<br />
要在登录的时候启动 X 程序,从LXQt单击主菜单-> 首选项 -> LXQt 设置 -> 会话设置。可以通过下面命令启动:<br />
lxqt-config-session<br />
<br />
从这个窗口中,点击左侧"AutoStart" ,添加程序到全局自动启动(使用这个规范的所有回话都会启动此程序) <br />
或本地自动启动 (标签 LXQt Autostart) (这个选项有个 Bug,见[https://github.com/lxde/lxqt/issues/746 issue 746]).<br />
<br />
=== 编辑程序菜单 ===<br />
<br />
可以通过编辑{{ic|/usr/share/applications/lxqt-*.desktop}}中的桌面文件修改菜单,参阅 [[Desktop entries]]。<br />
<br />
== 建议应用 ==<br />
<br />
LXQt是一个轻量级桌面,作一个简单的安装不会提供很多桌面应用程序。它留给用户选择他们想要安装的应用程序。[https://github.com/Razor-qt/razor-qt/wiki/3rd-party-applications Razor-qt wiki] 上有一个网页,其中列出了一些有用的 Qt 应用程序,您可能想要安装。另请参阅 [[List of applications]] 的页面中Arch可用应用程序的完整列表。<br />
<br />
== 参阅 ==<br />
<br />
* [http://lxqt.org LXQt homepage]<br />
* [https://github.com/lxde/lxqt LXQt development]<br />
* [http://lxqt-de.deviantart.com/ LXQt on deviantART]<br />
* [https://github.com/lxde/lxqt/wiki LXQt wiki on GitHUb]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=LXQt_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409249
LXQt (简体中文)
2015-11-15T13:18:14Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:Desktop environments (简体中文)]]<br />
[[en:LXQt]]<br />
[[ja:LXQt]]<br />
[[ru:Razor-qt]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|LXDE}}<br />
{{Related|Desktop environment (简体中文)}}<br />
{{Related|Window manager}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|LXQt|2015-11-06|408290}}<br />
2013年间,洪任諭(“PCMan”)启动了将 LXDE 移植到 Qt 的项目。LXDE-Qt 的首个预览版发布于2013年7月3日。而在2013年7月21日,Razor-qt(一个与LXDE类似的桌面)与 LXDE 宣布合并,产生了 LXQt。这个桌面集合了 Razor-qt 和 LXDE 的组件。尽管 LXDE 目前的精力已经集中到 LXQt,GTK+ 2 的版本依然在维护。<br />
<br />
== 安装 ==<br />
<br />
[[安装]] {{Grp|lxqt}} 包组。<br />
你还需要安装一个图标主题。 默认的是 ''Oxygen'', 可以从 {{Pkg|oxygen-icons}} 包安装。<br />
<br />
你还可以安装以下附加功能包:<br />
<br />
* {{App|LXImage-Qt|LXQt的图像查看器和截图工具.| https://github.com/lxde/lximage-qt | {{AUR|lximage-qt}}}}<br />
* {{App|ObConf-Qt| The Qt port of ObConf, the [[Openbox]] 配置工具。 | https://github.com/lxde/obconf-qt | {{AUR|obconf-qt}}}}<br />
* {{App|QTerminal|基于Qt轻量级的终端模拟器.| https://github.com/qterminal/qterminal | {{AUR|qterminal}}}}<br />
* {{App|[[SDDM]]|LXQt推荐的显示管理器。| https://github.com/sddm/sddm | {{Pkg|sddm}}}}<br />
<br />
== 开始桌面 ==<br />
<br />
=== 图形界面登入 ===<br />
<br />
在[[display manager|显示管理器]]的桌面菜单中选择 ''LXQt Desktop''.<br />
<br />
=== 使用 xinit ===<br />
<br />
在[[Xinitrc]]中添加:<br />
<br />
exec startlxqt<br />
<br />
== 配置 ==<br />
<br />
一般LXQt试图提供GUI应用程序改变其设置。配置文件中{{ic|~/.config/lxqt}},这个目录是自动初始化,新用户的默认配置是{{ic|/etc/xdg/lxqt}}中找到。<br />
<br />
=== 取代 Openbox ===<br />
<br />
虽然[[Openbox]]是LXQt 默认[[window manager]],你可以指定一个不同的窗口管理器,通过“会话设置”与LXQt使用,<br />
或编辑 {{ic|~/.config/lxqt/session.conf}}. 更改以下行:<br />
window_manager=openbox<br />
<br />
选择[[window manager]]:<br />
<br />
window_manager=''your_window_manager''<br />
<br />
=== 自动启动应用程序===<br />
<br />
要在登录的时候启动 X 程序,从LXQt单击主菜单-> 首选项 -> LXQt 设置 -> 会话设置。可以通过下面命令启动:<br />
lxqt-config-session<br />
<br />
从这个窗口中,点击左侧"AutoStart" ,添加程序到全局自动启动(使用这个规范的所有回话都会启动此程序) <br />
或本地自动启动 (标签 LXQt Autostart) (这个选项有个 Bug,见[https://github.com/lxde/lxqt/issues/746 issue 746]).<br />
<br />
=== 编辑程序菜单 ===<br />
<br />
可以通过编辑{{ic|/usr/share/applications/lxqt-*.desktop}}中的桌面文件修改菜单,参阅 [[Desktop entries]]。<br />
<br />
== 建议应用 ==<br />
<br />
LXQt是一个轻量级桌面,作一个简单的安装不会提供很多桌面应用程序。它留给用户选择他们想要安装的应用程序。[https://github.com/Razor-qt/razor-qt/wiki/3rd-party-applications Razor-qt wiki] 上有一个网页,其中列出了一些有用的 Qt 应用程序,您可能想要安装。另请参阅 [[List of applications]] 的页面中Arch可用应用程序的完整列表。<br />
<br />
== 参阅 ==<br />
<br />
* [http://lxqt.org LXQt homepage]<br />
* [https://github.com/lxde/lxqt LXQt development]<br />
* [http://lxqt-de.deviantart.com/ LXQt on deviantART]<br />
* [https://github.com/lxde/lxqt/wiki LXQt wiki on GitHUb]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Udev_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=409167
Udev (简体中文)
2015-11-14T17:57:39Z
<p>Aaron chen: /* 编写 udev 规则 */</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category: 简体中文]]<br />
[[Category:Hardware detection and troubleshooting (简体中文)]]<br />
[[cs:Udev]]<br />
[[de:Udev]]<br />
[[en:Udev]]<br />
[[es:Udev]]<br />
[[fr:Udev]]<br />
[[it:Udev]]<br />
[[ja:Udev]]<br />
[[ru:Udev]]<br />
[[zh-TW:Udev]]<br />
{{TranslationStatus (简体中文)|Udev|2015-10-07|403579}}<br />
摘自[[Wikipedia:Udev|维基百科:Udev]]:<br />
:udev 是 Linux 内核的设备管理器。总的来说,它取代了 devfs 和 hotplug,负责管理 {{ic|/dev}} 中的设备节点。同时,udev 也处理所有用户空间发生的硬件添加、删除事件,以及某些特定设备所需的固件加载。<br />
<br />
{{ic|udev}} 取代了{{ic|hotplug}} 和 {{Ic|hwdetect}}两个工具。<br />
<br />
与传统的顺序加载相比,udev 通过并行加载内核模块提供了潜在的性能优势。异步加载模块的方式也有一个天生的缺点:无法保证每次加载模块的顺序,如果机器具有多个块设备,那么它们的设备节点可能随机变化。例如如果有两个硬盘,{{ic|/dev/sda}} 可能会随机变成{{ic|/dev/sdb}}。后面有更详细的信息。<br />
<br />
== 安装 ==<br />
<br />
Udev 现在是 {{Pkg|systemd}} 的组成部分,默认已安装。有关信息请查阅 {{ic|systemd-udevd.service(8)}} 的[[man page|手册页]]。<br />
<br />
AUR 里有一个独立的 Udev 派生版:[[eudev]]。<br />
<br />
== udev 规则 ==<br />
udev 规则以管理员身份编写并保存在 {{ic|/etc/udev/rules.d/}} 目录,其文件名必须以 {{ic|.rules}} 结尾。各种软件包提供的规则文件位于 {{ic|/lib/udev/rules.d/}}。如果 {{ic|/usr/lib}} 和 {{ic|/etc}} 这两个目录中有同名文件,则 {{ic|/etc}} 中的文件优先。 <br />
<br />
=== 编写 udev 规则 ===<br />
<br />
{{Expansion|You can workaround the FUSE errors (caused by udev killing the mount process) by using a systemd service [https://github.com/Ferk/udev-media-automount] [http://jasonwryan.com/blog/2014/01/20/udev/]}}<br />
<br />
{{Warning|To mount removable drives, do not call {{ic|mount}} from udev rules. In case of FUSE filesystems, you will get {{ic|Transport endpoint not connected}} errors. Instead, you could use [[udisks]] that handles automount correctly or to make mount work inside udev rules, copy {{ic|/usr/lib/systemd/system/systemd-udevd.service}} to {{ic|/etc/systemd/system/systemd-udevd.service}} and replace {{ic|1=MountFlags=slave}} to {{ic|1=MountFlags=shared}}.[http://unix.stackexchange.com/a/154318] Keep in mind though that udev is not intended to invoke long-running processes.}}<br />
<br />
* 要想学习写udev规则,请访问[http://www.reactivated.net/writing_udev_rules.html 编写 udev 规则]。(译注:[http://www.cnitblog.com/luofuchong/archive/2007/12/18/37831.html 这里]有一篇转载的该文简体中文译本)<br />
* 要想查看 udev 规则的例子,请查阅上述文章的 [http://www.reactivated.net/writing_udev_rules.html#example-printer 范例] 章节。<br />
<br />
下面是一个规则的实例,给出的是当接入一个摄像头时创建一个符号链接 {{ic|/dev/video-cam1}} 。首先,我们发现摄像头被接入并且被挂载为 {{ic|/dev/video2}} 设备。写下这条规则的原因是由于下一次引导时这个设备可能会有个不同的名字,比如 {{ic|/dev/video0}}。<br />
<br />
{{hc|# udevadm info -a -p $(udevadm info -q path -n /dev/video2)|<nowiki><br />
Udevadm info starts with the device specified by the devpath and then walks up the chain of parent devices. It prints for every device found, all possible attributes in the udev rules key format. A rule to match, can be composed by the attributes of the device and the attributes from one single parent device.<br />
<br />
looking at device '/devices/pci0000:00/0000:00:04.1/usb3/3-2/3-2:1.0/video4linux/video2':<br />
KERNEL=="video2"<br />
SUBSYSTEM=="video4linux"<br />
...<br />
looking at parent device '/devices/pci0000:00/0000:00:04.1/usb3/3-2/3-2:1.0':<br />
KERNELS=="3-2:1.0"<br />
SUBSYSTEMS=="usb"<br />
...<br />
looking at parent device '/devices/pci0000:00/0000:00:04.1/usb3/3-2':<br />
KERNELS=="3-2"<br />
SUBSYSTEMS=="usb"<br />
...<br />
ATTRS{idVendor}=="05a9"<br />
...<br />
ATTRS{manufacturer}=="OmniVision Technologies, Inc."<br />
ATTRS{removable}=="unknown"<br />
ATTRS{idProduct}=="4519"<br />
ATTRS{bDeviceClass}=="00"<br />
ATTRS{product}=="USB Camera"<br />
...<br />
</nowiki>}}<br />
<br />
From the video4linux device we use {{ic|<nowiki>KERNEL=="video2"</nowiki>}} and {{ic|<nowiki>SUBSYSTEM=="video4linux"</nowiki>}}, then we match the webcam using vendor and product ID's from the usb parent {{ic|<nowiki>SUBSYSTEMS=="usb"</nowiki>}}, {{ic|<nowiki>ATTRS{idVendor}=="05a9"</nowiki>}} and {{ic|<nowiki>ATTRS{idProduct}=="4519"</nowiki>}}.<br />
<br />
{{hc|/etc/udev/rules.d/83-webcam.rules|<nowiki><br />
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="05a9", ATTRS{idProduct}=="4519", SYMLINK+="video-cam1"<br />
</nowiki>}}<br />
<br />
In the example above we create a symlink using {{ic|<nowiki>SYMLINK+="video-cam1"</nowiki>}} but we could easily set user {{ic|<nowiki>OWNER="john"</nowiki>}} or group using {{ic|<nowiki>GROUP="video"</nowiki>}} or set the permissions using {{ic|<nowiki>MODE="0660"</nowiki>}}. However, if you intend to write a rule to do something when a device is being removed, be aware that device attributes may not be accessible. In this case, you will have to work with preset device [[environment variables]]. To monitor those environment variables, execute the following command while unplugging your device:<br />
<br />
# udevadm monitor --environment --udev<br />
<br />
In this command's output, you will see value pairs such as ID_VENDOR_ID and ID_MODEL_ID, which match your previously used attributes "idVendor" and "idProduct". A rule that uses device environment variables may look like this:<br />
<br />
{{hc|/etc/udev/rules.d/83-webcam-removed.rules|<nowiki><br />
ACTION=="remove", SUBSYSTEM=="usb", ENV{ID_VENDOR_ID}=="05a9", ENV{ID_MODEL_ID}=="4519", RUN+="/path/to/your/script"<br />
</nowiki>}}<br />
<br />
=== 列出设备属性 ===<br />
<br />
To get a list of all of the attributes of a device you can use to write rules, run this command:<br />
<br />
# udevadm info -a -n [device name]<br />
<br />
Replace {{ic|[device name]}} with the device present in the system, such as {{ic|/dev/sda}} or {{ic|/dev/ttyUSB0}}.<br />
<br />
If you do not know the device name you can also list all attributes of a specific system path:<br />
<br />
# udevadm info -a -p /sys/class/backlight/acpi_video0<br />
<br />
=== 加载前测试规则 ===<br />
<br />
# udevadm test $(udevadm info -q path -n [device name]) 2>&1<br />
<br />
This will not perform all actions in your new rules but it will however process symlink rules on existing devices which might come in handy if you are unable to load them otherwise. You can also directly provide the path to the device you want to test the udev rule for:<br />
<br />
# udevadm test /sys/class/backlight/acpi_video0/<br />
<br />
=== 加载新规则 ===<br />
<br />
Udev 自动侦测规则文件的变化,所以修改会立即生效,无需重启 udev。但已接入设备的规则不会自动触发。像 USB 这类热插拔设备也许需要重新插拔才能使新规则生效,也可能需要卸载并重载内核的 ohci-hcd 和 ehci-hcd 模块以重新挂载所有 USB 设备。<br />
<br />
如果规则自动重载失败<br />
<br />
# udevadm control --reload<br />
<br />
可以手工强制触发规则<br />
<br />
# udevadm trigger<br />
<br />
== Udisks ==<br />
<br />
参阅 [[Udisks]].<br />
<br />
== 提示与技巧 ==<br />
<br />
=== 访问固件编程器(烧录器)和 USB 虚拟串行设备 ===<br />
<br />
{{Accuracy|Making a device world-writable is not secure.}}<br />
{{Style|One example is enough, others can surely be found with {{ic|lsusb}}.}}<br />
<br />
The following ruleset will allow normal users (within the "users" group) the ability to access the [http://www.ladyada.net/make/usbtinyisp/ USBtinyISP] USB programmer for AVR microcontrollers and a generic (SiLabs [http://www.silabs.com/products/interface/usbtouart CP2102]) USB to UART adapter, the [http://www.atmel.com/tools/AVRDRAGON.aspx?tab=overview Atmel AVR Dragon] programmer, and the [http://www.atmel.com/tools/AVRISPMKII.aspx Atmel AVR ISP mkII]. Adjust the permissions accordingly. Verified as of 31-10-2012.<br />
<br />
{{hc|/etc/udev/rules.d/50-embedded_devices.rules|2=<nowiki><br />
# USBtinyISP Programmer rules<br />
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c9f", GROUP="users", MODE="0666"<br />
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="0479", GROUP="users", MODE="0666"<br />
<br />
# USBasp Programmer rules http://www.fischl.de/usbasp/<br />
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", GROUP="users", MODE="0666"<br />
<br />
# Mdfly.com Generic (SiLabs CP2102) 3.3v/5v USB VComm adapter<br />
SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", GROUP="users", MODE="0666"<br />
<br />
#Atmel AVR Dragon (dragon_isp) rules<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2107", GROUP="users", MODE="0666"<br />
<br />
#Atmel AVR JTAGICEMKII rules<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2103", GROUP="users", MODE="0666"<br />
<br />
#Atmel Corp. AVR ISP mkII<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2104", GROUP="users", MODE="0666"<br />
<br />
#Atmel Copr. JTAGICE3<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2140", GROUP="users", MODE="0666"<br />
</nowiki>}}<br />
<br />
=== USB 插入时执行规则 ===<br />
<br />
See the [[Execute on USB insert]] article or the [http://igurublog.wordpress.com/downloads/script-devmon/ devmon wrapper script].<br />
<br />
=== VGA 线缆接入时执行规则 ===<br />
<br />
Create the rule {{ic|/etc/udev/rules.d/95-monitor-hotplug.rules}} with the following content to launch {{Pkg|arandr}} on plug in of a VGA monitor cable:<br />
<br />
KERNEL=="card0", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/''username''/.Xauthority", RUN+="/usr/bin/arandr"<br />
<br />
=== 侦测新的 eSATA 设备 ===<br />
<br />
If your eSATA drive is not detected when you plug it in, there are a few things you can try. You can reboot with the eSATA plugged in. Or you could try<br />
<br />
# echo 0 0 0 | tee /sys/class/scsi_host/host*/scan<br />
<br />
Or you could install {{AUR|scsiadd}} (from the AUR) and try<br />
<br />
# scsiadd -s<br />
<br />
Hopefully, your drive is now in {{ic|/dev}}. If it is not, you could try the above commands while running<br />
<br />
# udevadm monitor<br />
<br />
to see if anything is actually happening.<br />
<br />
=== 将内置 SATA 接口标记为 eSATA ===<br />
<br />
If you connected a eSATA bay or an other eSATA adapter the system will still recognize this disk as an internal SATA drive. [[GNOME]] and [[KDE]] will ask you for your root password all the time. The following rule will mark the specified SATA-Port as an external eSATA-Port. With that, a normal GNOME user can connect their eSATA drives to that port like a USB drive, without any root password and so on.<br />
<br />
{{hc|/etc/udev/rules.d/10-esata.rules|2=<nowiki><br />
DEVPATH=="/devices/pci0000:00/0000:00:1f.2/host4/*", ENV{UDISKS_SYSTEM}="0"<br />
</nowiki>}}<br />
<br />
{{Note|The {{ic|DEVPATH}} can be found after connection the eSATA drive with the following commands (replace {{ic|sdb}} accordingly):<br />
<br />
# udevadm info -q path -n /dev/sdb<br />
/devices/pci0000:00/0000:00:1f.2/host4/target4:0:0/4:0:0:0/block/sdb<br />
<br />
# find /sys/devices/ -name sdb<br />
/sys/devices/pci0000:00/0000:00:1f.2/host4/target4:0:0/4:0:0:0/block/sdb<br />
}}<br />
<br />
=== 设置静态设备名 ===<br />
<br />
Because udev loads all modules asynchronously, they are initialized in a different order. This can result in devices randomly switching names. A udev rule can be added to use static device names.<br />
<br />
See also [[Persistent block device naming]] for block devices and [[Network configuration#Device names]] for network devices.<br />
<br />
==== 视频设备 ====<br />
<br />
For setting up the webcam in the first place, refer to [[Webcam setup#Webcam configuration|Webcam configuration]].<br />
<br />
Using multiple webcams, useful for example with {{pkg|motion}} (software motion detector which grabs images from video4linux devices and/or from webcams), will assign video devices as /dev/video0..n randomly on boot. The recommended solution is to create symlinks using an ''udev'' rule (as in the example in [[#Writing udev rules]]):<br />
<br />
{{hc|/etc/udev/rules.d/83-webcam.rules|<nowiki><br />
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="05a9", ATTRS{idProduct}=="4519", SYMLINK+="video-cam1"<br />
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="08f6", SYMLINK+="video-cam2"<br />
KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="0840", SYMLINK+="video-cam3"<br />
</nowiki>}}<br />
<br />
{{Note|Using names other than {{ic|/dev/video*}} will break preloading of {{ic|v4l1compat.so}} and perhaps {{ic|v4l2convert.so}}}}<br />
<br />
==== 打印机 ====<br />
<br />
If you use multiple printers, {{ic|/dev/lp[0-9]}} devices will be assigned randomly on boot, which will break e.g. [[CUPS]] configuration. <br />
<br />
You can create following rule, which will create symlinks under {{ic|/dev/lp/by-id}} and {{ic|/dev/lp/by-path}}, similar to [[Persistent block device naming]] scheme:<br />
<br />
{{hc|/etc/udev/rules.d/60-persistent-printer.rules|<nowiki><br />
ACTION=="remove", GOTO="persistent_printer_end"<br />
<br />
# This should not be necessary<br />
#KERNEL!="lp*", GOTO="persistent_printer_end"<br />
<br />
SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id"<br />
ENV{ID_TYPE}!="printer", GOTO="persistent_printer_end"<br />
<br />
ENV{ID_SERIAL}=="?*", SYMLINK+="lp/by-id/$env{ID_BUS}-$env{ID_SERIAL}"<br />
<br />
IMPORT{builtin}="path_id"<br />
ENV{ID_PATH}=="?*", SYMLINK+="lp/by-path/$env{ID_PATH}"<br />
<br />
LABEL="persistent_printer_end"<br />
</nowiki>}}<br />
<br />
==== USB 闪存设备 ====<br />
<br />
USB flash devices usually contain partitions, and partition labels are one way to have a static naming for a device. Another way is to create a udev rule for it. <br />
<br />
Get the serial number and USB ids from the USB flash drive (if you use multiple of the same make, you might have to check the serial is indeed unique):<br />
lsusb -v | grep -A 5 Vendor<br />
<br />
Create a udev rule for it by adding the following to a file in {{ic|/etc/udev/rules.d/}}, such as {{ic|8-usbstick.rules}}:<br />
KERNEL=="sd*", ATTRS{serial}=="$SERIAL", ATTRS{idVendor}=="$VENDOR", ATTRS{idProduct}=="$PRODUCT" SYMLINK+="$SYMLINK%n"<br />
<br />
Replace {{ic|$SERIAL}}, {{ic|$VENDOR}}, {{ic|$PRODUCT}} from above output accordingly and {{ic|$SYMLINK}} with the desired name. {{ic|%n}} will expand to the partition number. For example, if the device has two partitions, two symlinks will be created. You do not need to go with the 'serial' attribute. If you have a custom rule of your own, you can put it in as well (e.g. using the vendor name).<br />
<br />
Rescan sysfs:<br />
udevadm trigger<br />
Now check the contents of {{ic|/dev}}:<br />
ls /dev<br />
It should show the device with the desired name.<br />
<br />
=== 唤醒挂起的 USB 设备 ===<br />
<br />
First, find vendor and product ID of your device, for example<br />
<br />
{{hc|<nowiki># lsusb | grep Logitech</nowiki>|Bus 007 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver}}<br />
<br />
Now change the {{ic|power/wakeup}} attribute of the device and the USB controller it is connected to, which is in this case {{ic|driver/usb7/power/wakeup}}. Use the following rule:<br />
<br />
{{hc|/etc/udev/rules.d/50-wake-on-device.rules|<nowiki><br />
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52b", ATTR{power/wakeup}="enabled", ATTR{driver/usb7/power/wakeup}="enabled"<br />
</nowiki>}}<br />
<br />
{{Note|Also make sure the USB controller is enabled in {{ic|/proc/acpi/wakeup}}.}}<br />
<br />
=== 触发事件 ===<br />
<br />
{{Merge|#Testing rules before loading|similar trick}}<br />
<br />
It can be useful to trigger various udev events. For example, you might want to simulate a USB device disconnect on a remote machine. In such cases, use {{ic|udevadm trigger}}:<br />
<br />
# udevadm trigger -v -t subsystems -c remove -s usb -a "idVendor=abcd"<br />
<br />
This command will trigger a USB remove event on all USB devices with vendor ID {{ic|abcd}}.<br />
<br />
== 排错 ==<br />
<br />
=== 屏蔽模块 ===<br />
极个别情况下,udev 也会犯错或加载错误的模块。为了防止错误的发生,你可以使用模块禁用列表。只要模块加入该列表,无论是启动时,或者是运行时(如usb硬盘等)udev都不会加载这些模块。参见[[blacklisting]].<br />
<br />
=== udevd 引导时挂起 ===<br />
<br />
After migrating to LDAP or updating an LDAP-backed system udevd can hang at boot at the message "Starting UDev Daemon". This is usually caused by udevd trying to look up a name from LDAP but failing, because the network is not up yet. The solution is to ensure that all system group names are present locally.<br />
<br />
Extract the group names referenced in udev rules and the group names actually present on the system:<br />
<br />
# fgrep -r GROUP /etc/udev/rules.d/ /usr/lib/udev/rules.d | perl -nle '/GROUP\s*=\s*"(.*?)"/ && print $1;' | sort | uniq > udev_groups<br />
# cut -f1 -d: /etc/gshadow /etc/group | sort | uniq > present_groups<br />
<br />
To see the differences, do a side-by-side diff:<br />
<br />
# diff -y present_groups udev_groups<br />
...<br />
network <<br />
nobody <<br />
ntp <<br />
optical optical<br />
power | pcscd<br />
rfkill <<br />
root root<br />
scanner scanner<br />
smmsp <<br />
storage storage<br />
...<br />
<br />
In this case, the {{ic|pcscd}} group is for some reason not present in the system. [[Users and groups#Group management|Add the missing groups]]. Also, make sure that local resources are looked up before resorting to LDAP. {{ic|/etc/nsswitch.conf}} should contain the following line:<br />
<br />
group: files ldap<br />
<br />
=== BusLogic ===<br />
<br />
BusLogic 设备被损坏而且导致启动时死机。这是一个内核的Bug目前还没有修正。<br />
<br />
=== 一些移动设备不可移除 ===<br />
创建自定义 udev 规则,设置 UDISKS_SYSTEM_INTERNAL=0。参见 udisks 手册。<br />
<br />
<br />
=== 声音问题和一些不能自动加载的模块 ===<br />
一些用户发现 {{ic|/etc/modprobe.d/sound.conf}} 中的遗留配置会引起这些问题,请清理配置并重试。<br />
{{注意|从 {{Ic|udev>&#61;171}} 开始 OSS 模拟模块({{Ic|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) 默认不会自动装载。}}<br />
<br />
<br />
=== IDE CD/DVD 驱动器的支持 ===<br />
<br />
Starting with version 170, udev does not support CD-ROM/DVD-ROM drives that are loaded as traditional IDE drives with the {{ic|ide_cd_mod}} module and show up as {{ic|/dev/hd*}}. The drive remains usable for tools which access the hardware directly, like ''cdparanoia'', but is invisible for higher userspace programs, like KDE.<br />
<br />
A cause for the loading of the ide_cd_mod module prior to others, like sr_mod, could be e.g. that you have for some reason the module piix loaded with your [[initramfs]]. In that case you can just replace it with ata_piix in your {{ic|/etc/mkinitcpio.conf}}.<br />
<br />
=== 光驱被标识为磁盘 ===<br />
<br />
If the group ID of your optical drive is set to {{ic|disk}} and you want to have it set to {{ic|optical}}, you have to create a custom udev rule:<br />
<br />
{{hc|/etc/udev/rules.d|2=<nowiki><br />
# permissions for IDE CD devices<br />
SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", ATTRS{media}=="cdrom*", GROUP="optical"<br />
<br />
# permissions for SCSI CD devices<br />
SUBSYSTEMS=="scsi", KERNEL=="s[rg][0-9]*", ATTRS{type}=="5", GROUP="optical"</nowiki>}}<br />
<br />
== 参阅 ==<br />
<br />
* [https://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/udev.html udev 主页]<br />
* [https://www.linux.com/news/hardware/peripherals/180950-udev udev 介绍]<br />
* [http://vger.kernel.org/vger-lists.html#linux-hotplug udev 邮件列表]<br />
* [http://jasonwryan.com/blog/2014/01/20/udev/ Scripting with udev]<br />
* [http://www.reactivated.net/writing_udev_rules.html 编写 udev 规则]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Bluetooth_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=408927
Bluetooth (简体中文)
2015-11-11T16:41:23Z
<p>Aaron chen: /* 图形化前端 */</p>
<hr />
<div>[[Category:Bluetooth (简体中文)]]<br />
[[cs:Bluetooth]]<br />
[[de:Bluetooth]]<br />
[[en:Bluetooth]]<br />
[[es:Bluetooth]]<br />
[[fr:Bluetooth]]<br />
[[it:Bluetooth]]<br />
[[ja:Bluetooth]]<br />
[[ru:Bluetooth]]<br />
[http://www.bluetooth.org/ 蓝牙]是一个短距离无线通信标准,适用于手机、计算机和其他电子设备之间的通信。在 Linux 中,通常使用的蓝牙协议栈实现是 [http://www.bluez.org/ BlueZ].<br />
<br />
==安装==<br />
[[Install|安装]] {{Pkg|bluez}} 和 {{Pkg|bluez-utils}} 软件包。{{Pkg|bluez}} 软件包提供蓝牙协议栈,{{Pkg|bluez-utils}} 软件包提供 {{ic|bluetoothctl}} 工具。<br />
如果尚未加载通用蓝牙驱动则需先加载:<br />
# modprobe btusb<br />
<br />
然后 [[start|启动]] {{ic|bluetooth.service}} systemd 单元。可以在系统引导时自动 [[enable|启用]] 它。<br />
<br />
{{注意|<br />
* 默认情况下,蓝牙仅为 {{ic|lp}} 用户组中的用户启用 bnep0 设备。如果想要加入蓝牙系统,需确认已将用户加入该组。可以修改{{ic|/etc/dbus-1/system.d/bluetooth.conf}}文件中相应的组配置来实现。<br />
* 有些蓝牙适配器是与无线网卡绑定在一起的(比如:[http://www.intel.com/content/www/us/en/wireless-products/centrino-advanced-n-6235.html 英特尔迅驰])。这就要求无线网卡先被启用(典型情况是在笔记本电脑上用快捷键启用)以便蓝牙适配器对内核可见。<br />
* 有些厂家(如 Broadcom)的蓝牙卡与网卡有冲突(不兼容)。这就需要确认在网络服务引导之前蓝牙设备已连接。}}<br />
<br />
== 通过命令行工具配置蓝牙 ==<br />
=== Bluetoothctl ===<br />
通过命令行配对是最可靠的选择。准确的配对过程依不同设备类型及其所提供的输入功能而各不相同。下面提供使用{{ic|/usr/bin/bluetoothctl}}配对的一般过程:<br />
<br />
启动 {{ic|bluetoothctl}} 交互命令。可以输入 {{ic|help}} 列出所有有效的命令。<br />
* 输入{{ic|power on}} 命令打开控制器电源。默认是关闭的。<br />
* 输入{{ic|devices}} 命令获取要配对设备的 MAC 地址。<br />
* 如果设备未在清单中列出,输入 {{ic|scan on}} 命令设置设备发现模式。<br />
* 输入{{ic|agent on}} 命令打开代理。<br />
* 输入 {{ic|pair ''MAC Address''}} 开始配对(支持 tab 键补全)。<br />
* 如果使用无 PIN 码设备,再次连接可能需要手工认证。输入 {{ic|trust ''MAC Address''}} 命令。<br />
* 最后,用 {{ic|connect ''MAC_address''}} 命令建立连接。<br />
<br />
以下为一个交互实例:<br />
# bluetoothctl <br />
[NEW] Controller 00:10:20:30:40:50 pi [default]<br />
[bluetooth]# agent KeyboardOnly <br />
Agent registered<br />
[bluetooth]# default-agent <br />
Default agent request successful<br />
[bluetooth]# scan on<br />
Discovery started<br />
[CHG] Controller 00:10:20:30:40:50 Discovering: yes<br />
[NEW] Device 00:12:34:56:78:90 myLino<br />
[CHG] Device 00:12:34:56:78:90 LegacyPairing: yes<br />
[bluetooth]# pair 00:12:34:56:78:90<br />
Attempting to pair with 00:12:34:56:78:90<br />
[CHG] Device 00:12:34:56:78:90 Connected: yes<br />
[CHG] Device 00:12:34:56:78:90 Connected: no<br />
[CHG] Device 00:12:34:56:78:90 Connected: yes<br />
Request PIN code<br />
[agent] Enter PIN code: 1234<br />
[CHG] Device 00:12:34:56:78:90 Paired: yes<br />
Pairing successful<br />
[CHG] Device 00:12:34:56:78:90 Connected: no<br />
<br />
为使系统重启后激活设备,需添加一条 udev 规则:<br />
<br />
{{hc|/etc/udev/rules.d/10-local.rules|2=<br />
# Set bluetooth power up<br />
ACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfig hci0 up"}}<br />
<br />
为使设备在系统挂起后唤醒时自动上电,应使用如下例所示 ''systemd'' 服务:<br />
<br />
{{hc|/etc/systemd/system/bluetooth-auto-power@.service|<nowiki><br />
[Unit]<br />
Description=Bluetooth auto power on<br />
After=bluetooth.service sys-subsystem-bluetooth-devices-%i.device suspend.target<br />
<br />
[Service]<br />
Type=oneshot<br />
#We could also do a 200 char long call to bluez via dbus. Except this does not work since bluez does not react to dbus at this point of the resume sequence and I do not know how I get this service to run at a time it does. So we just ignore bluez and force %i up using hciconfig. Welcome to the 21st century.<br />
#ExecStart=/usr/bin/dbus-send --system --type=method_call --dest=org.bluez /org/bluez/%I org.freedesktop.DBus.Properties.Set string:org.bluez.Adapter1 string:Powered variant:boolean:true<br />
ExecStart=/usr/bin/hciconfig %i up<br />
<br />
[Install]<br />
WantedBy=suspend.target<br />
</nowiki>}}<br />
<br />
== 图形化前端 ==<br />
<br />
下面的软件包提供了一个图形化的界面来自定义蓝牙。<br />
<br />
=== GNOME Bluetooth ===<br />
<br />
[https://wiki.gnome.org/Projects/GnomeBluetooth GNOME Bluetooth] 是 [[GNOME]] 的 蓝牙管理工具。{{Pkg|gnome-bluetooth}} 软件包提供后端。{{Pkg|gnome-shell}} 提供状态监视小部件。{{Pkg|gnome-control-center}} 提供图形化配置前端工具,可以在'''活动概览'''中输入'''Bluetooth'''或者用 {{ic|gnome-control-center bluetooth}} 命令打开。可以用 {{ic|bluetooth-sendto}} 命令直接向远端设备发送文件。<br />
<br />
要接收文件,必须安装 {{Pkg|gnome-user-share}} 软件包。然后在 ''设置 -> 共享'' 中授权配对的设备通过蓝牙接收文件。<br />
<br />
{{小贴士|若要在 Thunar 中文件属性的''发送到''菜单中增加蓝牙选项,参阅[http://docs.xfce.org/xfce/thunar/send-to 这里]的命令。(需要设置的命令是 {{ic|bluetooth-sendto %F}})。}}<br />
<br />
=== Bluedevil ===<br />
<br />
bluedevil 是 [[KDE (简体中文)|KDE]] 的蓝牙管理工具,可以用 {{Pkg|bluedevil}}(KDE Plasma 5)或 {{Pkg|bluedevil4}}(KDE 4)[[安装]]。<br />
<br />
确认{{ic|bluetooth}}守护进程在运行。你可以在dolphin和系统通知区域里得到一个蓝牙图标,你可以通过点击这个图标来设置bluedevil、检测蓝牙设备等等。你也可以通过KDE的系统设置来配置bluedevil。<br />
<br />
=== Blueberry ===<br />
<br />
''Blueberry'' 是 GNOME Bluetooth 的另一替代方案,可工作于所有桌面环境。可安装 {{Pkg|blueberry}} 软件包。它提供了配置工具(''blueberry'')和系统托盘程序(''blueberry-tray'')。<br />
=== Blueman ===<br />
参阅 [[Blueman]]<br />
<br />
== 手工配置 ==<br />
<br />
你需要编辑 {{ic|/etc/bluetooth}} 下的配置文件来实现人工配置Bluez。它们是:<br />
audio.conf<br />
input.conf<br />
main.conf<br />
network.conf<br />
rfcomm.conf<br />
<br />
默认的配置文件在绝大多数情况下都能都正常工作。绝大多数的配置选项在她们的文件里都有丰富的文档注释,所以自定义成为了一个简单到阅读配置选项的描述和注释的工作。全局设置从{{ic|main.conf}}开始<br />
<br />
=== 音频流 ===<br />
如果你想启用从你的设备到计算机的音频流,你必须更改 {{ic|audio.conf}} 然后添加这个到 {{ic|[General]}} 部分:<br />
Enable=Socket<br />
<br />
== 配对 ==<br />
{{注意| 这一部分描述可能不是完全的准确。感谢'''Gattschardo'''解决了'''个人验证码'''部分}}<br />
<br />
许多蓝牙(Bluetooth)设备要求在使用时[http://en.wikipedia.org/wiki/Bluetooth#Pairing 配对]。<br />
实际上的过程取决于配对涉及到的设备和这些设备的输入功能。<br />
在移动电话上的配对过程可能会像下面那样:<br />
* 计算机向移动电话发送一个配对请求<br />
* 移动电话上会提示输入一个由计算机给出的PIN(个人识别码)码<br />
* 必须在计算机上重新输入同一个序列(指上文中的PIN)。<br />
<br />
通过执行一下命令来搜索外部设备<br />
$ hcitool scan<br />
<br />
在不使用gnome-bluez包的情况下配对设备,你需要使用一个包含在bluez包里的,叫做''bluez-simple-agent''的工具。你需要从常用的软件仓库里获取几个跟python相关的工具来使这种方法可用:dbus-python和pygobject。 如果你准备好了,你可以以root身份执行这个脚本:<br />
<br />
# bluez-simple-agent<br />
<br />
如果它工作正常,你应当会在控制台得到消息:"Agent registered" 。<br />
<br />
现在你可以开始从你的移动电话开始配对工作,这个脚本会在控制台询问你PIN码,你输入进去然后按回车键确认,这样就完成了配对工作。接下来可以通过^C-c终止这个脚本的执行,只需要在配对的时候使用这个脚本,而连接设备时不需要用到它。<br />
<br />
需要查看例子.请向下翻页到示例部分。<br />
<br />
== 使用 Obex 发送接收文件 ==<br />
除了KDE和Gnome Bluetooth软件包之外,Obexfs是另一个选择,它可以允许你挂载你的移动电话作为文件系统的一部分。注意,如果要使用Obex,你需要一个能够提供Obex FTP服务的设备。<br />
安装Obex;<br />
# pacman -S obexfs<br />
<br />
然后你可以以root权限运行如下命令来挂载你的移动电话<br />
# obexfs -b <devices mac address> /mountpoint<br />
<br />
单看更多挂载选项,参阅http://dev.zuckschwerdt.org/openobex/wiki/ObexFs<br />
<br />
<br />
== 示例 ==<br />
<br />
=== 西门子 S55 ===<br />
<br />
这是我链接我的S55的过程。(我还没搞明白怎么样通过电话来初始化连接。)<br />
* 根据安装步骤<br />
* <br />
$> hcitool scan<br />
Scanning ...<br />
XX:XX:XX:XX:XX:XX NAME<br />
$> B=XX:XX:XX:XX:XX:XX<br />
在另一个终端启动simple-agent<br />
$> su -c bluez-simple-agent <br />
Password: <br />
Agent registered<br />
回到上一个终端<br />
$> obexftp -b $B -l "Address book"<br />
# Phone ask for pin, I enter it and answer yes when asked if I want to save the device<br />
...<br />
<file name="5F07.adr" size="78712" modified="20030101T001858" user-perm="WD" group-perm="" /><br />
...<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -g "Address book/5F07.adr"<br />
Browsing 00:01:E3:6B:FF:D7 ...<br />
Channel: 5<br />
Connecting...done<br />
Receiving "Address book/5F07.adr"... Sending "Address book"... done<br />
Disconnecting...done<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -p a <br />
...<br />
Sending "a"... done<br />
Disconnecting...done<br />
<br />
=== 罗技鼠标 MX Laser / M555b ===<br />
<br />
快速测试连接<br />
<br />
$> hidd --connect XX:XX:XX:XX:XX:XX<br />
<br />
通过桌面想到设置鼠标一实现自动重连。<br />
如果你的桌面环境不提供对此任务的支持,参阅[[Bluetooth mouse manual configuration]]向导.<br />
<br />
=== 摩托罗拉 V900 ===<br />
<br />
在安装blueman并且运行blueman-applet之后,在摩托罗拉设备的菜单connections -> bluetooth下单击"find me"。在blueman-applet搜索设备,找到摩托罗拉,然后单击blueman-applet中的“添加。单击“bond”,输入pin码,根据摩托罗达上的提示输入相同的pin码,在终端执行:<br />
<br />
cd ~/<br />
mkdir bluetooth-temp<br />
obexfs -n xx:yy:zz:... ~/bluetooth-temp<br />
cd ~/bluetooth-temp<br />
<br />
然后浏览... 这样操作时只能访问音频、视频和图片。<br />
<br />
=== 摩托罗拉 RAZ ===<br />
<br />
> pacman -S obextool obexfs obexftp openobex bluez<br />
<br />
> lsusb<br />
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 002 Device 002: ID 03f0:171d Hewlett-Packard Wireless (Bluetooth + WLAN) Interface [Integrated Module]<br />
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
<br />
> hciconfig hci0 up<br />
<br />
> hciconfig<br />
hci0: Type: BR/EDR Bus: USB<br />
BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8<br />
UP RUNNING<br />
RX bytes:348 acl:0 sco:0 events:11 errors:0<br />
TX bytes:38 acl:0 sco:0 commands:11 errors:0<br />
<br />
> hcitool dev<br />
Devices:<br />
hci0 00:16:41:97:BA:5E<br />
<br />
'''注意:确保手机上的蓝牙处于打开状态并且是可见的<br />
'''<br />
<br />
> hcitool scan<br />
Scanning ...<br />
00:1A:1B:82:9B:6D [quirxi]<br />
<br />
> hcitool inq<br />
Inquiring ...<br />
00:1A:1B:82:9B:6D clock offset: 0x1ee4 class: 0x522204<br />
<br />
> l2ping 00:1A:1B:82:9B:6D<br />
Ping: 00:1A:1B:82:9B:6D from 00:16:41:97:BA:5E (data size 44) ...<br />
44 bytes from 00:1A:1B:82:9B:6D id 0 time 23.94ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 1 time 18.85ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 2 time 30.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 3 time 18.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 4 time 17.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 5 time 17.88ms<br />
6 sent, 6 received, 0% loss<br />
<br />
> hcitool name 00:1A:1B:82:9B:6D<br />
[quirxi]<br />
<br />
# hciconfig -a hci0<br />
hci0: Type: BR/EDR Bus: USB<br />
BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8<br />
UP RUNNING<br />
RX bytes:9740 acl:122 sco:0 events:170 errors:0<br />
TX bytes:2920 acl:125 sco:0 commands:53 errors:0<br />
Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80<br />
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3<br />
Link policy:<br />
Link mode: SLAVE ACCEPT<br />
Name: 'BCM2045'<br />
Class: 0x000000<br />
Service Classes: Unspecified<br />
Device Class: Miscellaneous,<br />
HCI Version: 2.0 (0x3) Revision: 0x204a<br />
LMP Version: 2.0 (0x3) Subversion: 0x4176<br />
Manufacturer: Broadcoml / Corporation (15)<br />
<br />
> hcitool info 00:1A:1B:82:9B:6D<br />
Requesting information ...<br />
BD Address: 00:1A:1B:82:9B:6D<br />
Device Name: [quirxi]<br />
LMP Version: 1.2 (0x2) LMP Subversion: 0x309<br />
Manufacturer: Broadcom Corporation (15)<br />
Features: 0xff 0xfe 0x0d 0x00 0x08 0x08 0x00 0x00<br />
<3-slot packets> <5-slot packets> <encryption> <slot offset><br />
<timing accuracy> <role switch> <hold mode> <sniff mode><br />
<RSSI> <channel quality> <SCO link> <HV2 packets><br />
<HV3 packets> <A-law log> <CVSD> <power control><br />
<transparent SCO> <AFH cap. slave> <AFH cap. master><br />
<br />
<br />
'''编辑你的main.conf并且输入对应与你手机的class( Class = 0x100100 ):'''<br />
> vim /etc/bluetooth/main.conf<br />
<br />
# Default device class. Only the major and minor device class bits are<br />
# considered.<br />
#Class = 0x000100<br />
Class = 0x100100<br />
<br />
> /etc/rc.d/dbus start<br />
:: Starting D-BUS system messagebus <br />
[DONE]<br />
<br />
> /etc/rc.d/bluetooth start<br />
:: Stopping bluetooth subsystem: pand dund rfcomm hidd bluetoothd<br />
[DONE]<br />
:: Starting bluetooth subsystem: bluetoothd<br />
<br />
<br />
'''通过bluez-simple-agent配对只需要做一次。当你的手机要求输入pin码时,输入0000'''<br />
> /usr/bin/bluez-simple-agent hci0 00:1A:1B:82:9B:6D<br />
RequestPinCode (/org/bluez/10768/hci0/dev_00_1A_1B_82_9B_6D)<br />
Enter PIN Code: 0000<br />
Release<br />
New device (/org/bluez/10768/hci0/dev_00_1A_1B_82_9B_6D)<br />
<br />
'''现在你可以动过ObexFTP来访问你手机上的文件了:'''<br />
> obexftp -v -b 00:1A:1B:82:9B:6D -B 9 -l<br />
Connecting..\done<br />
Tried to connect for 448ms<br />
Receiving "(null)"...-<?xml version="1.0" ?><br />
<!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd"><br />
<folder-listing><br />
<parent-folder /><br />
<folder name="audio" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
<folder name="video" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
<folder name="picture" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
</folder-listing><br />
done<br />
Disconnecting..\done<br />
<br />
'''你也可以把你的手机作为文件系统的一部分挂载在你的计算机上:'''<br />
<br />
> groupadd bluetooth<br />
> mkdir /mnt/bluetooth<br />
> chown root:bluetooth /mnt/bluetooth<br />
> chmod 775 /mnt/bluetooth<br />
> usermod -a -G bluetooth arno<br />
<br />
> obexfs -b 00:1A:1B:82:9B:6D /mnt/bluetooth/<br />
> l /mnt/bluetooth/<br />
total 6<br />
drwxr-xr-x 1 root root 0 10. Okt 13:25 .<br />
drwxr-xr-x 5 root root 4096 10. Okt 10:08 ..<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 audio<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 picture<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 video<br />
<br />
=== 使用bluez-simple-agent来跟iPhone配对 ===<br />
<br />
假设有一个叫做hci0的蓝牙设备和一个在hcitool里显示为'00:00:DE:AD:BE:EF'的iPhone:<br />
<br />
# bluez-simple-agent hci0 00:00:DE:AD:BE:EF<br />
Passcode:<br />
<br />
== 疑难解答 ==<br />
<br />
=== passkey-agent ===<br />
$> passkey-agent --default 1234<br />
Can't register passkey agent<br />
The name org.bluez was not provided by any .service files<br />
你可能在启动<tt>/etc/rc.d/dbus</tt>之前启动了 <tt>/etc/rc.d/bluetooth</tt> <br />
$> hciconfig dev<br />
# (no listing)<br />
尝试运行 <tt>hciconfig hc0 up</tt><br />
<br />
=== Blueman ===<br />
如果blueman-applet启动失败,试着删除整个''/var/lib/bluetooth''目录然后重新启动电脑(或者仅仅重启hal、dbus和bluetooth这几个服务)。<br />
# rm -rf /var/lib/bluetooth<br />
# reboot<br />
<br />
=== gnome-bluetooth ===<br />
如果你通过在蓝牙属性里接受文件时受到如下消息:<br />
Bluetooth OBEX start failed: Invalid path<br />
Bluetooth FTP start failed: Invalid path<br />
<br />
那么运行<br />
# pacman -S xdg-user-dirs<br />
$ xdg-user-dirs-update<br />
你可以通过下列方式修改路径:<br />
$ vi ~/.config/user-dirs.dirs<br />
<br />
=== Bluetooth USB 适配器 ===<br />
如果你在使用USB适配器,你应当确认你的适配器被正确识别。你可以在插入适配器时通过查看<tt>/var/log/messages.log</tt>,这应当会出现类似于下面所示的信息:<br />
<br />
# tail -f /var/log/messages.log<br />
May 2 23:36:40 tatooine usb 4-1: new full speed USB device using uhci_hcd and address 9<br />
May 2 23:36:40 tatooine usb 4-1: configuration #1 chosen from 1 choice<br />
May 2 23:36:41 tatooine hcid[8109]: HCI dev 0 registered<br />
May 2 23:36:41 tatooine hcid[8109]: HCI dev 0 up<br />
May 2 23:36:41 tatooine hcid[8109]: Device hci0 has been added<br />
May 2 23:36:41 tatooine hcid[8109]: Starting security manager 0<br />
May 2 23:36:41 tatooine hcid[8109]: Device hci0 has been activated<br />
<br />
查看支持的硬件列表,请参考本页的[[Bluetooth#Resources|resources]]。<br />
<br />
如果你只得到了前面两行,说明了电脑发现了这个设备,但是你需要手动启动它。<br />
例如:<br />
<br />
hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0<br />
DOWN <br />
RX bytes:0 acl:0 sco:0 events:0 errors:0<br />
TX bytes:0 acl:0 sco:0 commands:0 errors:<br />
sudo hciconfig hci0 up<br />
hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:02:72:C4:7C:06 ACL MTU: 377:10 SCO MTU: 64:8<br />
UP RUNNING <br />
RX bytes:348 acl:0 sco:0 events:11 errors:0<br />
TX bytes:38 acl:0 sco:0 commands:11 errors:0<br />
<br />
要验证这个设备被正确检测,你可以使用<tt>bluez-utils</tt>当中的<tt>hcitool</tt>。你可以通过下面方式获得受支持的设备、它们的识别码和硬件地址:<br />
<br />
$ hcitool dev<br />
Devices:<br />
hci0 00:1B:DC:0F:DB:40<br />
<br />
可以通过<tt>hciconfig</tt>获得关于这个设备更详细的信息。<br />
<br />
$ hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:1B:DC:0F:DB:40 ACL MTU: 310:10 SCO MTU: 64:8<br />
UP RUNNING PSCAN ISCAN <br />
RX bytes:1226 acl:0 sco:0 events:27 errors:0<br />
TX bytes:351 acl:0 sco:0 commands:26 errors:0<br />
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80<br />
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 <br />
Link policy: RSWITCH HOLD SNIFF PARK <br />
Link mode: SLAVE ACCEPT <br />
Name: 'BlueZ (0)'<br />
Class: 0x000100<br />
Service Classes: Unspecified<br />
Device Class: Computer, Uncategorized<br />
HCI Ver: 2.0 (0x3) HCI Rev: 0xc5c LMP Ver: 2.0 (0x3) LMP Subver: 0xc5c<br />
Manufacturer: Cambridge Silicon Radio (10)<br />
<br />
=== hcitool scan: 没找到设备 ===<br />
* 在某些Dell的笔记本电脑(比如 Studio 15)上,你必须把蓝牙模式由HID改成HCI<br />
# hid2hci<br />
<br />
* 有时候这个简单的命令也会有用:<br />
# hciconfig hci0 up<br />
<br />
=== 我的电脑不可见 ===<br />
如果不能从你的移动电话上找到你的电脑,打开PSCAN和ISCAN:<br />
# 打开 PSCAN 和 ISCAN<br />
$ hciconfig hci0 piscan <br />
# 确认操作有效<br />
$ hciconfig <br />
hci0: Type: USB<br />
BD Address: 00:12:34:56:78:9A ACL MTU: 192:8 SCO MTU: 64:8<br />
'''UP RUNNING PSCAN ISCAN'''<br />
RX bytes:20425 acl:115 sco:0 events:526 errors:0<br />
TX bytes:5543 acl:84 sco:0 commands:340 errors:0<br />
<br />
{{注意 | 检查/etc/bluetooth/main.conf中的发现倒计时和配对倒计时}}<br />
<br />
试着在 /etc/bluetooth/main.conf 改变设备的class<br />
# Default device class. Only the major and minor device class bits are<br />
# considered.<br />
#Class = 0x000100 (from default config)<br />
Class = 0x100100<br />
<br />
This was the only solution to make my computer visible for my phone. <br />
<br />
=== Nautilus cannot browse files ===<br />
If nautilus doesn't open and show this error:<br />
Nautilus cannot handle obex: locations. Couldn't display "obex://[XX:XX:XX:XX:XX:XX]/".<br />
Install gvfs-obexftp package:<br />
# pacman -S gvfs-obexftp<br />
<br />
== 资源 ==<br />
*[http://www.bluez.org Official Linux Bluetooth protocol stack]<br />
*[http://www.holtmann.org/linux/bluetooth/devices.html List of Linux supported Bluetooth Hardware] >> The list is not available anymore!<br />
*[http://en.opensuse.org/HCL/Bluetooth_Adapters openSUSE Bluetooth Hardware Compatibility List (HCL)]<br />
*[http://www.gentoo.org/doc/en/bluetooth-guide.xml Gentoo wiki is usually good]<br />
*[http://linuxgazette.net/109/oregan3.html Accessing a Bluetooth phone on Linux Gazette]<br />
*[http://www.adamish.com/blog/#a000361 Bluetooth computer visibility]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Bluetooth_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=408926
Bluetooth (简体中文)
2015-11-11T15:58:52Z
<p>Aaron chen: /* Bluetoothctl */</p>
<hr />
<div>[[Category:Bluetooth (简体中文)]]<br />
[[cs:Bluetooth]]<br />
[[de:Bluetooth]]<br />
[[en:Bluetooth]]<br />
[[es:Bluetooth]]<br />
[[fr:Bluetooth]]<br />
[[it:Bluetooth]]<br />
[[ja:Bluetooth]]<br />
[[ru:Bluetooth]]<br />
[http://www.bluetooth.org/ 蓝牙]是一个短距离无线通信标准,适用于手机、计算机和其他电子设备之间的通信。在 Linux 中,通常使用的蓝牙协议栈实现是 [http://www.bluez.org/ BlueZ].<br />
<br />
==安装==<br />
[[Install|安装]] {{Pkg|bluez}} 和 {{Pkg|bluez-utils}} 软件包。{{Pkg|bluez}} 软件包提供蓝牙协议栈,{{Pkg|bluez-utils}} 软件包提供 {{ic|bluetoothctl}} 工具。<br />
如果尚未加载通用蓝牙驱动则需先加载:<br />
# modprobe btusb<br />
<br />
然后 [[start|启动]] {{ic|bluetooth.service}} systemd 单元。可以在系统引导时自动 [[enable|启用]] 它。<br />
<br />
{{注意|<br />
* 默认情况下,蓝牙仅为 {{ic|lp}} 用户组中的用户启用 bnep0 设备。如果想要加入蓝牙系统,需确认已将用户加入该组。可以修改{{ic|/etc/dbus-1/system.d/bluetooth.conf}}文件中相应的组配置来实现。<br />
* 有些蓝牙适配器是与无线网卡绑定在一起的(比如:[http://www.intel.com/content/www/us/en/wireless-products/centrino-advanced-n-6235.html 英特尔迅驰])。这就要求无线网卡先被启用(典型情况是在笔记本电脑上用快捷键启用)以便蓝牙适配器对内核可见。<br />
* 有些厂家(如 Broadcom)的蓝牙卡与网卡有冲突(不兼容)。这就需要确认在网络服务引导之前蓝牙设备已连接。}}<br />
<br />
== 通过命令行工具配置蓝牙 ==<br />
=== Bluetoothctl ===<br />
通过命令行配对是最可靠的选择。准确的配对过程依不同设备类型及其所提供的输入功能而各不相同。下面提供使用{{ic|/usr/bin/bluetoothctl}}配对的一般过程:<br />
<br />
启动 {{ic|bluetoothctl}} 交互命令。可以输入 {{ic|help}} 列出所有有效的命令。<br />
* 输入{{ic|power on}} 命令打开控制器电源。默认是关闭的。<br />
* 输入{{ic|devices}} 命令获取要配对设备的 MAC 地址。<br />
* 如果设备未在清单中列出,输入 {{ic|scan on}} 命令设置设备发现模式。<br />
* 输入{{ic|agent on}} 命令打开代理。<br />
* 输入 {{ic|pair ''MAC Address''}} 开始配对(支持 tab 键补全)。<br />
* 如果使用无 PIN 码设备,再次连接可能需要手工认证。输入 {{ic|trust ''MAC Address''}} 命令。<br />
* 最后,用 {{ic|connect ''MAC_address''}} 命令建立连接。<br />
<br />
以下为一个交互实例:<br />
# bluetoothctl <br />
[NEW] Controller 00:10:20:30:40:50 pi [default]<br />
[bluetooth]# agent KeyboardOnly <br />
Agent registered<br />
[bluetooth]# default-agent <br />
Default agent request successful<br />
[bluetooth]# scan on<br />
Discovery started<br />
[CHG] Controller 00:10:20:30:40:50 Discovering: yes<br />
[NEW] Device 00:12:34:56:78:90 myLino<br />
[CHG] Device 00:12:34:56:78:90 LegacyPairing: yes<br />
[bluetooth]# pair 00:12:34:56:78:90<br />
Attempting to pair with 00:12:34:56:78:90<br />
[CHG] Device 00:12:34:56:78:90 Connected: yes<br />
[CHG] Device 00:12:34:56:78:90 Connected: no<br />
[CHG] Device 00:12:34:56:78:90 Connected: yes<br />
Request PIN code<br />
[agent] Enter PIN code: 1234<br />
[CHG] Device 00:12:34:56:78:90 Paired: yes<br />
Pairing successful<br />
[CHG] Device 00:12:34:56:78:90 Connected: no<br />
<br />
为使系统重启后激活设备,需添加一条 udev 规则:<br />
<br />
{{hc|/etc/udev/rules.d/10-local.rules|2=<br />
# Set bluetooth power up<br />
ACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfig hci0 up"}}<br />
<br />
为使设备在系统挂起后唤醒时自动上电,应使用如下例所示 ''systemd'' 服务:<br />
<br />
{{hc|/etc/systemd/system/bluetooth-auto-power@.service|<nowiki><br />
[Unit]<br />
Description=Bluetooth auto power on<br />
After=bluetooth.service sys-subsystem-bluetooth-devices-%i.device suspend.target<br />
<br />
[Service]<br />
Type=oneshot<br />
#We could also do a 200 char long call to bluez via dbus. Except this does not work since bluez does not react to dbus at this point of the resume sequence and I do not know how I get this service to run at a time it does. So we just ignore bluez and force %i up using hciconfig. Welcome to the 21st century.<br />
#ExecStart=/usr/bin/dbus-send --system --type=method_call --dest=org.bluez /org/bluez/%I org.freedesktop.DBus.Properties.Set string:org.bluez.Adapter1 string:Powered variant:boolean:true<br />
ExecStart=/usr/bin/hciconfig %i up<br />
<br />
[Install]<br />
WantedBy=suspend.target<br />
</nowiki>}}<br />
<br />
== 图形化前端 ==<br />
<br />
下面的软件包提供了一个图形化的界面来自定义蓝牙(Bluetooth)。<br />
<br />
=== Blueman ===<br />
<br />
[http://blueman-project.org Blueman]是一个全能的基于 [[GTK+ (简体中文)|GTK+]] 开发的蓝牙(Bluetooth)管理器,因此,被[[GNOME (简体中文)|GNOME]]和[[Xfce (简体中文)|Xfce]]所推荐。你可以[[安装]][[官方仓库]]中的{{Pkg|blueman}}。<br />
<br />
在确认{{ic|bluetooth}}服务像上文描述的那样正在运行之后,执行{{ic|blueman-applet}}。为了确保这个applet在登录之后运行,将{{ic|blueman-applet}}添加到''System -> Preferences -> Startup Applications'' (GNOME) 或 ''Xfce Menu -> Settings -> Session and Startup'' (Xfce)<br />
<br />
要用 Blueman 添加或管理设备,用户需要位于 'lp' 组,参见 {{ic|/etc/dbus-1/system.d/bluetooth.conf}} 中对 'lp' 组与 Bluetooth daemon 交互的说明。<br />
<br />
{{注意|如果你不是在Gnome/gdm中运行blueman,例如,在Xfce使用朴素的{{ic|startx}}命令,你应当将{{ic|. /etc/X11/xinit/xinitrc.d/*}}添加到你的{{ic|~/.xinitrc}}来确保nautilus能够浏览你的设备。}}<br />
<br />
要接收文件,请点击 ''Blueman tray icon -> Local Services -> Transfer -> File Receiving" 并选中 "Enabled".<br />
<br />
==== Thunar 脚本工具====<br />
如果你没有使用nautilus(例如thunar)你会发现这个很有用:<br />
{{hc|obex_thunar.sh|<br />
#!/bin/bash<br />
fusermount -u ~/bluetooth<br />
obexfs -b $1 ~/bluetooth<br />
thunar ~/bluetooth<br />
}}<br />
<br />
移动脚本到一个合适的位置(例如:{{ic|/usr/bin}}),之后将它设为可执行:<br />
chmod +x /usr/bin/obex_thunar.sh<br />
<br />
最后更改''Blueman tray icon -> Local Services -> Transfer -> Advanced'' 这一行,改成 {{ic|obex_thunar.sh %d}}。<br />
<br />
=== gnome-bluetooth ===<br />
<br />
[http://live.gnome.org/GnomeBluetooth gnome-bluetooth] 是旧的''bluez-gnome'' 的一个分支,专注于跟[[GNOME (简体中文)|GNOME]]桌面环境相集成。GNOME Bluetooth 是 {{Pkg|gnome-shell}} 需要的,因此如果你在运行 GNOME 3 你应该已经安装了它。 否则,可以用 {{Pkg|gnome-bluetooth}} 这个包安装。<br />
<br />
运行{{ic|bluetooth-applet}}来打开一个漂亮的蓝牙(bluetooth)小程序。现在你应该可以能够通过在这个蓝牙(bluetooth)图标来设置设备并且传输文件了。为了保证这个小程序随登录启动,把它添加到''System -> Preferences -> Startup Applications''。<br />
<br />
如果想要在Thunar的文件属性菜单的发送到里添加一个蓝牙(Bluetooth)入口,参考[http://thunar.xfce.org/pwiki/documentation/sendto_menu 这里]。<br />
<br />
=== bluedevil ===<br />
<br />
[[KDE (简体中文)|KDE]] 的蓝牙工具是bluedevil,可以用 {{Pkg|bluedevil}} 包[[安装]],它在[[官方仓库]]中。<br />
<br />
确认{{ic|bluetooth}}守护进程在运行。你可以在dolphin和系统通知区域里得到一个蓝牙图标,你可以通过点击这个图标来设置bluedevil、检测蓝牙设备等等。你也可以通过KDE的系统设置来配置bluedevil。<br />
<br />
=== Fluxbox, openbox, 其他的窗口管理器 ===<br />
你当然可以用前面提到过的程序即便你没有用GNOME、Xfce或KDE作为你的桌面管理器。<br />
这个列表能够帮助你明白每个程序的功能:<br />
* bluetooth-applet -- 能够实现设置、配对向导和已知设备管理的系统通知区域图标。<br />
* /usr/lib/gnome-user-share/gnome-user-share -- 如果你想要通过obexBT来从已配对的设备接收文件的话,它应当处于运行状态。<br />
<br />
如果你在文件传输过程中收到了一个错误,并且/或没有收到文件,把下面的代码添加到<br />
<br />
<tt>/etc/dbus-1/system.d/bluetooth.conf</tt><br />
<policy user="your_user_id"><br />
<allow own="org.bluez"/><br />
<allow send_destination="org.bluez"/><br />
<allow send_interface="org.bluez.Agent"/><br />
</policy><br />
<br />
* bluetooth-wizard -- 负责新设备的配对工作。<br />
* bluetooth-properties -- 也能够通过Bluetooth-applet图标打开。<br />
* gnome-file-share-properties -- 对通过蓝牙(Bluetooth)传输文件授权。<br />
* bluez-sendto -- 提供向远端设备传送文件的图形用户接口。<br />
<br />
== 手工配置 ==<br />
<br />
你需要编辑 {{ic|/etc/bluetooth}} 下的配置文件来实现人工配置Bluez。它们是:<br />
audio.conf<br />
input.conf<br />
main.conf<br />
network.conf<br />
rfcomm.conf<br />
<br />
默认的配置文件在绝大多数情况下都能都正常工作。绝大多数的配置选项在她们的文件里都有丰富的文档注释,所以自定义成为了一个简单到阅读配置选项的描述和注释的工作。全局设置从{{ic|main.conf}}开始<br />
<br />
=== 音频流 ===<br />
如果你想启用从你的设备到计算机的音频流,你必须更改 {{ic|audio.conf}} 然后添加这个到 {{ic|[General]}} 部分:<br />
Enable=Socket<br />
<br />
== 配对 ==<br />
{{注意| 这一部分描述可能不是完全的准确。感谢'''Gattschardo'''解决了'''个人验证码'''部分}}<br />
<br />
许多蓝牙(Bluetooth)设备要求在使用时[http://en.wikipedia.org/wiki/Bluetooth#Pairing 配对]。<br />
实际上的过程取决于配对涉及到的设备和这些设备的输入功能。<br />
在移动电话上的配对过程可能会像下面那样:<br />
* 计算机向移动电话发送一个配对请求<br />
* 移动电话上会提示输入一个由计算机给出的PIN(个人识别码)码<br />
* 必须在计算机上重新输入同一个序列(指上文中的PIN)。<br />
<br />
通过执行一下命令来搜索外部设备<br />
$ hcitool scan<br />
<br />
在不使用gnome-bluez包的情况下配对设备,你需要使用一个包含在bluez包里的,叫做''bluez-simple-agent''的工具。你需要从常用的软件仓库里获取几个跟python相关的工具来使这种方法可用:dbus-python和pygobject。 如果你准备好了,你可以以root身份执行这个脚本:<br />
<br />
# bluez-simple-agent<br />
<br />
如果它工作正常,你应当会在控制台得到消息:"Agent registered" 。<br />
<br />
现在你可以开始从你的移动电话开始配对工作,这个脚本会在控制台询问你PIN码,你输入进去然后按回车键确认,这样就完成了配对工作。接下来可以通过^C-c终止这个脚本的执行,只需要在配对的时候使用这个脚本,而连接设备时不需要用到它。<br />
<br />
需要查看例子.请向下翻页到示例部分。<br />
<br />
== 使用 Obex 发送接收文件 ==<br />
除了KDE和Gnome Bluetooth软件包之外,Obexfs是另一个选择,它可以允许你挂载你的移动电话作为文件系统的一部分。注意,如果要使用Obex,你需要一个能够提供Obex FTP服务的设备。<br />
安装Obex;<br />
# pacman -S obexfs<br />
<br />
然后你可以以root权限运行如下命令来挂载你的移动电话<br />
# obexfs -b <devices mac address> /mountpoint<br />
<br />
单看更多挂载选项,参阅http://dev.zuckschwerdt.org/openobex/wiki/ObexFs<br />
<br />
<br />
== 示例 ==<br />
<br />
=== 西门子 S55 ===<br />
<br />
这是我链接我的S55的过程。(我还没搞明白怎么样通过电话来初始化连接。)<br />
* 根据安装步骤<br />
* <br />
$> hcitool scan<br />
Scanning ...<br />
XX:XX:XX:XX:XX:XX NAME<br />
$> B=XX:XX:XX:XX:XX:XX<br />
在另一个终端启动simple-agent<br />
$> su -c bluez-simple-agent <br />
Password: <br />
Agent registered<br />
回到上一个终端<br />
$> obexftp -b $B -l "Address book"<br />
# Phone ask for pin, I enter it and answer yes when asked if I want to save the device<br />
...<br />
<file name="5F07.adr" size="78712" modified="20030101T001858" user-perm="WD" group-perm="" /><br />
...<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -g "Address book/5F07.adr"<br />
Browsing 00:01:E3:6B:FF:D7 ...<br />
Channel: 5<br />
Connecting...done<br />
Receiving "Address book/5F07.adr"... Sending "Address book"... done<br />
Disconnecting...done<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -p a <br />
...<br />
Sending "a"... done<br />
Disconnecting...done<br />
<br />
=== 罗技鼠标 MX Laser / M555b ===<br />
<br />
快速测试连接<br />
<br />
$> hidd --connect XX:XX:XX:XX:XX:XX<br />
<br />
通过桌面想到设置鼠标一实现自动重连。<br />
如果你的桌面环境不提供对此任务的支持,参阅[[Bluetooth mouse manual configuration]]向导.<br />
<br />
=== 摩托罗拉 V900 ===<br />
<br />
在安装blueman并且运行blueman-applet之后,在摩托罗拉设备的菜单connections -> bluetooth下单击"find me"。在blueman-applet搜索设备,找到摩托罗拉,然后单击blueman-applet中的“添加。单击“bond”,输入pin码,根据摩托罗达上的提示输入相同的pin码,在终端执行:<br />
<br />
cd ~/<br />
mkdir bluetooth-temp<br />
obexfs -n xx:yy:zz:... ~/bluetooth-temp<br />
cd ~/bluetooth-temp<br />
<br />
然后浏览... 这样操作时只能访问音频、视频和图片。<br />
<br />
=== 摩托罗拉 RAZ ===<br />
<br />
> pacman -S obextool obexfs obexftp openobex bluez<br />
<br />
> lsusb<br />
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 002 Device 002: ID 03f0:171d Hewlett-Packard Wireless (Bluetooth + WLAN) Interface [Integrated Module]<br />
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
<br />
> hciconfig hci0 up<br />
<br />
> hciconfig<br />
hci0: Type: BR/EDR Bus: USB<br />
BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8<br />
UP RUNNING<br />
RX bytes:348 acl:0 sco:0 events:11 errors:0<br />
TX bytes:38 acl:0 sco:0 commands:11 errors:0<br />
<br />
> hcitool dev<br />
Devices:<br />
hci0 00:16:41:97:BA:5E<br />
<br />
'''注意:确保手机上的蓝牙处于打开状态并且是可见的<br />
'''<br />
<br />
> hcitool scan<br />
Scanning ...<br />
00:1A:1B:82:9B:6D [quirxi]<br />
<br />
> hcitool inq<br />
Inquiring ...<br />
00:1A:1B:82:9B:6D clock offset: 0x1ee4 class: 0x522204<br />
<br />
> l2ping 00:1A:1B:82:9B:6D<br />
Ping: 00:1A:1B:82:9B:6D from 00:16:41:97:BA:5E (data size 44) ...<br />
44 bytes from 00:1A:1B:82:9B:6D id 0 time 23.94ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 1 time 18.85ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 2 time 30.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 3 time 18.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 4 time 17.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 5 time 17.88ms<br />
6 sent, 6 received, 0% loss<br />
<br />
> hcitool name 00:1A:1B:82:9B:6D<br />
[quirxi]<br />
<br />
# hciconfig -a hci0<br />
hci0: Type: BR/EDR Bus: USB<br />
BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8<br />
UP RUNNING<br />
RX bytes:9740 acl:122 sco:0 events:170 errors:0<br />
TX bytes:2920 acl:125 sco:0 commands:53 errors:0<br />
Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80<br />
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3<br />
Link policy:<br />
Link mode: SLAVE ACCEPT<br />
Name: 'BCM2045'<br />
Class: 0x000000<br />
Service Classes: Unspecified<br />
Device Class: Miscellaneous,<br />
HCI Version: 2.0 (0x3) Revision: 0x204a<br />
LMP Version: 2.0 (0x3) Subversion: 0x4176<br />
Manufacturer: Broadcoml / Corporation (15)<br />
<br />
> hcitool info 00:1A:1B:82:9B:6D<br />
Requesting information ...<br />
BD Address: 00:1A:1B:82:9B:6D<br />
Device Name: [quirxi]<br />
LMP Version: 1.2 (0x2) LMP Subversion: 0x309<br />
Manufacturer: Broadcom Corporation (15)<br />
Features: 0xff 0xfe 0x0d 0x00 0x08 0x08 0x00 0x00<br />
<3-slot packets> <5-slot packets> <encryption> <slot offset><br />
<timing accuracy> <role switch> <hold mode> <sniff mode><br />
<RSSI> <channel quality> <SCO link> <HV2 packets><br />
<HV3 packets> <A-law log> <CVSD> <power control><br />
<transparent SCO> <AFH cap. slave> <AFH cap. master><br />
<br />
<br />
'''编辑你的main.conf并且输入对应与你手机的class( Class = 0x100100 ):'''<br />
> vim /etc/bluetooth/main.conf<br />
<br />
# Default device class. Only the major and minor device class bits are<br />
# considered.<br />
#Class = 0x000100<br />
Class = 0x100100<br />
<br />
> /etc/rc.d/dbus start<br />
:: Starting D-BUS system messagebus <br />
[DONE]<br />
<br />
> /etc/rc.d/bluetooth start<br />
:: Stopping bluetooth subsystem: pand dund rfcomm hidd bluetoothd<br />
[DONE]<br />
:: Starting bluetooth subsystem: bluetoothd<br />
<br />
<br />
'''通过bluez-simple-agent配对只需要做一次。当你的手机要求输入pin码时,输入0000'''<br />
> /usr/bin/bluez-simple-agent hci0 00:1A:1B:82:9B:6D<br />
RequestPinCode (/org/bluez/10768/hci0/dev_00_1A_1B_82_9B_6D)<br />
Enter PIN Code: 0000<br />
Release<br />
New device (/org/bluez/10768/hci0/dev_00_1A_1B_82_9B_6D)<br />
<br />
'''现在你可以动过ObexFTP来访问你手机上的文件了:'''<br />
> obexftp -v -b 00:1A:1B:82:9B:6D -B 9 -l<br />
Connecting..\done<br />
Tried to connect for 448ms<br />
Receiving "(null)"...-<?xml version="1.0" ?><br />
<!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd"><br />
<folder-listing><br />
<parent-folder /><br />
<folder name="audio" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
<folder name="video" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
<folder name="picture" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
</folder-listing><br />
done<br />
Disconnecting..\done<br />
<br />
'''你也可以把你的手机作为文件系统的一部分挂载在你的计算机上:'''<br />
<br />
> groupadd bluetooth<br />
> mkdir /mnt/bluetooth<br />
> chown root:bluetooth /mnt/bluetooth<br />
> chmod 775 /mnt/bluetooth<br />
> usermod -a -G bluetooth arno<br />
<br />
> obexfs -b 00:1A:1B:82:9B:6D /mnt/bluetooth/<br />
> l /mnt/bluetooth/<br />
total 6<br />
drwxr-xr-x 1 root root 0 10. Okt 13:25 .<br />
drwxr-xr-x 5 root root 4096 10. Okt 10:08 ..<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 audio<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 picture<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 video<br />
<br />
=== 使用bluez-simple-agent来跟iPhone配对 ===<br />
<br />
假设有一个叫做hci0的蓝牙设备和一个在hcitool里显示为'00:00:DE:AD:BE:EF'的iPhone:<br />
<br />
# bluez-simple-agent hci0 00:00:DE:AD:BE:EF<br />
Passcode:<br />
<br />
== 疑难解答 ==<br />
<br />
=== passkey-agent ===<br />
$> passkey-agent --default 1234<br />
Can't register passkey agent<br />
The name org.bluez was not provided by any .service files<br />
你可能在启动<tt>/etc/rc.d/dbus</tt>之前启动了 <tt>/etc/rc.d/bluetooth</tt> <br />
$> hciconfig dev<br />
# (no listing)<br />
尝试运行 <tt>hciconfig hc0 up</tt><br />
<br />
=== Blueman ===<br />
如果blueman-applet启动失败,试着删除整个''/var/lib/bluetooth''目录然后重新启动电脑(或者仅仅重启hal、dbus和bluetooth这几个服务)。<br />
# rm -rf /var/lib/bluetooth<br />
# reboot<br />
<br />
=== gnome-bluetooth ===<br />
如果你通过在蓝牙属性里接受文件时受到如下消息:<br />
Bluetooth OBEX start failed: Invalid path<br />
Bluetooth FTP start failed: Invalid path<br />
<br />
那么运行<br />
# pacman -S xdg-user-dirs<br />
$ xdg-user-dirs-update<br />
你可以通过下列方式修改路径:<br />
$ vi ~/.config/user-dirs.dirs<br />
<br />
=== Bluetooth USB 适配器 ===<br />
如果你在使用USB适配器,你应当确认你的适配器被正确识别。你可以在插入适配器时通过查看<tt>/var/log/messages.log</tt>,这应当会出现类似于下面所示的信息:<br />
<br />
# tail -f /var/log/messages.log<br />
May 2 23:36:40 tatooine usb 4-1: new full speed USB device using uhci_hcd and address 9<br />
May 2 23:36:40 tatooine usb 4-1: configuration #1 chosen from 1 choice<br />
May 2 23:36:41 tatooine hcid[8109]: HCI dev 0 registered<br />
May 2 23:36:41 tatooine hcid[8109]: HCI dev 0 up<br />
May 2 23:36:41 tatooine hcid[8109]: Device hci0 has been added<br />
May 2 23:36:41 tatooine hcid[8109]: Starting security manager 0<br />
May 2 23:36:41 tatooine hcid[8109]: Device hci0 has been activated<br />
<br />
查看支持的硬件列表,请参考本页的[[Bluetooth#Resources|resources]]。<br />
<br />
如果你只得到了前面两行,说明了电脑发现了这个设备,但是你需要手动启动它。<br />
例如:<br />
<br />
hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0<br />
DOWN <br />
RX bytes:0 acl:0 sco:0 events:0 errors:0<br />
TX bytes:0 acl:0 sco:0 commands:0 errors:<br />
sudo hciconfig hci0 up<br />
hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:02:72:C4:7C:06 ACL MTU: 377:10 SCO MTU: 64:8<br />
UP RUNNING <br />
RX bytes:348 acl:0 sco:0 events:11 errors:0<br />
TX bytes:38 acl:0 sco:0 commands:11 errors:0<br />
<br />
要验证这个设备被正确检测,你可以使用<tt>bluez-utils</tt>当中的<tt>hcitool</tt>。你可以通过下面方式获得受支持的设备、它们的识别码和硬件地址:<br />
<br />
$ hcitool dev<br />
Devices:<br />
hci0 00:1B:DC:0F:DB:40<br />
<br />
可以通过<tt>hciconfig</tt>获得关于这个设备更详细的信息。<br />
<br />
$ hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:1B:DC:0F:DB:40 ACL MTU: 310:10 SCO MTU: 64:8<br />
UP RUNNING PSCAN ISCAN <br />
RX bytes:1226 acl:0 sco:0 events:27 errors:0<br />
TX bytes:351 acl:0 sco:0 commands:26 errors:0<br />
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80<br />
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 <br />
Link policy: RSWITCH HOLD SNIFF PARK <br />
Link mode: SLAVE ACCEPT <br />
Name: 'BlueZ (0)'<br />
Class: 0x000100<br />
Service Classes: Unspecified<br />
Device Class: Computer, Uncategorized<br />
HCI Ver: 2.0 (0x3) HCI Rev: 0xc5c LMP Ver: 2.0 (0x3) LMP Subver: 0xc5c<br />
Manufacturer: Cambridge Silicon Radio (10)<br />
<br />
=== hcitool scan: 没找到设备 ===<br />
* 在某些Dell的笔记本电脑(比如 Studio 15)上,你必须把蓝牙模式由HID改成HCI<br />
# hid2hci<br />
<br />
* 有时候这个简单的命令也会有用:<br />
# hciconfig hci0 up<br />
<br />
=== 我的电脑不可见 ===<br />
如果不能从你的移动电话上找到你的电脑,打开PSCAN和ISCAN:<br />
# 打开 PSCAN 和 ISCAN<br />
$ hciconfig hci0 piscan <br />
# 确认操作有效<br />
$ hciconfig <br />
hci0: Type: USB<br />
BD Address: 00:12:34:56:78:9A ACL MTU: 192:8 SCO MTU: 64:8<br />
'''UP RUNNING PSCAN ISCAN'''<br />
RX bytes:20425 acl:115 sco:0 events:526 errors:0<br />
TX bytes:5543 acl:84 sco:0 commands:340 errors:0<br />
<br />
{{注意 | 检查/etc/bluetooth/main.conf中的发现倒计时和配对倒计时}}<br />
<br />
试着在 /etc/bluetooth/main.conf 改变设备的class<br />
# Default device class. Only the major and minor device class bits are<br />
# considered.<br />
#Class = 0x000100 (from default config)<br />
Class = 0x100100<br />
<br />
This was the only solution to make my computer visible for my phone. <br />
<br />
=== Nautilus cannot browse files ===<br />
If nautilus doesn't open and show this error:<br />
Nautilus cannot handle obex: locations. Couldn't display "obex://[XX:XX:XX:XX:XX:XX]/".<br />
Install gvfs-obexftp package:<br />
# pacman -S gvfs-obexftp<br />
<br />
== 资源 ==<br />
*[http://www.bluez.org Official Linux Bluetooth protocol stack]<br />
*[http://www.holtmann.org/linux/bluetooth/devices.html List of Linux supported Bluetooth Hardware] >> The list is not available anymore!<br />
*[http://en.opensuse.org/HCL/Bluetooth_Adapters openSUSE Bluetooth Hardware Compatibility List (HCL)]<br />
*[http://www.gentoo.org/doc/en/bluetooth-guide.xml Gentoo wiki is usually good]<br />
*[http://linuxgazette.net/109/oregan3.html Accessing a Bluetooth phone on Linux Gazette]<br />
*[http://www.adamish.com/blog/#a000361 Bluetooth computer visibility]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Bluetooth_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=408925
Bluetooth (简体中文)
2015-11-11T15:34:52Z
<p>Aaron chen: /* 图形化前端 */</p>
<hr />
<div>[[Category:Bluetooth (简体中文)]]<br />
[[cs:Bluetooth]]<br />
[[de:Bluetooth]]<br />
[[en:Bluetooth]]<br />
[[es:Bluetooth]]<br />
[[fr:Bluetooth]]<br />
[[it:Bluetooth]]<br />
[[ja:Bluetooth]]<br />
[[ru:Bluetooth]]<br />
[http://www.bluetooth.org/ 蓝牙]是一个短距离无线通信标准,适用于手机、计算机和其他电子设备之间的通信。在 Linux 中,通常使用的蓝牙协议栈实现是 [http://www.bluez.org/ BlueZ].<br />
<br />
==安装==<br />
[[Install|安装]] {{Pkg|bluez}} 和 {{Pkg|bluez-utils}} 软件包。{{Pkg|bluez}} 软件包提供蓝牙协议栈,{{Pkg|bluez-utils}} 软件包提供 {{ic|bluetoothctl}} 工具。<br />
如果尚未加载通用蓝牙驱动则需先加载:<br />
# modprobe btusb<br />
<br />
然后 [[start|启动]] {{ic|bluetooth.service}} systemd 单元。可以在系统引导时自动 [[enable|启用]] 它。<br />
<br />
{{注意|<br />
* 默认情况下,蓝牙仅为 {{ic|lp}} 用户组中的用户启用 bnep0 设备。如果想要加入蓝牙系统,需确认已将用户加入该组。可以修改{{ic|/etc/dbus-1/system.d/bluetooth.conf}}文件中相应的组配置来实现。<br />
* 有些蓝牙适配器是与无线网卡绑定在一起的(比如:[http://www.intel.com/content/www/us/en/wireless-products/centrino-advanced-n-6235.html 英特尔迅驰])。这就要求无线网卡先被启用(典型情况是在笔记本电脑上用快捷键启用)以便蓝牙适配器对内核可见。<br />
* 有些厂家(如 Broadcom)的蓝牙卡与网卡有冲突(不兼容)。这就需要确认在网络服务引导之前蓝牙设备已连接。}}<br />
<br />
== 通过命令行工具配置蓝牙 ==<br />
=== Bluetoothctl ===<br />
通过命令行配对是最可靠的选择。准确的配对过程依不同设备类型及其所提供的输入功能而各不相同。下面提供使用{{ic|/usr/bin/bluetoothctl}}配对的一般过程:<br />
<br />
Start the {{ic|bluetoothctl}} interactive command. There one can input {{ic|help}} to get a list of available commands. <br />
* Turn the power to the controller on by entering {{ic|power on}}. It is off by default.<br />
* Enter {{ic|devices}} to get the MAC Address of the device with which to pair.<br />
* Enter device discovery mode with {{ic|scan on}} command if device is not yet on the list.<br />
* Turn the agent on with {{ic|agent on}}.<br />
* Enter {{ic|pair ''MAC Address''}} to do the pairing (tab completion works).<br />
* If using a device without a PIN, one may need to manually trust the device before it can reconnect successfully. Enter {{ic|trust ''MAC Address''}} to do so.<br />
* Finally, use {{ic|connect ''MAC_address''}} to establish a connection.<br />
<br />
An example session may look this way:<br />
# bluetoothctl <br />
[NEW] Controller 00:10:20:30:40:50 pi [default]<br />
[bluetooth]# agent KeyboardOnly <br />
Agent registered<br />
[bluetooth]# default-agent <br />
Default agent request successful<br />
[bluetooth]# scan on<br />
Discovery started<br />
[CHG] Controller 00:10:20:30:40:50 Discovering: yes<br />
[NEW] Device 00:12:34:56:78:90 myLino<br />
[CHG] Device 00:12:34:56:78:90 LegacyPairing: yes<br />
[bluetooth]# pair 00:12:34:56:78:90<br />
Attempting to pair with 00:12:34:56:78:90<br />
[CHG] Device 00:12:34:56:78:90 Connected: yes<br />
[CHG] Device 00:12:34:56:78:90 Connected: no<br />
[CHG] Device 00:12:34:56:78:90 Connected: yes<br />
Request PIN code<br />
[agent] Enter PIN code: 1234<br />
[CHG] Device 00:12:34:56:78:90 Paired: yes<br />
Pairing successful<br />
[CHG] Device 00:12:34:56:78:90 Connected: no<br />
<br />
In order to have the device active after a reboot, a udev rule is needed:<br />
<br />
{{hc|/etc/udev/rules.d/10-local.rules|2=<br />
# Set bluetooth power up<br />
ACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfig hci0 up"}}<br />
<br />
After a suspend/resume-cycle, the device can be powered on automatically using something like this ''systemd'' service:<br />
<br />
{{hc|/etc/systemd/system/bluetooth-auto-power@.service|<nowiki><br />
[Unit]<br />
Description=Bluetooth auto power on<br />
After=bluetooth.service sys-subsystem-bluetooth-devices-%i.device suspend.target<br />
<br />
[Service]<br />
Type=oneshot<br />
#We could also do a 200 char long call to bluez via dbus. Except this does not work since bluez does not react to dbus at this point of the resume sequence and I do not know how I get this service to run at a time it does. So we just ignore bluez and force %i up using hciconfig. Welcome to the 21st century.<br />
#ExecStart=/usr/bin/dbus-send --system --type=method_call --dest=org.bluez /org/bluez/%I org.freedesktop.DBus.Properties.Set string:org.bluez.Adapter1 string:Powered variant:boolean:true<br />
ExecStart=/usr/bin/hciconfig %i up<br />
<br />
[Install]<br />
WantedBy=suspend.target<br />
</nowiki>}}<br />
<br />
== 图形化前端 ==<br />
<br />
下面的软件包提供了一个图形化的界面来自定义蓝牙(Bluetooth)。<br />
<br />
=== Blueman ===<br />
<br />
[http://blueman-project.org Blueman]是一个全能的基于 [[GTK+ (简体中文)|GTK+]] 开发的蓝牙(Bluetooth)管理器,因此,被[[GNOME (简体中文)|GNOME]]和[[Xfce (简体中文)|Xfce]]所推荐。你可以[[安装]][[官方仓库]]中的{{Pkg|blueman}}。<br />
<br />
在确认{{ic|bluetooth}}服务像上文描述的那样正在运行之后,执行{{ic|blueman-applet}}。为了确保这个applet在登录之后运行,将{{ic|blueman-applet}}添加到''System -> Preferences -> Startup Applications'' (GNOME) 或 ''Xfce Menu -> Settings -> Session and Startup'' (Xfce)<br />
<br />
要用 Blueman 添加或管理设备,用户需要位于 'lp' 组,参见 {{ic|/etc/dbus-1/system.d/bluetooth.conf}} 中对 'lp' 组与 Bluetooth daemon 交互的说明。<br />
<br />
{{注意|如果你不是在Gnome/gdm中运行blueman,例如,在Xfce使用朴素的{{ic|startx}}命令,你应当将{{ic|. /etc/X11/xinit/xinitrc.d/*}}添加到你的{{ic|~/.xinitrc}}来确保nautilus能够浏览你的设备。}}<br />
<br />
要接收文件,请点击 ''Blueman tray icon -> Local Services -> Transfer -> File Receiving" 并选中 "Enabled".<br />
<br />
==== Thunar 脚本工具====<br />
如果你没有使用nautilus(例如thunar)你会发现这个很有用:<br />
{{hc|obex_thunar.sh|<br />
#!/bin/bash<br />
fusermount -u ~/bluetooth<br />
obexfs -b $1 ~/bluetooth<br />
thunar ~/bluetooth<br />
}}<br />
<br />
移动脚本到一个合适的位置(例如:{{ic|/usr/bin}}),之后将它设为可执行:<br />
chmod +x /usr/bin/obex_thunar.sh<br />
<br />
最后更改''Blueman tray icon -> Local Services -> Transfer -> Advanced'' 这一行,改成 {{ic|obex_thunar.sh %d}}。<br />
<br />
=== gnome-bluetooth ===<br />
<br />
[http://live.gnome.org/GnomeBluetooth gnome-bluetooth] 是旧的''bluez-gnome'' 的一个分支,专注于跟[[GNOME (简体中文)|GNOME]]桌面环境相集成。GNOME Bluetooth 是 {{Pkg|gnome-shell}} 需要的,因此如果你在运行 GNOME 3 你应该已经安装了它。 否则,可以用 {{Pkg|gnome-bluetooth}} 这个包安装。<br />
<br />
运行{{ic|bluetooth-applet}}来打开一个漂亮的蓝牙(bluetooth)小程序。现在你应该可以能够通过在这个蓝牙(bluetooth)图标来设置设备并且传输文件了。为了保证这个小程序随登录启动,把它添加到''System -> Preferences -> Startup Applications''。<br />
<br />
如果想要在Thunar的文件属性菜单的发送到里添加一个蓝牙(Bluetooth)入口,参考[http://thunar.xfce.org/pwiki/documentation/sendto_menu 这里]。<br />
<br />
=== bluedevil ===<br />
<br />
[[KDE (简体中文)|KDE]] 的蓝牙工具是bluedevil,可以用 {{Pkg|bluedevil}} 包[[安装]],它在[[官方仓库]]中。<br />
<br />
确认{{ic|bluetooth}}守护进程在运行。你可以在dolphin和系统通知区域里得到一个蓝牙图标,你可以通过点击这个图标来设置bluedevil、检测蓝牙设备等等。你也可以通过KDE的系统设置来配置bluedevil。<br />
<br />
=== Fluxbox, openbox, 其他的窗口管理器 ===<br />
你当然可以用前面提到过的程序即便你没有用GNOME、Xfce或KDE作为你的桌面管理器。<br />
这个列表能够帮助你明白每个程序的功能:<br />
* bluetooth-applet -- 能够实现设置、配对向导和已知设备管理的系统通知区域图标。<br />
* /usr/lib/gnome-user-share/gnome-user-share -- 如果你想要通过obexBT来从已配对的设备接收文件的话,它应当处于运行状态。<br />
<br />
如果你在文件传输过程中收到了一个错误,并且/或没有收到文件,把下面的代码添加到<br />
<br />
<tt>/etc/dbus-1/system.d/bluetooth.conf</tt><br />
<policy user="your_user_id"><br />
<allow own="org.bluez"/><br />
<allow send_destination="org.bluez"/><br />
<allow send_interface="org.bluez.Agent"/><br />
</policy><br />
<br />
* bluetooth-wizard -- 负责新设备的配对工作。<br />
* bluetooth-properties -- 也能够通过Bluetooth-applet图标打开。<br />
* gnome-file-share-properties -- 对通过蓝牙(Bluetooth)传输文件授权。<br />
* bluez-sendto -- 提供向远端设备传送文件的图形用户接口。<br />
<br />
== 手工配置 ==<br />
<br />
你需要编辑 {{ic|/etc/bluetooth}} 下的配置文件来实现人工配置Bluez。它们是:<br />
audio.conf<br />
input.conf<br />
main.conf<br />
network.conf<br />
rfcomm.conf<br />
<br />
默认的配置文件在绝大多数情况下都能都正常工作。绝大多数的配置选项在她们的文件里都有丰富的文档注释,所以自定义成为了一个简单到阅读配置选项的描述和注释的工作。全局设置从{{ic|main.conf}}开始<br />
<br />
=== 音频流 ===<br />
如果你想启用从你的设备到计算机的音频流,你必须更改 {{ic|audio.conf}} 然后添加这个到 {{ic|[General]}} 部分:<br />
Enable=Socket<br />
<br />
== 配对 ==<br />
{{注意| 这一部分描述可能不是完全的准确。感谢'''Gattschardo'''解决了'''个人验证码'''部分}}<br />
<br />
许多蓝牙(Bluetooth)设备要求在使用时[http://en.wikipedia.org/wiki/Bluetooth#Pairing 配对]。<br />
实际上的过程取决于配对涉及到的设备和这些设备的输入功能。<br />
在移动电话上的配对过程可能会像下面那样:<br />
* 计算机向移动电话发送一个配对请求<br />
* 移动电话上会提示输入一个由计算机给出的PIN(个人识别码)码<br />
* 必须在计算机上重新输入同一个序列(指上文中的PIN)。<br />
<br />
通过执行一下命令来搜索外部设备<br />
$ hcitool scan<br />
<br />
在不使用gnome-bluez包的情况下配对设备,你需要使用一个包含在bluez包里的,叫做''bluez-simple-agent''的工具。你需要从常用的软件仓库里获取几个跟python相关的工具来使这种方法可用:dbus-python和pygobject。 如果你准备好了,你可以以root身份执行这个脚本:<br />
<br />
# bluez-simple-agent<br />
<br />
如果它工作正常,你应当会在控制台得到消息:"Agent registered" 。<br />
<br />
现在你可以开始从你的移动电话开始配对工作,这个脚本会在控制台询问你PIN码,你输入进去然后按回车键确认,这样就完成了配对工作。接下来可以通过^C-c终止这个脚本的执行,只需要在配对的时候使用这个脚本,而连接设备时不需要用到它。<br />
<br />
需要查看例子.请向下翻页到示例部分。<br />
<br />
== 使用 Obex 发送接收文件 ==<br />
除了KDE和Gnome Bluetooth软件包之外,Obexfs是另一个选择,它可以允许你挂载你的移动电话作为文件系统的一部分。注意,如果要使用Obex,你需要一个能够提供Obex FTP服务的设备。<br />
安装Obex;<br />
# pacman -S obexfs<br />
<br />
然后你可以以root权限运行如下命令来挂载你的移动电话<br />
# obexfs -b <devices mac address> /mountpoint<br />
<br />
单看更多挂载选项,参阅http://dev.zuckschwerdt.org/openobex/wiki/ObexFs<br />
<br />
<br />
== 示例 ==<br />
<br />
=== 西门子 S55 ===<br />
<br />
这是我链接我的S55的过程。(我还没搞明白怎么样通过电话来初始化连接。)<br />
* 根据安装步骤<br />
* <br />
$> hcitool scan<br />
Scanning ...<br />
XX:XX:XX:XX:XX:XX NAME<br />
$> B=XX:XX:XX:XX:XX:XX<br />
在另一个终端启动simple-agent<br />
$> su -c bluez-simple-agent <br />
Password: <br />
Agent registered<br />
回到上一个终端<br />
$> obexftp -b $B -l "Address book"<br />
# Phone ask for pin, I enter it and answer yes when asked if I want to save the device<br />
...<br />
<file name="5F07.adr" size="78712" modified="20030101T001858" user-perm="WD" group-perm="" /><br />
...<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -g "Address book/5F07.adr"<br />
Browsing 00:01:E3:6B:FF:D7 ...<br />
Channel: 5<br />
Connecting...done<br />
Receiving "Address book/5F07.adr"... Sending "Address book"... done<br />
Disconnecting...done<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -p a <br />
...<br />
Sending "a"... done<br />
Disconnecting...done<br />
<br />
=== 罗技鼠标 MX Laser / M555b ===<br />
<br />
快速测试连接<br />
<br />
$> hidd --connect XX:XX:XX:XX:XX:XX<br />
<br />
通过桌面想到设置鼠标一实现自动重连。<br />
如果你的桌面环境不提供对此任务的支持,参阅[[Bluetooth mouse manual configuration]]向导.<br />
<br />
=== 摩托罗拉 V900 ===<br />
<br />
在安装blueman并且运行blueman-applet之后,在摩托罗拉设备的菜单connections -> bluetooth下单击"find me"。在blueman-applet搜索设备,找到摩托罗拉,然后单击blueman-applet中的“添加。单击“bond”,输入pin码,根据摩托罗达上的提示输入相同的pin码,在终端执行:<br />
<br />
cd ~/<br />
mkdir bluetooth-temp<br />
obexfs -n xx:yy:zz:... ~/bluetooth-temp<br />
cd ~/bluetooth-temp<br />
<br />
然后浏览... 这样操作时只能访问音频、视频和图片。<br />
<br />
=== 摩托罗拉 RAZ ===<br />
<br />
> pacman -S obextool obexfs obexftp openobex bluez<br />
<br />
> lsusb<br />
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 002 Device 002: ID 03f0:171d Hewlett-Packard Wireless (Bluetooth + WLAN) Interface [Integrated Module]<br />
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
<br />
> hciconfig hci0 up<br />
<br />
> hciconfig<br />
hci0: Type: BR/EDR Bus: USB<br />
BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8<br />
UP RUNNING<br />
RX bytes:348 acl:0 sco:0 events:11 errors:0<br />
TX bytes:38 acl:0 sco:0 commands:11 errors:0<br />
<br />
> hcitool dev<br />
Devices:<br />
hci0 00:16:41:97:BA:5E<br />
<br />
'''注意:确保手机上的蓝牙处于打开状态并且是可见的<br />
'''<br />
<br />
> hcitool scan<br />
Scanning ...<br />
00:1A:1B:82:9B:6D [quirxi]<br />
<br />
> hcitool inq<br />
Inquiring ...<br />
00:1A:1B:82:9B:6D clock offset: 0x1ee4 class: 0x522204<br />
<br />
> l2ping 00:1A:1B:82:9B:6D<br />
Ping: 00:1A:1B:82:9B:6D from 00:16:41:97:BA:5E (data size 44) ...<br />
44 bytes from 00:1A:1B:82:9B:6D id 0 time 23.94ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 1 time 18.85ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 2 time 30.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 3 time 18.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 4 time 17.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 5 time 17.88ms<br />
6 sent, 6 received, 0% loss<br />
<br />
> hcitool name 00:1A:1B:82:9B:6D<br />
[quirxi]<br />
<br />
# hciconfig -a hci0<br />
hci0: Type: BR/EDR Bus: USB<br />
BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8<br />
UP RUNNING<br />
RX bytes:9740 acl:122 sco:0 events:170 errors:0<br />
TX bytes:2920 acl:125 sco:0 commands:53 errors:0<br />
Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80<br />
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3<br />
Link policy:<br />
Link mode: SLAVE ACCEPT<br />
Name: 'BCM2045'<br />
Class: 0x000000<br />
Service Classes: Unspecified<br />
Device Class: Miscellaneous,<br />
HCI Version: 2.0 (0x3) Revision: 0x204a<br />
LMP Version: 2.0 (0x3) Subversion: 0x4176<br />
Manufacturer: Broadcoml / Corporation (15)<br />
<br />
> hcitool info 00:1A:1B:82:9B:6D<br />
Requesting information ...<br />
BD Address: 00:1A:1B:82:9B:6D<br />
Device Name: [quirxi]<br />
LMP Version: 1.2 (0x2) LMP Subversion: 0x309<br />
Manufacturer: Broadcom Corporation (15)<br />
Features: 0xff 0xfe 0x0d 0x00 0x08 0x08 0x00 0x00<br />
<3-slot packets> <5-slot packets> <encryption> <slot offset><br />
<timing accuracy> <role switch> <hold mode> <sniff mode><br />
<RSSI> <channel quality> <SCO link> <HV2 packets><br />
<HV3 packets> <A-law log> <CVSD> <power control><br />
<transparent SCO> <AFH cap. slave> <AFH cap. master><br />
<br />
<br />
'''编辑你的main.conf并且输入对应与你手机的class( Class = 0x100100 ):'''<br />
> vim /etc/bluetooth/main.conf<br />
<br />
# Default device class. Only the major and minor device class bits are<br />
# considered.<br />
#Class = 0x000100<br />
Class = 0x100100<br />
<br />
> /etc/rc.d/dbus start<br />
:: Starting D-BUS system messagebus <br />
[DONE]<br />
<br />
> /etc/rc.d/bluetooth start<br />
:: Stopping bluetooth subsystem: pand dund rfcomm hidd bluetoothd<br />
[DONE]<br />
:: Starting bluetooth subsystem: bluetoothd<br />
<br />
<br />
'''通过bluez-simple-agent配对只需要做一次。当你的手机要求输入pin码时,输入0000'''<br />
> /usr/bin/bluez-simple-agent hci0 00:1A:1B:82:9B:6D<br />
RequestPinCode (/org/bluez/10768/hci0/dev_00_1A_1B_82_9B_6D)<br />
Enter PIN Code: 0000<br />
Release<br />
New device (/org/bluez/10768/hci0/dev_00_1A_1B_82_9B_6D)<br />
<br />
'''现在你可以动过ObexFTP来访问你手机上的文件了:'''<br />
> obexftp -v -b 00:1A:1B:82:9B:6D -B 9 -l<br />
Connecting..\done<br />
Tried to connect for 448ms<br />
Receiving "(null)"...-<?xml version="1.0" ?><br />
<!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd"><br />
<folder-listing><br />
<parent-folder /><br />
<folder name="audio" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
<folder name="video" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
<folder name="picture" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
</folder-listing><br />
done<br />
Disconnecting..\done<br />
<br />
'''你也可以把你的手机作为文件系统的一部分挂载在你的计算机上:'''<br />
<br />
> groupadd bluetooth<br />
> mkdir /mnt/bluetooth<br />
> chown root:bluetooth /mnt/bluetooth<br />
> chmod 775 /mnt/bluetooth<br />
> usermod -a -G bluetooth arno<br />
<br />
> obexfs -b 00:1A:1B:82:9B:6D /mnt/bluetooth/<br />
> l /mnt/bluetooth/<br />
total 6<br />
drwxr-xr-x 1 root root 0 10. Okt 13:25 .<br />
drwxr-xr-x 5 root root 4096 10. Okt 10:08 ..<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 audio<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 picture<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 video<br />
<br />
=== 使用bluez-simple-agent来跟iPhone配对 ===<br />
<br />
假设有一个叫做hci0的蓝牙设备和一个在hcitool里显示为'00:00:DE:AD:BE:EF'的iPhone:<br />
<br />
# bluez-simple-agent hci0 00:00:DE:AD:BE:EF<br />
Passcode:<br />
<br />
== 疑难解答 ==<br />
<br />
=== passkey-agent ===<br />
$> passkey-agent --default 1234<br />
Can't register passkey agent<br />
The name org.bluez was not provided by any .service files<br />
你可能在启动<tt>/etc/rc.d/dbus</tt>之前启动了 <tt>/etc/rc.d/bluetooth</tt> <br />
$> hciconfig dev<br />
# (no listing)<br />
尝试运行 <tt>hciconfig hc0 up</tt><br />
<br />
=== Blueman ===<br />
如果blueman-applet启动失败,试着删除整个''/var/lib/bluetooth''目录然后重新启动电脑(或者仅仅重启hal、dbus和bluetooth这几个服务)。<br />
# rm -rf /var/lib/bluetooth<br />
# reboot<br />
<br />
=== gnome-bluetooth ===<br />
如果你通过在蓝牙属性里接受文件时受到如下消息:<br />
Bluetooth OBEX start failed: Invalid path<br />
Bluetooth FTP start failed: Invalid path<br />
<br />
那么运行<br />
# pacman -S xdg-user-dirs<br />
$ xdg-user-dirs-update<br />
你可以通过下列方式修改路径:<br />
$ vi ~/.config/user-dirs.dirs<br />
<br />
=== Bluetooth USB 适配器 ===<br />
如果你在使用USB适配器,你应当确认你的适配器被正确识别。你可以在插入适配器时通过查看<tt>/var/log/messages.log</tt>,这应当会出现类似于下面所示的信息:<br />
<br />
# tail -f /var/log/messages.log<br />
May 2 23:36:40 tatooine usb 4-1: new full speed USB device using uhci_hcd and address 9<br />
May 2 23:36:40 tatooine usb 4-1: configuration #1 chosen from 1 choice<br />
May 2 23:36:41 tatooine hcid[8109]: HCI dev 0 registered<br />
May 2 23:36:41 tatooine hcid[8109]: HCI dev 0 up<br />
May 2 23:36:41 tatooine hcid[8109]: Device hci0 has been added<br />
May 2 23:36:41 tatooine hcid[8109]: Starting security manager 0<br />
May 2 23:36:41 tatooine hcid[8109]: Device hci0 has been activated<br />
<br />
查看支持的硬件列表,请参考本页的[[Bluetooth#Resources|resources]]。<br />
<br />
如果你只得到了前面两行,说明了电脑发现了这个设备,但是你需要手动启动它。<br />
例如:<br />
<br />
hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0<br />
DOWN <br />
RX bytes:0 acl:0 sco:0 events:0 errors:0<br />
TX bytes:0 acl:0 sco:0 commands:0 errors:<br />
sudo hciconfig hci0 up<br />
hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:02:72:C4:7C:06 ACL MTU: 377:10 SCO MTU: 64:8<br />
UP RUNNING <br />
RX bytes:348 acl:0 sco:0 events:11 errors:0<br />
TX bytes:38 acl:0 sco:0 commands:11 errors:0<br />
<br />
要验证这个设备被正确检测,你可以使用<tt>bluez-utils</tt>当中的<tt>hcitool</tt>。你可以通过下面方式获得受支持的设备、它们的识别码和硬件地址:<br />
<br />
$ hcitool dev<br />
Devices:<br />
hci0 00:1B:DC:0F:DB:40<br />
<br />
可以通过<tt>hciconfig</tt>获得关于这个设备更详细的信息。<br />
<br />
$ hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:1B:DC:0F:DB:40 ACL MTU: 310:10 SCO MTU: 64:8<br />
UP RUNNING PSCAN ISCAN <br />
RX bytes:1226 acl:0 sco:0 events:27 errors:0<br />
TX bytes:351 acl:0 sco:0 commands:26 errors:0<br />
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80<br />
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 <br />
Link policy: RSWITCH HOLD SNIFF PARK <br />
Link mode: SLAVE ACCEPT <br />
Name: 'BlueZ (0)'<br />
Class: 0x000100<br />
Service Classes: Unspecified<br />
Device Class: Computer, Uncategorized<br />
HCI Ver: 2.0 (0x3) HCI Rev: 0xc5c LMP Ver: 2.0 (0x3) LMP Subver: 0xc5c<br />
Manufacturer: Cambridge Silicon Radio (10)<br />
<br />
=== hcitool scan: 没找到设备 ===<br />
* 在某些Dell的笔记本电脑(比如 Studio 15)上,你必须把蓝牙模式由HID改成HCI<br />
# hid2hci<br />
<br />
* 有时候这个简单的命令也会有用:<br />
# hciconfig hci0 up<br />
<br />
=== 我的电脑不可见 ===<br />
如果不能从你的移动电话上找到你的电脑,打开PSCAN和ISCAN:<br />
# 打开 PSCAN 和 ISCAN<br />
$ hciconfig hci0 piscan <br />
# 确认操作有效<br />
$ hciconfig <br />
hci0: Type: USB<br />
BD Address: 00:12:34:56:78:9A ACL MTU: 192:8 SCO MTU: 64:8<br />
'''UP RUNNING PSCAN ISCAN'''<br />
RX bytes:20425 acl:115 sco:0 events:526 errors:0<br />
TX bytes:5543 acl:84 sco:0 commands:340 errors:0<br />
<br />
{{注意 | 检查/etc/bluetooth/main.conf中的发现倒计时和配对倒计时}}<br />
<br />
试着在 /etc/bluetooth/main.conf 改变设备的class<br />
# Default device class. Only the major and minor device class bits are<br />
# considered.<br />
#Class = 0x000100 (from default config)<br />
Class = 0x100100<br />
<br />
This was the only solution to make my computer visible for my phone. <br />
<br />
=== Nautilus cannot browse files ===<br />
If nautilus doesn't open and show this error:<br />
Nautilus cannot handle obex: locations. Couldn't display "obex://[XX:XX:XX:XX:XX:XX]/".<br />
Install gvfs-obexftp package:<br />
# pacman -S gvfs-obexftp<br />
<br />
== 资源 ==<br />
*[http://www.bluez.org Official Linux Bluetooth protocol stack]<br />
*[http://www.holtmann.org/linux/bluetooth/devices.html List of Linux supported Bluetooth Hardware] >> The list is not available anymore!<br />
*[http://en.opensuse.org/HCL/Bluetooth_Adapters openSUSE Bluetooth Hardware Compatibility List (HCL)]<br />
*[http://www.gentoo.org/doc/en/bluetooth-guide.xml Gentoo wiki is usually good]<br />
*[http://linuxgazette.net/109/oregan3.html Accessing a Bluetooth phone on Linux Gazette]<br />
*[http://www.adamish.com/blog/#a000361 Bluetooth computer visibility]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Bluetooth_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=408924
Bluetooth (简体中文)
2015-11-11T15:22:55Z
<p>Aaron chen: /* 安装 */</p>
<hr />
<div>[[Category:Bluetooth (简体中文)]]<br />
[[cs:Bluetooth]]<br />
[[de:Bluetooth]]<br />
[[en:Bluetooth]]<br />
[[es:Bluetooth]]<br />
[[fr:Bluetooth]]<br />
[[it:Bluetooth]]<br />
[[ja:Bluetooth]]<br />
[[ru:Bluetooth]]<br />
[http://www.bluetooth.org/ 蓝牙]是一个短距离无线通信标准,适用于手机、计算机和其他电子设备之间的通信。在 Linux 中,通常使用的蓝牙协议栈实现是 [http://www.bluez.org/ BlueZ].<br />
<br />
==安装==<br />
[[Install|安装]] {{Pkg|bluez}} 和 {{Pkg|bluez-utils}} 软件包。{{Pkg|bluez}} 软件包提供蓝牙协议栈,{{Pkg|bluez-utils}} 软件包提供 {{ic|bluetoothctl}} 工具。<br />
如果尚未加载通用蓝牙驱动则需先加载:<br />
# modprobe btusb<br />
<br />
然后 [[start|启动]] {{ic|bluetooth.service}} systemd 单元。可以在系统引导时自动 [[enable|启用]] 它。<br />
<br />
{{注意|<br />
* 默认情况下,蓝牙仅为 {{ic|lp}} 用户组中的用户启用 bnep0 设备。如果想要加入蓝牙系统,需确认已将用户加入该组。可以修改{{ic|/etc/dbus-1/system.d/bluetooth.conf}}文件中相应的组配置来实现。<br />
* 有些蓝牙适配器是与无线网卡绑定在一起的(比如:[http://www.intel.com/content/www/us/en/wireless-products/centrino-advanced-n-6235.html 英特尔迅驰])。这就要求无线网卡先被启用(典型情况是在笔记本电脑上用快捷键启用)以便蓝牙适配器对内核可见。<br />
* 有些厂家(如 Broadcom)的蓝牙卡与网卡有冲突(不兼容)。这就需要确认在网络服务引导之前蓝牙设备已连接。}}<br />
<br />
== 图形化前端 ==<br />
<br />
下面的软件包提供了一个图形化的界面来自定义蓝牙(Bluetooth)。<br />
<br />
=== Blueman ===<br />
<br />
[http://blueman-project.org Blueman]是一个全能的基于 [[GTK+ (简体中文)|GTK+]] 开发的蓝牙(Bluetooth)管理器,因此,被[[GNOME (简体中文)|GNOME]]和[[Xfce (简体中文)|Xfce]]所推荐。你可以[[安装]][[官方仓库]]中的{{Pkg|blueman}}。<br />
<br />
在确认{{ic|bluetooth}}服务像上文描述的那样正在运行之后,执行{{ic|blueman-applet}}。为了确保这个applet在登录之后运行,将{{ic|blueman-applet}}添加到''System -> Preferences -> Startup Applications'' (GNOME) 或 ''Xfce Menu -> Settings -> Session and Startup'' (Xfce)<br />
<br />
要用 Blueman 添加或管理设备,用户需要位于 'lp' 组,参见 {{ic|/etc/dbus-1/system.d/bluetooth.conf}} 中对 'lp' 组与 Bluetooth daemon 交互的说明。<br />
<br />
{{注意|如果你不是在Gnome/gdm中运行blueman,例如,在Xfce使用朴素的{{ic|startx}}命令,你应当将{{ic|. /etc/X11/xinit/xinitrc.d/*}}添加到你的{{ic|~/.xinitrc}}来确保nautilus能够浏览你的设备。}}<br />
<br />
要接收文件,请点击 ''Blueman tray icon -> Local Services -> Transfer -> File Receiving" 并选中 "Enabled".<br />
<br />
==== Thunar 脚本工具====<br />
如果你没有使用nautilus(例如thunar)你会发现这个很有用:<br />
{{hc|obex_thunar.sh|<br />
#!/bin/bash<br />
fusermount -u ~/bluetooth<br />
obexfs -b $1 ~/bluetooth<br />
thunar ~/bluetooth<br />
}}<br />
<br />
移动脚本到一个合适的位置(例如:{{ic|/usr/bin}}),之后将它设为可执行:<br />
chmod +x /usr/bin/obex_thunar.sh<br />
<br />
最后更改''Blueman tray icon -> Local Services -> Transfer -> Advanced'' 这一行,改成 {{ic|obex_thunar.sh %d}}。<br />
<br />
=== gnome-bluetooth ===<br />
<br />
[http://live.gnome.org/GnomeBluetooth gnome-bluetooth] 是旧的''bluez-gnome'' 的一个分支,专注于跟[[GNOME (简体中文)|GNOME]]桌面环境相集成。GNOME Bluetooth 是 {{Pkg|gnome-shell}} 需要的,因此如果你在运行 GNOME 3 你应该已经安装了它。 否则,可以用 {{Pkg|gnome-bluetooth}} 这个包安装。<br />
<br />
运行{{ic|bluetooth-applet}}来打开一个漂亮的蓝牙(bluetooth)小程序。现在你应该可以能够通过在这个蓝牙(bluetooth)图标来设置设备并且传输文件了。为了保证这个小程序随登录启动,把它添加到''System -> Preferences -> Startup Applications''。<br />
<br />
如果想要在Thunar的文件属性菜单的发送到里添加一个蓝牙(Bluetooth)入口,参考[http://thunar.xfce.org/pwiki/documentation/sendto_menu 这里]。<br />
<br />
=== bluedevil ===<br />
<br />
[[KDE (简体中文)|KDE]] 的蓝牙工具是bluedevil,可以用 {{Pkg|bluedevil}} 包[[安装]],它在[[官方仓库]]中。<br />
<br />
确认{{ic|bluetooth}}守护进程在运行。你可以在dolphin和系统通知区域里得到一个蓝牙图标,你可以通过点击这个图标来设置bluedevil、检测蓝牙设备等等。你也可以通过KDE的系统设置来配置bluedevil。<br />
<br />
=== Fluxbox, openbox, 其他的窗口管理器 ===<br />
你当然可以用前面提到过的程序即便你没有用GNOME、Xfce或KDE作为你的桌面管理器。<br />
这个列表能够帮助你明白每个程序的功能:<br />
* bluetooth-applet -- 能够实现设置、配对向导和已知设备管理的系统通知区域图标。<br />
* /usr/lib/gnome-user-share/gnome-user-share -- 如果你想要通过obexBT来从已配对的设备接收文件的话,它应当处于运行状态。<br />
<br />
如果你在文件传输过程中收到了一个错误,并且/或没有收到文件,把下面的代码添加到<br />
<br />
<tt>/etc/dbus-1/system.d/bluetooth.conf</tt><br />
<policy user="your_user_id"><br />
<allow own="org.bluez"/><br />
<allow send_destination="org.bluez"/><br />
<allow send_interface="org.bluez.Agent"/><br />
</policy><br />
<br />
* bluetooth-wizard -- 负责新设备的配对工作。<br />
* bluetooth-properties -- 也能够通过Bluetooth-applet图标打开。<br />
* gnome-file-share-properties -- 对通过蓝牙(Bluetooth)传输文件授权。<br />
* bluez-sendto -- 提供向远端设备传送文件的图形用户接口。<br />
<br />
== 手工配置 ==<br />
<br />
你需要编辑 {{ic|/etc/bluetooth}} 下的配置文件来实现人工配置Bluez。它们是:<br />
audio.conf<br />
input.conf<br />
main.conf<br />
network.conf<br />
rfcomm.conf<br />
<br />
默认的配置文件在绝大多数情况下都能都正常工作。绝大多数的配置选项在她们的文件里都有丰富的文档注释,所以自定义成为了一个简单到阅读配置选项的描述和注释的工作。全局设置从{{ic|main.conf}}开始<br />
<br />
=== 音频流 ===<br />
如果你想启用从你的设备到计算机的音频流,你必须更改 {{ic|audio.conf}} 然后添加这个到 {{ic|[General]}} 部分:<br />
Enable=Socket<br />
<br />
== 配对 ==<br />
{{注意| 这一部分描述可能不是完全的准确。感谢'''Gattschardo'''解决了'''个人验证码'''部分}}<br />
<br />
许多蓝牙(Bluetooth)设备要求在使用时[http://en.wikipedia.org/wiki/Bluetooth#Pairing 配对]。<br />
实际上的过程取决于配对涉及到的设备和这些设备的输入功能。<br />
在移动电话上的配对过程可能会像下面那样:<br />
* 计算机向移动电话发送一个配对请求<br />
* 移动电话上会提示输入一个由计算机给出的PIN(个人识别码)码<br />
* 必须在计算机上重新输入同一个序列(指上文中的PIN)。<br />
<br />
通过执行一下命令来搜索外部设备<br />
$ hcitool scan<br />
<br />
在不使用gnome-bluez包的情况下配对设备,你需要使用一个包含在bluez包里的,叫做''bluez-simple-agent''的工具。你需要从常用的软件仓库里获取几个跟python相关的工具来使这种方法可用:dbus-python和pygobject。 如果你准备好了,你可以以root身份执行这个脚本:<br />
<br />
# bluez-simple-agent<br />
<br />
如果它工作正常,你应当会在控制台得到消息:"Agent registered" 。<br />
<br />
现在你可以开始从你的移动电话开始配对工作,这个脚本会在控制台询问你PIN码,你输入进去然后按回车键确认,这样就完成了配对工作。接下来可以通过^C-c终止这个脚本的执行,只需要在配对的时候使用这个脚本,而连接设备时不需要用到它。<br />
<br />
需要查看例子.请向下翻页到示例部分。<br />
<br />
== 使用 Obex 发送接收文件 ==<br />
除了KDE和Gnome Bluetooth软件包之外,Obexfs是另一个选择,它可以允许你挂载你的移动电话作为文件系统的一部分。注意,如果要使用Obex,你需要一个能够提供Obex FTP服务的设备。<br />
安装Obex;<br />
# pacman -S obexfs<br />
<br />
然后你可以以root权限运行如下命令来挂载你的移动电话<br />
# obexfs -b <devices mac address> /mountpoint<br />
<br />
单看更多挂载选项,参阅http://dev.zuckschwerdt.org/openobex/wiki/ObexFs<br />
<br />
<br />
== 示例 ==<br />
<br />
=== 西门子 S55 ===<br />
<br />
这是我链接我的S55的过程。(我还没搞明白怎么样通过电话来初始化连接。)<br />
* 根据安装步骤<br />
* <br />
$> hcitool scan<br />
Scanning ...<br />
XX:XX:XX:XX:XX:XX NAME<br />
$> B=XX:XX:XX:XX:XX:XX<br />
在另一个终端启动simple-agent<br />
$> su -c bluez-simple-agent <br />
Password: <br />
Agent registered<br />
回到上一个终端<br />
$> obexftp -b $B -l "Address book"<br />
# Phone ask for pin, I enter it and answer yes when asked if I want to save the device<br />
...<br />
<file name="5F07.adr" size="78712" modified="20030101T001858" user-perm="WD" group-perm="" /><br />
...<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -g "Address book/5F07.adr"<br />
Browsing 00:01:E3:6B:FF:D7 ...<br />
Channel: 5<br />
Connecting...done<br />
Receiving "Address book/5F07.adr"... Sending "Address book"... done<br />
Disconnecting...done<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -p a <br />
...<br />
Sending "a"... done<br />
Disconnecting...done<br />
<br />
=== 罗技鼠标 MX Laser / M555b ===<br />
<br />
快速测试连接<br />
<br />
$> hidd --connect XX:XX:XX:XX:XX:XX<br />
<br />
通过桌面想到设置鼠标一实现自动重连。<br />
如果你的桌面环境不提供对此任务的支持,参阅[[Bluetooth mouse manual configuration]]向导.<br />
<br />
=== 摩托罗拉 V900 ===<br />
<br />
在安装blueman并且运行blueman-applet之后,在摩托罗拉设备的菜单connections -> bluetooth下单击"find me"。在blueman-applet搜索设备,找到摩托罗拉,然后单击blueman-applet中的“添加。单击“bond”,输入pin码,根据摩托罗达上的提示输入相同的pin码,在终端执行:<br />
<br />
cd ~/<br />
mkdir bluetooth-temp<br />
obexfs -n xx:yy:zz:... ~/bluetooth-temp<br />
cd ~/bluetooth-temp<br />
<br />
然后浏览... 这样操作时只能访问音频、视频和图片。<br />
<br />
=== 摩托罗拉 RAZ ===<br />
<br />
> pacman -S obextool obexfs obexftp openobex bluez<br />
<br />
> lsusb<br />
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 002 Device 002: ID 03f0:171d Hewlett-Packard Wireless (Bluetooth + WLAN) Interface [Integrated Module]<br />
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
<br />
> hciconfig hci0 up<br />
<br />
> hciconfig<br />
hci0: Type: BR/EDR Bus: USB<br />
BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8<br />
UP RUNNING<br />
RX bytes:348 acl:0 sco:0 events:11 errors:0<br />
TX bytes:38 acl:0 sco:0 commands:11 errors:0<br />
<br />
> hcitool dev<br />
Devices:<br />
hci0 00:16:41:97:BA:5E<br />
<br />
'''注意:确保手机上的蓝牙处于打开状态并且是可见的<br />
'''<br />
<br />
> hcitool scan<br />
Scanning ...<br />
00:1A:1B:82:9B:6D [quirxi]<br />
<br />
> hcitool inq<br />
Inquiring ...<br />
00:1A:1B:82:9B:6D clock offset: 0x1ee4 class: 0x522204<br />
<br />
> l2ping 00:1A:1B:82:9B:6D<br />
Ping: 00:1A:1B:82:9B:6D from 00:16:41:97:BA:5E (data size 44) ...<br />
44 bytes from 00:1A:1B:82:9B:6D id 0 time 23.94ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 1 time 18.85ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 2 time 30.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 3 time 18.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 4 time 17.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 5 time 17.88ms<br />
6 sent, 6 received, 0% loss<br />
<br />
> hcitool name 00:1A:1B:82:9B:6D<br />
[quirxi]<br />
<br />
# hciconfig -a hci0<br />
hci0: Type: BR/EDR Bus: USB<br />
BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8<br />
UP RUNNING<br />
RX bytes:9740 acl:122 sco:0 events:170 errors:0<br />
TX bytes:2920 acl:125 sco:0 commands:53 errors:0<br />
Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80<br />
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3<br />
Link policy:<br />
Link mode: SLAVE ACCEPT<br />
Name: 'BCM2045'<br />
Class: 0x000000<br />
Service Classes: Unspecified<br />
Device Class: Miscellaneous,<br />
HCI Version: 2.0 (0x3) Revision: 0x204a<br />
LMP Version: 2.0 (0x3) Subversion: 0x4176<br />
Manufacturer: Broadcoml / Corporation (15)<br />
<br />
> hcitool info 00:1A:1B:82:9B:6D<br />
Requesting information ...<br />
BD Address: 00:1A:1B:82:9B:6D<br />
Device Name: [quirxi]<br />
LMP Version: 1.2 (0x2) LMP Subversion: 0x309<br />
Manufacturer: Broadcom Corporation (15)<br />
Features: 0xff 0xfe 0x0d 0x00 0x08 0x08 0x00 0x00<br />
<3-slot packets> <5-slot packets> <encryption> <slot offset><br />
<timing accuracy> <role switch> <hold mode> <sniff mode><br />
<RSSI> <channel quality> <SCO link> <HV2 packets><br />
<HV3 packets> <A-law log> <CVSD> <power control><br />
<transparent SCO> <AFH cap. slave> <AFH cap. master><br />
<br />
<br />
'''编辑你的main.conf并且输入对应与你手机的class( Class = 0x100100 ):'''<br />
> vim /etc/bluetooth/main.conf<br />
<br />
# Default device class. Only the major and minor device class bits are<br />
# considered.<br />
#Class = 0x000100<br />
Class = 0x100100<br />
<br />
> /etc/rc.d/dbus start<br />
:: Starting D-BUS system messagebus <br />
[DONE]<br />
<br />
> /etc/rc.d/bluetooth start<br />
:: Stopping bluetooth subsystem: pand dund rfcomm hidd bluetoothd<br />
[DONE]<br />
:: Starting bluetooth subsystem: bluetoothd<br />
<br />
<br />
'''通过bluez-simple-agent配对只需要做一次。当你的手机要求输入pin码时,输入0000'''<br />
> /usr/bin/bluez-simple-agent hci0 00:1A:1B:82:9B:6D<br />
RequestPinCode (/org/bluez/10768/hci0/dev_00_1A_1B_82_9B_6D)<br />
Enter PIN Code: 0000<br />
Release<br />
New device (/org/bluez/10768/hci0/dev_00_1A_1B_82_9B_6D)<br />
<br />
'''现在你可以动过ObexFTP来访问你手机上的文件了:'''<br />
> obexftp -v -b 00:1A:1B:82:9B:6D -B 9 -l<br />
Connecting..\done<br />
Tried to connect for 448ms<br />
Receiving "(null)"...-<?xml version="1.0" ?><br />
<!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd"><br />
<folder-listing><br />
<parent-folder /><br />
<folder name="audio" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
<folder name="video" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
<folder name="picture" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
</folder-listing><br />
done<br />
Disconnecting..\done<br />
<br />
'''你也可以把你的手机作为文件系统的一部分挂载在你的计算机上:'''<br />
<br />
> groupadd bluetooth<br />
> mkdir /mnt/bluetooth<br />
> chown root:bluetooth /mnt/bluetooth<br />
> chmod 775 /mnt/bluetooth<br />
> usermod -a -G bluetooth arno<br />
<br />
> obexfs -b 00:1A:1B:82:9B:6D /mnt/bluetooth/<br />
> l /mnt/bluetooth/<br />
total 6<br />
drwxr-xr-x 1 root root 0 10. Okt 13:25 .<br />
drwxr-xr-x 5 root root 4096 10. Okt 10:08 ..<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 audio<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 picture<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 video<br />
<br />
=== 使用bluez-simple-agent来跟iPhone配对 ===<br />
<br />
假设有一个叫做hci0的蓝牙设备和一个在hcitool里显示为'00:00:DE:AD:BE:EF'的iPhone:<br />
<br />
# bluez-simple-agent hci0 00:00:DE:AD:BE:EF<br />
Passcode:<br />
<br />
== 疑难解答 ==<br />
<br />
=== passkey-agent ===<br />
$> passkey-agent --default 1234<br />
Can't register passkey agent<br />
The name org.bluez was not provided by any .service files<br />
你可能在启动<tt>/etc/rc.d/dbus</tt>之前启动了 <tt>/etc/rc.d/bluetooth</tt> <br />
$> hciconfig dev<br />
# (no listing)<br />
尝试运行 <tt>hciconfig hc0 up</tt><br />
<br />
=== Blueman ===<br />
如果blueman-applet启动失败,试着删除整个''/var/lib/bluetooth''目录然后重新启动电脑(或者仅仅重启hal、dbus和bluetooth这几个服务)。<br />
# rm -rf /var/lib/bluetooth<br />
# reboot<br />
<br />
=== gnome-bluetooth ===<br />
如果你通过在蓝牙属性里接受文件时受到如下消息:<br />
Bluetooth OBEX start failed: Invalid path<br />
Bluetooth FTP start failed: Invalid path<br />
<br />
那么运行<br />
# pacman -S xdg-user-dirs<br />
$ xdg-user-dirs-update<br />
你可以通过下列方式修改路径:<br />
$ vi ~/.config/user-dirs.dirs<br />
<br />
=== Bluetooth USB 适配器 ===<br />
如果你在使用USB适配器,你应当确认你的适配器被正确识别。你可以在插入适配器时通过查看<tt>/var/log/messages.log</tt>,这应当会出现类似于下面所示的信息:<br />
<br />
# tail -f /var/log/messages.log<br />
May 2 23:36:40 tatooine usb 4-1: new full speed USB device using uhci_hcd and address 9<br />
May 2 23:36:40 tatooine usb 4-1: configuration #1 chosen from 1 choice<br />
May 2 23:36:41 tatooine hcid[8109]: HCI dev 0 registered<br />
May 2 23:36:41 tatooine hcid[8109]: HCI dev 0 up<br />
May 2 23:36:41 tatooine hcid[8109]: Device hci0 has been added<br />
May 2 23:36:41 tatooine hcid[8109]: Starting security manager 0<br />
May 2 23:36:41 tatooine hcid[8109]: Device hci0 has been activated<br />
<br />
查看支持的硬件列表,请参考本页的[[Bluetooth#Resources|resources]]。<br />
<br />
如果你只得到了前面两行,说明了电脑发现了这个设备,但是你需要手动启动它。<br />
例如:<br />
<br />
hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0<br />
DOWN <br />
RX bytes:0 acl:0 sco:0 events:0 errors:0<br />
TX bytes:0 acl:0 sco:0 commands:0 errors:<br />
sudo hciconfig hci0 up<br />
hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:02:72:C4:7C:06 ACL MTU: 377:10 SCO MTU: 64:8<br />
UP RUNNING <br />
RX bytes:348 acl:0 sco:0 events:11 errors:0<br />
TX bytes:38 acl:0 sco:0 commands:11 errors:0<br />
<br />
要验证这个设备被正确检测,你可以使用<tt>bluez-utils</tt>当中的<tt>hcitool</tt>。你可以通过下面方式获得受支持的设备、它们的识别码和硬件地址:<br />
<br />
$ hcitool dev<br />
Devices:<br />
hci0 00:1B:DC:0F:DB:40<br />
<br />
可以通过<tt>hciconfig</tt>获得关于这个设备更详细的信息。<br />
<br />
$ hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:1B:DC:0F:DB:40 ACL MTU: 310:10 SCO MTU: 64:8<br />
UP RUNNING PSCAN ISCAN <br />
RX bytes:1226 acl:0 sco:0 events:27 errors:0<br />
TX bytes:351 acl:0 sco:0 commands:26 errors:0<br />
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80<br />
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 <br />
Link policy: RSWITCH HOLD SNIFF PARK <br />
Link mode: SLAVE ACCEPT <br />
Name: 'BlueZ (0)'<br />
Class: 0x000100<br />
Service Classes: Unspecified<br />
Device Class: Computer, Uncategorized<br />
HCI Ver: 2.0 (0x3) HCI Rev: 0xc5c LMP Ver: 2.0 (0x3) LMP Subver: 0xc5c<br />
Manufacturer: Cambridge Silicon Radio (10)<br />
<br />
=== hcitool scan: 没找到设备 ===<br />
* 在某些Dell的笔记本电脑(比如 Studio 15)上,你必须把蓝牙模式由HID改成HCI<br />
# hid2hci<br />
<br />
* 有时候这个简单的命令也会有用:<br />
# hciconfig hci0 up<br />
<br />
=== 我的电脑不可见 ===<br />
如果不能从你的移动电话上找到你的电脑,打开PSCAN和ISCAN:<br />
# 打开 PSCAN 和 ISCAN<br />
$ hciconfig hci0 piscan <br />
# 确认操作有效<br />
$ hciconfig <br />
hci0: Type: USB<br />
BD Address: 00:12:34:56:78:9A ACL MTU: 192:8 SCO MTU: 64:8<br />
'''UP RUNNING PSCAN ISCAN'''<br />
RX bytes:20425 acl:115 sco:0 events:526 errors:0<br />
TX bytes:5543 acl:84 sco:0 commands:340 errors:0<br />
<br />
{{注意 | 检查/etc/bluetooth/main.conf中的发现倒计时和配对倒计时}}<br />
<br />
试着在 /etc/bluetooth/main.conf 改变设备的class<br />
# Default device class. Only the major and minor device class bits are<br />
# considered.<br />
#Class = 0x000100 (from default config)<br />
Class = 0x100100<br />
<br />
This was the only solution to make my computer visible for my phone. <br />
<br />
=== Nautilus cannot browse files ===<br />
If nautilus doesn't open and show this error:<br />
Nautilus cannot handle obex: locations. Couldn't display "obex://[XX:XX:XX:XX:XX:XX]/".<br />
Install gvfs-obexftp package:<br />
# pacman -S gvfs-obexftp<br />
<br />
== 资源 ==<br />
*[http://www.bluez.org Official Linux Bluetooth protocol stack]<br />
*[http://www.holtmann.org/linux/bluetooth/devices.html List of Linux supported Bluetooth Hardware] >> The list is not available anymore!<br />
*[http://en.opensuse.org/HCL/Bluetooth_Adapters openSUSE Bluetooth Hardware Compatibility List (HCL)]<br />
*[http://www.gentoo.org/doc/en/bluetooth-guide.xml Gentoo wiki is usually good]<br />
*[http://linuxgazette.net/109/oregan3.html Accessing a Bluetooth phone on Linux Gazette]<br />
*[http://www.adamish.com/blog/#a000361 Bluetooth computer visibility]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=AMD_Catalyst_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=408909
AMD Catalyst (简体中文)
2015-11-11T13:40:25Z
<p>Aaron chen: /* xorg117 */</p>
<hr />
<div>[[Category:Graphics (简体中文)]]<br />
[[Category:X server (简体中文)]]<br />
[[en:AMD Catalyst]]<br />
[[es:AMD Catalyst]]<br />
[[fr:ATI#Catalyst]]<br />
[[it:AMD Catalyst]]<br />
[[ja:AMD Catalyst]]<br />
[[ru:AMD Catalyst]]<br />
{{TranslationStatus (简体中文)|AMD_Catalyst|2015-11-05|406475}}<br />
{{Related articles start (简体中文)}}<br />
{{Related|ATI (简体中文)}}<br />
{{Related|Xorg (简体中文)}}<br />
{{Related articles end}}<br />
AMD的显卡驱动有两种:一是官方私有驱动(catalyst,译为催化剂),二是开源驱动(xf86-video-ati).本文主要介绍私有驱动。<br />
<br />
AMD曾经将“catalyst”驱动命名为“fglrx” ('''F'''ire'''GL''' and '''R'''adeon '''X'''). 现在虽然名为“catalyst”,但内核模块名称依然为“fglrx.ko”. 因此,下文中任何提及fglrx 都是指“内核模块”,而不是指软件包.<br />
<br />
'''官方仓库不再提供Catalyst。''' Catalyst [https://www.archlinux.org/news/ati-catalyst-support-dropped/ 曾被移出Arch官方支持],原因是对质量与开发速度的不满。该项目于2013年4月被再次丢弃,截止现在还没有进一步的消息.<br />
<br />
与开源驱动相比, Catalyst 在2D,3D渲染和电源管理上更胜一筹,但缺乏高效的多显支持.支持设备为 [[wikipedia:Radeon|ATI/AMD Radeon]]显卡,芯片组 R600 及以上(Radeon HD 2xxx或者更新). ''model''名称 (如X1900, HD4850) 与 ''chip''名称 (分别是R580, RV770)间的对照请参见Xorg [http://www.x.org/wiki/RadeonFeature/#index5h2 decoder ring]或者[[wikipedia:Comparison of AMD graphics processing units|这个表格]].<br />
<br />
== 安装 ==<br />
<br />
共有三种途径安装Catalyst。第一种是用[https://aur.archlinux.org/account/Vi0l0/ Vi0L0](Arch非官方Catalyst维护人员)维护的软件库.此库包涵了所有可用的软件包.第二种方式就是通过AUR,Vi0L0提供的PKGBUILDs跟他用于构建他仓库的PKGBUILDs完全一样。最后你还可以直接通过AMD官方下载Catalyst.<br />
<br />
自Catalyst 12.4, AMD已将针对Radeon HD 5xxx 和 Radeon HD 2xxx, 3xxx and 4xxx 显卡驱动分开开发,因此在你选择何种安装方式之前,应查看你的显卡型号。Radeon HD 2xxx, 3xxx and 4xxx 显卡用 '''legacy'''驱动,Radeon HD 5xxx(以及更新的)用普通Catalyst。但无论你需要哪种驱动,都应安装Catalyst utilities。<br />
<br />
{{注意|你会发现,每种安装方式都会进行的一个相同的操作,无论你采用哪种安装方式,你都应了解一些通用的安装说明。}}<br />
<br />
=== 安装Catalyst ===<br />
<br />
==== 从非官方软件库 ====<br />
<br />
如果你不喜欢通过[[AUR]]来安装,则使用此方法。此软件库由我们的[[User:Vi0L0|Vi0l0]]维护。所有的包都经过签名,所以安全方面无需担心。下文提及的很多其他与AMD显卡有关的包也是由Vi0L0维护。<br />
<br />
Vi0L0有三个不同的Catalyst软件库:<br />
* [[Unofficial user repositories#catalyst|catalyst]]:Radeon HD 5xxx及更新的显卡使用的普通Catalyst驱动。包含了最新的 (稳定版或者beta版) Catalyst.<br />
* ''catalyst-stable'':Radeon HD 5xxx及更新的显卡使用的普通Catalyst驱动。包含了最新的稳定版 Catalyst.<br />
* [[Unofficial user repositories#catalyst-hd234k|catalyst-hd234k]]:Radeon HD 2xxx, 3xxx and 4xxx显卡使用的legacy Catalyst驱动.<br />
<br />
要启用上述软件库的话,参见[[Unofficial user repositories]]中所述方法. 记得在{{ic|pacman.conf}}中的'''其他软件库之前'''添加相应软件库.<br />
{{注意|''catalyst''和''catalyst-stable''软件库的URL相同.若要启用''catalyst-stable'',步骤与启用''catalyst''相同,并在{{ic|pacman.conf}}中将{{ic|[catalyst]}}替换成{{ic|[catalyst-stable]}}.如果你需要某个旧版本,这儿也有并且URL也相同,比如''catalyst-stable-13.4''.}}<br />
{{警告|<br />
* legacy Catalyst不支持Xorg Server 1.17. 要使用此驱动的话,参见 [[#Xorg repositories]] 来回滚到 Xorg Server 1.16.<br />
}}<br />
<br />
{{小贴士|有时 catalyst.wirephire.com 因为超出带宽上限而不能提供下载(曾发生过这个问题),或者你到这个服务器的连接很慢.这时,你可以尝试另外的镜像服务器: [http://mirror.rts-informatique.fr/archlinux-catalyst/] (rtsinformatique 提供,法国) 和 [http://mirror.hactar.bz/Vi0L0/] (goll 提供,德国). 不过,这些服务器不保证随时可用.需要的话就反注释掉,多准备一个替代品以防镜像临时不可用也是好习惯.<br />
<br />
Repository mirroring can be easily achieved using {{ic|rsync://mirror.rts-informatique.fr::archlinux-catalyst}}.<br />
}}<br />
<br />
完成后更新pacman数据库并[[pacman|安装]]这些软件包(更多信息参见[[#工具]]):<br />
<br />
* ''catalyst-hook''<br />
* ''catalyst-utils''<br />
* ''catalyst-libgl''<br />
* ''opencl-catalyst'' - 可选,OpenCL支持<br />
* ''lib32-catalyst-utils'' - 可选,64-bit系统上32-bit的OpenGL支持<br />
* ''lib32-catalyst-libgl'' - 可选,64-bit系统上32-bit的OpenGL支持<br />
* ''lib32-opencl-catalyst'' - 可选,64-bit系统上32-bit的OpenCL支持<br />
<br />
如果你是一台Intel/AMD双显卡笔记本,参考下这个:<br />
<br />
* ''catalyst-hook''<br />
* ''catalyst-utils-pxp''<br />
* ''lib32-catalyst-utils-pxp'' - 可选,64-bit系统上32-bit的OpenGL支持<br />
<br />
{{注意|如果pacman询问是否移除'''libgl''',尽管回答"是".}}<br />
<br />
{{警告|软件包catalyst已从Vi0L0的仓库移除,catalyst-hook取而代之.}}<br />
<br />
==== 通过AUR安装 ====<br />
<br />
还可以通过[[AUR]]安装。如果你需为你的电脑进行定制安装,则用此方法。此方法极为繁琐,因为它需要的工作量最大,而且每次内核更新后你得手动更新Catalyst。<br />
<br />
{{警告|若通过AUR安装 Catalyst, 每次内核更新你都得重新编译Catalyst,否则X将不能启动。}}<br />
<br />
在 Vi0L0's 软件库中提到的一切软件包[[AUR]]中也可用::<br />
* {{AUR|Catalyst}}<br />
* {{AUR|Catalyst-generator}}<br />
* {{AUR|Catalyst-hook}}<br />
* {{AUR|Catalyst-utils}}<br />
* {{AUR|Lib32-catalyst-utils}}<br />
<br />
AUR还提供些独家软件包。它含有被称为 ''Catalyst-total''的包和一些beta阶段的软件:<br />
* {{AUR|Catalyst-total}}<br />
* {{AUR|Catalyst-total-pxp}}<br />
* {{AUR|Catalyst-total-hd234k}}<br />
* {{AUR|Catalyst-test}}<br />
<br />
{{AUR|catalyst-total}}包能让AUR用户更为方便。它能构建驱动、内核工具、32位内核工具和{{AUR|catalyst-hook}}(参见[[#工具]]).<br />
<br />
{{AUR|catalyst-total-pxp}}让Catalyst对powerXpress提供实验性支持。<br />
<br />
=== 配置驱动 ===<br />
安装完毕后,要配置 X,让其使用Catalyst。要确保fglrx模块在启动阶段加载,而且要禁用[[kernel mode setting]].<br />
<br />
==== 配置X ====<br />
你需要创建 {{ic|xorg.conf}} 文件来配置X. Catalyst提供了{{ic|aticonfig}}工具来创建和(或)修改此文件。<br />
通过访问{{ic|/etc/ati/amdpcsdb}}文件它几乎能配置显卡的各项参数。了解完整的配置选项{{ic|aticonfig}}可运行:<br />
<br />
# aticonfig --help | less<br />
<br />
{{警告|在将各项配置参数提交到{{ic|/etc/X11/xorg.conf}}之前使用{{ic|--output}}选项,{{ic|/etc/X11/xorg.conf.d}}中的所有内容都会被覆盖。(Use the {{ic|--output}} option before committing to {{ic|/etc/X11/}} as an {{ic|xorg.conf}} file will override anything in {{ic|/etc/X11/xorg.conf.d/}})}}<br />
<br />
{{注意|如果坚持使用{{ic|xorg.conf.d}}下的新配置文件:为了让{{ic|Device}}部分与{{ic|/etc/X11/xorg.conf.d/20-radeon.conf}}相匹配,则使用{{ic|# aticonfig [...] --output}}.但这有一个缺点,很多依赖xorg.conf的{{ic|aticonfig}}选项都无法使用。}}<br />
<br />
现在来配置 Catalyst. 若只有一个显示器,运行:<br />
<br />
# aticonfig --initial<br />
<br />
{{注意| 如果对PowerXpress有疑问,安装 {{AUR|catalyst-total-pxp}}.}}<br />
<br />
注意,若你使用双显示器则使用下面的命令。 此命令会成两个配置文件,第二个显示器的配置文件在第一个前面<br />
<br />
# aticonfig --initial=dual-head --screen-layout=above<br />
<br />
{{注意|了解与设置双显有关的更多信息可查看[[#双屏显示]]}}<br />
<br />
你可与[[Xorg#Sample configurations|Sample Xorg.conf]]上的任何一个示例文件进行对照。<br />
<br />
虽然目前的版本的Xorg启动时能自动探测大多数选项,但不同Xorg版本的默认参数可能会有所不同,最好明确指定一些参数.<br />
<br />
给一个示例配置 (注意) '''仅供参考'''. 标{{ic|#}}必须有,标{{ic|##}}很可能会用到:<br />
<br />
{{hc|/etc/X11/xorg.conf|2=<br />
Section "ServerLayout"<br />
Identifier "Arch"<br />
Screen 0 "Screen0" 0 0 # 0's are necessary.<br />
EndSection<br />
Section "Module"<br />
Load [...]<br />
[...]<br />
EndSection<br />
Section "Monitor"<br />
Identifier "Monitor0"<br />
...<br />
EndSection<br />
Section "Device"<br />
Identifier "Card0"<br />
Driver "fglrx" # Essential.<br />
BusID "PCI:1:0:0" # Recommended if autodetect fails.<br />
Option "OpenGLOverlay" "0" ##<br />
Option "XAANoOffscreenPixmaps" "false" ##<br />
EndSection<br />
Section "Screen"<br />
Identifier "Screen0"<br />
Device "Card0"<br />
Monitor "Monitor0"<br />
DefaultDepth 24<br />
SubSection "Display"<br />
Viewport 0 0<br />
Depth 24 # Should not change from '24'<br />
Modes "1280x1024" "2048x1536" ## 1st value=default resolution, 2nd=maximum.<br />
Virtual 1664 1200 ## (x+64, y) to workaround potential OGL rect. artifacts/<br />
EndSubSection ## fixed in Catalyst 9.8<br />
EndSection<br />
Section "DRI"<br />
Mode 0666 # May help enable direct rendering.<br />
EndSection<br />
}}<br />
<br />
{{注意|一旦升级Catalyst就要通过后面的方法删除{{ic|amdpcsdb}}文件: 关闭X,删除{{ic|/etc/ati/amdpcsdb}},启动X然后运行{{ic|amdcccle}} -否则{{ic|amdcccle}}将会显示错误的Catalyst版本号}}<br />
<br />
''更多信息参考[https://bbs.archlinux.org/viewtopic.php?id=57084 这里].''<br />
<br />
==== 启动时加载模块 ====<br />
禁用{{ic|radeon}}以防其自动加载. 在{{ic|/etc/modprobe.d/modprobe.conf}}里禁用''radeon'',同时保证它不被{{ic|/etc/modules-load.d/}}里的文件加载. 详见[[kernel modules#Blacklisting]]. <br />
<br />
接下来,使模块{{ic|fglrx}}自动加载. 添加{{ic|fglrx}}到{{ic|/etc/modules-load.d/}}下已有的模块文件的新一行,或者创建一个新的模块文件并添加{{ic|fglrx}}.<br />
<br />
==== 禁用KMS ====<br />
<br />
{{注意|使用{{ic|catalyst-utils-pxp}}或者{{ic|catalyst-total-pxp}}的用户不要这样做,因为intel驱动需要KMS.}}<br />
<br />
禁用KMS很重要.由于Catalyst根本不使用[[KMS]],得将其禁用。否则,当系统切换至TTY或在桌面环境下关机时,系统可能会冻结。<br />
<br />
添加 {{ic|nomodeset}} 到你的 [[kernel parameters|内核参数]]. <br />
<br />
==== 检查安装是否成功 ====<br />
<br />
重启电脑并登录, 运行下列命令可查看{{ic|fglrx}}是否正确运行:<br />
<br />
$ lsmod | grep fglrx<br />
<br />
若有输出, 则证明安装成功。可以尝试用 {{ic|$ startx}} 或者显示管理器来启动X (参见 [[Xorg#Running]]).<br />
<br />
下面的命令可以输出你的显卡型号信息:<br />
<br />
$ fglrxinfo<br />
<br />
运行以下命令检查直接渲染模式是否启用:<br />
<br />
$ glxinfo | grep direct<br />
<br />
若显示{{ic|"direct rendering: yes"}},恭喜你,到位了! 若无{{ic|$ glxinfo}}命令,安装{{Pkg|mesa-demos}} package。<br />
<br />
{{注意|对于{{ic|glxgears}},你也可以使用:<br />
$ fgl_glxgears<br />
来测试fglrx.<br />
}}<br />
<br />
{{警告|最近几版Xorg,库函数路径变了,因此即使安装{{ic|libGL.so}}也不一定能正确人加载。请检查GL是否工作,可阅读"故障排除"段落}}<br />
<br />
=== 自己编译内核 ===<br />
<br />
在手动编译的内核上,你必须构建你自己的{{ic|catalyst-$kernel}}包.<br />
<br />
{{注意|如果你讨厌打包或毫无经验,可先阅读[[ABS]]。}}<br />
<br />
#从[[AUR|Catalyst]]上获取{{ic|PKGBUILD}} 和 {{ic|catalyst.install}}文件。<br />
# 编辑PKGBUILD. 两个地方需要修改:<br />
## 将{{ic|1=pkgname=catalyst}} 修改为 {{ic|1=pkgname=catalyst-$kernel_name}},{{ic|$kernel_name}}可以随意取(如:custom, mm)。<br />
## 将{{ic|linux}}的依赖修改为{{ic|$kernel_name}}。<br />
# 构建并安装软件包;运行{{ic|makepkg -i}} 和 {{ic|makepkg}},接着运行 {{ic|# pacman -U pkgname.pkg.tar.gz}}<br />
<br />
{{注意|<br />
*如果在安装有多内核的系统上,你必须为所有内核安装 {{AUR|catalyst-utils}} 包。这不会引起冲突.<br />
<br />
*{{AUR|catalyst-generator}}能为你自动构建{{ic|<nowiki>catalyst-{kernver}</nowiki>}},因此这些步骤根本就可省略。 请参考[[#工具|工具 部分]].}}<br />
<br />
=== PowerXpress support ===<br />
<br />
PowerXpress technology 允许支持dual-graphic功能(以前叫做AMD Hybrid CrossFire technology)的笔记本电脑从集成显卡(IGP) 切换到独立显卡,以增加电池寿命或者实现更好的3D渲染效能。<br />
<br />
为了在archlinux上用上这个功能,你j将需要:<br />
* 从 [[AUR]] 获取并编译 {{AUR|catalyst-total-pxp}} 这个软件包,或者<br />
* 从 [catalyst] 软件仓库安装 '''catalyst-utils-pxp''' 软件包 (如果需要,还有 lib32-catalyst-utils-pxp)。<br />
<br />
对于intel集成显卡的切换,你还需要安装 {{pkg|mesa-libgl}} 软件包和intel的驱动:{{pkg|xf86-video-intel}} 。<br />
{{注意|'''对最新的13.1版本的Catalyst(不是Catalyst legacy) ChrisXY 能够兼容最新的 {{pkg|xorg-server}} (版本 1.13.1), {{Pkg|mesa}} 9.0.1 和 {{pkg|xf86-video-intel}} 2.20.18'''.<br />
<br />
对于所有版本低于13.1的Catalyst(和任何版本的Catalyst legacy),和新的intel驱动存在一些兼容问题。'''最近的{{pkg|xf86-video-intel}}开发版本是2.20.2-2''',所以你可能必须从Arch软件仓库中的最新版本降级(尽管我们推荐你试验性地使用最新的驱动,因为有可能它在你这里没有问题)<br />
<br />
{{pkg|xf86-video-intel}} 2.20.2-2 只兼容 xorg-server 1.12 并且特它是 '''xorg112 repository'''的一部分. 如果你想使用它,你必须降级xorg-server。具体信息见 [[#Xorg repositories]].}}<br />
<br />
现在你可以用下面这些命令切换集成显卡和独立显卡:<br />
<br />
{{bc|1=<br />
# aticonfig --px-igpu #for integrated GPU<br />
# aticonfig --px-dgpu #for discrete GPU<br />
}}<br />
<br />
Just remember that fglrx needs {{ic|/etc/X11/xorg.conf}} configured for AMD's card with {{ic|fglrx}} inside.<br />
要记着对含有 {{ic|fglrx}} 模块的AMD显卡,fglrx需要 {{ic|/etc/X11/xorg.conf}} 这个文件<br />
<br />
你也可以用{{ic|pxp_switch_catalyst}} 这个切换脚本完成一些其他有用的操作:<br />
* Switching {{ic|xorg.conf}} - it will rename {{ic|xorg.conf}} into {{ic|xorg.conf.cat}} (if there is fglrx inside) or {{ic|xorg.conf.oth}} (if there is intel inside) and then it will create a symlink to {{ic|xorg.conf}}, depending on what you chose.<br />
* Running {{ic|aticonfig --px-Xgpu}}.<br />
* Running {{ic|switchlibGL}}.<br />
* Adding/removing {{ic|fglrx}} into/from {{ic|/etc/modules-load.d/catalyst.conf}}.<br />
<br />
Usage:<br />
{{bc|1=<br />
# pxp_switch_catalyst amd<br />
# pxp_switch_catalyst intel<br />
}}<br />
<br />
如果你试图在装有intel驱动的设备上运行X图形界面时遇到问题,你可以尝试强制开启"UXA" acceleration: 在{{ic|xorg.conf}}中写{{ic|Option "AccelMethod" "uxa"}},就象这样:<br />
{{hc|/etc/X11/xorg.conf|2=<br />
Section "Device"<br />
Identifier "Intel Graphics"<br />
Driver "intel"<br />
#Option "AccelMethod" "sna"<br />
'''Option "AccelMethod" "uxa"'''<br />
#Option "AccelMethod" "xaa"<br />
EndSection<br />
}}<br />
<br />
==== 同时运行两个X server(一个使用Intel驱动, 一个使用 fglrx) ====<br />
<br />
因为fglrx容易崩溃(考虑到PowerXpress),主要X server使用Intel驱动,另一个使用需要3D加速的fglrx驱动是个不错的选择。但是在开启第二个X server的时候,简单地从集成显卡 {{ic|aticonfig}} 或者 {{ic|amdcccle}}切换到独立显卡将引发一系列不正常的bugs。<br />
<br />
为了同时运行两个X server(每个用不同的驱动),你首先需要设置出一个可以和Catalyst一起正常工作的X图形环境,然后把它的 {{ic|xorg.conf}}移动到一个临时的地方(比如{{ic|/etc/X11/xorg.conf.fglrx}})。下次X图形环境启动时,它将默认使用intel驱动来代替fglrx。<br />
<br />
在开启第二个使用fglrx的X server,只需要在运行X之前,把{{ic|xorg.conf}} 移回合适的地方({{ic|/etc/X11/xorg.conf}})。这个方法甚至允许你在两个运行的X sessions之间来回切换。当你不需要使用fglrx时,再把 {{ic|xorg.conf}} 移动到其他地方。<br />
<br />
这种方法唯一的坏处是不能使用intel驱动的3D加速。但它的2D却能完全发挥作用。除此之外,它还能给我们一个非常稳定的桌面环境。<br />
<br />
==== 多显示器的PowerXpress笔记本运行于AMD模式时(pxp_switch_catalyst amd)的问题 ====<br />
当PowerXpress笔记本工作于AMD-only模式时(比如设置全部渲染工作交给独显),你有可能会遇到显示器伪影/重复的情况.这是一个已知的问题,发生于7xxxM系列显卡.<br />
<br />
当旋转或者缩放一个显示器时现象会消失,所以你可以使用xrandr来解决这个问题:<br />
<br />
{{bc|1=<br />
xrandr --output HDMI1 --left-of LVDS1 --primary --scale 1x1 --output LVDS1 --scale 1.0001x1.0001<br />
}}<br />
<br />
== Xorg软件库 ==<br />
Catalyst由于其缓慢的更新而被人大为诟病。因升级Xorg而造成两者不兼容是稀松平常的事。也就意味着Catalyst用户要么自己编译Xorg的包要么使用一个只包含Xorg包的回溯软件库,该库中不提供更新版Xorg以确保兼容性。 Vi0L0提供好几个这样的库. <br />
<br />
要启用上述软件库的话,参见[[Unofficial user repositories]]中所述方法. 记得在{{ic|pacman.conf}}中的'''其他软件库之前(甚至在你的catalyst仓库前,如果你有的话)'''添加相应软件库(使用和[[Unofficial user repositories#catalyst|catalyst]]库相同的PGP密匙).<br />
<br />
=== xorg117 ===<br />
Catalyst 不支持 xorg-server 1.18<br />
{{bc|<nowiki><br />
[xorg117]<br />
Server = http://catalyst.wirephire.com/repo/xorg117/$arch<br />
## Mirrors, if the primary server does not work or is too slow:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg117/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg117/$arch<br />
</nowiki>}}<br />
<br />
=== xorg116 ===<br />
Catalyst < 15.7 不支持 xorg-server 1.17<br />
{{bc|<nowiki><br />
[xorg116]<br />
Server = http://catalyst.wirephire.com/repo/xorg116/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg116/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg116/$arch<br />
</nowiki>}}<br />
<br />
=== xorg115 ===<br />
Catalyst < 14.9 不支持 xorg-server 1.16<br />
<br />
{{bc|<nowiki><br />
[xorg115]<br />
Server = http://catalyst.wirephire.com/repo/xorg115/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg115/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg115/$arch<br />
</nowiki>}}<br />
<br />
=== xorg114 ===<br />
Catalyst < 14.1 不支持 xorg-server 1.15.<br />
<br />
{{bc|<nowiki><br />
[xorg114]<br />
Server = http://catalyst.wirephire.com/repo/xorg114/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg114/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg114/$arch<br />
</nowiki>}}<br />
<br />
=== xorg113 ===<br />
Catalyst < 13.6 不支持 xorg-server 1.14.<br />
<br />
{{bc|<nowiki><br />
[xorg113]<br />
Server = http://catalyst.wirephire.com/repo/xorg113/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg113/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg113/$arch<br />
</nowiki>}}<br />
<br />
=== xorg112 ===<br />
Catalyst < 12.10 和 Catalyst Legacy 不支持 xorg-server 1.13.<br />
<br />
{{bc|<nowiki><br />
[xorg112]<br />
Server = http://catalyst.wirephire.com/repo/xorg112/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg112/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg112/$arch<br />
</nowiki>}}<br />
<br />
== 工具 ==<br />
<br />
=== Catalyst-hook ===<br />
{{AUR|Catalyst-hook}} 是一个 [[systemd]] 服务,它在系统关机或重启后重新构建{{ic|fglrx}}模块(如果需要的话,比如内核升级后).<br />
<br />
使用之前请保证 {{Grp|base-devel}} 组和 {{Pkg|linux-headers}} 包(对应你的内核)已经安装.<br />
<br />
只需激活{{ic|catalyst-hook.service}}服务即可:<br />
<br />
# systemctl enable catalyst-hook<br />
# systemctl start catalyst-hook<br />
<br />
你也可以用这个软件包来手动构建{{ic|fglrx}}模块. 在内核更新后运行 {{ic|catalyst_build_module}} 脚本即可:<br />
<br />
# catalyst_build_module all<br />
<br />
'''一些技术细节:'''<br />
<br />
The {{ic|catalyst-hook.service}} is stopping the systemd "river" and is forcing systemd to wait until catalyst-hook finishes its job.<br />
<br />
{{ic|catalyst-hook.service}} 调用 {{ic|catalyst_build_module check}} 来检查是否有必要重构建fglrx.<br />
<br />
{{ic|check}} 检查{{ic|fglrx}}模块是否存在:<br />
<br />
*不存在,将构建它;<br />
<br />
*存在,它将比较两个参数来确定是否有必要重构建{{ic|fglrx}}.<br />
<br />
这里的参数是 {{ic|/usr/lib/modules/<kernel_version>/build/Module.symvers}} 的md5值. (因为我(这里指Vi0L0)发现每一个版本的这个文件都不一样). 第一个参数是现有的 {{ic|Module.symvers}} 文件md5.第二个参数是{{ic|fglrx}}模块构建时 {{ic|Module.symvers}} 文件的md5. 这个参数被{{ic|catalyst_build_module}}脚本编译到{{ic|fglrx}}模块.<br />
<br />
如果参数不同,将编译新的{{ic|fglrx}}模块.<br />
<br />
check 检查整个 {{ic|/usr/lib/modules/}} 目录 ,为安装的所有内核编译fglrx模块(如果需要的话). 如果没有必要构建或重构建,进程将很快结束.<br />
<br />
=== Catalyst-generator ===<br />
<br />
{{AUR|catalyst-generator}}包能构建并安装{{ic|fglrx}}模块,该模块与pacman兼容的{{ic|<nowiki>catalyst-${kernver}</nowiki>}}相适应。与[[#Catalyst-hook]]的区别是必须手动使用此命令,而Catalyst-hook则不需。<br />
<br />
通过[[makepkg]],它能构建{{ic|<nowiki>catalyst-${kernver}</nowiki>}}二进制包并用[[pacman]]安装。{{ic|<nowiki>${kernver}</nowiki>}} 是软件包的目标内核版本 (例如 catalyst-2.6.35-ARCH 适用于 2.6.35-ARCH 内核).<br />
<br />
非特权用户使用{{ic|catalyst_build_module}}来构建并安装{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包。安装时会提示输入root密码。<br />
<br />
简单说一下如何使用此包:<br />
<br />
# root用户: 使用{{ic|catalyst_build_module remove}}。此举会删除无用的{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包。<br />
# 非特权用户: 使用{{ic|<nowiki>catalyst_build_module ${kernver}</nowiki>}}, {{ic|<nowiki>${kernver}</nowiki>}}是指升级过后的内核版本。也可通过{{ic|catalyst_build_module all}}为所有安装的内核构建{{ic|<nowiki>catalyst-{kernver}</nowiki>}}。<br />
# 若要删除{{ic|catalyst-generator}}, 在使用{{ic|catalyst_build_module remove_all}}命令删除catalyst-generator之前最好切换到root用户,'''这会删除所有{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包.'''<br />
<br />
当删除{{ic|Catalyst-generator}}时,{{ic|Catalyst-generator}}不能自动删除那些{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包,这是因为pacman不允许有一个以上的实例同时运行。若在使用{{ic|# pacman -R catalyst-generator}}前忘记运行{{ic|# catalyst_build_module remove_all}},catalyst-generator将会询问删除catalyst-generator自身后要删除哪个{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包。<br />
<br />
Catalyst-generator 是最安全的,最符合KISS原则的,因为:<br />
<br />
# 你可以使用非特权用户来构建包;<br />
# 它在 fakeroot 环境构建包;<br />
# 它不乱丢文件,[[pacman]]知道文件们在哪;<br />
# 你需要做的只是,记得去使用它<br />
<br />
{{注意|在构建 {{ic|<nowiki>catalyst-{kernver}</nowiki>}} 时,若看到下列警告,乃正常情况,不必莫名惊诧:<br />
<br />
'''WARNING:''' Package contains reference to $srcdir<br />
<br />
'''WARNING:''' '.pkg' is not a valid archive extension<br />
}}<br />
<br />
=== OpenCL / OpenGL 开发 ===<br />
<br />
这几年AMD一直在为OpenCL and OpenGL的开发做一套工具集。<br />
<br />
现在AMD在'''"Heterogeneous Computing"'''的旗帜下提供了更多的工具集,幸运的是它们也在Linux下可用。<br />
<br />
在AUR和 [catalyst] 软件仓库,你可以找到这些代表了AMD最重要工作的工具软件包:<br />
<br />
* {{AUR|amdapp-aparapi}}<br />
* {{AUR|amdapp-sdk}}<br />
* {{AUR|amdapp-codexl}}<br />
<br />
APP 这个缩写代表 Accelerated Parallel Processing(加速并行处理)。<br />
<br />
==== amdapp-aparapi ====<br />
AMD的Aparapi是一个用java实现的API,用于并行地表达图像数据,它同时也是一个能把java字节码翻译成能被OpenCL识别的运行时组件。所以它能够被很多种图形处理器(GPU)执行。如果Aparapi在GPU上不能执行,那将在java的线程池中执行。<br />
<br />
更多关于Aparapi的信息:[http://developer.amd.com/tools/heterogeneous-computing/aparapi/ here]。<br />
<br />
==== amdapp-sdk (以前的amdstream) ====<br />
AMD APP 软件开发工具套件,是一个由AMD制作地一套完整的开发平台。它让你能够快速和容易地使用AMD APP技术,使得你的程序得到加速。这个SDK提供了代码实例,技术文档和其他资料,让您可以在你的C\C++程序中使用 OpenCL, Bolt, or C++ AMP等技术实现计算加速。<br />
<br />
从2.8版本开始,amdapp-sdk 提供了 aparapiUtil 和 aparapi 的代码实例。有一个包已经加入到了[catalyst]软件仓库。它依赖于{{AUR|amdapp-aparapi}}。AUR中的软件包让你选择需不需要aparapi's additions。<br />
<br />
2.8 版本没有提供探查功能( Profiler functionality),它已经被移到CodeXL中了。<br />
<br />
关于 AMD APP SDK 的更多信息: [http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/ here]。<br />
<br />
==== amdapp-codexl ====<br />
CodeXL 是一个带有静态OpenCl内核分析器的OpenCL and OpenGL调试器和探查器。它具有GUI界面,是在著名的{{AUR|gdebugger}} 基础上完成的。它只支持 x86_64 系统。<br />
<br />
关于CodeXL的更多信息: [http://developer.amd.com/tools/heterogeneous-computing/codexl/ 这里]。<br />
<br />
== 功能 ==<br />
=== Tear Free Rendering ===<br />
<br />
在'''Catalyst 11.1'''中,很可能是添加了三重缓存和v-sync,''Tear Free Desktop''减少了2D,3D视频应用的屏幕撕裂毛病。但这需要额外的GPU处理。<br />
<br />
要启用'Tear Free Desktop',运行{{ic|amdcccle}},然后设置{{ic|Display Options}} → {{ic|Tear Free}}。<br />
<br />
或以root身份运行:<br />
<br />
# aticonfig --set-pcs-u32=DDX,EnableTearFreeDesktop,1<br />
<br />
若禁用,使用{{ic|amdcccle}}或以root身份运行:<br />
<br />
# aticonfig --del-pcs-key=DDX,EnableTearFreeDesktop<br />
<br />
=== 视频加速 ===<br />
<br />
'''[[wikipedia:Video_Acceleration_API|Video Acceleration API]] (VA API)'''是为基于Linux/UNIX操作系统提供利用GPU加速视频处理的一个开源函数库和应用程序接口规范。启用视频加速后,通过各种入口(VLD, IDCT, Motion Compensation, deblocking)它能加速常用编码标准(MPEG-2, MPEG-4 ASP/H.263, MPEG-4 AVC/H.264, and VC-1/WMV3)视频文件的解码过程(俗称硬解)。<br />
<br />
VA-API在{{AUR|xvba-video}}上有一个私有后端(2009年10月), 它允许使用VA-API的程序通过[[wikipedia:XvBA|XvBA (X-Video Bitstream Acceleration API designed by AMD)]]函数库来充分利用拥有uvd2(第二代通用视频解码单元)芯片组的视频加速功能.<br />
<br />
{{注意|使用 {{ic|catalyst-test}} 或者 {{ic|catalyst-total}} 时不需要安装 {{AUR|xvba-video}} , 因为有已经创建好的符号链接代替.}}<br />
xvba-video和支持XvBA的软件仍还在开发,'''但在大多数情况下它都能很好的工作'''. 通过AUR构建(或通过Vi0L0的仓库直接安装)专有{{AUR|xvba-video}}包,若这个版本对你来说有问题,用{{AUR|libva-xvba-driver}}取代; 并安装{{AUR|mplayer-vaapi}} and {{Pkg|libva}}。然后将视频播放器的视频输出设置为vaapi:gl:<br />
<br />
$ mplayer -vo vaapi:gl movie.avi<br />
<br />
此选项可添加到mplayer的配置文件,参考[[MPlayer]]。<br />
<br />
针对 '''smplayer''':<br />
<br />
Options → Preferences → General → Video (tab) → Output driver: User Defined : vaapi:gl<br />
Options → Preferences → General → Video (tab) → Double buffering '''on'''<br />
Options → Preferences → General → General → Screenshots → Turn screenshots '''off'''<br />
Options → Preferences → Performance → Threads for decoding: '''1''' (to turn off -lavdopts parameter)<br />
<br />
{{注意|如果启用了Tear Free Desktop,则按下列步骤:<br />
Options -> Preferences -> General -> Video (tab) -> Output driver: vaapi<br />
若视频输出中没有'''vaapi:gl'''选项 - 可使用:<br />
'''vaapi''', '''vaapi:gl2''' or 简单的 '''xv(0 - AMD Radeon [[wikipedia:Avivo|AVIVO Video]])'''.<br />
}}<br />
<br />
针对 '''VLC''':<br />
<br />
Tools → Preferences → Input & Codecs → Use GPU accelerated decoding<br />
<br />
它有助于在'''amdcccle'''中启用v-sync:<br />
<br />
3D → More Settings → Wait for vertical refresh = Always On<br />
<br />
{{注意|若使用'''Compiz/KWin''',消除'''画面抖动'''的唯一方法就是切换至'''全屏'''并且 '''关闭Redirected Fullscreen'''。<br />
<br />
使用'''compiz''',需在ccsm的General Options中设置'''Redirected Direct Rendering'''。若此举无效,则将其关闭。'''KWin'''默认关闭此功能,若出现画面抖动则通过{{ic|System Settings}} → {{ic|Desktop Effects}} → {{ic|Advanced}}.}}将"Suspend desktop effects for fullscreen windows"开启或关闭。}}<br />
<br />
=== 显卡/显存频率, 温度, 风扇转速, 超频工具 ===<br />
<br />
{{ic|$ aticonfig --od-getclocks}}可以获知当前显卡/显存频率。<br />
<br />
{{ic|$ aticonfig --pplib-cmd "get fanspeed 0"}}可以获知风扇转速(显卡);<br />
<br />
{{ic|$ aticonfig --odgt}}可以获知显卡温度。<br />
<br />
{{ic|$ aticonfig --pplib-cmd "set fanspeed 0 50"}}可以设置风扇转速,其中查询索引50代表速度百分比。<br />
<br />
若超频或与之相反,则使用图形工具反而相对容易些,如需要qt的'''ATi Overclocking Utility'''。你可以从[http://kde-apps.org/content/show.php/ATI+Overclock?content=47796 这儿]找到(不过它可能过时了).<br />
<br />
更复杂的{{AUR|amdoverdrivectrl}}也能达到此目的,它的主页是[http://sourceforge.net/projects/amdovdrvctrl here]。可通过[https://aur.archlinux.org/packages.php?ID=45298 AUR]或Vi0L0's非官方软件库构建安装包。<br />
<br />
=== 双屏显示 ===<br />
<br />
==== 介绍 ====<br />
<br />
{{警告|由于安装方式的不同,并且每种安装方式需要与其相对应进行配置,因此设置双屏显示并没有特定的方法,你必须根据你自己的需要采用相应的步骤。当然可以多尝试几种方法。'''所以,在修改之前,请务必将你现在能正常使用的{{ic|/etc/X11/xorg.conf}}备份,以便遇到问题时可以从命令行恢复.'''}}<br />
<br />
* 本节讲述如何配置"BIG Desktop"效果。主要是不同尺寸的屏幕如何通过两个不同的输出接口(DVI + HDMI)共享一个显卡。<br />
<br />
* Xinerama解决办法有些不便,尤其是不能与XrandR兼容。因为XrandR对于我们所讲的来说是必须的,所以不使用Xinerama。<br />
<br />
* 双头显示能让你有两个不同的会话(一个屏幕一个)。你可以随心所欲地干任何事情,但不能将窗口从一个屏幕移动到另一个屏幕。若只有一个屏幕,你得在Xorg会话里为Server Layout section的每个会话定义鼠标,具体方法查看:<br />
<br />
[http://support.amd.com/us/kbarticles/Pages/1105-HowCanIConfigureMultip.aspx ATI Documentation]<br />
<br />
==== ATI Catalyst Control Center ====<br />
<br />
ATI的图形工具非常有用,我们将尽可能地使用它。运行下面命令可启用它:<br />
<br />
$ {kdesu/gksu} amdcccle<br />
<br />
{{警告|'''千万不要'''直接使用sudo。 Sudo虽能给予管理员权限,却使用用户账户的信息(如环境变量)。GNOME下使用''gksu'',KDE下使用''kdesu''。}}<br />
<br />
==== 安装 ====<br />
<br />
开始之前,确保你的硬件接插正确,电源开启,而且你得你的硬件属性(2D还是3D屏,屏幕尺寸,刷新率等)。通常情况下,在启动阶段两个显示器都会被识别却不需正确区分先后顺序,而是依赖热插拔功能。尤其在不使用({{ic|/etc/X11/xorg.conf}})配置时。<br />
<br />
首先要让你的桌面环境和X认识你的显示器。为此,要为你两个显示器生成基本的Xorg配置文件:<br />
<br />
# aticonfig --initial --desktop-setup=horizontal --overlay-on=1<br />
<br />
或<br />
<br />
# aticonfig --initial=dual-head --screen-layout=left<br />
<br />
{{注意|{{ic|overlay}}非常重要,因为它能让两个显示器拥有1种(多种)像素。<br />
{{提示|运行{{ic|aticonfig --help}}了解所有可用的命令。}}<br />
<br />
现在可编辑基本的Xorg配置文件(如:添加分辨率)。分辨率一定要正确,尤其是使用不同尺寸的显示器。分辨率在"Screen" section:<br />
<br />
SubSection "Display"<br />
Depth 24<br />
Modes "X-resolution screen 1xY-resolution screen 1" "Xresolution screen 2xY-resolution screen 2"<br />
EndSubSection<br />
<br />
这以后就不需手动编辑{{ic|xorg.conf}},而ATI的图形化工具。重启X,确保正确支持两个显示器和识别屏幕分辨率(两个屏幕相互独立而不是完全一样。<br />
<br />
==== 设置 ====<br />
<br />
现在只需以root身份启动ATI控制中心,在显示菜单设置你需要的选项(下拉菜单中的小箭头)。设置好后重启X就大功造成(你和我都可松口气了,这段翻译有点难度,呵呵)!<br />
<br />
重启X之前,不要忘了核实{{ic|xorg.conf}}。主要是核实"Display"下的"Screen"节, 在"Virtual"行里,两个显示器的分辨率应该一样。"Server Layout"节则是剩下的参数。<br />
<br />
== 卸载 ==<br />
<br />
你可能会因为catalyst不工作或者是想试试开源驱动而要卸载掉catalyst:移除 {{ic|catalyst}} 和 {{ic|catalyst-utils}} 包. 当然你也应该移除 {{AUR|catalyst-generator}}, {{AUR|catalyst-hook}} 和 {{AUR|lib32-catalyst-utils}} 包(如果你安装了的话).<br />
<br />
{{警告|<br />
*你也许需要使用 {{ic|# pacman -Rdd}} 来移除 {{AUR|catalyst-utils}} (和/或 {{AUR|lib32-catalyst-utils}}) 因为它(们)包含了 ''gl'' 相关文件,许多包会依赖他们. 这些依赖关系将在安装{{Pkg|xf86-video-ati}}时被满足.<br />
*你也许会需要移除 {{ic|/etc/profile.d/ati-flgrx.sh}} 和 {{ic|/etc/profile.d/lib32-catalyst}} (如果他们存在), 否则 {{ic|r600_dri.so}} 将会载入失败,你将得不到3D支持.}}<br />
<br />
{{注意|你应该从 {{ic|/etc/pacman.conf}} 移除非官方仓库,然后运行 {{ic|# pacman -Syu}}, 因为那些仓库包含过时的Xorg包(为了兼容{{ic|catalyst}}),而 {{Pkg|xf86-video-ati}} 包需要来自[[Official repositories|官方仓库]]的最新的Xorg包.}}<br />
<br />
按如下步骤:<br />
<br />
* 如果你有 {{ic|/etc/modprobe.d/blacklist-radeon.conf}} ,删除文件或者注释掉文件中的{{ic|blacklist radeon}}.<br />
* 如果你在 {{ic|/etc/modules-load.d}} 下有配置文件要在启动时载入 {{ic|fglrx}} 模块, 删除掉或者注释掉 {{ic|fglrx}} 那一行.<br />
* 记住删除/备份 {{ic|/etc/X11/xorg.conf}}.<br />
* 如果安装了 {{AUR|catalyst-hook}} 包,记得关掉它的systemd服务的自启动.<br />
* 如果你在 [[kernel parameters|内核参数]] 中指定了{{ic|nomodeset}}而现在你打算使用KMS,那么删除{{ic|nomodeset}}.<br />
<br />
* 安装另一个驱动之前记得'''重启''' .<br />
<br />
== 故障排除 ==<br />
<br />
若能启动到命令行,问题很可能出在{{ic|/etc/X11/xorg.conf}}<br />
<br />
可阅读{{ic|/var/log/Xorg.0.log}}或通过下列命令查找线索:<br />
<br />
$ grep '(EE)' /var/log/Xorg.0.log<br />
$ grep '(WW)' /var/log/Xorg.0.log<br />
<br />
若看不懂显示的是什么东东,请先搜索论坛,没有结果的话,可将其提交到[https://bbs.archlinux.org/viewtopic.php?pid=1166052#p1166052/ thread specific to ATI/AMD],注意要提交两者显示的信息。<br />
<br />
=== 运行 atieventsd.service 失败 ===<br />
从 [[official repositories_(简体中文)|官方仓库]] 安装 {{Pkg|acpid}}. 启用并运行acpid[[Daemon_(简体中文)|守护进程]].<br />
<br />
如果还不行, 编辑 {{ic|/usr/lib/systemd/system/atieventsd.service}} ,把 {{ic|acpid.socket}} 改成 {{ic|acpid.service}}.<br />
<br />
=== 无法打开 fglrx_dri.so ===<br />
创建从 {{ic|/usr/lib/xorg/modules/dri/fglrx_dri.so}} 到 {{ic|/usr/X11R6/lib64/modules/dri/fglrx_dri.so}} 或其它需要路径的链接:<br />
<br />
# mkdir -p /usr/X11R6/lib64/modules/dri<br />
# ln -s /usr/lib/xorg/modules/dri/fglrx_dri.so /usr/X11R6/lib64/modules/dri/fglrx_dri.so<br />
<br />
=== 启动 GDM 失败 ===<br />
降级 {{pkg|xorg-server}} 或者试试其它 [[Display manager_(简体中文)|显示管理器]] 比如 [[LightDM]].<br />
<br />
=== 在Wine上3D应用冻结 ===<br />
若在Wine上3D应用挂起,禁用TLS。使用{{ic|aticonfig}}或编辑{{ic|/etc/X11/xorg.conf}}。使用{{ic|aticonfig}}:<br />
<br />
# aticonfig --tls=off<br />
<br />
或以root身份打开{{ic|/etc/X11/xorg.conf}},在''Device''段添加{{ic|Option "UseFastTLS" "off"}}。<br />
<br />
只需来个二选一,然后重启X让其生效。<br />
<br />
=== 视频颜色不正常 ===<br />
<br />
仍然使用{{ic|vaapi:gl}}来防止画面抖动,但这样不会有视频加速:<br />
<br />
* 不使用{{ic|-vo vaapi}}运行'''mplayer'''。<br />
<br />
* 若是'''smplayer''',在Options → Preferences → Advanced → Options for MPlayer → Options:中删除{{ic|-vo vaapi}}。<br />
<br />
此后还可以启动'''smplayer'''的截屏功能。<br />
<br />
=== KWin 与混成 ===<br />
<br />
根据你的显卡,在OpenGL和XRender渲染方式中选择一种更快的。<br />
在某些情况下,XRender还可以解决一些人为的错误(比如调整命令行大小)。<br />
<br />
=== 重启或启动x后,黑屏并且一直不退出 ===<br />
<br />
检查在启动加载器的内核参数行是否添加了{{ic|nomodeset}}(参考 [[#禁用KMS]])。<br />
你如果在使用legacy驱动 ({{ic|catalyst-hd234k}}) 黑屏的话, 尝试降级 xorg-server 到 1.12 (使用 [[#xorg112]] 库).<br />
<br />
==== 错误的ACPI硬件调用 ====<br />
<br />
出现此种错误很可能是fglrx模块与系统的ACPI硬件调用配合不够默契而自身禁用,屏幕也就不会有输出。<br />
<br />
果真那样,运行:<br />
<br />
$ aticonfig --acpi-services=off<br />
<br />
=== 注销后KDM消失 ===<br />
<br />
若使用Catalyst,当注销后你会获取tty1这个控制台而不是KDM的欢迎界面。每次注销后你必须让kdm重启X服务器. 将标题为{{ic|[X-:*-Core]}}段里下面行前的注释删掉:<br />
<br />
{{hc|/usr/share/config/kdm/kdmrc|2=<br />
TerminateServer=True<br />
}}<br />
<br />
<br />
<br />
当前注销KDE后KDM就会出现。<br />
<br />
=== 直接渲染无效 ===<br />
<br />
{{警告|在安装或升级catalyst后却没重启系统,也有可能出现此种错误,因为系统需要加载fglrx.ko模块来让驱动正常工作。}}<br />
若直接渲染有问题,运行:<br />
<br />
$ LIBGL_DEBUG=verbose glxinfo > /dev/null<br />
<br />
从此命令输出的第一行至末尾都与直接渲染无效有关,且非常详细。<br />
<br />
常见错误提示和解决办法:<br />
<br />
libGL error: XF86DRIQueryDirectRenderingCapable returned false<br />
<br />
* Ensure that you are loading the correct agp modules for your AGP chipset before you load the {{ic|fglrx}} kernel module. To determine which agp modules you will need, run {{ic|# hwdetect --show-agp}}. Then open your {{ic|/etc/modules-load.d/fglrx.conf}} and add the agp module on a line '''before''' the {{ic|fglrx}} line.<br />
* 若使用AGP的芯片组,确保加载fglrx模块之前加载正确的agp模块。要确定哪些agp模块,运行{{ic|hwdetect --show-agp}},然后打开{{ic|/etc/modules-load.d}}下的{{ic|fglrx.conf}},将agp模块添加到fglrx行'''之前'''。<br />
<br />
libGL error: failed to open DRM: Operation not permitted<br />
libGL error: reverting to (slow) indirect rendering<br />
<br />
libGL: OpenDriver: trying /usr/lib/xorg/modules/dri//fglrx_dri.so<br />
libGL error: dlopen /usr/lib/xorg/modules/dri//fglrx_dri.so failed<br />
(/usr/lib/xorg/modules/dri//fglrx_dri.so: cannot open shared object file: No such file or directory)<br />
libGL error: unable to find driver: fglrx_dri.so<br />
<br />
* 某些软件未正确安装。在错误提示中,若路径为{{ic|/usr/X11R6/lib/modules/dri/fglrx_dri.so}},彻底注销,然后重新登录。若使用图形化的登录管理器(gdm, kdm, xdm),确保每次登录时{{ic|/etc/profile}}都会被读取。将{{ic|source /etc/profile}}添加到{{ic|~/.xsession}}或{{ic|~/.xinitrc}}通过都达到以上目的(不同的登录管理器修改的文件不一样)。<br />
<br />
* 若路径为{{ic|/usr/lib/xorg/modules/dri/fglrx_dri.so}},试着重装{{AUR|catalyst}}包。<br />
<br />
若错误信息为:<br />
<br />
fglrx: libGL version undetermined - OpenGL module is using glapi fallback<br />
<br />
可能是因为系统装了多个版本的{{ic|libGL.so}}.下面的命令应该得到这样的回显:<br />
<br />
{{hc|$ locate libGL.s|<br />
<br />
/usr/lib/libGL.so<br />
/usr/lib/libGL.so.1<br />
/usr/lib/libGL.so.1.2}}<br />
<br />
系统应只有3个libGL.so文件,若不止(例如{{ic|/usr/X11R6/lib/libGL.so.1.2}}),则将其删除。<br />
<br />
若使用X11R7且系统中有下列文件,系统并不会给出任何错误提示,一定要将他们删除:<br />
<br />
/usr/X11R6/lib/libGL.so.1.2<br />
/usr/X11R6/lib/libGL.so.1<br />
<br />
=== 休眠问题 ===<br />
<br />
==== 视频播放不能从休眠状态中恢复 ====<br />
<br />
若启动了framebuffer,Catalyst不能从挂机状态中恢复。在[[kernel parameters|内核参数]]中添加 {{ic|1=vga=0}} 可禁用framebuffer。<br />
<br />
其他加载器,参考[[#禁用KMS]]。<br />
<br />
=== 系统冻结或硬件锁死 ===<br />
<br />
* 过去,{{ic|radeonfb}}的framebuffer驱动很容易导致这个问题。若内核编译时启用对radeonfb的支持,应换内核看是否能解决此问题。<br />
<br />
* 若退出桌面环境(关机、挂机和切换到tty等)时系统冻结,很可能忘记禁用KMS。(参见 [[#禁用KMS]])<br />
<br />
=== 硬件冲突 ===<br />
<br />
当和某些版本的nForce3芯片组一起使用时,Radeon不能3D加速。目前虽还未找到具体原因,但有资料表明: indicate that it may be possible to get acceleration with this combination of hardware by booting with the drivers from 先用nVIDIA驱动启动到Windows然后再重启系统就可能获得3D加速。在root控制台使用下列命令可识别此问题(会得到与下列相似(使用基于nForce3系统)的输出:):<br />
<br />
{{hc|<nowiki>$ dmesg | grep agp</nowiki>|<br />
agpgart: Detected AGP bridge 0<br />
agpgart: Setting up Nforce3 AGP.<br />
agpgart: aperture base > 4G<br />
}}<br />
<br />
或者还有下面的命令得到如下的回显:<br />
<br />
{{hc|<nowiki>$ tail -n 100 /var/log/Xorg.0.log | grep agp</nowiki>|<br />
(EE) fglrx(0): [agp] unable to acquire AGP, error "xf86_ENODEV"}}<br />
<br />
则就有问题。<br />
<br />
有些资料说在某些情形下降级主板的BIOS可能有助于解决问题,但注意此方法并不是在各种情况下都适用,而且'''方法不对则很可能让显卡报废。'''<br />
<br />
参考[http://bugzilla.kernel.org/show_bug.cgi?id=6350 这个错误报告]。<br />
<br />
=== 播放视频时系统短时间死机 ===<br />
<br />
使用Catalyst可导致此问题。<br />
<br />
当用mplayer,若不定时出现几秒到几分钟的死机。查看日志,若有与下面相似的信息:<br />
<br />
{{hc|/var/log/messages.log|2=<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium [<f8bc628c>] ? ip_firegl_ioctl+0x1c/0x30 [fglrx]<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium [<c0197038>] ? vfs_ioctl+0x78/0x90<br />
Nov 28 18:31:56 pandemonium [<c01970b7>] ? do_vfs_ioctl+0x67/0x2f0<br />
Nov 28 18:31:56 pandemonium [<c01973a6>] ? sys_ioctl+0x66/0x70<br />
Nov 28 18:31:56 pandemonium [<c0103ef3>] ? sysenter_do_call+0x12/0x33<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium =======================<br />
}}<br />
<br />
给内核参数添加{{ic|nopat}}和/或{{ic|nomodeset}}到[[kernel parameters|内核参数]]应该能行<br />
<br />
=== "aticonfig: No supported adaptaters detected" ===<br />
<br />
若得到:<br />
<br />
{{hc|# aticonfig --initial|<br />
aticonfig: No supported adapters detected<br />
}}<br />
<br />
可以在{{ic|etc/X11/xorg.conf}}中设置device,或者复制以前的能工作的 {{ic|/etc/ati/control}} 文件 (推荐 - 这也能解决水印的问题),这可能让Catalyst正常工作.<br />
<br />
从AMD下载先前版本的fglrx,使用{{ic|--extract driver}}参数运行. 文件将提取到{{ic|driver/common/etc/ati/control}}. 用它覆盖原来的control文件后重启X. 你可以试试不同版本的.<br />
<br />
设置型号的方法:在{{ic|/etc/X11/xorg.conf}}将device段设置为:<br />
<br />
{{hc|/etc/X11/xorg.conf|<br />
Section "Device"<br />
Identifier "ATI radeon '''****'''"<br />
Driver "fglrx"<br />
EndSection<br />
}}<br />
<br />
此处{{ic|****}}为设备型号(6870 for the HD 6870的显卡为6870,APU E-350为6310,通过网络是很容易查到的).<br />
<br />
Xorg启动后很可能使用{{ic|amdcccle}}而不是{{ic|aticonfig}}。这里会有一个"AMD不支持硬件"水印。<br />
<br />
用下面脚本可将此水印删除:<br />
<br />
#!/bin/sh<br />
DRIVER=/usr/lib/xorg/modules/drivers/fglrx_drv.so<br />
for x in $(objdump -d $DRIVER|awk '/call/&&/EnableLogo/{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6}'); do<br />
sed -i "s/$x/\x90\x90\x90\x90\x90/g" $DRIVER<br />
done<br />
<br />
然后重启。<br />
<br />
=== 让chromium支持WebGL ===<br />
<br />
在Google的Chromium/Chrome浏览器里,Linux的Catalyst驱动被列入了黑名单。参见 [[Chromium#WebGL]] .<br />
<br />
=== 用Adobe的flashplugin观看flash,画面迟滞或冻结 ===<br />
<br />
编辑:<br />
<br />
{{hc|/etc/adobe/mms.cfg|2=<br />
#EnableLinuxHWVideoDecode=1<br />
OverrideGPUValidation=true<br />
}}<br />
<br />
如果你使用KDE,请确保 系统设置->工作空间外观与行为->桌面效果->高级 里,"为全屏窗口挂起桌面特效" 没有勾选.<br />
<br />
=== GNOME3中移动窗口延迟/很慢 ===<br />
你可以试试这么做,有报告称大多数情况下此方法有效。<br />
<br />
将下面行添加到{{ic|~/.profile}}或{{ic|/etc/profile}}:<br />
<br />
export CLUTTER_VBLANK=none<br />
<br />
重启X或操作系统。<br />
<br />
=== 在1920x1080分辨率下不能全屏(欠扫描,屏幕周围有黑边) ===<br />
<br />
这经常会在使用HDMI连接显示器/电视时发生.<br />
<br />
这似乎是AMD/ATI为适应所有HDTV的一项新功能,可以在amdccle中调整.<br />
<br />
使用amdcccle(图形界面)你可以选择要修改的显示输出,将欠扫描设置成0% (aticonfig默认15%欠扫描). (至少)版本14.10有时也会出现显示调整的下面没有欠扫描的滑块的情况.(It is possible as well that the underscan slider won't show under the display's adjustments, as sometimes in (at least) version 14.10.)<br />
<br />
这不是永久的配置,重启X,重启系统,挂起后唤醒甚至切换tty之后都会失效.<br />
<br />
要使这成为永久配置的话,你需要以root身份在console下使用aticonfig来调整欠扫描设置,或者手动编辑 {{ic|/etc/ati/amdpcsdb}} (也是以root身份)<br />
<br />
'''用aticonfig的方法:'''<br />
<br />
# aticonfig --set-pcs-u32=MCIL,DigitalHDTVDefaultUnderscan,0<br />
<br />
改变设置后重启.<br />
<br />
新版本的话(比如12.11), 要是ccc总不能保存过扫描设置,你可以试试:<br />
<br />
# aticonfig --set-pcs-u32=MCIL,TVEnableOverscan,0<br />
<br />
'''手动编辑/etc/ati/amdpcsdb的方法:'''<br />
<br />
在 {{ic|[AMDPCSROOT/SYSTEM/MCIL]}} 之下的任意位置添加<br />
<br />
# DigitalHDTVDefaultUnderscan=V0<br />
<br />
新版本的话(比如12.11), 要是ccc总不能保存过扫描设置,你可以试试:<br />
在 {{ic|[AMDPCSROOT/SYSTEM/MCIL]}} 之下找到这一行<br />
<br />
# TVEnableOverscan=V1<br />
<br />
然后把它变成<br />
<br />
# TVEnableOverscan=V0<br />
<br />
改变设置后重启.<br />
<br />
{{note|也许你会发现,无论你怎么干,登录/注销/重启后, {{ic|/etc/ati/amdpcsdb}} 总是被覆写/还原, 于是你的修改就不见了 _(:з」∠)_.(You might find that the file /etc/ati/amdpcsdb will be overwritten and revert no matter what you do as user or as root even with log in/log out/reboot, ergo the modification will not stick.)<br />
所以你得在fglrx没运行的时候改它.<br />
可以试着重启进入什么不需要运行fglrx的"安全模式"什么的,或者是直接进console模式}}<br />
<br />
'''应对措施:'''<br />
要是因某些原因你不想动ATI的配置文件,你可以设置面板的位置与分辨率来规避问题<br />
以普通用户运行:<br />
<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,positionX:0<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,positionY:0<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,sizeX:1920<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,sizeY:1080<br />
<br />
{{ic|DISPLAYTYPE}}代表你想改的显示器,比如"dfp9".<br />
用如下命令获得你的 {{ic|DISPLAYTYPE}} :<br />
<br />
# xrandr --current<br />
<br />
如果没启用RandR的话,你可以用这个:<br />
<br />
# aticonfig --query-monitor<br />
<br />
也许需要用显示开关或 DISPLAY 变量来设置适当的显示/屏幕(比如 :0.1).<br />
<br />
这将告诉你目前哪一个显示正连接着或断开着,以及它的详情<br />
<br />
这个应对措施不是永久配置,不过是个让面板及上边内容看起来合适的方便快捷的方法<br />
<br />
{{note|新版驱动不应再使用{{ic|<nowiki>aticonfig --set-pcs-val=MCIL,DigitalHDTVDefaultUnderscan,0</nowiki>}}, ATI声明过这已被弃用并即将被移除.}}<br />
<br />
用 {{ic|<nowiki>aticonfig --help | grep set-pcs-val</nowiki>}} 来阅读ATI的说明.<br />
<br />
=== 双屏设置: 关于加速,OpenGL,合成,效能的一般问题 ===<br />
试着禁用 xinerama 和 xrandr12. 如下:<br />
<br />
输入:<br />
# aticonfig --initial<br />
# aticonfig --set-pcs-str="DDX,EnableRandR12,FALSE"<br />
然后重启系统. 在 {{ic|/etc/X11/xorg.conf}} 中检查 xinerama 是不是被禁用了, 如果没有,禁用它,然后重启系统.( In /etc/X11/xorg.conf check that xinerama is disabled, if it's not disable it and reboot your system. )<br />
<br />
接下来运行{{ic|amdcccle}},如下: amdcccle→显示管理→多屏幕显示→以display(s) 2多屏显示桌面(amdcccle->display manager->multi-display->multidisplay desktop with display(s) 2. ).<br />
<br />
再次重启,再按你的想法设置显示.<br />
<br />
=== 禁用VariBright功能 ===<br />
[http://support.hp.com/vn-en/document/c02848104 Vari-Bright] 动态调整显示面板用电量以节能.<br />
输入以下命令以禁用 VariBright:<br />
# aticonfig --set-pcs-u32=MCIL,PP_UserVariBrightEnable,0<br />
<br />
=== Hybrid/PowerXpress: 关掉独立GPU ===<br />
当你使用 {{AUR|catalyst-total-pxp}} 或 catalyst-utils-pxp 时,你也许会发现切换到集成GPU时,独立GPU仍在工作,又耗电又使得系统温度很高. <br />
<br />
对于集显是intel的话你可以通过 {{ic|vgaswitcheroo}} 来关掉独立GPU.<br />
不过很不幸有些时候不行...<br />
<br />
然后这时你可以试试 {{Pkg|acpi_call}}. MrDeepPurple准备好了脚本来完成这个任务.脚本在启动和恢复系统的时候通过systemd服务调用.<br />
这是他的脚本:<br />
#!/bin/sh<br />
libglx=$(/usr/lib/fglrx/switchlibglx query)<br />
modprobe acpi_call<br />
if [ "$libglx" = "intel" ]; then<br />
echo '\_SB.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call<br />
fi<br />
<br />
=== 从X会话切换到TTY黑屏/低分辨率TTY ===<br />
接受这个"功能"吧,这出现在catalys 13.2 beta,解决方法是使用{{ic|1=vga=}}内核选项,比如{{ic|1=vga=792}}。<br />
使用<br />
$ hwinfo --framebuffer<br />
来得到支持的分辨率列表<br />
选择最适合你的分辨率,粘贴到启动引导器的内核行,比如 {{ic|1=vga=0x03d4}}<br />
<br />
=== 从X会话切换到TTY黑屏,背光并没有关闭 ===<br />
使用 [[uvesafb]] 作为 framebuffer 驱动. 而且, {{ic|uvesafb}} 可以为 TTY 设置任意分辨率.<br />
<br />
=== 切换TTY后切换回X会话时,只有一个带鼠标的黑屏 ===<br />
如果你遇到了这个bug的话,试着添加<br />
Option "XAANoOffscreenPixmaps" "true"<br />
到你的 xorg.conf 的 'Device' 部分.<br />
<br />
同时, 确认已安装有 [[Polkit#Authentication agents|polkit 认证代理]] 并正在运行, 因为这种情况可能会在某程序想要请求密码但没有认证代理来显示密码对话框时出现.<br />
<br />
=== 30 FPS / Tear-Free / V-Sync bug ===<br />
这个Bug发生于Catalyst 13.6 beta, 到现在(13.9)还没修复.<br />
<br />
激活 "Tear Free"(防撕裂) 功能之后,所有新启动的OpenGL程序都出现延迟,常表现为只有30 FPS,复合桌面环境也是.("After enabling "Tear Free" functionality every freshly started OpenGL application is lagging, often generates only 30 FPS, it also touches composited desktop.")<br />
<br />
M132找到一个解决方法.在 "AMD Catalyst Control Center" (amdcccle) 里完成这些操作:<br />
<br />
1. 开启 Tear-Free, 这将设置 3D V-Sync 为"总是开启".<br />
2. 设置 3D V-Sync 为"总是关闭".<br />
3. 确认 Tear-Free 仍为"开启".<br />
4. 重启X/重登录.<br />
<br />
这在KDE 4.11.x下有效.M132的建议: "试着关闭 "Detect refresh rate" ,并为复合插件("Composite plugin")指定显示器刷新率."<br />
<br />
=== 背光调节不起效 ===<br />
如果你的背光调节有问题, 你可以试试:<br />
# aticonfig --set-pcs-u32=MCIL,PP_PhmUseDummyBackEnd,1<br />
一些用户报告说这导致FPS降低.要恢复默认的话:<br />
# aticonfig --set-pcs-u32=MCIL,PP_PhmUseDummyBackEnd,0<br />
[http://ati.cchtml.com/show_bug.cgi?id=711 更多信息见此]<br />
<br />
=== 使用 plasma 时 Chromium 出现毛刺(glitching) ===<br />
添加 --disable-gpu 参数来启动 chromium, 比如,对 /usr/share/applications/chromium.desktop, 改成这样:<br />
# cat /usr/share/applications/chromium.desktop | grep -i exec<br />
Exec=chromium %U --disable-gpu<br />
<br />
== 参见 ==<br />
<br />
* [http://wiki.cchtml.com/index.php/Main_Page Unofficial Wiki for the ATI Linux Driver]<br />
* [http://ati.cchtml.com/query.cgi Unofficial ATI Linux Driver Bugzilla]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=AMD_Catalyst_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=408908
AMD Catalyst (简体中文)
2015-11-11T13:39:45Z
<p>Aaron chen: /* xorg116 */</p>
<hr />
<div>[[Category:Graphics (简体中文)]]<br />
[[Category:X server (简体中文)]]<br />
[[en:AMD Catalyst]]<br />
[[es:AMD Catalyst]]<br />
[[fr:ATI#Catalyst]]<br />
[[it:AMD Catalyst]]<br />
[[ja:AMD Catalyst]]<br />
[[ru:AMD Catalyst]]<br />
{{TranslationStatus (简体中文)|AMD_Catalyst|2015-11-05|406475}}<br />
{{Related articles start (简体中文)}}<br />
{{Related|ATI (简体中文)}}<br />
{{Related|Xorg (简体中文)}}<br />
{{Related articles end}}<br />
AMD的显卡驱动有两种:一是官方私有驱动(catalyst,译为催化剂),二是开源驱动(xf86-video-ati).本文主要介绍私有驱动。<br />
<br />
AMD曾经将“catalyst”驱动命名为“fglrx” ('''F'''ire'''GL''' and '''R'''adeon '''X'''). 现在虽然名为“catalyst”,但内核模块名称依然为“fglrx.ko”. 因此,下文中任何提及fglrx 都是指“内核模块”,而不是指软件包.<br />
<br />
'''官方仓库不再提供Catalyst。''' Catalyst [https://www.archlinux.org/news/ati-catalyst-support-dropped/ 曾被移出Arch官方支持],原因是对质量与开发速度的不满。该项目于2013年4月被再次丢弃,截止现在还没有进一步的消息.<br />
<br />
与开源驱动相比, Catalyst 在2D,3D渲染和电源管理上更胜一筹,但缺乏高效的多显支持.支持设备为 [[wikipedia:Radeon|ATI/AMD Radeon]]显卡,芯片组 R600 及以上(Radeon HD 2xxx或者更新). ''model''名称 (如X1900, HD4850) 与 ''chip''名称 (分别是R580, RV770)间的对照请参见Xorg [http://www.x.org/wiki/RadeonFeature/#index5h2 decoder ring]或者[[wikipedia:Comparison of AMD graphics processing units|这个表格]].<br />
<br />
== 安装 ==<br />
<br />
共有三种途径安装Catalyst。第一种是用[https://aur.archlinux.org/account/Vi0l0/ Vi0L0](Arch非官方Catalyst维护人员)维护的软件库.此库包涵了所有可用的软件包.第二种方式就是通过AUR,Vi0L0提供的PKGBUILDs跟他用于构建他仓库的PKGBUILDs完全一样。最后你还可以直接通过AMD官方下载Catalyst.<br />
<br />
自Catalyst 12.4, AMD已将针对Radeon HD 5xxx 和 Radeon HD 2xxx, 3xxx and 4xxx 显卡驱动分开开发,因此在你选择何种安装方式之前,应查看你的显卡型号。Radeon HD 2xxx, 3xxx and 4xxx 显卡用 '''legacy'''驱动,Radeon HD 5xxx(以及更新的)用普通Catalyst。但无论你需要哪种驱动,都应安装Catalyst utilities。<br />
<br />
{{注意|你会发现,每种安装方式都会进行的一个相同的操作,无论你采用哪种安装方式,你都应了解一些通用的安装说明。}}<br />
<br />
=== 安装Catalyst ===<br />
<br />
==== 从非官方软件库 ====<br />
<br />
如果你不喜欢通过[[AUR]]来安装,则使用此方法。此软件库由我们的[[User:Vi0L0|Vi0l0]]维护。所有的包都经过签名,所以安全方面无需担心。下文提及的很多其他与AMD显卡有关的包也是由Vi0L0维护。<br />
<br />
Vi0L0有三个不同的Catalyst软件库:<br />
* [[Unofficial user repositories#catalyst|catalyst]]:Radeon HD 5xxx及更新的显卡使用的普通Catalyst驱动。包含了最新的 (稳定版或者beta版) Catalyst.<br />
* ''catalyst-stable'':Radeon HD 5xxx及更新的显卡使用的普通Catalyst驱动。包含了最新的稳定版 Catalyst.<br />
* [[Unofficial user repositories#catalyst-hd234k|catalyst-hd234k]]:Radeon HD 2xxx, 3xxx and 4xxx显卡使用的legacy Catalyst驱动.<br />
<br />
要启用上述软件库的话,参见[[Unofficial user repositories]]中所述方法. 记得在{{ic|pacman.conf}}中的'''其他软件库之前'''添加相应软件库.<br />
{{注意|''catalyst''和''catalyst-stable''软件库的URL相同.若要启用''catalyst-stable'',步骤与启用''catalyst''相同,并在{{ic|pacman.conf}}中将{{ic|[catalyst]}}替换成{{ic|[catalyst-stable]}}.如果你需要某个旧版本,这儿也有并且URL也相同,比如''catalyst-stable-13.4''.}}<br />
{{警告|<br />
* legacy Catalyst不支持Xorg Server 1.17. 要使用此驱动的话,参见 [[#Xorg repositories]] 来回滚到 Xorg Server 1.16.<br />
}}<br />
<br />
{{小贴士|有时 catalyst.wirephire.com 因为超出带宽上限而不能提供下载(曾发生过这个问题),或者你到这个服务器的连接很慢.这时,你可以尝试另外的镜像服务器: [http://mirror.rts-informatique.fr/archlinux-catalyst/] (rtsinformatique 提供,法国) 和 [http://mirror.hactar.bz/Vi0L0/] (goll 提供,德国). 不过,这些服务器不保证随时可用.需要的话就反注释掉,多准备一个替代品以防镜像临时不可用也是好习惯.<br />
<br />
Repository mirroring can be easily achieved using {{ic|rsync://mirror.rts-informatique.fr::archlinux-catalyst}}.<br />
}}<br />
<br />
完成后更新pacman数据库并[[pacman|安装]]这些软件包(更多信息参见[[#工具]]):<br />
<br />
* ''catalyst-hook''<br />
* ''catalyst-utils''<br />
* ''catalyst-libgl''<br />
* ''opencl-catalyst'' - 可选,OpenCL支持<br />
* ''lib32-catalyst-utils'' - 可选,64-bit系统上32-bit的OpenGL支持<br />
* ''lib32-catalyst-libgl'' - 可选,64-bit系统上32-bit的OpenGL支持<br />
* ''lib32-opencl-catalyst'' - 可选,64-bit系统上32-bit的OpenCL支持<br />
<br />
如果你是一台Intel/AMD双显卡笔记本,参考下这个:<br />
<br />
* ''catalyst-hook''<br />
* ''catalyst-utils-pxp''<br />
* ''lib32-catalyst-utils-pxp'' - 可选,64-bit系统上32-bit的OpenGL支持<br />
<br />
{{注意|如果pacman询问是否移除'''libgl''',尽管回答"是".}}<br />
<br />
{{警告|软件包catalyst已从Vi0L0的仓库移除,catalyst-hook取而代之.}}<br />
<br />
==== 通过AUR安装 ====<br />
<br />
还可以通过[[AUR]]安装。如果你需为你的电脑进行定制安装,则用此方法。此方法极为繁琐,因为它需要的工作量最大,而且每次内核更新后你得手动更新Catalyst。<br />
<br />
{{警告|若通过AUR安装 Catalyst, 每次内核更新你都得重新编译Catalyst,否则X将不能启动。}}<br />
<br />
在 Vi0L0's 软件库中提到的一切软件包[[AUR]]中也可用::<br />
* {{AUR|Catalyst}}<br />
* {{AUR|Catalyst-generator}}<br />
* {{AUR|Catalyst-hook}}<br />
* {{AUR|Catalyst-utils}}<br />
* {{AUR|Lib32-catalyst-utils}}<br />
<br />
AUR还提供些独家软件包。它含有被称为 ''Catalyst-total''的包和一些beta阶段的软件:<br />
* {{AUR|Catalyst-total}}<br />
* {{AUR|Catalyst-total-pxp}}<br />
* {{AUR|Catalyst-total-hd234k}}<br />
* {{AUR|Catalyst-test}}<br />
<br />
{{AUR|catalyst-total}}包能让AUR用户更为方便。它能构建驱动、内核工具、32位内核工具和{{AUR|catalyst-hook}}(参见[[#工具]]).<br />
<br />
{{AUR|catalyst-total-pxp}}让Catalyst对powerXpress提供实验性支持。<br />
<br />
=== 配置驱动 ===<br />
安装完毕后,要配置 X,让其使用Catalyst。要确保fglrx模块在启动阶段加载,而且要禁用[[kernel mode setting]].<br />
<br />
==== 配置X ====<br />
你需要创建 {{ic|xorg.conf}} 文件来配置X. Catalyst提供了{{ic|aticonfig}}工具来创建和(或)修改此文件。<br />
通过访问{{ic|/etc/ati/amdpcsdb}}文件它几乎能配置显卡的各项参数。了解完整的配置选项{{ic|aticonfig}}可运行:<br />
<br />
# aticonfig --help | less<br />
<br />
{{警告|在将各项配置参数提交到{{ic|/etc/X11/xorg.conf}}之前使用{{ic|--output}}选项,{{ic|/etc/X11/xorg.conf.d}}中的所有内容都会被覆盖。(Use the {{ic|--output}} option before committing to {{ic|/etc/X11/}} as an {{ic|xorg.conf}} file will override anything in {{ic|/etc/X11/xorg.conf.d/}})}}<br />
<br />
{{注意|如果坚持使用{{ic|xorg.conf.d}}下的新配置文件:为了让{{ic|Device}}部分与{{ic|/etc/X11/xorg.conf.d/20-radeon.conf}}相匹配,则使用{{ic|# aticonfig [...] --output}}.但这有一个缺点,很多依赖xorg.conf的{{ic|aticonfig}}选项都无法使用。}}<br />
<br />
现在来配置 Catalyst. 若只有一个显示器,运行:<br />
<br />
# aticonfig --initial<br />
<br />
{{注意| 如果对PowerXpress有疑问,安装 {{AUR|catalyst-total-pxp}}.}}<br />
<br />
注意,若你使用双显示器则使用下面的命令。 此命令会成两个配置文件,第二个显示器的配置文件在第一个前面<br />
<br />
# aticonfig --initial=dual-head --screen-layout=above<br />
<br />
{{注意|了解与设置双显有关的更多信息可查看[[#双屏显示]]}}<br />
<br />
你可与[[Xorg#Sample configurations|Sample Xorg.conf]]上的任何一个示例文件进行对照。<br />
<br />
虽然目前的版本的Xorg启动时能自动探测大多数选项,但不同Xorg版本的默认参数可能会有所不同,最好明确指定一些参数.<br />
<br />
给一个示例配置 (注意) '''仅供参考'''. 标{{ic|#}}必须有,标{{ic|##}}很可能会用到:<br />
<br />
{{hc|/etc/X11/xorg.conf|2=<br />
Section "ServerLayout"<br />
Identifier "Arch"<br />
Screen 0 "Screen0" 0 0 # 0's are necessary.<br />
EndSection<br />
Section "Module"<br />
Load [...]<br />
[...]<br />
EndSection<br />
Section "Monitor"<br />
Identifier "Monitor0"<br />
...<br />
EndSection<br />
Section "Device"<br />
Identifier "Card0"<br />
Driver "fglrx" # Essential.<br />
BusID "PCI:1:0:0" # Recommended if autodetect fails.<br />
Option "OpenGLOverlay" "0" ##<br />
Option "XAANoOffscreenPixmaps" "false" ##<br />
EndSection<br />
Section "Screen"<br />
Identifier "Screen0"<br />
Device "Card0"<br />
Monitor "Monitor0"<br />
DefaultDepth 24<br />
SubSection "Display"<br />
Viewport 0 0<br />
Depth 24 # Should not change from '24'<br />
Modes "1280x1024" "2048x1536" ## 1st value=default resolution, 2nd=maximum.<br />
Virtual 1664 1200 ## (x+64, y) to workaround potential OGL rect. artifacts/<br />
EndSubSection ## fixed in Catalyst 9.8<br />
EndSection<br />
Section "DRI"<br />
Mode 0666 # May help enable direct rendering.<br />
EndSection<br />
}}<br />
<br />
{{注意|一旦升级Catalyst就要通过后面的方法删除{{ic|amdpcsdb}}文件: 关闭X,删除{{ic|/etc/ati/amdpcsdb}},启动X然后运行{{ic|amdcccle}} -否则{{ic|amdcccle}}将会显示错误的Catalyst版本号}}<br />
<br />
''更多信息参考[https://bbs.archlinux.org/viewtopic.php?id=57084 这里].''<br />
<br />
==== 启动时加载模块 ====<br />
禁用{{ic|radeon}}以防其自动加载. 在{{ic|/etc/modprobe.d/modprobe.conf}}里禁用''radeon'',同时保证它不被{{ic|/etc/modules-load.d/}}里的文件加载. 详见[[kernel modules#Blacklisting]]. <br />
<br />
接下来,使模块{{ic|fglrx}}自动加载. 添加{{ic|fglrx}}到{{ic|/etc/modules-load.d/}}下已有的模块文件的新一行,或者创建一个新的模块文件并添加{{ic|fglrx}}.<br />
<br />
==== 禁用KMS ====<br />
<br />
{{注意|使用{{ic|catalyst-utils-pxp}}或者{{ic|catalyst-total-pxp}}的用户不要这样做,因为intel驱动需要KMS.}}<br />
<br />
禁用KMS很重要.由于Catalyst根本不使用[[KMS]],得将其禁用。否则,当系统切换至TTY或在桌面环境下关机时,系统可能会冻结。<br />
<br />
添加 {{ic|nomodeset}} 到你的 [[kernel parameters|内核参数]]. <br />
<br />
==== 检查安装是否成功 ====<br />
<br />
重启电脑并登录, 运行下列命令可查看{{ic|fglrx}}是否正确运行:<br />
<br />
$ lsmod | grep fglrx<br />
<br />
若有输出, 则证明安装成功。可以尝试用 {{ic|$ startx}} 或者显示管理器来启动X (参见 [[Xorg#Running]]).<br />
<br />
下面的命令可以输出你的显卡型号信息:<br />
<br />
$ fglrxinfo<br />
<br />
运行以下命令检查直接渲染模式是否启用:<br />
<br />
$ glxinfo | grep direct<br />
<br />
若显示{{ic|"direct rendering: yes"}},恭喜你,到位了! 若无{{ic|$ glxinfo}}命令,安装{{Pkg|mesa-demos}} package。<br />
<br />
{{注意|对于{{ic|glxgears}},你也可以使用:<br />
$ fgl_glxgears<br />
来测试fglrx.<br />
}}<br />
<br />
{{警告|最近几版Xorg,库函数路径变了,因此即使安装{{ic|libGL.so}}也不一定能正确人加载。请检查GL是否工作,可阅读"故障排除"段落}}<br />
<br />
=== 自己编译内核 ===<br />
<br />
在手动编译的内核上,你必须构建你自己的{{ic|catalyst-$kernel}}包.<br />
<br />
{{注意|如果你讨厌打包或毫无经验,可先阅读[[ABS]]。}}<br />
<br />
#从[[AUR|Catalyst]]上获取{{ic|PKGBUILD}} 和 {{ic|catalyst.install}}文件。<br />
# 编辑PKGBUILD. 两个地方需要修改:<br />
## 将{{ic|1=pkgname=catalyst}} 修改为 {{ic|1=pkgname=catalyst-$kernel_name}},{{ic|$kernel_name}}可以随意取(如:custom, mm)。<br />
## 将{{ic|linux}}的依赖修改为{{ic|$kernel_name}}。<br />
# 构建并安装软件包;运行{{ic|makepkg -i}} 和 {{ic|makepkg}},接着运行 {{ic|# pacman -U pkgname.pkg.tar.gz}}<br />
<br />
{{注意|<br />
*如果在安装有多内核的系统上,你必须为所有内核安装 {{AUR|catalyst-utils}} 包。这不会引起冲突.<br />
<br />
*{{AUR|catalyst-generator}}能为你自动构建{{ic|<nowiki>catalyst-{kernver}</nowiki>}},因此这些步骤根本就可省略。 请参考[[#工具|工具 部分]].}}<br />
<br />
=== PowerXpress support ===<br />
<br />
PowerXpress technology 允许支持dual-graphic功能(以前叫做AMD Hybrid CrossFire technology)的笔记本电脑从集成显卡(IGP) 切换到独立显卡,以增加电池寿命或者实现更好的3D渲染效能。<br />
<br />
为了在archlinux上用上这个功能,你j将需要:<br />
* 从 [[AUR]] 获取并编译 {{AUR|catalyst-total-pxp}} 这个软件包,或者<br />
* 从 [catalyst] 软件仓库安装 '''catalyst-utils-pxp''' 软件包 (如果需要,还有 lib32-catalyst-utils-pxp)。<br />
<br />
对于intel集成显卡的切换,你还需要安装 {{pkg|mesa-libgl}} 软件包和intel的驱动:{{pkg|xf86-video-intel}} 。<br />
{{注意|'''对最新的13.1版本的Catalyst(不是Catalyst legacy) ChrisXY 能够兼容最新的 {{pkg|xorg-server}} (版本 1.13.1), {{Pkg|mesa}} 9.0.1 和 {{pkg|xf86-video-intel}} 2.20.18'''.<br />
<br />
对于所有版本低于13.1的Catalyst(和任何版本的Catalyst legacy),和新的intel驱动存在一些兼容问题。'''最近的{{pkg|xf86-video-intel}}开发版本是2.20.2-2''',所以你可能必须从Arch软件仓库中的最新版本降级(尽管我们推荐你试验性地使用最新的驱动,因为有可能它在你这里没有问题)<br />
<br />
{{pkg|xf86-video-intel}} 2.20.2-2 只兼容 xorg-server 1.12 并且特它是 '''xorg112 repository'''的一部分. 如果你想使用它,你必须降级xorg-server。具体信息见 [[#Xorg repositories]].}}<br />
<br />
现在你可以用下面这些命令切换集成显卡和独立显卡:<br />
<br />
{{bc|1=<br />
# aticonfig --px-igpu #for integrated GPU<br />
# aticonfig --px-dgpu #for discrete GPU<br />
}}<br />
<br />
Just remember that fglrx needs {{ic|/etc/X11/xorg.conf}} configured for AMD's card with {{ic|fglrx}} inside.<br />
要记着对含有 {{ic|fglrx}} 模块的AMD显卡,fglrx需要 {{ic|/etc/X11/xorg.conf}} 这个文件<br />
<br />
你也可以用{{ic|pxp_switch_catalyst}} 这个切换脚本完成一些其他有用的操作:<br />
* Switching {{ic|xorg.conf}} - it will rename {{ic|xorg.conf}} into {{ic|xorg.conf.cat}} (if there is fglrx inside) or {{ic|xorg.conf.oth}} (if there is intel inside) and then it will create a symlink to {{ic|xorg.conf}}, depending on what you chose.<br />
* Running {{ic|aticonfig --px-Xgpu}}.<br />
* Running {{ic|switchlibGL}}.<br />
* Adding/removing {{ic|fglrx}} into/from {{ic|/etc/modules-load.d/catalyst.conf}}.<br />
<br />
Usage:<br />
{{bc|1=<br />
# pxp_switch_catalyst amd<br />
# pxp_switch_catalyst intel<br />
}}<br />
<br />
如果你试图在装有intel驱动的设备上运行X图形界面时遇到问题,你可以尝试强制开启"UXA" acceleration: 在{{ic|xorg.conf}}中写{{ic|Option "AccelMethod" "uxa"}},就象这样:<br />
{{hc|/etc/X11/xorg.conf|2=<br />
Section "Device"<br />
Identifier "Intel Graphics"<br />
Driver "intel"<br />
#Option "AccelMethod" "sna"<br />
'''Option "AccelMethod" "uxa"'''<br />
#Option "AccelMethod" "xaa"<br />
EndSection<br />
}}<br />
<br />
==== 同时运行两个X server(一个使用Intel驱动, 一个使用 fglrx) ====<br />
<br />
因为fglrx容易崩溃(考虑到PowerXpress),主要X server使用Intel驱动,另一个使用需要3D加速的fglrx驱动是个不错的选择。但是在开启第二个X server的时候,简单地从集成显卡 {{ic|aticonfig}} 或者 {{ic|amdcccle}}切换到独立显卡将引发一系列不正常的bugs。<br />
<br />
为了同时运行两个X server(每个用不同的驱动),你首先需要设置出一个可以和Catalyst一起正常工作的X图形环境,然后把它的 {{ic|xorg.conf}}移动到一个临时的地方(比如{{ic|/etc/X11/xorg.conf.fglrx}})。下次X图形环境启动时,它将默认使用intel驱动来代替fglrx。<br />
<br />
在开启第二个使用fglrx的X server,只需要在运行X之前,把{{ic|xorg.conf}} 移回合适的地方({{ic|/etc/X11/xorg.conf}})。这个方法甚至允许你在两个运行的X sessions之间来回切换。当你不需要使用fglrx时,再把 {{ic|xorg.conf}} 移动到其他地方。<br />
<br />
这种方法唯一的坏处是不能使用intel驱动的3D加速。但它的2D却能完全发挥作用。除此之外,它还能给我们一个非常稳定的桌面环境。<br />
<br />
==== 多显示器的PowerXpress笔记本运行于AMD模式时(pxp_switch_catalyst amd)的问题 ====<br />
当PowerXpress笔记本工作于AMD-only模式时(比如设置全部渲染工作交给独显),你有可能会遇到显示器伪影/重复的情况.这是一个已知的问题,发生于7xxxM系列显卡.<br />
<br />
当旋转或者缩放一个显示器时现象会消失,所以你可以使用xrandr来解决这个问题:<br />
<br />
{{bc|1=<br />
xrandr --output HDMI1 --left-of LVDS1 --primary --scale 1x1 --output LVDS1 --scale 1.0001x1.0001<br />
}}<br />
<br />
== Xorg软件库 ==<br />
Catalyst由于其缓慢的更新而被人大为诟病。因升级Xorg而造成两者不兼容是稀松平常的事。也就意味着Catalyst用户要么自己编译Xorg的包要么使用一个只包含Xorg包的回溯软件库,该库中不提供更新版Xorg以确保兼容性。 Vi0L0提供好几个这样的库. <br />
<br />
要启用上述软件库的话,参见[[Unofficial user repositories]]中所述方法. 记得在{{ic|pacman.conf}}中的'''其他软件库之前(甚至在你的catalyst仓库前,如果你有的话)'''添加相应软件库(使用和[[Unofficial user repositories#catalyst|catalyst]]库相同的PGP密匙).<br />
<br />
=== xorg117 ===<br />
Catalyst does not support xorg-server 1.18<br />
{{bc|<nowiki><br />
[xorg117]<br />
Server = http://catalyst.wirephire.com/repo/xorg117/$arch<br />
## Mirrors, if the primary server does not work or is too slow:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg117/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg117/$arch<br />
</nowiki>}}<br />
<br />
=== xorg116 ===<br />
Catalyst < 15.7 不支持 xorg-server 1.17<br />
{{bc|<nowiki><br />
[xorg116]<br />
Server = http://catalyst.wirephire.com/repo/xorg116/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg116/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg116/$arch<br />
</nowiki>}}<br />
<br />
=== xorg115 ===<br />
Catalyst < 14.9 不支持 xorg-server 1.16<br />
<br />
{{bc|<nowiki><br />
[xorg115]<br />
Server = http://catalyst.wirephire.com/repo/xorg115/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg115/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg115/$arch<br />
</nowiki>}}<br />
<br />
=== xorg114 ===<br />
Catalyst < 14.1 不支持 xorg-server 1.15.<br />
<br />
{{bc|<nowiki><br />
[xorg114]<br />
Server = http://catalyst.wirephire.com/repo/xorg114/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg114/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg114/$arch<br />
</nowiki>}}<br />
<br />
=== xorg113 ===<br />
Catalyst < 13.6 不支持 xorg-server 1.14.<br />
<br />
{{bc|<nowiki><br />
[xorg113]<br />
Server = http://catalyst.wirephire.com/repo/xorg113/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg113/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg113/$arch<br />
</nowiki>}}<br />
<br />
=== xorg112 ===<br />
Catalyst < 12.10 和 Catalyst Legacy 不支持 xorg-server 1.13.<br />
<br />
{{bc|<nowiki><br />
[xorg112]<br />
Server = http://catalyst.wirephire.com/repo/xorg112/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg112/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg112/$arch<br />
</nowiki>}}<br />
<br />
== 工具 ==<br />
<br />
=== Catalyst-hook ===<br />
{{AUR|Catalyst-hook}} 是一个 [[systemd]] 服务,它在系统关机或重启后重新构建{{ic|fglrx}}模块(如果需要的话,比如内核升级后).<br />
<br />
使用之前请保证 {{Grp|base-devel}} 组和 {{Pkg|linux-headers}} 包(对应你的内核)已经安装.<br />
<br />
只需激活{{ic|catalyst-hook.service}}服务即可:<br />
<br />
# systemctl enable catalyst-hook<br />
# systemctl start catalyst-hook<br />
<br />
你也可以用这个软件包来手动构建{{ic|fglrx}}模块. 在内核更新后运行 {{ic|catalyst_build_module}} 脚本即可:<br />
<br />
# catalyst_build_module all<br />
<br />
'''一些技术细节:'''<br />
<br />
The {{ic|catalyst-hook.service}} is stopping the systemd "river" and is forcing systemd to wait until catalyst-hook finishes its job.<br />
<br />
{{ic|catalyst-hook.service}} 调用 {{ic|catalyst_build_module check}} 来检查是否有必要重构建fglrx.<br />
<br />
{{ic|check}} 检查{{ic|fglrx}}模块是否存在:<br />
<br />
*不存在,将构建它;<br />
<br />
*存在,它将比较两个参数来确定是否有必要重构建{{ic|fglrx}}.<br />
<br />
这里的参数是 {{ic|/usr/lib/modules/<kernel_version>/build/Module.symvers}} 的md5值. (因为我(这里指Vi0L0)发现每一个版本的这个文件都不一样). 第一个参数是现有的 {{ic|Module.symvers}} 文件md5.第二个参数是{{ic|fglrx}}模块构建时 {{ic|Module.symvers}} 文件的md5. 这个参数被{{ic|catalyst_build_module}}脚本编译到{{ic|fglrx}}模块.<br />
<br />
如果参数不同,将编译新的{{ic|fglrx}}模块.<br />
<br />
check 检查整个 {{ic|/usr/lib/modules/}} 目录 ,为安装的所有内核编译fglrx模块(如果需要的话). 如果没有必要构建或重构建,进程将很快结束.<br />
<br />
=== Catalyst-generator ===<br />
<br />
{{AUR|catalyst-generator}}包能构建并安装{{ic|fglrx}}模块,该模块与pacman兼容的{{ic|<nowiki>catalyst-${kernver}</nowiki>}}相适应。与[[#Catalyst-hook]]的区别是必须手动使用此命令,而Catalyst-hook则不需。<br />
<br />
通过[[makepkg]],它能构建{{ic|<nowiki>catalyst-${kernver}</nowiki>}}二进制包并用[[pacman]]安装。{{ic|<nowiki>${kernver}</nowiki>}} 是软件包的目标内核版本 (例如 catalyst-2.6.35-ARCH 适用于 2.6.35-ARCH 内核).<br />
<br />
非特权用户使用{{ic|catalyst_build_module}}来构建并安装{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包。安装时会提示输入root密码。<br />
<br />
简单说一下如何使用此包:<br />
<br />
# root用户: 使用{{ic|catalyst_build_module remove}}。此举会删除无用的{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包。<br />
# 非特权用户: 使用{{ic|<nowiki>catalyst_build_module ${kernver}</nowiki>}}, {{ic|<nowiki>${kernver}</nowiki>}}是指升级过后的内核版本。也可通过{{ic|catalyst_build_module all}}为所有安装的内核构建{{ic|<nowiki>catalyst-{kernver}</nowiki>}}。<br />
# 若要删除{{ic|catalyst-generator}}, 在使用{{ic|catalyst_build_module remove_all}}命令删除catalyst-generator之前最好切换到root用户,'''这会删除所有{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包.'''<br />
<br />
当删除{{ic|Catalyst-generator}}时,{{ic|Catalyst-generator}}不能自动删除那些{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包,这是因为pacman不允许有一个以上的实例同时运行。若在使用{{ic|# pacman -R catalyst-generator}}前忘记运行{{ic|# catalyst_build_module remove_all}},catalyst-generator将会询问删除catalyst-generator自身后要删除哪个{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包。<br />
<br />
Catalyst-generator 是最安全的,最符合KISS原则的,因为:<br />
<br />
# 你可以使用非特权用户来构建包;<br />
# 它在 fakeroot 环境构建包;<br />
# 它不乱丢文件,[[pacman]]知道文件们在哪;<br />
# 你需要做的只是,记得去使用它<br />
<br />
{{注意|在构建 {{ic|<nowiki>catalyst-{kernver}</nowiki>}} 时,若看到下列警告,乃正常情况,不必莫名惊诧:<br />
<br />
'''WARNING:''' Package contains reference to $srcdir<br />
<br />
'''WARNING:''' '.pkg' is not a valid archive extension<br />
}}<br />
<br />
=== OpenCL / OpenGL 开发 ===<br />
<br />
这几年AMD一直在为OpenCL and OpenGL的开发做一套工具集。<br />
<br />
现在AMD在'''"Heterogeneous Computing"'''的旗帜下提供了更多的工具集,幸运的是它们也在Linux下可用。<br />
<br />
在AUR和 [catalyst] 软件仓库,你可以找到这些代表了AMD最重要工作的工具软件包:<br />
<br />
* {{AUR|amdapp-aparapi}}<br />
* {{AUR|amdapp-sdk}}<br />
* {{AUR|amdapp-codexl}}<br />
<br />
APP 这个缩写代表 Accelerated Parallel Processing(加速并行处理)。<br />
<br />
==== amdapp-aparapi ====<br />
AMD的Aparapi是一个用java实现的API,用于并行地表达图像数据,它同时也是一个能把java字节码翻译成能被OpenCL识别的运行时组件。所以它能够被很多种图形处理器(GPU)执行。如果Aparapi在GPU上不能执行,那将在java的线程池中执行。<br />
<br />
更多关于Aparapi的信息:[http://developer.amd.com/tools/heterogeneous-computing/aparapi/ here]。<br />
<br />
==== amdapp-sdk (以前的amdstream) ====<br />
AMD APP 软件开发工具套件,是一个由AMD制作地一套完整的开发平台。它让你能够快速和容易地使用AMD APP技术,使得你的程序得到加速。这个SDK提供了代码实例,技术文档和其他资料,让您可以在你的C\C++程序中使用 OpenCL, Bolt, or C++ AMP等技术实现计算加速。<br />
<br />
从2.8版本开始,amdapp-sdk 提供了 aparapiUtil 和 aparapi 的代码实例。有一个包已经加入到了[catalyst]软件仓库。它依赖于{{AUR|amdapp-aparapi}}。AUR中的软件包让你选择需不需要aparapi's additions。<br />
<br />
2.8 版本没有提供探查功能( Profiler functionality),它已经被移到CodeXL中了。<br />
<br />
关于 AMD APP SDK 的更多信息: [http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/ here]。<br />
<br />
==== amdapp-codexl ====<br />
CodeXL 是一个带有静态OpenCl内核分析器的OpenCL and OpenGL调试器和探查器。它具有GUI界面,是在著名的{{AUR|gdebugger}} 基础上完成的。它只支持 x86_64 系统。<br />
<br />
关于CodeXL的更多信息: [http://developer.amd.com/tools/heterogeneous-computing/codexl/ 这里]。<br />
<br />
== 功能 ==<br />
=== Tear Free Rendering ===<br />
<br />
在'''Catalyst 11.1'''中,很可能是添加了三重缓存和v-sync,''Tear Free Desktop''减少了2D,3D视频应用的屏幕撕裂毛病。但这需要额外的GPU处理。<br />
<br />
要启用'Tear Free Desktop',运行{{ic|amdcccle}},然后设置{{ic|Display Options}} → {{ic|Tear Free}}。<br />
<br />
或以root身份运行:<br />
<br />
# aticonfig --set-pcs-u32=DDX,EnableTearFreeDesktop,1<br />
<br />
若禁用,使用{{ic|amdcccle}}或以root身份运行:<br />
<br />
# aticonfig --del-pcs-key=DDX,EnableTearFreeDesktop<br />
<br />
=== 视频加速 ===<br />
<br />
'''[[wikipedia:Video_Acceleration_API|Video Acceleration API]] (VA API)'''是为基于Linux/UNIX操作系统提供利用GPU加速视频处理的一个开源函数库和应用程序接口规范。启用视频加速后,通过各种入口(VLD, IDCT, Motion Compensation, deblocking)它能加速常用编码标准(MPEG-2, MPEG-4 ASP/H.263, MPEG-4 AVC/H.264, and VC-1/WMV3)视频文件的解码过程(俗称硬解)。<br />
<br />
VA-API在{{AUR|xvba-video}}上有一个私有后端(2009年10月), 它允许使用VA-API的程序通过[[wikipedia:XvBA|XvBA (X-Video Bitstream Acceleration API designed by AMD)]]函数库来充分利用拥有uvd2(第二代通用视频解码单元)芯片组的视频加速功能.<br />
<br />
{{注意|使用 {{ic|catalyst-test}} 或者 {{ic|catalyst-total}} 时不需要安装 {{AUR|xvba-video}} , 因为有已经创建好的符号链接代替.}}<br />
xvba-video和支持XvBA的软件仍还在开发,'''但在大多数情况下它都能很好的工作'''. 通过AUR构建(或通过Vi0L0的仓库直接安装)专有{{AUR|xvba-video}}包,若这个版本对你来说有问题,用{{AUR|libva-xvba-driver}}取代; 并安装{{AUR|mplayer-vaapi}} and {{Pkg|libva}}。然后将视频播放器的视频输出设置为vaapi:gl:<br />
<br />
$ mplayer -vo vaapi:gl movie.avi<br />
<br />
此选项可添加到mplayer的配置文件,参考[[MPlayer]]。<br />
<br />
针对 '''smplayer''':<br />
<br />
Options → Preferences → General → Video (tab) → Output driver: User Defined : vaapi:gl<br />
Options → Preferences → General → Video (tab) → Double buffering '''on'''<br />
Options → Preferences → General → General → Screenshots → Turn screenshots '''off'''<br />
Options → Preferences → Performance → Threads for decoding: '''1''' (to turn off -lavdopts parameter)<br />
<br />
{{注意|如果启用了Tear Free Desktop,则按下列步骤:<br />
Options -> Preferences -> General -> Video (tab) -> Output driver: vaapi<br />
若视频输出中没有'''vaapi:gl'''选项 - 可使用:<br />
'''vaapi''', '''vaapi:gl2''' or 简单的 '''xv(0 - AMD Radeon [[wikipedia:Avivo|AVIVO Video]])'''.<br />
}}<br />
<br />
针对 '''VLC''':<br />
<br />
Tools → Preferences → Input & Codecs → Use GPU accelerated decoding<br />
<br />
它有助于在'''amdcccle'''中启用v-sync:<br />
<br />
3D → More Settings → Wait for vertical refresh = Always On<br />
<br />
{{注意|若使用'''Compiz/KWin''',消除'''画面抖动'''的唯一方法就是切换至'''全屏'''并且 '''关闭Redirected Fullscreen'''。<br />
<br />
使用'''compiz''',需在ccsm的General Options中设置'''Redirected Direct Rendering'''。若此举无效,则将其关闭。'''KWin'''默认关闭此功能,若出现画面抖动则通过{{ic|System Settings}} → {{ic|Desktop Effects}} → {{ic|Advanced}}.}}将"Suspend desktop effects for fullscreen windows"开启或关闭。}}<br />
<br />
=== 显卡/显存频率, 温度, 风扇转速, 超频工具 ===<br />
<br />
{{ic|$ aticonfig --od-getclocks}}可以获知当前显卡/显存频率。<br />
<br />
{{ic|$ aticonfig --pplib-cmd "get fanspeed 0"}}可以获知风扇转速(显卡);<br />
<br />
{{ic|$ aticonfig --odgt}}可以获知显卡温度。<br />
<br />
{{ic|$ aticonfig --pplib-cmd "set fanspeed 0 50"}}可以设置风扇转速,其中查询索引50代表速度百分比。<br />
<br />
若超频或与之相反,则使用图形工具反而相对容易些,如需要qt的'''ATi Overclocking Utility'''。你可以从[http://kde-apps.org/content/show.php/ATI+Overclock?content=47796 这儿]找到(不过它可能过时了).<br />
<br />
更复杂的{{AUR|amdoverdrivectrl}}也能达到此目的,它的主页是[http://sourceforge.net/projects/amdovdrvctrl here]。可通过[https://aur.archlinux.org/packages.php?ID=45298 AUR]或Vi0L0's非官方软件库构建安装包。<br />
<br />
=== 双屏显示 ===<br />
<br />
==== 介绍 ====<br />
<br />
{{警告|由于安装方式的不同,并且每种安装方式需要与其相对应进行配置,因此设置双屏显示并没有特定的方法,你必须根据你自己的需要采用相应的步骤。当然可以多尝试几种方法。'''所以,在修改之前,请务必将你现在能正常使用的{{ic|/etc/X11/xorg.conf}}备份,以便遇到问题时可以从命令行恢复.'''}}<br />
<br />
* 本节讲述如何配置"BIG Desktop"效果。主要是不同尺寸的屏幕如何通过两个不同的输出接口(DVI + HDMI)共享一个显卡。<br />
<br />
* Xinerama解决办法有些不便,尤其是不能与XrandR兼容。因为XrandR对于我们所讲的来说是必须的,所以不使用Xinerama。<br />
<br />
* 双头显示能让你有两个不同的会话(一个屏幕一个)。你可以随心所欲地干任何事情,但不能将窗口从一个屏幕移动到另一个屏幕。若只有一个屏幕,你得在Xorg会话里为Server Layout section的每个会话定义鼠标,具体方法查看:<br />
<br />
[http://support.amd.com/us/kbarticles/Pages/1105-HowCanIConfigureMultip.aspx ATI Documentation]<br />
<br />
==== ATI Catalyst Control Center ====<br />
<br />
ATI的图形工具非常有用,我们将尽可能地使用它。运行下面命令可启用它:<br />
<br />
$ {kdesu/gksu} amdcccle<br />
<br />
{{警告|'''千万不要'''直接使用sudo。 Sudo虽能给予管理员权限,却使用用户账户的信息(如环境变量)。GNOME下使用''gksu'',KDE下使用''kdesu''。}}<br />
<br />
==== 安装 ====<br />
<br />
开始之前,确保你的硬件接插正确,电源开启,而且你得你的硬件属性(2D还是3D屏,屏幕尺寸,刷新率等)。通常情况下,在启动阶段两个显示器都会被识别却不需正确区分先后顺序,而是依赖热插拔功能。尤其在不使用({{ic|/etc/X11/xorg.conf}})配置时。<br />
<br />
首先要让你的桌面环境和X认识你的显示器。为此,要为你两个显示器生成基本的Xorg配置文件:<br />
<br />
# aticonfig --initial --desktop-setup=horizontal --overlay-on=1<br />
<br />
或<br />
<br />
# aticonfig --initial=dual-head --screen-layout=left<br />
<br />
{{注意|{{ic|overlay}}非常重要,因为它能让两个显示器拥有1种(多种)像素。<br />
{{提示|运行{{ic|aticonfig --help}}了解所有可用的命令。}}<br />
<br />
现在可编辑基本的Xorg配置文件(如:添加分辨率)。分辨率一定要正确,尤其是使用不同尺寸的显示器。分辨率在"Screen" section:<br />
<br />
SubSection "Display"<br />
Depth 24<br />
Modes "X-resolution screen 1xY-resolution screen 1" "Xresolution screen 2xY-resolution screen 2"<br />
EndSubSection<br />
<br />
这以后就不需手动编辑{{ic|xorg.conf}},而ATI的图形化工具。重启X,确保正确支持两个显示器和识别屏幕分辨率(两个屏幕相互独立而不是完全一样。<br />
<br />
==== 设置 ====<br />
<br />
现在只需以root身份启动ATI控制中心,在显示菜单设置你需要的选项(下拉菜单中的小箭头)。设置好后重启X就大功造成(你和我都可松口气了,这段翻译有点难度,呵呵)!<br />
<br />
重启X之前,不要忘了核实{{ic|xorg.conf}}。主要是核实"Display"下的"Screen"节, 在"Virtual"行里,两个显示器的分辨率应该一样。"Server Layout"节则是剩下的参数。<br />
<br />
== 卸载 ==<br />
<br />
你可能会因为catalyst不工作或者是想试试开源驱动而要卸载掉catalyst:移除 {{ic|catalyst}} 和 {{ic|catalyst-utils}} 包. 当然你也应该移除 {{AUR|catalyst-generator}}, {{AUR|catalyst-hook}} 和 {{AUR|lib32-catalyst-utils}} 包(如果你安装了的话).<br />
<br />
{{警告|<br />
*你也许需要使用 {{ic|# pacman -Rdd}} 来移除 {{AUR|catalyst-utils}} (和/或 {{AUR|lib32-catalyst-utils}}) 因为它(们)包含了 ''gl'' 相关文件,许多包会依赖他们. 这些依赖关系将在安装{{Pkg|xf86-video-ati}}时被满足.<br />
*你也许会需要移除 {{ic|/etc/profile.d/ati-flgrx.sh}} 和 {{ic|/etc/profile.d/lib32-catalyst}} (如果他们存在), 否则 {{ic|r600_dri.so}} 将会载入失败,你将得不到3D支持.}}<br />
<br />
{{注意|你应该从 {{ic|/etc/pacman.conf}} 移除非官方仓库,然后运行 {{ic|# pacman -Syu}}, 因为那些仓库包含过时的Xorg包(为了兼容{{ic|catalyst}}),而 {{Pkg|xf86-video-ati}} 包需要来自[[Official repositories|官方仓库]]的最新的Xorg包.}}<br />
<br />
按如下步骤:<br />
<br />
* 如果你有 {{ic|/etc/modprobe.d/blacklist-radeon.conf}} ,删除文件或者注释掉文件中的{{ic|blacklist radeon}}.<br />
* 如果你在 {{ic|/etc/modules-load.d}} 下有配置文件要在启动时载入 {{ic|fglrx}} 模块, 删除掉或者注释掉 {{ic|fglrx}} 那一行.<br />
* 记住删除/备份 {{ic|/etc/X11/xorg.conf}}.<br />
* 如果安装了 {{AUR|catalyst-hook}} 包,记得关掉它的systemd服务的自启动.<br />
* 如果你在 [[kernel parameters|内核参数]] 中指定了{{ic|nomodeset}}而现在你打算使用KMS,那么删除{{ic|nomodeset}}.<br />
<br />
* 安装另一个驱动之前记得'''重启''' .<br />
<br />
== 故障排除 ==<br />
<br />
若能启动到命令行,问题很可能出在{{ic|/etc/X11/xorg.conf}}<br />
<br />
可阅读{{ic|/var/log/Xorg.0.log}}或通过下列命令查找线索:<br />
<br />
$ grep '(EE)' /var/log/Xorg.0.log<br />
$ grep '(WW)' /var/log/Xorg.0.log<br />
<br />
若看不懂显示的是什么东东,请先搜索论坛,没有结果的话,可将其提交到[https://bbs.archlinux.org/viewtopic.php?pid=1166052#p1166052/ thread specific to ATI/AMD],注意要提交两者显示的信息。<br />
<br />
=== 运行 atieventsd.service 失败 ===<br />
从 [[official repositories_(简体中文)|官方仓库]] 安装 {{Pkg|acpid}}. 启用并运行acpid[[Daemon_(简体中文)|守护进程]].<br />
<br />
如果还不行, 编辑 {{ic|/usr/lib/systemd/system/atieventsd.service}} ,把 {{ic|acpid.socket}} 改成 {{ic|acpid.service}}.<br />
<br />
=== 无法打开 fglrx_dri.so ===<br />
创建从 {{ic|/usr/lib/xorg/modules/dri/fglrx_dri.so}} 到 {{ic|/usr/X11R6/lib64/modules/dri/fglrx_dri.so}} 或其它需要路径的链接:<br />
<br />
# mkdir -p /usr/X11R6/lib64/modules/dri<br />
# ln -s /usr/lib/xorg/modules/dri/fglrx_dri.so /usr/X11R6/lib64/modules/dri/fglrx_dri.so<br />
<br />
=== 启动 GDM 失败 ===<br />
降级 {{pkg|xorg-server}} 或者试试其它 [[Display manager_(简体中文)|显示管理器]] 比如 [[LightDM]].<br />
<br />
=== 在Wine上3D应用冻结 ===<br />
若在Wine上3D应用挂起,禁用TLS。使用{{ic|aticonfig}}或编辑{{ic|/etc/X11/xorg.conf}}。使用{{ic|aticonfig}}:<br />
<br />
# aticonfig --tls=off<br />
<br />
或以root身份打开{{ic|/etc/X11/xorg.conf}},在''Device''段添加{{ic|Option "UseFastTLS" "off"}}。<br />
<br />
只需来个二选一,然后重启X让其生效。<br />
<br />
=== 视频颜色不正常 ===<br />
<br />
仍然使用{{ic|vaapi:gl}}来防止画面抖动,但这样不会有视频加速:<br />
<br />
* 不使用{{ic|-vo vaapi}}运行'''mplayer'''。<br />
<br />
* 若是'''smplayer''',在Options → Preferences → Advanced → Options for MPlayer → Options:中删除{{ic|-vo vaapi}}。<br />
<br />
此后还可以启动'''smplayer'''的截屏功能。<br />
<br />
=== KWin 与混成 ===<br />
<br />
根据你的显卡,在OpenGL和XRender渲染方式中选择一种更快的。<br />
在某些情况下,XRender还可以解决一些人为的错误(比如调整命令行大小)。<br />
<br />
=== 重启或启动x后,黑屏并且一直不退出 ===<br />
<br />
检查在启动加载器的内核参数行是否添加了{{ic|nomodeset}}(参考 [[#禁用KMS]])。<br />
你如果在使用legacy驱动 ({{ic|catalyst-hd234k}}) 黑屏的话, 尝试降级 xorg-server 到 1.12 (使用 [[#xorg112]] 库).<br />
<br />
==== 错误的ACPI硬件调用 ====<br />
<br />
出现此种错误很可能是fglrx模块与系统的ACPI硬件调用配合不够默契而自身禁用,屏幕也就不会有输出。<br />
<br />
果真那样,运行:<br />
<br />
$ aticonfig --acpi-services=off<br />
<br />
=== 注销后KDM消失 ===<br />
<br />
若使用Catalyst,当注销后你会获取tty1这个控制台而不是KDM的欢迎界面。每次注销后你必须让kdm重启X服务器. 将标题为{{ic|[X-:*-Core]}}段里下面行前的注释删掉:<br />
<br />
{{hc|/usr/share/config/kdm/kdmrc|2=<br />
TerminateServer=True<br />
}}<br />
<br />
<br />
<br />
当前注销KDE后KDM就会出现。<br />
<br />
=== 直接渲染无效 ===<br />
<br />
{{警告|在安装或升级catalyst后却没重启系统,也有可能出现此种错误,因为系统需要加载fglrx.ko模块来让驱动正常工作。}}<br />
若直接渲染有问题,运行:<br />
<br />
$ LIBGL_DEBUG=verbose glxinfo > /dev/null<br />
<br />
从此命令输出的第一行至末尾都与直接渲染无效有关,且非常详细。<br />
<br />
常见错误提示和解决办法:<br />
<br />
libGL error: XF86DRIQueryDirectRenderingCapable returned false<br />
<br />
* Ensure that you are loading the correct agp modules for your AGP chipset before you load the {{ic|fglrx}} kernel module. To determine which agp modules you will need, run {{ic|# hwdetect --show-agp}}. Then open your {{ic|/etc/modules-load.d/fglrx.conf}} and add the agp module on a line '''before''' the {{ic|fglrx}} line.<br />
* 若使用AGP的芯片组,确保加载fglrx模块之前加载正确的agp模块。要确定哪些agp模块,运行{{ic|hwdetect --show-agp}},然后打开{{ic|/etc/modules-load.d}}下的{{ic|fglrx.conf}},将agp模块添加到fglrx行'''之前'''。<br />
<br />
libGL error: failed to open DRM: Operation not permitted<br />
libGL error: reverting to (slow) indirect rendering<br />
<br />
libGL: OpenDriver: trying /usr/lib/xorg/modules/dri//fglrx_dri.so<br />
libGL error: dlopen /usr/lib/xorg/modules/dri//fglrx_dri.so failed<br />
(/usr/lib/xorg/modules/dri//fglrx_dri.so: cannot open shared object file: No such file or directory)<br />
libGL error: unable to find driver: fglrx_dri.so<br />
<br />
* 某些软件未正确安装。在错误提示中,若路径为{{ic|/usr/X11R6/lib/modules/dri/fglrx_dri.so}},彻底注销,然后重新登录。若使用图形化的登录管理器(gdm, kdm, xdm),确保每次登录时{{ic|/etc/profile}}都会被读取。将{{ic|source /etc/profile}}添加到{{ic|~/.xsession}}或{{ic|~/.xinitrc}}通过都达到以上目的(不同的登录管理器修改的文件不一样)。<br />
<br />
* 若路径为{{ic|/usr/lib/xorg/modules/dri/fglrx_dri.so}},试着重装{{AUR|catalyst}}包。<br />
<br />
若错误信息为:<br />
<br />
fglrx: libGL version undetermined - OpenGL module is using glapi fallback<br />
<br />
可能是因为系统装了多个版本的{{ic|libGL.so}}.下面的命令应该得到这样的回显:<br />
<br />
{{hc|$ locate libGL.s|<br />
<br />
/usr/lib/libGL.so<br />
/usr/lib/libGL.so.1<br />
/usr/lib/libGL.so.1.2}}<br />
<br />
系统应只有3个libGL.so文件,若不止(例如{{ic|/usr/X11R6/lib/libGL.so.1.2}}),则将其删除。<br />
<br />
若使用X11R7且系统中有下列文件,系统并不会给出任何错误提示,一定要将他们删除:<br />
<br />
/usr/X11R6/lib/libGL.so.1.2<br />
/usr/X11R6/lib/libGL.so.1<br />
<br />
=== 休眠问题 ===<br />
<br />
==== 视频播放不能从休眠状态中恢复 ====<br />
<br />
若启动了framebuffer,Catalyst不能从挂机状态中恢复。在[[kernel parameters|内核参数]]中添加 {{ic|1=vga=0}} 可禁用framebuffer。<br />
<br />
其他加载器,参考[[#禁用KMS]]。<br />
<br />
=== 系统冻结或硬件锁死 ===<br />
<br />
* 过去,{{ic|radeonfb}}的framebuffer驱动很容易导致这个问题。若内核编译时启用对radeonfb的支持,应换内核看是否能解决此问题。<br />
<br />
* 若退出桌面环境(关机、挂机和切换到tty等)时系统冻结,很可能忘记禁用KMS。(参见 [[#禁用KMS]])<br />
<br />
=== 硬件冲突 ===<br />
<br />
当和某些版本的nForce3芯片组一起使用时,Radeon不能3D加速。目前虽还未找到具体原因,但有资料表明: indicate that it may be possible to get acceleration with this combination of hardware by booting with the drivers from 先用nVIDIA驱动启动到Windows然后再重启系统就可能获得3D加速。在root控制台使用下列命令可识别此问题(会得到与下列相似(使用基于nForce3系统)的输出:):<br />
<br />
{{hc|<nowiki>$ dmesg | grep agp</nowiki>|<br />
agpgart: Detected AGP bridge 0<br />
agpgart: Setting up Nforce3 AGP.<br />
agpgart: aperture base > 4G<br />
}}<br />
<br />
或者还有下面的命令得到如下的回显:<br />
<br />
{{hc|<nowiki>$ tail -n 100 /var/log/Xorg.0.log | grep agp</nowiki>|<br />
(EE) fglrx(0): [agp] unable to acquire AGP, error "xf86_ENODEV"}}<br />
<br />
则就有问题。<br />
<br />
有些资料说在某些情形下降级主板的BIOS可能有助于解决问题,但注意此方法并不是在各种情况下都适用,而且'''方法不对则很可能让显卡报废。'''<br />
<br />
参考[http://bugzilla.kernel.org/show_bug.cgi?id=6350 这个错误报告]。<br />
<br />
=== 播放视频时系统短时间死机 ===<br />
<br />
使用Catalyst可导致此问题。<br />
<br />
当用mplayer,若不定时出现几秒到几分钟的死机。查看日志,若有与下面相似的信息:<br />
<br />
{{hc|/var/log/messages.log|2=<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium [<f8bc628c>] ? ip_firegl_ioctl+0x1c/0x30 [fglrx]<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium [<c0197038>] ? vfs_ioctl+0x78/0x90<br />
Nov 28 18:31:56 pandemonium [<c01970b7>] ? do_vfs_ioctl+0x67/0x2f0<br />
Nov 28 18:31:56 pandemonium [<c01973a6>] ? sys_ioctl+0x66/0x70<br />
Nov 28 18:31:56 pandemonium [<c0103ef3>] ? sysenter_do_call+0x12/0x33<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium =======================<br />
}}<br />
<br />
给内核参数添加{{ic|nopat}}和/或{{ic|nomodeset}}到[[kernel parameters|内核参数]]应该能行<br />
<br />
=== "aticonfig: No supported adaptaters detected" ===<br />
<br />
若得到:<br />
<br />
{{hc|# aticonfig --initial|<br />
aticonfig: No supported adapters detected<br />
}}<br />
<br />
可以在{{ic|etc/X11/xorg.conf}}中设置device,或者复制以前的能工作的 {{ic|/etc/ati/control}} 文件 (推荐 - 这也能解决水印的问题),这可能让Catalyst正常工作.<br />
<br />
从AMD下载先前版本的fglrx,使用{{ic|--extract driver}}参数运行. 文件将提取到{{ic|driver/common/etc/ati/control}}. 用它覆盖原来的control文件后重启X. 你可以试试不同版本的.<br />
<br />
设置型号的方法:在{{ic|/etc/X11/xorg.conf}}将device段设置为:<br />
<br />
{{hc|/etc/X11/xorg.conf|<br />
Section "Device"<br />
Identifier "ATI radeon '''****'''"<br />
Driver "fglrx"<br />
EndSection<br />
}}<br />
<br />
此处{{ic|****}}为设备型号(6870 for the HD 6870的显卡为6870,APU E-350为6310,通过网络是很容易查到的).<br />
<br />
Xorg启动后很可能使用{{ic|amdcccle}}而不是{{ic|aticonfig}}。这里会有一个"AMD不支持硬件"水印。<br />
<br />
用下面脚本可将此水印删除:<br />
<br />
#!/bin/sh<br />
DRIVER=/usr/lib/xorg/modules/drivers/fglrx_drv.so<br />
for x in $(objdump -d $DRIVER|awk '/call/&&/EnableLogo/{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6}'); do<br />
sed -i "s/$x/\x90\x90\x90\x90\x90/g" $DRIVER<br />
done<br />
<br />
然后重启。<br />
<br />
=== 让chromium支持WebGL ===<br />
<br />
在Google的Chromium/Chrome浏览器里,Linux的Catalyst驱动被列入了黑名单。参见 [[Chromium#WebGL]] .<br />
<br />
=== 用Adobe的flashplugin观看flash,画面迟滞或冻结 ===<br />
<br />
编辑:<br />
<br />
{{hc|/etc/adobe/mms.cfg|2=<br />
#EnableLinuxHWVideoDecode=1<br />
OverrideGPUValidation=true<br />
}}<br />
<br />
如果你使用KDE,请确保 系统设置->工作空间外观与行为->桌面效果->高级 里,"为全屏窗口挂起桌面特效" 没有勾选.<br />
<br />
=== GNOME3中移动窗口延迟/很慢 ===<br />
你可以试试这么做,有报告称大多数情况下此方法有效。<br />
<br />
将下面行添加到{{ic|~/.profile}}或{{ic|/etc/profile}}:<br />
<br />
export CLUTTER_VBLANK=none<br />
<br />
重启X或操作系统。<br />
<br />
=== 在1920x1080分辨率下不能全屏(欠扫描,屏幕周围有黑边) ===<br />
<br />
这经常会在使用HDMI连接显示器/电视时发生.<br />
<br />
这似乎是AMD/ATI为适应所有HDTV的一项新功能,可以在amdccle中调整.<br />
<br />
使用amdcccle(图形界面)你可以选择要修改的显示输出,将欠扫描设置成0% (aticonfig默认15%欠扫描). (至少)版本14.10有时也会出现显示调整的下面没有欠扫描的滑块的情况.(It is possible as well that the underscan slider won't show under the display's adjustments, as sometimes in (at least) version 14.10.)<br />
<br />
这不是永久的配置,重启X,重启系统,挂起后唤醒甚至切换tty之后都会失效.<br />
<br />
要使这成为永久配置的话,你需要以root身份在console下使用aticonfig来调整欠扫描设置,或者手动编辑 {{ic|/etc/ati/amdpcsdb}} (也是以root身份)<br />
<br />
'''用aticonfig的方法:'''<br />
<br />
# aticonfig --set-pcs-u32=MCIL,DigitalHDTVDefaultUnderscan,0<br />
<br />
改变设置后重启.<br />
<br />
新版本的话(比如12.11), 要是ccc总不能保存过扫描设置,你可以试试:<br />
<br />
# aticonfig --set-pcs-u32=MCIL,TVEnableOverscan,0<br />
<br />
'''手动编辑/etc/ati/amdpcsdb的方法:'''<br />
<br />
在 {{ic|[AMDPCSROOT/SYSTEM/MCIL]}} 之下的任意位置添加<br />
<br />
# DigitalHDTVDefaultUnderscan=V0<br />
<br />
新版本的话(比如12.11), 要是ccc总不能保存过扫描设置,你可以试试:<br />
在 {{ic|[AMDPCSROOT/SYSTEM/MCIL]}} 之下找到这一行<br />
<br />
# TVEnableOverscan=V1<br />
<br />
然后把它变成<br />
<br />
# TVEnableOverscan=V0<br />
<br />
改变设置后重启.<br />
<br />
{{note|也许你会发现,无论你怎么干,登录/注销/重启后, {{ic|/etc/ati/amdpcsdb}} 总是被覆写/还原, 于是你的修改就不见了 _(:з」∠)_.(You might find that the file /etc/ati/amdpcsdb will be overwritten and revert no matter what you do as user or as root even with log in/log out/reboot, ergo the modification will not stick.)<br />
所以你得在fglrx没运行的时候改它.<br />
可以试着重启进入什么不需要运行fglrx的"安全模式"什么的,或者是直接进console模式}}<br />
<br />
'''应对措施:'''<br />
要是因某些原因你不想动ATI的配置文件,你可以设置面板的位置与分辨率来规避问题<br />
以普通用户运行:<br />
<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,positionX:0<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,positionY:0<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,sizeX:1920<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,sizeY:1080<br />
<br />
{{ic|DISPLAYTYPE}}代表你想改的显示器,比如"dfp9".<br />
用如下命令获得你的 {{ic|DISPLAYTYPE}} :<br />
<br />
# xrandr --current<br />
<br />
如果没启用RandR的话,你可以用这个:<br />
<br />
# aticonfig --query-monitor<br />
<br />
也许需要用显示开关或 DISPLAY 变量来设置适当的显示/屏幕(比如 :0.1).<br />
<br />
这将告诉你目前哪一个显示正连接着或断开着,以及它的详情<br />
<br />
这个应对措施不是永久配置,不过是个让面板及上边内容看起来合适的方便快捷的方法<br />
<br />
{{note|新版驱动不应再使用{{ic|<nowiki>aticonfig --set-pcs-val=MCIL,DigitalHDTVDefaultUnderscan,0</nowiki>}}, ATI声明过这已被弃用并即将被移除.}}<br />
<br />
用 {{ic|<nowiki>aticonfig --help | grep set-pcs-val</nowiki>}} 来阅读ATI的说明.<br />
<br />
=== 双屏设置: 关于加速,OpenGL,合成,效能的一般问题 ===<br />
试着禁用 xinerama 和 xrandr12. 如下:<br />
<br />
输入:<br />
# aticonfig --initial<br />
# aticonfig --set-pcs-str="DDX,EnableRandR12,FALSE"<br />
然后重启系统. 在 {{ic|/etc/X11/xorg.conf}} 中检查 xinerama 是不是被禁用了, 如果没有,禁用它,然后重启系统.( In /etc/X11/xorg.conf check that xinerama is disabled, if it's not disable it and reboot your system. )<br />
<br />
接下来运行{{ic|amdcccle}},如下: amdcccle→显示管理→多屏幕显示→以display(s) 2多屏显示桌面(amdcccle->display manager->multi-display->multidisplay desktop with display(s) 2. ).<br />
<br />
再次重启,再按你的想法设置显示.<br />
<br />
=== 禁用VariBright功能 ===<br />
[http://support.hp.com/vn-en/document/c02848104 Vari-Bright] 动态调整显示面板用电量以节能.<br />
输入以下命令以禁用 VariBright:<br />
# aticonfig --set-pcs-u32=MCIL,PP_UserVariBrightEnable,0<br />
<br />
=== Hybrid/PowerXpress: 关掉独立GPU ===<br />
当你使用 {{AUR|catalyst-total-pxp}} 或 catalyst-utils-pxp 时,你也许会发现切换到集成GPU时,独立GPU仍在工作,又耗电又使得系统温度很高. <br />
<br />
对于集显是intel的话你可以通过 {{ic|vgaswitcheroo}} 来关掉独立GPU.<br />
不过很不幸有些时候不行...<br />
<br />
然后这时你可以试试 {{Pkg|acpi_call}}. MrDeepPurple准备好了脚本来完成这个任务.脚本在启动和恢复系统的时候通过systemd服务调用.<br />
这是他的脚本:<br />
#!/bin/sh<br />
libglx=$(/usr/lib/fglrx/switchlibglx query)<br />
modprobe acpi_call<br />
if [ "$libglx" = "intel" ]; then<br />
echo '\_SB.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call<br />
fi<br />
<br />
=== 从X会话切换到TTY黑屏/低分辨率TTY ===<br />
接受这个"功能"吧,这出现在catalys 13.2 beta,解决方法是使用{{ic|1=vga=}}内核选项,比如{{ic|1=vga=792}}。<br />
使用<br />
$ hwinfo --framebuffer<br />
来得到支持的分辨率列表<br />
选择最适合你的分辨率,粘贴到启动引导器的内核行,比如 {{ic|1=vga=0x03d4}}<br />
<br />
=== 从X会话切换到TTY黑屏,背光并没有关闭 ===<br />
使用 [[uvesafb]] 作为 framebuffer 驱动. 而且, {{ic|uvesafb}} 可以为 TTY 设置任意分辨率.<br />
<br />
=== 切换TTY后切换回X会话时,只有一个带鼠标的黑屏 ===<br />
如果你遇到了这个bug的话,试着添加<br />
Option "XAANoOffscreenPixmaps" "true"<br />
到你的 xorg.conf 的 'Device' 部分.<br />
<br />
同时, 确认已安装有 [[Polkit#Authentication agents|polkit 认证代理]] 并正在运行, 因为这种情况可能会在某程序想要请求密码但没有认证代理来显示密码对话框时出现.<br />
<br />
=== 30 FPS / Tear-Free / V-Sync bug ===<br />
这个Bug发生于Catalyst 13.6 beta, 到现在(13.9)还没修复.<br />
<br />
激活 "Tear Free"(防撕裂) 功能之后,所有新启动的OpenGL程序都出现延迟,常表现为只有30 FPS,复合桌面环境也是.("After enabling "Tear Free" functionality every freshly started OpenGL application is lagging, often generates only 30 FPS, it also touches composited desktop.")<br />
<br />
M132找到一个解决方法.在 "AMD Catalyst Control Center" (amdcccle) 里完成这些操作:<br />
<br />
1. 开启 Tear-Free, 这将设置 3D V-Sync 为"总是开启".<br />
2. 设置 3D V-Sync 为"总是关闭".<br />
3. 确认 Tear-Free 仍为"开启".<br />
4. 重启X/重登录.<br />
<br />
这在KDE 4.11.x下有效.M132的建议: "试着关闭 "Detect refresh rate" ,并为复合插件("Composite plugin")指定显示器刷新率."<br />
<br />
=== 背光调节不起效 ===<br />
如果你的背光调节有问题, 你可以试试:<br />
# aticonfig --set-pcs-u32=MCIL,PP_PhmUseDummyBackEnd,1<br />
一些用户报告说这导致FPS降低.要恢复默认的话:<br />
# aticonfig --set-pcs-u32=MCIL,PP_PhmUseDummyBackEnd,0<br />
[http://ati.cchtml.com/show_bug.cgi?id=711 更多信息见此]<br />
<br />
=== 使用 plasma 时 Chromium 出现毛刺(glitching) ===<br />
添加 --disable-gpu 参数来启动 chromium, 比如,对 /usr/share/applications/chromium.desktop, 改成这样:<br />
# cat /usr/share/applications/chromium.desktop | grep -i exec<br />
Exec=chromium %U --disable-gpu<br />
<br />
== 参见 ==<br />
<br />
* [http://wiki.cchtml.com/index.php/Main_Page Unofficial Wiki for the ATI Linux Driver]<br />
* [http://ati.cchtml.com/query.cgi Unofficial ATI Linux Driver Bugzilla]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=AMD_Catalyst_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=408906
AMD Catalyst (简体中文)
2015-11-11T13:38:28Z
<p>Aaron chen: </p>
<hr />
<div>[[Category:Graphics (简体中文)]]<br />
[[Category:X server (简体中文)]]<br />
[[en:AMD Catalyst]]<br />
[[es:AMD Catalyst]]<br />
[[fr:ATI#Catalyst]]<br />
[[it:AMD Catalyst]]<br />
[[ja:AMD Catalyst]]<br />
[[ru:AMD Catalyst]]<br />
{{TranslationStatus (简体中文)|AMD_Catalyst|2015-11-05|406475}}<br />
{{Related articles start (简体中文)}}<br />
{{Related|ATI (简体中文)}}<br />
{{Related|Xorg (简体中文)}}<br />
{{Related articles end}}<br />
AMD的显卡驱动有两种:一是官方私有驱动(catalyst,译为催化剂),二是开源驱动(xf86-video-ati).本文主要介绍私有驱动。<br />
<br />
AMD曾经将“catalyst”驱动命名为“fglrx” ('''F'''ire'''GL''' and '''R'''adeon '''X'''). 现在虽然名为“catalyst”,但内核模块名称依然为“fglrx.ko”. 因此,下文中任何提及fglrx 都是指“内核模块”,而不是指软件包.<br />
<br />
'''官方仓库不再提供Catalyst。''' Catalyst [https://www.archlinux.org/news/ati-catalyst-support-dropped/ 曾被移出Arch官方支持],原因是对质量与开发速度的不满。该项目于2013年4月被再次丢弃,截止现在还没有进一步的消息.<br />
<br />
与开源驱动相比, Catalyst 在2D,3D渲染和电源管理上更胜一筹,但缺乏高效的多显支持.支持设备为 [[wikipedia:Radeon|ATI/AMD Radeon]]显卡,芯片组 R600 及以上(Radeon HD 2xxx或者更新). ''model''名称 (如X1900, HD4850) 与 ''chip''名称 (分别是R580, RV770)间的对照请参见Xorg [http://www.x.org/wiki/RadeonFeature/#index5h2 decoder ring]或者[[wikipedia:Comparison of AMD graphics processing units|这个表格]].<br />
<br />
== 安装 ==<br />
<br />
共有三种途径安装Catalyst。第一种是用[https://aur.archlinux.org/account/Vi0l0/ Vi0L0](Arch非官方Catalyst维护人员)维护的软件库.此库包涵了所有可用的软件包.第二种方式就是通过AUR,Vi0L0提供的PKGBUILDs跟他用于构建他仓库的PKGBUILDs完全一样。最后你还可以直接通过AMD官方下载Catalyst.<br />
<br />
自Catalyst 12.4, AMD已将针对Radeon HD 5xxx 和 Radeon HD 2xxx, 3xxx and 4xxx 显卡驱动分开开发,因此在你选择何种安装方式之前,应查看你的显卡型号。Radeon HD 2xxx, 3xxx and 4xxx 显卡用 '''legacy'''驱动,Radeon HD 5xxx(以及更新的)用普通Catalyst。但无论你需要哪种驱动,都应安装Catalyst utilities。<br />
<br />
{{注意|你会发现,每种安装方式都会进行的一个相同的操作,无论你采用哪种安装方式,你都应了解一些通用的安装说明。}}<br />
<br />
=== 安装Catalyst ===<br />
<br />
==== 从非官方软件库 ====<br />
<br />
如果你不喜欢通过[[AUR]]来安装,则使用此方法。此软件库由我们的[[User:Vi0L0|Vi0l0]]维护。所有的包都经过签名,所以安全方面无需担心。下文提及的很多其他与AMD显卡有关的包也是由Vi0L0维护。<br />
<br />
Vi0L0有三个不同的Catalyst软件库:<br />
* [[Unofficial user repositories#catalyst|catalyst]]:Radeon HD 5xxx及更新的显卡使用的普通Catalyst驱动。包含了最新的 (稳定版或者beta版) Catalyst.<br />
* ''catalyst-stable'':Radeon HD 5xxx及更新的显卡使用的普通Catalyst驱动。包含了最新的稳定版 Catalyst.<br />
* [[Unofficial user repositories#catalyst-hd234k|catalyst-hd234k]]:Radeon HD 2xxx, 3xxx and 4xxx显卡使用的legacy Catalyst驱动.<br />
<br />
要启用上述软件库的话,参见[[Unofficial user repositories]]中所述方法. 记得在{{ic|pacman.conf}}中的'''其他软件库之前'''添加相应软件库.<br />
{{注意|''catalyst''和''catalyst-stable''软件库的URL相同.若要启用''catalyst-stable'',步骤与启用''catalyst''相同,并在{{ic|pacman.conf}}中将{{ic|[catalyst]}}替换成{{ic|[catalyst-stable]}}.如果你需要某个旧版本,这儿也有并且URL也相同,比如''catalyst-stable-13.4''.}}<br />
{{警告|<br />
* legacy Catalyst不支持Xorg Server 1.17. 要使用此驱动的话,参见 [[#Xorg repositories]] 来回滚到 Xorg Server 1.16.<br />
}}<br />
<br />
{{小贴士|有时 catalyst.wirephire.com 因为超出带宽上限而不能提供下载(曾发生过这个问题),或者你到这个服务器的连接很慢.这时,你可以尝试另外的镜像服务器: [http://mirror.rts-informatique.fr/archlinux-catalyst/] (rtsinformatique 提供,法国) 和 [http://mirror.hactar.bz/Vi0L0/] (goll 提供,德国). 不过,这些服务器不保证随时可用.需要的话就反注释掉,多准备一个替代品以防镜像临时不可用也是好习惯.<br />
<br />
Repository mirroring can be easily achieved using {{ic|rsync://mirror.rts-informatique.fr::archlinux-catalyst}}.<br />
}}<br />
<br />
完成后更新pacman数据库并[[pacman|安装]]这些软件包(更多信息参见[[#工具]]):<br />
<br />
* ''catalyst-hook''<br />
* ''catalyst-utils''<br />
* ''catalyst-libgl''<br />
* ''opencl-catalyst'' - 可选,OpenCL支持<br />
* ''lib32-catalyst-utils'' - 可选,64-bit系统上32-bit的OpenGL支持<br />
* ''lib32-catalyst-libgl'' - 可选,64-bit系统上32-bit的OpenGL支持<br />
* ''lib32-opencl-catalyst'' - 可选,64-bit系统上32-bit的OpenCL支持<br />
<br />
如果你是一台Intel/AMD双显卡笔记本,参考下这个:<br />
<br />
* ''catalyst-hook''<br />
* ''catalyst-utils-pxp''<br />
* ''lib32-catalyst-utils-pxp'' - 可选,64-bit系统上32-bit的OpenGL支持<br />
<br />
{{注意|如果pacman询问是否移除'''libgl''',尽管回答"是".}}<br />
<br />
{{警告|软件包catalyst已从Vi0L0的仓库移除,catalyst-hook取而代之.}}<br />
<br />
==== 通过AUR安装 ====<br />
<br />
还可以通过[[AUR]]安装。如果你需为你的电脑进行定制安装,则用此方法。此方法极为繁琐,因为它需要的工作量最大,而且每次内核更新后你得手动更新Catalyst。<br />
<br />
{{警告|若通过AUR安装 Catalyst, 每次内核更新你都得重新编译Catalyst,否则X将不能启动。}}<br />
<br />
在 Vi0L0's 软件库中提到的一切软件包[[AUR]]中也可用::<br />
* {{AUR|Catalyst}}<br />
* {{AUR|Catalyst-generator}}<br />
* {{AUR|Catalyst-hook}}<br />
* {{AUR|Catalyst-utils}}<br />
* {{AUR|Lib32-catalyst-utils}}<br />
<br />
AUR还提供些独家软件包。它含有被称为 ''Catalyst-total''的包和一些beta阶段的软件:<br />
* {{AUR|Catalyst-total}}<br />
* {{AUR|Catalyst-total-pxp}}<br />
* {{AUR|Catalyst-total-hd234k}}<br />
* {{AUR|Catalyst-test}}<br />
<br />
{{AUR|catalyst-total}}包能让AUR用户更为方便。它能构建驱动、内核工具、32位内核工具和{{AUR|catalyst-hook}}(参见[[#工具]]).<br />
<br />
{{AUR|catalyst-total-pxp}}让Catalyst对powerXpress提供实验性支持。<br />
<br />
=== 配置驱动 ===<br />
安装完毕后,要配置 X,让其使用Catalyst。要确保fglrx模块在启动阶段加载,而且要禁用[[kernel mode setting]].<br />
<br />
==== 配置X ====<br />
你需要创建 {{ic|xorg.conf}} 文件来配置X. Catalyst提供了{{ic|aticonfig}}工具来创建和(或)修改此文件。<br />
通过访问{{ic|/etc/ati/amdpcsdb}}文件它几乎能配置显卡的各项参数。了解完整的配置选项{{ic|aticonfig}}可运行:<br />
<br />
# aticonfig --help | less<br />
<br />
{{警告|在将各项配置参数提交到{{ic|/etc/X11/xorg.conf}}之前使用{{ic|--output}}选项,{{ic|/etc/X11/xorg.conf.d}}中的所有内容都会被覆盖。(Use the {{ic|--output}} option before committing to {{ic|/etc/X11/}} as an {{ic|xorg.conf}} file will override anything in {{ic|/etc/X11/xorg.conf.d/}})}}<br />
<br />
{{注意|如果坚持使用{{ic|xorg.conf.d}}下的新配置文件:为了让{{ic|Device}}部分与{{ic|/etc/X11/xorg.conf.d/20-radeon.conf}}相匹配,则使用{{ic|# aticonfig [...] --output}}.但这有一个缺点,很多依赖xorg.conf的{{ic|aticonfig}}选项都无法使用。}}<br />
<br />
现在来配置 Catalyst. 若只有一个显示器,运行:<br />
<br />
# aticonfig --initial<br />
<br />
{{注意| 如果对PowerXpress有疑问,安装 {{AUR|catalyst-total-pxp}}.}}<br />
<br />
注意,若你使用双显示器则使用下面的命令。 此命令会成两个配置文件,第二个显示器的配置文件在第一个前面<br />
<br />
# aticonfig --initial=dual-head --screen-layout=above<br />
<br />
{{注意|了解与设置双显有关的更多信息可查看[[#双屏显示]]}}<br />
<br />
你可与[[Xorg#Sample configurations|Sample Xorg.conf]]上的任何一个示例文件进行对照。<br />
<br />
虽然目前的版本的Xorg启动时能自动探测大多数选项,但不同Xorg版本的默认参数可能会有所不同,最好明确指定一些参数.<br />
<br />
给一个示例配置 (注意) '''仅供参考'''. 标{{ic|#}}必须有,标{{ic|##}}很可能会用到:<br />
<br />
{{hc|/etc/X11/xorg.conf|2=<br />
Section "ServerLayout"<br />
Identifier "Arch"<br />
Screen 0 "Screen0" 0 0 # 0's are necessary.<br />
EndSection<br />
Section "Module"<br />
Load [...]<br />
[...]<br />
EndSection<br />
Section "Monitor"<br />
Identifier "Monitor0"<br />
...<br />
EndSection<br />
Section "Device"<br />
Identifier "Card0"<br />
Driver "fglrx" # Essential.<br />
BusID "PCI:1:0:0" # Recommended if autodetect fails.<br />
Option "OpenGLOverlay" "0" ##<br />
Option "XAANoOffscreenPixmaps" "false" ##<br />
EndSection<br />
Section "Screen"<br />
Identifier "Screen0"<br />
Device "Card0"<br />
Monitor "Monitor0"<br />
DefaultDepth 24<br />
SubSection "Display"<br />
Viewport 0 0<br />
Depth 24 # Should not change from '24'<br />
Modes "1280x1024" "2048x1536" ## 1st value=default resolution, 2nd=maximum.<br />
Virtual 1664 1200 ## (x+64, y) to workaround potential OGL rect. artifacts/<br />
EndSubSection ## fixed in Catalyst 9.8<br />
EndSection<br />
Section "DRI"<br />
Mode 0666 # May help enable direct rendering.<br />
EndSection<br />
}}<br />
<br />
{{注意|一旦升级Catalyst就要通过后面的方法删除{{ic|amdpcsdb}}文件: 关闭X,删除{{ic|/etc/ati/amdpcsdb}},启动X然后运行{{ic|amdcccle}} -否则{{ic|amdcccle}}将会显示错误的Catalyst版本号}}<br />
<br />
''更多信息参考[https://bbs.archlinux.org/viewtopic.php?id=57084 这里].''<br />
<br />
==== 启动时加载模块 ====<br />
禁用{{ic|radeon}}以防其自动加载. 在{{ic|/etc/modprobe.d/modprobe.conf}}里禁用''radeon'',同时保证它不被{{ic|/etc/modules-load.d/}}里的文件加载. 详见[[kernel modules#Blacklisting]]. <br />
<br />
接下来,使模块{{ic|fglrx}}自动加载. 添加{{ic|fglrx}}到{{ic|/etc/modules-load.d/}}下已有的模块文件的新一行,或者创建一个新的模块文件并添加{{ic|fglrx}}.<br />
<br />
==== 禁用KMS ====<br />
<br />
{{注意|使用{{ic|catalyst-utils-pxp}}或者{{ic|catalyst-total-pxp}}的用户不要这样做,因为intel驱动需要KMS.}}<br />
<br />
禁用KMS很重要.由于Catalyst根本不使用[[KMS]],得将其禁用。否则,当系统切换至TTY或在桌面环境下关机时,系统可能会冻结。<br />
<br />
添加 {{ic|nomodeset}} 到你的 [[kernel parameters|内核参数]]. <br />
<br />
==== 检查安装是否成功 ====<br />
<br />
重启电脑并登录, 运行下列命令可查看{{ic|fglrx}}是否正确运行:<br />
<br />
$ lsmod | grep fglrx<br />
<br />
若有输出, 则证明安装成功。可以尝试用 {{ic|$ startx}} 或者显示管理器来启动X (参见 [[Xorg#Running]]).<br />
<br />
下面的命令可以输出你的显卡型号信息:<br />
<br />
$ fglrxinfo<br />
<br />
运行以下命令检查直接渲染模式是否启用:<br />
<br />
$ glxinfo | grep direct<br />
<br />
若显示{{ic|"direct rendering: yes"}},恭喜你,到位了! 若无{{ic|$ glxinfo}}命令,安装{{Pkg|mesa-demos}} package。<br />
<br />
{{注意|对于{{ic|glxgears}},你也可以使用:<br />
$ fgl_glxgears<br />
来测试fglrx.<br />
}}<br />
<br />
{{警告|最近几版Xorg,库函数路径变了,因此即使安装{{ic|libGL.so}}也不一定能正确人加载。请检查GL是否工作,可阅读"故障排除"段落}}<br />
<br />
=== 自己编译内核 ===<br />
<br />
在手动编译的内核上,你必须构建你自己的{{ic|catalyst-$kernel}}包.<br />
<br />
{{注意|如果你讨厌打包或毫无经验,可先阅读[[ABS]]。}}<br />
<br />
#从[[AUR|Catalyst]]上获取{{ic|PKGBUILD}} 和 {{ic|catalyst.install}}文件。<br />
# 编辑PKGBUILD. 两个地方需要修改:<br />
## 将{{ic|1=pkgname=catalyst}} 修改为 {{ic|1=pkgname=catalyst-$kernel_name}},{{ic|$kernel_name}}可以随意取(如:custom, mm)。<br />
## 将{{ic|linux}}的依赖修改为{{ic|$kernel_name}}。<br />
# 构建并安装软件包;运行{{ic|makepkg -i}} 和 {{ic|makepkg}},接着运行 {{ic|# pacman -U pkgname.pkg.tar.gz}}<br />
<br />
{{注意|<br />
*如果在安装有多内核的系统上,你必须为所有内核安装 {{AUR|catalyst-utils}} 包。这不会引起冲突.<br />
<br />
*{{AUR|catalyst-generator}}能为你自动构建{{ic|<nowiki>catalyst-{kernver}</nowiki>}},因此这些步骤根本就可省略。 请参考[[#工具|工具 部分]].}}<br />
<br />
=== PowerXpress support ===<br />
<br />
PowerXpress technology 允许支持dual-graphic功能(以前叫做AMD Hybrid CrossFire technology)的笔记本电脑从集成显卡(IGP) 切换到独立显卡,以增加电池寿命或者实现更好的3D渲染效能。<br />
<br />
为了在archlinux上用上这个功能,你j将需要:<br />
* 从 [[AUR]] 获取并编译 {{AUR|catalyst-total-pxp}} 这个软件包,或者<br />
* 从 [catalyst] 软件仓库安装 '''catalyst-utils-pxp''' 软件包 (如果需要,还有 lib32-catalyst-utils-pxp)。<br />
<br />
对于intel集成显卡的切换,你还需要安装 {{pkg|mesa-libgl}} 软件包和intel的驱动:{{pkg|xf86-video-intel}} 。<br />
{{注意|'''对最新的13.1版本的Catalyst(不是Catalyst legacy) ChrisXY 能够兼容最新的 {{pkg|xorg-server}} (版本 1.13.1), {{Pkg|mesa}} 9.0.1 和 {{pkg|xf86-video-intel}} 2.20.18'''.<br />
<br />
对于所有版本低于13.1的Catalyst(和任何版本的Catalyst legacy),和新的intel驱动存在一些兼容问题。'''最近的{{pkg|xf86-video-intel}}开发版本是2.20.2-2''',所以你可能必须从Arch软件仓库中的最新版本降级(尽管我们推荐你试验性地使用最新的驱动,因为有可能它在你这里没有问题)<br />
<br />
{{pkg|xf86-video-intel}} 2.20.2-2 只兼容 xorg-server 1.12 并且特它是 '''xorg112 repository'''的一部分. 如果你想使用它,你必须降级xorg-server。具体信息见 [[#Xorg repositories]].}}<br />
<br />
现在你可以用下面这些命令切换集成显卡和独立显卡:<br />
<br />
{{bc|1=<br />
# aticonfig --px-igpu #for integrated GPU<br />
# aticonfig --px-dgpu #for discrete GPU<br />
}}<br />
<br />
Just remember that fglrx needs {{ic|/etc/X11/xorg.conf}} configured for AMD's card with {{ic|fglrx}} inside.<br />
要记着对含有 {{ic|fglrx}} 模块的AMD显卡,fglrx需要 {{ic|/etc/X11/xorg.conf}} 这个文件<br />
<br />
你也可以用{{ic|pxp_switch_catalyst}} 这个切换脚本完成一些其他有用的操作:<br />
* Switching {{ic|xorg.conf}} - it will rename {{ic|xorg.conf}} into {{ic|xorg.conf.cat}} (if there is fglrx inside) or {{ic|xorg.conf.oth}} (if there is intel inside) and then it will create a symlink to {{ic|xorg.conf}}, depending on what you chose.<br />
* Running {{ic|aticonfig --px-Xgpu}}.<br />
* Running {{ic|switchlibGL}}.<br />
* Adding/removing {{ic|fglrx}} into/from {{ic|/etc/modules-load.d/catalyst.conf}}.<br />
<br />
Usage:<br />
{{bc|1=<br />
# pxp_switch_catalyst amd<br />
# pxp_switch_catalyst intel<br />
}}<br />
<br />
如果你试图在装有intel驱动的设备上运行X图形界面时遇到问题,你可以尝试强制开启"UXA" acceleration: 在{{ic|xorg.conf}}中写{{ic|Option "AccelMethod" "uxa"}},就象这样:<br />
{{hc|/etc/X11/xorg.conf|2=<br />
Section "Device"<br />
Identifier "Intel Graphics"<br />
Driver "intel"<br />
#Option "AccelMethod" "sna"<br />
'''Option "AccelMethod" "uxa"'''<br />
#Option "AccelMethod" "xaa"<br />
EndSection<br />
}}<br />
<br />
==== 同时运行两个X server(一个使用Intel驱动, 一个使用 fglrx) ====<br />
<br />
因为fglrx容易崩溃(考虑到PowerXpress),主要X server使用Intel驱动,另一个使用需要3D加速的fglrx驱动是个不错的选择。但是在开启第二个X server的时候,简单地从集成显卡 {{ic|aticonfig}} 或者 {{ic|amdcccle}}切换到独立显卡将引发一系列不正常的bugs。<br />
<br />
为了同时运行两个X server(每个用不同的驱动),你首先需要设置出一个可以和Catalyst一起正常工作的X图形环境,然后把它的 {{ic|xorg.conf}}移动到一个临时的地方(比如{{ic|/etc/X11/xorg.conf.fglrx}})。下次X图形环境启动时,它将默认使用intel驱动来代替fglrx。<br />
<br />
在开启第二个使用fglrx的X server,只需要在运行X之前,把{{ic|xorg.conf}} 移回合适的地方({{ic|/etc/X11/xorg.conf}})。这个方法甚至允许你在两个运行的X sessions之间来回切换。当你不需要使用fglrx时,再把 {{ic|xorg.conf}} 移动到其他地方。<br />
<br />
这种方法唯一的坏处是不能使用intel驱动的3D加速。但它的2D却能完全发挥作用。除此之外,它还能给我们一个非常稳定的桌面环境。<br />
<br />
==== 多显示器的PowerXpress笔记本运行于AMD模式时(pxp_switch_catalyst amd)的问题 ====<br />
当PowerXpress笔记本工作于AMD-only模式时(比如设置全部渲染工作交给独显),你有可能会遇到显示器伪影/重复的情况.这是一个已知的问题,发生于7xxxM系列显卡.<br />
<br />
当旋转或者缩放一个显示器时现象会消失,所以你可以使用xrandr来解决这个问题:<br />
<br />
{{bc|1=<br />
xrandr --output HDMI1 --left-of LVDS1 --primary --scale 1x1 --output LVDS1 --scale 1.0001x1.0001<br />
}}<br />
<br />
== Xorg软件库 ==<br />
Catalyst由于其缓慢的更新而被人大为诟病。因升级Xorg而造成两者不兼容是稀松平常的事。也就意味着Catalyst用户要么自己编译Xorg的包要么使用一个只包含Xorg包的回溯软件库,该库中不提供更新版Xorg以确保兼容性。 Vi0L0提供好几个这样的库. <br />
<br />
要启用上述软件库的话,参见[[Unofficial user repositories]]中所述方法. 记得在{{ic|pacman.conf}}中的'''其他软件库之前(甚至在你的catalyst仓库前,如果你有的话)'''添加相应软件库(使用和[[Unofficial user repositories#catalyst|catalyst]]库相同的PGP密匙).<br />
<br />
=== xorg117 ===<br />
Catalyst does not support xorg-server 1.18<br />
{{bc|<nowiki><br />
[xorg117]<br />
Server = http://catalyst.wirephire.com/repo/xorg117/$arch<br />
## Mirrors, if the primary server does not work or is too slow:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg117/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg117/$arch<br />
</nowiki>}}<br />
<br />
=== xorg116 ===<br />
Catalyst 不支持 xorg-server 1.17<br />
{{bc|<nowiki><br />
[xorg116]<br />
Server = http://catalyst.wirephire.com/repo/xorg116/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg116/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg116/$arch<br />
</nowiki>}}<br />
<br />
=== xorg115 ===<br />
Catalyst < 14.9 不支持 xorg-server 1.16<br />
<br />
{{bc|<nowiki><br />
[xorg115]<br />
Server = http://catalyst.wirephire.com/repo/xorg115/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg115/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg115/$arch<br />
</nowiki>}}<br />
<br />
=== xorg114 ===<br />
Catalyst < 14.1 不支持 xorg-server 1.15.<br />
<br />
{{bc|<nowiki><br />
[xorg114]<br />
Server = http://catalyst.wirephire.com/repo/xorg114/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg114/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg114/$arch<br />
</nowiki>}}<br />
<br />
=== xorg113 ===<br />
Catalyst < 13.6 不支持 xorg-server 1.14.<br />
<br />
{{bc|<nowiki><br />
[xorg113]<br />
Server = http://catalyst.wirephire.com/repo/xorg113/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg113/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg113/$arch<br />
</nowiki>}}<br />
<br />
=== xorg112 ===<br />
Catalyst < 12.10 和 Catalyst Legacy 不支持 xorg-server 1.13.<br />
<br />
{{bc|<nowiki><br />
[xorg112]<br />
Server = http://catalyst.wirephire.com/repo/xorg112/$arch<br />
## 如果上面那个不行或者太慢的话就换这些镜像站:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg112/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg112/$arch<br />
</nowiki>}}<br />
<br />
== 工具 ==<br />
<br />
=== Catalyst-hook ===<br />
{{AUR|Catalyst-hook}} 是一个 [[systemd]] 服务,它在系统关机或重启后重新构建{{ic|fglrx}}模块(如果需要的话,比如内核升级后).<br />
<br />
使用之前请保证 {{Grp|base-devel}} 组和 {{Pkg|linux-headers}} 包(对应你的内核)已经安装.<br />
<br />
只需激活{{ic|catalyst-hook.service}}服务即可:<br />
<br />
# systemctl enable catalyst-hook<br />
# systemctl start catalyst-hook<br />
<br />
你也可以用这个软件包来手动构建{{ic|fglrx}}模块. 在内核更新后运行 {{ic|catalyst_build_module}} 脚本即可:<br />
<br />
# catalyst_build_module all<br />
<br />
'''一些技术细节:'''<br />
<br />
The {{ic|catalyst-hook.service}} is stopping the systemd "river" and is forcing systemd to wait until catalyst-hook finishes its job.<br />
<br />
{{ic|catalyst-hook.service}} 调用 {{ic|catalyst_build_module check}} 来检查是否有必要重构建fglrx.<br />
<br />
{{ic|check}} 检查{{ic|fglrx}}模块是否存在:<br />
<br />
*不存在,将构建它;<br />
<br />
*存在,它将比较两个参数来确定是否有必要重构建{{ic|fglrx}}.<br />
<br />
这里的参数是 {{ic|/usr/lib/modules/<kernel_version>/build/Module.symvers}} 的md5值. (因为我(这里指Vi0L0)发现每一个版本的这个文件都不一样). 第一个参数是现有的 {{ic|Module.symvers}} 文件md5.第二个参数是{{ic|fglrx}}模块构建时 {{ic|Module.symvers}} 文件的md5. 这个参数被{{ic|catalyst_build_module}}脚本编译到{{ic|fglrx}}模块.<br />
<br />
如果参数不同,将编译新的{{ic|fglrx}}模块.<br />
<br />
check 检查整个 {{ic|/usr/lib/modules/}} 目录 ,为安装的所有内核编译fglrx模块(如果需要的话). 如果没有必要构建或重构建,进程将很快结束.<br />
<br />
=== Catalyst-generator ===<br />
<br />
{{AUR|catalyst-generator}}包能构建并安装{{ic|fglrx}}模块,该模块与pacman兼容的{{ic|<nowiki>catalyst-${kernver}</nowiki>}}相适应。与[[#Catalyst-hook]]的区别是必须手动使用此命令,而Catalyst-hook则不需。<br />
<br />
通过[[makepkg]],它能构建{{ic|<nowiki>catalyst-${kernver}</nowiki>}}二进制包并用[[pacman]]安装。{{ic|<nowiki>${kernver}</nowiki>}} 是软件包的目标内核版本 (例如 catalyst-2.6.35-ARCH 适用于 2.6.35-ARCH 内核).<br />
<br />
非特权用户使用{{ic|catalyst_build_module}}来构建并安装{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包。安装时会提示输入root密码。<br />
<br />
简单说一下如何使用此包:<br />
<br />
# root用户: 使用{{ic|catalyst_build_module remove}}。此举会删除无用的{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包。<br />
# 非特权用户: 使用{{ic|<nowiki>catalyst_build_module ${kernver}</nowiki>}}, {{ic|<nowiki>${kernver}</nowiki>}}是指升级过后的内核版本。也可通过{{ic|catalyst_build_module all}}为所有安装的内核构建{{ic|<nowiki>catalyst-{kernver}</nowiki>}}。<br />
# 若要删除{{ic|catalyst-generator}}, 在使用{{ic|catalyst_build_module remove_all}}命令删除catalyst-generator之前最好切换到root用户,'''这会删除所有{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包.'''<br />
<br />
当删除{{ic|Catalyst-generator}}时,{{ic|Catalyst-generator}}不能自动删除那些{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包,这是因为pacman不允许有一个以上的实例同时运行。若在使用{{ic|# pacman -R catalyst-generator}}前忘记运行{{ic|# catalyst_build_module remove_all}},catalyst-generator将会询问删除catalyst-generator自身后要删除哪个{{ic|<nowiki>catalyst-{kernver}</nowiki>}}包。<br />
<br />
Catalyst-generator 是最安全的,最符合KISS原则的,因为:<br />
<br />
# 你可以使用非特权用户来构建包;<br />
# 它在 fakeroot 环境构建包;<br />
# 它不乱丢文件,[[pacman]]知道文件们在哪;<br />
# 你需要做的只是,记得去使用它<br />
<br />
{{注意|在构建 {{ic|<nowiki>catalyst-{kernver}</nowiki>}} 时,若看到下列警告,乃正常情况,不必莫名惊诧:<br />
<br />
'''WARNING:''' Package contains reference to $srcdir<br />
<br />
'''WARNING:''' '.pkg' is not a valid archive extension<br />
}}<br />
<br />
=== OpenCL / OpenGL 开发 ===<br />
<br />
这几年AMD一直在为OpenCL and OpenGL的开发做一套工具集。<br />
<br />
现在AMD在'''"Heterogeneous Computing"'''的旗帜下提供了更多的工具集,幸运的是它们也在Linux下可用。<br />
<br />
在AUR和 [catalyst] 软件仓库,你可以找到这些代表了AMD最重要工作的工具软件包:<br />
<br />
* {{AUR|amdapp-aparapi}}<br />
* {{AUR|amdapp-sdk}}<br />
* {{AUR|amdapp-codexl}}<br />
<br />
APP 这个缩写代表 Accelerated Parallel Processing(加速并行处理)。<br />
<br />
==== amdapp-aparapi ====<br />
AMD的Aparapi是一个用java实现的API,用于并行地表达图像数据,它同时也是一个能把java字节码翻译成能被OpenCL识别的运行时组件。所以它能够被很多种图形处理器(GPU)执行。如果Aparapi在GPU上不能执行,那将在java的线程池中执行。<br />
<br />
更多关于Aparapi的信息:[http://developer.amd.com/tools/heterogeneous-computing/aparapi/ here]。<br />
<br />
==== amdapp-sdk (以前的amdstream) ====<br />
AMD APP 软件开发工具套件,是一个由AMD制作地一套完整的开发平台。它让你能够快速和容易地使用AMD APP技术,使得你的程序得到加速。这个SDK提供了代码实例,技术文档和其他资料,让您可以在你的C\C++程序中使用 OpenCL, Bolt, or C++ AMP等技术实现计算加速。<br />
<br />
从2.8版本开始,amdapp-sdk 提供了 aparapiUtil 和 aparapi 的代码实例。有一个包已经加入到了[catalyst]软件仓库。它依赖于{{AUR|amdapp-aparapi}}。AUR中的软件包让你选择需不需要aparapi's additions。<br />
<br />
2.8 版本没有提供探查功能( Profiler functionality),它已经被移到CodeXL中了。<br />
<br />
关于 AMD APP SDK 的更多信息: [http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/ here]。<br />
<br />
==== amdapp-codexl ====<br />
CodeXL 是一个带有静态OpenCl内核分析器的OpenCL and OpenGL调试器和探查器。它具有GUI界面,是在著名的{{AUR|gdebugger}} 基础上完成的。它只支持 x86_64 系统。<br />
<br />
关于CodeXL的更多信息: [http://developer.amd.com/tools/heterogeneous-computing/codexl/ 这里]。<br />
<br />
== 功能 ==<br />
=== Tear Free Rendering ===<br />
<br />
在'''Catalyst 11.1'''中,很可能是添加了三重缓存和v-sync,''Tear Free Desktop''减少了2D,3D视频应用的屏幕撕裂毛病。但这需要额外的GPU处理。<br />
<br />
要启用'Tear Free Desktop',运行{{ic|amdcccle}},然后设置{{ic|Display Options}} → {{ic|Tear Free}}。<br />
<br />
或以root身份运行:<br />
<br />
# aticonfig --set-pcs-u32=DDX,EnableTearFreeDesktop,1<br />
<br />
若禁用,使用{{ic|amdcccle}}或以root身份运行:<br />
<br />
# aticonfig --del-pcs-key=DDX,EnableTearFreeDesktop<br />
<br />
=== 视频加速 ===<br />
<br />
'''[[wikipedia:Video_Acceleration_API|Video Acceleration API]] (VA API)'''是为基于Linux/UNIX操作系统提供利用GPU加速视频处理的一个开源函数库和应用程序接口规范。启用视频加速后,通过各种入口(VLD, IDCT, Motion Compensation, deblocking)它能加速常用编码标准(MPEG-2, MPEG-4 ASP/H.263, MPEG-4 AVC/H.264, and VC-1/WMV3)视频文件的解码过程(俗称硬解)。<br />
<br />
VA-API在{{AUR|xvba-video}}上有一个私有后端(2009年10月), 它允许使用VA-API的程序通过[[wikipedia:XvBA|XvBA (X-Video Bitstream Acceleration API designed by AMD)]]函数库来充分利用拥有uvd2(第二代通用视频解码单元)芯片组的视频加速功能.<br />
<br />
{{注意|使用 {{ic|catalyst-test}} 或者 {{ic|catalyst-total}} 时不需要安装 {{AUR|xvba-video}} , 因为有已经创建好的符号链接代替.}}<br />
xvba-video和支持XvBA的软件仍还在开发,'''但在大多数情况下它都能很好的工作'''. 通过AUR构建(或通过Vi0L0的仓库直接安装)专有{{AUR|xvba-video}}包,若这个版本对你来说有问题,用{{AUR|libva-xvba-driver}}取代; 并安装{{AUR|mplayer-vaapi}} and {{Pkg|libva}}。然后将视频播放器的视频输出设置为vaapi:gl:<br />
<br />
$ mplayer -vo vaapi:gl movie.avi<br />
<br />
此选项可添加到mplayer的配置文件,参考[[MPlayer]]。<br />
<br />
针对 '''smplayer''':<br />
<br />
Options → Preferences → General → Video (tab) → Output driver: User Defined : vaapi:gl<br />
Options → Preferences → General → Video (tab) → Double buffering '''on'''<br />
Options → Preferences → General → General → Screenshots → Turn screenshots '''off'''<br />
Options → Preferences → Performance → Threads for decoding: '''1''' (to turn off -lavdopts parameter)<br />
<br />
{{注意|如果启用了Tear Free Desktop,则按下列步骤:<br />
Options -> Preferences -> General -> Video (tab) -> Output driver: vaapi<br />
若视频输出中没有'''vaapi:gl'''选项 - 可使用:<br />
'''vaapi''', '''vaapi:gl2''' or 简单的 '''xv(0 - AMD Radeon [[wikipedia:Avivo|AVIVO Video]])'''.<br />
}}<br />
<br />
针对 '''VLC''':<br />
<br />
Tools → Preferences → Input & Codecs → Use GPU accelerated decoding<br />
<br />
它有助于在'''amdcccle'''中启用v-sync:<br />
<br />
3D → More Settings → Wait for vertical refresh = Always On<br />
<br />
{{注意|若使用'''Compiz/KWin''',消除'''画面抖动'''的唯一方法就是切换至'''全屏'''并且 '''关闭Redirected Fullscreen'''。<br />
<br />
使用'''compiz''',需在ccsm的General Options中设置'''Redirected Direct Rendering'''。若此举无效,则将其关闭。'''KWin'''默认关闭此功能,若出现画面抖动则通过{{ic|System Settings}} → {{ic|Desktop Effects}} → {{ic|Advanced}}.}}将"Suspend desktop effects for fullscreen windows"开启或关闭。}}<br />
<br />
=== 显卡/显存频率, 温度, 风扇转速, 超频工具 ===<br />
<br />
{{ic|$ aticonfig --od-getclocks}}可以获知当前显卡/显存频率。<br />
<br />
{{ic|$ aticonfig --pplib-cmd "get fanspeed 0"}}可以获知风扇转速(显卡);<br />
<br />
{{ic|$ aticonfig --odgt}}可以获知显卡温度。<br />
<br />
{{ic|$ aticonfig --pplib-cmd "set fanspeed 0 50"}}可以设置风扇转速,其中查询索引50代表速度百分比。<br />
<br />
若超频或与之相反,则使用图形工具反而相对容易些,如需要qt的'''ATi Overclocking Utility'''。你可以从[http://kde-apps.org/content/show.php/ATI+Overclock?content=47796 这儿]找到(不过它可能过时了).<br />
<br />
更复杂的{{AUR|amdoverdrivectrl}}也能达到此目的,它的主页是[http://sourceforge.net/projects/amdovdrvctrl here]。可通过[https://aur.archlinux.org/packages.php?ID=45298 AUR]或Vi0L0's非官方软件库构建安装包。<br />
<br />
=== 双屏显示 ===<br />
<br />
==== 介绍 ====<br />
<br />
{{警告|由于安装方式的不同,并且每种安装方式需要与其相对应进行配置,因此设置双屏显示并没有特定的方法,你必须根据你自己的需要采用相应的步骤。当然可以多尝试几种方法。'''所以,在修改之前,请务必将你现在能正常使用的{{ic|/etc/X11/xorg.conf}}备份,以便遇到问题时可以从命令行恢复.'''}}<br />
<br />
* 本节讲述如何配置"BIG Desktop"效果。主要是不同尺寸的屏幕如何通过两个不同的输出接口(DVI + HDMI)共享一个显卡。<br />
<br />
* Xinerama解决办法有些不便,尤其是不能与XrandR兼容。因为XrandR对于我们所讲的来说是必须的,所以不使用Xinerama。<br />
<br />
* 双头显示能让你有两个不同的会话(一个屏幕一个)。你可以随心所欲地干任何事情,但不能将窗口从一个屏幕移动到另一个屏幕。若只有一个屏幕,你得在Xorg会话里为Server Layout section的每个会话定义鼠标,具体方法查看:<br />
<br />
[http://support.amd.com/us/kbarticles/Pages/1105-HowCanIConfigureMultip.aspx ATI Documentation]<br />
<br />
==== ATI Catalyst Control Center ====<br />
<br />
ATI的图形工具非常有用,我们将尽可能地使用它。运行下面命令可启用它:<br />
<br />
$ {kdesu/gksu} amdcccle<br />
<br />
{{警告|'''千万不要'''直接使用sudo。 Sudo虽能给予管理员权限,却使用用户账户的信息(如环境变量)。GNOME下使用''gksu'',KDE下使用''kdesu''。}}<br />
<br />
==== 安装 ====<br />
<br />
开始之前,确保你的硬件接插正确,电源开启,而且你得你的硬件属性(2D还是3D屏,屏幕尺寸,刷新率等)。通常情况下,在启动阶段两个显示器都会被识别却不需正确区分先后顺序,而是依赖热插拔功能。尤其在不使用({{ic|/etc/X11/xorg.conf}})配置时。<br />
<br />
首先要让你的桌面环境和X认识你的显示器。为此,要为你两个显示器生成基本的Xorg配置文件:<br />
<br />
# aticonfig --initial --desktop-setup=horizontal --overlay-on=1<br />
<br />
或<br />
<br />
# aticonfig --initial=dual-head --screen-layout=left<br />
<br />
{{注意|{{ic|overlay}}非常重要,因为它能让两个显示器拥有1种(多种)像素。<br />
{{提示|运行{{ic|aticonfig --help}}了解所有可用的命令。}}<br />
<br />
现在可编辑基本的Xorg配置文件(如:添加分辨率)。分辨率一定要正确,尤其是使用不同尺寸的显示器。分辨率在"Screen" section:<br />
<br />
SubSection "Display"<br />
Depth 24<br />
Modes "X-resolution screen 1xY-resolution screen 1" "Xresolution screen 2xY-resolution screen 2"<br />
EndSubSection<br />
<br />
这以后就不需手动编辑{{ic|xorg.conf}},而ATI的图形化工具。重启X,确保正确支持两个显示器和识别屏幕分辨率(两个屏幕相互独立而不是完全一样。<br />
<br />
==== 设置 ====<br />
<br />
现在只需以root身份启动ATI控制中心,在显示菜单设置你需要的选项(下拉菜单中的小箭头)。设置好后重启X就大功造成(你和我都可松口气了,这段翻译有点难度,呵呵)!<br />
<br />
重启X之前,不要忘了核实{{ic|xorg.conf}}。主要是核实"Display"下的"Screen"节, 在"Virtual"行里,两个显示器的分辨率应该一样。"Server Layout"节则是剩下的参数。<br />
<br />
== 卸载 ==<br />
<br />
你可能会因为catalyst不工作或者是想试试开源驱动而要卸载掉catalyst:移除 {{ic|catalyst}} 和 {{ic|catalyst-utils}} 包. 当然你也应该移除 {{AUR|catalyst-generator}}, {{AUR|catalyst-hook}} 和 {{AUR|lib32-catalyst-utils}} 包(如果你安装了的话).<br />
<br />
{{警告|<br />
*你也许需要使用 {{ic|# pacman -Rdd}} 来移除 {{AUR|catalyst-utils}} (和/或 {{AUR|lib32-catalyst-utils}}) 因为它(们)包含了 ''gl'' 相关文件,许多包会依赖他们. 这些依赖关系将在安装{{Pkg|xf86-video-ati}}时被满足.<br />
*你也许会需要移除 {{ic|/etc/profile.d/ati-flgrx.sh}} 和 {{ic|/etc/profile.d/lib32-catalyst}} (如果他们存在), 否则 {{ic|r600_dri.so}} 将会载入失败,你将得不到3D支持.}}<br />
<br />
{{注意|你应该从 {{ic|/etc/pacman.conf}} 移除非官方仓库,然后运行 {{ic|# pacman -Syu}}, 因为那些仓库包含过时的Xorg包(为了兼容{{ic|catalyst}}),而 {{Pkg|xf86-video-ati}} 包需要来自[[Official repositories|官方仓库]]的最新的Xorg包.}}<br />
<br />
按如下步骤:<br />
<br />
* 如果你有 {{ic|/etc/modprobe.d/blacklist-radeon.conf}} ,删除文件或者注释掉文件中的{{ic|blacklist radeon}}.<br />
* 如果你在 {{ic|/etc/modules-load.d}} 下有配置文件要在启动时载入 {{ic|fglrx}} 模块, 删除掉或者注释掉 {{ic|fglrx}} 那一行.<br />
* 记住删除/备份 {{ic|/etc/X11/xorg.conf}}.<br />
* 如果安装了 {{AUR|catalyst-hook}} 包,记得关掉它的systemd服务的自启动.<br />
* 如果你在 [[kernel parameters|内核参数]] 中指定了{{ic|nomodeset}}而现在你打算使用KMS,那么删除{{ic|nomodeset}}.<br />
<br />
* 安装另一个驱动之前记得'''重启''' .<br />
<br />
== 故障排除 ==<br />
<br />
若能启动到命令行,问题很可能出在{{ic|/etc/X11/xorg.conf}}<br />
<br />
可阅读{{ic|/var/log/Xorg.0.log}}或通过下列命令查找线索:<br />
<br />
$ grep '(EE)' /var/log/Xorg.0.log<br />
$ grep '(WW)' /var/log/Xorg.0.log<br />
<br />
若看不懂显示的是什么东东,请先搜索论坛,没有结果的话,可将其提交到[https://bbs.archlinux.org/viewtopic.php?pid=1166052#p1166052/ thread specific to ATI/AMD],注意要提交两者显示的信息。<br />
<br />
=== 运行 atieventsd.service 失败 ===<br />
从 [[official repositories_(简体中文)|官方仓库]] 安装 {{Pkg|acpid}}. 启用并运行acpid[[Daemon_(简体中文)|守护进程]].<br />
<br />
如果还不行, 编辑 {{ic|/usr/lib/systemd/system/atieventsd.service}} ,把 {{ic|acpid.socket}} 改成 {{ic|acpid.service}}.<br />
<br />
=== 无法打开 fglrx_dri.so ===<br />
创建从 {{ic|/usr/lib/xorg/modules/dri/fglrx_dri.so}} 到 {{ic|/usr/X11R6/lib64/modules/dri/fglrx_dri.so}} 或其它需要路径的链接:<br />
<br />
# mkdir -p /usr/X11R6/lib64/modules/dri<br />
# ln -s /usr/lib/xorg/modules/dri/fglrx_dri.so /usr/X11R6/lib64/modules/dri/fglrx_dri.so<br />
<br />
=== 启动 GDM 失败 ===<br />
降级 {{pkg|xorg-server}} 或者试试其它 [[Display manager_(简体中文)|显示管理器]] 比如 [[LightDM]].<br />
<br />
=== 在Wine上3D应用冻结 ===<br />
若在Wine上3D应用挂起,禁用TLS。使用{{ic|aticonfig}}或编辑{{ic|/etc/X11/xorg.conf}}。使用{{ic|aticonfig}}:<br />
<br />
# aticonfig --tls=off<br />
<br />
或以root身份打开{{ic|/etc/X11/xorg.conf}},在''Device''段添加{{ic|Option "UseFastTLS" "off"}}。<br />
<br />
只需来个二选一,然后重启X让其生效。<br />
<br />
=== 视频颜色不正常 ===<br />
<br />
仍然使用{{ic|vaapi:gl}}来防止画面抖动,但这样不会有视频加速:<br />
<br />
* 不使用{{ic|-vo vaapi}}运行'''mplayer'''。<br />
<br />
* 若是'''smplayer''',在Options → Preferences → Advanced → Options for MPlayer → Options:中删除{{ic|-vo vaapi}}。<br />
<br />
此后还可以启动'''smplayer'''的截屏功能。<br />
<br />
=== KWin 与混成 ===<br />
<br />
根据你的显卡,在OpenGL和XRender渲染方式中选择一种更快的。<br />
在某些情况下,XRender还可以解决一些人为的错误(比如调整命令行大小)。<br />
<br />
=== 重启或启动x后,黑屏并且一直不退出 ===<br />
<br />
检查在启动加载器的内核参数行是否添加了{{ic|nomodeset}}(参考 [[#禁用KMS]])。<br />
你如果在使用legacy驱动 ({{ic|catalyst-hd234k}}) 黑屏的话, 尝试降级 xorg-server 到 1.12 (使用 [[#xorg112]] 库).<br />
<br />
==== 错误的ACPI硬件调用 ====<br />
<br />
出现此种错误很可能是fglrx模块与系统的ACPI硬件调用配合不够默契而自身禁用,屏幕也就不会有输出。<br />
<br />
果真那样,运行:<br />
<br />
$ aticonfig --acpi-services=off<br />
<br />
=== 注销后KDM消失 ===<br />
<br />
若使用Catalyst,当注销后你会获取tty1这个控制台而不是KDM的欢迎界面。每次注销后你必须让kdm重启X服务器. 将标题为{{ic|[X-:*-Core]}}段里下面行前的注释删掉:<br />
<br />
{{hc|/usr/share/config/kdm/kdmrc|2=<br />
TerminateServer=True<br />
}}<br />
<br />
<br />
<br />
当前注销KDE后KDM就会出现。<br />
<br />
=== 直接渲染无效 ===<br />
<br />
{{警告|在安装或升级catalyst后却没重启系统,也有可能出现此种错误,因为系统需要加载fglrx.ko模块来让驱动正常工作。}}<br />
若直接渲染有问题,运行:<br />
<br />
$ LIBGL_DEBUG=verbose glxinfo > /dev/null<br />
<br />
从此命令输出的第一行至末尾都与直接渲染无效有关,且非常详细。<br />
<br />
常见错误提示和解决办法:<br />
<br />
libGL error: XF86DRIQueryDirectRenderingCapable returned false<br />
<br />
* Ensure that you are loading the correct agp modules for your AGP chipset before you load the {{ic|fglrx}} kernel module. To determine which agp modules you will need, run {{ic|# hwdetect --show-agp}}. Then open your {{ic|/etc/modules-load.d/fglrx.conf}} and add the agp module on a line '''before''' the {{ic|fglrx}} line.<br />
* 若使用AGP的芯片组,确保加载fglrx模块之前加载正确的agp模块。要确定哪些agp模块,运行{{ic|hwdetect --show-agp}},然后打开{{ic|/etc/modules-load.d}}下的{{ic|fglrx.conf}},将agp模块添加到fglrx行'''之前'''。<br />
<br />
libGL error: failed to open DRM: Operation not permitted<br />
libGL error: reverting to (slow) indirect rendering<br />
<br />
libGL: OpenDriver: trying /usr/lib/xorg/modules/dri//fglrx_dri.so<br />
libGL error: dlopen /usr/lib/xorg/modules/dri//fglrx_dri.so failed<br />
(/usr/lib/xorg/modules/dri//fglrx_dri.so: cannot open shared object file: No such file or directory)<br />
libGL error: unable to find driver: fglrx_dri.so<br />
<br />
* 某些软件未正确安装。在错误提示中,若路径为{{ic|/usr/X11R6/lib/modules/dri/fglrx_dri.so}},彻底注销,然后重新登录。若使用图形化的登录管理器(gdm, kdm, xdm),确保每次登录时{{ic|/etc/profile}}都会被读取。将{{ic|source /etc/profile}}添加到{{ic|~/.xsession}}或{{ic|~/.xinitrc}}通过都达到以上目的(不同的登录管理器修改的文件不一样)。<br />
<br />
* 若路径为{{ic|/usr/lib/xorg/modules/dri/fglrx_dri.so}},试着重装{{AUR|catalyst}}包。<br />
<br />
若错误信息为:<br />
<br />
fglrx: libGL version undetermined - OpenGL module is using glapi fallback<br />
<br />
可能是因为系统装了多个版本的{{ic|libGL.so}}.下面的命令应该得到这样的回显:<br />
<br />
{{hc|$ locate libGL.s|<br />
<br />
/usr/lib/libGL.so<br />
/usr/lib/libGL.so.1<br />
/usr/lib/libGL.so.1.2}}<br />
<br />
系统应只有3个libGL.so文件,若不止(例如{{ic|/usr/X11R6/lib/libGL.so.1.2}}),则将其删除。<br />
<br />
若使用X11R7且系统中有下列文件,系统并不会给出任何错误提示,一定要将他们删除:<br />
<br />
/usr/X11R6/lib/libGL.so.1.2<br />
/usr/X11R6/lib/libGL.so.1<br />
<br />
=== 休眠问题 ===<br />
<br />
==== 视频播放不能从休眠状态中恢复 ====<br />
<br />
若启动了framebuffer,Catalyst不能从挂机状态中恢复。在[[kernel parameters|内核参数]]中添加 {{ic|1=vga=0}} 可禁用framebuffer。<br />
<br />
其他加载器,参考[[#禁用KMS]]。<br />
<br />
=== 系统冻结或硬件锁死 ===<br />
<br />
* 过去,{{ic|radeonfb}}的framebuffer驱动很容易导致这个问题。若内核编译时启用对radeonfb的支持,应换内核看是否能解决此问题。<br />
<br />
* 若退出桌面环境(关机、挂机和切换到tty等)时系统冻结,很可能忘记禁用KMS。(参见 [[#禁用KMS]])<br />
<br />
=== 硬件冲突 ===<br />
<br />
当和某些版本的nForce3芯片组一起使用时,Radeon不能3D加速。目前虽还未找到具体原因,但有资料表明: indicate that it may be possible to get acceleration with this combination of hardware by booting with the drivers from 先用nVIDIA驱动启动到Windows然后再重启系统就可能获得3D加速。在root控制台使用下列命令可识别此问题(会得到与下列相似(使用基于nForce3系统)的输出:):<br />
<br />
{{hc|<nowiki>$ dmesg | grep agp</nowiki>|<br />
agpgart: Detected AGP bridge 0<br />
agpgart: Setting up Nforce3 AGP.<br />
agpgart: aperture base > 4G<br />
}}<br />
<br />
或者还有下面的命令得到如下的回显:<br />
<br />
{{hc|<nowiki>$ tail -n 100 /var/log/Xorg.0.log | grep agp</nowiki>|<br />
(EE) fglrx(0): [agp] unable to acquire AGP, error "xf86_ENODEV"}}<br />
<br />
则就有问题。<br />
<br />
有些资料说在某些情形下降级主板的BIOS可能有助于解决问题,但注意此方法并不是在各种情况下都适用,而且'''方法不对则很可能让显卡报废。'''<br />
<br />
参考[http://bugzilla.kernel.org/show_bug.cgi?id=6350 这个错误报告]。<br />
<br />
=== 播放视频时系统短时间死机 ===<br />
<br />
使用Catalyst可导致此问题。<br />
<br />
当用mplayer,若不定时出现几秒到几分钟的死机。查看日志,若有与下面相似的信息:<br />
<br />
{{hc|/var/log/messages.log|2=<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium [<f8bc628c>] ? ip_firegl_ioctl+0x1c/0x30 [fglrx]<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium [<c0197038>] ? vfs_ioctl+0x78/0x90<br />
Nov 28 18:31:56 pandemonium [<c01970b7>] ? do_vfs_ioctl+0x67/0x2f0<br />
Nov 28 18:31:56 pandemonium [<c01973a6>] ? sys_ioctl+0x66/0x70<br />
Nov 28 18:31:56 pandemonium [<c0103ef3>] ? sysenter_do_call+0x12/0x33<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium =======================<br />
}}<br />
<br />
给内核参数添加{{ic|nopat}}和/或{{ic|nomodeset}}到[[kernel parameters|内核参数]]应该能行<br />
<br />
=== "aticonfig: No supported adaptaters detected" ===<br />
<br />
若得到:<br />
<br />
{{hc|# aticonfig --initial|<br />
aticonfig: No supported adapters detected<br />
}}<br />
<br />
可以在{{ic|etc/X11/xorg.conf}}中设置device,或者复制以前的能工作的 {{ic|/etc/ati/control}} 文件 (推荐 - 这也能解决水印的问题),这可能让Catalyst正常工作.<br />
<br />
从AMD下载先前版本的fglrx,使用{{ic|--extract driver}}参数运行. 文件将提取到{{ic|driver/common/etc/ati/control}}. 用它覆盖原来的control文件后重启X. 你可以试试不同版本的.<br />
<br />
设置型号的方法:在{{ic|/etc/X11/xorg.conf}}将device段设置为:<br />
<br />
{{hc|/etc/X11/xorg.conf|<br />
Section "Device"<br />
Identifier "ATI radeon '''****'''"<br />
Driver "fglrx"<br />
EndSection<br />
}}<br />
<br />
此处{{ic|****}}为设备型号(6870 for the HD 6870的显卡为6870,APU E-350为6310,通过网络是很容易查到的).<br />
<br />
Xorg启动后很可能使用{{ic|amdcccle}}而不是{{ic|aticonfig}}。这里会有一个"AMD不支持硬件"水印。<br />
<br />
用下面脚本可将此水印删除:<br />
<br />
#!/bin/sh<br />
DRIVER=/usr/lib/xorg/modules/drivers/fglrx_drv.so<br />
for x in $(objdump -d $DRIVER|awk '/call/&&/EnableLogo/{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6}'); do<br />
sed -i "s/$x/\x90\x90\x90\x90\x90/g" $DRIVER<br />
done<br />
<br />
然后重启。<br />
<br />
=== 让chromium支持WebGL ===<br />
<br />
在Google的Chromium/Chrome浏览器里,Linux的Catalyst驱动被列入了黑名单。参见 [[Chromium#WebGL]] .<br />
<br />
=== 用Adobe的flashplugin观看flash,画面迟滞或冻结 ===<br />
<br />
编辑:<br />
<br />
{{hc|/etc/adobe/mms.cfg|2=<br />
#EnableLinuxHWVideoDecode=1<br />
OverrideGPUValidation=true<br />
}}<br />
<br />
如果你使用KDE,请确保 系统设置->工作空间外观与行为->桌面效果->高级 里,"为全屏窗口挂起桌面特效" 没有勾选.<br />
<br />
=== GNOME3中移动窗口延迟/很慢 ===<br />
你可以试试这么做,有报告称大多数情况下此方法有效。<br />
<br />
将下面行添加到{{ic|~/.profile}}或{{ic|/etc/profile}}:<br />
<br />
export CLUTTER_VBLANK=none<br />
<br />
重启X或操作系统。<br />
<br />
=== 在1920x1080分辨率下不能全屏(欠扫描,屏幕周围有黑边) ===<br />
<br />
这经常会在使用HDMI连接显示器/电视时发生.<br />
<br />
这似乎是AMD/ATI为适应所有HDTV的一项新功能,可以在amdccle中调整.<br />
<br />
使用amdcccle(图形界面)你可以选择要修改的显示输出,将欠扫描设置成0% (aticonfig默认15%欠扫描). (至少)版本14.10有时也会出现显示调整的下面没有欠扫描的滑块的情况.(It is possible as well that the underscan slider won't show under the display's adjustments, as sometimes in (at least) version 14.10.)<br />
<br />
这不是永久的配置,重启X,重启系统,挂起后唤醒甚至切换tty之后都会失效.<br />
<br />
要使这成为永久配置的话,你需要以root身份在console下使用aticonfig来调整欠扫描设置,或者手动编辑 {{ic|/etc/ati/amdpcsdb}} (也是以root身份)<br />
<br />
'''用aticonfig的方法:'''<br />
<br />
# aticonfig --set-pcs-u32=MCIL,DigitalHDTVDefaultUnderscan,0<br />
<br />
改变设置后重启.<br />
<br />
新版本的话(比如12.11), 要是ccc总不能保存过扫描设置,你可以试试:<br />
<br />
# aticonfig --set-pcs-u32=MCIL,TVEnableOverscan,0<br />
<br />
'''手动编辑/etc/ati/amdpcsdb的方法:'''<br />
<br />
在 {{ic|[AMDPCSROOT/SYSTEM/MCIL]}} 之下的任意位置添加<br />
<br />
# DigitalHDTVDefaultUnderscan=V0<br />
<br />
新版本的话(比如12.11), 要是ccc总不能保存过扫描设置,你可以试试:<br />
在 {{ic|[AMDPCSROOT/SYSTEM/MCIL]}} 之下找到这一行<br />
<br />
# TVEnableOverscan=V1<br />
<br />
然后把它变成<br />
<br />
# TVEnableOverscan=V0<br />
<br />
改变设置后重启.<br />
<br />
{{note|也许你会发现,无论你怎么干,登录/注销/重启后, {{ic|/etc/ati/amdpcsdb}} 总是被覆写/还原, 于是你的修改就不见了 _(:з」∠)_.(You might find that the file /etc/ati/amdpcsdb will be overwritten and revert no matter what you do as user or as root even with log in/log out/reboot, ergo the modification will not stick.)<br />
所以你得在fglrx没运行的时候改它.<br />
可以试着重启进入什么不需要运行fglrx的"安全模式"什么的,或者是直接进console模式}}<br />
<br />
'''应对措施:'''<br />
要是因某些原因你不想动ATI的配置文件,你可以设置面板的位置与分辨率来规避问题<br />
以普通用户运行:<br />
<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,positionX:0<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,positionY:0<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,sizeX:1920<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,sizeY:1080<br />
<br />
{{ic|DISPLAYTYPE}}代表你想改的显示器,比如"dfp9".<br />
用如下命令获得你的 {{ic|DISPLAYTYPE}} :<br />
<br />
# xrandr --current<br />
<br />
如果没启用RandR的话,你可以用这个:<br />
<br />
# aticonfig --query-monitor<br />
<br />
也许需要用显示开关或 DISPLAY 变量来设置适当的显示/屏幕(比如 :0.1).<br />
<br />
这将告诉你目前哪一个显示正连接着或断开着,以及它的详情<br />
<br />
这个应对措施不是永久配置,不过是个让面板及上边内容看起来合适的方便快捷的方法<br />
<br />
{{note|新版驱动不应再使用{{ic|<nowiki>aticonfig --set-pcs-val=MCIL,DigitalHDTVDefaultUnderscan,0</nowiki>}}, ATI声明过这已被弃用并即将被移除.}}<br />
<br />
用 {{ic|<nowiki>aticonfig --help | grep set-pcs-val</nowiki>}} 来阅读ATI的说明.<br />
<br />
=== 双屏设置: 关于加速,OpenGL,合成,效能的一般问题 ===<br />
试着禁用 xinerama 和 xrandr12. 如下:<br />
<br />
输入:<br />
# aticonfig --initial<br />
# aticonfig --set-pcs-str="DDX,EnableRandR12,FALSE"<br />
然后重启系统. 在 {{ic|/etc/X11/xorg.conf}} 中检查 xinerama 是不是被禁用了, 如果没有,禁用它,然后重启系统.( In /etc/X11/xorg.conf check that xinerama is disabled, if it's not disable it and reboot your system. )<br />
<br />
接下来运行{{ic|amdcccle}},如下: amdcccle→显示管理→多屏幕显示→以display(s) 2多屏显示桌面(amdcccle->display manager->multi-display->multidisplay desktop with display(s) 2. ).<br />
<br />
再次重启,再按你的想法设置显示.<br />
<br />
=== 禁用VariBright功能 ===<br />
[http://support.hp.com/vn-en/document/c02848104 Vari-Bright] 动态调整显示面板用电量以节能.<br />
输入以下命令以禁用 VariBright:<br />
# aticonfig --set-pcs-u32=MCIL,PP_UserVariBrightEnable,0<br />
<br />
=== Hybrid/PowerXpress: 关掉独立GPU ===<br />
当你使用 {{AUR|catalyst-total-pxp}} 或 catalyst-utils-pxp 时,你也许会发现切换到集成GPU时,独立GPU仍在工作,又耗电又使得系统温度很高. <br />
<br />
对于集显是intel的话你可以通过 {{ic|vgaswitcheroo}} 来关掉独立GPU.<br />
不过很不幸有些时候不行...<br />
<br />
然后这时你可以试试 {{Pkg|acpi_call}}. MrDeepPurple准备好了脚本来完成这个任务.脚本在启动和恢复系统的时候通过systemd服务调用.<br />
这是他的脚本:<br />
#!/bin/sh<br />
libglx=$(/usr/lib/fglrx/switchlibglx query)<br />
modprobe acpi_call<br />
if [ "$libglx" = "intel" ]; then<br />
echo '\_SB.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call<br />
fi<br />
<br />
=== 从X会话切换到TTY黑屏/低分辨率TTY ===<br />
接受这个"功能"吧,这出现在catalys 13.2 beta,解决方法是使用{{ic|1=vga=}}内核选项,比如{{ic|1=vga=792}}。<br />
使用<br />
$ hwinfo --framebuffer<br />
来得到支持的分辨率列表<br />
选择最适合你的分辨率,粘贴到启动引导器的内核行,比如 {{ic|1=vga=0x03d4}}<br />
<br />
=== 从X会话切换到TTY黑屏,背光并没有关闭 ===<br />
使用 [[uvesafb]] 作为 framebuffer 驱动. 而且, {{ic|uvesafb}} 可以为 TTY 设置任意分辨率.<br />
<br />
=== 切换TTY后切换回X会话时,只有一个带鼠标的黑屏 ===<br />
如果你遇到了这个bug的话,试着添加<br />
Option "XAANoOffscreenPixmaps" "true"<br />
到你的 xorg.conf 的 'Device' 部分.<br />
<br />
同时, 确认已安装有 [[Polkit#Authentication agents|polkit 认证代理]] 并正在运行, 因为这种情况可能会在某程序想要请求密码但没有认证代理来显示密码对话框时出现.<br />
<br />
=== 30 FPS / Tear-Free / V-Sync bug ===<br />
这个Bug发生于Catalyst 13.6 beta, 到现在(13.9)还没修复.<br />
<br />
激活 "Tear Free"(防撕裂) 功能之后,所有新启动的OpenGL程序都出现延迟,常表现为只有30 FPS,复合桌面环境也是.("After enabling "Tear Free" functionality every freshly started OpenGL application is lagging, often generates only 30 FPS, it also touches composited desktop.")<br />
<br />
M132找到一个解决方法.在 "AMD Catalyst Control Center" (amdcccle) 里完成这些操作:<br />
<br />
1. 开启 Tear-Free, 这将设置 3D V-Sync 为"总是开启".<br />
2. 设置 3D V-Sync 为"总是关闭".<br />
3. 确认 Tear-Free 仍为"开启".<br />
4. 重启X/重登录.<br />
<br />
这在KDE 4.11.x下有效.M132的建议: "试着关闭 "Detect refresh rate" ,并为复合插件("Composite plugin")指定显示器刷新率."<br />
<br />
=== 背光调节不起效 ===<br />
如果你的背光调节有问题, 你可以试试:<br />
# aticonfig --set-pcs-u32=MCIL,PP_PhmUseDummyBackEnd,1<br />
一些用户报告说这导致FPS降低.要恢复默认的话:<br />
# aticonfig --set-pcs-u32=MCIL,PP_PhmUseDummyBackEnd,0<br />
[http://ati.cchtml.com/show_bug.cgi?id=711 更多信息见此]<br />
<br />
=== 使用 plasma 时 Chromium 出现毛刺(glitching) ===<br />
添加 --disable-gpu 参数来启动 chromium, 比如,对 /usr/share/applications/chromium.desktop, 改成这样:<br />
# cat /usr/share/applications/chromium.desktop | grep -i exec<br />
Exec=chromium %U --disable-gpu<br />
<br />
== 参见 ==<br />
<br />
* [http://wiki.cchtml.com/index.php/Main_Page Unofficial Wiki for the ATI Linux Driver]<br />
* [http://ati.cchtml.com/query.cgi Unofficial ATI Linux Driver Bugzilla]</div>
Aaron chen
https://wiki.archlinux.org/index.php?title=Network_configuration_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)/Wireless_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=408887
Network configuration (简体中文)/Wireless (简体中文)
2015-11-11T11:35:41Z
<p>Aaron chen: /* 手动设置 */</p>
<hr />
<div>[[Category:Wireless networking (简体中文)]]<br />
[[cs:Wireless network configuration]]<br />
[[de:(W)LAN und Arch Linux]]<br />
[[el:Wireless network configuration]]<br />
[[en:Wireless network configuration]]<br />
[[es:Wireless network configuration]]<br />
[[fr:Wifi]]<br />
[[it:Wireless network configuration]]<br />
[[ja:ワイヤレス設定]]<br />
[[nl:Wireless network configuration]]<br />
[[ro:Wireless]]<br />
[[ru:Wireless network configuration]]<br />
[[th:Wireless network configuration]]<br />
[[tr:Kablosuz bağlantı]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Network configuration}}<br />
{{Related|Software access point}}<br />
{{Related|Ad-hoc networking}}<br />
{{Related|Internet sharing}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Wireless_network_configuration|2014-06-21|320903}}<br />
{{Translateme (简体中文)|.}}<br />
配置无线网络一般分两步:第一步是识别硬件、安装正确的驱动程序并进行配置,安装盘中已经包含驱动,但是通常需要额外安装;第二步是选择一种管理无线连接的方式。这篇文章涵盖了这两方面,并提供了无线管理工具的链接地址。<br />
<br />
== 设备驱动 ==<br />
默认的 Arch Linux 内核是'''模块化'''的,,硬件的设备驱动作为[[Kernel modules|内核模块]]保存在硬盘上。启动时 [[udev]] 会根据硬件加载不同的驱动模块,这就创建了需要的网络接口。<br />
<br />
有些无线芯片需要额外的固件,默认安装的 {{Pkg|linux-firmware}} 提供了很多固件。如果缺失需要的固件,请查看 [[#安装 driver/firmware]].<br />
<br />
Udev 不是完美的,有些内核模块需要[[Kernel modules#Loading|手动安装]]. 有些时候 Udev 会同时加载相互冲突的多个模块,就需要[[Kernel modules#Blacklisting|屏蔽]] 不需要的模块。<br />
<br />
=== 检查设备状态 ===<br />
<br />
根据设备是 PCI 还是 USB 连接,执行 {{ic|lspci -k}} 或 {{ic|lsusb -v}} 检查设备驱动是否已经加载:<br />
<br />
{{hc|$ lspci -k|<nowiki><br />
06:00.0 Network controller: Intel Corporation WiFi Link 5100<br />
Subsystem: Intel Corporation WiFi Link 5100 AGN<br />
Kernel driver in use: iwlwifi<br />
Kernel modules: iwlwifi<br />
</nowiki>}}<br />
<br />
如果是 USB 设备,执行 {{ic|<nowiki>dmesg | grep usbcore</nowiki>}} 可以看到类似下面的输出 {{ic|usbcore: registered new interface driver rtl8187}}。<br />
<br />
通过 {{ic|ip link}} 查看无线 ([[Network configuration#Device names|设备名]],通常是类似 {{ic|wlp2s1}}) 的设备。启用设备:<br />
<br />
# ip link set <设备名> up<br />
<br />
如果设备加载,接口正常启用,说明不需要安装额外的驱动和固件。<br />
<br />
=== 安装 driver/firmware ===<br />
错误信息{{ic|SIOCSIFFLAGS: No such file or directory}} 说明需要固件才能工作, <br />
<br />
检查内核中的固件信息:<br />
<br />
{{hc|<nowiki>$ dmesg | grep firmware</nowiki>|<nowiki><br />
[ 7.148259] iwlwifi 0000:02:00.0: loaded firmware version 39.30.4.1 build 35138 op_mode iwldvm<br />
</nowiki>}}<br />
<br />
如果没有类似的输出,先执行命令,例如{{ic|iwlwifi}},然后查找对应的错误信息:<br />
<br />
{{hc|<nowiki>$ dmesg | grep iwlwifi</nowiki>|<nowiki><br />
[ 12.342694] iwlwifi 0000:02:00.0: irq 44 for MSI/MSI-X<br />
[ 12.353466] iwlwifi 0000:02:00.0: loaded firmware version 39.31.5.1 build 35138 op_mode iwldvm<br />
[ 12.430317] iwlwifi 0000:02:00.0: CONFIG_IWLWIFI_DEBUG disabled<br />
...<br />
[ 12.430341] iwlwifi 0000:02:00.0: Detected Intel(R) Corporation WiFi Link 5100 AGN, REV=0x6B<br />
</nowiki>}}<br />
<br />
根据获得的信息,在下面网址查找硬件支持:<br />
<br />
* [https://help.ubuntu.com/community/WifiDocs/WirelessCardsSupported Ubuntu Wiki] 维护了一个设备被内核和用户空间驱动支持状况的列表。<br />
* [http://linux-wless.passys.nl/ Linux 无线支持页面] 和[http://www.linuxquestions.org/hcl/index.php?cat=10 硬件兼容性列表](HCL)也维护了一个内核友好的设备列表。<br />
* [http://wireless.kernel.org/en/users/Devices 内核页面] 也有一个支持的硬件矩阵。<br />
<br />
如果列表中没有,可能你的设备只提供了 Windows 驱动(比如 Broadcom, 3com 等)。这时需要用 [http://ndiswrapper.sourceforge.net/wiki/index.php/List ndiswrapper]. <br />
<br />
Ndiswrapper 可以在 Linux 中使用 Windows 驱动。兼容性列表在 [http://ndiswrapper.sourceforge.net/mediawiki/index.php/List 这里]. 需要 Windows 中安装的 {{ic|.inf}} 和 {{ic|.sys}} 文件。如果有更新的网卡,请通过互联网搜索型号名称 + 'linux' 以获取更多信息。<br />
<br />
== 无线网络管理 ==<br />
为了管理已经安装好的无线驱动,并且使无线能正常工作,需要安装一个无线连接管理工具。下面章节将帮助您确定一个最佳管理方法。<br />
<br />
过程和需要使用的工具,将依赖于下面几个因素:<br />
* 配置方式,从完全手动执行每一步到软件自动管理、自动启动<br />
* 是否使用加密及加密类型<br />
* 是否需要区分网络配置,是否经常切换不同网络(比如手提电脑)。<br />
<br />
无论选的那个方案,最好先尝试手动方法。这将有助于您了解不同步骤的意义,并在出问题时解决之。 <br />
如果可以的话(比如说你在管理你自己的无线接入点),尝试连接一个开放的无线网络来检查是否所有的配置都在正常工作。然后再尝试加密的无线接入点,比如WEP(更易于配置)或者WPA。<br />
<br />
此表列出可以使用的激活和管理无线网络的方法,按照加密和管理方式分类,给出了需要的工具。虽然还有其他办法,但这些是最常使用的:<br />
<br />
{| class="wikitable"<br />
! 管理方法 || 接口激活 || 无线连接管理 <br>(/=alternatives) || IP 地址分配 <br>(/=alternatives) <br />
|-<br />
| [[#手动设置|手动设置]], <br>无加密或 WEP 加密 || [[Core utilities (简体中文)#ip|ip]] || {{Pkg|iw}} / [https://www.archlinux.org/packages/?name=wireless_tools iwconfig] || [[Core utilities (简体中文)#ip|ip]] / [[dhcpcd]] / {{Pkg|dhclient}}<br />
|-<br />
| [[#手动设置|手动管理]], <br> WPA 或 WPA2 PSK 加密 || [[Core utilities (简体中文)#ip|ip]] || {{Pkg|iw}} / [https://www.archlinux.org/packages/?name=wireless_tools iwconfig] + [[WPA supplicant (简体中文)|wpa_supplicant]] || [[Core utilities (简体中文)#ip|ip]] / [[dhcpcd]] / {{Pkg|dhclient}}<br />
|-<br />
| [[#自动设置|自动管理]], <br>支持网络配置 || colspan="3" align="center" | [[netctl (简体中文)|netctl]], [[Wicd (简体中文)|Wicd]], [[NetworkManager (简体中文)|NetworkManager]], etc.<br><br />
这些工具会自动安装手动配置需要的工具。<br />
|}<br />
<br />
=== 手动设置 ===<br />
软件包 {{pkg|wireless_tools}} 提供了建立无线连接的基础工具。如果你需要使用 WPA/WPA2 加密,还需要 {{pkg|wpa_supplicant}}。 这些强大的用户空间终端工具提供了完全的控制手段。<br />
<br />
这些例子假设无线设备是 {{ic|wlan0}}, 请将其替换为正确的设备名。<br />
{{注意| 根据硬件和加密方式的不同,下面一些步骤可以省略。有些设备需要在建立关联时激活接口或扫描访问点,并提供 IP 地址。需要进行一些尝试,例如 WPA/WPA2 用户可以直接到第三步激活无线网络。}}<br />
<br />
和其它网络接口一样,无线设备也是通过 {{Pkg|iproute2}} 软件包提供的 ip 命令进行。<br />
<br />
基本的工具如下,这些用户空间工具可以对无线连接进行完整控制。<br />
* {{Pkg|iw}} - 当前的 nl80211 标准,不是所有的芯片都支持。<br />
* {{Pkg|wireless_tools}} - 已经过时,但是依然广泛使用。<br />
* {{Pkg|wpa_supplicant}} - 提供 WPA/WPA2 加密支持<br />
<br />
下面表格给出了 {{ic|iw}} 和 {{ic|wireless_tools}} 命令的对比(更多示例参阅 [http://wireless.kernel.org/en/users/Documentation/iw/replace-iwconfig 这里]). <br />
<br />
{{Note|<br />
* 示例中使用网络接口 {{ic|wlan0}} 和热点 {{ic|''your_essid''}}. <br />
* 大部分命令需要以 [[Users and groups|root 权限]]执行,否则会无输出就退出。<br />
}} <br />
<br />
{| class="wikitable"<br />
! ''iw'' 命令<br />
! ''wireless_tools'' 命令<br />
! 描述<br />
|-<br />
| iw dev wlan0 link<br />
| iwconfig wlan0<br />
| 获取连接状态<br />
|-<br />
| iw dev wlan0 scan<br />
| iwlist wlan0 scan<br />
| 扫描可用热点<br />
|-<br />
| iw dev wlan0 set type ibss<br />
| iwconfig wlan0 mode ad-hoc<br />
| 设置操作模式为 ''ad-hoc''.<br />
|-<br />
| iw dev wlan0 connect ''your_essid''<br />
| iwconfig wlan0 essid ''your_essid''<br />
| 连接到开放网络<br />
|-<br />
| iw dev wlan0 connect ''your_essid'' 2432<br />
| iwconfig wlan0 essid ''your_essid'' freq 2432M<br />
| 连接到开放网络的一个频道<br />
|-<br />
| iw dev wlan0 connect ''your_essid'' key 0:''your_key''<br />
| iwconfig wlan0 essid ''your_essid'' key ''your_key''<br />
| 用16进制加密密码访问 WEP 加密网络<br />
|-<br />
| iw dev wlan0 connect ''your_essid'' key 0:''your_key''<br />
| iwconfig wlan0 essid ''your_essid'' key s:''your_key''<br />
|用 ASCII 密码访问 WEP 加密网络.<br />
|-<br />
| iw dev wlan0 set power_save on<br />
| iwconfig wlan0 power on<br />
| 启用省电模式<br />
|}<br />
<br />
{{注意|根据硬件和加密设备的不同,有些步骤可以跳过。一些网卡需要在关联到热点前先激活或扫描热点,需要一些实验才能确定。WPA/WPA2 用户可以按照[[#关联]]中的步骤激活网络。}}<br />
<br />
====获取有用信息 ====<br />
<br />
[http://wireless.kernel.org/en/users/Documentation/iw iw 官方文档] 包含更多示例。<br />
<br />
* 获取接口名:<br />
<br />
{{hc|$ iw dev|<br />
phy#0<br />
Interface '''wlan0'''<br />
ifindex 3<br />
wdev 0x1<br />
addr 12:34:56:78:9a:bc<br />
type managed<br />
channel 1 (2412 MHz), width: 40 MHz, center1: 2422 MHz<br />
}}<br />
<br />
* 检查连接状态,未连接时,可以看到:<br />
<br />
{{hc|$ iw dev wlan0 link|<br />
Not connected.<br />
}}<br />
<br />
连接到 AP 后可以看到:<br />
<br />
{{hc|$ iw dev wlan0 link|<br />
Connected to 12:34:56:78:9a:bc (on wlan0)<br />
SSID: MyESSID<br />
freq: 2412<br />
RX: 33016518 bytes (152703 packets)<br />
TX: 2024638 bytes (11477 packets)<br />
signal: -53 dBm<br />
tx bitrate: 150.0 MBit/s MCS 7 40MHz short GI<br />
<br />
bss flags: short-preamble short-slot-time<br />
dtim period: 1<br />
beacon int: 100<br />
}}<br />
<br />
* 获取统计数据:<br />
<br />
{{hc|$ iw dev wlan0 station dump|<br />
Station 12:34:56:78:9a:bc (on wlan0)<br />
inactive time: 1450 ms<br />
rx bytes: 24668671<br />
rx packets: 114373<br />
tx bytes: 1606991<br />
tx packets: 8557<br />
tx retries: 623<br />
tx failed: 1425<br />
signal: -52 dBm<br />
signal avg: -53 dBm<br />
tx bitrate: 150.0 MBit/s MCS 7 40MHz short GI<br />
authorized: yes<br />
authenticated: yes<br />
preamble: long<br />
WMM/WME: yes<br />
MFP: no<br />
TDLS peer: no<br />
}}<br />
<br />
==== 激活内核接口 ====<br />
(可能需要) 一些无线网卡在使用 {{pkg|wireless_tools}}前需要激活内核接口:<br />
# ip link set wlan0 up<br />
<br />
如果出现错误 {{ic|RTNETLINK answers: Operation not possible due to RF-kill}}, 请确保硬件开关已经打开。参阅 [[#Rfkill caveat]]。<br />
<br />
要验证接口确实打开:<br />
<br />
{{hc|# ip link show wlan0|<br />
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000<br />
link/ether 12:34:56:78:9a:bc brd ff:ff:ff:ff:ff:ff<br />
}}<br />
<br />
{{ic|<BROADCAST,MULTICAST,UP,LOWER_UP>}} 中的{{ic|UP}} 显示接口已经打开。 <br />
<br />
==== 查看接入点 ====<br />
<br />
# iw dev wlan0 scan |less<br />
<br />
{{注意|如果显示 "Interface doesn't support scanning",可能是忘了安装固件。有时不以 root 运行 {{ic|iwlist}} 也会产生这个问题。同样无线网络可能被软禁于,请安装 {{pkg|rfkill}} 并运行 {{ic|rfkill list all}} 进行检查。}}<br />
<br />
The important points to check:<br />
* '''SSID:''' the name of the network.<br />
* '''Signal:''' is reported in a wireless power ratio in dbm (e.g. from -100 to 0). The closer the negative value gets to zero, the better the signal. Observing the reported power on a good quality link and a bad one should give an idea about the individual range. <br />
* '''Security:''' it is not reported directly, check the line starting with {{ic|capability}}. If there is {{ic|Privacy}}, for example {{ic|capability: ESS Privacy ShortSlotTime (0x0411)}}, then the network is protected somehow.<br />
** If you see an {{ic|RSN}} information block, then the network is protected by [[Wikipedia:Robust Security Network|Robust Security Network]] protocol, also known as WPA2.<br />
** If you see an {{ic|WPA}} information block, then the network is protected by [[Wikipedia:Wi-Fi Protected Access|Wi-Fi Protected Access]] protocol.<br />
** In the {{ic|RSN}} and {{ic|WPA}} blocks you may find the following information:<br />
*** '''Group cipher:''' value in TKIP, CCMP, both, others.<br />
*** '''Pairwise ciphers:''' value in TKIP, CCMP, both, others. Not necessarily the same value than Group cipher.<br />
*** '''Authentication suites:''' value in PSK, 802.1x, others. For home router, you'll usually find PSK (''i.e.'' passphrase). In universities, you are more likely to find 802.1x suite which requires login and password. Then you will need to know which key management is in use (e.g. EAP), and what encapsulation it uses (e.g. PEAP). Find more details at [[Wikipedia:Authentication protocol]] and the sub-articles.<br />
** If you do not see neither {{ic|RSN}} nor {{ic|WPA}} blocks but there is {{ic|Privacy}}, then WEP is used.<br />
<br />
==== 操作模式 ====<br />
(可能需要) 设置无线网卡的操作模式,如果连接到漫游网络,需要设置操作模式为 '''ibss'''<br />
<br />
# iw wlan0 set type ibss<br />
<br />
{{注意|有些网卡需要先关闭无线接口({{ic|ip link set wlan0 down}})才能修改模式。}}<br />
<br />
==== 关联 ====<br />
<br />
根据加密方式不同,需要使用密码将无线设备关联到接入点。<br />
<br />
假设要使用的接入点 ESSID 为 {{ic|MyEssid}}: <br />
* 无加密<br />
# iw wlan0 connect MyEssid<br />
<br />
* WEP<br />
使用十六进制或 ASCII 密码(格式是自动识别出来的,因为 WEP 密码长度是固定的):<br />
<br />
# iw dev wlan0 connect ''your_essid'' key 0:''your_key''<br />
<br />
使用十六进制或 ASCII 密码,第三个是默认 (从0计数,共四个):<br />
<br />
# iw dev wlan0 connect ''your_essid'' key d:2:''your_key''<br />
<br />
* '''WPA/WPA2'''<br />
<br />
# wpa_supplicant -i interface -c <(wpa_passphrase ''your_SSID'' ''your_key'')<br />
<br />
假设设备使用 {{ic|wext}} 驱动。如果无法工作,可能需要调整选项,参见 [[WPA_Supplicant]]。<br />
<br />
如果连接成功,在新终端中执行后续命令或(或者通过 {{ic|Ctrl+c}} 退出并使用 {{ic|-B}} 参数在后台再次执行上述命令。[[WPA_Supplicant]] 页面包含更多参数和配置文件的信息。<br />
<br />
通过下面命令确认是否连接成功:<br />
<br />
# iw dev wlan0 link<br />
<br />
==== 获取 IP 地址 ====<br />
使用 DHCP:<br />
# dhcpcd wlan0<br />
<br />
或<br />
# dhclient wlan0<br />
<br />
静态 IP:<br />
# ip addr add 192.168.0.2/24 dev wlan0<br />
# ip route add default via 192.168.0.1<br />
<br />
{{Tip|[[dhcpcd]] contains a hook (enabled by default) to automatically launch [[WPA supplicant]] on wireless interfaces. It is started only if a configuration file at {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} exists and no ''wpa_supplicant'' process is listening on that interface. In most cases, you do not need to create any [[#Manual wireless connection at boot using systemd and dhcpcd|custom service]], just enable {{ic|dhcpcd@''interface''}}.}}<br />
<br />
==== Custom startup scripts/services ====<br />
<br />
Although the manual configuration method will help troubleshoot wireless problems, you will have to re-type every command each time you reboot. You can also quickly write a shell script to automate the whole process, which is still a quite convenient way of managing network connection while keeping full control over your configuration. You can find some examples in this section.<br />
<br />
===== Manual wireless connection at boot using systemd and dhcpcd =====<br />
<br />
This example uses [[systemd]] for start up, [[WPA supplicant]] for connecting, and {{Pkg|dhcpcd}} for assigning an IP address.<br />
<br />
{{Note|Make sure that {{Pkg|wpa_supplicant}} is installed and create {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}}. See [[WPA supplicant]] for details.}}<br />
<br />
Create a systemd unit, e.g {{ic|/etc/systemd/system/network-wireless@.service}}:<br />
<br />
{{hc|/etc/systemd/system/network-wireless@.service|<nowiki><br />
[Unit]<br />
Description=Wireless network connectivity (%i)<br />
Wants=network.target<br />
Before=network.target<br />
BindsTo=sys-subsystem-net-devices-%i.device<br />
After=sys-subsystem-net-devices-%i.device<br />
<br />
[Service]<br />
Type=oneshot<br />
RemainAfterExit=yes<br />
<br />
ExecStart=/usr/bin/ip link set dev %i up<br />
ExecStart=/usr/bin/wpa_supplicant -B -i %i -c /etc/wpa_supplicant/wpa_supplicant.conf<br />
ExecStart=/usr/bin/dhcpcd %i<br />
<br />
ExecStop=/usr/bin/ip link set dev %i down<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
Start and/or enable the unit as described in [[systemd#Using units]], remember to pass the name of the interface:<br />
<br />
# systemctl enable network-wireless@wlan0.service<br />
# systemctl start network-wireless@wlan0.service<br />
<br />
===== Systemd with wpa_supplicant and static IP =====<br />
<br />
{{Note|Make sure that {{Pkg|wpa_supplicant}} is installed and create a custom {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}}. See [[WPA supplicant]] for details.}}<br />
<br />
First create configuration file for the [[systemd]] service, replace {{ic|''interface''}} with proper interface name:<br />
<br />
{{hc|/etc/conf.d/network-wireless@''interface''|<nowiki><br />
address=192.168.0.10<br />
netmask=24<br />
broadcast=192.168.0.255<br />
gateway=192.168.0.1<br />
</nowiki>}}<br />
<br />
Create a systemd unit file:<br />
<br />
{{hc|/etc/systemd/system/network-wireless@.service|<nowiki><br />
[Unit]<br />
Description=Wireless network connectivity (%i)<br />
Wants=network.target<br />
Before=network.target<br />
BindsTo=sys-subsystem-net-devices-%i.device<br />
After=sys-subsystem-net-devices-%i.device<br />
<br />
[Service]<br />
Type=oneshot<br />
RemainAfterExit=yes<br />
EnvironmentFile=/etc/conf.d/network-wireless@%i<br />
<br />
ExecStart=/usr/bin/ip link set dev %i up<br />
ExecStart=/usr/bin/wpa_supplicant -B -i %i -c /etc/wpa_supplicant/wpa_supplicant.conf<br />
ExecStart=/usr/bin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev %i<br />
ExecStart=/usr/bin/ip route add default via ${gateway}<br />
<br />
ExecStop=/usr/bin/ip addr flush dev %i<br />
ExecStop=/usr/bin/ip link set dev %i down<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
Enable the unit and start it, passing the name of the interface:<br />
<br />
# systemctl enable network-wireless@wlan0.service<br />
# systemctl start network-wireless@wlan0.service<br />
<br />
====自动设置====<br />
有许多可选方法,但是注意它们是互斥的,不能同时运行两个守护进程。下面是比较表格:<br />
<br />
{| class="wikitable"<br />
! 连接管理器 || profiles 支持 || 漫游 <br>(自动连接和重连) || [[Wikipedia:point-to-point protocol|PPP]] 支持 <br>(3G modem) || 官方 <br>GUI || 控制台工具<br />
|-<br />
| [[Connman]] || Yes || Yes || Yes || No || {{ic|connmanctl}}<br />
|-<br />
| [[Netctl]] || Yes || Yes || Yes || No || {{ic|netctl}},{{ic|wifi-menu}}<br />
|-<br />
| [[NetworkManager]] || Yes || Yes || Yes || Yes || {{ic|nmcli}}<br />
|-<br />
| [[Wicd]] || Yes || Yes || No || Yes || {{ic|wicd-curses}}<br />
|}<br />
<br />
====Connman====<br />
ConnMan is an alternative to NetworkManager and Wicd, designed to be light on resources making it ideal for netbooks, and other mobile devices. It is modular in design takes advandage of the dbus API and provides proper abstraction on top of wpa_supplicant. <br />
<br />
See: [[Connman]]<br />
<br />
==== Netctl ====<br />
<br />
''netctl'' is a replacement for ''netcfg'' designed to work with systemd. It uses a profile based setup and is capable of detection and connection to a wide range of network types. This is no harder than using graphical tools.<br />
<br />
See: [[Netctl]]<br />
<br />
=====Wicd=====<br />
Wicd 是可以同时处理无线和有线网络的管理器。用 Python 和 Gtk 写成,依赖关系比 NetworkManager 少,所以是轻量级桌面的理想选择。位于[[Official repositories (简体中文)|官方软件仓库]].<br />
<br />
参见: [[Wicd]]<br />
<br />
{{Note|[[wicd]] may cause excessive dropped connections with some drivers, while [[NetworkManager]] might work better.}}<br />
<br />
=====NetworkManager=====<br />
NetworkManager 是高级网络管理工具,在大部分流行发行版中使用。除了能管理有线链接,NetworkManager还提供了一个易于使用的图形界面程序来选择想要的无线移动链接。 <br />
<br />
{{Note|GNOME's {{Pkg|network-manager-applet}} also works under [[Xfce]] if you install {{AUR|xfce4-xfapplet-plugin}}{{Broken package link|{{aur-mirror|xfce4-xfapplet-plugin}}}} (available in the [[Arch User Repository|AUR]]) first. Additionally, there are applets available for [[KDE]].}}<br />
<br />
详情请见 [[NetworkManager]]。<br />
<br />
=====Wifi Radar=====<br />
WiFi Radar是 一个Python/PyGTK2 的管理无线配置的程序('''只有'''无线)。它能够扫描可用的网络,为选择的网络创建新的配置。<br />
<br />
详情请见[[Wifi Radar]]。<br />
<br />
===Power saving===<br />
参阅[[Power_saving]].<br />
<br />
== Troubleshooting ==<br />
<br />
This section contains general troubleshooting tips, not strictly related to problems with drivers or firmware. For such topics, see next section.<br />
<br />
{{Out of date|Commands in following subsections need updating according to [[ArchWiki:Requests#wireless_tools_-.3E_iw|wireless_tools -> iw]] transition.}}<br />
<br />
=== Rfkill caveat ===<br />
<br />
Many laptops have a hardware button (or switch) to turn off wireless card, however, the card can also be blocked by kernel. This can be handled by {{Pkg|rfkill}}. Use ''rfkill'' to show the current status:<br />
<br />
{{hc|# rfkill list|<br />
0: phy0: Wireless LAN<br />
Soft blocked: yes<br />
Hard blocked: yes<br />
}}<br />
<br />
If the card is ''hard-blocked'', use the hardware button (switch) to unblock it. If the card is not ''hard-blocked'' but ''soft-blocked'', use the following command:<br />
<br />
# rfkill unblock wifi<br />
<br />
{{Note|It is possible that the card will go from ''hard-blocked'' and ''soft-unblocked'' state into ''hard-unblocked'' and ''soft-blocked'' state by pressing the hardware button (i.e. the ''soft-blocked'' bit is just switched no matter what). This can be adjusted by tuning some options of the {{ic|rfkill}} [[Kernel modules|kernel module]].}}<br />
<br />
More info: http://askubuntu.com/questions/62166/siocsifflags-operation-not-possible-due-to-rf-kill<br />
<br />
=== Respecting the regulatory domain ===<br />
<br />
The [http://en.wikipedia.org/wiki/IEEE_802.11#Regulatory_domains_and_legal_compliance regulatory domain], or "regdomain", is used to reconfigure wireless drivers to make sure that wireless hardware usage complies with local laws set by the FCC, ETSI and other organizations. Regdomains use [https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO 3166-1 alpha-2 country codes]. For example, the regdomain of the United States would be "US", China would be "CN", etc.<br />
<br />
Regdomains affect the availability of wireless channels. In the 2.4GHz band, the allowed channels are 1-11 for the US, 1-14 for Japan, and 1-13 for most of the rest of the world. In the 5GHz band, the rules for allowed channels are much more complex. In either case, consult [https://en.wikipedia.org/wiki/List_of_WLAN_channels this list of WLAN channels] for more detailed information.<br />
<br />
Regdomains also affect the limit on the [https://en.wikipedia.org/wiki/Equivalent_isotropically_radiated_power effective isotropic radiated power (EIRP)] from wireless devices. This is derived from transmit power/"tx power", and is measured in [https://en.wikipedia.org/wiki/DBm dBm/mBm (1dBm=100mBm) or mW (log scale)]. In the 2.4GHz band, the maximum is 30dBm in the US and Canada, 20dBm in most of Europe, and 20dB-30dBm for the rest of the world. In the 5GHz band, maximums are usually lower. Consult the [http://git.kernel.org/cgit/linux/kernel/git/linville/wireless-regdb.git/tree/db.txt wireless-regdb] for more detailed information (EIRP dBm values are in the second set of brackets for each line).<br />
<br />
Misconfiguring the regdomain can be useful - for example, by allowing use of an unused channel when other channels are crowded, or by allowing an increase in tx power to widen transmitter range. However, '''this is not recommended''' as it could break local laws and cause interference with other radio devices.<br />
<br />
To configure the regdomain, install {{Pkg|crda}} and {{Pkg|wireless-regdb}} and reboot (to reload the {{ic|cfg80211}} module and all related drivers). Check the boot log to make sure that CRDA is being called by {{ic|cfg80211}}:<br />
<br />
$ dmesg | grep cfg80211<br />
<br />
The current regdomain can be set to the United States with:<br />
<br />
# iw reg set US<br />
<br />
And queried with:<br />
<br />
$ iw reg get<br />
<br />
{{Note|Your device may be set to country "00", which is the "world regulatory domain" and contains generic settings. If this cannot be unset, CRDA may be misconfigured.}}<br />
<br />
However, setting the regdomain may not alter your settings. Some devices have a regdomain set in firmware/EEPROM, which dictates the limits of the device, meaning that setting regdomain in software [http://wiki.openwrt.org/doc/howto/wireless.utilities#iw can only increase restrictions], not decrease them. For example, a CN device could be set in software to the US regdomain, but because CN has an EIRP maximum of 20dBm, the device will not be able to transmit at the US maximum of 30dBm.<br />
<br />
For example, to see if the regdomain is being set in firmware for an Atheros device:<br />
<br />
$ dmesg | grep ath:<br />
<br />
For other chipsets, it may help to search for "EEPROM", "regdomain", or simply the name of the device driver.<br />
<br />
To see if your regdomain change has been successful, and to query the number of available channels and their allowed transmit power:<br />
<br />
$ iw list | grep -A 15 Frequencies:<br />
<br />
A more permanent configuration of the regdomain can be achieved through editing {{ic|/etc/conf.d/wireless-regdom}} and uncommenting the appropriate domain. {{ic|wpa_supplicant}} can also use a regdomain in the {{ic|1=country=}} line of {{ic|/etc/wpa_supplicant.conf}}.<br />
<br />
It is also possible to configure the [http://wireless.kernel.org/en/developers/Documentation/cfg80211 cfg80211] kernel module to use a specific regdomain by adding, for example, {{ic|1=options cfg80211 ieee80211_regdom=EU}} to {{ic|/etc/modprobe.d/modprobe.conf}}. However, this is part of the [http://wireless.kernel.org/en/developers/Regulatory#The_ieee80211_regdom_module_parameter old regulatory implementation].<br />
<br />
For further information, read the [http://wireless.kernel.org/en/developers/Regulatory/ wireless.kernel.org regulatory documentation].<br />
<br />
=== Observing Logs === <br />
<br />
A good first measure to troubleshoot is to analyze the system's logfiles first. In order not to manually parse through them all, it can help to open a second terminal/console window and watch the kernels messages with <br />
$ dmesg -w<br />
while performing the action, e.g. the wireless association attempt. <br />
<br />
When using a tool for network management, the same can be done for systemd with <br />
# journalctl -f <br />
<br />
Frequently a wireless error is accompanied by a deauthentication with a particular reason code, for example: <br />
wlan0: deauthenticating from XX:XX:XX:XX:XX:XX by local choice (reason=3)<br />
Looking up [http://www.aboutcher.co.uk/2012/07/linux-wifi-deauthenticated-reason-codes/ the reason code] might give a first hint. <br />
<br />
The individual tools used in this article further provide options for more detailed debugging output, which can be used in a second step of the analysis, if required.<br />
<br />
=== Failed to get IP address ===<br />
<br />
* If getting an IP address repeatedly fails using the default {{Pkg|dhcpcd}} client, try installing and using {{Pkg|dhclient}} instead. Do not forget to select ''dhclient'' as the primary DHCP client in your [[#Automatic setup|connection manager]]!<br />
<br />
* If you can get an IP address for a wired interface and not for a wireless interface, try disabling the wireless card's power saving features:<br />
<br />
# iwconfig wlan0 power off<br />
<br />
* If you get a timeout error due to a ''waiting for carrier'' problem, then you might have to set the channel mode to {{ic|auto}} for the specific device:<br />
<br />
# iwconfig wlan0 channel auto<br />
<br />
Before changing the channel to auto, make sure your wireless interface is down. After it has successfully changed it, you can bring the interface up again and continue from there.<br />
<br />
=== Connection always times out ===<br />
<br />
The driver may suffer from a lot of tx excessive retries and invalid misc errors for some unknown reason, resulting in a lot of packet loss and keep disconnecting, sometimes instantly. Following tips might be helpful.<br />
<br />
==== Lowering the rate ====<br />
<br />
Try setting lower rate, for example 5.5M:<br />
<br />
# iwconfig wlan0 rate 5.5M auto<br />
<br />
Fixed option should ensure that the driver does not change the rate on its own, thus making the connection a bit more stable:<br />
<br />
# iwconfig wlan0 rate 5.5M fixed<br />
<br />
==== Lowering the txpower ====<br />
<br />
You can try lowering the transmit power as well. This may save power as well:<br />
<br />
# iwconfig wlan0 txpower 5<br />
<br />
Valid settings are from {{ic|0}} to {{ic|20}}, {{ic|auto}} and {{ic|off}}.<br />
<br />
==== Setting rts and fragmentation thresholds ====<br />
<br />
Default iwconfig options have rts and fragmentation thresholds off. These options are particularly useful when there are many adjacent APs or in a noisy environment.<br />
<br />
The minimum value for fragmentation value is 256 and maximum is 2346. In many windows drivers the maximum is the default value:<br />
<br />
# iwconfig wlan0 frag 2346<br />
<br />
For rts minimum is 0, maximum is 2347. Once again windows drivers often use maximum as the default:<br />
<br />
# iwconfig wlan0 rts 2347<br />
<br />
=== Random disconnections ===<br />
<br />
==== Cause #1 ====<br />
<br />
If dmesg says {{ic|1=wlan0: deauthenticating from MAC by local choice (reason=3)}} and you lose your Wi-Fi connection, it is likely that you have a bit too aggressive power-saving on your Wi-Fi card[http://us.generation-nt.com/answer/gentoo-user-wireless-deauthenticating-by-local-choice-help-204640041.html]. Try disabling the wireless card's power-saving features:<br />
<br />
# iwconfig wlan0 power off<br />
<br />
See [[Power saving]] for tips on how to make it permanent (just specify {{ic|off}} instead of {{ic|on}}).<br />
<br />
If your card does not support {{ic|iwconfig wlan0 power off}}, check the '''BIOS''' for power management options. Disabling PCI-Express power management in the BIOS of a Lenovo W520 resolved this issue.<br />
<br />
==== Cause #2 ====<br />
<br />
If you are experiencing frequent disconnections and dmesg shows messages such as <br />
<br />
{{ic|1=ieee80211 phy0: wlan0: No probe response from AP xx:xx:xx:xx:xx:xx after 500ms, disconnecting}}<br />
<br />
try changing the channel bandwidth to {{ic|20MHz}} through your router's settings page.<br />
<br />
==== Cause #3 ====<br />
<br />
On some laptop models with hardware rfkill switches (e.g., Thinkpad X200 series), due to wear or bad design, the switch (or its connection to the mainboard) might become loose over time resulting in seemingly random hardblocks/disconnects when you accidentally touch the switch or move the laptop.<br />
There is no software solution to this, unless your switch is electrical and the BIOS offers the option to disable the switch.<br />
If your switch is mechanical (most are), there are lots of possible solutions, most of which aim to disable the switch: Soldering the contact point on the mainboard/wifi-card, glueing or blocking the switch, using a screw nut to tighten the switch or removing it altogether.<br />
<br />
== Troubleshooting drivers and firmware ==<br />
<br />
This section covers methods and procedures for installing kernel modules and ''firmware'' for specific chipsets, that differ from generic method.<br />
<br />
See [[Kernel modules]] for general informations on operations with modules.<br />
<br />
=== Ralink ===<br />
<br />
====rt2x00====<br />
Ralink 芯片组的统一驱动,代替了 {{ic|rt2500}}, {{ic|rt61}}, {{ic|rt73}} 等。Linux 内核从 2.6.24 开始包含此驱动,但是有些设备可能需要额外固件。可以使用标准 {{Pkg|wpa_supplicant}} 和 {{ic|iwconfig}} 工具配置。<br />
<br />
有些芯片组需要固件文件,可以安装软件包 {{Pkg|linux-firmware}}。<br />
<br />
参见: [[Using the new rt2x00 beta driver]]<br />
<br />
* Since kernel 3.0, rt2x00 includes also these drivers: {{ic|rt2800pci}}, {{ic|rt2800usb}}. {{ic|rt2860sta}} 被主分支驱动 {{ic|rt2800pci}} 替代,{{ic|rt2870sta}} 被 {{ic|rt2800usb}} 替代。<br />
* 通过 {{ic|iwpriv}} 可以配置很多参数,文档在 [http://web.ralinktech.com/ralink/Home/Support/Linux.html Ralink 源代码包] 中。<br />
<br />
==== rt3090 ====<br />
<br />
For devices which are using the rt3090 chipset it should be possible to use {{ic|rt2800pci}} driver, however, is not working with this chipset very well (e.g. sometimes it's not possible to use higher rate than 2Mb/s).<br />
<br />
The best way is to use the {{AUR|rt3090-dkms}}{{Broken package link|{{aur-mirror|rt3090-dkms}}}} driver from [[AUR]]. Make sure to [[Kernel modules#Blacklisting|blacklist]] the {{ic|rt2800pci}} module and setup the {{ic|rt3090sta}} module to [[Kernel modules#Loading|load]] at boot.<br />
<br />
{{Note|This driver also works with rt3062 chipsets. Also the {{AUR|rt3090}}{{Broken package link|{{aur-mirror|rt3090}}}} package is not supported by the latest kernel and has been orphaned {{AUR|rt3090-dkms}}{{Broken package link|{{aur-mirror|rt3090-dkms}}}} should be used instead. }}<br />
<br />
==== rt3290 ====<br />
<br />
The rt3290 chipset is recognised by the kernel {{ic|rt2800pci}} module. However, some users experience problems and reverting to a patched Ralink driver seems to be beneficial in these [https://bbs.archlinux.org/viewtopic.php?id=161952 cases].<br />
<br />
====rt3573====<br />
<br />
2012年新出的芯片组,需要 Ralink 的闭源驱动,有不同的厂商使用他们,参阅[https://bbs.archlinux.org/viewtopic.php?pid=1164228#p1164228 Belkin N750 示例] 。<br />
<br />
====rt5572====<br />
<br />
支持 5 Gh 频率,需要 Ralink 的闭源驱动,编译指令位于[http://bernaerts.dyndns.org/linux/229-ubuntu-precise-dlink-dwa160-revb2 这里]<br />
<br />
=== Realtek ===<br />
<br />
==== rtl8192cu ====<br />
<br />
The driver is now in the kernel, but many users have reported being unable to make a connection although scanning for networks does work.<br />
<br />
Package {{AUR|8192cu-dkms}} in the AUR includes many patches, try this if it doesn't work fine with the driver in kernel.<br />
<br />
==== rtl8192e ====<br />
<br />
The driver is part of the current kernel package. 启动时可能装入模块失败,错误信息是: <br />
<br />
rtl819xE:ERR in CPUcheck_firmware_ready()<br />
rtl819xE:ERR in init_firmware() step 2<br />
rtl819xE:ERR!!! _rtl8192_up(): initialization is failed!<br />
r8169 0000:03:00.0: eth0: link down<br />
<br />
一个暂时的解决方法是卸载模块: <br />
# modprobe -r r8192e_pci<br />
等一会后,重新装入模块:<br />
# modprobe r8192e_pci<br />
<br />
==== rtl8188eu ====<br />
<br />
Some dongles, like the TP-Link TL-WN725N v2 (not sure, but it seems that uses the rtl8179 chipset), use chipsets compatible with this driver. In order to use it you have to install the {{AUR|dkms-8188eu}}{{Broken package link|{{aur-mirror|dkms-8188eu}}}} package in the AUR.<br />
<br />
==== rtl8723be ====<br />
<br />
{{Poor writing|This belongs to the [[AUR]], then there can be only simple reference to install the package.}}<br />
<br />
The driver for this card is designated to be entered into the Linux kernel as a part of version 3.15. Until version 3.15 is released, the kernel module for the card can be downloaded from [https://github.com/lwfinger/rtl8723be lwfinger's github]. If git is not installed, please install it.<br />
$ cd ~/temp<br />
$ git clone https://github.com/lwfinger/rtl8723be.git<br />
$ cd rtl8723be<br />
$ make<br />
# make install<br />
# modprobe rtl8723be<br />
When running {{ic|make}}, some users may encounter a compile error based on the kernel version. If, and only if you encounter a compile error:<br />
$ nano rtl8723be/trx.c<br />
On line 621, change the line <br />
if ((_ieee80211_is_robust_mgmt_frame(hdr)) &&<br />
to<br />
if ((ieee80211_is_robust_mgmt_frame(hdr)) &&<br />
Save, then cd back to the main rtl8723be directory and continue from {{ic|make install}}<br />
Additionally, some users may encounter errors with powersave on this card. This is shown with occasional disconnects that are not recognized by high level network managers (netctl, NetworkManager). This error can be confirmed by running {{ic|$ dmesg -w}} or {{ic|$ journalctl -f}} and looking for output related to powersave and the rtl8723be module. If you are having this issue, you need to add a kernel option:<br />
# nano /etc/modprobe.d/rtl8723be.conf<br />
Add this line to the new file:<br />
#Prevents the WiFi card from automatically sleeping and halting connection<br />
options rtl8723be fwlps=0<br />
That should rectify any issues with firmware powersaving.<br />
<br />
=== Atheros ===<br />
[http://madwifi-project.org/ MadWifi team] 开发组维护了三个模块:<br />
* {{ic|madwifi}} 是最老的驱动, Arch kernel 从 2.6.39.1 开始已经不再包含。<br />
* [[#ath5k|{{ic|ath5k}}]] 将逐步替代 {{ic|ath_pci}},有些芯片组使用效果很好,但有些还不能很好工作(后面有介绍)<br />
* [[#ath9k|{{ic|ath9k}}]] 是新的官方驱动,适用于新 Atheros 硬件。<br />
<br />
There are some other drivers for some Atheros devices. See [http://wireless.kernel.org/en/users/Drivers/Atheros#PCI_.2F_PCI-E_.2F_AHB_Drivers Linux Wireless documentation] for details.<br />
<br />
====ath5k====<br />
<br />
参考:<br />
* http://wireless.kernel.org/en/users/Drivers/ath5k<br />
* http://wiki.debian.org/ath5k<br />
<br />
If you find web pages randomly loading very slow, or if the device is unable to lease an IP address, try to switch from hardware to software encryption by loading the {{ic|ath5k}} module with {{ic|1=nohwcrypt=1}} option. See [[Kernel Modules#Setting module options]] for details.<br />
<br />
有些笔记本的 LED 指示灯有问题,可以:<br />
echo none > "/sys/class/leds/ath5k-phy0::tx/trigger"<br />
echo none > "/sys/class/leds/ath5k-phy0::rx/trigger"<br />
<br />
====ath9k====<br />
{{ic|ath9k}} 是 Atheros 官方支持的驱动,支持所有带 802.11n 功能的芯片组,最大传输速度 180 Mbps. [http://wireless.kernel.org/en/users/Drivers/ath9k 这个页面] 列出了所有支持的硬件。<br />
<br />
工作模式:Station, AP and Adhoc.<br />
<br />
{{ic|ath9k}} 是官方内核的一部分。如果在极个别情况下遇到稳定性问题,可以使用 [http://wireless.kernel.org/en/users/Download compat-wireless] 软件包。[https://lists.ath9k.org/mailman/listinfo/ath9k-devel ath9k 邮件列表] 提供了支持和开发的相关信息。<br />
<br />
参考:<br />
* http://wireless.kernel.org/en/users/Drivers/ath9k<br />
* http://wiki.debian.org/ath9k<br />
<br />
==== ath9k ====<br />
<br />
External resources:<br />
* http://wireless.kernel.org/en/users/Drivers/ath9k<br />
* http://wiki.debian.org/ath9k<br />
<br />
In the unlikely event that you have stability issues that trouble you, you could try using the [http://wireless.kernel.org/en/users/Download compat-wireless] package.<br />
An [https://lists.ath9k.org/mailman/listinfo/ath9k-devel ath9k mailing list] exists for support and development related discussions.<br />
<br />
===== ASUS =====<br />
<br />
With some ASUS laptops (tested with ASUS U32U series), it could help to add {{ic|1=options asus_nb_wmi wapf=1}} to {{ic|/etc/modprobe.d/asus_nb_wmi.conf}} to fix rfkill-related issues.<br />
<br />
You can also try to blacklist the module asus_nb_wmi (tested with ASUSPRO P550C):<br />
# echo "blacklist asus_nb_wmi" >> /etc/modprobe.d/blacklist.conf<br />
<br />
=== Intel ===<br />
====ipw2100 与 ipw2200====<br />
<br />
内核完全支持,但是需要安装额外的固件。根据芯片组型号,[[pacman (简体中文)|安装]] 软件包 {{Pkg|ipw2100-fw}} 或 {{Pkg|ipw2200-fw}}。<br />
<br />
{{Tip|You may use the following [[Kernel modules#Setting module options|module options]]:<br />
* use the {{ic|1=rtap_iface=1}} option to enable the radiotap interface<br />
* use the {{ic|1=led=1}} option to enable a front LED indicating when the wireless is connected or not<br />
}}<br />
<br />
==== iwlegacy ====<br />
<br />
[http://wireless.kernel.org/en/users/Drivers/iwlegacy iwlegacy] is the wireless driver for Intel's 3945 and 4965 wireless chips. The firmware is included in the {{Pkg|linux-firmware}} package.<br />
<br />
[[udev]] should load the driver automatically, otherwise load {{ic|iwl3945}} or {{ic|iwl4965}} manually. See [[Kernel modules#Loading]] for details.<br />
<br />
==== iwlwifi ====<br />
<br />
[http://wireless.kernel.org/en/users/Drivers/iwlwifi iwlwifi] is the wireless driver for Intel's current wireless chips, such as 5100AGN, 5300AGN, and 5350AGN. See the [http://wireless.kernel.org/en/users/Drivers/iwlwifi#Supported_Devices full list of supported devices]. The firmware is included in the {{Pkg|linux-firmware}} package.<br />
<br />
If you have problems connecting to networks in general or your link quality is very poor, try to disable 802.11n and enable software encryption:<br />
<br />
{{hc|/etc/modprobe.d/iwlwifi.conf|<nowiki>options iwlwifi 11n_disable=1<br />
options iwlwifi swcrypto=1</nowiki>}}<br />
<br />
In case this does not work for you, you may try disabling power saving for your wireless adapter. For a permanent solution, add a new udev rule:<br />
{{hc|/etc/udev/rules.d/80-iwlwifi.rules|<nowiki>ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="<your_mac_address>", RUN+="/usr/bin/iw dev %k set power_save off"</nowiki>}}<br />
<br />
=====禁用 LED 闪烁=====<br />
<br />
{{Note|This works with the {{ic|iwlegacy}} and {{ic|iwlwifi}} drivers.}}<br />
<br />
默认设置中 LED 闪烁是开着的,有些人不喜欢,可以[[systemd#Temporary files|systemd-tmpfiles]]禁止闪烁:<br />
<br />
{{hc|/etc/tmpfiles.d/phy0-led.conf|<br />
w /sys/class/leds/phy0-led/trigger - - - - phy0radio<br />
}}<br />
<br />
Run {{ic|systemd-tmpfiles --create phy0-led.conf}} for the change to take effect, or reboot.<br />
<br />
To see all the possible trigger values for this LED:<br />
<br />
# cat /sys/class/leds/phy0-led/trigger<br />
<br />
{{Tip|If you do not have {{ic|/sys/class/leds/phy0-led}}, you may try to use the {{ic|1=led_mode="1"}} [[Kernel modules#Setting module options|module option]]. It should be valid for both {{ic|iwlwifi}} and {{ic|iwlegacy}} drivers.}}<br />
<br />
# cat /sys/class/leds/phy0-led/trigger<br />
<br />
=== Broadcom ===<br />
<br />
See [[Broadcom wireless]].<br />
<br />
==== Tenda w322u ====<br />
<br />
Treat this Tenda card as an {{ic|rt2870sta}} device. See [[#rt2x00]].<br />
<br />
==== orinoco ====<br />
<br />
这应当是内核的一部分,是已经被安装的。<br />
<br />
Some Orinoco chipsets are Hermes II. You can use the {{ic|wlags49_h2_cs}} driver instead of {{ic|orinoco_cs}} and gain WPA support. To use the driver, [[Kernel modules#Blacklisting|blacklist]] {{ic|orinoco_cs}} first.<br />
<br />
==== prism54 ====<br />
<br />
The driver {{ic|p54}} is included in kernel, but you have to download the appropriate firmware for your card from [http://linuxwireless.org/en/users/Drivers/p54#firmware this site] and install it into the {{ic|/usr/lib/firmware}} directory.<br />
<br />
过时的 {{ic|prism54}} 和新内核模块 {{ic|p54pci}} 或 {{ic|p54usb}} 同时装入造成冲突,使用 {{ic|<nowiki>lsmod | grep prism54</nowiki>}} 查看是否装入了过时模块,如果是,那么就 [[blacklisting|屏蔽]] {{ic|prism54}} 并根据上面方法修改固件名称。<br />
<br />
==== ACX100/111 ====<br />
<br />
{{Warning|The drivers for these devices [https://mailman.archlinux.org/pipermail/arch-dev-public/2011-June/020669.html are broken] and do not work with newer kernel versions.}}<br />
<br />
Packages: {{ic|tiacx}} {{ic|tiacx-firmware}} (deleted from official repositories and AUR)<br />
<br />
See [http://sourceforge.net/apps/mediawiki/acx100/index.php?title=Main_Page official wiki] for details.<br />
<br />
==== zd1211rw ====<br />
<br />
[http://zd1211.wiki.sourceforge.net/ {{ic|zd1211rw}}] 是ZyDAS ZD1211 802.11b/g USB WLAN芯片的驱动,最近的版本的内核已经包括了。[http://zd1211.wiki.sourceforge.net/ zd1211rw] [http://www.linuxwireless.org/en/users/Drivers/zd1211rw/devices|这里]有被支持的设备列表。 你只需要这样安装固件{{Pkg|zd1211-firmware}}。<br />
<br />
==== hostap_cs ====<br />
<br />
[http://hostap.epitest.fi/ Host AP] is a Linux driver for wireless LAN cards based on Intersil's Prism2/2.5/3 chipset. The driver is included in Linux kernel.<br />
<br />
{{Note|Make sure to [[Kernel_modules#Blacklisting|blacklist]] the {{ic|orinico_cs}} driver, it may cause problems.}}<br />
<br />
===ndiswrapper===<br />
Ndiswrapper并不是一个真正的驱动,但是如果你无法找到适合你的无线网卡驱动的适合, 它就派上用场了.有的时候, 它是非常有用的.为了使用Ndiswrapper, 你需要Windows驱动中的*.inf文件(*.sys文件应该和*.info在同一个目录中)。确保使用合适架构(也就是32/64位)的驱动。如果你需要从 {{ic|*.exe}} 文件解压缩,你可以使用 {{pkg|cabextract}}.<br />
<br />
下面是安装ndiswrapper的几个步骤:<br />
<br />
1. 安装驱动到 {{ic|/etc/ndiswrapper/*}}<br />
ndiswrapper -i filename.inf<br />
2. 列出所有的安装的驱动<br />
ndiswrapper -l<br />
3. 书写配置文件到 {{ic|/etc/modprobe.d/ndiswrapper.conf}}<br />
ndiswrapper -m<br />
depmod -a<br />
<br />
现在基本上就要安装完ndiswrapper了; 依照 [[Kernel modules#Loading|这里]]设置启动时加载这个模块。<br />
<br />
modprobe ndiswrapper<br />
iwconfig<br />
<br />
如果正常的话, 你应该可以看到wlan0接口了. 如果有问题的话, 你可以从<br />
[http://ndiswrapper.sourceforge.net/joomla/index.php?/component/option,com_openwiki/Itemid,33/id,installation/ Ndiswrapper 安装 wiki]上面得到更多的信息.<br />
<br />
== 参见 ==<br />
*[[Sharing PPP Connection]]<br />
*[[Ad-hoc networking]]<br />
<br />
== 其他资源 ==<br />
*[http://www.gnome.org/projects/NetworkManager/ NetworkManager] - NetworkManager官方网站<br />
*[http://wicd.sourceforge.net/ WICD] - WICD官方网站<br />
*[http://wifi-radar.systemimager.org/ Wifi Radar] - Wifi Radar官方网站<br />
*[http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Wireless.html 一个很少能帮忙的废话连篇的howto]<br />
*[http://madwifi-project.org/wiki/UserDocs/FirstTimeHowTo madwifi的安装方法,如果你在用Arch的方式安装时遇到了问题]</div>
Aaron chen