https://wiki.archlinux.org/api.php?action=feedcontributions&user=Tomaszc&feedformat=atomArchWiki - User contributions [en]2024-03-28T09:01:44ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Nft-blackhole&diff=636169Nft-blackhole2020-09-22T19:11:23Z<p>Tomaszc: Update usage section</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Firewalls]]<br />
{{Merge|nftables|Why copy github README, and why just not include mention of your software as simple 2 line in [[nftables]], see [[Template:App]]?}}<br />
[https://github.com/tomasz-c/nft-blackhole nft-blackhole] - script / daemon to blocking IP in [[nftables]] by country and black lists.<br />
== Features ==<br />
<br />
* download publicly available blacklists and block IPs from them,<br />
* block or whitelist individual countries,<br />
* whitelist individual networks or IP addresses,<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{AUR|nft-blackhole}} package.<br />
<br />
== Configuration file ==<br />
In the configuration file ''/etc/nft-blackhole.conf'' you can define:<br />
<br />
* IP versions supported (ipv4, ipv6),<br />
* blocking policy (reject, drop,)<br />
* network or IP addresses for the white list,<br />
* blacklist url addresses,<br />
* list of countries, policy for countries (accept, block)<br />
<br />
== Usage ==<br />
As root for start [[systemd]] unit:<br />
<br />
# systemctl start nft-blackhole.service<br />
<br />
for enable autostart:<br />
<br />
# systemctl enable nft-blackhole.service<br />
<br />
===== List counter packages dropped/accept =====<br />
# nft list chain inet blackhole input<br />
<br />
===== List table and sets for blackhole =====<br />
# nft list table inet blackhole<br />
<br />
===== Refresh lists =====<br />
Manual:<br /><br />
# systemctl reload nft-blackhole.service<br />
[[crontab]], for example:<br />
0 */6 * * * systemctl reload nft-blackhole.service<br />
Systemd Timer:<br />
# systemctl enable --now nft-blackhole-reload.timer<br />
# systemctl list-timers --all</div>Tomaszchttps://wiki.archlinux.org/index.php?title=Nft-blackhole&diff=606445Nft-blackhole2020-04-17T19:07:08Z<p>Tomaszc: Initial release</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Firewalls]]<br />
<br />
[https://github.com/tomasz-c/nft-blackhole nft-blackhole] - script / daemon to blocking IP in [[nftables]] by country and black lists.<br />
== Features ==<br />
<br />
* download publicly available blacklists and block IPs from them,<br />
* block or whitelist individual countries,<br />
* whitelist individual networks or IP addresses,<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{AUR|nft-blackhole}} package.<br />
<br />
== Configuration file ==<br />
In the configuration file ''/etc/nft-blackhole.conf'' you can define:<br />
<br />
* IP versions supported (ipv4, ipv6),<br />
* blocking policy (reject, drop,)<br />
* network or IP addresses for the white list,<br />
* blacklist url addresses,<br />
* list of countries, policy for countries (accept, block)<br />
<br />
== Usage ==<br />
As root for start [[systemd]] unit:<br />
<br />
# systemctl start nft-blackhole.service<br />
<br />
for enable autostart:<br />
<br />
# systemctl enable nft-blackhole.service<br />
<br />
===== List counter packages dropped/accept =====<br />
# nft list chain inet blackhole input<br />
<br />
===== List table and sets for blackhole =====<br />
# nft list table inet blackhole<br />
<br />
===== Refresh lists =====<br />
Manual:<br /><br />
# systemctl reload nft-blackhole.service<br />
or add to root [[crontab]] for automatic refresh, for example:<br />
0 */6 * * * systemctl reload nft-blackhole.service<br />
for refreshing every six hours.</div>Tomaszchttps://wiki.archlinux.org/index.php?title=Talk:Intel_graphics&diff=251623Talk:Intel graphics2013-03-22T19:53:20Z<p>Tomaszc: /* Disable VSYNC */ new section</p>
<hr />
<div>=== Setting gamma and brightness ===<br />
<br />
''Intel offers no way to adjust these at the driver level. Luckily these can be set with {{ic|xgamma}} and {{ic|xrandr}}.''<br />
<br />
<s>Adding acpi_backlight=vendor to the kernel boot line allows the backlight to be changed on the Intel HD 3000 via xbacklight without root access. Perhaps a note could be added to provide this option. <br />
[[User:Papabean|papabean]] ([[User talk:Papabean|talk]]) 02:40, 14 January 2013 (UTC)</s><br />
<br />
acpi_backlight=vendor stopped working a few kernels ago. (No. I did not revert to be certain).<br />
<br />
However, [https://www.archlinux.org/packages/?sort=&repo=Community&q=intel-gpu-tools intel-gpu-tools] in the [[Arch_User_Repository#.5Bcommunity.5D|community]] repository includes the intel_backlight utility which allows one to manually set the backlight level.<br />
<br />
[[User:Papabean|papabean]] ([[User talk:Papabean|talk]]) 04:36, 11 February 2013 (UTC)<br />
<br />
== Best performance options ==<br />
<br />
In my experience (i5 CPU w/ HD4000, Z77 mobo) the best performance can be had with the following options:<br />
<br />
* SNA acceleration method<br />
* Vertical sync '''enabled'''<br />
* TearFree option '''enabled'''<br />
* {{ic|<nowiki>i915.semaphores=1</nowiki>}} kernel option turned on<br />
<br />
Using the [[Repo-ck | ck kernel]] specific to the CPU architecture also seems to make the video performance more consistent, but not necessarily any faster.<br />
<br />
== Disable VSYNC ==<br />
<br />
''I suggest that the restoration of this entry, it was very useful''<br />
<br />
To disable VSYNC, adjust {{ic|/etc/X11/xorg.conf.d/20-intel.conf}} in {{ic|Section "Device"}} the string {{ic|Option "SwapbuffersWait" "false"}}.<br />
<br />
Alternatively, set {{ic|vblank_mode}} to {{ic|0}} in {{ic|~/.drirc}} and make sure that {{ic|driver}} is set to {{ic|dri2}}:<br />
<br />
{{hc|~/.drirc|2=<br />
<device screen="0" driver="dri2"><br />
<application name="Default"><br />
<option name="vblank_mode" value="0"/><br />
</application><br />
</device>}}</div>Tomaszchttps://wiki.archlinux.org/index.php?title=Laptop&diff=248908Laptop2013-03-02T15:31:06Z<p>Tomaszc: </p>
<hr />
<div>[[Category:Laptops]]<br />
[[cs:Laptop]]<br />
[[es:Laptop]]<br />
[[it:Laptop]]<br />
[[ru:Laptop]]<br />
[[zh-CN:Laptop]]<br />
== Setting Up For Laptops ==<br />
This page should contain links to pages needed for configuring a laptop for the best experience. Setting up a laptop is in many ways the same as setting up a desktop. However, there are a few key differences. When setting up a laptop with Arch Linux, the following points should be taken into consideration:<br />
<br />
* [[#Power Management]] Power Management for laptops refers to optimizing the system to last as long as possible on a single battery charge. This can be accomplished by a variety of tweaks.<br />
** [[#Suspend and Hibernate]] : the operating system can be manually suspended either to memory or to disk, allowing for an (almost) complete shutdown of other hardware.<br />
** Hard drive spindown : the system can be configured to automatically turn off the hard disk after a specified interval of inactivity.<br />
** Screen shut off : the laptop screen can be configured to automatically turn off after a specified interval of inactivity (not just blanked with a screensaver but completely shut off).<br />
** CPU frequency scaling : the processor(s) can be configured to automatically step down to a lower frequency at lower loads.<br />
<br />
* [[#Screen brightness]]. How do I manage screen brightness?<br />
* Network and wireless setup is described in [[Wireless Setup]].<br />
* Media buttons can be configured as described in [[Extra Keyboard Keys]].<br />
* [[#Touchpad]] sensitivity, acceleration, button function and scroll borders can be configured for some (Synaptics or Alps) touchpads.<br />
* [[#Hard disk shock protection]] <br />
<br />
All of these points are important to take into consideration when getting a laptop set up the way you like. Fortunately, Arch Linux provides all the tools and programs necessary to take complete control of your laptop. These programs and utilities are highlighted below, with appropriate tips tutorials.<br />
<br />
== Power Management ==<br />
Power management is very important for anyone who wishes to make good use of their battery capacity. The following tools and programs help to increase battery life and keep your laptop cool and quiet.<br />
<br />
=== Battery State ===<br />
<br />
==== Udev events ====<br />
<br />
When battery charges/discharges it sends events which can be handled by udev. Example of how it could be used is presented below.<br />
<br />
==== Low charge action ====<br />
<br />
By default, system won't do anything if your laptop's battery is going to discharge. In order not to lose all unsaved work this example udev rule could be used:<br />
{{hc|/etc/udev/rules.d/lowbat.rules|<nowiki><br />
## SLEEP IF BATTERY IS LOW<br />
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="2", RUN+="/usr/bin/systemctl suspend"<br />
</nowiki>}}<br />
Likewise, the rule can be customized to perform other action on different status.<br />
<br />
==== Utilities ====<br />
<br />
Battery state can be read using ACPI utilities from the terminal. ACPI command line utilities are provided via the {{Pkg|acpi}} package. A simple battery monitor that sits in the system tray is {{AUR|batterymon-clone}} which can be found in the [[Arch User Repository|AUR]].<br />
<br />
{{Tip|More information can be found in the [[ACPI modules]] article.}}<br />
<br />
* {{pkg|batti}} is a simple battery monitor for the system tray, similar to batterymon-clone. Unlike the latter {{ic|batti}} uses UPower, and if that is missing DeviceKit.Power, for it's power information.<br />
<br />
=== Suspend and Hibernate ===<br />
<br />
Manually suspending the operating system, either to memory (standby) or to disk (hibernate) sometimes provides the most efficient way to optimize battery life, depending on the usage pattern of the laptop. While there is relatively straightforward support in the linux kernel to support these operations, typically some adjustments have to be made before initiating these operations (typically due to problematic drivers, modules or hardware). The following tools provide wrappers around the kernel interfaces to suspend/resume :<br />
<br />
* [[Acpid]]<br />
* [[Pm-utils]]<br />
* [[Uswsusp]]<br />
<br />
which are described in more detail in [[Suspend]].<br />
<br />
===Power saving===<br />
<br />
See the main article, [[power saving]].<br />
<br />
==== Automatic tweaks for battery life ====<br />
<br />
As opposed to manually initiated actions like suspend/hibernate, a number of tweaks can be made to prolong the battery life of the laptop under low/idle usage.<br />
<br />
* [[CPU Frequency Scaling]] is a technology used primarily by notebooks which enables the OS to scale the CPU frequency up or down, depending on the current system load and/or power scheme.<br />
* [[Laptop Mode Tools]] provides a comprehensive suite of tools to tweak a large number of power saving settings through well documented configuration files.<br />
* [[Powertop]] is a handy utility from Intel that displays which hardware/processes are using the most power on your system, and provides instructions on how to stop or remove power-wasting services. Works great for mobile Intel CPUs; provides the current CPU state and suggestions for power saving. Also works on AMD systems, but does not provide as much information about the CPU state.<br />
<br />
The following options are specific to certain laptop types:<br />
<br />
* [[Asus_G1#The_Lapsus_daemon_.26_KDE_applet|Lapsus]] is a set of programs providing easy access to many features of various laptops. It currently supports most features provided by asus-laptop kernel module from ACPI4Asus project, such as additional LEDs, hotkeys, backlight control etc. It also has support for some IBM laptops features provided by IBM ThinkPad ACPI Extras Driver and NVRAM device.<br />
* Battery tweaks for Thinkpads can be found in the [[tp_smapi]] article.<br />
* [[TLP]] for Thinkpads is a set of scripts, which set many powersaving options according to the current Powersource. [[TLP]] is intended to be used on Thinkpads, but most settings should work on other laptops too.<br />
<br />
====PCI-e ASPM====<br />
On some laptops, powertop suggests enabling the {{ic|CONFIG_PCIEASPM}} kernel option. It can be found under "Bus options (PCI etc.)"->"PCI Express ASPM support". This option is marked as experimental in the current kernel (2.6.35) and allows the PCI-e links to enter a power saving state. <br />
<br />
According to [http://www.lesswatts.org/projects/devices-power-management/pcie.php], this option might degrade performance a bit, but on an Acer 3820TG laptop, it can reduce power consumption by about one third or even more.<br />
<br />
More experience with this setting would be appreciated, so please share them [https://bbs.archlinux.org/viewtopic.php?id=107173 here]!<br />
<br />
It seems like the option is going to be enabled by default in kernel 2.6.36; if so, the information here will be obsolete soon. However, if your system should be able to make use of this power management feature but you are receiving messages like like the following (check {{ic|/var/log/everything.log*}}):<br />
<br />
disabling ASPM on pre-1.1 PCI-e device. You can enable it with 'pcie_aspm=force'<br />
<br />
then add {{ic|pcie_aspm<nowiki>=</nowiki>force}} to your kernel command line.<br />
<br />
==== Granola ====<br />
<br />
{{Out of date|Arch Linux has moved to systemd, so rc.conf is no longer used.}}<br />
<br />
[https://aur.archlinux.org/packages.php?ID=36841 Granola] is a daemon that monitors the cpu usage and uses the cpufreq-userspace module to lessen power usage without any noticeable difference in performance.<br />
To use it, first install from the AUR:[https://aur.archlinux.org/packages.php?ID=36841], the default settings will work for most setups.<br />
You will need to load the cpufreq_userspace module, as well as the cpufreq scaling governor for your CPU at startup.<br />
Edit {{ic|/etc/rc.conf}}:<br />
For most generic cpus:<br />
<br />
MODULES=( ... cpufreq_userspace acpi-cpufreq ... )<br />
<br />
For Intel Atom or Pentium 4 cpus:<br />
<br />
MODULES=( ... cpufreq_userspace p4_clockmod ... )<br />
<br />
Then add Granola to the DAEMONS array:<br />
<br />
DAEMONS=( ... granola ... )<br />
<br />
and reboot. <br />
<br />
To test if it worked, run:<br />
<br />
cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq<br />
#OR<br />
cpufreq-info #if you have cpufreq-utils installed<br />
<br />
and check that the cpu frequency is below maximum.<br />
<br />
====WLAN-device====<br />
When often en route working with your Notebook without WLAN-Access around, it might be expedient to add a little script to your system startup that automatically turns off your WLAN-Hardware to keep it from searching for Access Points and wasting power on this, when not connected:<br />
<br />
#!/bin/bash<br />
<br />
essid="`iwconfig wlan0 | grep ESSID | awk {'print $4'}`"<br />
if [ "$essid" == "ESSID:off/any" ] ; then<br />
sudo iwconfig wlan0 txpower off<br />
fi<br />
[edit, if wlan0 is not your WLAN-device]<br />
<br />
Start the script according to your DE/WM options by '(sleep xx && /path/to/script)' depending on how long it usually takes to connect to your Access Point, 60 seconds are a good default value. It will check if you're connected, turning off the device if not.<br />
sudo iwconfig wlan0 txpower on<br />
will bring it back up, as, of course, a reboot will.<br />
<br />
==== Disk-related tweaks ====<br />
Disable file access time: every time you access (read) a file the filesystem writes an access time to the file metadata. You can disable this on individual files by using the chattr command, or you can enable it on an entire disk by setting the ''noatime'' option in your fstab, as follows:<br />
<br />
/dev/sda1 / ext3 defaults,noatime 1 2<br />
<br />
[http://www.faqs.org/docs/securing/chap6sec73.html Source]<br />
<br />
{{Note|<br />
* Disabling {{ic|atime}} causes troubles with [[Mutt|mutt]] and other applications that make use of file timestamps. Consider compromising between performance and compatibility by using mount option {{ic|relatime}} instead, or look into [http://wiki.mutt.org/?MaildirFormat mutt work-around for noatime].<br />
* {{ic|relatime}} is used by default as of kernel 2.6.30, so unless you're using an older kernel, there should be no need to edit fstab.<br />
}}<br />
<br />
To allow the CD/DVD rom to spin down after a while using [[udisks]]:<br />
<br />
# udisks --inhibit-polling /dev/sr0<br />
<br />
==== More tweaks ====<br />
These are some generic suggestions that will work with most laptops.<br />
<br />
Add the following to {{ic|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options usbcore autosuspend=1<br />
<br />
Add the following to {{ic|/etc/sysctl.conf}}<br />
<br />
vm.dirty_writeback_centisecs=1500<br />
vm.laptop_mode=5<br />
<br />
{{Note|''laptop-mode-tools'' automatically rewrites these values based on the values {{Ic|LM_BATT_MAX_LOST_WORK_SECONDS}}, {{Ic|LM_AC_MAX_LOST_WORK_SECONDS}} (both multiplied by 100) resp. {{Ic|LM_SECONDS_BEFORE_SYNC}}, which are set in {{ic|/etc/laptop-mode/laptop-mode.conf}}. However, that only happens if the three "Enable laptop mode" variables in the same file are set accordingly — left to 0, it resets the values to kernel defaults (500 / 0) for the corresponding scenario regardless of {{ic|/etc/sysctl.conf}}.}}<br />
<br />
{{accuracy|reason=This belongs in a udev rule, not rc.local.}}<br />
<br />
Add the following to {{ic|/etc/rc.local}} (and make sure it gets executed at boot time)<br />
<br />
/usr/sbin/iwpriv your_wireless_interface set_power 5<br />
<br />
Source: [http://www.nervous.it/2007/11/linux-dell-xps-m1330/ here]<br />
<br />
==== Hard drive spin down problem ====<br />
Documented [https://bugs.launchpad.net/ubuntu/+source/acpi-support/+bug/59695 here]<br />
<br />
To prevent your laptop hard drive from spinning down too often (result of too aggressive APM defaults) do the following:<br />
<br />
Add the following to {{ic|/etc/rc.local}}<br />
<br />
hdparm -B 254 /dev/sdX ''where X is your hard drive device''<br />
<br />
If you are using [https://wiki.archlinux.org/index.php/Systemd Systemd]:<br />
<br />
Add the following to {{ic|/etc/udev/rules.d/75-hdparm.rules}}<br />
ACTION=="add", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", RUN+="/sbin/hdparm -B 254 /dev/$kernel"<br />
<br />
You can also set it to 255 to completely disable spinning down. You may wish to set a lower value if you move your laptop around as lower values park the heads more often and reduce the chance of damage to your hard disk while it is being moved. If you do not move your laptop at all when you are using it, then 255 or 254 is probably best. If you do, then you might want to try a lower value. A value like 128 might be a good middle-ground.<br />
<br />
Add the following to {{ic|/etc/pm/sleep.d/50-hdparm_pm}}<br />
<br />
#!/bin/sh<br />
<br />
if [ -n "$1" ] && ([ "$1" = "resume" ] || [ "$1" = "thaw" ]); then<br />
hdparm -B 254 /dev/your-hard-drive > /dev/null<br />
fi<br />
<br />
and run ''chmod +x /etc/pm/sleep.d/50-hdparm_pm'' to make sure it resets after suspend. Again, you can change the value 254 as you see fit.<br />
<br />
Now the APM level should be set for your hard drive.<br />
<br />
For some laptops, the option -S to hdparm can also be relevant (sets the spindown time for the drive). Note that all these options can also be configured using the [[Laptop_Mode_Tools | laptop-mode tools]]. This will allow you to set a high value when on AC and a lower value when you are running on battery power.<br />
<br />
=== Using a script and an udev rule ===<br />
Since systemd users can suspend and hibernate through {{ic|systemctl suspend}} or {{ic|systemctl hibernate}} and handle acpi events with {{ic|/etc/systemd/logind.conf}}, it might be interesting to remove pm-utils and acpid. Now, there's just one thing systemd can't do (at this time of writing): powermanagement, depending on whether the system is running on AC or battery. To fill this gap, one can create a single udev rule that launches a script when the laptop is unplugged and plugged:<br />
{{hc|/etc/udev/rules.d/powersave|2=<nowiki><br />
SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="/path/to/your/script true"<br />
SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="/path/to/your/script false"<br />
</nowiki>}}<br />
{{Note|One can use the same script that pm-powersave uses. You just have to make it executable and place it somewhere else (for example, /usr/bin).}}<br />
Examples of powersave scripts can be found here: [https://bbs.archlinux.org/viewtopic.php?pid=1046075#p1046075] (or in aur: {{AUR|powerdown}}), here: [https://github.com/Unia/powersave] and there: [https://aur.archlinux.org/packages/powerconf].<br />
<br />
The above udev rule should work as expected, but if your power settings aren't updated after a suspend or hibernate cycle, you should add a script in {{ic|/usr/lib/systemd/system-sleep/}} with the following contents:<br />
{{hc|/usr/lib/systemd/system-sleep/00powersave|<nowiki><br />
#!/bin/sh<br />
<br />
case $1 in<br />
pre) /path/to/your/script false ;;<br />
post) <br />
if cat /sys/class/power_supply/AC0/online | grep 0 > /dev/null 2>&1<br />
then<br />
/path/to/your/script true <br />
else<br />
/path/to/your/script false<br />
fi<br />
;;<br />
esac'<br />
exit 0<br />
</nowiki>}}<br />
<br />
Don't forget to make it executable!<br />
{{Note|Be aware that AC0 may be different for your laptop, change it if that is the case.}}<br />
<br />
Now you don't need pm-utils anymore. Depending on your configuration, it may be a dependency of some other package. If you wish to remove it anyway, run {{ic|pacman -Rdd pm-utils}}.<br />
<br />
== Screen brightness ==<br />
{{Merge|Backlight}}<br />
To change your display brightness, first check {{ic|/sys/class/backlight}}:<br />
<br />
# ls /sys/class/backlight/<br />
intel_backlight<br />
<br />
So this particular backlight is managed by an Intel card. Keep in mind that different cards might manage this differently! It is called ''acpi_video0'' on an ATI card, for instance.<br />
<br />
Check current value:<br />
<br />
$ cat /sys/class/backlight/intel_backlight/brightness<br />
<br />
In this case, the backlight managed by echoing values into {{ic|/sys/class/backlight/intel_backlight/brightness}}:<br />
<br />
# echo "400" > /sys/class/backlight/intel_backlight/brightness<br />
<br />
If you get a response along the lines of "invalid argument" then you didn't honor the maximum brightness. Obviously you cannot go any higher than your screens maximum brightness. The values for maximum brightness and brightness in general vary wildly among cards. This Intel card, for instance, can go up to 976 while the ATI can go up 9. Obviously these values don't say anything about maximum effective brightness.<br />
<br />
Check your maximum brightness: <br />
<br />
$ cat /sys/class/backlight/intel_backlight/max_brightness<br />
<br />
If your laptop's Fn keys don't work or Gnome/KDE fail to correctly set the brightness using their power daemons, you can try appending '''acpi_backlight=vendor''' to your kernel line in your bootloader.<br />
<br />
=== setpci fallback method ===<br />
{{Warning| The setpci command edits hardware parameters. Use with caution.}}<br />
On some laptops, the above methods do not actually change screen brightness. If this is the case for your laptop, first find the domain and bus using lspci:<br />
$ lspci<br />
(...)<br />
00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 09)<br />
(...)<br />
Now use setpci to change the value at slot F4 to, say, a0:<br />
# setpci -s 00:02.0 f4.b=a0<br />
The {{ic|.b}} indicates a byte value; this runs in hexadecimal from {{ic|00}} to {{ic|ff}}. '''ff''' Is usually the brightest, although this may be reversed. See [https://bbs.archlinux.org/viewtopic.php?pid=1088825#p1088825 here] for a script which can be used with brightness keys.<br />
<br />
== Touchpad ==<br />
To get your touchpad working properly, see the [[Touchpad Synaptics]] page. Note that your laptop may have an ALPS touchpad (such as the DELL Inspiron 6000), and not a Synaptics touchpad. In either case, see the link above.<br />
<br />
== Hard disk shock protection ==<br />
There are several laptops from different vendors featuring shock protection capabilities. As manufacturers have refused to support open source development of the required software components so far, Linux support for shock protection varies considerably between different hardware implementations.<br />
<br />
Currently, two projects, named HDAPS and hpfall, support this kind of protection.<br />
HDAPS is for IBM/Lenovo Thinkpads and hpfall for HP/Compaq laptops<br />
<br />
Just Check [[HDAPS|Hard Disk Active Protection System]].<br />
{{AUR|hpfall}} can be installed from the [[AUR]].<br />
<br />
== Network Time Syncing ==<br />
For a laptop, it may be a good idea to use [[Chrony]] as an alternative to [[NTPd]] to sync your clock over the network. Chrony is designed to work well even on systems with no permanent network connection (such as laptops), and is capable of much faster time synchronisation than standard ntp. Chrony has several advantages when used in systems running on virtual machines, such as a larger range for frequency correction to help correct quickly drifting clocks, and better response to rapid changes in the clock frequency. It also has a smaller memory footprint and no unnecessary process wakeups, improving power efficiency.<br />
<br />
== See also ==<br />
* [http://www.linux-on-laptops.com/ http://www.linux-on-laptops.com/]<br />
* [http://www.linlap.com/ http://www.linlap.com/]</div>Tomaszchttps://wiki.archlinux.org/index.php?title=Xorg&diff=150464Xorg2011-08-01T21:57:47Z<p>Tomaszc: </p>
<hr />
<div>[[Category:X Server (English)]]<br />
{{i18n|Xorg}}<br />
[[pl:Xorg]]<br />
[[fr:Xorg]]<br />
<br />
{{Article summary start}}<br />
{{Article summary text|An all-inclusive overview about installing and managing Xorg}}<br />
{{Article summary heading|Overview}}<br />
{{Article summary text|{{Graphical user interface overview}}}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|ATI}}<br />
{{Article summary wiki|Intel}}<br />
{{Article summary wiki|NVIDIA}}<br />
{{Article summary end}}<br />
<br />
'''Xorg''' is the public, open-source implementation of the X window system version 11. Since Xorg is the most popular choice among Linux users, its ubiquity has led to making it an ever-present requisite for GUI applications, resulting in massive adoption from most distributions. See the [[Wikipedia:X.Org Server|Xorg]] Wikipedia article or visit the [http://www.x.org/wiki/ Xorg website] for more details.<br />
<br />
==Installing==<br />
<br />
First, you'll need the X server:<br />
# pacman -Syu xorg-server <br />
<br />
Install the xorg-xinit package if you want to start X without a display manager:<br />
# pacman -S xorg-xinit<br />
<br />
Optionally, install twm, xclock and xterm for the default xorg-xinit environment:<br />
# pacman -S xorg-twm xorg-xclock xterm<br />
<br />
You may also want the useful Xorg utilities:<br />
# pacman -S xorg-utils xorg-server-utils <br />
<br />
udev will detect your hardware and evdev will act as the hotplugging input driver for almost all devices. Installing input drivers is not needed for most hardware.<br />
<br />
If evdev doesn't support your device, install the needed driver from the '''xorg-input-drivers''' group.<br />
<br />
Xorg-server can be initiated by the '''startx''' command (from the xorg-xinit package). By default, it starts a basic environment with twm, xclock and xterm. You can switch to a custom environment by editing {{Filename|~/.xinitrc}}.<br />
<br />
{{Note|You may also start X using a display manager such as KDM. See [[Display Manager]] for more info.}}<br />
<br />
==Configuring==<br />
<br />
Xorg can be configured via {{Filename|/etc/X11/xorg.conf}} or {{Filename|/etc/xorg.conf}} and configuration files located in {{Filename|/etc/X11/xorg.conf.d/}}. Arch supplies default configuration files in {{Filename|/etc/X11/xorg.conf.d}}, and no extra configuration is necessary for most setups.<br />
<br />
You should have {{filename|10-evdev.conf}} which manages the keyboard, the mouse, the touchpad and the touchscreen.<br />
<br />
You are free to create new config files, but they must start with '''XX-''' (where XX is a number) and have a '''.conf''' suffix (10 read before 20 for example).<br />
<br />
===Touchpad/Synaptics===<br />
<br />
If you have a laptop, you need to install the touchpad driver.<br />
# pacman -S xf86-input-synaptics<br />
<br />
After installation, you can find {{filename|10-synaptics.conf}} in the {{filename|/etc/X11/xorg.conf.d}} directory. It is safe to comment out/delete the "InputClass" line regarding the touchpad in {{filename|10-evdev.conf}}.<br />
<br />
===Graphics card and driver===<br />
The default graphics driver is Vesa (xf86-video-vesa), which handles a large number of chipsets but does not include any 2d or 3d acceleration. To enable graphics acceleration, you will need to install and use the driver specific to your graphics card.<br />
<br />
First, identify your card:<br />
$ lspci | grep VGA<br />
<br />
Then, install an appropriate driver. You can ''search'' for these packages with the following command:<br />
# pacman -Ss xf86-video<br />
<br />
Common drivers (open source):<br />
*nvidia: xf86-video-nouveau (see [[Nouveau]])<br />
*intel: xf86-video-intel (see [[Intel]])<br />
*ati: xf86-video-ati (see [[ATI]])<br />
<!--add more drivers with links to wiki pages here--><br />
<br />
====Proprietary drivers====<br />
<br />
Xorg should run smoothly without closed source drivers, which are typically needed only for advanced features such as fast 3D-accelerated rendering for games, dual-screen setups, and TV-out. See [[NVIDIA]] and [[Catalyst]].<br />
<br />
=====Nvidia=====<br />
<br />
During the installation of the proprietary [[NVIDIA]] driver, a config file ('''20-nvidia.conf''') will be installed in the {{filename|/etc/X11/xorg.conf.d}} directory. It allows Xorg to use nvidia's driver at Xorg start.<br />
<br />
===Monitor settings===<br />
<br />
==== Getting started ====<br />
<br />
{{Note|This step is OPTIONAL and shouldn't be done unless you know what you are doing.}}<br />
{{Note|This step is '''NOT OPTIONAL''' if using dual monitors or the nouveau driver. See [[Nouveau#Configuration]].}}<br />
<br />
First, create a new config file, for example, {{filename|/etc/X11/xorg.conf.d/10-monitor.conf}}.<br />
# nano /etc/X11/xorg.conf.d/10-monitor.conf<br />
Copy and paste the following code.<br />
<br />
<pre><br />
Section "Monitor"<br />
Identifier "Monitor0"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "Device0"<br />
Driver "vesa" #Choose the driver used for this monitor<br />
EndSection<br />
<br />
Section "Screen"<br />
Identifier "Screen0" #Collapse Monitor and Device section to Screen section<br />
Device "Device0"<br />
Monitor "Monitor0"<br />
DefaultDepth 16 #Choose the depth (16||24)<br />
SubSection "Display"<br />
Depth 16<br />
Modes "1024x768_75.00" #Choose the resolution<br />
EndSubSection<br />
EndSection<br />
</pre><br />
<br />
====Multiple monitors/Dual screen====<br />
<br />
=====Nvidia=====<br />
To activate dual screen support, you just need to edit the {{filename|10-monitor.conf}} file which you made before.<br />
<br />
Per each physical monitor, add one Monitor, Device, and Screen Section entry, and then a ServerLayout section to manage it. Be advised that when Xinerama is enabled, the Nvidia proprietary driver automatically disables compositing. If you desire compositing, you should comment the Xinerama line in "ServerLayout" out and use Twinview (see below) instead.<br />
<br />
<pre><br />
Section "ServerLayout"<br />
Identifier "DualSreen"<br />
Screen 0 "Screen0"<br />
Screen 1 "Screen1" RightOf "Screen0" #Screen1 at the right of Screen0<br />
Option "Xinerama" "1" #To move windows between screens<br />
EndSection<br />
<br />
Section "Monitor"<br />
Identifier "Monitor0"<br />
Option "Enable" "true"<br />
EndSection<br />
<br />
Section "Monitor"<br />
Identifier "Monitor1"<br />
Option "Enable" "true"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "Device0"<br />
Driver "nvidia"<br />
Screen 0<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "Device1"<br />
Driver "nvidia"<br />
Screen 1<br />
EndSection<br />
<br />
Section "Screen"<br />
Identifier "Screen0"<br />
Device "Device0"<br />
Monitor "Monitor0"<br />
DefaultDepth 24<br />
Option "TwinView" "0"<br />
SubSection "Display"<br />
Depth 24<br />
Modes "1280x800_75.00"<br />
EndSubSection<br />
EndSection<br />
<br />
Section "Screen"<br />
Identifier "Screen1"<br />
Device "Device1"<br />
Monitor "Monitor1"<br />
DefaultDepth 24<br />
Option "TwinView" "0"<br />
SubSection "Display"<br />
Depth 24<br />
EndSubSection<br />
EndSection<br />
</pre><br />
<br />
======TwinView======<br />
You want only one big screen instead of two. Set the TwinView argument to 1. This option should be used instead of Xinerama (see above), if you desire compositing.<br />
Option "TwinView" "1"<br />
<br />
======Using Nvidia Settings======<br />
You can also use the Nvidia-settings tool, with this method you will use the proprietary software Nvidia provides with their drivers. Simply open the settings as Root, then configure how you wish, and then save the configuration to /etc/X11/xorg.conf.d/10-monitor.conf .<br />
<br />
=====More than one graphic card=====<br />
You must define the good driver to use and put the ID bus of your graphic cards.<br />
<pre><br />
Section "Device"<br />
Identifier "Screen0"<br />
Driver "nouveau"<br />
BusID "PCI:0:12:0"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "Screen1"<br />
Driver "radeon"<br />
BusID "PCI:1:0:0"<br />
EndSection<br />
</pre><br />
<br />
To get your ID bus :<br />
$ lspci | grep VGA<br />
01:00.0 VGA compatible controller: nVidia Corporation G96 [GeForce 9600M GT] (rev a1)<br />
<br />
The ID bus here is 1:0:0.<br />
<br />
=====Script to toggle internal/external display for laptops=====<br />
Script can be used to the keyboard shortcut.<br />
<pre><br />
#!/bin/bash<br />
<br />
IN="LVDS1"<br />
EXT="VGA1"<br />
<br />
if (xrandr | grep "$EXT" | grep "+")<br />
then<br />
xrandr --output $EXT --off --output $IN --auto<br />
else<br />
if (xrandr | grep "$EXT" | grep " connected")<br />
then<br />
xrandr --output $IN --off --output $EXT --auto<br />
fi<br />
fi<br />
</pre><br />
<br />
Internal/external display names you can check:<br />
<pre><br />
# xrandr -q<br />
</pre><br />
<br />
If you do not have {{filename|xrandr}}:<br />
<pre><br />
# pacman -S xorg-xrandr<br />
</pre><br />
<br />
====Display Size and DPI ====<br />
<br />
'''Q:''' How does the Xorg server calculate DPI? <br /><br />
'''A:''' The DPI of the X server is determined in the following manner:<br />
<br />
# The -dpi command line option has highest priority.<br />
# If this is not used, the DisplaySize setting in the X config file is used to derive the DPI, given the screen resolution.<br />
# If no DisplaySize is given, the monitor size values from DDC are used to derive the DPI, given the screen resolution.<br />
# If DDC does not specify a size, 75 DPI is used by default.<br />
<br />
In order to get correct dots per inch (DPI) set, the display size must be recognized or set. Having the correct DPI is especially necessary where fine detail is required (like font rendering). Previously, manufacturers tried to create a standard for 96 DPI (a 10.3" diagonal monitor would be 800x600, a 13.2" monitor 1024x768). These days, screen DPIs vary and may not be equal horizontally and vertically. For example, a 19" widescreen LCD at 1440x900 may have a DPI of 89x87. To be able to set the DPI, the Xorg server attempts to auto-detect your monitor's physical screen size through the graphic card with [http://en.wikipedia.org/wiki/Display_Data_Channel DDC]. When the Xorg server knows the physical screen size, it will be able to set the correct DPI depending on resolution size.<br />
<br />
To see if your display size and DPI are detected/calculated correctly:<br />
<br />
$ xdpyinfo | grep dimensions<br />
$ xdpyinfo | grep "dots per inch"<br />
<br />
Check that the dimensions match your display size. If the Xorg server is not able to correctly calculate the screen size, it will default to 75x75 DPI and you will have to calculate it yourself.<br />
<br />
If you have specifications on the physical size of the screen, they can be entered in the Xorg configuration file so that the proper DPI is calculated:<br />
<br />
<pre><br />
Section "Monitor"<br />
Identifier "Monitor0"<br />
DisplaySize 286 179 # In millimeters<br />
EndSection<br />
</pre><br />
<br />
If you only want to enter the specification of your monitor WITHOUT creating a full xorg.conf instead, first create a new config file, for example, {{filename|/etc/X11/xorg.conf.d/90-monitor.conf}}.<br />
# nano /etc/X11/xorg.conf.d/10-monitor.conf<br />
Copy and paste the following code:<br />
<br />
<pre><br />
Section "Monitor"<br />
Identifier "<default monitor>"<br />
DisplaySize 286 179 # In millimeters<br />
EndSection<br />
</pre><br />
<br />
If you do not have specifications for physical screen width and height (most specifications these days only list by diagonal size), you can use the monitor's native resolution (or aspect ratio) and diagonal length to calculate the horizontal and vertical physical dimensions. Using the Pythagorean theorem on a 13.3" diagonal length screen with a 1280x800 native resolution (or 16:10 aspect ratio):<br />
<br />
echo 'scale=5;sqrt(1280^2+800^2)' | bc # 1509.43698<br />
<br />
This will give the pixel diagonal length and with this value you can discover the physical horizontal and vertical lengths (and convert them to millimeters):<br />
<br />
<pre><br />
echo 'scale=5;(13.3/1509)*1280*25.4' | bc # 286.43072<br />
echo 'scale=5;(13.3/1509)*800*25.4' | bc # 179.01920<br />
</pre><br />
<br />
{{Note|This calculation works for most monitor sizes; however, there is the seldom monitor that may compress aspect ratio (e.g 16:10 aspect resolution to a 16:9 monitor). If this is the case, you should measure your screen size manually.}}<br />
<br />
===== Setting DPI manually =====<br />
<br />
DPI can be set manually if you only plan to use one resolution:<br />
<br />
<pre><br />
Section "Monitor"<br />
Identifier "Monitor0"<br />
Option "DPI" "96 x 96"<br />
EndSection<br />
</pre><br />
<br />
If you use Nvidia card, you can manually set the DPI adding the options bellow on ''/etc/X11/xorg.conf.d/20-nvidia.conf'' (inside '''Device''' section):<br />
<br />
Option "UseEdidDpi" "False"<br />
Option "DPI" "96 x 96"<br />
<br />
For RandR compliant drivers, you can set it by:<br />
<br />
xrandr --dpi 96<br />
<br />
See [[Execute commands after X start]] to make it permanent.<br />
<br />
====DPMS====<br />
<br />
DPMS (Display Power Management Signaling) is a technology that allows power saving behaviour of monitors when the computer is not in use. This will allow you to have your monitors automatically go into standby after a predefined period of time. See: [[DPMS]]<br />
<br />
===Disabling Input Hot-plugging===<br />
Since version''' 1.8''' Xorg-server uses udev for device detection. The following will disable the use of udev.<br />
<br />
Section "ServerFlags"<br />
Option "AutoAddDevices" "False"<br />
EndSection<br />
{{Warning|This will disable Xorg hot-plugging for '''all''' input devices and revert to the same behavior as xorg-server 1.4. It is much more convenient to let udev configure your devices. '''Therefore, disabling hot-plugging is not recommended!'''}}<br />
<br />
===InputClasses ===<br />
'''Taken from: https://fedoraproject.org/wiki/Input_device_configuration'''<br />
<br />
InputClasses are a new type of configuration section that does not apply to a single device but rather to a class of devices, including hotplugged devices. An InputClass section's scope is limited by the ''matches'' specified &ndash; to apply to an input device, all matches must apply to a device. An example InputClass section is provided below:<br />
<br />
<pre><br />
Section "InputClass"<br />
Identifier "touchpad catchall"<br />
MatchIsTouchpad "on"<br />
Driver "synaptics"<br />
EndSection<br />
</pre><br />
<br />
The next snippet might also be helpful:<br />
<pre><br />
Section "InputClass"<br />
Identifier "evdev touchpad catchall"<br />
MatchIsTouchpad "on"<br />
MatchDevicePath "/dev/input/event*"<br />
Driver "evdev"<br />
EndSection<br />
</pre><br />
<br />
If this snippet is present in the {{Filename|xorg.conf}} or xorg.conf.d, any touchpad present in the system is assigned the synaptics driver. Note that due to precedence order (alphanumeric sorting of xorg.conf.d snippets) the Driver setting overwrites previously set driver options &ndash; the more generic the class, the earlier it should be listed. The default snippet shipped with the xorg-x11-drv-Xorg package is {{Filename|00-evdev.conf}} and applies the evdev driver to all input devices.<br />
<br />
The match options specify which devices a section may apply to. To match a device, all match lines must apply. The following match lines are supported (with examples):<br />
* {{Codeline|MatchIsPointer}}, {{Codeline|MatchIsKeyboard}}, {{Codeline|MatchIsTouchpad}}, {{Codeline|MatchIsTouchscreen}}, {{Codeline|MatchIsJoystick}} &ndash; boolean options to apply to a group of devices.<br />
* {{Codeline|MatchProduct "foo&#124;bar"}}: match any device with a product name containing either "foo" or "bar"<br />
* {{Codeline|MatchVendor "foo&#124;bar&#124;baz"}}: match any device with a vendor string containing either "foo", "bar", or "baz"<br />
* {{Codeline|MatchDevicePath "/dev/input/event*"}}: match any device with a device path matching the given patch (see fnmatch(3) for the allowed pattern)<br />
* {{Codeline|MatchTag "foo&#124;bar"}}: match any device with a tag of either "foo" or "bar". Tags may be assigned by the config backend &ndash; udev in our case &ndash; to label devices that need quirks or special configuration.<br />
<br />
An example section for user-specific configuration is:<br />
<br />
<pre><br />
Section "InputClass"<br />
Identifier "lasermouse slowdown"<br />
MatchIsPointer "on"<br />
MatchProduct "Lasermouse"<br />
MatchVendor "LaserMouse Inc."<br />
Option "ConstantDeceleration" 20<br />
EndSection<br />
</pre><br />
<br />
This section would match a pointer device containing "Lasermouse" from "Lasermouse Inc." and apply a constant deceleration of 20 on this device &ndash; slowing it down by factor 20.<br />
<br />
Some devices may get picked up by the X server when they really shouldn't be. These devices can be configured to be ignored:<br />
<br />
<pre><br />
Section "InputClass"<br />
Identifier "no need for accelerometers in X"<br />
MatchProduct "accelerometer"<br />
Option "Ignore" "on"<br />
EndSection<br />
</pre><br />
<br />
====Example configurations====<br />
<br />
The following subsections describe example configurations for commonly used configuration options. Note that if you use a desktop environment such as GNOME or KDE, options you set in the xorg.conf ''may'' get overwritten with user-specific options upon login.<br />
<br />
=====Example: Wheel Emulation (for a Trackpoint)=====<br />
<br />
If you own a computer with a Trackpoint (a Thinkpad for example) you can add the following to the {{Filename|xorg.conf}} to use the middle Button to emulate a mouse wheel:<br />
<br />
<pre><br />
Section "InputClass"<br />
Identifier "Wheel Emulation"<br />
MatchIsPointer "on"<br />
MatchProduct "TrackPoint"<br />
Option "EmulateWheelButton" "2"<br />
Option "EmulateWheel" "on"<br />
EndSection<br />
</pre><br />
<br />
For full support of TrackPoints (including horizontal scrolling) you can use the following:<br />
<pre><br />
Section "InputClass"<br />
Identifier "Trackpoint Wheel Emulation"<br />
MatchProduct "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device"<br />
MatchDevicePath "/dev/input/event*"<br />
Option "EmulateWheel" "true"<br />
Option "EmulateWheelButton" "2"<br />
Option "Emulate3Buttons" "false"<br />
Option "XAxisMapping" "6 7"<br />
Option "YAxisMapping" "4 5"<br />
EndSection<br />
</pre><br />
<br />
=====Example: Tap-to-click=====<br />
Tap-to-click can be enabled in the mouse configuration dialog (in the touchpad tab) but if you need tapping enabled at gdm already, the following snippet does it for you:<br />
<pre><br />
Section "InputClass"<br />
Identifier "tap-by-default"<br />
MatchIsTouchpad "on"<br />
Option "TapButton1" "1"<br />
EndSection<br />
</pre><br />
<br />
=====Example: Keyboard layout and model on Acer 5920G Laptop=====<br />
<br />
Keyboard model and layout may be set in the file {{filename|/etc/X11/xorg.conf.d/keyboard.conf}} or any other .conf file in the same directory.<br />
* {{Codeline|MatchIsKeyboard "yes"}}: set the input device to a keyboard<br />
* {{Codeline|Option "XkbModel" "acer_laptop"}}: set the keyboard model to an Acer * {{Codeline|Option "XkbLayout" "be"}}: set the keyboard layout to belgian. You may replace {{Codeline|be}} with whatever layout you have.<br />
* {{Codeline|Option "XkbVariant" "sundeadkeys"}}: set the layout variant to Sun dead keys. You may omit the {{Codeline|XkbVariant}} option if you stick with the default variant.<br />
laptop keyboard. You may replace {{Codeline|acer_laptop}} with your actual keyboard layout.<br />
<br />
Note that a list of keyboard layouts and models can be found in {{filename|/usr/share/X11/xkb/rules/base.lst}}<br />
<br />
<pre><br />
Section "InputClass"<br />
Identifier "Keyboard Defaults"<br />
MatchIsKeyboard "yes"<br />
Option "XkbModel" "acer_laptop"<br />
Option "XkbLayout" "be"<br />
Option "XkbVariant" "sundeadkeys"<br />
EndSection<br />
</pre><br />
<br />
===Keyboard settings===<br />
<br />
Xorg may fail to detect your keyboard correctly. This might give problems with your keyboard layout or keyboard model not being set correctly.<br />
<br />
To see a full list of keyboard models, layouts, variants and options, open:<br />
<br />
/usr/share/X11/xkb/rules/xorg.lst<br />
<br />
To set the keymap for the current Xorg session:<br />
# setxkbmap dvorak<br />
<br />
====Key repeat delay and rate====<br />
<br />
Use {{Codeline|xset r rate DELAY RATE}} to change them, then use [[xinitrc]] to make it permanent.<br />
<br />
====Viewing Keyboard Settings====<br />
$ setxkbmap -print -verbose 10<br />
<pre><br />
Setting verbose level to 10<br />
locale is C<br />
Applied rules from evdev:<br />
model: evdev<br />
layout: us<br />
options: terminate:ctrl_alt_bksp<br />
Trying to build keymap using the following components:<br />
keycodes: evdev+aliases(qwerty)<br />
types: complete<br />
compat: complete<br />
symbols: pc+us+inet(evdev)+terminate(ctrl_alt_bksp)<br />
geometry: pc(pc104)<br />
xkb_keymap {<br />
xkb_keycodes { include "evdev+aliases(qwerty)" };<br />
xkb_types { include "complete" };<br />
xkb_compat { include "complete" };<br />
xkb_symbols { include "pc+us+inet(evdev)+terminate(ctrl_alt_bksp)" };<br />
xkb_geometry { include "pc(pc104)" };<br />
};<br />
</pre><br />
<br />
====Setting Keyboard Layout With Hot-Plugging====<br />
To permanently change your keyboard layout, add the following to xorg.conf:<br />
<pre><br />
Section "InputClass"<br />
Identifier "Keyboard Defaults"<br />
MatchIsKeyboard "yes"<br />
Option "XkbLayout" "dvorak"<br />
EndSection<br />
</pre><br />
<br />
Note that this is in an InputClass Section and not the InputDevice section for the keyboard.<br />
<br />
====Setting Keyboard Layout Without Hot-Plugging (deprecated)====<br />
{{Note|Changing the keyboard layout through this method requires disabling input hot-plugging.}}<br />
<br />
To change the keyboard layout, use the XkbLayout option in the keyboard InputDevice section. For example, if you have a keyboard with English (Great Britain) layout, your keyboard InputDevice section might look similar to this:<br />
<br />
<pre><br />
Section "InputDevice"<br />
Identifier "Keyboard0"<br />
Driver "kbd"<br />
Option "XkbLayout" "gb"<br />
EndSection<br />
</pre><br />
<br />
To change the keyboard model, use the XkbModel option in the keyboard InputDevice section. For example, if you have a Microsoft Wireless Multimedia Keyboard:<br />
<br />
Option "XkbModel" "microsoftmult"<br />
<br />
====Switching Between Keyboard Layouts====<br />
To be able to easily switch keyboard layouts, modify the Options used in either of the above two methods. For example, to switch between a US and a Swedish layout using the Caps Lock key, use:<br />
<br />
Option "XkbLayout" "us, se"<br />
Option "XkbOptions" "grp:caps_toggle"<br />
<br />
This is mainly useful if you run a Desktop Environment which does not take care of keyboard layouts for you.<br />
<br />
====Disable mousekeys Permanently====<br />
{{note|1=Now this is disabled by default. [https://bbs.archlinux.org/viewtopic.php?pid=904880#p904880]}}<br />
<br />
To disable the mousekeys permanently and prevent Shift+NumLock or Shift+Alt+NumLock to enable, edit:<br />
/usr/share/X11/xkb/compat/complete<br />
and comment out:<br />
augment "mousekeys"<br />
augment "accessx(full)"<br />
<br />
===Fonts===<br />
See [[Font Configuration]] for information on how to configure font rendering.<br />
<br />
===Sample xorg.conf Files===<br />
Anyone who has an Xorg.conf file written up that works, go ahead and post a link to it here for others to look at. Please do not in-line the entire configuration file; upload it somewhere else and link.<br /><br />
'''Please post input hotplugging configurations only, otherwise note that your config is not using input hotplugging.''' (Xorg 1.8 = udev)<br />
<br />
===== - Sample One: xorg.conf & xorg.conf.d/10-evdev.conf =====<br />
This is a sample configuration file using xorg.conf.d/10-evdev.conf for the keyboard layouts:<br /><br />
''Note: The "InputDevice" sections are commented out, because 10-evdev.conf is taking care of them.''<br />
xorg.conf: http://pastebin.com/raw.php?i=EuSKahkn<br />
xorg.conf.d/10-evdev.conf: http://pastebin.com/raw.php?i=4mPY35Mw><br />
xorg.conf.d/10-monitor.conf (VMWare): http://pastebin.com/raw.php?i=fJv8EXGb<br />
xorg.conf.d/10-monitor.conf (KVM): http://pastebin.com/raw.php?i=NRz7v0Kn<br />
<br />
==Running Xorg==<br />
<br />
{{Daemon|dbus}}<br />
<br />
Finally, start Xorg:<br />
$ startx<br />
or<br />
$ xinit -- /usr/bin/X -nolisten tcp<br />
<br />
{{Note|If you just installed Xorg, there is an empty .xinitrc file in your $HOME that you need to either delete or edit in order for X to start properly. If you do not do this X will show a blank screen with what appears to be no errors in your Xorg.0.log. Simply deleting it will get it running with a default X environment.}}<br />
<br />
The default X environment is rather bare, and you will typically seek to install window managers or desktop environments to supplement X. A list of suitable options is present in [[Common Applications#Window Managers (WM)]].<br />
<br />
If a problem occurs, then view the log at {{Filename|/var/log/Xorg.0.log}}. Be on the lookout for any lines beginning with {{Codeline|(EE)}} which represent errors, and also {{Codeline|(WW)}} which are warnings that could indicate other issues.<br />
<br />
===Methods for starting your Graphical Environment===<br />
What follows are a couple of methods for starting a graphical environment from the command line.<br />
{{Note|If you are using a full-blown Desktop Environment (Gnome, KDE, etc), you might be more interested in reading the wiki page dedicated to said DE.}}<br />
<br />
====Using runlevels====<br />
By default, Linux is set up to have different [[runlevels]]. Arch boots into runlevel 3 by default. Runlevel 5 is typically used in Linux for loading X server.<br />
Edit the file /etc/inittab. In the last section at the bottom of the file, uncomment the appropriate line for your desktop environment's display manager. For example, for XDM (X Display manager) it would look like this:<br />
# Example lines for starting a login manager<br />
x:5:respawn:/usr/bin/xdm -nodaemon<br />
#x:5:respawn:/usr/sbin/gdm -nodaemon<br />
#x:5:respawn:/usr/bin/kdm -nodaemon<br />
#x:5:respawn:/usr/bin/slim >/dev/null 2>&1<br />
<br />
Now, simply start your desktop environment:<br />
# init 5<br />
<br />
====Using .xinitrc====<br />
This method involves the most configuring.<br />
<br />
First we need to configure {{Filename|~/.xinitrc}}<br />
<br />
One of the main functions of this file is to dictate what '''X''' Window client is invoked with the '''/usr/bin/startx''' and/or '''/usr/bin/xinit''' program ''on a per-user basis''. (The '''startx''' script is merely a front end to the more versatile '''xinit''' command.) There are vast amounts of additional configurable specifications and commands that may also be added to {{Filename|~/[[.xinitrc]]}} as you further customize your system.<br />
<br />
{{Note | '''[[.xinitrc]]''' is a so-called 'dot' (.) file. Files in a *nix filesystem which are preceded with a dot (.) are 'hidden' and will not show up with a regular 'ls' command, usually for the sake of keeping directories tidy. Dot files may be seen by issuing '''ls -a'''. The 'rc' denotes ''Run Commands'' and simply indicates that it is a configuration file. Since it controls how a program runs, it is (although historically incorrect) also said to stand for &quot;Run Control&quot;.}}<br />
<br />
The '''startx''' and '''xinit''' commands will start the '''X''' server and clients. To determine the client to run, '''startx/xinit''' will first look to parse a [[.xinitrc]] file in the user's home directory. In the absence of file {{Filename|~/[[.xinitrc]]}}, it defaults to the global xinitrc in the xinit library directory; {{Filename|/etc/X11/xinit/xinitrc}}, which defaults to using the TWM window manager. (Hence, if you invoke startx without a {{Filename|~/[[.xinitrc]]}} file, a TWM session will start.) See further details in the [[.xinitrc]] wiki entry.<br />
<br />
Switch to your '''''normal, non-root''''' user:<br />
<br />
# su - ''yourusername''<br />
<br />
* {{Filename|/etc/skel/}} contains files and directories to provide sane defaults for newly created user accounts. The name '''skel''' is derived from the word '''skeleton''', because the files it contains form the basic structure for users' home directories.<br />
{{Note | This template file '''[[.xinitrc]]''' is available in the {{Filename|/etc/skel}} directory when the package '''xorg-xinit''' is installed.}}<br />
<br />
* Sample .xinitrc provided [[Xinitrc#A_standard_.xinitrc | here]]<br />
Copy the sample xinitrc file from {{Filename|/etc/skel/}} to your home directory:<br />
<br />
$ cp /etc/skel/[[.xinitrc]] ~/<br />
Edit the file:<br />
$ nano ~/.xinitrc<br />
and uncomment the line that corresponds to your Desktop Environment. For example, if you use Xterm, it will look something like this:<br />
<br />
<pre><br />
#!/bin/sh<br />
#<br />
# ~/.xinitrc<br />
#<br />
# Executed by startx (run your window manager from here)<br />
<br />
# exec gnome-session<br />
# exec startkde<br />
# exec startxfce4<br />
# exec wmaker<br />
# exec icewm<br />
# exec blackbox<br />
# exec fluxbox<br />
# exec openbox-session<br />
# ...or the Window Manager of your choice<br />
exec xterm<br />
</pre><br />
<br />
{{Note | ''Be sure to have only '''one''' uncommented '''exec''' line in {{Filename|~/.xinitrc}}''.}}<br />
<br />
Now we're ready to launch X. Start '''X''' as a '''normal, non-root''' user, with:<br />
<br />
$ startx<br />
or<br />
$ xinit<br />
<br />
Your desktop should open up now. You can test your keyboard and its layout in it. Try moving your mouse around and enjoy the view.<br />
<br />
If trouble with automounting is experienced, try using the following command in {{Filename|~/.xinitrc}} instead. (Replace "startxfce4" with the command that is appropriate for your window manager/DE.)<br />
exec ck-launch-session startxfce4<br />
This will ensure the various environment variables are set correctly by starting a clean ConsoleKit session. ConsoleKit is a framework for keeping track of the various users, sessions, and seats present on a system. It provides a mechanism for software to react to changes of any of these items or of any of the metadata associated with them. It works in conjunction with dbus, and other tools.<br />
<br />
==Tips and tricks==<br />
<br />
===X startup ({{Filename|/usr/bin/startx}}) tweaking===<br />
For X's option reference see:<br />
$ man Xserver<br />
<br />
The following options have to be appended to the variable {{Codeline|"defaultserverargs"}} in the {{Filename|/usr/bin/startx}} file:<br />
<br />
* Enable deferred glyph loading for 16 bit fonts:<br />
-deferglyphs 16<br />
<br />
Note: If you start X with kdm, the startx script does not seem to be executed. X options must be appended to the variable {{Codeline|"ServerArgsLocal"}} or {{Codeline|"ServerCmd"}} in the {{Filename|/usr/share/config/kdm/kdmrc}} file. By default kdm options are:<br />
ServerArgsLocal=-nolisten tcp<br />
ServerCmd=/usr/bin/X<br />
<br />
===Virtual X session===<br />
To start another X session in, for example, CTRL + ALT + F8, you need to type this on a console:<br />
xinit /path/to/wm -- :1<br />
<br />
Change "/path/to/wm" to your window manager start file or to your login manager like gdm, kdm, or slim.<br />
<br />
===Nested X session===<br />
To run a nested session of another desktop environment:<br />
$ /usr/bin/Xnest :1 -geometry 1024x768+0+0 -ac -name Windowmaker & wmaker -display :1<br />
<br />
This will launch a Window Maker session in a 1024 by 768 window within your current X session.<br />
<br />
This needs the package ''xorg-server-xnest'' to be installed.<br />
<br />
==Troubleshooting==<br />
===Common problems===<br />
If Xorg will not start, the screen is completely black, the keyboard and mouse are not working, etc., first take these simple steps:<br />
*Check the log file: {{codeline|cat /var/log/Xorg.0.log}}<br />
*Install input driver (keyboard, mouse, joystick, tablet, etc...):<br />
*Finally, search for common problems in [[ATI]], [[Intel]] and [[NVIDIA]] articles.<br />
<br />
===Ctrl-Alt-Backspace doesn't work===<br />
There are two ways of restoring {{keypress|Ctrl}}+{{keypress|Alt}}+{{keypress|Backspace}}; with and without input-hotplugging. Using hot-plugging is recommended.<br />
<br />
====With input hot-plugging====<br />
=====System-wide=====<br />
<br />
Within {{Filename|/etc/X11/xorg.conf.d/10-evdev.conf}}, simply add the following:<br />
<pre><br />
Section "InputClass"<br />
Identifier "Keyboard Defaults"<br />
MatchIsKeyboard "yes"<br />
Option "XkbOptions" "terminate:ctrl_alt_bksp"<br />
EndSection<br />
</pre><br />
<br />
{{Note|On KDE, this system-wide setting has no effect. To restore, go to Kickoff > Computer > System Settings which will open up the System Settings window. Click on 'Input Devices'. In this new window click the Keyboard tab and then click on the advanced tab. In this new window, click the box for 'Configure keyboard options.' Expand the entry for 'Key sequence to kill the X server' and ensure Control + Alt + Backspace is checked. Click Apply and close the System Settings window. You now have your CTRL-ALT-Backspace back in KDE.}}<br />
<br />
=====User-specific=====<br />
Another way is to put this line in [[xinitrc]]:<br />
setxkbmap -option terminate:ctrl_alt_bksp<br />
<br />
====Without input hot-plugging====<br />
New Xorg disables zapping with {{Keypress|Ctrl}}+{{Keypress|Alt}}+{{Keypress|Backspace}} by default. You can enable it by adding the following line to {{Filename|/etc/X11/xorg.conf}},<br />
Option "XkbOptions" "terminate:ctrl_alt_bksp"<br />
to {{codeline|InputDevice}} section for keyboard.<br />
<br />
===Apple keyboard issues===<br />
:''See: [[Apple Keyboard]]''<br />
<br />
===Touchpad tap-click issues===<br />
:''See: [[Synaptics]]''<br />
<br />
===Extra mouse buttons not recognized===<br />
:''See: [[Get All Mouse Buttons Working]]''<br />
<br />
===X clients started with "su" fail===<br />
If you are getting "Client is not authorized to connect to server", try adding the line:<br />
session optional pam_xauth.so<br />
to {{filename|/etc/pam.d/su}}. {{codeline|pam_xauth}} will then properly set environment variables and handle {{codeline|xauth}} keys.<br />
<br />
===Program requests "font '(null)'"===<br />
*Error message: "''unable to load font `(null)'.''"<br />
Some programs only work with bitmap fonts. Two major packages with bitmap fonts are available, xorg-fonts-75dpi and xorg-fonts-100dpi. You do not need both; one should be enough. To find out which one would be better in your case, try this:<br />
$ xdpyinfo | grep resolution<br />
and use what is closer to you (75 or 100 instead of XX)<br />
# pacman -S xorg-fonts-XXdpi<br />
<br />
===Frame-buffer mode problems===<br />
If X fails to start with the following log messages,<br />
<pre><br />
(WW) Falling back to old probe method for fbdev<br />
(II) Loading sub module "fbdevhw"<br />
(II) LoadModule: "fbdevhw"<br />
(II) Loading /usr/lib/xorg/modules/linux//libfbdevhw.so<br />
(II) Module fbdevhw: vendor="X.Org Foundation"<br />
compiled for 1.6.1, module version=0.0.2<br />
ABI class: X.Org Video Driver, version 5.0<br />
(II) FBDEV(1): using default device<br />
<br />
Fatal server error:<br />
Cannot run in framebuffer mode. Please specify busIDs for all framebuffer devices<br />
</pre><br />
uninstall fbdev:<br />
# pacman -R xf86-video-fbdev<br />
<br />
===DRI with Matrox cards stops working===<br />
If you use a Matrox card and DRI stops working after upgrading to Xorg, try adding the line:<br />
Option "OldDmaInit" "On"<br />
to the Device section that references the video card in xorg.conf.<br />
<br />
===Recovery: disabling Xorg before GUI login===<br />
If Xorg is set to boot up automatically and for some reason you need to prevent it from starting up before the login/display manager appears (if {{filename|/etc/rc.conf}} is wrongly configured and Xorg does not recognize your mouse or keyboard input, for instance), you can accomplish this task with two methods.<br />
<br />
*From the GRUB menu, you can specify the runlevel in the kernel line by adding a number to the end of the kernel line specifying the run level you want. The following example sets the run level to 3:<br />
kernel /boot/vmlinuz26 root=/dev/disk/by-uuid/..ro 3<br />
<br />
*If you have not only a faulty {{filename|/etc/rc.conf}} to make Xorg unusable, but you have also set the GRUB menu wait time to zero, or cannot otherwise use GRUB to prevent Xorg from booting, you can use the Arch Linux live CD. Boot up the live CD and login as root. You need a mount point, such as {{filename|/mnt}}, and you need to know the name of the partition you want to mount.<br />
<br />
:You can use the command,<br />
# fdisk -l<br />
:to see your partitions. Usually, the one you want will be resembling {{filename|/dev/sda1}}. Then, to mount this to {{filename|/mnt}}, use<br />
# mount /dev/sda1 /mnt<br />
<br />
:Then your filesystem will show up under {{filename|/mnt}}. So your {{filename|/etc/rc.conf}} file, for example, would be in {{filename|/mnt/etc/rc.conf}}. From here you can delete the {{codeline|gdm}} daemon to prevent Xorg from booting up normally or make any other necessary changes to the configuration.<br />
<br />
==See also==<br />
* [[Display Manager]]<br />
* [[Execute commands after X start]]<br />
* [[Start X at boot]]<br />
* [[Font Configuration]]<br />
* Proprietary Video Drivers<br />
** [[ATI Catalyst]]<br />
** [[NVIDIA]]<br />
* [[Desktop Environment]]<br />
* [[Window Manager]]<br />
* [[Get All Mouse Buttons Working]]</div>Tomaszc