https://wiki.archlinux.org/api.php?action=feedcontributions&user=Sleeping&feedformat=atomArchWiki - User contributions [en]2024-03-28T20:14:56ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Talk:Dark_mode_switching&diff=728818Talk:Dark mode switching2022-05-07T19:19:20Z<p>Sleeping: Add comment about GNOME 42</p>
<hr />
<div>== GNOME 42 ==<br />
<br />
GNOME 42 has built-in dark mode switching, yet the article makes no mention of this. See https://release.gnome.org/42/. The new freedesktop standard should also be mentioned: https://github.com/flatpak/xdg-desktop-portal/blob/d7a304a00697d7d608821253cd013f3b97ac0fb6/data/org.freedesktop.impl.portal.Settings.xml#L33-L45 [[User:Sleeping|Sleeping]] ([[User talk:Sleeping|talk]]) 19:19, 7 May 2022 (UTC)</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Dark_mode_switching&diff=728817Dark mode switching2022-05-07T19:17:08Z<p>Sleeping: Add out of date template since GNOME 42 has built in dark-mode switching.</p>
<hr />
<div>{{Out of date|GNOME 42 has been released, which has built-in dark mode switching.}}<br />
<br />
[[Category:Eye candy]]<br />
[[Category:Accessibility]]<br />
[[ja:ダークモードの切り替え]]<br />
[[ru:Dark mode switching]]<br />
[[zh-hans:Dark mode switching]]<br />
Switching between light and dark modes/themes is nice to have. It allows you to switch to dark mode on sunset or toggle modes with a keyboard shortcut.<br />
<br />
The switch between themes can apply to currently running programs, probably requiring a daemon, or only to newly launched ones.<br />
This article focuses on switching at runtime, so toggling during use affects currently running programs.<br />
<br />
Switching between light and dark mode requires support from applications or application toolkits like [[GTK]] and [[Qt]].<br />
<br />
== Tools ==<br />
<br />
* {{App|[https://gitlab.com/WhyNotHugo/darkman/ darkman]|darkman is a tool that allows automating transitioning to dark mode at sundown, and back to light mode at sunrise. It allows placing drop-in scripts to be run automatically at those times.|https://gitlab.com/WhyNotHugo/darkman/|{{AUR|darkman}}}}<br />
*{{App|[https://github.com/oskarsh/Yin-Yang Yin-Yang]|Yin-Yang is another tool with a similar feature set, running custom scripts is, however, not supported yet.|https://github.com/oskarsh/Yin-Yang|{{AUR|yin-yang-git}}}}<br />
<br />
== Toolkits ==<br />
<br />
=== GTK ===<br />
<br />
To change the light/dark mode, you have to change the used theme.<br />
<br />
Most themes do have a dark variant and those have by convention the suffix {{ic|-dark}}. For example the default [[GTK]] theme {{ic|Adwaita}} has the variant {{ic|Adwaita-dark}}.<br />
<br />
To permanently change to the dark variant, see [[GTK#Dark theme variant]]<br />
<br />
To switch themes instantly for running programs, either a daemon providing the [https://www.freedesktop.org/wiki/Specifications/xsettings-spec/ xsettings spec] or gsettings is required. For desktops running with [[Xorg]], an xsettings daemon is needed. For desktops running with [[Wayland]], gsettings is queried.<br />
<br />
==== xsettings daemon ====<br />
<br />
xsettings is queried for [[Xorg]] sessions<br />
<br />
The xsettings daemon from [[Xfce]] is [https://docs.xfce.org/xfce/xfce4-settings/xfsettingsd xfsettingsd], which is provided by the {{Pkg|xfce4-settings}} package.<br />
<br />
To query current GTK theme:<br />
$ xfconf-query -c xsettings -p /Net/ThemeName<br />
<br />
To set GTK theme:<br />
$ xfconf-query -c xsettings -p /Net/ThemeName -s "new-theme"<br />
<br />
Changes to this entry are instant and affect all GTK applications.<br />
<br />
==== gsettings ====<br />
<br />
gsettings is queried for [[Wayland]] sessions.<br />
<br />
To query the current GTK theme:<br />
$ gsettings get org.gnome.desktop.interface gtk-theme<br />
<br />
To set GTK theme:<br />
$ gsettings set org.gnome.desktop.interface gtk-theme "new-theme"<br />
<br />
Changes to this entry are instant and affect all GTK applications.<br />
<br />
=== Qt ===<br />
<br />
[[Qt]] has theme support similar to GTK.<br />
<br />
One method to theme Qt applications is [[Uniform_look_for_Qt_and_GTK_applications#QGtkStyle|using GTK for styling]].<br />
Changes to the GTK theme then affect Qt applications as well.<br />
<br />
Another method is using a native Qt theme, e.g. {{AUR|adwaita-qt}}. To switch between themes, you can follow [[Qt#Configuration of Qt 5 applications under environments other than KDE Plasma]].<br />
<br />
== Applications ==<br />
<br />
=== Firefox ===<br />
<br />
[[Firefox]] automatically uses the current GTK theme mode and adapts the appearance of the browser accordingly. See [[Firefox#Dark themes]] for some more settings and caveats.<br />
<br />
To change web content smartly, the [https://addons.mozilla.org/firefox/addon/darkreader/ Dark Reader] Add-On is recommended.<br />
<br />
By setting {{ic|Automation}} to {{ic|Use system color scheme}}, Dark Reader activates automatically with dark GTK themes.<br />
<br />
=== Thunderbird ===<br />
<br />
[[Thunderbird]] conforms with the current GTK Theme, but some changes are recommended.<br />
<br />
See [[Thunderbird#Theming tweaks]].<br />
<br />
=== Visual Studio Code ===<br />
<br />
To change the theme in [[Visual Studio Code]], [https://github.com/sandygk/woof-configs/blob/master/bin/set_theme_vscode this script] may help.<br />
<br />
=== Alacritty ===<br />
<br />
[[Alacritty]] has support for multiple custom color schemes. The configuration syntax and published color schemes can be found [https://github.com/alacritty/alacritty/wiki/Color-schemes here].<br />
<br />
To quickly change theme, you should declare a pointer to each color scheme, for example {{ic|&black}}. Then you can switch to a color scheme by simply setting {{ic|colors: *black}}. This change to the configuration file is instant and affects all currently running instances. If not, you may have to set {{ic|live_config_reload: true}}.<br />
<br />
The borders and title bar are themed with GTK. To abide by the GTK theme, you should set the setting {{ic|gtk_theme_variant}} to the default {{ic|None}}.</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Systemd/User&diff=724150Systemd/User2022-03-24T15:06:31Z<p>Sleeping: Add note that Systemd does not look at the set PATH when resolving non-absolute binaries itself.</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:System administration]]<br />
[[fr:Systemd (Français)/User]]<br />
[[it:Systemd (Italiano)/User]]<br />
[[ja:Systemd/ユーザー]]<br />
[[ru:Systemd (Русский)/User]]<br />
[[zh-hans:Systemd (简体中文)/User]]<br />
{{Related articles start}}<br />
{{Related|systemd}}<br />
{{Related|Automatic login to virtual console}}<br />
{{Related|Start X at login}}<br />
{{Related articles end}}<br />
<br />
[[systemd]] offers the ability to manage services under the user's control with a per-user systemd instance, enabling them to start, stop, enable, and disable their own '''user units'''. This is convenient for daemons and other services that are commonly run for a single user, such as [[mpd]], or to perform automated tasks like fetching mail.<br />
<br />
== How it works ==<br />
<br />
As per default configuration in {{ic|/etc/pam.d/system-login}}, the {{ic|pam_systemd}} module automatically launches a {{ic|systemd --user}} instance when the user logs in for the first time. This process will survive as long as there is some session for that user, and will be killed as soon as the last session for the user is closed. When [[#Automatic start-up of systemd user instances]] is enabled, the instance is started on boot and will not be killed. The systemd user instance is responsible for managing user services, which can be used to run daemons or automated tasks, with all the benefits of systemd, such as socket activation, timers, dependency system or strict process control via cgroups.<br />
<br />
Similarly to system units, user units are located in the following directories (ordered by ascending precedence):<br />
<br />
* {{ic|/usr/lib/systemd/user/}} where units provided by installed packages belong.<br />
* {{ic|~/.local/share/systemd/user/}} where units of packages that have been installed in the home directory belong.<br />
* {{ic|/etc/systemd/user/}} where system-wide user units are placed by the system administrator.<br />
* {{ic|~/.config/systemd/user/}} where the user puts their own units.<br />
<br />
When a systemd user instance starts, it brings up the per user target {{ic|default.target}}. Other units can be controlled manually with {{ic|systemctl --user}}. See {{man|7|systemd.special|UNITS MANAGED BY THE USER SERVICE MANAGER}}.<br />
<br />
{{Note|<br />
* Be aware that the {{ic|systemd --user}} instance is a per-user process, and not per-session. The rationale is that most resources handled by user services, like sockets or state files will be per-user (live on the user's home directory) and not per session. This means that all user services run outside of a session. As a consequence, programs that need to be run inside a session will probably break in user services. The way systemd handles user sessions is pretty much in flux. See [https://mail.gnome.org/archives/desktop-devel-list/2014-January/msg00079.html] and [https://lists.freedesktop.org/archives/systemd-devel/2014-March/017552.html] for some hints on where things are going.<br />
* {{ic|systemd --user}} runs as a separate process from the {{ic|systemd --system}} process. User units can not reference or depend on system units or units of other users.<br />
}}<br />
<br />
== Basic setup ==<br />
<br />
All the user units will be placed in {{ic|~/.config/systemd/user/}}. If you want to start units on first login, execute {{ic|systemctl --user enable ''unit''}} for any unit you want to be autostarted.<br />
<br />
{{Tip|If you want to enable a unit for all users rather than the user executing the ''systemctl'' command, run {{ic|systemctl --global enable ''unit''}} as root. Similarly for {{ic|disable}}.}}<br />
<br />
=== Environment variables ===<br />
<br />
The user instance of systemd does not inherit any of the [[environment variables]] set in places like {{ic|.bashrc}} etc. There are several ways to set environment variables for the systemd user instance:<br />
<br />
# For users with a {{ic|$HOME}} directory, create a ''.conf'' file in the {{ic|~/.config/environment.d/}} directory with lines of the form {{ic|1=NAME=VAL}}. Affects only that user's user unit. See {{man|5|environment.d}} for more information.<br />
# Use the {{ic|DefaultEnvironment}} option in {{ic|/etc/systemd/user.conf}} file. Affects all user units.<br />
# Add a drop-in configuration file in {{ic|/etc/systemd/system/user@.service.d/}}. Affects all user units; see [[#Service example]]<br />
# At any time, use {{ic|systemctl --user set-environment}} or {{ic|systemctl --user import-environment}}. Affects all user units started after setting the environment variables, but not the units that were already running.<br />
# Using the {{ic|dbus-update-activation-environment --systemd --all}} command provided by [[dbus]]. Has the same effect as {{ic|systemctl --user import-environment}}, but also affects the D-Bus session. You can add this to the end of your shell initialization file.<br />
# For "global" environment variables for the user environment you can use the {{ic|environment.d}} directories which are parsed by some generators. See {{man|5|environment.d}} and {{man|7|systemd.generator}} for more information.<br />
# You can also write a {{man|7|systemd.environment-generator}} script which can produce environment variables that vary from user to user, this is probably the best way if you need per-user environments (this is the case for {{ic|XDG_RUNTIME_DIR}}, {{ic|DBUS_SESSION_BUS_ADDRESS}}, etc).<br />
<br />
One variable you may want to set is {{ic|PATH}}.<br />
<br />
After configuration, the command {{ic|systemctl --user show-environment}} can be used to verify that the values are correct.<br />
<br />
==== Service example ====<br />
<br />
Create the [[Systemd#Drop-in files|drop-in]] directory {{ic|/etc/systemd/system/user@.service.d/}} and inside create a file that has the extension ''.conf'' (e.g. {{ic|local.conf}}):<br />
<br />
{{hc|/etc/systemd/system/user@.service.d/local.conf|2=<br />
[Service]<br />
Environment="PATH=/usr/lib/ccache/bin:/usr/local/bin:/usr/bin:/bin"<br />
Environment="EDITOR=nano -c"<br />
Environment="BROWSER=firefox"<br />
Environment="NO_AT_BRIDGE=1"<br />
}}<br />
<br />
==== DISPLAY and XAUTHORITY ====<br />
<br />
{{ic|DISPLAY}} is used by any X application to know which display to use and {{ic|XAUTHORITY}} to provide a path to the user's {{ic|.Xauthority}} file and thus the cookie needed to access the X server. If you plan on launching X applications from systemd units, these variables need to be set. Systemd provides a script in {{ic|/etc/X11/xinit/xinitrc.d/50-systemd-user.sh}} to import those variables into the systemd user session on X launch. [https://github.com/systemd/systemd/blob/v219/NEWS#L194] So unless you start X in a nonstandard way, user services should be aware of the {{ic|DISPLAY}} and {{ic|XAUTHORITY}}.<br />
<br />
==== PATH ====<br />
<br />
If you customize your {{ic|PATH}} and plan on launching applications that make use of it from systemd units, you should make sure the modified {{ic|PATH}} is set on the systemd environment. Assuming you set your {{ic|PATH}} in {{ic|.bash_profile}}, the best way to make systemd aware of your modified {{ic|PATH}} is by adding the following to {{ic|.bash_profile}} after the {{ic|PATH}} variable is set:<br />
<br />
{{hc|~/.bash_profile|<br />
systemctl --user import-environment PATH<br />
}}<br />
<br />
{{Note|This will not affect systemd services started before {{ic|PATH}} is imported.}}<br />
<br />
{{Note|Systemd does not look at the set {{ic|PATH}} when resolving non-absolute binaries itself.}}<br />
<br />
==== pam_environment ====<br />
<br />
Environment variables can be made available through use of the {{ic|pam_env.so}} module. See [[Environment variables#Using pam_env]] for configuration details.<br />
<br />
=== Automatic start-up of systemd user instances ===<br />
<br />
The systemd user instance is started after the first login of a user and killed after the last session of the user is closed. Sometimes it may be useful to start it right after boot, and keep the systemd user instance running after the last session closes, for instance to have some user process running without any open session. Lingering is used to that effect. Use the following command to enable lingering for specific user:<br />
<br />
# loginctl enable-linger ''username''<br />
<br />
{{Warning|systemd services are '''not''' sessions, they run outside of ''logind''. Do not use lingering to enable automatic login as it will [[General troubleshooting#Session permissions|break the session]].}}<br />
<br />
== Writing user units ==<br />
<br />
See [[systemd#Writing unit files]] for general information about writing systemd unit files.<br />
<br />
=== Example ===<br />
<br />
The following is an example of a user version of the mpd service:<br />
<br />
{{hc|~/.config/systemd/user/mpd.service|2=<br />
[Unit]<br />
Description=Music Player Daemon<br />
<br />
[Service]<br />
ExecStart=/usr/bin/mpd --no-daemon<br />
<br />
[Install]<br />
WantedBy=default.target<br />
}}<br />
<br />
=== Example with variables ===<br />
<br />
The following is a user service used by {{AUR|foldingathome}}, which takes into account variable home directories where [[Folding@home]] can find certain files:<br />
<br />
{{hc|~/.config/systemd/user/foldingathome-user.service|2=<br />
[Unit]<br />
Description=Folding@home distributed computing client<br />
After=network.target<br />
<br />
[Service]<br />
Type=simple<br />
WorkingDirectory=%h/.config/fah<br />
ExecStart=/usr/bin/FAHClient<br />
CPUSchedulingPolicy=idle<br />
IOSchedulingClass=3<br />
<br />
[Install]<br />
WantedBy=default.target<br />
}}<br />
<br />
As detailed in {{man|5|systemd.unit|SPECIFIERS}}, the {{ic|%h}} variable is replaced by the home directory of the user running the service. There are other variables that can be taken into account in the [[systemd]] manpages.<br />
<br />
=== Reading the journal ===<br />
<br />
The journal for the user can be read using the analogous command:<br />
<br />
$ journalctl --user<br />
<br />
To specify a unit, one can use<br />
<br />
$ journalctl --user-unit myunit.service<br />
<br />
Or, equivalently:<br />
<br />
$ journalctl --user -u myunit.service<br />
<br />
{{Note|journald will not write user journals for users with UIDs below 1000, instead [https://github.com/systemd/systemd/blob/a33687b792908aa6c9f4c0b22e8935643ee0ddb6/src/journal/journald-server.c#L402 directing] everything to the system journal.}}<br />
<br />
== Temporary files ==<br />
<br />
''systemd-tmpfiles'' allows users to manage custom volatile and temporary files and directories just like in the system-wide way (see [[systemd#systemd-tmpfiles - temporary files]]). User-specific configuration files are read from {{ic|~/.config/user-tmpfiles.d/}} and {{ic|~/.local/share/user-tmpfiles.d/}}, in that order. For this functionality to be used, it is needed to enable the necessary systemd user units for your user:<br />
<br />
$ systemctl --user enable systemd-tmpfiles-setup.service systemd-tmpfiles-clean.timer<br />
<br />
The syntax of the configuration files is the same than those used system-wide. See the {{man|8|systemd-tmpfiles}} and {{man|5|tmpfiles.d}} man pages for details.<br />
<br />
== Xorg and systemd ==<br />
<br />
{{Expansion|Cover {{ic|graphical-session.target}}: {{man|7|systemd.special|Special Passive User Units}}, [https://goral.net.pl/post/systemd-x-sessions/].}}<br />
<br />
There are several ways to run xorg within systemd units. Below there are two options, either by starting a new user session with an xorg process, or by launching xorg from a systemd user service.<br />
<br />
=== Automatic login into Xorg without display manager ===<br />
<br />
{{Accuracy|This setup ends up with two user D-Bus buses, one for the desktop, and an other for systemd. Why cannot we use the systemd one alone? }}<br />
<br />
This option will launch a system unit that will start a user session with an xorg server and then run the usual {{ic|~/.xinitrc}} to launch the window manager, etc. You need to have {{AUR|xlogin-git}} installed. Set up your xinitrc as specified in the [[Xinit#xinitrc]] section.<br />
<br />
The session will use its own dbus daemon, but various systemd utilities will automatically connect to the {{ic|dbus.service}} instance. Finally, [[enable]] the {{ic|xlogin@''username''}} service for automatic login at boot. The user session lives entirely inside a systemd scope and everything in the user session should work just fine.<br />
<br />
=== Xorg as a systemd user service ===<br />
<br />
Alternatively, [[xorg]] can be run from within a systemd user service. This is nice since other X-related units can be made to depend on xorg, etc, but on the other hand, it has some drawbacks explained below.<br />
<br />
{{Pkg|xorg-server}} provides integration with systemd in two ways:<br />
<br />
* Can be run unprivileged, delegating device management to logind (see Hans de Goede commits around [https://cgit.freedesktop.org/xorg/xserver/commit/?id=82863656ec449644cd34a86388ba40f36cea11e9 this commit]).<br />
* Can be made into a socket activated service (see [https://cgit.freedesktop.org/xorg/xserver/commit/?id=b3d3ffd19937827bcbdb833a628f9b1814a6e189 this commit]). This removes the need for {{AUR|systemd-xorg-launch-helper-git}}.<br />
<br />
Unfortunately, to be able to run xorg in unprivileged mode, it needs to run inside a session. So, right now the handicap of running xorg as user service is that it must be run with root privileges (like before 1.16), and cannot take advantage of the unprivileged mode introduced in 1.16.<br />
<br />
{{Note|This is not a fundamental restriction imposed by logind, but the reason seems to be that xorg needs to know which session to take over, and right now it gets this information calling [https://www.freedesktop.org/wiki/Software/systemd/logind logind]'s {{ic|GetSessionByPID}} using its own pid as argument. See [https://lists.x.org/archives/xorg-devel/2014-February/040476.html this thread] and [https://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/os-support/linux/systemd-logind.c xorg sources]. It seems likely that xorg could be modified to get the session from the tty it is attaching to, and then it could run unprivileged from a user service outside a session.}}<br />
<br />
{{Warning|1=On xorg 1.18 socket activation seems to be broken. The client triggering the activation deadlocks. See the upstream bug report [https://gitlab.freedesktop.org/xorg/xserver/issues/491]. As a temporary workaround you can start the xorg server without socket activation, making sure the clients connect after a delay, so the server is fully started. There seems to be no nice mechanism to get a startup notification for the X server.}}<br />
<br />
This is how to launch xorg from a user service:<br />
<br />
1. Make xorg run with root privileges for any user, by editing {{ic|/etc/X11/Xwrapper.config}} <br />
<br />
{{hc|/etc/X11/Xwrapper.config|2=<br />
allowed_users=anybody<br />
needs_root_rights=yes<br />
}}<br />
<br />
2. Add the following units to {{ic|~/.config/systemd/user}}<br />
<br />
{{hc|~/.config/systemd/user/xorg@.socket|2=<br />
[Unit]<br />
Description=Socket for xorg at display %i<br />
<br />
[Socket]<br />
ListenStream=/tmp/.X11-unix/X%i<br />
}}<br />
<br />
{{hc|~/.config/systemd/user/xorg@.service|2=<br />
[Unit]<br />
Description=Xorg server at display %i<br />
<br />
Requires=xorg@%i.socket<br />
After=xorg@%i.socket<br />
<br />
[Service]<br />
Type=simple<br />
SuccessExitStatus=0 1<br />
<br />
ExecStart=/usr/bin/Xorg :%i -nolisten tcp -noreset -verbose 2 "vt${XDG_VTNR}"<br />
}}<br />
<br />
where {{ic|${XDG_VTNR}<nowiki/>}} is the virtual terminal where xorg will be launched, either hard-coded in the service unit, or set in the systemd environment with<br />
<br />
$ systemctl --user set-environment XDG_VTNR=1<br />
<br />
{{Note|xorg should be launched at the same virtual terminal where the user logged in. Otherwise logind will consider the session inactive.}}<br />
<br />
3. Make sure to configure the {{ic|DISPLAY}} environment variable as explained [[#DISPLAY and XAUTHORITY|above]].<br />
<br />
4. Then, to enable socket activation for xorg on display 0 and tty 2 one would do:<br />
<br />
$ systemctl --user set-environment XDG_VTNR=2 # So that xorg@.service knows which vt use<br />
$ systemctl --user start xorg@0.socket # Start listening on the socket for display 0<br />
<br />
Now running any X application will launch xorg on virtual terminal 2 automatically.<br />
<br />
The environment variable {{ic|XDG_VTNR}} can be set in the systemd environment from {{ic|.bash_profile}}, and then one could start any X application, including a window manager, as a systemd unit that depends on {{ic|xorg@0.socket}}.<br />
<br />
{{Warning|Currently running a window manager as a user service means it runs outside of a session with the problems this may bring: [[General troubleshooting#Session permissions|break the session]]. However, it seems that systemd developers intend to make something like this possible. See [https://mail.gnome.org/archives/desktop-devel-list/2014-January/msg00079.html] and [https://lists.freedesktop.org/archives/systemd-devel/2014-March/017552.html]}}<br />
<br />
=== X clients as a user service ===<br />
<br />
{{Remove|ArchWiki is not a code patching platform.}}<br />
<br />
With an adapted version of {{Pkg|sx}}, one can easily have all the X clients running as a user service while leaving [[Xorg]], the server, running in a session unprivileged.<br />
<br />
First, put a copy of {{ic|/usr/bin/sx}} under {{ic|/usr/local/bin/}}. The copy can be named e.g. {{ic|sdsx}} so that the original {{ic|sx}} can remain accessible.<br />
<br />
Then, replace<br />
<br />
trap 'DISPLAY=:$tty exec "${@:-$cfgdir/sxrc}" & wait "$!"' USR1<br />
<br />
with<br />
<br />
trap 'systemd-run --user -u sx-client-$tty -E DISPLAY=:$tty -E XAUTHORITY="$XAUTHORITY" \<br />
"${@:-$cfgdir/sxrc}" & wait "$pid"' USR1<br />
<br />
and replace<br />
<br />
<nowiki>(trap '' USR1 && exec Xorg :"$tty" -keeptty vt"$tty" -noreset -auth "$XAUTHORITY") & pid=$!</nowiki><br />
<br />
with<br />
<br />
<nowiki>(trap '' USR1 && exec Xorg :"$tty" -keeptty vt"$tty" -terminate -auth "$XAUTHORITY") & pid=$!</nowiki><br />
<br />
The caveat of this approach is that, if for some reason not a single X client succeeded in reaching the server, the server will need to be killed from another tty manually. Also, if e.g. {{ic|xrdb}} needs to be run in {{ic|sxrc}}, it will now need to be run with the option {{ic|-retain}}. See {{man|1|Xserver}} and {{man|1|xrdb}} for details.<br />
<br />
One of the use cases and/or advantages of this approach is that the X clients will now be running under the user manager ({{ic|user@$uid.service}}) and snippet (i.e. {{ic|systemctl edit}}) applied to it (e.g. {{ic|1=NetworkNamespacePath=}}) will also be applied to the programs running in the graphical environment (including but not limited to the command-line shells running in an terminal emulator).<br />
<br />
== Some use cases ==<br />
<br />
=== Window manager ===<br />
<br />
To run a window manager as a systemd service, you first need to run [[#Xorg as a systemd user service]]. In the following we will use [[awesome]] as an example:<br />
<br />
{{hc|~/.config/systemd/user/awesome.service|2=<br />
[Unit]<br />
Description=Awesome window manager<br />
After=xorg.target<br />
Requires=xorg.target<br />
<br />
[Service]<br />
ExecStart=/usr/bin/awesome<br />
Restart=always<br />
RestartSec=10<br />
<br />
[Install]<br />
WantedBy=wm.target<br />
}}<br />
<br />
{{Note|The {{ic|[Install]}} section includes a {{ic|WantedBy}} part. When using {{ic|systemctl --user enable}} it will link this as {{ic|~/.config/systemd/user/wm.target.wants/''window_manager''.service}}, allowing it to be started at login. Is recommended to enable this service, not to link it manually.}}<br />
<br />
=== Persistent terminal multiplexer ===<br />
<br />
{{Style|Should be rewritten in a less blog-ish style.}}<br />
<br />
You may wish your user session to default to running a terminal multiplexer, such as [[GNU Screen]] or [[Tmux]], in the background rather than logging you into a window manager session. Separating login from X login is most likely only useful for those who boot to a TTY instead of to a display manager (in which case you can simply bundle everything you start in with {{ic|myStuff.target}}). <br />
<br />
To create this type of user session, procede as above, but instead of creating {{ic|wm.target}}, create {{ic|multiplexer.target}}:<br />
<br />
{{bc|1=<br />
[Unit]<br />
Description=Terminal multiplexer<br />
Documentation=info:screen man:screen(1) man:tmux(1)<br />
After=cruft.target<br />
Wants=cruft.target<br />
<br />
[Install]<br />
Alias=default.target<br />
}}<br />
<br />
{{ic|cruft.target}}, like {{ic|mystuff.target}} above, should start anything you think should run before tmux or screen starts (or which you want started at boot regardless of timing), such as a GnuPG daemon session.<br />
<br />
You then need to create a service for your multiplexer session. Here is a sample service, using tmux as an example and sourcing a gpg-agent session which wrote its information to {{ic|/tmp/gpg-agent-info}}. This sample session, when you start X, will also be able to run X programs, since DISPLAY is set.<br />
<br />
{{bc|1=<br />
[Unit]<br />
Description=tmux: A terminal multiplexer <br />
Documentation=man:tmux(1)<br />
After=gpg-agent.service<br />
Wants=gpg-agent.service<br />
<br />
[Service]<br />
Type=forking<br />
ExecStart=/usr/bin/tmux start<br />
ExecStop=/usr/bin/tmux kill-server<br />
Environment=DISPLAY=:0<br />
EnvironmentFile=/tmp/gpg-agent-info<br />
<br />
[Install]<br />
WantedBy=multiplexer.target<br />
}}<br />
<br />
Once this is done, [[enable]] {{ic|tmux.service}}, {{ic|multiplexer.target}} and any services you created to be run by {{ic|cruft.target}} and you should be set to go! [[Start]] {{ic|user@.service}} as usual. Congratulations! You have a running terminal multiplexer and some other useful programs ready to start at boot!<br />
<br />
== Kill user processes on logout ==<br />
<br />
Arch Linux builds the {{pkg|systemd}} package with {{ic|--without-kill-user-processes}}, setting {{ic|1=KillUserProcesses}} to {{ic|no}} by default. This setting causes user processes not to be killed when the user logs out. To change this behavior in order to have all user processes killed on the user's logout, set {{ic|1=KillUserProcesses=yes}} in {{ic|/etc/systemd/logind.conf}}. <br />
<br />
Note that changing this setting breaks terminal multiplexers such as [[tmux]] and [[GNU Screen]]. If you change this setting, you can still use a terminal multiplexer by using {{ic|systemd-run}} as follows:<br />
<br />
$ systemd-run --scope --user ''command'' ''args''<br />
<br />
For example, to run {{ic|screen}} you would do:<br />
<br />
$ systemd-run --scope --user screen -S ''foo''<br />
<br />
Using {{ic|systemd-run}} will keep the process running after logout only while the user is logged in at least once somewhere else in the system and {{ic|user@.service}} is still running. <br />
<br />
After the user logs out of all sessions, {{ic|user@.service}} will be terminated too, by default, unless the user has "lingering" enabled [https://github.com/systemd/systemd/blob/76153ad45f09b6ae45464f2e03d3afefbb4b2afe/NEWS#L274]. To effectively allow users to run long-term tasks even if they are completely logged out, lingering must be enabled for them. See [[#Automatic start-up of systemd user instances]] and {{man|1|loginctl}} for details.<br />
<br />
== Troubleshooting ==<br />
<br />
=== Runtime directory '/run/user/1000' is not owned by UID 1000, as it should ===<br />
<br />
systemd[1867]: pam_systemd(systemd-user:session): Runtime directory '/run/user/1000' is not owned by UID 1000, as it should.<br />
systemd[1867]: Trying to run as user instance, but $XDG_RUNTIME_DIR is not set<br />
<br />
If you see errors such as this and your login session is broken, it is possible that another system (non-user) service on your system is creating this folder. This can happen for example if you use a [[docker]] container that has a bind mount to {{ic|/run/user/1000}}. To fix this, you can either fix the container by removing the mount, or disable/delay the docker service.<br />
<br />
== See also ==<br />
<br />
* [https://bitbucket.org/KaiSforza/systemd-user-units/wiki/Home KaiSforza's Bitbucket wiki]<br />
* [https://github.com/zoqaeski/systemd-user-units Zoqaeski's units on GitHub]<br />
* [https://bbs.archlinux.org/viewtopic.php?id=167115 Arch forum thread about changes in systemd 206 user instances]</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Sxhkd&diff=642470Sxhkd2020-11-26T15:09:50Z<p>Sleeping: /* Usage */ Explain how to configure autostart with Desktop Application Autostart Specification</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Keyboard configuration]]<br />
[[Category:X server]]<br />
[[es:Sxhkd]]<br />
[[ja:Sxhkd]]<br />
{{Related articles start}}<br />
{{Related|Xbindkeys}}<br />
{{Related|Xmodmap}}<br />
{{Related articles end}}<br />
<br />
[https://github.com/baskerville/sxhkd sxhkd] is a simple [[X]] hotkey daemon, by the developer of [[bspwm]], that reacts to input events by executing commands.<br />
<br />
== Installation ==<br />
<br />
[[Install]] {{Pkg|sxhkd}} or {{AUR|sxhkd-git}}.<br />
<br />
== Configuration ==<br />
<br />
=== Configuration file ===<br />
sxhkd defaults to {{ic|$XDG_CONFIG_HOME/sxhkd/sxhkdrc}} for its configuration file. An alternate configuration file can be specified with the {{ic|-c}} option. <br />
<br />
Each line of the configuration file is interpreted as so:<br />
<br />
* If it starts with {{ic|#}}, it is ignored.<br />
* If it starts with one or more white space commands, it is read as a command.<br />
* Otherwise, it is parsed as a hotkey: each key name is separated by spaces and/or {{ic|+}} characters.<br />
<br />
General syntax:<br />
<br />
[MODIFIER + ]*[@|!]KEYSYM<br />
COMMAND<br />
<br />
Where {{ic|MODIFIER}} is one of the following names: {{ic|super}}, {{ic|hyper}}, {{ic|meta}}, {{ic|alt}}, {{ic|control}}, {{ic|ctrl}}, {{ic|shift}}, {{ic|mode_switch}}, {{ic|lock}}, {{ic|mod1}}, {{ic|mod2}}, {{ic|mod3}}, {{ic|mod4}}, {{ic|mod5}}. If {{ic|@}} is added at the beginning of the keysym, the command will be run on key release events, otherwise on key press events. If {{ic|!}} is added at the beginning of the keysym, the command will be run on motion notify events and must contain two integer conversion specifications which will be replaced by the x and y coordinates of the pointer relative to the root window referential (the only valid button keysyms for this type of hotkeys are: {{ic|button1}}, ..., {{ic|button5}}). The {{ic|KEYSYM}} names are those your will get from {{ic|xev}}.<br />
<br />
Mouse hotkeys can be defined by using one of the following special keysym names: {{ic|button1}}, {{ic|button2}}, {{ic|button3}}, ..., {{ic|button24}}. The hotkey can contain a sequence of the form {{{ic|STRING_1}},…,{{ic|STRING_N}}}, in which case, the command must also contain a sequence with ''N'' elements: the pairing of the two sequences generates ''N'' hotkeys. If the command includes curly braces ({{ic|{}}, {{ic|<nowiki>}</nowiki>}}) eg. {{ic|awk '{print $1}'}}, escape them with backslash {{ic|\}} eg. {{ic|awk '\{print $1\}'}}. In addition, the sequences can contain ranges of the form {{ic|A-Z}} where ''A'' and ''Z'' are alphanumeric characters.<br />
<br />
What is actually executed is {{ic|SHELL -c COMMAND}}, which means you can use environment variables in {{ic|COMMAND}}. {{ic|SHELL}} will be the content of the first defined environment variable in the following list: {{ic|SXHKD_SHELL}}, {{ic|SHELL}}. If sxhkd receives a {{ic|SIGUSR1}} signal, it will reload its configuration file.<br />
<br />
== Usage ==<br />
After configuring it, you may wish to setup sxhkd to [[autostart]]. An example [[systemd]] service file is found [https://github.com/baskerville/sxhkd/blob/master/contrib/systemd/sxhkd.service here]. This approach requires [https://wiki.archlinux.org/index.php/Systemd/User#Xorg_as_a_systemd_user_service configuring Xorg as a systemd user service].<br />
<br />
Alternatively, if your desktop environment supports the [https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html Desktop Application Autostart Specification] you can also have it start sxhkd by creating an {{ic|sxhkd.desktop}} file in the appropiate directory: <br />
<br />
{{hc|head=~/.config/autostart/sxhkd.desktop|output=Name=sxhkd<br />
Comment=Simple X hotkey daemon<br />
Exec=/usr/bin/sxhkd<br />
Terminal=false<br />
Type=Application}}<br />
<br />
== Example ==<br />
<br />
{{hc|$XDG_CONFIG_HOME/sxhkd/sxhkdrc|<br />
# On mouse button 1 press Alt_R+F1<br />
button1<br />
xte "keydown Alt_R" "keydown F1" "keyup Alt_R" "keyup F1"<br />
<br />
# On mouse button 2 pause 3 seconds then press Alt_R+F2<br />
button2<br />
xte "sleep 3" "keydown Alt_R" "keydown F2" "keyup Alt_R" "keyup F2"<br />
}}<br />
<br />
Reload user's sxhkd service<br />
<br />
$ systemctl --user restart sxhkd<br />
<br />
== See also ==<br />
<br />
* [https://github.com/baskerville/sxhkd Official website] - includes configuration options, example bindings, and source code.<br />
* [https://bbs.archlinux.org/viewtopic.php?id=155613 ArchLinux forum thread]</div>Sleepinghttps://wiki.archlinux.org/index.php?title=User_talk:Trokhymchuk&diff=638998User talk:Trokhymchuk2020-10-17T10:10:16Z<p>Sleeping: Created page with "Thanks for posting your solution how to fix Telegram fonts! ~~~~"</p>
<hr />
<div>Thanks for posting your solution how to fix Telegram fonts! [[User:Sleeping|Sleeping]] ([[User talk:Sleeping|talk]]) 10:10, 17 October 2020 (UTC)</div>Sleepinghttps://wiki.archlinux.org/index.php?title=User:Sleeping&diff=618739User:Sleeping2020-06-07T19:43:16Z<p>Sleeping: </p>
<hr />
<div>==== Set up Ctrl+/ with XTerm ====<br />
<br />
When using vim, I like to use {{ic|Ctrl+/}} to comment out lines. I added the following to my {{ic|.vimrc}}:<br />
<br />
nmap <C-_> gcc<br />
vmap <C-_> gc<br />
<br />
This worked with {{Pkg|Konsole}}, but it didn't work with [[Xterm]]. Using {{ic|showkey -a}} in Konsole, pressing {{ic|Ctrl+/}} shows:<br />
<br />
^_ 31 0037 0x1f<br />
<br />
To send the same keycode with XTerm, use the following in {{ic|.Xresources}}:<br />
<br />
XTerm.vt100.translations: #override \n\<br />
Ctrl <Key>slash: string(0x1f) \n\</div>Sleepinghttps://wiki.archlinux.org/index.php?title=User:Sleeping&diff=618738User:Sleeping2020-06-07T19:42:47Z<p>Sleeping: </p>
<hr />
<div>==== Set up Ctrl+/ with XTerm ====<br />
<br />
When using vim, I like to use {{ic|Ctrl+/}} to comment out lines. I added the following to my {{ic|.vimrc}}:<br />
<br />
nmap <C-_> gcc<br />
vmap <C-_> gc<br />
<br />
This worked with {{Pkg|Konsole}}, but it didn't work with {{Pkg|xorg-XTerm}}. Using {{ic|showkey -a}} in Konsole, pressing {{ic|Ctrl+/}} shows:<br />
<br />
^_ 31 0037 0x1f<br />
<br />
To send the same keycode with XTerm, use the following in {{ic|.Xresources}}:<br />
<br />
XTerm.vt100.translations: #override \n\<br />
Ctrl <Key>slash: string(0x1f) \n\</div>Sleepinghttps://wiki.archlinux.org/index.php?title=User:Sleeping&diff=618737User:Sleeping2020-06-07T19:42:37Z<p>Sleeping: </p>
<hr />
<div>==== Set up Ctrl+/ with XTerm ====<br />
<br />
When using vim, I like to use {{ic|Ctrl+/}} to comment out lines. I added the following to my {{ic|.vimrc}}:<br />
<br />
nmap <C-_> gcc<br />
vmap <C-_> gc<br />
<br />
This worked with {{Pkg|Konsole}}, but it didn't work with {{Pkg|XTerm}}. Using {{ic|showkey -a}} in Konsole, pressing {{ic|Ctrl+/}} shows:<br />
<br />
^_ 31 0037 0x1f<br />
<br />
To send the same keycode with XTerm, use the following in {{ic|.Xresources}}:<br />
<br />
XTerm.vt100.translations: #override \n\<br />
Ctrl <Key>slash: string(0x1f) \n\</div>Sleepinghttps://wiki.archlinux.org/index.php?title=User:Sleeping&diff=618736User:Sleeping2020-06-07T19:42:05Z<p>Sleeping: </p>
<hr />
<div>==== Set up Ctrl+/ with XTerm ====<br />
<br />
When using vim, I like to use {{ic|Ctrl+/}} to comment out lines. I added the following to my {{ic|.vimrc}}:<br />
<br />
nmap <C-_> gcc<br />
vmap <C-_> gc<br />
<br />
This worked with [[Konsole]], but it didn't work with [[XTerm]]. Using {{ic|showkey -a}} in Konsole, pressing {{ic|Ctrl+/}} shows:<br />
<br />
^_ 31 0037 0x1f<br />
<br />
To send the same keycode with XTerm, use the following in {{ic|.Xresources}}:<br />
<br />
XTerm.vt100.translations: #override \n\<br />
Ctrl <Key>slash: string(0x1f) \n\</div>Sleepinghttps://wiki.archlinux.org/index.php?title=User:Sleeping&diff=618735User:Sleeping2020-06-07T19:41:46Z<p>Sleeping: </p>
<hr />
<div>==== Set up Ctrl+/ with XTerm ====<br />
<br />
When using vim, I like to use {{ic|Ctrl+/}} to comment out lines. I added the following to my {{ic|.vimrc}}:<br />
<br />
nmap <C-_> gcc<br />
vmap <C-_> gc<br />
<br />
This worked with Konsole, but it didn't work with XTerm. Using {{ic|showkey -a}} in Konsole, pressing {{ic|Ctrl+/}} shows:<br />
<br />
^_ 31 0037 0x1f<br />
<br />
To send the same keycode with XTerm, use the following in {{ic|.Xresources}}:<br />
<br />
XTerm.vt100.translations: #override \n\<br />
Ctrl <Key>slash: string(0x1f) \n\</div>Sleepinghttps://wiki.archlinux.org/index.php?title=User:Sleeping&diff=618734User:Sleeping2020-06-07T19:39:27Z<p>Sleeping: </p>
<hr />
<div>{{ic|showkey -a}} in Konsole, press {{ic|Ctrl+/}} shows:<br />
<br />
^_ 31 0037 0x1f<br />
<br />
You can make sure the same keycode is sent when using XTerm with:<br />
<br />
XTerm.vt100.translations: #override \n\<br />
Ctrl <Key>slash: string(0x1f) \n\</div>Sleepinghttps://wiki.archlinux.org/index.php?title=User:Sleeping&diff=618733User:Sleeping2020-06-07T19:38:40Z<p>Sleeping: Created page with "{{ic|showkey -a}} in Konsole, press Ctrl+/ shows: ^_ 31 0037 0x1f You can make sure the same keycode is sent when using XTerm with: XTerm.vt100.translations: #overrid..."</p>
<hr />
<div>{{ic|showkey -a}} in Konsole, press Ctrl+/ shows:<br />
<br />
^_ 31 0037 0x1f<br />
<br />
You can make sure the same keycode is sent when using XTerm with:<br />
<br />
XTerm.vt100.translations: #override \n\<br />
Ctrl <Key>slash: string(0x1f) \n\</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Downgrading_packages&diff=604203Downgrading packages2020-04-05T17:52:43Z<p>Sleeping: Remove link to broken script (which has not been updated for 4 years)</p>
<hr />
<div>[[Category:Package management]]<br />
[[cs:Downgrading packages]]<br />
[[de:Ältere Paketversion installieren (Downgrade)]]<br />
[[es:Downgrading packages]]<br />
[[fa:دانگرید]]<br />
[[fr:Downgrade]]<br />
[[it:Downgrading packages]]<br />
[[ja:パッケージのダウングレード]]<br />
[[pt:Downgrading packages]]<br />
[[ru:Downgrading packages]]<br />
[[sk:Downgrading packages]]<br />
[[zh-hans:Downgrading packages]]<br />
{{Related articles start}}<br />
{{Related|Arch Build System}}<br />
{{Related|makepkg}}<br />
{{Related|pacman}}<br />
{{Related|Arch Linux Archive}}<br />
{{Related articles end}}<br />
Before downgrading a single or multiple packages, consider why you wish to do so. If it is due to a bug, search the [https://bugs.archlinux.org/ bug tracker] for existing tasks. If there is none, add a new task; it is better to correct bugs, or at least warn other users of possible issues.<br />
<br />
{{Warning|<br />
* Downgrading one package may require that its dependencies be downgraded as well. When the number of packages to downgrade is large, consider using a snapshot. See [[Arch Linux Archive#How to restore all packages to a specific date]].<br />
* Be careful with changes to configuration files and scripts. For now pacman will handle this for us, as long as we do not bypass its safeguards.<br />
* If the downgrading involve a soname change, all dependency may need downgrading or [[Frequently_asked_questions#What if I run a full system upgrade and there will be an update for a shared library, but not for the apps that depend on it?|rebuild]] too.<br />
}}<br />
<br />
== Return to an earlier package version ==<br />
<br />
=== Using the pacman cache ===<br />
<br />
If a package was installed at an earlier stage, and the [[Pacman#Cleaning_the_package_cache|pacman cache]] was not cleaned, install an earlier version from {{ic|/var/cache/pacman/pkg/}}.<br />
<br />
This process will remove the current package and install the older version. Dependency changes will be handled, but [[pacman]] will not handle version conflicts. If a library or other package needs to be downgraded with the packages, please be aware that you will have to downgrade this package yourself as well.<br />
<br />
# pacman -U /var/cache/pacman/pkg/''package''-''old_version''.pkg.tar.xz<br />
<br />
Once the package is reverted, temporarily add it to the [[Pacman#Skip package from being upgraded|IgnorePkg section]] of {{ic|pacman.conf}}, until the difficulty with the updated package is resolved.<br />
<br />
=== Downgrading the kernel ===<br />
<br />
In case of issue with a new kernel, the Linux packages can be downgraded to the last working ones [[#Using the pacman cache]]. Go into the directory {{ic|/var/cache/pacman/pkg}} and downgrade at least {{Pkg|linux}}, {{Pkg|linux-headers}} and any kernel modules. For example:<br />
<br />
# pacman -U linux-4.15.8-1-x86_64.pkg.tar.xz linux-headers-4.15.8-1-x86_64.pkg.tar.xz virtualbox-host-modules-arch-5.2.8-4-x86_64.pkg.tar.xz<br />
<br />
{{Tip|If you are unable to boot after a kernel update, you can downgrade the kernel [[Change root|chrooting]] into the system. Boot using an Arch Linux [[USB flash installation media]] and mount the partition where your system is installed to {{ic|/mnt}}. If you have {{ic|/boot}} or {{ic|/var}} on separate partitions, also mount them to {{ic|/mnt}} (e.g. {{ic|mount /dev/sdc3 /mnt/boot}}). Then ''chroot'' into the system using: {{bc|# arch-chroot /mnt /bin/bash}}<br />
Now you can go into the ''pacman'' cache directory and downgrade the Linux packages using the command indicated above. Once done, exit the chroot (with {{ic|exit}}) and reboot.}}<br />
<br />
=== Arch Linux Archive ===<br />
<br />
The [[Arch Linux Archive]] is a daily snapshot of the [[official repositories]]. It can be used to [[Arch Linux Archive#How to downgrade one package|install a previous package version]], or [[Arch Linux Archive#How to restore all packages to a specific date|restore the system to an earlier date]].<br />
<br />
=== Rebuild the package ===<br />
<br />
If the package is unavailable, find the correct [[PKGBUILD]] and rebuild it with [[makepkg]].<br />
<br />
For packages from the [[official repositories]], retrieve the PKGBUILD with [[ABS]] and change the software version. Alternatively, find the package on the [https://www.archlinux.org/packages Packages] website, click "View Changes", and navigate to the desired version. The files are available through a {{ic|.tar.gz}} snapshot, and via the ''Tree'' view.<br />
<br />
See also [[Arch Build System#Checkout an older version of a package]].<br />
<br />
Old AUR packages can be built by checking out an old commit in the AUR package Git repository. For pre-2015 AUR3 PKGBUILDs, see [[Arch User Repository#Git repositories for AUR3 packages]].<br />
<br />
=== Automation ===<br />
<br />
{{AUR|downgrader}}{{Broken package link|package not found}} is a tool which works with libalpm, supports the pacman log and downgrading packages using [[Arch Linux Archive]], local cache and [http://repo-arm.archlinuxcn.org ARM].<br />
<br />
The {{AUR|downgrade}} package is a Bash script to downgrade one (or multiple) packages, by using the pacman cache or the [[Arch Rollback Machine]]. See {{ic|man downgrade}} for details.<br />
<br />
== Return from [testing] ==<br />
<br />
See [[Official repositories#Disabling testing repositories]].</div>Sleepinghttps://wiki.archlinux.org/index.php?title=DokuWiki&diff=597081DokuWiki2020-02-09T16:12:57Z<p>Sleeping: Undo revision 597073 by Sleeping (talk) The package places the file, my bad</p>
<hr />
<div>[[Category:Wiki software]]<br />
[[es:DokuWiki]]<br />
[[ja:DokuWiki]]<br />
[[zh-hant:DokuWiki]]<br />
"[https://www.dokuwiki.org/dokuwiki# DokuWiki] is a standards-compliant, simple-to-use wiki which allows users to create rich documentation repositories. It provides an environment for individuals, teams and companies to create and collaborate using a simple yet powerful syntax that ensures data files remain structured and readable outside the wiki."<br />
<br />
"Unlimited page revisions allows restoration to any earlier page version, and with data stored in plain text files, no database is required. A powerful plugin architecture allows for extension and enhancement of the core system. See the features section for a full description of what DokuWiki has to offer."[http://wiki.splitbrain.org/wiki:dokuwiki]<br />
<br />
In other words, DokuWiki is a wiki written in PHP and requires no database.<br />
<br />
== Initial notes ==<br />
DokuWiki should work on any web server which supports PHP 5.6 or later. As the requirements may change over time, you should consult the [http://www.dokuwiki.org/requirements requirements page] for DokuWiki for additional details.<br />
<br />
It is strongly recommend to read through the appropriate sections of [http://www.dokuwiki.org/security DokuWiki's security page] for your web server. Most popular web servers are covered but there are generic instructions as well.<br />
<br />
The package in [community] unpacks DokuWiki at {{ic|/usr/share/webapps/dokuwiki}} with the configuration files in {{ic|/etc/webapps/dokuwiki}} and the data files in {{ic|/var/lib/dokuwiki/data}}. It also changes the ownership of the relevant files to the "http" user. This should work fine for most popular web servers as packaged for Arch.<br />
<br />
== Installation ==<br />
<br />
# Install your web server of choice (e.g. [[Apache]], [[nginx]] or [[lighttpd]]) and configure it for [[PHP]]. As mentioned above, DokuWiki has no need for a database server so you may be able to skip those steps when setting up your web server.<br />
# Install {{Pkg|dokuwiki}} from [community] with [[pacman]].<br />
# Configure web server for dokuwiki (see section below)<br />
# With your web browser of choice, open <nowiki>http://&lt;your-server&gt;/dokuwiki/install.php</nowiki> and continue the installation from there. For nginx the URL is <nowiki>http://&lt;your-server&gt;/install.php</nowiki>.<br />
<br />
Alternatively, if you would like to install from tarball, you can read from http://www.dokuwiki.org/Install. Generally the procedure is the same as above. Instead of using pacman, you will need to [http://www.splitbrain.org/projects/dokuwiki download the tarball], unpack it to your server's document root (e.g. {{ic|/srv/http/dokuwiki}}), and chown to the appropriate user (e.g. "http").<br />
<br />
== Configuration ==<br />
<br />
If you are using [[lighttpd]] or [[nginx]] and your PHP version is lower than 7, you need to adjust the {{ic|open_basedir}} in {{ic|/etc/php/php.ini}} to include the dokuwiki directories (php forbids following symbolic links outside of the allowed scope):<br />
<br />
{{hc|/etc/php/php.ini|<nowiki><br />
open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/dokuwiki/:/var/lib/dokuwiki/<br />
</nowiki>}}<br />
<br />
Also uncomment the following line.<br />
{{hc|/etc/php/php.ini|<nowiki><br />
extension=gd<br />
</nowiki>}}<br />
Dokuwiki needs this library for resizing images.<br />
=== Apache ===<br />
<br />
The package should add the file {{ic|/etc/httpd/conf/extra/dokuwiki.conf}} with the following contents:<br />
<br />
{{bc|<br />
Alias /dokuwiki /usr/share/webapps/dokuwiki<br />
<Directory /usr/share/webapps/dokuwiki/><br />
Options +FollowSymLinks<br />
AllowOverride All<br />
order allow,deny<br />
allow from all<br />
php_admin_value open_basedir "/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/dokuwiki/:/var/lib/dokuwiki/"<br />
</Directory><br />
}}<br />
<br />
If you are running [https://httpd.apache.org/docs/2.4/upgrading.html Apache 2.4 or newer], you will have to change the following lines:<br />
{{bc|<br />
order allow,deny<br />
allow from all<br />
}}<br />
to read:<br />
{{bc|<br />
Require all granted<br />
}}<br />
<br />
Include the newly created file in the Apache configuration by placing the following line at the end of {{ic|/etc/httpd/conf/httpd.conf}}:<br />
{{bc|<br />
Include conf/extra/dokuwiki.conf<br />
}}<br />
<br />
Make sure the folders {{ic|/etc/webapps/dokuwiki}} and {{ic|/var/lib/dokuwiki}} are owned by user and group "http". You may relocate these directories if you like as long as you update the references in {{ic|/etc/httpd/conf/extra/dokuwiki.conf}} respectively. You should keep the reference to {{ic|/var/lib/dokuwiki/}} for DokuWiki to find the plugins and tpl folder.<br />
<br />
Afterwards restart Apache:<br />
# systemctl restart httpd.service<br />
<br />
Then finish the installation by running the ''dokuwiki/install.php'' script in your browser.<br />
<br />
=== lighttpd ===<br />
<br />
Edit the {{ic|/etc/lighttpd/lighttpd.conf}} file as per the [http://www.dokuwiki.org/install:lighttpd dokuwiki instructions] (might contain updated information).<br />
<br />
Make sure the modules {{ic|mod_access}} and {{ic|mod_alias}} are loaded. If not, load them by adding the following to {{ic|/etc/lighttpd/lighttpd.conf}}:<br />
{{bc|1=<br />
server.modules += ("mod_access")<br />
server.modules += ("mod_alias")<br />
}}<br />
{{ic|mod_access}} provides the {{ic|url.access-deny}} command, which we are using from this point.<br />
<br />
Under the line:<br />
{{bc|1= <br />
$HTTP["url"] =~ "\.pdf$" {<br />
server.range-requests = "disable"<br />
}<br />
}}<br />
<br />
add this: <br />
{{bc|1=<br />
# subdir of dokuwiki<br />
# comprised of the subdir of the root dir where dokuwiki is installed<br />
# in this case the root dir is the basedir plus /htdocs/<br />
# Note: be careful with trailing slashes when uniting strings.<br />
# all content on this example server is served from htdocs/ up.<br />
#var.dokudir = var.basedir + "/dokuwiki"<br />
var.dokudir = server.document-root + "/dokuwiki"<br />
<br />
# make sure those are always served through fastcgi and never as static files<br />
# deny access completly to these<nowiki><br />
$HTTP["url"] =~ "/(\.|_)ht" { url.access-deny = ( "" ) }<br />
$HTTP["url"] =~ "^" + var.dokudir + "/(bin|data|inc|conf)/" { url.access-deny = ( "" ) }</nowiki><br />
}}<br />
<br />
''These entries give some basic security to DokuWiki.'' lighttpd does not use .htaccess files like Apache. You CAN install with out this, but I would NEVER recommend it.<br />
<br />
Add alias somewhere in lighttpd or fastcgi conf file:<br />
{{bc|1=<br />
alias.url += ("/dokuwiki" => "/usr/share/webapps/dokuwiki/")<br />
}}<br />
<br />
Restart lighttpd:<br />
# systemctl restart lighttpd<br />
<br />
=== nginx ===<br />
Ensure that {{Pkg|php-fpm}} is installed and [[start]]ed.<br />
<br />
Add the following server block, but change the server name to your own and comment out the install.php block until you're done installing DokuWiki. This block assumes you use TLS. [https://www.dokuwiki.org/install:nginx]<br />
{{hc|/etc/nginx/nginx.conf|<nowiki><br />
server {<br />
listen 443 ssl http2;<br />
listen [::]:443 ssl http2;<br />
server_name wiki.example.com;<br />
<br />
root /usr/share/webapps/dokuwiki;<br />
index doku.php;<br />
<br />
#Remember to comment the below out when you're installing DokuWiki, and uncomment it when you're done.<br />
location ~ /(data/|conf/|bin/|inc/|install.php) { deny all; } # secure Dokuwiki<br />
<br />
location ~^/\.ht { deny all; } # also secure the Apache .htaccess files<br />
location @dokuwiki {<br />
#rewrites "doku.php/" out of the URLs if you set the userewrite setting to .htaccess in dokuwiki config page<br />
rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;<br />
rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;<br />
rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;<br />
rewrite ^/(.*) /doku.php?id=$1&$args last;<br />
}<br />
<br />
location / { try_files $uri $uri/ @dokuwiki; }<br />
location ~ \.php$ {<br />
try_files $uri =404;<br />
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;<br />
fastcgi_index index.php;<br />
include fastcgi.conf;<br />
}<br />
<br />
}<br />
</nowiki>}}<br />
<br />
Restart nginx<br />
# systemctl restart nginx<br />
<br />
=== Enable upload and displaying of SVG files ===<br />
DokuWiki supports SVG files but has them disabled by default.<br />
<br />
If you wish to enable them, create the following file:<br />
<br />
{{hc|/etc/webapps/dokuwiki/mime.local.conf|<br />
svg image/svg+xml<br />
}}<br />
This has security implications - [https://github.com/splitbrain/dokuwiki/issues/1045#issuecomment-90226230 see here]<br />
<br />
== Post installation ==<br />
<br />
=== Cleaning up ===<br />
<br />
'''After configuring the server either remove the install.php file or make sure it is made inaccessible in your webserver configuration!'''<br />
# rm /usr/share/webapps/dokuwiki/install.php<br />
<br />
=== Installing plugins ===<br />
<br />
Many community created plugins can be found [http://www.dokuwiki.org/plugins here]<br />
<br />
They can be added through the web interface (as well as updated) through the Admin menu. Some plugins cannot be downloaded, if they go over ssl (e.g. git).<br />
<br />
=== Backing up ===<br />
<br />
It is very trivial to backup DokuWiki, since there is no database. All pages are in plain text, and require only a simple tar, or [[rsync]]. <br />
<br />
A quick breakdown of the directories of interest in the current (20180422_a-1) version:<br />
/usr/share/webapps/dokuwiki/data/ => All User Created Data<br />
/usr/share/webapps/dokuwiki/conf/ => Configuration settings<br />
<br />
This may change in future releases, please consult the [https://www.dokuwiki.org/faq:backup DokuWiki Backup FAQ] for verification.<br />
<br />
== Further reading ==<br />
<br />
The [http://www.dokuwiki.org/ DokuWiki main site] has all of the information and help that you could possibly need.</div>Sleepinghttps://wiki.archlinux.org/index.php?title=DokuWiki&diff=597073DokuWiki2020-02-09T13:51:19Z<p>Sleeping: Since Arch is a rolling distribution, rewrite text so that newer version is assumed instead of old version</p>
<hr />
<div>[[Category:Wiki software]]<br />
[[es:DokuWiki]]<br />
[[ja:DokuWiki]]<br />
[[zh-hant:DokuWiki]]<br />
"[https://www.dokuwiki.org/dokuwiki# DokuWiki] is a standards-compliant, simple-to-use wiki which allows users to create rich documentation repositories. It provides an environment for individuals, teams and companies to create and collaborate using a simple yet powerful syntax that ensures data files remain structured and readable outside the wiki."<br />
<br />
"Unlimited page revisions allows restoration to any earlier page version, and with data stored in plain text files, no database is required. A powerful plugin architecture allows for extension and enhancement of the core system. See the features section for a full description of what DokuWiki has to offer."[http://wiki.splitbrain.org/wiki:dokuwiki]<br />
<br />
In other words, DokuWiki is a wiki written in PHP and requires no database.<br />
<br />
== Initial notes ==<br />
DokuWiki should work on any web server which supports PHP 5.6 or later. As the requirements may change over time, you should consult the [http://www.dokuwiki.org/requirements requirements page] for DokuWiki for additional details.<br />
<br />
It is strongly recommend to read through the appropriate sections of [http://www.dokuwiki.org/security DokuWiki's security page] for your web server. Most popular web servers are covered but there are generic instructions as well.<br />
<br />
The package in [community] unpacks DokuWiki at {{ic|/usr/share/webapps/dokuwiki}} with the configuration files in {{ic|/etc/webapps/dokuwiki}} and the data files in {{ic|/var/lib/dokuwiki/data}}. It also changes the ownership of the relevant files to the "http" user. This should work fine for most popular web servers as packaged for Arch.<br />
<br />
== Installation ==<br />
<br />
# Install your web server of choice (e.g. [[Apache]], [[nginx]] or [[lighttpd]]) and configure it for [[PHP]]. As mentioned above, DokuWiki has no need for a database server so you may be able to skip those steps when setting up your web server.<br />
# Install {{Pkg|dokuwiki}} from [community] with [[pacman]].<br />
# Configure web server for dokuwiki (see section below)<br />
# With your web browser of choice, open <nowiki>http://&lt;your-server&gt;/dokuwiki/install.php</nowiki> and continue the installation from there. For nginx the URL is <nowiki>http://&lt;your-server&gt;/install.php</nowiki>.<br />
<br />
Alternatively, if you would like to install from tarball, you can read from http://www.dokuwiki.org/Install. Generally the procedure is the same as above. Instead of using pacman, you will need to [http://www.splitbrain.org/projects/dokuwiki download the tarball], unpack it to your server's document root (e.g. {{ic|/srv/http/dokuwiki}}), and chown to the appropriate user (e.g. "http").<br />
<br />
== Configuration ==<br />
<br />
If you are using [[lighttpd]] or [[nginx]] and your PHP version is lower than 7, you need to adjust the {{ic|open_basedir}} in {{ic|/etc/php/php.ini}} to include the dokuwiki directories (php forbids following symbolic links outside of the allowed scope):<br />
<br />
{{hc|/etc/php/php.ini|<nowiki><br />
open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/dokuwiki/:/var/lib/dokuwiki/<br />
</nowiki>}}<br />
<br />
Also uncomment the following line.<br />
{{hc|/etc/php/php.ini|<nowiki><br />
extension=gd<br />
</nowiki>}}<br />
Dokuwiki needs this library for resizing images.<br />
=== Apache ===<br />
<br />
The package should add the file {{ic|/etc/httpd/conf/extra/dokuwiki.conf}} with the following contents:<br />
<br />
{{bc|<br />
Alias /dokuwiki /usr/share/webapps/dokuwiki<br />
<Directory /usr/share/webapps/dokuwiki/><br />
Options +FollowSymLinks<br />
AllowOverride All<br />
Require all granted<br />
php_admin_value open_basedir "/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/dokuwiki/:/var/lib/dokuwiki/"<br />
</Directory><br />
}}<br />
<br />
If you are running an old version of Apache ([https://httpd.apache.org/docs/2.4/upgrading.html before 2.4]), you will have to change the following line:<br />
{{bc|<br />
Require all granted<br />
}}<br />
<br />
to read:<br />
{{bc|<br />
order allow,deny<br />
allow from all<br />
}}<br />
<br />
Include the newly created file in the Apache configuration by placing the following line at the end of {{ic|/etc/httpd/conf/httpd.conf}}:<br />
{{bc|<br />
Include conf/extra/dokuwiki.conf<br />
}}<br />
<br />
Make sure the folders {{ic|/etc/webapps/dokuwiki}} and {{ic|/var/lib/dokuwiki}} are owned by user and group "http". You may relocate these directories if you like as long as you update the references in {{ic|/etc/httpd/conf/extra/dokuwiki.conf}} respectively. You should keep the reference to {{ic|/var/lib/dokuwiki/}} for DokuWiki to find the plugins and tpl folder.<br />
<br />
Afterwards restart Apache:<br />
# systemctl restart httpd.service<br />
<br />
Then finish the installation by running the ''dokuwiki/install.php'' script in your browser.<br />
<br />
=== lighttpd ===<br />
<br />
Edit the {{ic|/etc/lighttpd/lighttpd.conf}} file as per the [http://www.dokuwiki.org/install:lighttpd dokuwiki instructions] (might contain updated information).<br />
<br />
Make sure the modules {{ic|mod_access}} and {{ic|mod_alias}} are loaded. If not, load them by adding the following to {{ic|/etc/lighttpd/lighttpd.conf}}:<br />
{{bc|1=<br />
server.modules += ("mod_access")<br />
server.modules += ("mod_alias")<br />
}}<br />
{{ic|mod_access}} provides the {{ic|url.access-deny}} command, which we are using from this point.<br />
<br />
Under the line:<br />
{{bc|1= <br />
$HTTP["url"] =~ "\.pdf$" {<br />
server.range-requests = "disable"<br />
}<br />
}}<br />
<br />
add this: <br />
{{bc|1=<br />
# subdir of dokuwiki<br />
# comprised of the subdir of the root dir where dokuwiki is installed<br />
# in this case the root dir is the basedir plus /htdocs/<br />
# Note: be careful with trailing slashes when uniting strings.<br />
# all content on this example server is served from htdocs/ up.<br />
#var.dokudir = var.basedir + "/dokuwiki"<br />
var.dokudir = server.document-root + "/dokuwiki"<br />
<br />
# make sure those are always served through fastcgi and never as static files<br />
# deny access completly to these<nowiki><br />
$HTTP["url"] =~ "/(\.|_)ht" { url.access-deny = ( "" ) }<br />
$HTTP["url"] =~ "^" + var.dokudir + "/(bin|data|inc|conf)/" { url.access-deny = ( "" ) }</nowiki><br />
}}<br />
<br />
''These entries give some basic security to DokuWiki.'' lighttpd does not use .htaccess files like Apache. You CAN install with out this, but I would NEVER recommend it.<br />
<br />
Add alias somewhere in lighttpd or fastcgi conf file:<br />
{{bc|1=<br />
alias.url += ("/dokuwiki" => "/usr/share/webapps/dokuwiki/")<br />
}}<br />
<br />
Restart lighttpd:<br />
# systemctl restart lighttpd<br />
<br />
=== nginx ===<br />
Ensure that {{Pkg|php-fpm}} is installed and [[start]]ed.<br />
<br />
Add the following server block, but change the server name to your own and comment out the install.php block until you're done installing DokuWiki. This block assumes you use TLS. [https://www.dokuwiki.org/install:nginx]<br />
{{hc|/etc/nginx/nginx.conf|<nowiki><br />
server {<br />
listen 443 ssl http2;<br />
listen [::]:443 ssl http2;<br />
server_name wiki.example.com;<br />
<br />
root /usr/share/webapps/dokuwiki;<br />
index doku.php;<br />
<br />
#Remember to comment the below out when you're installing DokuWiki, and uncomment it when you're done.<br />
location ~ /(data/|conf/|bin/|inc/|install.php) { deny all; } # secure Dokuwiki<br />
<br />
location ~^/\.ht { deny all; } # also secure the Apache .htaccess files<br />
location @dokuwiki {<br />
#rewrites "doku.php/" out of the URLs if you set the userewrite setting to .htaccess in dokuwiki config page<br />
rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;<br />
rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;<br />
rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;<br />
rewrite ^/(.*) /doku.php?id=$1&$args last;<br />
}<br />
<br />
location / { try_files $uri $uri/ @dokuwiki; }<br />
location ~ \.php$ {<br />
try_files $uri =404;<br />
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;<br />
fastcgi_index index.php;<br />
include fastcgi.conf;<br />
}<br />
<br />
}<br />
</nowiki>}}<br />
<br />
Restart nginx<br />
# systemctl restart nginx<br />
<br />
=== Enable upload and displaying of SVG files ===<br />
DokuWiki supports SVG files but has them disabled by default.<br />
<br />
If you wish to enable them, create the following file:<br />
<br />
{{hc|/etc/webapps/dokuwiki/mime.local.conf|<br />
svg image/svg+xml<br />
}}<br />
This has security implications - [https://github.com/splitbrain/dokuwiki/issues/1045#issuecomment-90226230 see here]<br />
<br />
== Post installation ==<br />
<br />
=== Cleaning up ===<br />
<br />
'''After configuring the server either remove the install.php file or make sure it is made inaccessible in your webserver configuration!'''<br />
# rm /usr/share/webapps/dokuwiki/install.php<br />
<br />
=== Installing plugins ===<br />
<br />
Many community created plugins can be found [http://www.dokuwiki.org/plugins here]<br />
<br />
They can be added through the web interface (as well as updated) through the Admin menu. Some plugins cannot be downloaded, if they go over ssl (e.g. git).<br />
<br />
=== Backing up ===<br />
<br />
It is very trivial to backup DokuWiki, since there is no database. All pages are in plain text, and require only a simple tar, or [[rsync]]. <br />
<br />
A quick breakdown of the directories of interest in the current (20180422_a-1) version:<br />
/usr/share/webapps/dokuwiki/data/ => All User Created Data<br />
/usr/share/webapps/dokuwiki/conf/ => Configuration settings<br />
<br />
This may change in future releases, please consult the [https://www.dokuwiki.org/faq:backup DokuWiki Backup FAQ] for verification.<br />
<br />
== Further reading ==<br />
<br />
The [http://www.dokuwiki.org/ DokuWiki main site] has all of the information and help that you could possibly need.</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Redmine&diff=596481Redmine2020-01-30T11:28:48Z<p>Sleeping: removed "from the AUR"</p>
<hr />
<div>{{out of date|largely out of date installation for old Redmine and Apache 2.2 (amongst other things)}}<br />
[[Category:Issue tracking systems]]<br />
[[ja:Redmine]]<br />
{{Related articles start}}<br />
{{Related|Ruby on Rails}}<br />
{{Related|RVM}}<br />
{{Related|MariaDB}}<br />
{{Related|Apache}}<br />
{{Related|Nginx}}<br />
{{Related articles end}}<br />
[https://www.redmine.org/ Redmine] is a [[Wikipedia:free and open source software|free and open source]], web-based [[Wikipedia:project management|project management]] and [[Wikipedia:Issue tracking system|issue tracking]] tool. It handles multiple projects and subprojects. It [http://www.redmine.org/projects/redmine/wiki/Features features] per project wikis and forums, time tracking, and flexible role based access control. It includes a [[Wikipedia:calendar|calendar]] and [[Wikipedia:Gantt chart|Gantt chart]]s to aid visual representation of projects and their [[Wikipedia:time limit|deadlines]]. Redmine integrates with various [[Wikipedia:version control|version control]] systems and includes a repository browser and diff viewer.<br />
<br />
Redmine is written using the [[Ruby on Rails]] framework. It is cross-platform and cross-[[Wikipedia:database|database]] and supports 34 languages.<br />
<br />
==Prerequisites==<br />
{{Out of date|Redmine package is now in community and has its own dependencies. The installation process is a little different.}}<br />
<br />
This document will guide you through the installation process of Redmine and all of its prerequisites, including the optional ones. If desired, however, you may install Redmine and its prerequisites separately, simply referring to the relevant sections below.<br />
<br />
Although this guide will go through the entire installation process, this is not a one way path. Redmine can use different versions of the requisite software. For example the database requirement can be provided by mariaDB, mySQL, postgreSQL, etc.<br />
<br />
{{Note|This guide is a default suggestion, feel free to substitute any of the prerequisites mentioned on this page.}}<br />
<br />
===Ruby===<br />
<br />
{| border="1" class="wikitable" style="text-align:center;"<br />
! Redmine version<br />
! Supported Ruby Versions<br />
! Rails version used<br />
|-<br />
! 3.0.2<br />
| style="text-align:left;" | '''ruby''' 1.9.3<sup>3</sup>, 2.0.0<sup>2</sup>, 2.1, 2.2<sup>1</sup><br />
| '''Rails''' 4.2<sup>0</sup><br />
|-<br />
! 3.4<br />
| style="text-align:left;" | '''ruby''' 1.9.3<sup>3</sup>, 2.0.0, 2.1, 2.2, 2.3, 2.4<br />
| '''Rails''' 4.2<br />
|-<br />
|-<br />
! 4.0<br />
| style="text-align:left;" | '''ruby''' 2.2<sup>4</sup>, 2.3, 2.4, 2.5, 2.6<br />
| '''Rails''' 5.2<br />
|-<br />
! 4.1<br />
| style="text-align:left;" | '''ruby''' 2.3, 2.4, 2.5, 2.6<br />
| '''Rails''' 5.2<br />
|}<br />
<br />
There are two simple ways to install Ruby: installing the {{Pkg|ruby}} package as described in [[ruby]] or installing RVM as described in [[RVM]] '''(recommended)'''.<br />
<br />
<br />
{{Note | <sup>0</sup> Rails 4.2.1 has non ASCII URL issue on MinGW Ruby ([http://rubyinstaller.org/ Windows-based installer]) thin and puma ([http://www.redmine.org/issues/19321 #19321], [http://www.redmine.org/issues/19374 #19374]) }}<br />
{{Note | <sup>1</sup> MinGW Ruby 2.2 has nokogiri issue ([http://www.redmine.org/issues/19419 #19419]).}}<br />
{{Note | <sup>2</sup> As of 2013-03-19, SQL Server support is reported broken with '''ruby 2.0.0 under Windows''' because of a [https://github.com/rails-sqlserver/tiny_tds/issues/110 database adapter gem incompatibility]}}<br />
{{Note | <sup>3</sup> MRI 1.9.3p327 contains a [http://bugs.ruby-lang.org/issues/7374 bug] breaking plugin loading under Windows which 1.9.3p194 or 1.9.3p392 haven't.}}<br />
{{Warning | If you use RVM, pay attention to the single and multiple user differences! If you are not creating a hosting service, the multiple user (available for all users on the machine) should be the choice for simpler debuging.}}<br />
{{Note | <sup>4</sup> Redmine prior to 4.0.6 supports Ruby <nowiki> >= </nowiki> 2.2.2. Redmine 4.0.6 and later don't support Ruby 2.2 ([https://redmine.org/projects/redmine/wiki/RedmineInstall see Redmine installation page])}}<br />
<br />
===Database===<br />
<br />
Redmine [http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Database supports many different databases].<br />
<br />
====MariaDB 5.0 or higher (recommended)====<br />
* MariaDB is a drop-in replacement for MySQL, in fact it was a fork of it and maintain binary compatibility. It is also [https://www.archlinux.org/news/mariadb-replaces-mysql-in-repositories/ Arch Linux's default implementation of MySQL].<br />
* MariaDB has known issues ([https://www.redmine.org/issues/19344 #19344], [https://www.redmine.org/issues/19395 #19395], [https://www.redmine.org/issues/17460 #17460]).<br />
<br />
To install {{Pkg|mariadb}} simply refer to [[MySQL]].<br />
<br />
====MySQL 5.5 - 5.7====<br />
* [https://www.archlinux.org/news/mariadb-replaces-mysql-in-repositories/ Oracle MySQL was dropped] to the [[AUR]]. {{AUR|mysql}} in the [[AUR]].<br />
* MySQL 5.6 or higher has known issues ([https://www.redmine.org/issues/19344 #19344], [https://www.redmine.org/issues/19395 #19395], [https://www.redmine.org/issues/17460 #17460]).<br />
* Redmine 3.x also supports MySQL 5.0 and 5.1<br />
<br />
====PostgreSQL 9.2 or higher====<br />
* To install {{Pkg|postgresql}} simply refer to [[PostgreSQL]].<br />
<br />
* Make sure your database datestyle is set to ISO (Postgresql default setting). You can set it using:<br />
<br />
{{bc|1=ALTER DATABASE "redmine_db" SET datestyle="ISO,MDY";}}<br />
<br />
* Redmine 3.x also supports PostgreSQL 8.3 - 9.1.<br />
<br />
{{Note|Some bugs in PostgreSQL 8.4.0 and 8.4.1 affect Redmine behavior ([http://www.redmine.org/issues/4259 #4259], [http://www.redmine.org/issues/4314 #4314]), they are fixed in PostgreSQL 8.4.2}}<br />
<br />
====Microsoft SQL Server [https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/v4.2.3/README.md#activerecord-sql-server-adapter-for-sql-server-2012-and-higher 2012 or higher]====<br />
{{Warning|Support is temporarily broken (with ruby 2.0.0 under Windows because of [https://github.com/rails-sqlserver/tiny_tds/issues/110 database adapter gem incompatibility]).}}<br />
<br />
====SQLite 3====<br />
Not supported for multi-user production use. So, it will not be detailed how to install and configure it for use with Redmine. See [http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Supported-database-back-ends upstream document] for more info.<br />
<br />
===Web Server===<br />
<br />
====Apache====<br />
To install {{Pkg|apache}} simply refer to [[Apache]].<br />
<br />
==== Unicorn ====<br />
To install Unicorn server (ruby gem) simply refer to [[Ruby on Rails#Unicorn]].<br />
<br />
====Nginx====<br />
To install {{Pkg|nginx}} simply refer to [[Nginx]].<br />
<br />
====Apache Tomcat====<br />
<br />
To install {{Pkg|tomcat8}} or {{Pkg|tomcat7}} simply refer to [[Tomcat]].<br />
<br />
==Optional Prerequisites==<br />
<br />
===SCM (Source Code Management)===<br />
<br />
<table border="1"><br />
<tr><br />
<th>SCM</th><br />
<th>Supported versions</th><br />
<th>Comments</th><br />
</tr><br />
<tr><br />
<td>[http://git-scm.com Git]</td><br />
<td>1.5.4.2 to 2.11.0</td><br />
<td></td><br />
</tr><br />
<tr><br />
<td>[http://subversion.apache.org Subversion]</td><br />
<td>1.3 to 1.9.7</td><br />
<td>1.3 or higher required.<br/><br />
Does not support Ruby Bindings for Subversion.<br/><br />
Subversion 1.7.0 and 1.7.1 contains bugs [http://www.redmine.org/issues/9541 #9541]</td><br />
</tr><br />
<tr><br />
<td>[http://www.selenic.com/mercurial Mercurial]</td><br />
<td>1.2 to 4.3.1</td><br />
<td>Support bellow version 1.6 is droped as seen in [http://www.redmine.org/issues/9465 #9465].</td><br />
</tr><br />
<tr><br />
<td>[http://bazaar-vcs.org Bazaar]</td><br />
<td>1.0.0.candidate.1 to 2.7.0</td><br />
<td></td><br />
</tr><br />
<tr><br />
<td>[http://darcs.net Darcs]</td><br />
<td>>=1.0.7</td><br />
<td></td><br />
</tr><br />
<tr><br />
<td>[http://www.nongnu.org/cvs CVS]</td><br />
<td>1.12.12, 1.12.13</td><br />
<td>1.12 required.<br/><br />
Will not work with CVSNT.</td><br />
</tr><br />
</table><br />
<br />
More information can be read at [http://www.redmine.org/projects/redmine/wiki/RedmineRepositories Redmine Repositories Wiki].<br />
<br />
===ImageMagick (recommended)===<br />
[http://www.imagemagick.org ImageMagick] is necessary to enable Gantt export to a [[wikipedia:Portable_Network_Graphics|PNG]] file and thumbnails generation.<br />
<br />
To install {{pkg|imagemagick}} simply:<br />
# pacman -S imagemagick<br />
<br />
===Ruby OpenID Library===<br />
To enable [http://janrain.com/openid-enabled OpenID] support, is required a version >= 2 of the library.<br />
<br />
The current version (as of 14th January 2020) is 0.9.4, which supports Redmine 4.<br />
<br />
==Installation==<br />
<br />
{{Out of date|Redmine package is now in community and has its own dependencies. The installation process is a little different.}}<br />
<br />
===Build and Installation===<br />
<br />
Download, build and install the {{Pkg|redmine}} package.<br />
<br />
{{Note|Detailed build instructions are in [[Arch User Repository#Build and install the package]]. It is '''HIGHLY''' recommended to read the [[AUR]] page to understand what are you doing. }}<br />
<br />
===Database Configuration===<br />
<br />
Now, we will need to create the database that the Redmine will use to store your data. For now on, the database and its user will be named {{ic|redmine}}. But this names can be changed to anything else.<br />
<br />
{{Note|The configuration for [[MariaDB]] and [[MySQL]] will be the same since both are binary compatible.}}<br />
<br />
====Database Creation====<br />
<br />
To create the database, the user and set privileges (MariaDB and MySQL >= 5.0.2):<br />
{{hc|# mysql -u root -p|<br />
CREATE DATABASE redmine CHARACTER SET UTF8;<br />
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';<br />
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';}}<br />
<br />
For versions of MariaDB and MySQL prior to 5.0.2:<br />
{{hc|# mysql -u root -p|<br />
CREATE DATABASE redmine CHARACTER SET UTF8;<br />
GRANT ALL PRIVILEGES ON redmine.* TO'redmine'@'localhost' IDENTIFIED BY 'my_password';}}<br />
<br />
For PostgreSQL:<br />
{{bc|1=CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity';<br />
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;}}<br />
<br />
For SQLServer:<br />
<br />
Although the database, login and user can be created within SQL Server Management Studio with a few clicks, you can always use the command line with {{ic|SQLCMD}}:<br />
{{bc|1=USE [master]<br />
GO<br />
-- Very basic DB creation<br />
CREATE DATABASE [REDMINE]<br />
GO<br />
-- Creation of a login with SQL Server login/password authentication and no password expiration policy<br />
CREATE LOGIN [REDMINE] WITH PASSWORD=N'redminepassword', DEFAULT_DATABASE=[REDMINE], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF<br />
GO<br />
-- User creation using previously created login authentication<br />
USE [REDMINE]<br />
GO<br />
CREATE USER [REDMINE] FOR LOGIN [REDMINE]<br />
GO<br />
-- User permissions set via roles<br />
EXEC sp_addrolemember N'db_datareader', N'REDMINE'<br />
GO<br />
EXEC sp_addrolemember N'db_datawriter', N'REDMINE'<br />
GO}}<br />
<br />
{{Note|If you want to use additional environments, you must create separate databases for each one (for example: ''development'' and ''test'').}}<br />
<br />
====Database Access Configuration====<br />
<br />
Now you need to configure Redmine to access the database we just created. To do that you have to copy {{ic|/usr/share/webapps/redmine/config/database.yml.example}} to {{ic|database.yml}}:<br />
<br />
# cd /usr/share/webapps/redmine/config<br />
# cp database.yml.example database.yml<br />
<br />
And then edit this file in order to configure your database settings for "production" environment (you can configure for the "development" and "test" environments too, just change the appropriate sections).<br />
<br />
Example for MariaDB and MySQL database:<br />
{{hc|nano database.yml|<br />
production:<br />
adapter: mysql2<br />
database: redmine<br />
host: localhost<br />
port: 3307 '''#If your server is not running on the standard port (3306), set it here, otherwise this line is unnecessary.'''<br />
username: redmine<br />
password: my_password}}<br />
<br />
{{Note|For ruby1.9 the "adapter" value must be set to {{ic|mysql2}}, and for ruby1.8 or jruby, it must be set to {{ic|mysql}}.}}<br />
<br />
Example for PostgreSQL database:<br />
{{hc|nano database.yml|<br />
production:<br />
adapter: postgresql<br />
database: redmine<br />
host: localhost<br />
username: redmine<br />
password: my_password<br />
encoding: utf8<br />
schema_search_path: <database_schema> (default - public)}}<br />
<br />
Example for a SQL Server database:<br />
{{hc|nano database.yml|<br />
production:<br />
adapter: sqlserver<br />
database: redmine<br />
host: localhost '''#Set not default host (localhost) here, otherwise this line is unnecessary.'''<br />
port: 1433 '''#Set not standard port (1433) here, otherwise this line is unnecessary.'''<br />
username: redmine<br />
password: my_password<br />
}}<br />
<br />
=== Ruby gems ===<br />
Redmine requires some [[RubyGems]] to be installed and there are multiple ways of installing them (as listed on the referenced page).<br />
* prototype-rails<br />
* unicorn (an application-server)<br />
* mysql2 (high-performance Ruby bindings for MySQL)<br />
* coderay<br />
* erubis<br />
* fastercsv<br />
* rdoc<br />
* net-ldap<br />
* rack-openid<br />
<br />
Obviously, if you choose a different database-server, or want to use a different application-server you should replace ''mysql2'' and ''unicorn'' to your liking.<br />
<br />
====Adding Additional Gems (Optional)====<br />
If you need to load gems that are not required by Redmine core (eg. Puma, fcgi), create a file named {{ic|Gemfile.local}} at the root of your redmine directory. It will be loaded automatically when running {{ic|bundle install}}:<br />
<br />
{{hc|# nano Gemfile.local|<br />
gem 'puma'}}<br />
<br />
==== Check previously installed gems ====<br />
The Redmine devs included Bundler in Redmine, which can manage Gems just like pacman manages packages. Run the following command to assure that all Redmine dependencies are met:<br />
# bundle install --without development test<br />
This should output a list of gems Redmine needs.<br />
<br />
====Gems Installation====<br />
<br />
{{Note|If you prefer, you can install all the gems as pacman packages. You have only to search for the gem package and install them as usual. As of using Ruby gem is much simpler to manage and maintain up to date gems, this will be preferable and used as default bellow.}}<br />
<br />
Redmine uses Bundler to manage gems dependencies. So, you need to install Bundler first:<br />
# gem install bundler<br />
<br />
Then you can install all the gems required by Redmine using the following command:<br />
# cd /usr/share/webapps/redmine<br />
# bundle install<br />
<br />
To install without the ruby ''development'' and ''test'' environments use this instead of the last command:<br />
# bundle install --without development test<br />
<br />
{{Note|You can include/exclude environments using the above syntax.}}<br />
<br />
Although {{Pkg|imagemagick}} is highly [[#ImageMagick_.28recommended.29|recommended]], if you do not use it, you should skip the installation of the {{ic|rmagick}} gem using:<br />
<br />
# bundle install --without rmagick<br />
<br />
{{Note|Only the gems that are needed by the adapters you have specified in your database configuration file are actually installed (eg. if your {{ic|config/database.yml}} uses the ''mysql2'' adapter, then only the mysql2 gem will be installed). Do not forget to re-run {{ic|bundle install}} when you change or add adapters in this file.}}<br />
<br />
===Session Store Secret Generation===<br />
Now you must generate a random key that will be used by Rails to encode cookies that stores session data thus preventing their tampering:<br />
<br />
# bundle exec rake generate_secret_token<br />
<br />
{{Note|For Redmine prior to 2.x this step is done by executing {{ic|# bundle exec rake generate_session_store}}.}}<br />
<br />
{{Warning|Generating a new secret token invalidates all existing sessions after restart.}}<br />
<br />
===Database Structure Creation===<br />
With the database created and the access configured for Redmine, now it is time to create the database structure. This is done by running the following command under the application root directory:<br />
<br />
# cd /usr/share/webapps/redmine<br />
# RAILS_ENV=production bundle exec rake db:migrate<br />
<br />
These command will create tables by running all migrations one by one then create the set of the permissions and the application administrator account, named admin.<br />
<br />
===Database Population with Default Data===<br />
Now you may want to insert the default configuration data in database, like basic types of task, task states, groups, etc. To do so execute the following:<br />
<br />
# RAILS_ENV=production bundle exec rake redmine:load_default_data<br />
<br />
Redmine will prompt for the data set language that should be loaded; you can also define the REDMINE_LANG environment variable before running the command to a value which will be automatically and silently picked up by the task:<br />
<br />
# RAILS_ENV=production REDMINE_LANG=pt-BR bundle exec rake redmine:load_default_data<br />
<br />
{{Note|This step is not mandatory, but it certainly will save you a lot of work to start using Redmine. And for a first time it can be very instructive.}}<br />
<br />
===File System Permissions===<br />
The user account running the application '''must''' have write permission on the following subdirectories:<br />
<br />
'''files''': storage of attachments.<br />
'''log''': application log file production.log.<br />
'''tmp''' and '''tmp/pdf''': used to generate PDF documents among other things (create these ones if not present).<br />
<br />
Assuming you run the application with a the default Apache user {{ic|http}} account:<br />
<br />
# mkdir tmp tmp/pdf public/plugin_assets<br />
# chown -R http:http files log tmp public/plugin_assets<br />
# chmod -R 755 files log tmp tmp/pdf public/plugin_assets<br />
<br />
===Test the installation===<br />
To test your new installation using WEBrick web server run the following in the Redmine folder:<br />
<br />
# ruby bin/rails server webrick -e production<br />
<br />
Once WEBrick has started, point your browser to '''http://localhost:3000/'''. You should now see the application welcome page. Use default administrator account to log in: '''''admin'''''/'''''admin'''''. You can go to Administration menu and choose Settings to modify most of the application settings.<br />
<br />
{{Warning|Webrick is not suitable for production use, please only use webrick for testing that the installation up to this point is functional. Use one of the many other guides in this wiki to setup redmine to use either Passenger (aka mod_rails), FCGI or a Rack server (Unicorn, Thin, Puma or hellip) to serve up your redmine.}}<br />
<br />
===Configure the production server===<br />
For Apache and Nginx, it is recommended to use Phusion Passenger. [http://www.modrails.com/ Passenger], also known as {{ic|mod_rails}}, is a module available for [[Nginx]] and [[Apache]].<br />
<br />
Start by installing the 'passenger' gem:<br />
# gem install passenger<br />
<br />
Now you have to look at your passenger gem installation directory to continue. If you do not known where it is, type:<br />
# gem env<br />
<br />
And look at the {{ic|GEM PATHS}} to find where the gems are installed. If you followed this guide and installed [[RVM]], you can have more than one path, look at the one you are using.<br />
<br />
For this guide so far, the gem path is {{ic|/usr/local/rvm/gems/ruby-2.0.0-p247@global}}.<br />
# cd /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/passenger-4.0.23<br />
<br />
If you are aiming to use [[Apache]], run:<br />
# passenger-install-apache2-module<br />
<br />
In case a rails application is deployed with a sub-URI, like http://example.com/yourapplication, some additional configuration is required, see [http://www.modrails.com/documentation/Users%20guide%20Apache.html#deploying_rails_to_sub_uri the modrails documentation]<br />
<br />
For [[Nginx]]:<br />
# passenger-install-nginx-module<br />
<br />
And finally, the installer will provide you with further information regarding the installation (such as installing additional libraries). So, to setup your server, simply follow the output from the passenger installer.<br />
<br />
==Updating==<br />
<br />
Backup the files used in Redmine:<br />
# tar czvf ~/redmine_files.tar.gz -C /usr/share/webapps/redmine/ files<br />
<br />
Backup the plugins installed in Redmine:<br />
# tar czvf ~/redmine_plugins.tar.gz -C /usr/share/webapps/redmine/ plugins<br />
<br />
Backup the database:<br />
# mysqldump -u root -p <redmine_database> | gzip > ~/redmine_db.sql.gz<br />
<br />
Update the package as normal (through [[AUR]]):<br />
# wget https://aur.archlinux.org/packages/re/redmine/redmine.tar.gz<br />
# tar -zxpvf redmine.tar.gz<br />
# cd redmine<br />
<br />
Inspect the downloaded files, mainly the [[PKGBUILD]], and then build:<br />
# makepkg -s<br />
# pacman -U redmine-2.3.0-2-any.pkg.tar.gz<br />
<br />
Update the gems requirements:<br />
# bundle update<br />
<br />
For a clean gems environment, you may want to remove all the gems and reinstall them. To go through this, do:<br />
# for x in `gem list --no-versions`; do gem uninstall $x -a -x -I; done<br />
<br />
{{Warning|The command above will delete ALL the gems in your system or user, depending of what type of Ruby installation you did in the prerequisites step. You must take care or you can stop working another applications that rely on Ruby gems.}}<br />
<br />
If you did the last step and removed all the gems, now you will need to reinstall them all:<br />
# gem install bundler<br />
# bundle install --without development test<br />
<br />
{{Note|If you removed ALL the gems as above, and used a server that uses a gem, remember to reinstall the server gem: passenger (for Apache and Nginx), Mongrel or Unicorn. To do this, just follow the steps in the installation tutorial above.}}<br />
<br />
Copy the saved files:<br />
# tar xzvf ~/redmine_files.tar.gz -C /usr/share/webapps/redmine/<br />
<br />
Copy the installed plugins:<br />
# tar xzvf ~/redmine_plugins.tar.gz -C /usr/share/webapps/redmine/<br />
<br />
Regenerate the secret token:<br />
# cd /usr/share/webapps/redmine<br />
# bundle exec rake generate_secret_token<br />
<br />
Check for any themes that you may have installed in the {{ic|public/themes}} directory. You can copy them over but checking for updated version is ideal.<br />
<br />
{{Warning|Do NOT overwrite config/settings.yml with the old one.}}<br />
<br />
Update the database. This step is the one that could change the contents of your database. Go to your new redmine directory, then migrate your database:<br />
# RAILS_ENV=production REDMINE_LANG=pt-BR bundle exec rake db:migrate<br />
<br />
If you have installed any plugins, you should also run their database migrations:<br />
# RAILS_ENV=production REDMINE_LANG=pt-BR bundle exec rake redmine:plugins:migrate<br />
<br />
Now, it is time to clean the cache and the existing sessions:<br />
# RAILS_ENV=production bundle exec rake tmp:cache:clear tmp:sessions:clear<br />
<br />
Restart the application server (e.g. puma, thin, passenger, etc). And finally go to "Admin -> Roles & permissions" to check/set permissions for the new features, if any.<br />
<br />
==Troubleshooting==<br />
===RMagick gem without support for High Dynamic Range in ImageMagick===<br />
As of ImageMagick 6.8.6.8-1, it is built with HDRI (High Dynamic Range Image) support, and this breaks the RMagick gem as seen in {{Bug|36518}}.<br />
<br />
The github [https://github.com/rmagick/rmagick rmagick] is already patched, but the mantainer did not packed it for rubygems yet.<br />
<br />
To install this patched version download the git repository:<br />
# git clone https://github.com/rmagick/rmagick.git<br />
<br />
Then, you need to build the gem:<br />
# cd rmagick<br />
# gem build rmagick.gemspec<br />
<br />
And finally install it:<br />
# gem install rmagick-2.13.2.gem<br />
<br />
{{Note|It will show some complains like {{ic|unable to convert "\xE0" from ASCII-8BIT to UTF-8 for ext/RMagick/RMagick2.so, skipping}}, but you can safelly ignore it.}}<br />
<br />
===Runtime error complaining that RMagick was configured with older version===<br />
<br />
If you get the following runtime error after upgrading ImageMagick {{ic|This installation of RMagick was configured with ImageMagick 6.8.7 but ImageMagick 6.8.8-1 is in use.}} then you only need to reinstall (or rebuild as shown above if is the case).<br />
<br />
{{Note|This is due to that when you install the RMagick gem it compiles some native extensions and they may need to be rebuilt after some ImageMagick upgrades.}}<br />
<br />
=== OpenSSL error about "SSLv3_client" ===<br />
<br />
After thel latest OpenSSL release (version 1.0.2.g-3) the ruby stop to work and you cannot build some ruby versions. You have two way to fix it:<br />
<br />
1. Use ruby-head (if using RVM) or 2.3.0or above (if using Arch package).<br />
<br />
2. Use this patch as noted in [https://github.com/rvm/rvm/issues/3529#issuecomment-157205030 Issue 3529] and [https://github.com/rvm/rvm/issues/3548 Issue 3548]<br />
<br />
# curl https://github.com/ruby/ruby/commit/801e1fe46d83c856844ba18ae4751478c59af0d1.diff > openssl.patch<br />
# rvm install --patch ./openssl.patch 2.0.0 /*or another ruby version*/<br />
<br />
===Error when installing gems: Cannot load such file -- mysql2/mysql2===<br />
<br />
If you see an error like {{ic| cannot load such file -- mysql2/mysql2}}, you are having a problem with the installation of the database gem. Probably a misconfiguration in the [[#Database Access Configuration|Database Access Configuration]] step.<br />
In this case you should verify the {{ic|database.yml}} file.<br />
<br />
If no success, you can manually install the database gem by:<br />
<br />
# gem install mysql2<br />
<br />
In last case, as suggested by [[User:Bobdog|Bobdog]], you can try to comment the line of the database gem and add a new one as bellow:<br />
<br />
{{hc|<path-to-mysql2-gem-directory>/lib/mysql2/mysql2.rb|<br />
<br />
# require 'mysql2/mysql2'<br />
require '<path-to-mysql2-gem-directory>/lib/mysql2/mysql2.so'}}<br />
<br />
=== Apache 2.4 Updating ===<br />
<br />
When updating to Apache 2.4 will be necessary to remove and install all your gems to make sure all of them that need to build native extensions will be rebuilt against the new Apache server.<br />
<br />
So, for a clean gems environment, remove all the gems:<br />
<br />
# for x in `gem list --no-versions`; do gem uninstall $x -a -x -I; done<br />
<br />
To reinstall the gems:<br />
<br />
# cd /usr/share/webapps/redmine<br />
# gem install bundler<br />
# bundle install --without development test<br />
<br />
Remember to reinstall the RMagick gem as describe above in [[#RMagick gem without support for High Dynamic Range in ImageMagick|RMagick gem without support for High Dynamic Range in ImageMagick]].<br />
<br />
And if you are using Passenger to serve your apps through Apache you will need to reinstall it as described above in [[#Configure the production server|Configure the production server]].<br />
<br />
=== Checkout SVN Source ===<br />
Get the Redmine source ([http://www.redmine.org/projects/redmine/wiki/Download Download instructions]). Here is method of installing Redmine directly from subversion in /srv/http/redmine/<br />
# useradd -d /srv/http/redmine -s /bin/false redmine<br />
# mkdir -p /srv/http/redmine<br />
# svn checkout http://svn.redmine.org/redmine/branches/2.1-stable /srv/http/redmine<br />
# chown -R redmine: /srv/http/redmine<br />
<br />
=== Automating The Update Process ===<br />
Example of an after-update script:<br />
<br />
#!/usr/bin/bash<br />
export RAILS_ENV=production<br />
grep -E "^gem 'thin'" Gemfile || echo "gem 'thin'" >> Gemfile<br />
bundle update && bundle exec rake generate_secret_token db:migrate redmine:plugins:migrate tmp:cache:clear tmp:sessions:clear<br />
<br />
{{Note| Note that this script uses Thin as application server, so you must change it to your needs.}}<br />
<br />
=== Creating a Systemd Unit===<br />
If you want to automatic run you application server when system starts, you need to create a systemd unit file.<br />
<br />
{{Note| This is not needed if you use {{Pkg|apache}} or {{Pkg|nginx}} with Passenger gem. Those servers already have their own unit file, so you have only to enable it.}}<br />
<br />
{{hc|/etc/systemd/system/redmine.service|<nowiki><br />
[Unit]<br />
Description=Redmine server<br />
After=syslog.target<br />
After=network.target<br />
<br />
[Service]<br />
Type=simple<br />
User=redmine2<br />
Group=redmine2<br />
Environment=GEM_HOME=/home/redmine2/.gem/<br />
ExecStart=/usr/bin/ruby /usr/share/webapps/redmine/bin/rails server webrick -e production<br />
<br />
# Give a reasonable amount of time for the server to start up/shut down<br />
TimeoutSec=300<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
<br />
</nowiki>}}<br />
<br />
=== Complaints about psych===<br />
<br />
Like that:<br />
<br />
/usr/lib/ruby/2.1.0/psych/parser.rb:33:in `<class:Parser>': superclass mismatch for class Mark (TypeError)<br />
from /usr/lib/ruby/2.1.0/psych/parser.rb:32:in `<module:Psych>'<br />
from /usr/lib/ruby/2.1.0/psych/parser.rb:1:in `<top (required)>'<br />
from /usr/lib/ruby/2.1.0/psych.rb:7:in `require'<br />
<br />
[http://www.redmine.org/boards/2/topics/36728 according to that] that is a bundler issue, and you have to add<br />
gem 'psych'<br />
to your Gemfile.local<br />
<br />
== See also ==<br />
<br />
* [http://www.redmine.org/ Redmine Official Site]<br />
* [http://www.redmine.org/projects/redmine/wiki/Features Redmine Features]<br />
* [http://www.redmine.org/projects/redmine/wiki/RedmineInstall Official install guide from Redmine Wiki]</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Talk:Media_Transfer_Protocol&diff=556848Talk:Media Transfer Protocol2018-11-23T16:45:45Z<p>Sleeping: Usage mtp-connect</p>
<hr />
<div>== Custom udev rules and rebooting ==<br />
<br />
In a couple of places {{ic|/usr/lib/udev/rules.d/}} is used as location for custom {{ic|udev}} rules. Isn't the {{ic|/etc/udev/rules.d/}} a better place for them? If so I propose to change {{ic|/usr/lib/udev/rules.d/}} to {{ic|/etc/udev/rules.d/}}.<br />
<br />
Also, there's no need for rebooting the system, as suggested in [[MTP#gvfs-mtp troubleshooting]]. What is that? A Windows? ;} I think this should be removed or changed to some other means like “relogging”.<br />
<br />
--thebodzio 22:34, 29 December 2014 (UTC)<br />
<br />
:Yes to both, [[Udev#About udev rules]] and [[Udev#Loading new rules]]. -- [[User:Kynikos|Kynikos]] ([[User talk:Kynikos|talk]]) 01:39, 31 December 2014 (UTC)<br />
<br />
:: May be it must be removed "This article or section is a candidate for merging with udev."? I have added more related info to gvfs-mtp but not related to udev, I think that it is good if will stay here as it is. (Andy Crowd - [[wikipedia:蔡依林|蔡依林]] 18:28, 17 August 2016 (UTC)).<br />
<br />
::I am not sure about two probably similar [[udev]] rules [[MTP#Media_players]] and [[MTP#gvfs-mtp]], may be to have only one is enough and merge both?(Andy Crowd - [[wikipedia:蔡依林|蔡依林]] 22:58, 19 August 2016 (UTC)) <br />
:: EDIT: <br />
:: I will try to merge them after few days, I hope it is OK. (Andy Crowd - [[wikipedia:蔡依林|蔡依林]] 21:24, 20 August 2016 (UTC))<br />
<br />
:: This is what I mean about merging Media players and gvfs-mtp sections and udev rules:<br />
ATTR{idVendor}=="04b7", ATTR{idProduct}=="88a9", SYMLINK+="libmtp", MODE="660", ENV{ID_MTP_DEVICE}="1"<br />
+<br />
SUBSYSTEM=="usb", ATTR{idVendor}=="04b7", ATTR{idProduct}=="88a9", MODE="0666", OWNER="[username]"<br />
=<br />
SUBSYSTEM=="usb", ATTR{idVendor}=="04b7", ATTR{idProduct}=="88a9", MODE="0660", GROUP="uucp", ENV{ID_MTP_DEVICE}="1", SYMLINK+="libmtp"<br />
:: (Andy Crowd - [[wikipedia:蔡依林|蔡依林]] 19:42, 21 August 2016 (UTC)).<br />
<br />
:: In Archlinux I have no problem with detecting my phone without Udev rules but in Debian I have tested both udev rules and only the last that I combined worked perfect, I could both see and mount MTP in Thunar.<br />
<br />
:: (Andy Crowd - [[wikipedia:蔡依林|蔡依林]] 11:12, 22 August 2016 (UTC))<br />
<br />
:: About restarting computer: after changing Udev rules and reload them is not working, I think that it is also necessary restart gvfsd and related to it processes or just reboot computer that helped me much better. Did some else tested it?<br />
:: (Andy Crowd - [[wikipedia:蔡依林|蔡依林]] 18:46, 22 August 2016 (UTC)).<br />
<br />
== <s>Warning that mounting can harm the filesystem</s> ==<br />
<br />
I removed the warning [[User:David Hedlund]] added in [[Special:Diff/521341]] as I don't think that mounting can damage the filesystem.<br />
<br />
Feel free to proof me wrong.--[[User:Larivact|Larivact]] ([[User talk:Larivact|talk]])<br />
<br />
:I could not access GRUB after I tried to mount a smartphone. Can you please add a Tip box at the beginning of the page says: "MTP is widely supported on most distributions but it requires you to '''unlock your phone's screen to get connected''' for security reasons.". --[[User:David Hedlund|David Hedlund]] ([[User talk:David Hedlund|talk]]) 13:09, 16 May 2018 (UTC)<br />
<br />
::Correlation does not imply causation. The need to unlock the screen is already stated in [[MTP#Connecting]] and I don't think it needs more emphasis because failing to do so shouldn't do any harm.--[[User:Larivact|Larivact]] ([[User talk:Larivact|talk]]) 14:11, 16 May 2018 (UTC)<br />
<br />
<br />
== Usage mtp-connect ==<br />
<br />
"You can transfer files using the {{ic|mtp-connect}} command." How? --[[User:Sleeping|Sleeping]] ([[User talk:Sleeping|talk]]) 16:45, 23 November 2018 (UTC)</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Thunderbird&diff=549881Thunderbird2018-10-22T10:06:46Z<p>Sleeping: /* LC_TIME environment variable not respected */</p>
<hr />
<div>[[Category:Email clients]]<br />
[[de:Thunderbird]]<br />
[[fr:Thunderbird]]<br />
[[it:Thunderbird]]<br />
[[ja:Thunderbird]]<br />
{{Related articles start}}<br />
{{Related|Thunderbird/Enigmail}}<br />
{{Related|Firefox}}<br />
{{Related articles end}}<br />
<br />
[https://www.thunderbird.net/en-US/ Mozilla Thunderbird] is an open source email, news, and chat client developed by the [https://www.mozilla.org/ Mozilla Foundation].<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{Pkg|thunderbird}} package, with a [https://www.archlinux.org/packages/?q=thunderbird-i18n language pack] if required.<br />
<br />
Other versions include:<br />
<br />
* {{App | Thunderbird Beta | Cutting edge features with relatively-good stability. | https://www.thunderbird.net/channel/ | {{AUR|thunderbird-beta-bin}}}}<br />
* {{App | Thunderbird Earlybird | Experience the newest innovations as they're developed (equivalent to an alpha and Firefox Aurora releases). | https://www.thunderbird.net/channel/ | {{AUR|thunderbird-earlybird}}}}<br />
* {{App | Thunderbird Nightly | Experience the newest innovations with nightly releases (for those that want to work with breakages). | https://ftp.mozilla.org/pub/mozilla.org/thunderbird/nightly/latest-comm-central/ | {{AUR|thunderbird-nightly}}}}<br />
<br />
A version overview, both past and future, can be read on [[MozillaWiki:Releases]].<br />
<br />
== Securing ==<br />
<br />
=== Considerations ===<br />
<br />
Under some circumstances Thunderbird may send your system's (internal) IP address as reply to HELO/ELHO requesting SMTP servers. If you have concerns, please read [http://kb.mozillazine.org/Replace_IP_address_with_name_in_headers this] article. You might change this for Firefox, too.<br />
<br />
If you want to hide Thunderbird for sending your system's [https://developer.mozilla.org/en-US/docs/Web/HTTP/Gecko_user_agent_string_reference#Linux User Agent] string,<br />
create a new empty string entry {{ic|general.useragent.override}} in the [[#Config Editor]].<br />
<br />
While Thunderbird disables email images by default, it enables HTML rendering which may expose IP address and location. Choose ''View > Message Body As > Plain Text'' to disable this.<br />
<br />
JavaScript is disabled for message content but not RSS news feeds. To disable JavaScript for RSS set {{ic|javascript.enabled}} to false in the [[#Config Editor]].<br />
<br />
== Extensions ==<br />
<br />
* {{App|[[Thunderbird/Enigmail|Enigmail]]|Extension for writing and receiving email signed and/or encrypted with the OpenPGP standard.|https://www.enigmail.net|{{Pkg|thunderbird-extension-enigmail}}, {{AUR|thunderbird-enigmail-git}}}}<br />
* {{App|TorBirdy|Extension that configures Thunderbird to make connections over the [[Tor]] anonymity network|[https://addons.mozilla.org/thunderbird/addon/torbirdy/ TorBirdy AMO]|}}<br />
* {{App|FireTray|Adds a customizable system tray icon for Thunderbird|[https://addons.mozilla.org/thunderbird/addon/firetray/ FireTray AMO]|}}<br />
* {{App|[[Wikipedia:Lightning_(software)|Lightning]]|A calendar extension that brings [[Wikipedia:Mozilla Sunbird|Sunbird]]'s functionality to Thunderbird, including CalDAV support. Lightning now ships with Thunderbird, but due to differing release schedules it may have issues in Thunderbird testing releases. See [https://support.mozilla.org/en-US/questions/1211583 Mozilla support forum post]. Also see [https://developer.mozilla.org/en-US/docs/Mozilla/Calendar/Calendar_Versions Lightning Release Schedule].|https://www.thunderbird.net/en-US/calendar/|}}<br />
* {{App|SOGo Connector| Lets you sync address books via CardDAV|https://sogo.nu/download.html#/frontends|{{AUR|thunderbird-sogo-connector-bin}}}}<br />
* {{App|Cardbook|A new addressbook for Thunderbird based on the CARDDav and VCARD standards.|[https://addons.mozilla.org/thunderbird/addon/cardbook/ Cardbook AMO]|}}<br />
<br />
== Tips and tricks ==<br />
<br />
=== Config Editor ===<br />
<br />
Thunderbird can be extensively configured in ''Edit > Preferences > Advanced > General > Config Editor''.<br />
<br />
=== Setting the default browser ===<br />
<br />
{{Note|Since version 24 the {{ic|network.protocol-handler.app.*}} keys have no effect and will not be able to set the default browser.}}<br />
<br />
Thunderbird uses the default browser as defined by the [[XDG MIME Applications]]. This is commonly modified by the Gnome Control Center (''Gnome Control Center > Details > Default Applications > Web'') (available in: {{Pkg|gnome-control-center}}).<br />
<br />
This can be overridden in the [[#Config Editor]] by searching for {{ic|network.protocol-handler.warn-external}}.<br />
<br />
If the following three are all set to '''false''' (default), turn them to '''true''', and Thunderbird will ask you when clicking on links which application to use (remember to also check ''"Remember my choice for .. links"'').<br />
<br />
network.protocol-handler.warn-external.ftp<br />
network.protocol-handler.warn-external.http<br />
network.protocol-handler.warn-external.https<br />
<br />
=== Plain Text mode and font uniformity ===<br />
<br />
Plain Text mode lets you view all your emails without HTML rendering and is available in ''View > Message Body As''. This defaults to the [[Wikipedia:Monospace_(Unicode)|Monospace]] font but the size is still inherited from original system fontconfig settings. The following example will overwrite this with Ubuntu Mono of 10 pixels (available in: {{Pkg|ttf-ubuntu-font-family}}).<br />
<br />
Remember to run {{ic|fc-cache -fv}} to update system font cache. See [[Font configuration]] for more information.<br />
<br />
{{hc|~/.config/fontconfig/fonts.conf|<nowiki><br />
<?xml version="1.0"?><br />
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"><br />
<fontconfig><br />
<match target="pattern"><br />
<test qual="any" name="family"><string>monospace</string></test><br />
<edit name="family" mode="assign" binding="same"><string>Ubuntu Mono</string></edit><br />
<!-- For Thunderbird, lowering default font size to 10 for uniformity --><br />
<edit name="pixelsize" mode="assign"><int>10</int></edit><br />
</match><br />
</fontconfig><br />
</nowiki>}}<br />
<br />
=== Webmail with Thunderbird ===<br />
<br />
:''See upstream Wiki: [http://kb.mozillazine.org/Using_webmail_with_your_email_client Using webmail with your email client].''<br />
<br />
=== Migrate profile to another system ===<br />
<br />
{{Tip|The [https://addons.mozilla.org/thunderbird/addon/importexporttools ImportExportTools] addon offers an option to export and import a profile folder.}}<br />
<br />
Before you start with Importing or Exporting tasks, backup your complete {{ic|~/.thunderbird}} profile:<br />
<br />
$ cp -R ~/.thunderbird /to/backup/folder/<br />
<br />
With migration you just copy your current Thunderbird profile to another PC or a new Thunderbird installation:<br />
<br />
1. Install Thunderbird on the target PC<br />
<br />
2. Start Thunderbird without doing anything and quit it.<br />
<br />
3. Go to your Backup folder of your old Thunderbird installation<br />
<br />
4. Enter the backup profile folder:<br />
<br />
$ cd /to/backup/folder/.thunderbird/<oldrandomnumber>.default/<br />
<br />
5. Copy its content into the target profile folder {{ic|~/.thunderbird/<newrandomnumber>.default/}}<br />
<br />
$ cp -R /to/backup/folder/.thunderbird/<oldrandomnumber>.default/* ~/.thunderbird/<newrandomnumber>.default/<br />
<br />
=== Export + Import ===<br />
<br />
Before you start with Importing or Exporting tasks, backup your complete {{ic|~/.thunderbird}} profile:<br />
<br />
$ cp -R ~/.thunderbird /to/backup/folder/<br />
<br />
If your accounts are broken or you want to join two different Thunderbird installations, you better install one Import and Export AddOn (eg. [https://addons.mozilla.org/thunderbird/addon/importexporttools ImportExportTools AddOn]) to both Thunderbird installations and following this just export and import all your data to the new installation.<br />
<br />
=== Changing the default sorting order ===<br />
Thunderbird (up to at least 31.4.0-1) sorts mail by date with the oldest on top without any threading. While this can be changed per folder, it is easier to set a sane default instead as described in [https://superuser.com/questions/13518/change-the-default-sorting-order-in-thunderbird this Superuser.com post].<br />
<br />
Set these preferences in the [[#Config Editor]]:<br />
<br />
mailnews.default_sort_order = 2 (descending)<br />
mailnews.default_view_flags = 1 (Threaded view)<br />
<br />
=== Maildir support ===<br />
The default message store format is mbox. To enable the use of Maildir, see [[MozillaWiki:Thunderbird/Maildir]]. You basically have to set the following preference in the [[#Config Editor]]:<br />
<br />
mail.serverDefaultStoreContractID = @mozilla.org/msgstore/maildirstore;1<br />
<br />
Some limitations up to at least 31.4.0-1: only the "tmp" and "cur" directories are supported. The "new" directory is completely ignored. The read state of mails are stored in a separate ".msf" file, so initially all local mail using Maildir will be marked as unread even when located in the "cur" directory.<br />
<br />
=== Spell checking ===<br />
<br />
[[Install]] {{Pkg|hunspell}} and a [https://www.archlinux.org/packages/?q=hunspell+dict hunspell language dictionary] and restart Thunderbird.<br />
<br />
See the Firefox article for [[Firefox#Firefox does not remember default spell check language|how to set the default spell checking language]].<br />
<br />
=== Native notifications ===<br />
<br />
Enable {{ic|mail.biff.use_system_alert}} in the [[#Config Editor]]. This option means that extensions (such as Gnome Integration) are not needed for these newer versions of Thunderbird.<br />
<br />
=== Theming tweaks ===<br />
<br />
Thunderbird will generally follow GTK theming in use on your system. However, two tweaks are desirable for full consistency. These are most beneficial for dark themes.<br />
<br />
# To view the body of emails with colors following your theme<br />
## Go to Preferences<br />
## Select the Display tab<br />
## Click the Colors button<br />
## Check {{ic|Use system colors}}<br />
## Set the option for {{ic|Override the colors specified by the content with my selection above}} to {{ic|Always}} or {{ic|Only with High Contrast themes}}<br />
# To view Lightning calendar with colors following your theme<br />
## Go to preferences<br />
## Select the Calendar tab<br />
## Check {{ic|Optimize colors for accessibility}}<br />
<br />
Further customization can be attained by creating and editing a {{ic|userchrome.css}} file in a process similar to Firefox. See [[Firefox/Tweaks#General user interface CSS settings]] and [http://kb.mozillazine.org/UserChrome.css Mozillazine's userchrome page].<br />
<br />
== Troubleshooting ==<br />
<br />
=== LDAP Segfault ===<br />
<br />
An [https://bugzilla.mozilla.org/show_bug.cgi?id=292127 LDAP clash (Bugzilla#292127)] arises on systems configured to use it to fetch user information. A possible [https://bugzilla.mozilla.org/show_bug.cgi?id=292127#c7 workaround] consists of renaming the conflicting bundled LDAP library.<br />
<br />
=== Error: Incoming server already exists ===<br />
<br />
It seems Thunderbird (v24) still has that bug which pops up with "Incoming server already exists" if you want to reinstall a previously deleted account with the same account data afterwards. Unfortunately, if you get this error you can now only clean reinstall Thunderbird: <br />
<br />
1. Make a backup of your current profile:<br />
<br />
$ cp -R ~/.thunderbird /to/backup/folder/<br />
<br />
2. Export all you Accounts, Calendar and Feeds via an AddOn like it's written in ''Export section'' of this Wiki.<br />
3. Uninstall your current Thunderbird installation<br />
<br />
$ pacman -R thunderbird<br />
<br />
4. Remove all your data by deleting your current Thunderbird folder {{ic|rm -R ~/.thunderbird/}}.<br />
<br />
5. Install Thunderbird again:<br />
<br />
$ pacman -S thunderbird<br />
<br />
6. Create your mail accounts, feeds and calendars (empty).<br />
<br />
7. Install the [https://addons.mozilla.org/thunderbird/addon/importexporttools/ ImportExportTools] AddOn<br />
<br />
8. Import all your data.<br />
<br />
=== Thunderbird UI freezes when receiving a new message ===<br />
<br />
If Thunderbird is configured to show an alert when a new message arrives, or at launch, the lack of a notification daemon may freeze the interface (white screen) for many seconds. You can solve this issue by disabling alerts or installing a [[Desktop_notifications#Notification_servers|notification server]].<br />
<br />
=== LC_TIME environment variable not respected ===<br />
<br />
Thunderbird should use the {{ic|LC_TIME}} environment variable for localization, but it might not do so in all contexts. Some problems can be mitigated by setting Edit > Preferences > Advanced > Date and Time Formatting to "Regional settings locale", a setting which was introduced in Thunderbird 56. However, there is an [https://bugzilla.mozilla.org/show_bug.cgi?id=1426907| active bug report] for this issue.</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Thunderbird&diff=549879Thunderbird2018-10-22T10:05:53Z<p>Sleeping: /* Troubleshooting */ Added section on LC_TIME problems</p>
<hr />
<div>[[Category:Email clients]]<br />
[[de:Thunderbird]]<br />
[[fr:Thunderbird]]<br />
[[it:Thunderbird]]<br />
[[ja:Thunderbird]]<br />
{{Related articles start}}<br />
{{Related|Thunderbird/Enigmail}}<br />
{{Related|Firefox}}<br />
{{Related articles end}}<br />
<br />
[https://www.thunderbird.net/en-US/ Mozilla Thunderbird] is an open source email, news, and chat client developed by the [https://www.mozilla.org/ Mozilla Foundation].<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{Pkg|thunderbird}} package, with a [https://www.archlinux.org/packages/?q=thunderbird-i18n language pack] if required.<br />
<br />
Other versions include:<br />
<br />
* {{App | Thunderbird Beta | Cutting edge features with relatively-good stability. | https://www.thunderbird.net/channel/ | {{AUR|thunderbird-beta-bin}}}}<br />
* {{App | Thunderbird Earlybird | Experience the newest innovations as they're developed (equivalent to an alpha and Firefox Aurora releases). | https://www.thunderbird.net/channel/ | {{AUR|thunderbird-earlybird}}}}<br />
* {{App | Thunderbird Nightly | Experience the newest innovations with nightly releases (for those that want to work with breakages). | https://ftp.mozilla.org/pub/mozilla.org/thunderbird/nightly/latest-comm-central/ | {{AUR|thunderbird-nightly}}}}<br />
<br />
A version overview, both past and future, can be read on [[MozillaWiki:Releases]].<br />
<br />
== Securing ==<br />
<br />
=== Considerations ===<br />
<br />
Under some circumstances Thunderbird may send your system's (internal) IP address as reply to HELO/ELHO requesting SMTP servers. If you have concerns, please read [http://kb.mozillazine.org/Replace_IP_address_with_name_in_headers this] article. You might change this for Firefox, too.<br />
<br />
If you want to hide Thunderbird for sending your system's [https://developer.mozilla.org/en-US/docs/Web/HTTP/Gecko_user_agent_string_reference#Linux User Agent] string,<br />
create a new empty string entry {{ic|general.useragent.override}} in the [[#Config Editor]].<br />
<br />
While Thunderbird disables email images by default, it enables HTML rendering which may expose IP address and location. Choose ''View > Message Body As > Plain Text'' to disable this.<br />
<br />
JavaScript is disabled for message content but not RSS news feeds. To disable JavaScript for RSS set {{ic|javascript.enabled}} to false in the [[#Config Editor]].<br />
<br />
== Extensions ==<br />
<br />
* {{App|[[Thunderbird/Enigmail|Enigmail]]|Extension for writing and receiving email signed and/or encrypted with the OpenPGP standard.|https://www.enigmail.net|{{Pkg|thunderbird-extension-enigmail}}, {{AUR|thunderbird-enigmail-git}}}}<br />
* {{App|TorBirdy|Extension that configures Thunderbird to make connections over the [[Tor]] anonymity network|[https://addons.mozilla.org/thunderbird/addon/torbirdy/ TorBirdy AMO]|}}<br />
* {{App|FireTray|Adds a customizable system tray icon for Thunderbird|[https://addons.mozilla.org/thunderbird/addon/firetray/ FireTray AMO]|}}<br />
* {{App|[[Wikipedia:Lightning_(software)|Lightning]]|A calendar extension that brings [[Wikipedia:Mozilla Sunbird|Sunbird]]'s functionality to Thunderbird, including CalDAV support. Lightning now ships with Thunderbird, but due to differing release schedules it may have issues in Thunderbird testing releases. See [https://support.mozilla.org/en-US/questions/1211583 Mozilla support forum post]. Also see [https://developer.mozilla.org/en-US/docs/Mozilla/Calendar/Calendar_Versions Lightning Release Schedule].|https://www.thunderbird.net/en-US/calendar/|}}<br />
* {{App|SOGo Connector| Lets you sync address books via CardDAV|https://sogo.nu/download.html#/frontends|{{AUR|thunderbird-sogo-connector-bin}}}}<br />
* {{App|Cardbook|A new addressbook for Thunderbird based on the CARDDav and VCARD standards.|[https://addons.mozilla.org/thunderbird/addon/cardbook/ Cardbook AMO]|}}<br />
<br />
== Tips and tricks ==<br />
<br />
=== Config Editor ===<br />
<br />
Thunderbird can be extensively configured in ''Edit > Preferences > Advanced > General > Config Editor''.<br />
<br />
=== Setting the default browser ===<br />
<br />
{{Note|Since version 24 the {{ic|network.protocol-handler.app.*}} keys have no effect and will not be able to set the default browser.}}<br />
<br />
Thunderbird uses the default browser as defined by the [[XDG MIME Applications]]. This is commonly modified by the Gnome Control Center (''Gnome Control Center > Details > Default Applications > Web'') (available in: {{Pkg|gnome-control-center}}).<br />
<br />
This can be overridden in the [[#Config Editor]] by searching for {{ic|network.protocol-handler.warn-external}}.<br />
<br />
If the following three are all set to '''false''' (default), turn them to '''true''', and Thunderbird will ask you when clicking on links which application to use (remember to also check ''"Remember my choice for .. links"'').<br />
<br />
network.protocol-handler.warn-external.ftp<br />
network.protocol-handler.warn-external.http<br />
network.protocol-handler.warn-external.https<br />
<br />
=== Plain Text mode and font uniformity ===<br />
<br />
Plain Text mode lets you view all your emails without HTML rendering and is available in ''View > Message Body As''. This defaults to the [[Wikipedia:Monospace_(Unicode)|Monospace]] font but the size is still inherited from original system fontconfig settings. The following example will overwrite this with Ubuntu Mono of 10 pixels (available in: {{Pkg|ttf-ubuntu-font-family}}).<br />
<br />
Remember to run {{ic|fc-cache -fv}} to update system font cache. See [[Font configuration]] for more information.<br />
<br />
{{hc|~/.config/fontconfig/fonts.conf|<nowiki><br />
<?xml version="1.0"?><br />
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"><br />
<fontconfig><br />
<match target="pattern"><br />
<test qual="any" name="family"><string>monospace</string></test><br />
<edit name="family" mode="assign" binding="same"><string>Ubuntu Mono</string></edit><br />
<!-- For Thunderbird, lowering default font size to 10 for uniformity --><br />
<edit name="pixelsize" mode="assign"><int>10</int></edit><br />
</match><br />
</fontconfig><br />
</nowiki>}}<br />
<br />
=== Webmail with Thunderbird ===<br />
<br />
:''See upstream Wiki: [http://kb.mozillazine.org/Using_webmail_with_your_email_client Using webmail with your email client].''<br />
<br />
=== Migrate profile to another system ===<br />
<br />
{{Tip|The [https://addons.mozilla.org/thunderbird/addon/importexporttools ImportExportTools] addon offers an option to export and import a profile folder.}}<br />
<br />
Before you start with Importing or Exporting tasks, backup your complete {{ic|~/.thunderbird}} profile:<br />
<br />
$ cp -R ~/.thunderbird /to/backup/folder/<br />
<br />
With migration you just copy your current Thunderbird profile to another PC or a new Thunderbird installation:<br />
<br />
1. Install Thunderbird on the target PC<br />
<br />
2. Start Thunderbird without doing anything and quit it.<br />
<br />
3. Go to your Backup folder of your old Thunderbird installation<br />
<br />
4. Enter the backup profile folder:<br />
<br />
$ cd /to/backup/folder/.thunderbird/<oldrandomnumber>.default/<br />
<br />
5. Copy its content into the target profile folder {{ic|~/.thunderbird/<newrandomnumber>.default/}}<br />
<br />
$ cp -R /to/backup/folder/.thunderbird/<oldrandomnumber>.default/* ~/.thunderbird/<newrandomnumber>.default/<br />
<br />
=== Export + Import ===<br />
<br />
Before you start with Importing or Exporting tasks, backup your complete {{ic|~/.thunderbird}} profile:<br />
<br />
$ cp -R ~/.thunderbird /to/backup/folder/<br />
<br />
If your accounts are broken or you want to join two different Thunderbird installations, you better install one Import and Export AddOn (eg. [https://addons.mozilla.org/thunderbird/addon/importexporttools ImportExportTools AddOn]) to both Thunderbird installations and following this just export and import all your data to the new installation.<br />
<br />
=== Changing the default sorting order ===<br />
Thunderbird (up to at least 31.4.0-1) sorts mail by date with the oldest on top without any threading. While this can be changed per folder, it is easier to set a sane default instead as described in [https://superuser.com/questions/13518/change-the-default-sorting-order-in-thunderbird this Superuser.com post].<br />
<br />
Set these preferences in the [[#Config Editor]]:<br />
<br />
mailnews.default_sort_order = 2 (descending)<br />
mailnews.default_view_flags = 1 (Threaded view)<br />
<br />
=== Maildir support ===<br />
The default message store format is mbox. To enable the use of Maildir, see [[MozillaWiki:Thunderbird/Maildir]]. You basically have to set the following preference in the [[#Config Editor]]:<br />
<br />
mail.serverDefaultStoreContractID = @mozilla.org/msgstore/maildirstore;1<br />
<br />
Some limitations up to at least 31.4.0-1: only the "tmp" and "cur" directories are supported. The "new" directory is completely ignored. The read state of mails are stored in a separate ".msf" file, so initially all local mail using Maildir will be marked as unread even when located in the "cur" directory.<br />
<br />
=== Spell checking ===<br />
<br />
[[Install]] {{Pkg|hunspell}} and a [https://www.archlinux.org/packages/?q=hunspell+dict hunspell language dictionary] and restart Thunderbird.<br />
<br />
See the Firefox article for [[Firefox#Firefox does not remember default spell check language|how to set the default spell checking language]].<br />
<br />
=== Native notifications ===<br />
<br />
Enable {{ic|mail.biff.use_system_alert}} in the [[#Config Editor]]. This option means that extensions (such as Gnome Integration) are not needed for these newer versions of Thunderbird.<br />
<br />
=== Theming tweaks ===<br />
<br />
Thunderbird will generally follow GTK theming in use on your system. However, two tweaks are desirable for full consistency. These are most beneficial for dark themes.<br />
<br />
# To view the body of emails with colors following your theme<br />
## Go to Preferences<br />
## Select the Display tab<br />
## Click the Colors button<br />
## Check {{ic|Use system colors}}<br />
## Set the option for {{ic|Override the colors specified by the content with my selection above}} to {{ic|Always}} or {{ic|Only with High Contrast themes}}<br />
# To view Lightning calendar with colors following your theme<br />
## Go to preferences<br />
## Select the Calendar tab<br />
## Check {{ic|Optimize colors for accessibility}}<br />
<br />
Further customization can be attained by creating and editing a {{ic|userchrome.css}} file in a process similar to Firefox. See [[Firefox/Tweaks#General user interface CSS settings]] and [http://kb.mozillazine.org/UserChrome.css Mozillazine's userchrome page].<br />
<br />
== Troubleshooting ==<br />
<br />
=== LDAP Segfault ===<br />
<br />
An [https://bugzilla.mozilla.org/show_bug.cgi?id=292127 LDAP clash (Bugzilla#292127)] arises on systems configured to use it to fetch user information. A possible [https://bugzilla.mozilla.org/show_bug.cgi?id=292127#c7 workaround] consists of renaming the conflicting bundled LDAP library.<br />
<br />
=== Error: Incoming server already exists ===<br />
<br />
It seems Thunderbird (v24) still has that bug which pops up with "Incoming server already exists" if you want to reinstall a previously deleted account with the same account data afterwards. Unfortunately, if you get this error you can now only clean reinstall Thunderbird: <br />
<br />
1. Make a backup of your current profile:<br />
<br />
$ cp -R ~/.thunderbird /to/backup/folder/<br />
<br />
2. Export all you Accounts, Calendar and Feeds via an AddOn like it's written in ''Export section'' of this Wiki.<br />
3. Uninstall your current Thunderbird installation<br />
<br />
$ pacman -R thunderbird<br />
<br />
4. Remove all your data by deleting your current Thunderbird folder {{ic|rm -R ~/.thunderbird/}}.<br />
<br />
5. Install Thunderbird again:<br />
<br />
$ pacman -S thunderbird<br />
<br />
6. Create your mail accounts, feeds and calendars (empty).<br />
<br />
7. Install the [https://addons.mozilla.org/thunderbird/addon/importexporttools/ ImportExportTools] AddOn<br />
<br />
8. Import all your data.<br />
<br />
=== Thunderbird UI freezes when receiving a new message ===<br />
<br />
If Thunderbird is configured to show an alert when a new message arrives, or at launch, the lack of a notification daemon may freeze the interface (white screen) for many seconds. You can solve this issue by disabling alerts or installing a [[Desktop_notifications#Notification_servers|notification server]].<br />
<br />
=== LC_TIME environment variable not respected ===<br />
<br />
Thunderbird should use the {{ic|LC_TIME}} environment variable for localization, but it might not do so in all contexts. Some problems can be mitigated by setting Edit > Preferences > Advanced > Date and Time Formatting to "Regional settings locale", a setting which was introduced in Thunderbird 56. However, there is a [https://bugzilla.mozilla.org/show_bug.cgi?id=1426907|active bug report] for this issue.</div>Sleepinghttps://wiki.archlinux.org/index.php?title=QEMU&diff=523574QEMU2018-05-27T12:59:28Z<p>Sleeping: /* Troubleshooting */ -balloon option is deprecated https://qemu.weilnetz.de/doc/qemu-doc.html#g_t_002dballoon-_0028since-2_002e12_002e0_0029</p>
<hr />
<div>[[Category:Emulation]]<br />
[[Category:Hypervisors]]<br />
[[de:Qemu]]<br />
[[es:QEMU]]<br />
[[fr:Qemu]]<br />
[[ja:QEMU]]<br />
[[ru:QEMU]]<br />
[[zh-hans:QEMU]]<br />
[[zh-hant:QEMU]]<br />
{{Related articles start}}<br />
{{Related|:Category:Hypervisors}}<br />
{{Related|Libvirt}}<br />
{{Related|PCI passthrough via OVMF}}<br />
{{Related articles end}}<br />
<br />
According to the [http://wiki.qemu.org/Main_Page QEMU about page], "QEMU is a generic and open source machine emulator and virtualizer."<br />
<br />
When used as a machine emulator, QEMU can run OSes and programs made for one machine (e.g. an ARM board) on a different machine (e.g. your x86 PC). By using dynamic translation, it achieves very good performance.<br />
<br />
QEMU can use other hypervisors like [[Xen]] or [[KVM]] to use CPU extensions ([[Wikipedia:Hardware-assisted virtualization|HVM]]) for virtualization. When used as a virtualizer, QEMU achieves near native performances by executing the guest code directly on the host CPU.<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{Pkg|qemu}} package (or {{Pkg|qemu-headless}} for the version without GUI) and below optional packages for your needs:<br />
<br />
* {{Pkg|qemu-arch-extra}} - extra architectures support<br />
* {{Pkg|qemu-block-gluster}} - [[Glusterfs]] block support<br />
* {{Pkg|qemu-block-iscsi}} - [[iSCSI]] block support<br />
* {{Pkg|qemu-block-rbd}} - RBD block support <br />
* {{Pkg|samba}} - [[Samba|SMB/CIFS]] server support<br />
<br />
== Graphical front-ends for QEMU ==<br />
<br />
Unlike other virtualization programs such as [[VirtualBox]] and [[VMware]], QEMU does not provide a GUI to manage virtual machines (other than the window that appears when running a virtual machine), nor does it provide a way to create persistent virtual machines with saved settings. All parameters to run a virtual machine must be specified on the command line at every launch, unless you have created a custom script to start your virtual machine(s). However, there are several GUI front-ends for QEMU:<br />
<br />
* {{Pkg|virt-manager}}<br />
* {{Pkg|gnome-boxes}}<br />
* {{AUR|qemu-launcher}}<br />
* {{AUR|qtemu}}<br />
* {{AUR|aqemu}}<br />
<br />
Additional front-ends with QEMU support are available for [[libvirt]].<br />
<br />
== Creating new virtualized system ==<br />
<br />
=== Creating a hard disk image ===<br />
<br />
{{Tip|See the [https://en.wikibooks.org/wiki/QEMU/Images QEMU Wikibook] for more information on QEMU images.}}<br />
<br />
To run QEMU you will need a hard disk image, unless you are booting a live system from CD-ROM or the network (and not doing so to install an operating system to a hard disk image). A hard disk image is a file which stores the contents of the emulated hard disk.<br />
<br />
A hard disk image can be ''raw'', so that it is literally byte-by-byte the same as what the guest sees, and will always use the full capacity of the guest hard drive on the host. This method provides the least I/O overhead, but can waste a lot of space, as not-used space on the guest cannot be used on the host.<br />
<br />
Alternatively, the hard disk image can be in a format such as ''qcow2'' which only allocates space to the image file when the guest operating system actually writes to those sectors on its virtual hard disk. The image appears as the full size to the guest operating system, even though it may take up only a very small amount of space on the host system. This image format also supports QEMU snapshotting functionality (see [[#Creating and managing snapshots via the monitor console]] for details). However, using this format instead of ''raw'' will likely affect performance.<br />
<br />
QEMU provides the {{ic|qemu-img}} command to create hard disk images. For example to create a 4 GB image in the ''raw'' format:<br />
<br />
$ qemu-img create -f raw ''image_file'' 4G<br />
<br />
You may use {{ic|-f qcow2}} to create a ''qcow2'' disk instead.<br />
<br />
{{Note|You can also simply create a ''raw'' image by creating a file of the needed size using {{ic|dd}} or {{ic|fallocate}}.}}<br />
<br />
{{Warning|If you store the hard disk images on a [[Btrfs]] file system, you should consider disabling [[Btrfs#Copy-on-Write (CoW)|Copy-on-Write]] for the directory before creating any images.}}<br />
<br />
==== Overlay storage images ====<br />
<br />
You can create a storage image once (the 'backing' image) and have QEMU keep mutations to this image in an overlay image. This allows you to revert to a previous state of this storage image. You could revert by creating a new overlay image at the time you wish to revert, based on the original backing image.<br />
<br />
To create an overlay image, issue a command like:<br />
<br />
$ qemu-img create -o backing_file=''img1.raw'',backing_fmt=''raw'' -f ''qcow2'' ''img1.cow''<br />
<br />
After that you can run your QEMU VM as usual (see [[#Running virtualized system]]):<br />
<br />
$ qemu-system-x86_64 ''img1.cow''<br />
<br />
The backing image will then be left intact and mutations to this storage will be recorded in the overlay image file.<br />
<br />
When the path to the backing image changes, repair is required.<br />
<br />
{{Warning|The backing image's absolute filesystem path is stored in the (binary) overlay image file. Changing the backing image's path requires some effort.}}<br />
<br />
Make sure that the original backing image's path still leads to this image. If necessary, make a symbolic link at the original path to the new path. Then issue a command like:<br />
<br />
$ qemu-img rebase -b ''/new/img1.raw'' ''/new/img1.cow''<br />
<br />
At your discretion, you may alternatively perform an 'unsafe' rebase where the old path to the backing image is not checked:<br />
<br />
$ qemu-img rebase -u -b ''/new/img1.raw'' ''/new/img1.cow''<br />
<br />
==== Resizing an image ====<br />
<br />
{{Warning|Resizing an image containing an NTFS boot file system could make the operating system installed on it unbootable. For full explanation and workaround see [http://tjworld.net/wiki/Howto/ResizeQemuDiskImages].}}<br />
<br />
The {{ic|qemu-img}} executable has the {{ic|resize}} option, which enables easy resizing of a hard drive image. It works for both ''raw'' and ''qcow2''. For example, to increase image space by 10 GB, run:<br />
<br />
$ qemu-img resize ''disk_image'' +10G<br />
<br />
After enlarging the disk image, you must use file system and partitioning tools inside the virtual machine to actually begin using the new space. When shrinking a disk image, you must '''first reduce the allocated file systems and partition sizes''' using the file system and partitioning tools inside the virtual machine and then shrink the disk image accordingly, otherwise shrinking the disk image will result in data loss!<br />
<br />
=== Preparing the installation media ===<br />
<br />
To install an operating system into your disk image, you need the installation medium (e.g. optical disk, USB-drive, or ISO image) for the operating system. The installation medium should not be mounted because QEMU accesses the media directly.<br />
<br />
{{Tip|If using an optical disk, it is a good idea to first dump the media to a file because this both improves performance and does not require you to have direct access to the devices (that is, you can run QEMU as a regular user without having to change access permissions on the media's device file). For example, if the CD-ROM device node is named {{ic|/dev/cdrom}}, you can dump it to a file with the command: {{bc|1=$ dd if=/dev/cdrom of=''cd_image.iso''}}}}<br />
<br />
=== Installing the operating system===<br />
<br />
This is the first time you will need to start the emulator. To install the operating system on the disk image, you must attach both the disk image and the installation media to the virtual machine, and have it boot from the installation media.<br />
<br />
For example on i386 guests, to install from a bootable ISO file as CD-ROM and a raw disk image:<br />
<br />
$ qemu-system-x86_64 -cdrom ''iso_image'' -boot order=d -drive file=''disk_image'',format=raw<br />
<br />
See {{man|1|qemu}} for more information about loading other media types (such as floppy, disk images or physical drives) and [[#Running virtualized system]] for other useful options.<br />
<br />
After the operating system has finished installing, the QEMU image can be booted directly (see [[#Running virtualized system]]).<br />
<br />
{{Warning|By default only 128 MB of memory is assigned to the machine. The amount of memory can be adjusted with the {{ic|-m}} switch, for example {{ic|-m 512M}} or {{ic|-m 2G}}.}}<br />
<br />
{{Tip|<br />
* Instead of specifying {{ic|1=-boot order=x}}, some users may feel more comfortable using a boot menu: {{ic|1=-boot menu=on}}, at least during configuration and experimentation.<br />
* If you need to replace floppies or CDs as part of the installation process, you can use the QEMU machine monitor (press {{ic|Ctrl+Alt+2}} in the virtual machine's window) to remove and attach storage devices to a virtual machine. Type {{ic|info block}} to see the block devices, and use the {{ic|change}} command to swap out a device. Press {{ic|Ctrl+Alt+1}} to go back to the virtual machine.}}<br />
<br />
== Running virtualized system ==<br />
<br />
{{ic|qemu-system-*}} binaries (for example {{ic|qemu-system-i386}} or {{ic|qemu-system-x86_64}}, depending on guest's architecture) are used to run the virtualized guest. The usage is:<br />
<br />
$ qemu-system-x86_64 ''options'' ''disk_image''<br />
<br />
Options are the same for all {{ic|qemu-system-*}} binaries, see {{man|1|qemu}} for documentation of all options.<br />
<br />
By default, QEMU will show the virtual machine's video output in a window. One thing to keep in mind: when you click inside the QEMU window, the mouse pointer is grabbed. To release it, press {{ic|Ctrl+Alt+g}}.<br />
<br />
{{Warning|QEMU should never be run as root. If you must launch it in a script as root, you should use the {{ic|-runas}} option to make QEMU drop root privileges.}}<br />
<br />
=== Enabling KVM ===<br />
<br />
KVM must be supported by your processor and kernel, and necessary [[kernel modules]] must be loaded. See [[KVM]] for more information.<br />
<br />
To start QEMU in KVM mode, append {{ic|-enable-kvm}} to the additional start options. To check if KVM is enabled for a running VM, enter the QEMU [https://en.wikibooks.org/wiki/QEMU/Monitor Monitor] using {{ic|Ctrl+Alt+Shift+2}}, and type {{ic|info kvm}}.<br />
<br />
{{Note|<br />
* If you start your VM with a GUI tool and experience very bad performance, you should check for proper KVM support, as QEMU may be falling back to software emulation.<br />
* KVM needs to be enabled in order to start Windows 7 and Windows 8 properly without a ''blue screen''.<br />
}}<br />
<br />
=== Enabling IOMMU (Intel VT-d/AMD-Vi) support ===<br />
<br />
First enable IOMMU, see [[PCI passthrough via OVMF#Setting up IOMMU]].<br />
<br />
Add {{ic|-device intel-iommu}} to create the IOMMU device:<br />
<br />
$ qemu-system-x86_64 '''-enable-kvm -machine q35,accel=kvm -device intel-iommu''' -cpu host ..<br />
<br />
{{Note|<br />
On Intel CPU based systems creating an IOMMU device in a QEMU guest with {{ic|-device intel-iommu}} will disable PCI passthrough with an error like: {{bc|Device at bus pcie.0 addr 09.0 requires iommu notifier which is currently not supported by intel-iommu emulation}} While adding the kernel parameter {{ic|1=intel_iommu=on}} is still needed for remapping IO (e.g. [[PCI_passthrough_via_OVMF#Using_vfio-pci|PCI passthrough with vfio-pci]]), {{ic|-device intel-iommu}} should not be set if PCI PCI passthrough is required.<br />
}}<br />
<br />
== Moving data between host and guest OS ==<br />
<br />
=== Network ===<br />
<br />
Data can be shared between the host and guest OS using any network protocol that can transfer files, such as [[NFS]], [[SMB]], [[Wikipedia:Network Block Device|NBD]], HTTP, [[Very Secure FTP Daemon|FTP]], or [[SSH]], provided that you have set up the network appropriately and enabled the appropriate services.<br />
<br />
The default user-mode networking allows the guest to access the host OS at the IP address 10.0.2.2. Any servers that you are running on your host OS, such as a SSH server or SMB server, will be accessible at this IP address. So on the guests, you can mount directories exported on the host via [[SMB]] or [[NFS]], or you can access the host's HTTP server, etc.<br />
It will not be possible for the host OS to access servers running on the guest OS, but this can be done with other network configurations (see [[#Tap networking with QEMU]]).<br />
<br />
=== QEMU's built-in SMB server ===<br />
<br />
QEMU's documentation says it has a "built-in" SMB server, but actually it just starts up [[Samba]] with an automatically generated {{ic|smb.conf}} file located at {{ic|/tmp/qemu-smb.''pid''-0/smb.conf}} and makes it accessible to the guest at a different IP address (10.0.2.4 by default). This only works for user networking, and this is not necessarily very useful since the guest can also access the normal [[Samba]] service on the host if you have set up shares on it.<br />
<br />
To enable this feature, start QEMU with a command like:<br />
<br />
$ qemu-system-x86_64 ''disk_image'' -net nic -net user,smb=''shared_dir_path''<br />
<br />
where {{ic|''shared_dir_path''}} is a directory that you want to share between the guest and host.<br />
<br />
Then, in the guest, you will be able to access the shared directory on the host 10.0.2.4 with the share name "qemu". For example, in Windows Explorer you would go to {{ic|\\10.0.2.4\qemu}}.<br />
<br />
{{Note|<br />
* If you are using sharing options multiple times like {{ic|1=-net user,smb=''shared_dir_path1'' -net user,smb=''shared_dir_path2''}} or {{ic|1=-net user,smb=''shared_dir_path1'',smb=''shared_dir_path2''}} then it will share only the last defined one.<br />
* If you cannot access the shared folder and the guest system is Windows, check that the [http://ecross.mvps.org/howto/enable-netbios-over-tcp-ip-with-windows.htm NetBIOS protocol is enabled] and that a firewall does not block [http://technet.microsoft.com/en-us/library/cc940063.aspx ports] used by the NetBIOS protocol.<br />
}}<br />
<br />
=== Mounting a partition inside a raw disk image ===<br />
<br />
When the virtual machine is not running, it is possible to mount partitions that are inside a raw disk image file by setting them up as loopback devices. This does not work with disk images in special formats, such as qcow2, although those can be mounted using {{ic|qemu-nbd}}.<br />
<br />
{{Warning|You must make sure to unmount the partitions before running the virtual machine again. Otherwise, data corruption is very likely to occur.}}<br />
<br />
==== With manually specifying byte offset ====<br />
<br />
One way to mount a disk image partition is to mount the disk image at a certain offset using a command like the following:<br />
<br />
# mount -o loop,offset=32256 ''disk_image'' ''mountpoint''<br />
<br />
The {{ic|1=offset=32256}} option is actually passed to the {{ic|losetup}} program to set up a loopback device that starts at byte offset 32256 of the file and continues to the end. This loopback device is then mounted. You may also use the {{ic|sizelimit}} option to specify the exact size of the partition, but this is usually unnecessary.<br />
<br />
Depending on your disk image, the needed partition may not start at offset 32256. Run {{ic|fdisk -l ''disk_image''}} to see the partitions in the image. fdisk gives the start and end offsets in 512-byte sectors, so multiply by 512 to get the correct offset to pass to {{ic|mount}}.<br />
<br />
==== With loop module autodetecting partitions ====<br />
<br />
The Linux loop driver actually supports partitions in loopback devices, but it is disabled by default. To enable it, do the following:<br />
<br />
* Get rid of all your loopback devices (unmount all mounted images, etc.).<br />
* [[Kernel_modules#Manual_module_handling|Unload]] the {{ic|loop}} kernel module, and load it with the {{ic|1=max_part=15}} parameter set. Additionally, the maximum number of loop devices can be controlled with the {{ic|max_loop}} parameter.<br />
<br />
{{Tip|You can put an entry in {{ic|/etc/modprobe.d}} to load the loop module with {{ic|1=max_part=15}} every time, or you can put {{ic|1=loop.max_part=15}} on the kernel command-line, depending on whether you have the {{ic|loop.ko}} module built into your kernel or not.}}<br />
<br />
Set up your image as a loopback device:<br />
<br />
# losetup -f -P ''disk_image''<br />
<br />
Then, if the device created was {{ic|/dev/loop0}}, additional devices {{ic|/dev/loop0pX}} will have been automatically created, where X is the number of the partition. These partition loopback devices can be mounted directly. For example:<br />
<br />
# mount /dev/loop0p1 ''mountpoint''<br />
<br />
To mount the disk image with ''udisksctl'', see [[Udisks#Mount loop devices]].<br />
<br />
==== With kpartx ====<br />
<br />
'''kpartx''' from the {{AUR|multipath-tools}} package can read a partition table on a device and create a new device for each partition. For example:<br />
# kpartx -a ''disk_image''<br />
<br />
This will setup the loopback device and create the necessary partition(s) device(s) in {{ic|/dev/mapper/}}.<br />
<br />
=== Mounting a partition inside a qcow2 image ===<br />
<br />
You may mount a partition inside a qcow2 image using {{ic|qemu-nbd}}. See [http://en.wikibooks.org/wiki/QEMU/Images#Mounting_an_image_on_the_host Wikibooks].<br />
<br />
=== Using any real partition as the single primary partition of a hard disk image ===<br />
<br />
Sometimes, you may wish to use one of your system partitions from within QEMU. Using a raw partition for a virtual machine will improve performance, as the read and write operations do not go through the file system layer on the physical host. Such a partition also provides a way to share data between the host and guest.<br />
<br />
In Arch Linux, device files for raw partitions are, by default, owned by ''root'' and the ''disk'' group. If you would like to have a non-root user be able to read and write to a raw partition, you need to change the owner of the partition's device file to that user.<br />
<br />
{{Warning|<br />
* Although it is possible, it is not recommended to allow virtual machines to alter critical data on the host system, such as the root partition.<br />
* You must not mount a file system on a partition read-write on both the host and the guest at the same time. Otherwise, data corruption will result.<br />
}}<br />
<br />
After doing so, you can attach the partition to a QEMU virtual machine as a virtual disk.<br />
<br />
However, things are a little more complicated if you want to have the ''entire'' virtual machine contained in a partition. In that case, there would be no disk image file to actually boot the virtual machine since you cannot install a bootloader to a partition that is itself formatted as a file system and not as a partitioned device with a MBR. Such a virtual machine can be booted either by specifying the [[kernel]] and [[initramfs|initrd]] manually, or by simulating a disk with a MBR by using linear [[RAID]].<br />
<br />
==== By specifying kernel and initrd manually ====<br />
<br />
QEMU supports loading [[Kernels|Linux kernels]] and [[initramfs|init ramdisks]] directly, thereby circumventing bootloaders such as [[GRUB]]. It then can be launched with the physical partition containing the root file system as the virtual disk, which will not appear to be partitioned. This is done by issuing a command similar to the following:<br />
<br />
{{Note|In this example, it is the '''host's''' images that are being used, not the guest's. If you wish to use the guest's images, either mount {{ic|/dev/sda3}} read-only (to protect the file system from the host) and specify the {{ic|/full/path/to/images}} or use some kexec hackery in the guest to reload the guest's kernel (extends boot time). }}<br />
<br />
$ qemu-system-x86_64 -kernel /boot/vmlinuz-linux -initrd /boot/initramfs-linux.img -append root=/dev/sda /dev/sda3<br />
<br />
In the above example, the physical partition being used for the guest's root file system is {{ic|/dev/sda3}} on the host, but it shows up as {{ic|/dev/sda}} on the guest.<br />
<br />
You may, of course, specify any kernel and initrd that you want, and not just the ones that come with Arch Linux.<br />
<br />
When there are multiple [[kernel parameters]] to be passed to the {{ic|-append}} option, they need to be quoted using single or double quotes. For example:<br />
<br />
... -append 'root=/dev/sda1 console=ttyS0'<br />
<br />
==== Simulate virtual disk with MBR using linear RAID ====<br />
<br />
A more complicated way to have a virtual machine use a physical partition, while keeping that partition formatted as a file system and not just having the guest partition the partition as if it were a disk, is to simulate a MBR for it so that it can boot using a bootloader such as GRUB.<br />
<br />
You can do this using software [[RAID]] in linear mode (you need the {{ic|linear.ko}} kernel driver) and a loopback device: the trick is to dynamically prepend a master boot record (MBR) to the real partition you wish to embed in a QEMU raw disk image.<br />
<br />
Suppose you have a plain, unmounted {{ic|/dev/hdaN}} partition with some file system on it you wish to make part of a QEMU disk image. First, you create some small file to hold the MBR:<br />
<br />
$ dd if=/dev/zero of=''/path/to/mbr'' count=32<br />
<br />
Here, a 16 KB (32 * 512 bytes) file is created. It is important not to make it too small (even if the MBR only needs a single 512 bytes block), since the smaller it will be, the smaller the chunk size of the software RAID device will have to be, which could have an impact on performance. Then, you setup a loopback device to the MBR file:<br />
<br />
# losetup -f ''/path/to/mbr''<br />
<br />
Let us assume the resulting device is {{ic|/dev/loop0}}, because we would not already have been using other loopbacks. Next step is to create the "merged" MBR + {{ic|/dev/hdaN}} disk image using software RAID:<br />
<br />
# modprobe linear<br />
# mdadm --build --verbose /dev/md0 --chunk=16 --level=linear --raid-devices=2 /dev/loop0 /dev/hda''N''<br />
<br />
The resulting {{ic|/dev/md0}} is what you will use as a QEMU raw disk image (do not forget to set the permissions so that the emulator can access it). The last (and somewhat tricky) step is to set the disk configuration (disk geometry and partitions table) so that the primary partition start point in the MBR matches the one of {{ic|/dev/hda''N''}} inside {{ic|/dev/md0}} (an offset of exactly 16 * 512 = 16384 bytes in this example). Do this using {{ic|fdisk}} on the host machine, not in the emulator: the default raw disc detection routine from QEMU often results in non-kilobyte-roundable offsets (such as 31.5 KB, as in the previous section) that cannot be managed by the software RAID code. Hence, from the the host:<br />
<br />
# fdisk /dev/md0<br />
<br />
Press {{ic|X}} to enter the expert menu. Set number of 's'ectors per track so that the size of one cylinder matches the size of your MBR file. For two heads and a sector size of 512, the number of sectors per track should be 16, so we get cylinders of size 2x16x512=16k.<br />
<br />
Now, press {{ic|R}} to return to the main menu.<br />
<br />
Press {{ic|P}} and check that the cylinder size is now 16k.<br />
<br />
Now, create a single primary partition corresponding to {{ic|/dev/hda''N''}}. It should start at cylinder 2 and end at the end of the disk (note that the number of cylinders now differs from what it was when you entered fdisk.<br />
<br />
Finally, 'w'rite the result to the file: you are done. You now have a partition you can mount directly from your host, as well as part of a QEMU disk image:<br />
<br />
$ qemu-system-x86_64 -hdc /dev/md0 ''[...]''<br />
<br />
You can, of course, safely set any bootloader on this disk image using QEMU, provided the original {{ic|/dev/hda''N''}} partition contains the necessary tools.<br />
<br />
===== Alternative: use nbd-server =====<br />
Instead of linear RAID, you may use {{ic|nbd-server}} (from the {{pkg|nbd}} package) to create an MBR wrapper for QEMU.<br />
<br />
Assuming you have already set up your MBR wrapper file like above, rename it to {{ic|wrapper.img.0}}. Then create a symbolic link named {{ic|wrapper.img.1}} in the same directory, pointing to your partition. Then put the following script in the same directory:<br />
<br />
#!/bin/sh<br />
dir="$(realpath "$(dirname "$0")")"<br />
cat >wrapper.conf <<EOF<br />
[generic]<br />
allowlist = true<br />
listenaddr = 127.713705<br />
port = 10809<br />
<br />
[wrap]<br />
exportname = $dir/wrapper.img<br />
multifile = true<br />
EOF<br />
<br />
nbd-server \<br />
-C wrapper.conf \<br />
-p wrapper.pid \<br />
"$@"<br />
<br />
The {{ic|.0}} and {{ic|.1}} suffixes are essential; the rest can be changed. After running the above script (which you may need to do as root to make sure nbd-server is able to access the partition), you can launch QEMU with:<br />
<br />
qemu-system-x86_64 -drive file=nbd:127.713705:10809:exportname=wrap ''[...]''<br />
<br />
== Networking ==<br />
<br />
{{Style|Network topologies (sections [[#Host-only networking]], [[#Internal networking]] and info spread out across other sections) should not be described alongside the various virtual interfaces implementations, such as [[#User-mode networking]], [[#Tap networking with QEMU]], [[#Networking with VDE2]].}}<br />
<br />
The performance of virtual networking should be better with tap devices and bridges than with user-mode networking or vde because tap devices and bridges are implemented in-kernel.<br />
<br />
In addition, networking performance can be improved by assigning virtual machines a [http://wiki.libvirt.org/page/Virtio virtio] network device rather than the default emulation of an e1000 NIC. See [[#Installing virtio drivers]] for more information.<br />
<br />
=== Link-level address caveat ===<br />
<br />
By giving the {{ic|-net nic}} argument to QEMU, it will, by default, assign a virtual machine a network interface with the link-level address {{ic|52:54:00:12:34:56}}. However, when using bridged networking with multiple virtual machines, it is essential that each virtual machine has a unique link-level (MAC) address on the virtual machine side of the tap device. Otherwise, the bridge will not work correctly, because it will receive packets from multiple sources that have the same link-level address. This problem occurs even if the tap devices themselves have unique link-level addresses because the source link-level address is not rewritten as packets pass through the tap device.<br />
<br />
Make sure that each virtual machine has a unique link-level address, but it should always start with {{ic|52:54:}}. Use the following option, replace ''X'' with arbitrary hexadecimal digit:<br />
<br />
$ qemu-system-x86_64 -net nic,macaddr=52:54:''XX:XX:XX:XX'' -net vde ''disk_image''<br />
<br />
Generating unique link-level addresses can be done in several ways:<br />
<br />
<ol><br />
<li>Manually specify unique link-level address for each NIC. The benefit is that the DHCP server will assign the same IP address each time the virtual machine is run, but it is unusable for large number of virtual machines.<br />
</li><br />
<li>Generate random link-level address each time the virtual machine is run. Practically zero probability of collisions, but the downside is that the DHCP server will assign a different IP address each time. You can use the following command in a script to generate random link-level address in a {{ic|macaddr}} variable:<br />
<br />
{{bc|1=<br />
printf -v macaddr "52:54:%02x:%02x:%02x:%02x" $(( $RANDOM & 0xff)) $(( $RANDOM & 0xff )) $(( $RANDOM & 0xff)) $(( $RANDOM & 0xff ))<br />
qemu-system-x86_64 -net nic,macaddr="$macaddr" -net vde ''disk_image''<br />
}}<br />
<br />
</li><br />
<li>Use the following script {{ic|qemu-mac-hasher.py}} to generate the link-level address from the virtual machine name using a hashing function. Given that the names of virtual machines are unique, this method combines the benefits of the aforementioned methods: it generates the same link-level address each time the script is run, yet it preserves the practically zero probability of collisions.<br />
<br />
{{hc|qemu-mac-hasher.py|<nowiki><br />
#!/usr/bin/env python<br />
<br />
import sys<br />
import zlib<br />
<br />
if len(sys.argv) != 2:<br />
print("usage: %s <VM Name>" % sys.argv[0])<br />
sys.exit(1)<br />
<br />
crc = zlib.crc32(sys.argv[1].encode("utf-8")) & 0xffffffff<br />
crc = str(hex(crc))[2:]<br />
print("52:54:%s%s:%s%s:%s%s:%s%s" % tuple(crc))<br />
</nowiki>}}<br />
<br />
In a script, you can use for example:<br />
<br />
vm_name="''VM Name''"<br />
qemu-system-x86_64 -name "$vm_name" -net nic,macaddr=$(qemu-mac-hasher.py "$vm_name") -net vde ''disk_image''<br />
</li><br />
</ol><br />
<br />
=== User-mode networking ===<br />
<br />
By default, without any {{ic|-netdev}} arguments, QEMU will use user-mode networking with a built-in DHCP server. Your virtual machines will be assigned an IP address when they run their DHCP client, and they will be able to access the physical host's network through IP masquerading done by QEMU.<br />
<br />
{{warning|This only works with the TCP and UDP protocols, so ICMP, including {{ic|ping}}, will not work. Do not use {{ic|ping}} to test network connectivity.}}<br />
<br />
This default configuration allows your virtual machines to easily access the Internet, provided that the host is connected to it, but the virtual machines will not be directly visible on the external network, nor will virtual machines be able to talk to each other if you start up more than one concurrently.<br />
<br />
QEMU's user-mode networking can offer more capabilities such as built-in TFTP or SMB servers, redirecting host ports to the guest (for example to allow SSH connections to the guest) or attaching guests to VLANs so that they can talk to each other. See the QEMU documentation on the {{ic|-net user}} flag for more details.<br />
<br />
However, user-mode networking has limitations in both utility and performance. More advanced network configurations require the use of tap devices or other methods.<br />
<br />
{{Note|If the host system uses [[systemd-networkd]], make sure to symlink the {{ic|/etc/resolv.conf}} file as described in [[systemd-networkd#Required services and setup]], otherwise the DNS lookup in the guest system will not work.}}<br />
<br />
=== Tap networking with QEMU ===<br />
<br />
[[wikipedia:TUN/TAP|Tap devices]] are a Linux kernel feature that allows you to create virtual network interfaces that appear as real network interfaces. Packets sent to a tap interface are delivered to a userspace program, such as QEMU, that has bound itself to the interface.<br />
<br />
QEMU can use tap networking for a virtual machine so that packets sent to the tap interface will be sent to the virtual machine and appear as coming from a network interface (usually an Ethernet interface) in the virtual machine. Conversely, everything that the virtual machine sends through its network interface will appear on the tap interface.<br />
<br />
Tap devices are supported by the Linux bridge drivers, so it is possible to bridge together tap devices with each other and possibly with other host interfaces such as {{ic|eth0}}. This is desirable if you want your virtual machines to be able to talk to each other, or if you want other machines on your LAN to be able to talk to the virtual machines.<br />
<br />
{{Warning|If you bridge together tap device and some host interface, such as {{ic|eth0}}, your virtual machines will appear directly on the external network, which will expose them to possible attack. Depending on what resources your virtual machines have access to, you may need to take all the [[Firewalls|precautions]] you normally would take in securing a computer to secure your virtual machines. If the risk is too great, virtual machines have little resources or you set up multiple virtual machines, a better solution might be to use [[#Host-only networking|host-only networking]] and set up NAT. In this case you only need one firewall on the host instead of multiple firewalls for each guest.}}<br />
<br />
As indicated in the user-mode networking section, tap devices offer higher networking performance than user-mode. If the guest OS supports virtio network driver, then the networking performance will be increased considerably as well. Supposing the use of the tap0 device, that the virtio driver is used on the guest, and that no scripts are used to help start/stop networking, next is part of the qemu command one should see:<br />
<br />
-device virtio-net,netdev=network0 -netdev tap,id=network0,ifname=tap0,script=no,downscript=no<br />
<br />
But if already using a tap device with virtio networking driver, one can even boost the networking performance by enabling vhost, like:<br />
<br />
-device virtio-net,netdev=network0 -netdev tap,id=network0,ifname=tap0,script=no,downscript=no,vhost=on<br />
<br />
See http://www.linux-kvm.com/content/how-maximize-virtio-net-performance-vhost-net for more information.<br />
<br />
==== Host-only networking ====<br />
<br />
If the bridge is given an IP address and traffic destined for it is allowed, but no real interface (e.g. {{ic|eth0}}) is connected to the bridge, then the virtual machines will be able to talk to each other and the host system. However, they will not be able to talk to anything on the external network, provided that you do not set up IP masquerading on the physical host. This configuration is called ''host-only networking'' by other virtualization software such as [[VirtualBox]].<br />
<br />
{{Tip|<br />
* If you want to set up IP masquerading, e.g. NAT for virtual machines, see the [[Internet sharing#Enable NAT]] page.<br />
* See [[Network bridge]] for information on creating bridge.<br />
* You may want to have a DHCP server running on the bridge interface to service the virtual network. For example, to use the {{ic|172.20.0.1/16}} subnet with [[dnsmasq]] as the DHCP server:<br />
# ip addr add 172.20.0.1/16 dev br0<br />
# ip link set br0 up<br />
# dnsmasq --interface&#61;br0 --bind-interfaces --dhcp-range&#61;172.20.0.2,172.20.255.254<br />
}}<br />
<br />
==== Internal networking ====<br />
<br />
If you do not give the bridge an IP address and add an [[iptables]] rule to drop all traffic to the bridge in the INPUT chain, then the virtual machines will be able to talk to each other, but not to the physical host or to the outside network. This configuration is called ''internal networking'' by other virtualization software such as [[VirtualBox]]. You will need to either assign static IP addresses to the virtual machines or run a DHCP server on one of them.<br />
<br />
By default iptables would drop packets in the bridge network. You may need to use such iptables rule to allow packets in a bridged network:<br />
<br />
# iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT<br />
<br />
==== Bridged networking using qemu-bridge-helper ====<br />
<br />
{{Note|This method is available since QEMU 1.1, see http://wiki.qemu.org/Features/HelperNetworking.}}<br />
<br />
This method does not require a start-up script and readily accommodates multiple taps and multiple bridges. It uses {{ic|/usr/lib/qemu/qemu-bridge-helper}} binary, which allows creating tap devices on an existing bridge.<br />
<br />
{{Tip|See [[Network bridge]] for information on creating bridge.}}<br />
<br />
First, create a configuration file containing the names of all bridges to be used by QEMU:<br />
<br />
{{hc|/etc/qemu/bridge.conf|<br />
allow ''bridge0''<br />
allow ''bridge1''<br />
...}}<br />
<br />
Now start the VM. The most basic usage would be:<br />
<br />
$ qemu-system-x86_64 -net nic -net bridge,br=''bridge0'' ''[...]''<br />
<br />
With multiple taps, the most basic usage requires specifying the VLAN for all additional NICs:<br />
<br />
$ qemu-system-x86_64 -net nic -net bridge,br=''bridge0'' -net nic,vlan=1 -net bridge,vlan=1,br=''bridge1'' ''[...]''<br />
<br />
==== Creating bridge manually ====<br />
<br />
{{Style|This section needs serious cleanup and may contain out-of-date information.}}<br />
<br />
{{Tip|Since QEMU 1.1, the [http://wiki.qemu.org/Features/HelperNetworking network bridge helper] can set tun/tap up for you without the need for additional scripting. See [[#Bridged networking using qemu-bridge-helper]].}}<br />
<br />
The following describes how to bridge a virtual machine to a host interface such as {{ic|eth0}}, which is probably the most common configuration. This configuration makes it appear that the virtual machine is located directly on the external network, on the same Ethernet segment as the physical host machine.<br />
<br />
We will replace the normal Ethernet adapter with a bridge adapter and bind the normal Ethernet adapter to it.<br />
<br />
* Install {{Pkg|bridge-utils}}, which provides {{ic|brctl}} to manipulate bridges.<br />
<br />
* Enable IPv4 forwarding:<br />
# sysctl net.ipv4.ip_forward=1<br />
<br />
To make the change permanent, change {{ic|1=net.ipv4.ip_forward = 0}} to {{ic|1=net.ipv4.ip_forward = 1}} in {{ic|/etc/sysctl.d/99-sysctl.conf}}.<br />
<br />
* Load the {{ic|tun}} module and configure it to be loaded on boot. See [[Kernel modules]] for details.<br />
<br />
* Now create the bridge. See [[Bridge with netctl]] for details. Remember to name your bridge as {{ic|br0}}, or change the scripts below to your bridge's name.<br />
<br />
* Create the script that QEMU uses to bring up the tap adapter with {{ic|root:kvm}} 750 permissions:<br />
{{hc|/etc/qemu-ifup|<nowiki><br />
#!/bin/sh<br />
<br />
echo "Executing /etc/qemu-ifup"<br />
echo "Bringing up $1 for bridged mode..."<br />
sudo /usr/bin/ip link set $1 up promisc on<br />
echo "Adding $1 to br0..."<br />
sudo /usr/bin/brctl addif br0 $1<br />
sleep 2<br />
</nowiki>}}<br />
<br />
* Create the script that QEMU uses to bring down the tap adapter in {{ic|/etc/qemu-ifdown}} with {{ic|root:kvm}} 750 permissions:<br />
{{hc|/etc/qemu-ifdown|<nowiki><br />
#!/bin/sh<br />
<br />
echo "Executing /etc/qemu-ifdown"<br />
sudo /usr/bin/ip link set $1 down<br />
sudo /usr/bin/brctl delif br0 $1<br />
sudo /usr/bin/ip link delete dev $1<br />
</nowiki>}}<br />
<br />
* Use {{ic|visudo}} to add the following to your {{ic|sudoers}} file:<br />
{{bc|<nowiki><br />
Cmnd_Alias QEMU=/usr/bin/ip,/usr/bin/modprobe,/usr/bin/brctl<br />
%kvm ALL=NOPASSWD: QEMU<br />
</nowiki>}}<br />
<br />
* You launch QEMU using the following {{ic|run-qemu}} script:<br />
{{hc|run-qemu|<nowiki><br />
#!/bin/bash<br />
USERID=$(whoami)<br />
<br />
# Get name of newly created TAP device; see https://bbs.archlinux.org/viewtopic.php?pid=1285079#p1285079<br />
precreationg=$(/usr/bin/ip tuntap list | /usr/bin/cut -d: -f1 | /usr/bin/sort)<br />
sudo /usr/bin/ip tuntap add user $USERID mode tap<br />
postcreation=$(/usr/bin/ip tuntap list | /usr/bin/cut -d: -f1 | /usr/bin/sort)<br />
IFACE=$(comm -13 <(echo "$precreationg") <(echo "$postcreation"))<br />
<br />
# This line creates a random MAC address. The downside is the DHCP server will assign a different IP address each time<br />
printf -v macaddr "52:54:%02x:%02x:%02x:%02x" $(( $RANDOM & 0xff)) $(( $RANDOM & 0xff )) $(( $RANDOM & 0xff)) $(( $RANDOM & 0xff ))<br />
# Instead, uncomment and edit this line to set a static MAC address. The benefit is that the DHCP server will assign the same IP address.<br />
# macaddr='52:54:be:36:42:a9'<br />
<br />
qemu-system-x86_64 -net nic,macaddr=$macaddr -net tap,ifname="$IFACE" $*<br />
<br />
sudo ip link set dev $IFACE down &> /dev/null<br />
sudo ip tuntap del $IFACE mode tap &> /dev/null<br />
</nowiki>}}<br />
<br />
Then to launch a VM, do something like this<br />
$ run-qemu -hda ''myvm.img'' -m 512 -vga std<br />
<br />
* It is recommended for performance and security reasons to disable the [http://ebtables.netfilter.org/documentation/bridge-nf.html firewall on the bridge]:<br />
{{hc|/etc/sysctl.d/10-disable-firewall-on-bridge.conf|<nowiki><br />
net.bridge.bridge-nf-call-ip6tables = 0<br />
net.bridge.bridge-nf-call-iptables = 0<br />
net.bridge.bridge-nf-call-arptables = 0<br />
</nowiki>}}<br />
Run {{ic|sysctl -p /etc/sysctl.d/10-disable-firewall-on-bridge.conf}} to apply the changes immediately.<br />
<br />
See the [http://wiki.libvirt.org/page/Networking#Creating_network_initscripts libvirt wiki] and [https://bugzilla.redhat.com/show_bug.cgi?id=512206 Fedora bug 512206]. If you get errors by sysctl during boot about non-existing files, make the {{ic|bridge}} module load at boot. See [[Kernel modules#Automatic module handling]].<br />
<br />
Alternatively, you can configure [[iptables]] to allow all traffic to be forwarded across the bridge by adding a rule like this:<br />
-I FORWARD -m physdev --physdev-is-bridged -j ACCEPT<br />
<br />
==== Network sharing between physical device and a Tap device through iptables ====<br />
<br />
{{Merge|Internet_sharing|Duplication, not specific to QEMU.}}<br />
<br />
Bridged networking works fine between a wired interface (Eg. eth0), and it is easy to setup. However if the host gets connected to the network through a wireless device, then bridging is not possible.<br />
<br />
See [[Network bridge#Wireless interface on a bridge]] as a reference.<br />
<br />
One way to overcome that is to setup a tap device with a static IP, making linux automatically handle the routing for it, and then forward traffic between the tap interface and the device connected to the network through iptables rules.<br />
<br />
See [[Internet sharing]] as a reference.<br />
<br />
There you can find what is needed to share the network between devices, included tap and tun ones. The following just hints further on some of the host configurations required. As indicated in the reference above, the client needs to be configured for a static IP, using the IP assigned to the tap interface as the gateway. The caveat is that the DNS servers on the client might need to be manually edited if they change when changing from one host device connected to the network to another.<br />
<br />
To allow IP forwarding on every boot, one need to add the following lines to sysctl configuration file inside {{ic|/etc/sysctl.d}}:<br />
<br />
net.ipv4.ip_forward = 1<br />
net.ipv6.conf.default.forwarding = 1<br />
net.ipv6.conf.all.forwarding = 1<br />
<br />
The iptables rules can look like:<br />
<br />
# Forwarding from/to outside<br />
iptables -A FORWARD -i ${INT} -o ${EXT_0} -j ACCEPT<br />
iptables -A FORWARD -i ${INT} -o ${EXT_1} -j ACCEPT<br />
iptables -A FORWARD -i ${INT} -o ${EXT_2} -j ACCEPT<br />
iptables -A FORWARD -i ${EXT_0} -o ${INT} -j ACCEPT<br />
iptables -A FORWARD -i ${EXT_1} -o ${INT} -j ACCEPT<br />
iptables -A FORWARD -i ${EXT_2} -o ${INT} -j ACCEPT<br />
# NAT/Masquerade (network address translation)<br />
iptables -t nat -A POSTROUTING -o ${EXT_0} -j MASQUERADE<br />
iptables -t nat -A POSTROUTING -o ${EXT_1} -j MASQUERADE<br />
iptables -t nat -A POSTROUTING -o ${EXT_2} -j MASQUERADE<br />
<br />
The prior supposes there are 3 devices connected to the network sharing traffic with one internal device, where for example:<br />
<br />
INT=tap0<br />
EXT_0=eth0<br />
EXT_1=wlan0<br />
EXT_2=tun0<br />
<br />
The prior shows a forwarding that would allow sharing wired and wireless connections with the tap device.<br />
<br />
The forwarding rules shown are stateless, and for pure forwarding. One could think of restricting specific traffic, putting a firewall in place to protect the guest and others. However those would decrease the networking performance, while a simple bridge does not include any of that.<br />
<br />
Bonus: Whether the connection is wired or wireless, if one gets connected through VPN to a remote site with a tun device, supposing the tun device opened for that connection is tun0, and the prior iptables rules are applied, then the remote connection gets also shared with the guest. This avoids the need for the guest to also open a VPN connection. Again, as the guest networking needs to be static, then if connecting the host remotely this way, one most probably will need to edit the DNS servers on the guest.<br />
<br />
=== Networking with VDE2 ===<br />
<br />
{{Style|This section needs serious cleanup and may contain out-of-date information.}}<br />
<br />
==== What is VDE? ====<br />
<br />
VDE stands for Virtual Distributed Ethernet. It started as an enhancement of [[User-mode Linux|uml]]_switch. It is a toolbox to manage virtual networks.<br />
<br />
The idea is to create virtual switches, which are basically sockets, and to "plug" both physical and virtual machines in them. The configuration we show here is quite simple; However, VDE is much more powerful than this, it can plug virtual switches together, run them on different hosts and monitor the traffic in the switches. You are invited to read [http://wiki.virtualsquare.org/wiki/index.php/Main_Page the documentation of the project].<br />
<br />
The advantage of this method is you do not have to add sudo privileges to your users. Regular users should not be allowed to run modprobe.<br />
<br />
==== Basics ====<br />
<br />
VDE support can be [[pacman|installed]] via the {{Pkg|vde2}} package.<br />
<br />
In our config, we use tun/tap to create a virtual interface on my host. Load the {{ic|tun}} module (see [[Kernel modules]] for details):<br />
<br />
# modprobe tun<br />
<br />
Now create the virtual switch:<br />
<br />
# vde_switch -tap tap0 -daemon -mod 660 -group users<br />
<br />
This line creates the switch, creates {{ic|tap0}}, "plugs" it, and allows the users of the group {{ic|users}} to use it.<br />
<br />
The interface is plugged in but not configured yet. To configure it, run this command:<br />
<br />
# ip addr add 192.168.100.254/24 dev tap0<br />
<br />
Now, you just have to run KVM with these {{ic|-net}} options as a normal user:<br />
<br />
$ qemu-system-x86_64 -net nic -net vde -hda ''[...]''<br />
<br />
Configure networking for your guest as you would do in a physical network.<br />
<br />
{{Tip|You might want to set up NAT on tap device to access the internet from the virtual machine. See [[Internet sharing#Enable NAT]] for more information.}}<br />
<br />
==== Startup scripts ====<br />
<br />
Example of main script starting VDE:<br />
<br />
{{hc|/etc/systemd/scripts/qemu-network-env|<nowiki><br />
#!/bin/sh<br />
# QEMU/VDE network environment preparation script<br />
<br />
# The IP configuration for the tap device that will be used for<br />
# the virtual machine network:<br />
<br />
TAP_DEV=tap0<br />
TAP_IP=192.168.100.254<br />
TAP_MASK=24<br />
TAP_NETWORK=192.168.100.0<br />
<br />
# Host interface<br />
NIC=eth0<br />
<br />
case "$1" in<br />
start)<br />
echo -n "Starting VDE network for QEMU: "<br />
<br />
# If you want tun kernel module to be loaded by script uncomment here<br />
#modprobe tun 2>/dev/null<br />
## Wait for the module to be loaded<br />
#while ! lsmod | grep -q "^tun"; do echo "Waiting for tun device"; sleep 1; done<br />
<br />
# Start tap switch<br />
vde_switch -tap "$TAP_DEV" -daemon -mod 660 -group users<br />
<br />
# Bring tap interface up<br />
ip address add "$TAP_IP"/"$TAP_MASK" dev "$TAP_DEV"<br />
ip link set "$TAP_DEV" up<br />
<br />
# Start IP Forwarding<br />
echo "1" > /proc/sys/net/ipv4/ip_forward<br />
iptables -t nat -A POSTROUTING -s "$TAP_NETWORK"/"$TAP_MASK" -o "$NIC" -j MASQUERADE<br />
;;<br />
stop)<br />
echo -n "Stopping VDE network for QEMU: "<br />
# Delete the NAT rules<br />
iptables -t nat -D POSTROUTING "$TAP_NETWORK"/"$TAP_MASK" -o "$NIC" -j MASQUERADE<br />
<br />
# Bring tap interface down<br />
ip link set "$TAP_DEV" down<br />
<br />
# Kill VDE switch<br />
pgrep -f vde_switch | xargs kill -TERM<br />
;;<br />
restart|reload)<br />
$0 stop<br />
sleep 1<br />
$0 start<br />
;;<br />
*)<br />
echo "Usage: $0 {start|stop|restart|reload}"<br />
exit 1<br />
esac<br />
exit 0<br />
</nowiki>}}<br />
<br />
Example of systemd service using the above script:<br />
<br />
{{hc|/etc/systemd/system/qemu-network-env.service|<nowiki><br />
[Unit]<br />
Description=Manage VDE Switch<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/etc/systemd/scripts/qemu-network-env start<br />
ExecStop=/etc/systemd/scripts/qemu-network-env stop<br />
RemainAfterExit=yes<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
Change permissions for {{ic|qemu-network-env}} to be executable<br />
<br />
# chmod u+x /etc/systemd/scripts/qemu-network-env<br />
<br />
You can [[start]] {{ic|qemu-network-env.service}} as usual.<br />
<br />
====Alternative method====<br />
<br />
If the above method does not work or you do not want to mess with kernel configs, TUN, dnsmasq, and iptables you can do the following for the same result.<br />
<br />
# vde_switch -daemon -mod 660 -group users<br />
# slirpvde --dhcp --daemon<br />
<br />
Then, to start the VM with a connection to the network of the host:<br />
<br />
$ qemu-system-x86_64 -net nic,macaddr=52:54:00:00:EE:03 -net vde ''disk_image''<br />
<br />
=== VDE2 Bridge ===<br />
<br />
Based on [http://selamatpagicikgu.wordpress.com/2011/06/08/quickhowto-qemu-networking-using-vde-tuntap-and-bridge/ quickhowto: qemu networking using vde, tun/tap, and bridge] graphic. Any virtual machine connected to vde is externally exposed. For example, each virtual machine can receive DHCP configuration directly from your ADSL router.<br />
<br />
==== Basics ====<br />
<br />
Remember that you need {{ic|tun}} module and {{Pkg|bridge-utils}} package.<br />
<br />
Create the vde2/tap device:<br />
<br />
# vde_switch -tap tap0 -daemon -mod 660 -group users<br />
# ip link set tap0 up<br />
<br />
Create bridge:<br />
<br />
# brctl addbr br0<br />
<br />
Add devices:<br />
<br />
# brctl addif br0 eth0<br />
# brctl addif br0 tap0<br />
<br />
And configure bridge interface:<br />
<br />
# dhcpcd br0<br />
<br />
==== Startup scripts ====<br />
<br />
All devices must be set up. And only the bridge needs an IP address. For physical devices on the bridge (e.g. {{ic|eth0}}), this can be done with [[netctl]] using a custom Ethernet profile with:<br />
<br />
{{hc|/etc/netctl/ethernet-noip|<nowiki><br />
Description='A more versatile static Ethernet connection'<br />
Interface=eth0<br />
Connection=ethernet<br />
IP=no<br />
</nowiki>}}<br />
<br />
The following custom systemd service can be used to create and activate a VDE2 tap interface for use in the {{ic|users}} user group.<br />
<br />
{{hc|/etc/systemd/system/vde2@.service|<nowiki><br />
[Unit]<br />
Description=Network Connectivity for %i<br />
Wants=network.target<br />
Before=network.target<br />
<br />
[Service]<br />
Type=oneshot<br />
RemainAfterExit=yes<br />
ExecStart=/usr/bin/vde_switch -tap %i -daemon -mod 660 -group users<br />
ExecStart=/usr/bin/ip link set dev %i up<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 />
And finally, you can create the [[Bridge with netctl|bridge interface with netctl]].<br />
<br />
== Graphics ==<br />
<br />
QEMU can use the following different graphic outputs: {{ic|std}}, {{ic|qxl}}, {{ic|vmware}}, {{ic|virtio}}, {{ic|cirrus}} and {{ic|none}}.<br />
<br />
=== std ===<br />
<br />
With {{ic|-vga std}} you can get a resolution of up to 2560 x 1600 pixels without requiring guest drivers. This is the default since QEMU 2.2.<br />
<br />
=== qxl ===<br />
<br />
QXL is a paravirtual graphics driver with 2D support. To use it, pass the {{ic|-vga qxl}} option and install drivers in the guest. You may want to use SPICE for improved graphical performance when using QXL.<br />
<br />
On Linux guests, the {{ic|qxl}} and {{ic|bochs_drm}} kernel modules must be loaded in order to gain a decent performance.<br />
<br />
==== SPICE ====<br />
The [http://spice-space.org/ SPICE project] aims to provide a complete open source solution for remote access to virtual machines in a seamless way.<br />
<br />
SPICE can only be used when using QXL as the graphical output.<br />
<br />
The following is example of booting with SPICE as the remote desktop protocol, including the support for copy and paste from host:<br />
<br />
$ qemu-system-x86_64 -vga qxl -spice port=5930,disable-ticketing -device virtio-serial-pci -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 -chardev spicevmc,id=spicechannel0,name=vdagent<br />
<br />
From the [https://www.linux-kvm.org/page/SPICE SPICE page on the KVM wiki]: "''The {{ic|-device virtio-serial-pci}} option adds the virtio-serial device, {{ic|1=-device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0}} opens a port for spice vdagent in that device and {{ic|1=-chardev spicevmc,id=spicechannel0,name=vdagent}} adds a spicevmc chardev for that port. It is important that the {{ic|1=chardev=}} option of the {{ic|virtserialport}} device matches the {{ic|1=id=}} option given to the {{ic|chardev}} option ({{ic|spicechannel0}} in this example). It is also important that the port name is {{ic|com.redhat.spice.0}}, because that is the namespace where vdagent is looking for in the guest. And finally, specify {{ic|1=name=vdagent}} so that spice knows what this channel is for.''"<br />
<br />
{{Tip|Since QEMU in SPICE mode acts similarly to a remote desktop server, it may be more convenient to run QEMU in daemon mode with the {{ic|-daemonize}} parameter.}}<br />
<br />
Connect to the guest by using a SPICE client. {{pkg|virt-viewer}} is the recommended SPICE client by the protocol developers:<br />
<br />
$ remote-viewer spice://127.0.0.1:5930<br />
<br />
The reference and test implementation {{Pkg|spice-gtk}} can also be used:<br />
<br />
$ spicy -h 127.0.0.1 -p 5930<br />
<br />
Other [http://www.spice-space.org/download.html clients], including for other platforms, are also available.<br />
<br />
Using [[wikipedia:Unix_socket|Unix sockets]] instead of TCP ports does not involve using network stack on the host system, so it is [https://unix.stackexchange.com/questions/91774/performance-of-unix-sockets-vs-tcp-ports reportedly] better for performance. Example:<br />
$ qemu-system-x86_64 -vga qxl -device virtio-serial-pci -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 -chardev spicevmc,id=spicechannel0,name=vdagent -spice unix,addr=/tmp/vm_spice.socket,disable-ticketing<br />
<br />
Then connect via:<br />
<br />
$ remote-viewer spice+unix:///tmp/vm_spice.socket<br />
<br />
or via:<br />
<br />
$ spicy --uri="spice+unix:///tmp/vm_spice.socket"<br />
<br />
For improved support for multiple monitors, clipboard sharing, etc. the following packages should be installed on the guest:<br />
* {{Pkg|spice-vdagent}}: Spice agent xorg client that enables copy and paste between client and X-session and more. [[Enable]] {{ic|spice-vdagentd.service}} after installation.<br />
* {{Pkg|xf86-video-qxl}}: Xorg X11 qxl video driver<br />
* For other operating systems, see the Guest section on [http://www.spice-space.org/download.html SPICE-Space download] page.<br />
<br />
===== Password authentication with SPICE =====<br />
If you want to enable password authentication with SPICE you need to remove {{ic|disable-ticketing}} from the {{ic|-spice}} argument and instead add {{ic|1=password=''yourpassword''}}. For example:<br />
<br />
$ qemu-system-x86_64 -vga qxl -spice port=5900,password=''yourpassword'' -device virtio-serial-pci -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 -chardev spicevmc,id=spicechannel0,name=vdagent<br />
<br />
Your SPICE client should now ask for the password to be able to connect to the SPICE server.<br />
<br />
===== TLS encryption =====<br />
<br />
You can also configure TLS encryption for communicating with the SPICE server. First, you need to have a directory which contains the following files (the names must be exactly as indicated):<br />
* {{ic|ca-cert.pem}}: the CA master certificate.<br />
* {{ic|server-cert.pem}}: the server certificate signed with {{ic|ca-cert.pem}}.<br />
* {{ic|server-key.pem}}: the server private key.<br />
<br />
An example of generation of self-signed certificates with your own generated CA for your server is shown in the [https://www.spice-space.org/spice-user-manual.html#_generating_self_signed_certificates Spice User Manual].<br />
<br />
Afterwards, you can run QEMU with SPICE as explained above but using the following {{ic|-spice}} argument: {{ic|1=-spice tls-port=5901,password=''yourpassword'',x509-dir=''/path/to/pki_certs''}}, where {{ic|''/path/to/pki_certs''}} is the directory path that contains the three needed files shown earlier.<br />
<br />
It is now possible to connect to the server using {{pkg|virt-viewer}}:<br />
<br />
$ remote-viewer spice://''hostname''?tls-port=5901 --spice-ca-file=''/path/to/ca-cert.pem'' --spice-host-subject="C=''XX'',L=''city'',O=''organization'',CN=''hostname''" --spice-secure-channels=all<br />
<br />
Keep in mind that the {{ic|--spice-host-subject}} parameter needs to be set according to your {{ic|server-cert.pem}} subject. You also need to copy {{ic|ca-cert.pem}} to every client to verify the server certificate.<br />
<br />
{{Tip|You can get the subject line of the server certificate in the correct format for {{ic|--spice-host-subject}} (with entries separated by commas) using the following command: {{bc|<nowiki>$ openssl x509 -noout -subject -in server-cert.pem | cut -d' ' -f2- | sed 's/\///' | sed 's/\//,/g'</nowiki>}}<br />
}}<br />
<br />
The equivalent {{Pkg|spice-gtk}} command is:<br />
<br />
$ spicy -h ''hostname'' -s 5901 --spice-ca-file=ca-cert.pem --spice-host-subject="C=''XX'',L=''city'',O=''organization'',CN=''hostname''" --spice-secure-channels=all<br />
<br />
=== vmware ===<br />
<br />
Although it is a bit buggy, it performs better than std and cirrus. Install the VMware drivers {{Pkg|xf86-video-vmware}} and {{Pkg|xf86-input-vmmouse}} for Arch Linux guests.<br />
<br />
=== virtio ===<br />
<br />
{{ic|virtio-vga}} / {{ic|virtio-gpu}} is a paravirtual 3D graphics driver based on [https://virgil3d.github.io/ virgl]. Currently a work in progress, supporting only very recent (>= 4.4) Linux guests with {{Pkg|mesa}} (>=11.2) compiled with the option {{ic|1=--with-gallium-drivers=virgl}}.<br />
<br />
To enable 3D acceleration on the guest system select this vga with {{ic|-vga virtio}} and enable the opengl context in the display device with {{ic|1=-display sdl,gl=on}} or {{ic|1=-display gtk,gl=on}} for the sdl and gtk display output respectively. Successful configuration can be confirmed looking at the kernel log in the guest:<br />
<br />
{{hc|$ dmesg {{!}} grep drm |<br />
[drm] pci: virtio-vga detected<br />
[drm] virgl 3d acceleration enabled<br />
}}<br />
<br />
As of September 2016, support for the spice protocol is under development and can be tested installing the development release of {{Pkg|spice}} (>= 0.13.2) and recompiling qemu.<br />
<br />
For more information visit [https://www.kraxel.org/blog/tag/virgl/ kraxel's blog].<br />
<br />
=== cirrus ===<br />
<br />
The cirrus graphical adapter was the default [http://wiki.qemu.org/ChangeLog/2.2#VGA before 2.2]. It [https://www.kraxel.org/blog/2014/10/qemu-using-cirrus-considered-harmful/ should not] be used on modern systems.<br />
<br />
=== none ===<br />
<br />
This is like a PC that has no VGA card at all. You would not even be able to access it with the {{ic|-vnc}} option. Also, this is different from the {{ic|-nographic}} option which lets QEMU emulate a VGA card, but disables the SDL display.<br />
<br />
=== vnc ===<br />
<br />
Given that you used the {{ic|-nographic}} option, you can add the {{ic|-vnc display}} option to have QEMU listen on {{ic|display}} and redirect the VGA display to the VNC session. There is an example of this in the [[#Starting QEMU virtual machines on boot]] section's example configs.<br />
<br />
$ qemu-system-x86_64 -vga std -nographic -vnc :0<br />
$ gvncviewer :0<br />
<br />
When using VNC, you might experience keyboard problems described (in gory details) [https://www.berrange.com/posts/2010/07/04/more-than-you-or-i-ever-wanted-to-know-about-virtual-keyboard-handling/ here]. The solution is ''not'' to use the {{ic|-k}} option on QEMU, and to use {{ic|gvncviewer}} from {{Pkg|gtk-vnc}}. See also [http://www.mail-archive.com/libvir-list@redhat.com/msg13340.html this] message posted on libvirt's mailing list.<br />
<br />
== Audio ==<br />
<br />
=== Host ===<br />
<br />
The audio driver used by QEMU is set with the {{ic|QEMU_AUDIO_DRV}} environment variable:<br />
<br />
$ export QEMU_AUDIO_DRV=pa<br />
<br />
Run the following command to get QEMU's configuration options related to PulseAudio:<br />
<br />
$ qemu-system-x86_64 -audio-help | awk '/Name: pa/' RS=<br />
<br />
The listed options can be exported as environment variables, for example:<br />
<br />
{{bc|1=<br />
$ export QEMU_PA_SINK=alsa_output.pci-0000_04_01.0.analog-stereo.monitor<br />
$ export QEMU_PA_SOURCE=input<br />
}}<br />
<br />
=== Guest ===<br />
To get list of the supported emulation audio drivers:<br />
$ qemu-system-x86_64 -soundhw help<br />
<br />
To use e.g. {{ic|hda}} driver for the guest use the {{ic|-soundhw hda}} command with QEMU.<br />
<br />
{{Note|Video graphic card emulated drivers for the guest machine may also cause a problem with the sound quality. Test one by one to make it work. You can list possible options with {{ic|<nowiki>qemu-system-x86_64 -h | grep vga</nowiki>}}.}}<br />
<br />
== Installing virtio drivers ==<br />
<br />
QEMU offers guests the ability to use paravirtualized block and network devices using the [http://wiki.libvirt.org/page/Virtio virtio] drivers, which provide better performance and lower overhead.<br />
<br />
* A virtio block device requires the option {{Ic|-drive}} for passing a disk image, with parameter {{Ic|1=if=virtio}}:<br />
$ qemu-system-x86_64 -boot order=c -drive file=''disk_image'',if=virtio<br />
<br />
* Almost the same goes for the network:<br />
$ qemu-system-x86_64 -net nic,model=virtio<br />
<br />
{{Note|This will only work if the guest machine has drivers for virtio devices. Linux does, and the required drivers are included in Arch Linux, but there is no guarantee that virtio devices will work with other operating systems.}}<br />
<br />
=== Preparing an (Arch) Linux guest ===<br />
<br />
To use virtio devices after an Arch Linux guest has been installed, the following modules must be loaded in the guest: {{Ic|virtio}}, {{Ic|virtio_pci}}, {{Ic|virtio_blk}}, {{Ic|virtio_net}}, and {{Ic|virtio_ring}}. For 32-bit guests, the specific "virtio" module is not necessary.<br />
<br />
If you want to boot from a virtio disk, the initial ramdisk must contain the necessary modules. By default, this is handled by [[mkinitcpio]]'s {{ic|autodetect}} hook. Otherwise use the {{ic|MODULES}} array in {{ic|/etc/mkinitcpio.conf}} to include the necessary modules and rebuild the initial ramdisk.<br />
<br />
{{hc|/etc/mkinitcpio.conf|2=<br />
MODULES="virtio virtio_blk virtio_pci virtio_net"}}<br />
<br />
Virtio disks are recognized with the prefix {{ic|'''v'''}} (e.g. {{ic|'''v'''da}}, {{ic|'''v'''db}}, etc.); therefore, changes must be made in at least {{ic|/etc/fstab}} and {{ic|/boot/grub/grub.cfg}} when booting from a virtio disk.<br />
<br />
{{Tip|When referencing disks by [[UUID]] in both {{ic|/etc/fstab}} and bootloader, nothing has to be done.}}<br />
<br />
Further information on paravirtualization with KVM can be found [http://www.linux-kvm.org/page/Boot_from_virtio_block_device here].<br />
<br />
You might also want to install {{Pkg|qemu-guest-agent}} to implement support for QMP commands that will enhance the hypervisor management capabilities. After installing the package you can enable and start the {{ic|qemu-ga.service}}.<br />
<br />
=== Preparing a Windows guest ===<br />
<br />
{{Note|1=The only (reliable) way to upgrade a Windows 8.1 guest to Windows 10 seems to be to temporarily choose cpu core2duo,nx for the install [http://ubuntuforums.org/showthread.php?t=2289210]. After the install, you may revert to other cpu settings (8/8/2015).}}<br />
<br />
==== Block device drivers ====<br />
<br />
===== New Install of Windows =====<br />
<br />
Windows does not come with the virtio drivers. Therefore, you will need to load them during installation. There are basically two ways to do this: via Floppy Disk or via ISO files. Both images can be downloaded from the [https://fedoraproject.org/wiki/Windows_Virtio_Drivers Fedora repository].<br />
<br />
The floppy disk option is difficult because you will need to press F6 (Shift-F6 on newer Windows) at the very beginning of powering on the QEMU. This is difficult since you need time to connect your VNC console window. You can attempt to add a delay to the boot sequence. See {{man|1|qemu}} for more details about applying a delay at boot.<br />
<br />
The ISO option to load drivers is the preferred way, but it is available only on Windows Vista and Windows Server 2008 and later. The procedure is to load the image with virtio drivers in an additional cdrom device along with the primary disk device and Windows installer:<br />
<br />
$ qemu-system-x86_64 ... \<br />
-drive file=''/path/to/primary/disk.img'',index=0,media=disk,if=virtio \<br />
-drive file=''/path/to/installer.iso'',index=2,media=cdrom \<br />
-drive file=''/path/to/virtio.iso'',index=3,media=cdrom \<br />
...<br />
<br />
During the installation, the Windows installer will ask you for your Product key and perform some additional checks. When it gets to the "Where do you want to install Windows?" screen, it will give a warning that no disks are found. Follow the example instructions below (based on Windows Server 2012 R2 with Update).<br />
<br />
* Select the option {{ic|Load Drivers}}.<br />
* Uncheck the box for "Hide drivers that aren't compatible with this computer's hardware".<br />
* Click the Browse button and open the CDROM for the virtio iso, usually named "virtio-win-XX".<br />
* Now browse to {{ic|E:\viostor\[your-os]\amd64}}, select it, and press OK.<br />
* Click Next<br />
<br />
You should now see your virtio disk(s) listed here, ready to be selected, formatted and installed to.<br />
<br />
===== Change Existing Windows VM to use virtio =====<br />
Modifying an existing Windows guest for booting from virtio disk is a bit tricky.<br />
<br />
You can download the virtio disk driver from the [https://fedoraproject.org/wiki/Windows_Virtio_Drivers Fedora repository].<br />
<br />
Now you need to create a new disk image, which will force Windows to search for the driver. For example:<br />
<br />
$ qemu-img create -f qcow2 ''fake.qcow2'' 1G<br />
<br />
Run the original Windows guest (with the boot disk still in IDE mode) with the fake disk (in virtio mode) and a CD-ROM with the driver.<br />
<br />
$ qemu-system-x86_64 -m 512 -vga std -drive file=''windows_disk_image'',if=ide -drive file=''fake.qcow2'',if=virtio -cdrom virtio-win-0.1-81.iso<br />
<br />
Windows will detect the fake disk and try to find a driver for it. If it fails, go to the ''Device Manager'', locate the SCSI drive with an exclamation mark icon (should be open), click ''Update driver'' and select the virtual CD-ROM. Do not forget to select the checkbox which says to search for directories recursively.<br />
<br />
When the installation is successful, you can turn off the virtual machine and launch it again, now with the boot disk attached in virtio mode:<br />
<br />
$ qemu-system-x86_64 -m 512 -vga std -drive file=''windows_disk_image'',if=virtio<br />
<br />
{{Note|If you encounter the Blue Screen of Death, make sure you did not forget the {{ic|-m}} parameter, and that you do not boot with virtio instead of ide for the system drive before drivers are installed.}}<br />
<br />
==== Network drivers ====<br />
<br />
Installing virtio network drivers is a bit easier, simply add the {{ic|-net}} argument as explained above.<br />
<br />
$ qemu-system-x86_64 -m 512 -vga std -drive file=''windows_disk_image'',if=virtio -net nic,model=virtio -cdrom virtio-win-0.1-74.iso<br />
<br />
Windows will detect the network adapter and try to find a driver for it. If it fails, go to the ''Device Manager'', locate the network adapter with an exclamation mark icon (should be open), click ''Update driver'' and select the virtual CD-ROM. Do not forget to select the checkbox which says to search for directories recursively.<br />
<br />
==== Balloon driver ====<br />
<br />
If you want to track you guest memory state (for example via {{ic|virsh}} command {{ic|dommemstat}}) or change guest's memory size in runtime (you still won't be able to change memory size, but can limit memory usage via inflating balloon driver) you will need to install guest balloon driver.<br />
<br />
For this you will need to go to ''Device Manager'', locate ''PCI standard RAM Controller'' in ''System devices'' (or unrecognized PCI controller from ''Other devices'') and choose ''Update driver''. In opened window you will need to choose ''Browse my computer...'' and select the CD-ROM (and don't forget the ''Include subdirectories'' checkbox). Reboot after installation. This will install the driver and you will be able to inflate the balloon (for example via hmp command {{ic|balloon ''memory_size''}}, which will cause balloon to take as much memory as possible in order to shrink the guest's available memory size to ''memory_size''). However, you still won't be able to track guest memory state. In order to do this you will need to install ''Balloon'' service properly. For that open command line as administrator, go to the CD-ROM, ''Balloon'' directory and deeper, depending on your system and architecture. Once you are in ''amd64'' (''x86'') directory, run {{ic|blnsrv.exe -i}} which will do the installation. After that {{ic|virsh}} command {{ic|dommemstat}} should be outputting all supported values.<br />
<br />
=== Preparing a FreeBSD guest ===<br />
<br />
Install the {{ic|emulators/virtio-kmod}} port if you are using FreeBSD 8.3 or later up until 10.0-CURRENT where they are included into the kernel. After installation, add the following to your {{ic|/boot/loader.conf}} file:<br />
<br />
{{bc|<nowiki><br />
virtio_loader="YES"<br />
virtio_pci_load="YES"<br />
virtio_blk_load="YES"<br />
if_vtnet_load="YES"<br />
virtio_balloon_load="YES"<br />
</nowiki>}}<br />
<br />
Then modify your {{ic|/etc/fstab}} by doing the following:<br />
<br />
{{bc|<nowiki><br />
sed -i bak "s/ada/vtbd/g" /etc/fstab<br />
</nowiki>}}<br />
<br />
And verify that {{ic|/etc/fstab}} is consistent. If anything goes wrong, just boot into a rescue CD and copy {{ic|/etc/fstab.bak}} back to {{ic|/etc/fstab}}.<br />
<br />
== QEMU Monitor ==<br />
<br />
While QEMU is running, a monitor console is provided in order to provide several ways to interact with the virtual machine running. The QEMU Monitor offers interesting capabilities such as obtaining information about the current virtual machine, hotplugging devices, creating snapshots of the current state of the virtual machine, etc. To see the list of all commands, run {{ic|help}} or {{ic|?}} in the QEMU monitor console or review the relevant section of the [https://qemu.weilnetz.de/doc/qemu-doc.html#pcsys_005fmonitor official QEMU documentation].<br />
<br />
=== Accessing the monitor console ===<br />
<br />
When using the {{ic|std}} default graphics option, one can access the QEMU Monitor by pressing {{ic|Ctrl+Alt+2}} or by clicking ''View > compatmonitor0'' in the QEMU window. To return to the virtual machine graphical view either press {{ic|Ctrl+Alt+1}} or click ''View > VGA''.<br />
<br />
However, the standard method of accessing the monitor is not always convenient and does not work in all graphic outputs QEMU supports. Alternative options of accessing the monitor are described below:<br />
<br />
* [[telnet]]: Run QEMU with the {{ic|-monitor telnet:127.0.0.1:''port'',server,nowait}} parameter. When the virtual machine is started you will be able to access the monitor via telnet:<br />
$ telnet 127.0.0.1 ''port''<br />
{{Note|If {{ic|127.0.0.1}} is specified as the IP to listen it will be only possible to connect to the monitor from the same host QEMU is running on. If connecting from remote hosts is desired, QEMU must be told to listen {{ic|0.0.0.0}} as follows: {{ic|-monitor telnet:0.0.0.0:''port'',server,nowait}}. Keep in mind that it is recommended to have a [[firewall]] configured in this case or make sure your local network is completely trustworthy since this connection is completely unauthenticated and unencrypted.}}<br />
<br />
* UNIX socket: Run QEMU with the {{ic|-monitor unix:''socketfile'',server,nowait}} parameter. Then you can connect with either {{pkg|socat}} or {{pkg|openbsd-netcat}}.<br />
<br />
For example, if QEMU is run via:<br />
<br />
$ qemu-system-x86_64 ''[...]'' -monitor unix:/tmp/monitor.sock,server,nowait ''[...]''<br />
<br />
It is possible to connect to the monitor with:<br />
<br />
$ socat - UNIX-CONNECT:/tmp/monitor.sock<br />
<br />
Or with:<br />
<br />
$ nc -U /tmp/monitor.sock<br />
<br />
* TCP: You can expose the monitor over TCP with the argument {{ic|-monitor tcp:127.0.0.1:''port'',server,nowait}}. Then connect with netcat, either {{pkg|openbsd-netcat}} or {{pkg|gnu-netcat}} by running:<br />
<br />
$ nc 127.0.0.1 ''port''<br />
<br />
{{Note|In order to be able to connect to the tcp socket from other devices other than the same host QEMU is being run on you need to listen to {{ic|0.0.0.0}} like explained in the telnet case. The same security warnings apply in this case as well.}}<br />
<br />
* Standard I/O: It is possible to access the monitor automatically from the same terminal QEMU is being run by running it with the argument {{ic|-monitor stdio}}.<br />
<br />
=== Sending keyboard presses to the virtual machine using the monitor console ===<br />
<br />
Some combinations of keys may be difficult to perform on virtual machines due to the host intercepting them instead in some configurations (a notable example is the {{ic|Ctrl+Alt+F*}} key combinations, which change the active tty). To avoid this problem, the problematic combination of keys may be sent via the monitor console instead. Switch to the monitor and use the {{ic|sendkey}} command to forward the necessary keypresses to the virtual machine. For example:<br />
<br />
(qemu) sendkey ctrl-alt-f2<br />
<br />
=== Creating and managing snapshots via the monitor console ===<br />
<br />
{{Note|This feature will '''only''' work when the virtual machine disk image is in ''qcow2'' format. It will not work with ''raw'' images.}}<br />
<br />
It is sometimes desirable to save the current state of a virtual machine and having the possibility of reverting the state of the virtual machine to that of a previously saved snapshot at any time. The QEMU monitor console provides the user with the necessary utilities to create snapshots, manage them, and revert the machine state to a saved snapshot.<br />
<br />
* Use {{ic|savevm ''name''}} in order to create a snapshot with the tag ''name''.<br />
* Use {{ic|loadvm ''name''}} to revert the virtual machine to the state of the snapshot ''name''.<br />
* Use {{ic|delvm ''name''}} to delete the snapshot tagged as ''name''.<br />
* Use {{ic|info snapshots}} to see a list of saved snapshots. Snapshots are identified by both an auto-incremented ID number and a text tag (set by the user on snapshot creation).<br />
<br />
=== Running the virtual machine in immutable mode ===<br />
<br />
It is possible to run a virtual machine in a frozen state so that all changes will be discarded when the virtual machine is powered off just by running QEMU with the {{ic|-snapshot}} parameter. When the disk image is written by the guest, changes will be saved in a temporary file in {{ic|/tmp}} and will be discarded when QEMU halts.<br />
<br />
However, if a machine is running in frozen mode it is still possible to save the changes to the disk image if it is afterwards desired by using the monitor console and running the following command:<br />
<br />
(qemu) commit<br />
<br />
If snapshots are created when running in frozen mode they will be discarded as soon as QEMU is exited unless changes are explicitly commited to disk, as well.<br />
<br />
=== Pause and power options via the monitor console ===<br />
<br />
Some operations of a physical machine can be emulated by QEMU using some monitor commands:<br />
<br />
* {{ic|system_powerdown}} will send an ACPI shutdown request to the virtual machine. This effect is similar to the power button in a physical machine.<br />
* {{ic|system_reset}} will reset the virtual machine similarly to a reset button in a physical machine. This operation can cause data loss and file system corruption since the virtual machine is not cleanly restarted.<br />
* {{ic|stop}} will pause the virtual machine.<br />
* {{ic|cont}} will resume a virtual machine previously paused.<br />
<br />
=== Taking screenshots of the virtual machine ===<br />
<br />
Screenshots of the virtual machine graphic display can be obtained in the PPM format by running the following command in the monitor console:<br />
<br />
(qemu) screendump ''file.ppm''<br />
<br />
== Tips and tricks ==<br />
<br />
=== Starting QEMU virtual machines on boot ===<br />
<br />
==== With libvirt ====<br />
<br />
If a virtual machine is set up with [[libvirt]], it can be configured with {{ic|virsh autostart}} or through the ''virt-manager'' GUI to start at host boot by going to the Boot Options for the virtual machine and selecting "Start virtual machine on host boot up".<br />
<br />
==== Custom script ====<br />
<br />
To run QEMU VMs on boot, you can use following systemd unit and config.<br />
<br />
{{hc|/etc/systemd/system/qemu@.service|<nowiki><br />
[Unit]<br />
Description=QEMU virtual machine<br />
<br />
[Service]<br />
Environment="type=system-x86_64" "haltcmd=kill -INT $MAINPID"<br />
EnvironmentFile=/etc/conf.d/qemu.d/%i<br />
PIDFile=/tmp/%i.pid<br />
ExecStart=/usr/bin/env qemu-${type} -name %i -nographic -pidfile /tmp/%i.pid $args<br />
ExecStop=/bin/sh -c ${haltcmd}<br />
TimeoutStopSec=30<br />
KillMode=none<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
{{Note|<br />
* According to {{man|5|systemd.service}} and {{ic|5|systemd.kill}} man pages it is necessary to use the {{ic|1=KillMode=none}} option. Otherwise the main qemu process will be killed immediately after the {{ic|ExecStop}} command quits (it simply echoes one string) and your quest system will not be able to shutdown correctly.<br />
* It is necessary to use the {{ic|PIDFile}} option. Otherwise systemd cannot tell whether the main qemu process was terminated and your quest system will not be able to shutdown correctly. On host shutdown it will proceed without waiting for the VM to shutdown.<br />
}}<br />
<br />
Then create per-VM configuration files, named {{ic|/etc/conf.d/qemu.d/''vm_name''}}, with the following variables set:<br />
<br />
; type<br />
: QEMU binary to call. If specified, will be prepended with {{ic|/usr/bin/qemu-}} and that binary will be used to start the VM. I.e. you can boot e.g. {{ic|qemu-system-arm}} images with {{ic|1=type="system-arm"}}.<br />
; args<br />
: QEMU command line to start with. Will always be prepended with {{ic|-name ${vm} -nographic}}.<br />
; haltcmd<br />
: Command to shut down a VM safely. In this example, the QEMU monitor is exposed via telnet using {{ic|-monitor telnet:..}} and the VMs are powered off via ACPI by sending {{ic|system_powerdown}} to monitor with the {{ic|nc}} command. You can use SSH or some other ways as well.<br />
<br />
Example configs:<br />
<br />
{{hc|/etc/conf.d/qemu.d/one|<nowiki><br />
type="system-x86_64"<br />
<br />
args="-enable-kvm -m 512 -hda /dev/vg0/vm1 -net nic,macaddr=DE:AD:BE:EF:E0:00 \<br />
-net tap,ifname=tap0 -serial telnet:localhost:7000,server,nowait,nodelay \<br />
-monitor telnet:localhost:7100,server,nowait,nodelay -vnc :0"<br />
<br />
haltcmd="echo 'system_powerdown' | nc localhost 7100" # or netcat/ncat<br />
<br />
# You can use other ways to shut down your VM correctly<br />
#haltcmd="ssh powermanager@vm1 sudo poweroff"<br />
</nowiki>}}<br />
<br />
{{hc|/etc/conf.d/qemu.d/two|<nowiki><br />
args="-enable-kvm -m 512 -hda /srv/kvm/vm2.img -net nic,macaddr=DE:AD:BE:EF:E0:01 \<br />
-net tap,ifname=tap1 -serial telnet:localhost:7001,server,nowait,nodelay \<br />
-monitor telnet:localhost:7101,server,nowait,nodelay -vnc :1"<br />
<br />
haltcmd="echo 'system_powerdown' | nc localhost 7101"<br />
</nowiki>}}<br />
<br />
To set which virtual machines will start on boot-up, [[enable]] the {{ic|qemu@''vm_name''.service}} systemd unit.<br />
<br />
=== Mouse integration ===<br />
<br />
To prevent the mouse from being grabbed when clicking on the guest operating system's window, add the options {{ic|-usb -device usb-tablet}}. This means QEMU is able to report the mouse position without having to grab the mouse. This also overrides PS/2 mouse emulation when activated. For example:<br />
<br />
$ qemu-system-x86_64 -hda ''disk_image'' -m 512 -vga std -usb -device usb-tablet<br />
<br />
If that does not work, try the tip at [[#Mouse cursor is jittery or erratic]].<br />
<br />
=== Pass-through host USB device ===<br />
<br />
To access physical USB device connected to host from VM, you can use the option: {{ic|-usbdevice host:''vendor_id'':''product_id''}}.<br />
<br />
You can find {{ic|vendor_id}} and {{ic|product_id}} of your device with {{ic|lsusb}} command.<br />
<br />
Since the default I440FX chipset emulated by qemu feature a single UHCI controller (USB 1), the {{ic|-usbdevice}} option will try to attach your physical device to it. In some cases this may cause issues with newer devices. A possible solution is to emulate the [http://wiki.qemu.org/Features/Q35 ICH9] chipset, which offer an EHCI controller supporting up to 12 devices, using the option {{ic|1=-machine type=q35}}.<br />
<br />
A less invasive solution is to emulate an EHCI (USB 2) or XHCI (USB 3) controller with the option {{ic|1=-device usb-ehci,id=ehci}} or {{ic|1=-device nec-usb-xhci,id=xhci}} respectively and then attach your physical device to it with the option {{ic|1=-device usb-host,..}} as follows:<br />
<br />
-device usb-host,bus='''controller_id'''.0,vendorid=0x'''vendor_id''',productid=0x'''product_id'''<br />
<br />
You can also add the {{ic|1=...,port=''<n>''}} setting to the previous option to specify in which physical port of the virtual controller you want to attach your device, useful in the case you want to add multiple usb devices to the VM.<br />
<br />
{{Note|If you encounter permission errors when running QEMU, see [[Udev#Writing udev rules]] for information on how to set permissions of the device.}}<br />
<br />
=== USB redirection with SPICE ===<br />
<br />
When using [[#SPICE]] it is possible to redirect USB devices from the client to the virtual machine without needing to specify them in the QEMU command. It is possible to configure the number of USB slots available for redirected devices (the number of slots will determine the maximum number of devices which can be redirected simultaneously). The main advantages of using SPICE for redirection compared to the previously-mentioned {{ic|-usbdevice}} method is the possibility of hot-swapping USB devices after the virtual machine has started, without needing to halt it in order to remove USB devices from the redirection or adding new ones. This method of USB redirection also allows us to redirect USB devices over the network, from the client to the server. In summary, it is the most flexible method of using USB devices in a QEMU virtual machine.<br />
<br />
We need to add one EHCI/UHCI controller per available USB redirection slot desired as well as one SPICE redirection channel per slot. For example, adding the following arguments to the QEMU command you use for starting the virtual machine in SPICE mode will start the virtual machine with three available USB slots for redirection:<br />
<br />
{{bc|<nowiki>-device ich9-usb-ehci1,id=usb \<br />
-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,multifunction=on \<br />
-device ich9-usb-uhci2,masterbus=usb.0,firstport=2 \<br />
-device ich9-usb-uhci3,masterbus=usb.0,firstport=4 \<br />
-chardev spicevmc,name=usbredir,id=usbredirchardev1 \<br />
-device usb-redir,chardev=usbredirchardev1,id=usbredirdev1 \<br />
-chardev spicevmc,name=usbredir,id=usbredirchardev2 \<br />
-device usb-redir,chardev=usbredirchardev2,id=usbredirdev2 \<br />
-chardev spicevmc,name=usbredir,id=usbredirchardev3 \<br />
-device usb-redir,chardev=usbredirchardev3,id=usbredirdev3</nowiki>}}<br />
<br />
Both {{ic|spicy}} from {{Pkg|spice-gtk}} (''Input > Select USB Devices for redirection'') and {{ic|remote-viewer}} from {{pkg|virt-viewer}} (''File > USB device selection'') support this feature. Please make sure that you have installed the necessary SPICE Guest Tools on the virtual machine for this functionality to work as expected (see the [[#SPICE]] section for more information).<br />
<br />
{{Warning|Keep in mind that when a USB device is redirected from the client, it will not be usable from the client operating system itself until the redirection is stopped. It is specially important to never redirect the input devices (namely mouse and keyboard), since it will be then difficult to access the SPICE client menus to revert the situation, because the client will not respond to the input devices after being redirected to the virtual machine.}}<br />
<br />
=== Enabling KSM ===<br />
<br />
Kernel Samepage Merging (KSM) is a feature of the Linux kernel that allows for an application to register with the kernel to have its pages merged with other processes that also register to have their pages merged. The KSM mechanism allows for guest virtual machines to share pages with each other. In an environment where many of the guest operating systems are similar, this can result in significant memory savings.<br />
<br />
{{Note|Although KSM may reduce memory usage, it may increase CPU usage. Also note some security issues may occur, see [[Wikipedia:Kernel same-page merging]].}}<br />
<br />
To enable KSM:<br />
<br />
# echo 1 > /sys/kernel/mm/ksm/run<br />
<br />
To make it permanent, use [[systemd#Temporary files|systemd's temporary files]]:<br />
<br />
{{hc|/etc/tmpfiles.d/ksm.conf|<br />
w /sys/kernel/mm/ksm/run - - - - 1<br />
}}<br />
<br />
If KSM is running, and there are pages to be merged (i.e. at least two similar VMs are running), then {{ic|/sys/kernel/mm/ksm/pages_shared}} should be non-zero. See https://www.kernel.org/doc/Documentation/vm/ksm.txt for more information.<br />
<br />
{{Tip|An easy way to see how well KSM is performing is to simply print the contents of all the files in that directory: {{bc|$ grep . /sys/kernel/mm/ksm/*}}}}<br />
<br />
=== Multi-monitor support ===<br />
The Linux QXL driver supports four heads (virtual screens) by default. This can be changed via the {{ic|1=qxl.heads=N}} kernel parameter.<br />
<br />
The default VGA memory size for QXL devices is 16M (VRAM size is 64M). This is not sufficient if you would like to enable two 1920x1200 monitors since that requires 2 × 1920 × 4 (color depth) × 1200 = 17.6 MiB VGA memory. This can be changed by replacing {{ic|-vga qxl}} by {{ic|<nowiki>-vga none -device qxl-vga,vgamem_mb=32</nowiki>}}. If you ever increase vgamem_mb beyond 64M, then you also have to increase the {{ic|vram_size_mb}} option.<br />
<br />
=== Copy and paste ===<br />
<br />
To have copy and paste between the host and the guest you need to enable the spice agent communication channel. It requires to add a virtio-serial device to the guest, and open a port for the spice vdagent. It is also required to install the spice vdagent in guest ({{Pkg|spice-vdagent}} for Arch guests, [http://www.spice-space.org/download.html Windows guest tools] for Windows guests). Make sure the agent is running (and for future, started automatically). See [[#SPICE]] for the necessary procedure to use QEMU with the SPICE protocol.<br />
<br />
=== Windows-specific notes ===<br />
<br />
QEMU can run any version of Windows from Windows 95 through Windows 10.<br />
<br />
It is possible to run [[Windows PE]] in QEMU.<br />
<br />
==== Fast startup ====<br />
{{Note|An administrator account is required to change power settings.}}<br />
For Windows 8 (or later) guests it is better to disable "Turn on fast startup (recommended)" from the Power Options of the Control Panel as explained in the following [https://www.tenforums.com/tutorials/4189-turn-off-fast-startup-windows-10-a.html forum page], as it causes the guest to hang during every other boot.<br />
<br />
Fast Startup may also need to be disabled for changes to the {{ic|-smp}} option to be properly applied.<br />
<br />
==== Remote Desktop Protocol ====<br />
<br />
If you use a MS Windows guest, you might want to use RDP to connect to your guest VM. If you are using a VLAN or are not in the same network as the guest, use:<br />
<br />
$ qemu-system-x86_64 -nographic -net user,hostfwd=tcp::5555-:3389<br />
<br />
Then connect with either {{Pkg|rdesktop}} or {{Pkg|freerdp}} to the guest. For example:<br />
<br />
$ xfreerdp -g 2048x1152 localhost:5555 -z -x lan<br />
<br />
== Troubleshooting ==<br />
<br />
=== Virtual machine runs too slowly ===<br />
<br />
There are a number of techniques that you can use to improve the performance of your virtual machine. For example:<br />
<br />
* Use the {{ic|-cpu host}} option to make QEMU emulate the host's exact CPU. If you do not do this, it may be trying to emulate a more generic CPU.<br />
* Especially for Windows guests, enable [http://blog.wikichoon.com/2014/07/enabling-hyper-v-enlightenments-with-kvm.html Hyper-V enlightenments]: {{ic|1=-cpu host,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time}}.<br />
* If the host machine has multiple CPUs, assign the guest more CPUs using the {{ic|-smp}} option.<br />
* Make sure you have assigned the virtual machine enough memory. By default, QEMU only assigns 128 MiB of memory to each virtual machine. Use the {{ic|-m}} option to assign more memory. For example, {{ic|-m 1024}} runs a virtual machine with 1024 MiB of memory.<br />
* Use KVM if possible: add {{ic|1=-machine type=pc,accel=kvm}} to the QEMU start command you use.<br />
* If supported by drivers in the guest operating system, use [http://wiki.libvirt.org/page/Virtio virtio] for network and/or block devices. For example:<br />
$ qemu-system-x86_64 -net nic,model=virtio -net tap,if=tap0,script=no -drive file=''disk_image'',media=disk,if=virtio<br />
* Use TAP devices instead of user-mode networking. See [[#Tap networking with QEMU]].<br />
* If the guest OS is doing heavy writing to its disk, you may benefit from certain mount options on the host's file system. For example, you can mount an [[Ext4|ext4 file system]] with the option {{ic|1=barrier=0}}. You should read the documentation for any options that you change because sometimes performance-enhancing options for file systems come at the cost of data integrity.<br />
* If you have a raw disk image, you may want to disable the cache:<br />
$ qemu-system-x86_64 -drive file=''disk_image'',if=virtio,'''cache=none'''<br />
* Use the native Linux AIO:<br />
$ qemu-system-x86_64 -drive file=''disk_image'',if=virtio''',aio=native,cache.direct=on'''<br />
* If you use a qcow2 disk image, I/O performance can be improved considerably by ensuring that the L2 cache is of sufficient size. The [https://blogs.igalia.com/berto/2015/12/17/improving-disk-io-performance-in-qemu-2-5-with-the-qcow2-l2-cache/ formula] to calculate L2 cache is: l2_cache_size = disk_size * 8 / cluster_size. Assuming the qcow2 image was created with the default cluster size of 64K, this means that for every 8 GB in size of the qcow2 image, 1 MB of L2 cache is best for performance. Only 1 MB is used by QEMU by default; specifying a larger cache is done on the QEMU command line. For instance, to specify 4 MB of cache (suitable for a 32 GB disk with a cluster size of 64K):<br />
$ qemu-system-x86_64 -drive file=''disk_image'',format=qcow2,l2-cache-size=4M<br />
* If you are running multiple virtual machines concurrently that all have the same operating system installed, you can save memory by enabling [[wikipedia:Kernel_SamePage_Merging_(KSM)|kernel same-page merging]]. See [[#Enabling KSM]].<br />
* In some cases, memory can be reclaimed from running virtual machines by running a memory ballooning driver in the guest operating system and launching QEMU using {{ic|--device virtio-balloon}}.<br />
* It is possible to use a emulation layer for an ICH-9 AHCI controller (although it may be unstable). The AHCI emulation supports [[Wikipedia:Native_Command_Queuing|NCQ]], so multiple read or write requests can be outstanding at the same time:<br />
$ qemu-system-x86_64 -drive id=disk,file=''disk_image'',if=none -device ich9-ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0<br />
<br />
See http://www.linux-kvm.org/page/Tuning_KVM for more information.<br />
<br />
=== Mouse cursor is jittery or erratic ===<br />
<br />
If the cursor jumps around the screen uncontrollably, entering this on the terminal before starting QEMU might help:<br />
<br />
$ export SDL_VIDEO_X11_DGAMOUSE=0<br />
<br />
If this helps, you can add this to your {{ic|~/.bashrc}} file.<br />
<br />
=== No visible Cursor ===<br />
<br />
Add {{ic|-show-cursor}} to QEMU's options to see a mouse cursor.<br />
<br />
If that still does not work, make sure you have set your display device appropriately.<br />
<br />
For example: {{ic|-vga qxl}}<br />
<br />
=== Unable to move/attach Cursor ===<br />
<br />
Replace {{ic|-usbdevice tablet}} with {{ic|-usb}} as QEMU option.<br />
<br />
=== Keyboard seems broken or the arrow keys do not work ===<br />
<br />
Should you find that some of your keys do not work or "press" the wrong key (in particular, the arrow keys), you likely need to specify your keyboard layout as an option. The keyboard layouts can be found in {{ic|/usr/share/qemu/keymaps}}.<br />
<br />
$ qemu-system-x86_64 -k ''keymap'' ''disk_image''<br />
<br />
=== Guest display stretches on window resize ===<br />
<br />
To restore default window size, press {{ic|Ctrl+Alt+u}}.<br />
<br />
=== ioctl(KVM_CREATE_VM) failed: 16 Device or resource busy ===<br />
<br />
If an error message like this is printed when starting QEMU with {{ic|-enable-kvm}} option:<br />
<br />
ioctl(KVM_CREATE_VM) failed: 16 Device or resource busy<br />
failed to initialize KVM: Device or resource busy<br />
<br />
that means another [[hypervisor]] is currently running. It is not recommended or possible to run several hypervisors in parallel.<br />
<br />
=== libgfapi error message ===<br />
<br />
The error message displayed at startup:<br />
<br />
Failed to open module: libgfapi.so.0: cannot open shared object file: No such file or directory<br />
<br />
[[Install]] {{pkg|glusterfs}} or ignore the error message as GlusterFS is a optional dependency.<br />
<br />
=== Kernel panic on LIVE-environments===<br />
<br />
If you start a live-environment (or better: booting a system) you may encounter this:<br />
<br />
[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown block(0,0)<br />
<br />
or some other boot hindering process (e.g. cannot unpack initramfs, cant start service foo).<br />
Try starting the VM with the {{ic|-m VALUE}} switch and an appropriate amount of RAM, if the ram is to low you will probably encounter similar issues as above/without the memory-switch.<br />
<br />
=== Windows 7 guest suffers low-quality sound ===<br />
<br />
Using the {{ic|hda}} audio driver for Windows 7 guest may result in low-quality sound. Changing the audio driver to {{ic|ac97}} by passing the {{ic|-soundhw ac97}} arguments to QEMU and installing the AC97 driver from [http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=14&PFid=23&Level=4&Conn=3&DownTypeID=3&GetDown=false Realtek AC'97 Audio Codecs] in the guest may solve the problem. See [https://bugzilla.redhat.com/show_bug.cgi?id=1176761#c16 Red Hat Bugzilla – Bug 1176761] for more information.<br />
<br />
=== Could not access KVM kernel module: Permission denied ===<br />
<br />
If you encounter the following error:<br />
<br />
libvirtError: internal error: process exited while connecting to monitor: Could not access KVM kernel module: Permission denied failed to initialize KVM: Permission denied<br />
<br />
Systemd 234 assign it a dynamic id to group kvm (see [https://bugs.archlinux.org/task/54943 bug]). A workground for avoid this error, you need edit the file {{ic|/etc/libvirt/qemu.conf}} and change the line:<br />
<br />
group = "78"<br />
<br />
to<br />
<br />
group = "kvm"<br />
<br />
=== "System Thread Exception Not Handled" when booting a Windows VM ===<br />
<br />
Windows 8 or Windows 10 guests may raise a generic compatibility exception at boot, namely "System Thread Exception Not Handled", which tends to be caused by legacy drivers acting strangely on real machines. On KVM machines this issue can generally be solved by setting the CPU model to {{ic|core2duo}}.<br />
<br />
=== Certain Windows games/applications crashing/causing a bluescreen ===<br />
<br />
Occasionally, applications running in the VM may crash unexpectedly, whereas they'd run normally on a physical machine. If, while running {{ic|dmesg -wH}}, you encounter an error mentioning {{ic|MSR}}, the reason for those crashes is that KVM injects a [[wikipedia:General protection fault|General protection fault]] (GPF) when the guest tries to access unsupported [[wikipedia:Model-specific register|Model-specific registers]] (MSRs) - this often results in guest applications/OS crashing. A number of those issues can be solved by passing the {{ic|1=ignore_msrs=1}} option to the KVM module, which will ignore unimplemented MSRs.<br />
<br />
{{hc|/etc/modprobe.d/kvm.conf|2=<br />
...<br />
options kvm ignore_msrs=1<br />
...<br />
}}<br />
<br />
Cases where adding this option might help:<br />
<br />
* GeForce Experience complaining about an unsupported CPU being present.<br />
* StarCraft 2 and L.A. Noire reliably blue-screening Windows 10 with {{ic|KMODE_EXCEPTION_NOT_HANDLED}}. The blue screen information does not identify a driver file in these cases.<br />
<br />
{{Warning|While this is normally safe and some applications might not work without this, silently ignoring unknown MSR accesses could potentially break other software within the VM or other VMs.}}<br />
<br />
== See also ==<br />
<br />
* [http://qemu.org Official QEMU website]<br />
* [http://www.linux-kvm.org Official KVM website]<br />
* [http://qemu.weilnetz.de/qemu-doc.html QEMU Emulator User Documentation]<br />
* [https://en.wikibooks.org/wiki/QEMU QEMU Wikibook]<br />
* [http://alien.slackbook.org/dokuwiki/doku.php?id=slackware:qemu Hardware virtualization with QEMU] by AlienBOB (last updated in 2008)<br />
* [http://blog.falconindy.com/articles/build-a-virtual-army.html Building a Virtual Army] by Falconindy<br />
* [http://git.qemu.org/?p=qemu.git;a=tree;f=docs Lastest docs]<br />
* [http://qemu.weilnetz.de/ QEMU on Windows]<br />
* [[wikipedia:Qemu|Wikipedia]]<br />
* [[debian:QEMU|Debian Wiki - QEMU]]<br />
* [https://people.gnome.org/~markmc/qemu-networking.html QEMU Networking on gnome.org]<br />
* [http://bsdwiki.reedmedia.net/wiki/networking_qemu_virtual_bsd_systems.html Networking QEMU Virtual BSD Systems]<br />
* [https://www.gnu.org/software/hurd/hurd/running/qemu.html QEMU on gnu.org]<br />
* [https://wiki.freebsd.org/qemu QEMU on FreeBSD as host]<br />
* [https://wiki.mikejung.biz/KVM_/_Xen KVM/QEMU Virtio Tuning and SSD VM Optimization Guide]<br />
* [https://doc.opensuse.org/documentation/leap/virtualization/html/book.virt/part.virt.qemu.html Managing Virtual Machines with QEMU - OpenSUSE documentation]<br />
* [https://www.ibm.com/support/knowledgecenter/en/linuxonibm/liaat/liaatkvm.htm KVM on IBM Knowledge Center]</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Talk:Notion&diff=520583Talk:Notion2018-05-07T13:16:04Z<p>Sleeping: /* Lua secion */ Lua</p>
<hr />
<div><br />
== Lua secion ==<br />
<br />
I removed the Lua section. You can find it here: https://wiki.archlinux.org/index.php?title=Notion&oldid=483531. It's unclear where anything has to be replaced and what the relevance to Notion is. --[[User:Sleeping|Sleeping]] ([[User talk:Sleeping|talk]]) 12:27, 7 May 2018 (UTC)<br />
<br />
* The relevance is that Notion is configured using Lua code, and if you have any custom Lua in your configuration and are moving from lua5.x to lua5.2 you'll have to make the mentioned substitutions. --[[User:Raboof|Raboof]] ([[User talk:Raboof|talk]]) 12:52, 7 May 2018 (UTC)<br />
<br />
* Prior to my latest edit, that was not even mentioned in the article, so it seemed out of place, but I will add it back. --[[User:Sleeping|Sleeping]] ([[User talk:Sleeping|talk]]) 13:13, 7 May 2018 (UTC)<br />
<br />
* On second thought, I won't add it back. Lua 5.2 was released in 2011. Also, it seems like that the migration recommendations apply to any and all Lua code, so not sure if it makes sense to include it on all pages describing programs that make use of Lua... --[[User:Sleeping|Sleeping]] ([[User talk:Sleeping|talk]]) 13:16, 7 May 2018 (UTC)</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Talk:Notion&diff=520582Talk:Notion2018-05-07T13:13:15Z<p>Sleeping: Lua</p>
<hr />
<div><br />
== Lua secion ==<br />
<br />
I removed the Lua section. You can find it here: https://wiki.archlinux.org/index.php?title=Notion&oldid=483531. It's unclear where anything has to be replaced and what the relevance to Notion is. --[[User:Sleeping|Sleeping]] ([[User talk:Sleeping|talk]]) 12:27, 7 May 2018 (UTC)<br />
<br />
* The relevance is that Notion is configured using Lua code, and if you have any custom Lua in your configuration and are moving from lua5.x to lua5.2 you'll have to make the mentioned substitutions. --[[User:Raboof|Raboof]] ([[User talk:Raboof|talk]]) 12:52, 7 May 2018 (UTC)<br />
<br />
* Prior to my latest edit, that was not even mentioned in the article, so it seemed out of place, but I will add it back. --[[User:Sleeping|Sleeping]] ([[User talk:Sleeping|talk]]) 13:13, 7 May 2018 (UTC)</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Notion&diff=520581Notion2018-05-07T13:06:32Z<p>Sleeping: /* Usage */ Added link to tour</p>
<hr />
<div>[[Category:Tiling WMs]]<br />
[[ja:Notion]]<br />
[http://notion.sourceforge.net/ Notion] is a tiling, tabbed [[window manager]] for X.<br />
<br />
==Installation==<br />
<br />
[[Install]] {{Pkg|notion}}.<br />
<br />
==Starting==<br />
<br />
Run {{ic|notion}} with [[xinit]].<br />
<br />
===With a display manager===<br />
<br />
To start/select Notion with a [[display manager]], a standard .desktop file can be created in the {{ic|/usr/share/xsessions/}} directory. An example {{ic|notion.desktop}} file can be found below:<br />
<br />
[Desktop Entry]<br />
Name=Notion<br />
Comment=This session logs you into Notion<br />
Exec=/usr/bin/notion<br />
TryExec=/usr/bin/notion<br />
Icon=<br />
Type=XSession<br />
<br />
See the [[display manager]] article for more details.<br />
<br />
==Usage==<br />
<br />
You can view Notion's man page during use with the F1 key and pressing the return key, this will tell you the default key bindings for Notion. You can also access the man page for other programs this way by pressing F1, typing in the program's name and pressing return. Besides the manual there is also a [http://raboof.github.io/notion/tour/ getting started tour] available for a quick overview of Notion.<br />
<br />
==Configuration==<br />
Notion can be configured using Lua. To get started, copy {{ic|/etc/notion/cfg_notion.lua}} to {{ic|~/.notion}}. For more information, read [http://notion.sourceforge.net/notionconf/ Configuring and Extending Notion using Lua].<br />
<br />
==See also==<br />
*http://notion.sourceforge.net/ - Notion website<br />
*http://notion.sourceforge.net/notionconf/ - Configuring and Extending Notion using Lua<br />
*https://sourceforge.net/projects/notion/ - Notion Wiki</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Notion&diff=520580Notion2018-05-07T13:04:34Z<p>Sleeping: Begin Configuration section, added markup to filenames ant paths</p>
<hr />
<div>[[Category:Tiling WMs]]<br />
[[ja:Notion]]<br />
[http://notion.sourceforge.net/ Notion] is a tiling, tabbed [[window manager]] for X.<br />
<br />
==Installation==<br />
<br />
[[Install]] {{Pkg|notion}}.<br />
<br />
==Starting==<br />
<br />
Run {{ic|notion}} with [[xinit]].<br />
<br />
===With a display manager===<br />
<br />
To start/select Notion with a [[display manager]], a standard .desktop file can be created in the {{ic|/usr/share/xsessions/}} directory. An example {{ic|notion.desktop}} file can be found below:<br />
<br />
[Desktop Entry]<br />
Name=Notion<br />
Comment=This session logs you into Notion<br />
Exec=/usr/bin/notion<br />
TryExec=/usr/bin/notion<br />
Icon=<br />
Type=XSession<br />
<br />
See the [[display manager]] article for more details.<br />
<br />
==Usage==<br />
<br />
You can view Notion's man page during use with the F1 key and pressing the return key, this will tell you the default key bindings for Notion. You can also access the man page for other programs this way by pressing F1, typing in the program's name and pressing return.<br />
<br />
==Configuration==<br />
Notion can be configured using Lua. To get started, copy {{ic|/etc/notion/cfg_notion.lua}} to {{ic|~/.notion}}. For more information, read [http://notion.sourceforge.net/notionconf/ Configuring and Extending Notion using Lua].<br />
<br />
==See also==<br />
*http://notion.sourceforge.net/ - Notion website<br />
*http://notion.sourceforge.net/notionconf/ - Configuring and Extending Notion using Lua<br />
*https://sourceforge.net/projects/notion/ - Notion Wiki</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Notion&diff=520576Notion2018-05-07T12:34:43Z<p>Sleeping: /* Starting Notion */ Renamed to Starting for consistency. Removed redundant .xinitrc</p>
<hr />
<div>[[Category:Tiling WMs]]<br />
[[ja:Notion]]<br />
[http://notion.sourceforge.net/ Notion] is a tiling, tabbed [[window manager]] for X.<br />
<br />
==Installation==<br />
<br />
[[Install]] {{Pkg|notion}}.<br />
<br />
==Starting==<br />
<br />
Run {{ic|notion}} with [[xinit]].<br />
<br />
===With a display manager===<br />
<br />
To start/select Notion with a [[display manager]], a standard .desktop file can be created in the /usr/share/xsessions/ directory. An example notion.desktop file can be found below:<br />
<br />
[Desktop Entry]<br />
Name=Notion<br />
Comment=This session logs you into Notion<br />
Exec=/usr/bin/notion<br />
TryExec=/usr/bin/notion<br />
Icon=<br />
Type=XSession<br />
<br />
See the [[display manager]] article for more details.<br />
<br />
==Usage==<br />
<br />
You can view Notion's man page during use with the F1 key and pressing the return key, this will tell you the default key bindings for Notion. You can also access the man page for other programs this way by pressing F1, typing in the program's name and pressing return.<br />
<br />
==See also==<br />
*http://notion.sourceforge.net/ - Notion website<br />
*http://notion.sourceforge.net/notionconf/ - Configuring and Extending Notion using LUA<br />
*https://sourceforge.net/projects/notion/ - Notion Wiki</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Notion&diff=520575Notion2018-05-07T12:30:18Z<p>Sleeping: Using Notion -> Usage to be consistent with other articles</p>
<hr />
<div>[[Category:Tiling WMs]]<br />
[[ja:Notion]]<br />
[http://notion.sourceforge.net/ Notion] is a tiling, tabbed [[window manager]] for X.<br />
<br />
==Installation==<br />
<br />
[[Install]] {{Pkg|notion}}.<br />
<br />
==Starting Notion==<br />
<br />
===With a login manager===<br />
<br />
To start/select Notion from most login managers, a standard .desktop file can be created in the /usr/share/xsessions/ directory. An example notion.desktop file can be found below:<br />
<br />
[Desktop Entry]<br />
Name=Notion<br />
Comment=This session logs you into Notion<br />
Exec=/usr/bin/notion<br />
TryExec=/usr/bin/notion<br />
Icon=<br />
Type=XSession<br />
<br />
See the [[display manager]] article for more details.<br />
<br />
===With xinitrc===<br />
<br />
You can start Notion from the command line by adding {{Ic|exec notion}} to [[~/.xinitrc]] or any other startup script you may want to use. An example .xinitrc file can be found below.<br />
<br />
DEFAULT_SESSION=notion<br />
case $1 in<br />
awesome) <br />
exec awesome<br />
;;<br />
notion) <br />
exec notion<br />
;;<br />
openbox) <br />
exec openbox-session<br />
;;<br />
*) <br />
exec $DEFAULT_SESSION<br />
;;<br />
esac<br />
<br />
==Usage==<br />
<br />
You can view Notion's man page during use with the F1 key and pressing the return key, this will tell you the default key bindings for Notion. You can also access the man page for other programs this way by pressing F1, typing in the program's name and pressing return.<br />
<br />
==See also==<br />
*http://notion.sourceforge.net/ - Notion website<br />
*http://notion.sourceforge.net/notionconf/ - Configuring and Extending Notion using LUA<br />
*https://sourceforge.net/projects/notion/ - Notion Wiki</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Talk:Notion&diff=520574Talk:Notion2018-05-07T12:29:48Z<p>Sleeping: Update comment about Lua</p>
<hr />
<div><br />
== Lua secion ==<br />
<br />
I removed the Lua section. You can find it here: https://wiki.archlinux.org/index.php?title=Notion&oldid=483531. It's unclear where anything has to be replaced and what the relevance to Notion is. --[[User:Sleeping|Sleeping]] ([[User talk:Sleeping|talk]]) 12:27, 7 May 2018 (UTC)</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Talk:Notion&diff=520573Talk:Notion2018-05-07T12:27:31Z<p>Sleeping: Created page with " == Lua secion == I removed the Lua section You can find it below: == Lua 5.2 == === gfind === You should replace 'gfind' to 'gmatch' because of 'gfind' was removed === goto..."</p>
<hr />
<div><br />
== Lua secion ==<br />
<br />
I removed the Lua section You can find it below:<br />
<br />
== Lua 5.2 ==<br />
=== gfind ===<br />
You should replace 'gfind' to 'gmatch' because of 'gfind' was removed<br />
=== goto ===<br />
'goto' is a keyword now. You can use following workaround:<br />
<br />
replace<br />
win:goto()<br />
with<br />
function win_goto(w) return w['goto'](w) end<br />
...<br />
win_goto(win)<br />
<br />
It's unclear where anything has to be replaced and what the relevance to Notion is. --[[User:Sleeping|Sleeping]] ([[User talk:Sleeping|talk]]) 12:27, 7 May 2018 (UTC)</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Notion&diff=520572Notion2018-05-07T12:26:30Z<p>Sleeping: Removed Lua section -- relevance unclear</p>
<hr />
<div>[[Category:Tiling WMs]]<br />
[[ja:Notion]]<br />
[http://notion.sourceforge.net/ Notion] is a tiling, tabbed [[window manager]] for X.<br />
<br />
==Installation==<br />
<br />
[[Install]] {{Pkg|notion}}.<br />
<br />
==Starting Notion==<br />
<br />
===With a login manager===<br />
<br />
To start/select Notion from most login managers, a standard .desktop file can be created in the /usr/share/xsessions/ directory. An example notion.desktop file can be found below:<br />
<br />
[Desktop Entry]<br />
Name=Notion<br />
Comment=This session logs you into Notion<br />
Exec=/usr/bin/notion<br />
TryExec=/usr/bin/notion<br />
Icon=<br />
Type=XSession<br />
<br />
See the [[display manager]] article for more details.<br />
<br />
===With xinitrc===<br />
<br />
You can start Notion from the command line by adding {{Ic|exec notion}} to [[~/.xinitrc]] or any other startup script you may want to use. An example .xinitrc file can be found below.<br />
<br />
DEFAULT_SESSION=notion<br />
case $1 in<br />
awesome) <br />
exec awesome<br />
;;<br />
notion) <br />
exec notion<br />
;;<br />
openbox) <br />
exec openbox-session<br />
;;<br />
*) <br />
exec $DEFAULT_SESSION<br />
;;<br />
esac<br />
<br />
==Using Notion==<br />
<br />
You can view Notion's man page during use with the F1 key and pressing the return key, this will tell you the default key bindings for Notion. You can also access the man page for other programs this way by pressing F1, typing in the program's name and pressing return.<br />
<br />
==See also==<br />
*http://notion.sourceforge.net/ - Notion website<br />
*http://notion.sourceforge.net/notionconf/ - Configuring and Extending Notion using LUA<br />
*https://sourceforge.net/projects/notion/ - Notion Wiki</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Urban_Terror&diff=508265Urban Terror2018-01-22T22:01:32Z<p>Sleeping: /* Client */ Added outdaded tag</p>
<hr />
<div>[[Category:Gaming]]<br />
[[ja:Urban Terror]]<br />
{{expansion}}<br />
"''[http://www.urbanterror.info/ Urban Terror]™ is a free multiplayer first person shooter, it can be described as a Hollywood tactical shooter; somewhat realism based, but the motto is "fun over realism". This results in a very unique, enjoyable and addictive game.''" <small>[http://www.urbanterror.net]</small><br />
<br />
==Installation==<br />
<br />
===Client===<br />
<br />
{{Out of date|No longer an official package.}}<br />
<br />
<br />
Urban Terror is now supported in the [[official repositories]]. Two packages should be [[pacman|installed]]: {{AUR|urbanterror}} and {{AUR|urbanterror-data}}{{Broken package link|package not found}}.<br />
<br />
====Running Urban Terror in a second X server====<br />
You might want to run this game in an extra X server. To do that, create a new Bash script with that content and mark it as executable: <br />
{{hc|~/xstart/urbanterror.sh|#!/bin/bash <br />
<nowiki>DISPLAY=:1.0</nowiki><br />
xinit /usr/bin/urbanterror $* -- :1}}<br />
<br />
Now you can use {{ic|Ctrl+Alt+F7}} to get to your first X server with your normal desktop, and {{ic|Ctrl+Alt+F8}} to go back to your game.<br />
<br />
Because the second X server is only running the game and the first X server with all your programs is backgrounded, performance should increase. In addition, it is much more convenient to switch X servers while in game to access other resources, rather than having to exit the game completely or {{ic|Alt+Tab}} out. Finally, it is useful if Urban Terror crashes. Simply {{ic|Ctrl+Alt+Backspace}} on the second X server to kill that X and all processes on that desktop will terminate as well.<br />
<br />
====Running Urban Terror in a single X server====<br />
If you log out from any X sessions if already started up and execute the file from e.g. tty1 ({{ic|Ctrl+Alt+F1}}) urbanterror is run on the first X Server ({{ic|Ctrl+Alt+F7}}). All terminal output is printed to tty1. This works for mostly every game not depending on a window manager.<br />
<br />
==Mapping==<br />
<br />
How to create your own maps.<br />
<br />
===Prepare the game files===<br />
There are '''two ways,''' use the second one if you are low on disk space.<br />
<br />
====Extract your pk3s (recommended, ~1GB free disk space required)====<br />
To get something to work with, you need to extract Urban Terror's pk3 files to a new folder:<br />
install -d ~/urtmapping/q3ut4<br />
cd ~/urtmapping/q3ut4<br />
<br />
bsdtar -x -f /opt/urbanterror/q3ut4/zpak000_assets.pk3 --exclude maps<br />
bsdtar -x -f /opt/urbanterror/q3ut4/zpak000.pk3<br />
<br />
====Or: Give GTKRadiant write access to the game folder (for single user machines)====<br />
GTKradiant creates a few own files inside game directory on creating a game profile. This means that you can own to the Urban Terror folder temporarily until these are created:<br />
chown ''yourusername'' -R /opt/urbanterror<br />
<br />
Then start GTKRadiant and configure the game profile (see [[#ZeroRadiant .28gtkradiant-svn.29|below]], just use {{ic|/opt/urbanterror}} as path). Close it afterwards and restrict access again with:<br />
<br />
chown root -R /opt/urbanterror<br />
<br />
Please note, that your user will own the newly created files until they get deleted (which is just what we want in this case).<br />
<br />
===Install a level editor===<br />
It might be possible to create Urban Terror maps with other level editors, such as [http://dev.alientrap.org/wiki/7 netradiant] for example. If you know how to do just that, please add it to the wiki.<br />
<br />
====ZeroRadiant (gtkradiant-svn)====<br />
Build and install both [https://aur.archlinux.org/packages.php?ID=31795 gtkradiant-svn] and {{AUR|gtkradiant-gamepack-urt-svn}}{{Broken package link|{{aur-mirror|gtkradiant-gamepack-urt-svn}}}} from the AUR.<br />
<br />
Start gtkradiant by either typing its name in a terminal or clicking the new menu entry. You will see a dialog, choose ''Urban Terror (standalone)'' in the drop-down list and {{ic|/home/you/urtmapping}} as engine directory (''not'' q3ut4). Click OK in the next window and the editor should pop up.<br />
<br />
[http://daffy.nerius.com/radiant/#first-map Here] is a nice guide that explains how to create your first map as well as some Urban Terror specific things you need to watch out for.<br />
<br />
===Test your map===<br />
Copy your compiled .bsp mapfile to {{ic|~/.urbanterror/q3ut4/maps}} and run:<br />
urbanterror +set fs_game iourtmap +set sv_pure 0 +map ''ut4_yourmap''<br />
<br />
==Troubleshooting==<br />
<br />
===Fix urbanterror_ui.shader===<br />
Open up {{ic|~/urtmapping/q3ut4/scripts/urbanterror_ui.shader}} in your favorite editor and delete lines 29-55 (from /* to */), because gtkradiant will not recognize this part as a comment and would try to parse it.<br />
<br />
===Problems with libcurl===<br />
UrbanTerror may complain that it cannot autodownload missing files because the cURL library could not be loaded, even though the cURL package is installed. UrbanTerror expects the shared library file to be called libcurl.so.3, but Arch Linux currently uses libcurl.so.4.<br />
<br />
To remedy this, start UrbanTerror with an additional parameter from a terminal emulator:<br />
<pre><br />
urbanterror +cl_curllib libcurl.so.4<br />
</pre><br />
<br />
=== no sound ??===<br />
maybe you are using alsa<br />
export SDL_AUDIODRIVER=alsa <br />
or maybe you are using the wrong device<br />
emacs .asoundrc <br />
maybe this will help..<br />
cat /proc/asound/card*/id<br />
<br />
==External links==<br />
<br />
* [http://www.urbanterror.info Urban Terror homepage]<br />
* [http://forums.urbanterror.info/topic/141-level-design-links/ UT-Forums: Level Design Linklist]<br />
* [http://daffy.nerius.com/radiant/ Debian + GTKRadiant + Urban Terror HOW-TO]<br />
* [http://forums.urbanterror.info/topic/13539-complete-linux-gtkradiant-urt-mapping-how-to/page__hl__urtpack__fromsearch__1__s__0bed93b96b8f19a3707143f46acfb964 UT-Forums: Urban Terror GTKRadiant Tutorial] ''Please note'' that the example from this guide has no light and Urban Terror will just display black walls.</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Talk:Wake-on-LAN&diff=504938Talk:Wake-on-LAN2017-12-29T12:43:41Z<p>Sleeping: /* Predictable Network Interface Names */ add comment</p>
<hr />
<div>== Predictable Network Interface Names ==<br />
<br />
The article should explain how to obtain the network interface name, or link to such an explanation. The default ethernet port is no longer called ''eth0'' by default since [[Network_configuration#Device names|Predictable Network Interface Names]]. --[[User:Sleeping|Sleeping]] ([[User talk:Sleeping|talk]]) 00:37, 29 December 2017 (UTC)<br />
:Good point, you can propose something, the interface name should also be written as a pseudo variable (in italic) to highlight it depends on each config, I am already replacing 'net0' by 'interface' and let you carry on if you wish [[User:Kewl|Kewl]] ([[User talk:Kewl|talk]]) 07:33, 29 December 2017 (UTC)<br />
::I changed it to ''devname'', that's the identifier ''ethtool'' uses in its man page. I am a bit unsure if the distinction matters. Also linking to [[Network_configuration#Get_current_device_names]] now. --[[User:Sleeping|Sleeping]] ([[User talk:Sleeping|talk]]) 12:43, 29 December 2017 (UTC)</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Wake-on-LAN&diff=504937Wake-on-LAN2017-12-29T12:41:07Z<p>Sleeping: /* netctl */ placeholder interface->devname (these are different things)</p>
<hr />
<div>[[Category:Networking]]<br />
[[ja:Wake-on-LAN]]<br />
[[Wikipedia:Wake-on-LAN|Wake-on-LAN]] (WoL) is a feature to switch on a computer via the network.<br />
<br />
== Hardware settings ==<br />
<br />
The target computer's motherboard and [[wikipedia:Network interface controller|Network Interface Controller]] have to support Wake-on-LAN. The target computer has to be physically connected (with a cable) to a router or to the source computer, wireless cards do not support WoL.<br />
<br />
The Wake-on-LAN feature also has to be enabled in the computer's BIOS. Different motherboard manufacturers use slightly different language for this feature. Look for terminology such as "PCI Power up", "Allow PCI wake up event" or "Boot from PCI/PCI-E".<br />
<br />
It is known that some motherboards are affected by a bug that can cause immediate or random wake-up after a ''shutdown'' whenever the BIOS WoL feature is enabled (as discussed in [https://bbs.archlinux.org/viewtopic.php?id=173648 this thread] for example). The following actions in the BIOS preferences can solve this issue with some motherboards:<br />
# Disable all references to ''xHCI'' in the USB settings (note this will also disable USB 3.0 at boot time)<br />
# Disable ''EuP 2013'' if it is explicitly an option<br />
# Optionally enable wake-up on keyboard actions<br />
{{Note|There are mixed opinions as to the value of #3 above and it may be motherboard dependent.}}<br />
<br />
== Software configuration ==<br />
<br />
=== Enable WoL on the network adapter ===<br />
<br />
Depending on the hardware, the network driver may have WoL switched off by default.<br />
<br />
To query this status or to change the settings, install {{Pkg|ethtool}}, [[Network_configuration#Get_current_device_names|determine the network device's name]], and query it using the command:<br />
{{hc|# ethtool ''devname'' {{!}} grep Wake-on|<br />
Supports Wake-on: pumbag<br />
Wake-on: d}}<br />
The ''Wake-on'' values define what activity triggers wake up: {{ic|d}} (disabled), {{ic|p}} (PHY activity), {{ic|u}} (unicast activity), {{ic|m}} (multicast activity), {{ic|b}} (broadcast activity), {{ic|a}} (ARP activity), and {{ic|g}} (magic packet activity). The value {{ic|g}} is required for WoL to work, if not, the following command enables the WoL feature in the driver:<br />
<br />
# ethtool -s ''devname'' wol g<br />
<br />
This command might not last beyond the next reboot and in this case must be repeated via some mechanism. Common solutions are listed in the following subsections.<br />
<br />
=== Make it persistent ===<br />
<br />
==== netctl ====<br />
<br />
If using netctl, one can make this setting persistent by adding the following the netctl profile:<br />
<br />
{{hc|/etc/netctl/''profile''|2=<br />
ExecUpPost='/usr/bin/ethtool -s ''devname'' wol g'<br />
}}<br />
<br />
==== systemd.link ====<br />
<br />
Link-level configuration is possible through systemd. The actual setup is performed by the {{ic|net_setup_link}} udev builtin. Add the {{ic|WakeOnLan}} option to the network link file:<br />
<br />
{{hc|/etc/systemd/network/50-wired.link|2=<br />
[Link]<br />
WakeOnLan=magic<br />
...<br />
}}<br />
<br />
{{Note|This configuration applies only to the link-level, and is independent of network-level daemons such as [[NetworkManager]] or [[systemd-networkd]].}}<br />
<br />
See [[systemd-networkd#link files]] and {{man|5|systemd.link}} for more information.<br />
<br />
==== systemd service ====<br />
<br />
This is an equivalent of previous {{ic|systemd.link}} option, but uses a standalone systemd service.<br />
<br />
{{hc|/etc/systemd/system/wol@.service|2=<br />
[Unit]<br />
Description=Wake-on-LAN for %i<br />
Requires=network.target<br />
After=network.target<br />
<br />
[Service]<br />
ExecStart=/usr/bin/ethtool -s %i wol g<br />
Type=oneshot<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
}}<br />
<br />
Alternatively install the {{AUR|wol-systemd}} package.<br />
<br />
Then activate this new service by [[starting]] {{ic|wol@''interface''.service}}.<br />
<br />
==== udev ====<br />
<br />
[[udev]] is capable of running any command as soon as a device is visible. The following rule will turn on WOL on all [[network interface]]s whose name matches {{ic|enp*}}:<br />
<br />
{{hc|/etc/udev/rules.d/99-wol.rules|<nowiki><br />
ACTION=="add", SUBSYSTEM=="net", NAME=="enp*", RUN+="/usr/bin/ethtool -s $name wol g"<br />
</nowiki>}}<br />
<br />
The {{ic|$name}} placeholder will be replaced by the value of the {{ic|NAME}} variable for the matched device.<br />
<br />
{{Note|The name of the configuration file is important. Due to the introduction of [[Network configuration#Device_names|persistent device names]] in systemd v197, it is important that the rules matching a specific network interface are named lexicographically after {{ic|80-net-name-slot.rules}}, so that they are applied after the devices gain the persistent names.}}<br />
<br />
{{Warning|[[udev]] will match the device as soon it becomes available, be this in the [[initramfs]] (before the switch_root) or the main system. The order is not deterministic; there is no guarantee. Be sure that your initramfs includes the necessary udev rules (from {{ic|/etc/udev/rules.d}}) and supporting binaries ({{ic|/usr/bin/ethtool}}).}}<br />
<br />
==== cron ====<br />
<br />
A command can be run each time the computer is (re)booted using "@reboot" in a crontab. First, make sure [[Cron#Installation|cron]] is enabled, and then [[Cron#Basic_commands|edit a crontab]] for the root user that contains the following line:<br />
<br />
@reboot /usr/bin/ethtool -s [net-device] wol g<br />
<br />
==== NetworkManager ====<br />
<br />
In version 1.0.6 NetworkManager [https://www.phoronix.com/scan.php?page=news_item&px=NetworkManager-WoL-Control adds Wake-on-LAN controls]. One way to enable Wake-on-LAN by magic packet is through nmcli.<br />
<br />
First, search for the name of the wired connection:<br />
<br />
{{hc|# nmcli con show|2=<br />
NAME UUID TYPE DEVICE<br />
wired1 612e300a-c047-4adb-91e2-12ea7bfe214e 802-3-ethernet enp0s25<br />
}}<br />
<br />
By following, one can view current status of Wake-on-LAN settings:<br />
<br />
{{hc|# nmcli c show "wired1" <nowiki>|</nowiki> grep 802-3-ethernet.wake-on-lan|2=<br />
802-3-ethernet.wake-on-lan: default<br />
802-3-ethernet.wake-on-lan-password: --<br />
}}<br />
<br />
Enable Wake-on-LAN by magic packet on that connection:<br />
<br />
# nmcli c modify "wired1" 802-3-ethernet.wake-on-lan magic<br />
<br />
Then reboot, possibly two times.<br />
<br />
From version 1.2.0 Wake-on-LAN settings can be changed graphically using {{Pkg|nm-connection-editor}}.<br />
<br />
=== Enable WoL in TLP ===<br />
<br />
When using [[TLP]] for suspend/hibernate, the {{ic|WOL_DISABLE}} setting should be set to {{ic|N}} in {{ic|/etc/default/tlp}} to allow resuming the computer with WoL.<br />
<br />
== Trigger a wake up ==<br />
<br />
To trigger WoL on a target machine, its MAC address and external or internal IP should be known.<br />
<br />
To obtain the internal IP address and MAC address of the target computer, execute the following command:<br />
<br />
{{hc|$ ip addr|<br />
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default<br />
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00<br />
inet 127.0.0.1/8 scope host lo<br />
valid_lft forever preferred_lft forever<br />
inet6 ::1/128 scope host<br />
valid_lft forever preferred_lft forever<br />
2: enp1s0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000<br />
link/ether '''48:05:ca:09:0e:6a''' brd ff:ff:ff:ff:ff:ff<br />
inet '''192.168.1.20/24''' brd 192.168.1.255 scope global br0<br />
valid_lft forever preferred_lft forever<br />
inet6 fe80::6a05:caff:fe09:e6a/64 scope link<br />
valid_lft forever preferred_lft forever<br />
}}<br />
<br />
Here the internal IP address is {{ic|192.168.1.20}} and the MAC address is {{ic|48:05:ca:09:0e:6a}}.<br />
<br />
One program able to send magic packets for WoL is {{Pkg|wol}}.<br />
<br />
=== On the same LAN ===<br />
<br />
If you are connected directly to another computer through a network cable, or the traffic within a LAN is not firewalled, then using Wake-on-LAN should be very easy since there is no need to worry about port redirects.<br />
<br />
In the simplest case the default broadcast address {{ic|255.255.255.255}} is used:<br />
<br />
$ wol ''target_MAC_address''<br />
<br />
To broadcast the magic packet only to a specific subnet or host, use the {{ic|-i}} switch:<br />
<br />
$ wol -i ''target_IP'' ''target_MAC_address''<br />
<br />
{{Tip|If you intend to continue using Wake-on-LAN, it is recommended to assign a static IP address to the target computer.}}<br />
<br />
=== Across the internet ===<br />
<br />
When the source and target computers are separated by a router, Wake-on-LAN can be achieved via [[wikipedia:Port forwarding|port forwarding]]. The router needs to be configured using one of these two options:<br />
<br />
* Forward a different port to each target machine. This requires any target machine to have a static IP address on its LAN.<br />
* Forward a single port to the [[wikipedia:Broadcast_address|broadcast address]]. This is likely not possible on your router with the stock firmware, in this case refer to [[#Forward a port to the broadcast address]] for workarounds.<br />
<br />
In both cases, run the following command from the source computer to trigger wake-up:<br />
<br />
$ wol -p ''forwarded_port'' -i ''router_IP'' ''target_MAC_address''<br />
<br />
==== Forward a port to the broadcast address ====<br />
<br />
Most routers do not allow to forward to broadcast, however if you can get shell access to your router (through telnet, ssh, serial cable, etc), you can implement this workaround:<br />
$ ip neighbor add 192.168.1.254 lladdr FF:FF:FF:FF:FF:FF dev net0<br />
<br />
(The above command assumes your network is ''192.168.1.0/24'' and uses ''net0'' as network interface). Now, forward UDP port 9 to 192.168.1.254. This has worked for me on a Linksys WRT54G running [[Wikipedia:Tomato_(firmware)|Tomato]], and on the Verizon FIOS ActionTec router.<br />
<br />
For notes on how to do it on a router with [[Wikipedia:DD-WRT|DD-WRT]] firmware, see [http://www.dd-wrt.com/wiki/index.php/WOL#Remote_Wake_On_LAN_via_Port_Forwarding this tutorial].<br />
<br />
For notes on how to do it on a router with [[Wikipedia:OpenWrt|OpenWrt]] firmware, see [https://wiki.openwrt.org/doc/uci/wol this tutorial].<br />
<br />
== Miscellaneous ==<br />
<br />
=== Check reception of the magic packets ===<br />
In order to make sure the WoL packets reach the target computer, one can listen to the UDP port, usually port 9, for magic packets.<br />
<br />
This can be performed by installing {{pkg|gnu-netcat}} from the [[official repositories]] on the target computer and using the following command:<br />
<br />
# nc --udp --listen --local-port=9 --hexdump<br />
<br />
Then wait for the incoming traffic to appear in the {{ic|nc}} terminal.<br />
<br />
The magic packet frame expected contains 6 bytes of FF followed by 16 repetitions of the target computer's MAC (6 bytes each) for a total of 102 bytes.<br />
<br />
=== Example of WoL script ===<br />
Here is a script that illustrates the use of {{ic|wol}} with different machines:<br />
{{bc|<nowiki><br />
#!/bin/bash<br />
<br />
# definition of MAC addresses<br />
monster=01:12:46:82:ab:4f<br />
ghost=01:1a:d2:56:6b:e6<br />
<br />
echo "Which PC to wake?"<br />
echo "m) monster"<br />
echo "g) ghost"<br />
echo "q) quit"<br />
read input1<br />
case $input1 in<br />
m)<br />
/usr/bin/wol $monster<br />
;;<br />
g)<br />
# uses wol over the internet provided that port 9 is forwarded to ghost on ghost's router<br />
/usr/bin/wol --port=9 --host=ghost.mydomain.org $ghost<br />
;;<br />
Q|q)<br />
break<br />
;;<br />
esac</nowiki>}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Battery draining problem ===<br />
Some laptops have a battery draining problem after shutdown [http://ubuntuforums.org/archive/index.php/t-1729782.html]. This might be caused by enabled WOL. To solve this problem, disable it by using ethtool as mentioned above.<br />
<br />
# ethtool -s net0 wol d<br />
<br />
=== Realtek ===<br />
<br />
Users with Realtek 8168 8169 8101 8111(C) based NICs (cards / and on-board) may notice a problem where the NIC seems to be disabled on boot and has no Link light. See [[Network configuration#Realtek no link / WOL problem]].<br />
<br />
If the link light on the network switch is enabled when the computer is turned off but wake on LAN is still not working, booting the system using the {{Pkg|r8168}} kernel module at least once and then switching back to the r8169 kernel module included with the kernel seems to fix it at least in the following configurations:<br />
* MSI B85M-E45 motherboard, BIOS version V10.9, onboard Realtek 8111G chipset<br />
<br />
For the {{ic|r8168}} module you might need to set the {{ic|1=s5wol=1}} [[Kernel_modules#Setting_module_options|module option]] to enable the wake on LAN functionality.<br />
<br />
===alx driver support===<br />
<br />
For some newer Atheros-based NICs (such as Atheros AR8161 and Killer E2500), WOL support has been disabled in the mainline {{ic|alx}} module due to a bug causing unintentional wake-up (see [http://www.spinics.net/lists/netdev/msg242477.html this patch discussion]). A patch can be applied (or installed as a [[dkms]] module) which both restores WOL support and fixes the underlying bug, as outlined in [https://bugzilla.kernel.org/show_bug.cgi?id=61651 this thread].<br />
<br />
== See also ==<br />
<br />
* [http://www.depicus.com/wake-on-lan/woli.aspx Wake-On-Lan]</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Wake-on-LAN&diff=504936Wake-on-LAN2017-12-29T12:40:34Z<p>Sleeping: /* Enable WoL on the network adapter */ interface_>devname, link to explanation how to determine network device name, remove outdated template</p>
<hr />
<div>[[Category:Networking]]<br />
[[ja:Wake-on-LAN]]<br />
[[Wikipedia:Wake-on-LAN|Wake-on-LAN]] (WoL) is a feature to switch on a computer via the network.<br />
<br />
== Hardware settings ==<br />
<br />
The target computer's motherboard and [[wikipedia:Network interface controller|Network Interface Controller]] have to support Wake-on-LAN. The target computer has to be physically connected (with a cable) to a router or to the source computer, wireless cards do not support WoL.<br />
<br />
The Wake-on-LAN feature also has to be enabled in the computer's BIOS. Different motherboard manufacturers use slightly different language for this feature. Look for terminology such as "PCI Power up", "Allow PCI wake up event" or "Boot from PCI/PCI-E".<br />
<br />
It is known that some motherboards are affected by a bug that can cause immediate or random wake-up after a ''shutdown'' whenever the BIOS WoL feature is enabled (as discussed in [https://bbs.archlinux.org/viewtopic.php?id=173648 this thread] for example). The following actions in the BIOS preferences can solve this issue with some motherboards:<br />
# Disable all references to ''xHCI'' in the USB settings (note this will also disable USB 3.0 at boot time)<br />
# Disable ''EuP 2013'' if it is explicitly an option<br />
# Optionally enable wake-up on keyboard actions<br />
{{Note|There are mixed opinions as to the value of #3 above and it may be motherboard dependent.}}<br />
<br />
== Software configuration ==<br />
<br />
=== Enable WoL on the network adapter ===<br />
<br />
Depending on the hardware, the network driver may have WoL switched off by default.<br />
<br />
To query this status or to change the settings, install {{Pkg|ethtool}}, [[Network_configuration#Get_current_device_names|determine the network device's name]], and query it using the command:<br />
{{hc|# ethtool ''devname'' {{!}} grep Wake-on|<br />
Supports Wake-on: pumbag<br />
Wake-on: d}}<br />
The ''Wake-on'' values define what activity triggers wake up: {{ic|d}} (disabled), {{ic|p}} (PHY activity), {{ic|u}} (unicast activity), {{ic|m}} (multicast activity), {{ic|b}} (broadcast activity), {{ic|a}} (ARP activity), and {{ic|g}} (magic packet activity). The value {{ic|g}} is required for WoL to work, if not, the following command enables the WoL feature in the driver:<br />
<br />
# ethtool -s ''devname'' wol g<br />
<br />
This command might not last beyond the next reboot and in this case must be repeated via some mechanism. Common solutions are listed in the following subsections.<br />
<br />
=== Make it persistent ===<br />
<br />
==== netctl ====<br />
<br />
If using netctl, one can make this setting persistent by adding the following the netctl profile:<br />
<br />
{{hc|/etc/netctl/''profile''|2=<br />
ExecUpPost='/usr/bin/ethtool -s ''interface'' wol g'<br />
}}<br />
<br />
==== systemd.link ====<br />
<br />
Link-level configuration is possible through systemd. The actual setup is performed by the {{ic|net_setup_link}} udev builtin. Add the {{ic|WakeOnLan}} option to the network link file:<br />
<br />
{{hc|/etc/systemd/network/50-wired.link|2=<br />
[Link]<br />
WakeOnLan=magic<br />
...<br />
}}<br />
<br />
{{Note|This configuration applies only to the link-level, and is independent of network-level daemons such as [[NetworkManager]] or [[systemd-networkd]].}}<br />
<br />
See [[systemd-networkd#link files]] and {{man|5|systemd.link}} for more information.<br />
<br />
==== systemd service ====<br />
<br />
This is an equivalent of previous {{ic|systemd.link}} option, but uses a standalone systemd service.<br />
<br />
{{hc|/etc/systemd/system/wol@.service|2=<br />
[Unit]<br />
Description=Wake-on-LAN for %i<br />
Requires=network.target<br />
After=network.target<br />
<br />
[Service]<br />
ExecStart=/usr/bin/ethtool -s %i wol g<br />
Type=oneshot<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
}}<br />
<br />
Alternatively install the {{AUR|wol-systemd}} package.<br />
<br />
Then activate this new service by [[starting]] {{ic|wol@''interface''.service}}.<br />
<br />
==== udev ====<br />
<br />
[[udev]] is capable of running any command as soon as a device is visible. The following rule will turn on WOL on all [[network interface]]s whose name matches {{ic|enp*}}:<br />
<br />
{{hc|/etc/udev/rules.d/99-wol.rules|<nowiki><br />
ACTION=="add", SUBSYSTEM=="net", NAME=="enp*", RUN+="/usr/bin/ethtool -s $name wol g"<br />
</nowiki>}}<br />
<br />
The {{ic|$name}} placeholder will be replaced by the value of the {{ic|NAME}} variable for the matched device.<br />
<br />
{{Note|The name of the configuration file is important. Due to the introduction of [[Network configuration#Device_names|persistent device names]] in systemd v197, it is important that the rules matching a specific network interface are named lexicographically after {{ic|80-net-name-slot.rules}}, so that they are applied after the devices gain the persistent names.}}<br />
<br />
{{Warning|[[udev]] will match the device as soon it becomes available, be this in the [[initramfs]] (before the switch_root) or the main system. The order is not deterministic; there is no guarantee. Be sure that your initramfs includes the necessary udev rules (from {{ic|/etc/udev/rules.d}}) and supporting binaries ({{ic|/usr/bin/ethtool}}).}}<br />
<br />
==== cron ====<br />
<br />
A command can be run each time the computer is (re)booted using "@reboot" in a crontab. First, make sure [[Cron#Installation|cron]] is enabled, and then [[Cron#Basic_commands|edit a crontab]] for the root user that contains the following line:<br />
<br />
@reboot /usr/bin/ethtool -s [net-device] wol g<br />
<br />
==== NetworkManager ====<br />
<br />
In version 1.0.6 NetworkManager [https://www.phoronix.com/scan.php?page=news_item&px=NetworkManager-WoL-Control adds Wake-on-LAN controls]. One way to enable Wake-on-LAN by magic packet is through nmcli.<br />
<br />
First, search for the name of the wired connection:<br />
<br />
{{hc|# nmcli con show|2=<br />
NAME UUID TYPE DEVICE<br />
wired1 612e300a-c047-4adb-91e2-12ea7bfe214e 802-3-ethernet enp0s25<br />
}}<br />
<br />
By following, one can view current status of Wake-on-LAN settings:<br />
<br />
{{hc|# nmcli c show "wired1" <nowiki>|</nowiki> grep 802-3-ethernet.wake-on-lan|2=<br />
802-3-ethernet.wake-on-lan: default<br />
802-3-ethernet.wake-on-lan-password: --<br />
}}<br />
<br />
Enable Wake-on-LAN by magic packet on that connection:<br />
<br />
# nmcli c modify "wired1" 802-3-ethernet.wake-on-lan magic<br />
<br />
Then reboot, possibly two times.<br />
<br />
From version 1.2.0 Wake-on-LAN settings can be changed graphically using {{Pkg|nm-connection-editor}}.<br />
<br />
=== Enable WoL in TLP ===<br />
<br />
When using [[TLP]] for suspend/hibernate, the {{ic|WOL_DISABLE}} setting should be set to {{ic|N}} in {{ic|/etc/default/tlp}} to allow resuming the computer with WoL.<br />
<br />
== Trigger a wake up ==<br />
<br />
To trigger WoL on a target machine, its MAC address and external or internal IP should be known.<br />
<br />
To obtain the internal IP address and MAC address of the target computer, execute the following command:<br />
<br />
{{hc|$ ip addr|<br />
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default<br />
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00<br />
inet 127.0.0.1/8 scope host lo<br />
valid_lft forever preferred_lft forever<br />
inet6 ::1/128 scope host<br />
valid_lft forever preferred_lft forever<br />
2: enp1s0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000<br />
link/ether '''48:05:ca:09:0e:6a''' brd ff:ff:ff:ff:ff:ff<br />
inet '''192.168.1.20/24''' brd 192.168.1.255 scope global br0<br />
valid_lft forever preferred_lft forever<br />
inet6 fe80::6a05:caff:fe09:e6a/64 scope link<br />
valid_lft forever preferred_lft forever<br />
}}<br />
<br />
Here the internal IP address is {{ic|192.168.1.20}} and the MAC address is {{ic|48:05:ca:09:0e:6a}}.<br />
<br />
One program able to send magic packets for WoL is {{Pkg|wol}}.<br />
<br />
=== On the same LAN ===<br />
<br />
If you are connected directly to another computer through a network cable, or the traffic within a LAN is not firewalled, then using Wake-on-LAN should be very easy since there is no need to worry about port redirects.<br />
<br />
In the simplest case the default broadcast address {{ic|255.255.255.255}} is used:<br />
<br />
$ wol ''target_MAC_address''<br />
<br />
To broadcast the magic packet only to a specific subnet or host, use the {{ic|-i}} switch:<br />
<br />
$ wol -i ''target_IP'' ''target_MAC_address''<br />
<br />
{{Tip|If you intend to continue using Wake-on-LAN, it is recommended to assign a static IP address to the target computer.}}<br />
<br />
=== Across the internet ===<br />
<br />
When the source and target computers are separated by a router, Wake-on-LAN can be achieved via [[wikipedia:Port forwarding|port forwarding]]. The router needs to be configured using one of these two options:<br />
<br />
* Forward a different port to each target machine. This requires any target machine to have a static IP address on its LAN.<br />
* Forward a single port to the [[wikipedia:Broadcast_address|broadcast address]]. This is likely not possible on your router with the stock firmware, in this case refer to [[#Forward a port to the broadcast address]] for workarounds.<br />
<br />
In both cases, run the following command from the source computer to trigger wake-up:<br />
<br />
$ wol -p ''forwarded_port'' -i ''router_IP'' ''target_MAC_address''<br />
<br />
==== Forward a port to the broadcast address ====<br />
<br />
Most routers do not allow to forward to broadcast, however if you can get shell access to your router (through telnet, ssh, serial cable, etc), you can implement this workaround:<br />
$ ip neighbor add 192.168.1.254 lladdr FF:FF:FF:FF:FF:FF dev net0<br />
<br />
(The above command assumes your network is ''192.168.1.0/24'' and uses ''net0'' as network interface). Now, forward UDP port 9 to 192.168.1.254. This has worked for me on a Linksys WRT54G running [[Wikipedia:Tomato_(firmware)|Tomato]], and on the Verizon FIOS ActionTec router.<br />
<br />
For notes on how to do it on a router with [[Wikipedia:DD-WRT|DD-WRT]] firmware, see [http://www.dd-wrt.com/wiki/index.php/WOL#Remote_Wake_On_LAN_via_Port_Forwarding this tutorial].<br />
<br />
For notes on how to do it on a router with [[Wikipedia:OpenWrt|OpenWrt]] firmware, see [https://wiki.openwrt.org/doc/uci/wol this tutorial].<br />
<br />
== Miscellaneous ==<br />
<br />
=== Check reception of the magic packets ===<br />
In order to make sure the WoL packets reach the target computer, one can listen to the UDP port, usually port 9, for magic packets.<br />
<br />
This can be performed by installing {{pkg|gnu-netcat}} from the [[official repositories]] on the target computer and using the following command:<br />
<br />
# nc --udp --listen --local-port=9 --hexdump<br />
<br />
Then wait for the incoming traffic to appear in the {{ic|nc}} terminal.<br />
<br />
The magic packet frame expected contains 6 bytes of FF followed by 16 repetitions of the target computer's MAC (6 bytes each) for a total of 102 bytes.<br />
<br />
=== Example of WoL script ===<br />
Here is a script that illustrates the use of {{ic|wol}} with different machines:<br />
{{bc|<nowiki><br />
#!/bin/bash<br />
<br />
# definition of MAC addresses<br />
monster=01:12:46:82:ab:4f<br />
ghost=01:1a:d2:56:6b:e6<br />
<br />
echo "Which PC to wake?"<br />
echo "m) monster"<br />
echo "g) ghost"<br />
echo "q) quit"<br />
read input1<br />
case $input1 in<br />
m)<br />
/usr/bin/wol $monster<br />
;;<br />
g)<br />
# uses wol over the internet provided that port 9 is forwarded to ghost on ghost's router<br />
/usr/bin/wol --port=9 --host=ghost.mydomain.org $ghost<br />
;;<br />
Q|q)<br />
break<br />
;;<br />
esac</nowiki>}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Battery draining problem ===<br />
Some laptops have a battery draining problem after shutdown [http://ubuntuforums.org/archive/index.php/t-1729782.html]. This might be caused by enabled WOL. To solve this problem, disable it by using ethtool as mentioned above.<br />
<br />
# ethtool -s net0 wol d<br />
<br />
=== Realtek ===<br />
<br />
Users with Realtek 8168 8169 8101 8111(C) based NICs (cards / and on-board) may notice a problem where the NIC seems to be disabled on boot and has no Link light. See [[Network configuration#Realtek no link / WOL problem]].<br />
<br />
If the link light on the network switch is enabled when the computer is turned off but wake on LAN is still not working, booting the system using the {{Pkg|r8168}} kernel module at least once and then switching back to the r8169 kernel module included with the kernel seems to fix it at least in the following configurations:<br />
* MSI B85M-E45 motherboard, BIOS version V10.9, onboard Realtek 8111G chipset<br />
<br />
For the {{ic|r8168}} module you might need to set the {{ic|1=s5wol=1}} [[Kernel_modules#Setting_module_options|module option]] to enable the wake on LAN functionality.<br />
<br />
===alx driver support===<br />
<br />
For some newer Atheros-based NICs (such as Atheros AR8161 and Killer E2500), WOL support has been disabled in the mainline {{ic|alx}} module due to a bug causing unintentional wake-up (see [http://www.spinics.net/lists/netdev/msg242477.html this patch discussion]). A patch can be applied (or installed as a [[dkms]] module) which both restores WOL support and fixes the underlying bug, as outlined in [https://bugzilla.kernel.org/show_bug.cgi?id=61651 this thread].<br />
<br />
== See also ==<br />
<br />
* [http://www.depicus.com/wake-on-lan/woli.aspx Wake-On-Lan]</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Talk:Wake-on-LAN&diff=504830Talk:Wake-on-LAN2017-12-29T00:38:09Z<p>Sleeping: ittalic</p>
<hr />
<div>== Predictable Network Interface Names ==<br />
<br />
The article should explain how to obtain the network interface name, or link to such an explanation. The default ethernet port is no longer called ''eth0'' by default since [[Network_configuration#Device names|Predictable Network Interface Names]]. --[[User:Sleeping|Sleeping]] ([[User talk:Sleeping|talk]]) 00:37, 29 December 2017 (UTC)</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Talk:Wake-on-LAN&diff=504829Talk:Wake-on-LAN2017-12-29T00:37:44Z<p>Sleeping: added comment about outdated tag</p>
<hr />
<div>== Predictable Network Interface Names ==<br />
<br />
The article should explain how to obtain the network interface name, or link to such an explanation. The default ethernet port is no longer called `eth0` by default since [[Network_configuration#Device names|Predictable Network Interface Names]]. --[[User:Sleeping|Sleeping]] ([[User talk:Sleeping|talk]]) 00:37, 29 December 2017 (UTC)</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Wake-on-LAN&diff=504828Wake-on-LAN2017-12-29T00:34:23Z<p>Sleeping: Added outdated template</p>
<hr />
<div>[[Category:Networking]]<br />
[[ja:Wake-on-LAN]]<br />
[[Wikipedia:Wake-on-LAN|Wake-on-LAN]] (WoL) is a feature to switch on a computer via the network.<br />
<br />
== Hardware settings ==<br />
<br />
The target computer's motherboard and [[wikipedia:Network interface controller|Network Interface Controller]] have to support Wake-on-LAN. The target computer has to be physically connected (with a cable) to a router or to the source computer, wireless cards do not support WoL.<br />
<br />
The Wake-on-LAN feature also has to be enabled in the computer's BIOS. Different motherboard manufacturers use slightly different language for this feature. Look for terminology such as "PCI Power up", "Allow PCI wake up event" or "Boot from PCI/PCI-E".<br />
<br />
It is known that some motherboards are affected by a bug that can cause immediate or random wake-up after a ''shutdown'' whenever the BIOS WoL feature is enabled (as discussed in [https://bbs.archlinux.org/viewtopic.php?id=173648 this thread] for example). The following actions in the BIOS preferences can solve this issue with some motherboards:<br />
# Disable all references to ''xHCI'' in the USB settings (note this will also disable USB 3.0 at boot time)<br />
# Disable ''EuP 2013'' if it is explicitly an option<br />
# Optionally enable wake-up on keyboard actions<br />
{{Note|There are mixed opinions as to the value of #3 above and it may be motherboard dependent.}}<br />
<br />
== Software configuration ==<br />
<br />
=== Enable WoL on the network adapter ===<br />
<br />
{{Out of date|Predictable Network Interface Names introduced different names than eth0 for ethernet interface.}}<br />
<br />
Depending on the hardware, the network driver may have WoL switched off by default.<br />
<br />
To query this status or to change the settings, install {{Pkg|ethtool}} and query the network device via this command:<br />
{{hc|<nowiki># ethtool net0 | grep Wake-on</nowiki>|<br />
Supports Wake-on: pumbag<br />
Wake-on: d}}<br />
The ''Wake-on'' values define what activity triggers wake up: {{ic|d}} (disabled), {{ic|p}} (PHY activity), {{ic|u}} (unicast activity), {{ic|m}} (multicast activity), {{ic|b}} (broadcast activity), {{ic|a}} (ARP activity), and {{ic|g}} (magic packet activity). The value {{ic|g}} is required for WoL to work, if not, the following command enables the WoL feature in the driver:<br />
<br />
# ethtool -s net0 wol g<br />
<br />
This command might not last beyond the next reboot and in this case must be repeated via some mechanism. Common solutions are listed in the following subsections.<br />
<br />
=== Make it persistent ===<br />
<br />
==== netctl ====<br />
<br />
If using netctl, one can make this setting persistent by adding the following the netctl profile:<br />
<br />
{{hc|/etc/netctl/''profile''|2=<br />
ExecUpPost='/usr/bin/ethtool -s net0 wol g'<br />
}}<br />
<br />
==== systemd.link ====<br />
<br />
Link-level configuration is possible through systemd. The actual setup is performed by the {{ic|net_setup_link}} udev builtin. Add the {{ic|WakeOnLan}} option to the network link file:<br />
<br />
{{hc|/etc/systemd/network/50-wired.link|2=<br />
[Link]<br />
WakeOnLan=magic<br />
...<br />
}}<br />
<br />
{{Note|This configuration applies only to the link-level, and is independent of network-level daemons such as [[NetworkManager]] or [[systemd-networkd]].}}<br />
<br />
See [[systemd-networkd#link files]] and {{man|5|systemd.link}} for more information.<br />
<br />
==== systemd service ====<br />
<br />
This is an equivalent of previous {{ic|systemd.link}} option, but uses a standalone systemd service.<br />
<br />
{{hc|/etc/systemd/system/wol@.service|2=<br />
[Unit]<br />
Description=Wake-on-LAN for %i<br />
Requires=network.target<br />
After=network.target<br />
<br />
[Service]<br />
ExecStart=/usr/bin/ethtool -s %i wol g<br />
Type=oneshot<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
}}<br />
<br />
Alternatively install the {{AUR|wol-systemd}} package.<br />
<br />
Then activate this new service by [[starting]] {{ic|wol@''interface''.service}}.<br />
<br />
==== udev ====<br />
<br />
[[udev]] is capable of running any command as soon as a device is visible. The following rule will turn on WOL on all [[network interface]]s whose name matches {{ic|enp*}}:<br />
<br />
{{hc|/etc/udev/rules.d/99-wol.rules|<nowiki><br />
ACTION=="add", SUBSYSTEM=="net", NAME=="enp*", RUN+="/usr/bin/ethtool -s $name wol g"<br />
</nowiki>}}<br />
<br />
The {{ic|$name}} placeholder will be replaced by the value of the {{ic|NAME}} variable for the matched device.<br />
<br />
{{Note|The name of the configuration file is important. Due to the introduction of [[Network configuration#Device_names|persistent device names]] in systemd v197, it is important that the rules matching a specific network interface are named lexicographically after {{ic|80-net-name-slot.rules}}, so that they are applied after the devices gain the persistent names.}}<br />
<br />
{{Warning|[[udev]] will match the device as soon it becomes available, be this in the [[initramfs]] (before the switch_root) or the main system. The order is not deterministic; there is no guarantee. Be sure that your initramfs includes the necessary udev rules (from {{ic|/etc/udev/rules.d}}) and supporting binaries ({{ic|/usr/bin/ethtool}}).}}<br />
<br />
==== cron ====<br />
<br />
A command can be run each time the computer is (re)booted using "@reboot" in a crontab. First, make sure [[Cron#Installation|cron]] is enabled, and then [[Cron#Basic_commands|edit a crontab]] for the root user that contains the following line:<br />
<br />
@reboot /usr/bin/ethtool -s [net-device] wol g<br />
<br />
==== NetworkManager ====<br />
<br />
In version 1.0.6 NetworkManager [https://www.phoronix.com/scan.php?page=news_item&px=NetworkManager-WoL-Control adds Wake-on-LAN controls]. One way to enable Wake-on-LAN by magic packet is through nmcli.<br />
<br />
First, search for the name of the wired connection:<br />
<br />
{{hc|# nmcli con show|2=<br />
NAME UUID TYPE DEVICE<br />
wired1 612e300a-c047-4adb-91e2-12ea7bfe214e 802-3-ethernet enp0s25<br />
}}<br />
<br />
By following, one can view current status of Wake-on-LAN settings:<br />
<br />
{{hc|# nmcli c show "wired1" <nowiki>|</nowiki> grep 802-3-ethernet.wake-on-lan|2=<br />
802-3-ethernet.wake-on-lan: default<br />
802-3-ethernet.wake-on-lan-password: --<br />
}}<br />
<br />
Enable Wake-on-LAN by magic packet on that connection:<br />
<br />
# nmcli c modify "wired1" 802-3-ethernet.wake-on-lan magic<br />
<br />
Then reboot, possibly two times.<br />
<br />
From version 1.2.0 Wake-on-LAN settings can be changed graphically using {{Pkg|nm-connection-editor}}.<br />
<br />
=== Enable WoL in TLP ===<br />
<br />
When using [[TLP]] for suspend/hibernate, the {{ic|WOL_DISABLE}} setting should be set to {{ic|N}} in {{ic|/etc/default/tlp}} to allow resuming the computer with WoL.<br />
<br />
== Trigger a wake up ==<br />
<br />
To trigger WoL on a target machine, its MAC address and external or internal IP should be known.<br />
<br />
To obtain the internal IP address and MAC address of the target computer, execute the following command:<br />
<br />
{{hc|$ ip addr|<br />
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default<br />
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00<br />
inet 127.0.0.1/8 scope host lo<br />
valid_lft forever preferred_lft forever<br />
inet6 ::1/128 scope host<br />
valid_lft forever preferred_lft forever<br />
2: enp1s0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000<br />
link/ether '''48:05:ca:09:0e:6a''' brd ff:ff:ff:ff:ff:ff<br />
inet '''192.168.1.20/24''' brd 192.168.1.255 scope global br0<br />
valid_lft forever preferred_lft forever<br />
inet6 fe80::6a05:caff:fe09:e6a/64 scope link<br />
valid_lft forever preferred_lft forever<br />
}}<br />
<br />
Here the internal IP address is {{ic|192.168.1.20}} and the MAC address is {{ic|48:05:ca:09:0e:6a}}.<br />
<br />
One program able to send magic packets for WoL is {{Pkg|wol}}.<br />
<br />
=== On the same LAN ===<br />
<br />
If you are connected directly to another computer through a network cable, or the traffic within a LAN is not firewalled, then using Wake-on-LAN should be very easy since there is no need to worry about port redirects.<br />
<br />
In the simplest case the default broadcast address {{ic|255.255.255.255}} is used:<br />
<br />
$ wol ''target_MAC_address''<br />
<br />
To broadcast the magic packet only to a specific subnet or host, use the {{ic|-i}} switch:<br />
<br />
$ wol -i ''target_IP'' ''target_MAC_address''<br />
<br />
{{Tip|If you intend to continue using Wake-on-LAN, it is recommended to assign a static IP address to the target computer.}}<br />
<br />
=== Across the internet ===<br />
<br />
When the source and target computers are separated by a router, Wake-on-LAN can be achieved via [[wikipedia:Port forwarding|port forwarding]]. The router needs to be configured using one of these two options:<br />
<br />
* Forward a different port to each target machine. This requires any target machine to have a static IP address on its LAN.<br />
* Forward a single port to the [[wikipedia:Broadcast_address|broadcast address]]. This is likely not possible on your router with the stock firmware, in this case refer to [[#Forward a port to the broadcast address]] for workarounds.<br />
<br />
In both cases, run the following command from the source computer to trigger wake-up:<br />
<br />
$ wol -p ''forwarded_port'' -i ''router_IP'' ''target_MAC_address''<br />
<br />
==== Forward a port to the broadcast address ====<br />
<br />
Most routers do not allow to forward to broadcast, however if you can get shell access to your router (through telnet, ssh, serial cable, etc), you can implement this workaround:<br />
$ ip neighbor add 192.168.1.254 lladdr FF:FF:FF:FF:FF:FF dev net0<br />
<br />
(The above command assumes your network is ''192.168.1.0/24'' and uses ''net0'' as network interface). Now, forward UDP port 9 to 192.168.1.254. This has worked for me on a Linksys WRT54G running [[Wikipedia:Tomato_(firmware)|Tomato]], and on the Verizon FIOS ActionTec router.<br />
<br />
For notes on how to do it on a router with [[Wikipedia:DD-WRT|DD-WRT]] firmware, see [http://www.dd-wrt.com/wiki/index.php/WOL#Remote_Wake_On_LAN_via_Port_Forwarding this tutorial].<br />
<br />
For notes on how to do it on a router with [[Wikipedia:OpenWrt|OpenWrt]] firmware, see [https://wiki.openwrt.org/doc/uci/wol this tutorial].<br />
<br />
== Miscellaneous ==<br />
<br />
=== Check reception of the magic packets ===<br />
In order to make sure the WoL packets reach the target computer, one can listen to the UDP port, usually port 9, for magic packets.<br />
<br />
This can be performed by installing {{pkg|gnu-netcat}} from the [[official repositories]] on the target computer and using the following command:<br />
<br />
# nc --udp --listen --local-port=9 --hexdump<br />
<br />
Then wait for the incoming traffic to appear in the {{ic|nc}} terminal.<br />
<br />
The magic packet frame expected contains 6 bytes of FF followed by 16 repetitions of the target computer's MAC (6 bytes each) for a total of 102 bytes.<br />
<br />
=== Example of WoL script ===<br />
Here is a script that illustrates the use of {{ic|wol}} with different machines:<br />
{{bc|<nowiki><br />
#!/bin/bash<br />
<br />
# definition of MAC addresses<br />
monster=01:12:46:82:ab:4f<br />
ghost=01:1a:d2:56:6b:e6<br />
<br />
echo "Which PC to wake?"<br />
echo "m) monster"<br />
echo "g) ghost"<br />
echo "q) quit"<br />
read input1<br />
case $input1 in<br />
m)<br />
/usr/bin/wol $monster<br />
;;<br />
g)<br />
# uses wol over the internet provided that port 9 is forwarded to ghost on ghost's router<br />
/usr/bin/wol --port=9 --host=ghost.mydomain.org $ghost<br />
;;<br />
Q|q)<br />
break<br />
;;<br />
esac</nowiki>}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Battery draining problem ===<br />
Some laptops have a battery draining problem after shutdown [http://ubuntuforums.org/archive/index.php/t-1729782.html]. This might be caused by enabled WOL. To solve this problem, disable it by using ethtool as mentioned above.<br />
<br />
# ethtool -s net0 wol d<br />
<br />
=== Realtek ===<br />
<br />
Users with Realtek 8168 8169 8101 8111(C) based NICs (cards / and on-board) may notice a problem where the NIC seems to be disabled on boot and has no Link light. See [[Network configuration#Realtek no link / WOL problem]].<br />
<br />
If the link light on the network switch is enabled when the computer is turned off but wake on LAN is still not working, booting the system using the {{Pkg|r8168}} kernel module at least once and then switching back to the r8169 kernel module included with the kernel seems to fix it at least in the following configurations:<br />
* MSI B85M-E45 motherboard, BIOS version V10.9, onboard Realtek 8111G chipset<br />
<br />
For the {{ic|r8168}} module you might need to set the {{ic|1=s5wol=1}} [[Kernel_modules#Setting_module_options|module option]] to enable the wake on LAN functionality.<br />
<br />
===alx driver support===<br />
<br />
For some newer Atheros-based NICs (such as Atheros AR8161 and Killer E2500), WOL support has been disabled in the mainline {{ic|alx}} module due to a bug causing unintentional wake-up (see [http://www.spinics.net/lists/netdev/msg242477.html this patch discussion]). A patch can be applied (or installed as a [[dkms]] module) which both restores WOL support and fixes the underlying bug, as outlined in [https://bugzilla.kernel.org/show_bug.cgi?id=61651 this thread].<br />
<br />
== See also ==<br />
<br />
* [http://www.depicus.com/wake-on-lan/woli.aspx Wake-On-Lan]</div>Sleepinghttps://wiki.archlinux.org/index.php?title=TunnelBear&diff=498982TunnelBear2017-11-25T14:33:38Z<p>Sleeping: Changed stub to accuracy tag</p>
<hr />
<div>[[Category:VPN providers]]<br />
[[ja:TunnelBear]]<br />
{{Accuracy|Instructions to copy 3rd party configs into {{ic|/etc/openvpn/}} is not the ArchWiki way.}}<br />
<br />
[https://www.tunnelbear.com TunnelBear] is a VPN provider that utilizes OpenVPN protocol.<br />
<br />
In order to use this tutorial, one must have Giant or Grizzly subscription.<br />
<br />
{{Note|There is an [https://www.tunnelbear.com/updates/linux_support/ easier] method to use TunnelBear service for Gnome users.}}<br />
<br />
== Walkthrough ==<br />
<br />
[[Install]] {{pkg|openvpn}}.<br />
<br />
Download [https://s3.amazonaws.com/tunnelbear/linux/openvpn.zip TunnelBear OpenVPN config files] (also you can install {{Aur|tunnelbear}} package from AUR).<br />
<br />
Unzip the folder, and copy all the files to<br />
<br />
$ /etc/openvpn/client/<br />
<br />
Do not forget to change the permission<br />
<br />
$ sudo chmod 600 /etc/openvpn/client/*<br />
<br />
Pick the corresponding '''.ovpn''' that will be used (TunnelBear Japan is used as an example)<br />
<br />
Rename the extension & remove the space<br />
<br />
$ mv /etc/openvpn/client/TunnelBear\ Japan.ovpn /etc/openvpn/client/TunnelBearJapan.conf<br />
<br />
Edit the '''.conf''' file<br />
<br />
{{hc|/etc/openvpn/client/TunnelBearJapan.conf|<br />
.<br />
.<br />
keepalive 10 30<br />
auth-user-pass login.key<br />
.<br />
.<br />
}}<br />
<br />
Create '''login.key'''<br />
<br />
{{hc|/etc/openvpn/client/login.key|<br />
<br />
yourtunnelbearusername<br />
yourtunnelbearpassword<br />
<br />
}}<br />
<br />
[[Start/enable]] {{ic|openvpn-client@TunnelBearJapan.service}}.<br />
<br />
== References ==<br />
<br />
* [https://github.com/JenniferMack/TunnelBear-Helper TunnelBear Helper]<br />
* [[OpenVPN|Arch Wiki OpenVPN]]</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Geogebra&diff=487469Geogebra2017-08-27T22:01:02Z<p>Sleeping: Replaced blurb with neutral text from Wikipedia</p>
<hr />
<div>[[Category:Mathematics and science]]<br />
<br />
GeoGebra is an interactive geometry, algebra, statistics and calculus application, intended for learning and teaching mathematics and science from primary school to university level.<br />
<br />
== Installation ==<br />
[[Install]] the {{Pkg|geogebra}} package.</div>Sleepinghttps://wiki.archlinux.org/index.php?title=Geogebra&diff=487468Geogebra2017-08-27T21:59:36Z<p>Sleeping: Created page with basic info. I was looking for this package, but couldn't find it in the Mathematics and science overview.</p>
<hr />
<div>[[Category:Mathematics and science]]<br />
<br />
From the [https://www.geogebra.org/about official website]:<br />
<br />
:''GeoGebra is dynamic mathematics software for all levels of education that brings together geometry, algebra, spreadsheets, graphing, statistics and calculus in one easy-to-use package. GeoGebra is a rapidly expanding community of millions of users located in just about every country. GeoGebra has become the leading provider of dynamic mathematics software, supporting science, technology, engineering and mathematics (STEM) education and innovations in teaching and learning worldwide.<br />
''<br />
<br />
== Installation ==<br />
[[Install]] the {{Pkg|geogebra}} package.</div>Sleeping