https://wiki.archlinux.org/api.php?action=feedcontributions&user=Dongerd&feedformat=atomArchWiki - User contributions [en]2024-03-29T11:42:19ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=User:Gen2ly/10-synaptics.conf_example&diff=125391User:Gen2ly/10-synaptics.conf example2010-12-15T15:40:27Z<p>Dongerd: </p>
<hr />
<div>Additional descriptions would be welcome by anyone that has the time to do so.<br />
<br />
<pre>Section "InputClass"<br />
Identifier "touchpad catchall"<br />
Driver "synaptics"<br />
MatchIsTouchpad "on"<br />
# Enable touchpad<br />
Option "TouchpadOff" "0"<br />
# Allow run-time configuration<br />
# Option "SHMConfig" "on" # deprecated<br />
# Edge Limits<br />
Option "LeftEdge" "1748"<br />
Option "RightEdge" "5640"<br />
Option "TopEdge" "1274"<br />
Option "BottomEdge" "4752"<br />
# Speed<br />
Option "MinSpeed" "0.4"<br />
Option "MaxSpeed" "0.7"<br />
Option "AccelFactor" "0.00995223"<br />
# Pressure<br />
Option "FingerLow" "24"<br />
Option "FingerHigh" "29"<br />
Option "FingerPress" "255"<br />
# Tapping Detection<br />
Option "MaxTapTime" "0" # 0 disables tap<br />
Option "MaxTapMove" "29"<br />
Option "MaxDoubleTapTime" "180"<br />
Option "SingleTapTimeout" "180"<br />
Option "ClickTime" "100"<br />
Option "FastTaps" "0"<br />
# Tapping as Buttons (number of fingers)<br />
Option "TapButton1" "1"<br />
Option "TapButton2" "2"<br />
Option "TapButton3" "3"<br />
# Tap Dragging<br />
Option "LockedDrags" "0"<br />
Option "LockedDragTimeout" "5000"<br />
# Tap Gesture Dragging<br />
Option "TapAndDragGesture" "0"<br />
# Corner Tap Buttons<br />
Option "RTCornerButton" "0"<br />
Option "RBCornerButton" "0"<br />
Option "LTCornerButton" "0"<br />
Option "LBCornerButton" "0"<br />
# Scrolling Edges<br />
Option "VertEdgeScroll" "1"<br />
Option "VertScrollDelta" "100"<br />
Option "HorizEdgeScroll" "0"<br />
Option "HorizScrollDelta" "100"<br />
# Circular Scrolling<br />
Option "CircularScrolling" "0"<br />
Option "CircScrollDelta" "0.1"<br />
Option "CircScrollTrigger" "0"<br />
# Two Finger Scrolling<br />
Option "VertTwoFingerScroll" "0"<br />
Option "HorizTwoFingerScroll" "0"<br />
# Corner Coasting<br />
Option "CornerCoasting" "0"<br />
Option "CoastingSpeed" "20"<br />
Option "CoastingFriction" "50"<br />
# Kernel Event Protocol<br />
Option "GrabEventDevice" "1"<br />
# Edge Ignore Boundaries<br />
Option "AreaLeftEdge" "0"<br />
Option "AreaRightEdge" "0"<br />
Option "AreaTopEdge" "0"<br />
Option "AreaBottomEdge" "0"<br />
# Trackstick<br />
Option "TrackstickSpeed" "40"<br />
# Circular Trackpad<br />
Option "CircularPad" "0"<br />
# Multi-function Buttons<br />
Option "ClickFinger1" "1"<br />
Option "ClickFinger2" "1"<br />
Option "ClickFinger3" "1"<br />
# Edge Movements<br />
Option "EdgeMotionMinZ" "29"<br />
Option "EdgeMotionMaxZ" "159"<br />
Option "EdgeMotionMinSpeed" "1"<br />
Option "EdgeMotionMaxSpeed" "401"<br />
Option "EdgeMotionUseAlways" "0"<br />
# Pressure Motion<br />
Option "PressureMotionMinZ" "29"<br />
Option "PressureMotionMaxZ" "159"<br />
Option "PressureMotionMinFactor" "1"<br />
Option "PressureMotionMaxFactor" "1"<br />
# Emulations<br />
Option "EmulateMidButtonTime" "75"<br />
Option "EmulateTwoFingerMinZ" "280"<br />
Option "EmulateTwoFingerMinW" "7"<br />
# Palm Detection<br />
Option "PalmDetect" "0"<br />
Option "PalmMinWidth" "10"<br />
Option "PalmMinZ" "199"<br />
EndSection</pre><br />
<br />
You can print all available options on your own (and their current values with this line:<br />
<br />
synclient -l | awk '/=/{printf "Option \"%s\" \"%s\"\n",$1,$3}'</div>Dongerdhttps://wiki.archlinux.org/index.php?title=NetworkManager&diff=119269NetworkManager2010-10-15T14:43:49Z<p>Dongerd: /* KDE4 */</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n|NetworkManager}}<br />
[[de:Networkmanager]]<br />
{{Article summary start}}<br />
{{Article summary text|Covers installation and configuration of NetworkManager &ndash; a set of co-operative tools that make networking simple and straightforward.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Wireless Setup}}<br />
{{Article summary end}}<br />
<br />
NetworkManager is a program for providing detection and configuration for systems to automatically connect to network. NetworkManager's functionality can be useful for both wireless and wired networks. For wireless networks, NetworkManager prefers known wireless networks and has the ability to be able to switch to the most reliable network. NetworkManager-aware applications can switch from online and offline mode. NetworkManager also prefers wired connections over wireless ones, has support for modem connections and certain types of VPN. NetworkManager was originally developed by RedHat and now is hosted by the GNOME project.<br />
<br />
== Base install ==<br />
<br />
NetworkManager is available in the official repositories:<br />
<br />
# pacman -S networkmanager<br />
<br />
== Graphical Front-ends ==<br />
<br />
To configure and have easy access to NetworkManager most people will want to install an applet. This GUI front-end usually resides in the system tray (or notification area) and allows network selection and configuration of NetworkManager. Various applets exist for different types of desktops.<br />
<br />
=== GNOME ===<br />
<br />
GNOME's applet (formerly gnome-network-manager) is lightweight enough and works across all environments:<br />
<br />
# pacman -S network-manager-applet<br />
<br />
If you want to store authentication details (Wireless/DSL) and enable global connection settings, i.e "available to all users":<br />
<br />
# pacman -S gnome-keyring<br />
<br />
=== KDE4 ===<br />
<br />
The KNetworkManager front-end has been made available in KDE version 4.4 as a plasma widget:<br />
<br />
# pacman -S kdeplasma-applets-networkmanagement<br />
<br />
The GNOME counterpart works just as nicely, or even better (has more features and detects more hardware).<br />
<br />
{{Note|If you are changing from another network managing tool like Wicd, do not forget to set the default 'Network Management Backend' in <br />
System Settings -> Hardware -> Information Sources}}<br />
<br />
=== KDE3 ===<br />
<br />
Though no longer supported, {{Package AUR|knetworkmanager}} is in the [[AUR]]. Package name:<br />
knetworkmanager<br />
<br />
=== Openbox ===<br />
<br />
The GNOME applet with the xfce4-notifyd notification daemon works well:<br />
<br />
# pacman -S network-manager-applet xfce4-notifyd hicolor-icon-theme gnome-icon-theme<br />
<br />
If you want to store authentication details (Wireless/DSL):<br />
<br />
# pacman -S gnome-keyring<br />
<br />
To prevent nm-applet dbus errors, edit ~/.xinitrc and change "exec openbox-session" to<br />
"exec ck-launch-session openbox-session".<br />
<br />
To have Openbox's autostart.sh start nm-applet properly, you may need to delete the file /etc/xdg/autostart/nm-applet.desktop (You may need to delete this file again after every update to network-manager-applet)<br />
<br />
Then in autostart.sh, start nm-applet with this line:<br />
<br />
(sleep 3 && /usr/bin/nm-applet --sm-disable) &<br />
<br />
=== Other Desktops and Window Managers ===<br />
<br />
It is recommended to use the GNOME applet. You'll also need to be sure that the GNOME hicolor theme is installed to be able to display the applet:<br />
<br />
# pacman -S hicolor-icon-theme gnome-icon-theme<br />
<br />
=== Command line ===<br />
<br />
cnetworkmanager, which is now available in the community repository, can be used to configure connections from the command line.<br />
<br />
# pacman -S cnetworkmanager<br />
<br />
== Configuration ==<br />
<br />
NetworkManager will require some additional steps to be able run properly.<br />
<br />
{{Note|Someone please verify how true this is. With just a pacman -S network-manager-applet everything works as expected. No hostname or networkmanager group set up. --- Confirmed, no hostname edit necessary for proper function here, network group was already added.}}<br />
<br />
=== Set hostname ===<br />
<br />
By default NetworkManager 0.7 will do a reverse lookup of your IP to determine your hostname to use to display to other networks. Because of how it handles it, generally this will result in a hostname of ''localhost'' or ''localhost.localdomain''. Having such a hostname and NetworkManagers attempts to manipulate it can occasionally cause crashes of the Xorg server ''(citation needed)''.<br />
<br />
To fix this, create a configuration that explicitly defines your hostname. Create the file {{Filename|/etc/NetworkManager/nm-system-settings.conf}} and add:<br />
<br />
<pre><br />
[main]<br />
plugins = keyfile<br />
<br />
[keyfile]<br />
hostname = <your hostname><br />
</pre><br />
<br />
Verify that your {{Filename|/etc/hosts}} is correct before continuing. If you previously tried to connect before doing this step, NetworkManager may have altered it. An example hostname line in {{Filename|/etc/hosts}}:<br />
<br />
<pre><br />
#<ip-address> <hostname.domain.org> <hostname> <br />
127.0.0.1 localhost.localdomain localhost dell-latitude<br />
</pre><br />
<br />
=== Add user to network and networkmanager groups ===<br />
<br />
To manipulate NetworkManager settings you will be required to be part of the network group OR the networkmanager group (you must create the networkmanager group first) ''(citation needed)''. Run the below commands after replacing ''USERNAME'' with your username.<br />
<br />
# gpasswd -a USERNAME network<br />
<br />
Alternatively:<br />
<br />
# groupadd networkmanager<br />
# gpasswd -a USERNAME networkmanager<br />
<br />
If you are not already a part of these groups, logout and back in for the changes to take effect.<br />
<br />
''(What is the purpose of this networkmanager group? Everything is possible with the network group.)''<br />
<br />
=== Disable current network setup ===<br />
<br />
You'll want to disable your current network setup to be able to properly test NetworkManager. First (if using the Arch Linux network scripts) stop the network:<br />
<br />
/etc/rc.d/network stop<br />
<br />
Bring down your NIC's (Network Interface Controllers, i.e. network cards). For example:<br />
<br />
ifconfig eth0 down<br />
ifconfig wlan0 down<br />
<br />
Edit {{Filename|/etc/rc.conf}} and where you defined DHCP or a static IP address, comment them out:<br />
<br />
<pre><br />
#eth0="dhcp" <br />
#wlan0="dhcp" <br />
INTERFACES=(!eth0 !wlan0)<br />
</pre><br />
<br />
=== Edit daemons ===<br />
<br />
You must ''remove'' the default '''network''' daemon and add the '''hal''' ''(needs citation; only dbus is needed)'', and '''networkmanager''' daemons in this order:<br />
<br />
DAEMONS=( ...'''hal networkmanager'''... )<br />
<br />
Be sure that the package {{Package Official|dbus}} is installed as NetworkManager will require it. The '''hal''' daemon also starts the '''dbus''' daemon, so you should not need to worry. Also, do ''not'' background hal as then the dependencies do not get loaded before (and in time for) '''networkmanager'''. To start other services (daemons) that require a network connection see the next section on how to set them up. Though the NetworkManager daemon has been started here, it will not (by default) connect onto a network until an applet is loaded and the applet specifies to do so. This means that networking services will need to be specified to NetworkManager on when to run.<br />
<br />
=== Network Services with NetworkManager Dispatcher===<br />
<br />
There are quite a few network services that you will not want running until NetworkManager brings up an interface. Good examples are '''openntpd''' and network filesystem mounts of various types (e.g. '''netfs'''). NetworkManager has the ability to start these services when you connect to a network (interface up), and stop them when you are no longer using them (interface down).<br />
<br />
To use this feature, scripts can be added to the {{Filename|/etc/NetworkManager/dispatcher.d}} directory. These scripts will need to have executable, user permissions. For security, it's good practice to make them owned by '''root:root''' and writable only by the owner. The scripts will be run in alphabetical order at connection time (with arguments ''interface up''), and in reverse alphabetical order at disconnect time (''interface down''). To ensure what order they come up in, it is common to use numerical characters prior to the name of the script (e.g. {{Filename|10_portmap}} or {{Filename|30_netfs}} (which ensures that the portmapper is up before NFS mounts are attempted).<br />
<br />
The following starts openntpd when an interface is brought up. Save the file as {{Filename|/etc/NetworkManager/dispatcher.d/20_openntpd}} and make it executable.<br />
<pre><br />
#!/bin/sh<br />
<br />
INTERFACE=$1 # The interface which is brought up or down<br />
STATUS=$2 # The new state of the interface<br />
<br />
case "$STATUS" in<br />
'up') # $INTERFACE is up<br />
exec /etc/rc.d/openntpd start<br />
;;<br />
'down') # $INTERFACE is down<br />
# Check for active interface and down if no one active<br />
if [ ! `nm-tool|grep State|cut -f2 -d' '` == "connected" ]; then<br />
exec /etc/rc.d/openntpd stop<br />
fi<br />
;;<br />
esac<br />
</pre><br />
<br />
{{Warning|if you connect to foreign or public networks, be aware of what services you are starting and what servers you expect to be available for them to connect to. You could make a security hole by starting the wrong services while connected to a public network.}}<br />
<br />
==== Use dispatcher to connect to a vpn after a network-connection is established ====<br />
<br />
In this example we want to connect automatically to a vpn-connection we defined previously with NetworkManager. First thing to to is to create the dispatcher-script that defines what to do after we connected to the network.<br />
<br />
1. Create the dispatcher script in {{Filename|/etc/NetworkManager/dispatcher.d/vpn-up}}<br />
<br />
case "$2" in<br />
up)<br />
sudo -u username DISPLAY=:0 /usr/bin/python /etc/NetworkManager/vpn-up.py<br />
;;<br />
esac<br />
<br />
Remember to make it executable with chmod +x and change '''username''' to the right one.<br />
<br />
2. Create the {{Filename|/etc/NetworkManager/vpn-up.py}} and change '''network-ESSID''' to the desired one. You'll find the code [http://dpaste.com/hold/203441/ here].<br />
<br />
Now NetworkManager should try to connect to your vpn which you had defined in your profile.<br />
<br />
=== Proxy settings ===<br />
<br />
Network Manager does not directly handle proxy settings.<br />
<br />
See: [[Proxy settings]]<br />
<br />
== Testing ==<br />
<br />
NetworkManager applets are designed to load upon login so no further configuration should be necessary for most users. If you have already disabled your previous network settings and disconnected from your network, you can now test if NetworkManager will work. First start the daemon:<br />
<br />
/etc/rc.d/networkmanager start<br />
<br />
Some applets will provide you with a .desktop file so that the NetworkManager applet can be loaded through the application menu. If it doesn't, you're going to either have to discover the command to use or logout and login again to start the applet. Once the applet is started, it will likely begin polling network connections with for auto-configuration with a DHCP server.<br />
<br />
To start the GNOME applet in non-xdg-compliant Window Managers like Awesome:<br />
<br />
nm-applet --sm-disable &<br />
<br />
For static IPs you will have to configure NetworkManager to understand them. The process usually involves right-clicking the applet and selecting something like 'Edit Connections'.<br />
<br />
==Troubleshooting==<br />
<br />
Some fixes to common problems.<br />
<br />
=== Network Management Disabled ===<br />
<br />
Sometimes when NM shuts down the pid (state) file does not get removed and you will get a 'Network management disabled' message. If this happens, you'l have to remove it manually:<br />
<br />
rm /var/lib/NetworkManager/NetworkManager.state<br />
<br />
If this happens upon reboot, you can add an action to your {{Filename|etc/rc.local}} to have it removed upon bootup:<br />
<br />
<pre>nmpid=/var/lib/NetworkManager/NetworkManager.state<br />
[ -f $nmpid ] && rm $nmpid</pre><br />
<br />
=== NetworkManager prevents DHCPCD from using resolv.conf.head and resolv.conf.tail ===<br />
<br />
Sometimes it's problematic to add static items to resolv.conf when it's constantly rewritten by nm and dhcpcd. You can use networkmanager-dhclient package from AUR but a better solution is to use this simple script:<br />
<br />
<pre><br />
#!/bin/bash<br />
# <br />
# /etc/NetworkManager/dispatcher.d/99-resolv.conf-head_and_tail<br />
# Include /etc/resolv.conf.head and /etc/resolv.conf.tail to /etc/resolv.conf<br />
#<br />
# scripts in the /etc/NetworkManager/dispatcher.d/ directory<br />
# are called alphabetically and are passed two parameters:<br />
# $1 is the interface name, and $2 is “up” or “down” as the<br />
# case may be.<br />
<br />
resolvconf='/etc/resolv.conf';<br />
cat "$resolvconf"{.head,,.tail} 2>/dev/null > "$resolvconf".tmp<br />
mv -f "$resolvconf".tmp "$resolvconf"<br />
</pre><br />
<br />
===DHCP problems===<br />
If you have problems with getting an IP via DHCP try to add the following to your {{Filename|/etc/dhclient.conf}}:<br />
interface "eth0" {<br />
send dhcp-client-identifier 01:aa:bb:cc:dd:ee:ff;<br />
}<br />
Where {{Codeline|aa:bb:cc:dd:ee:ff}} is the MAC-adress of this NIC.<br />
<br />
===How to bypass Gnome keyring for normal users connecting with wireless===<br />
It's super simple! First, create a group called '''networkmanager''' with the following command (or any other method you prefer):<br />
# groupadd networkmanager<br />
<br />
Then add your user to that group using the following command (or any other preferred method):<br />
# gpasswd -a username networkmanager<br />
Replace username in the above command with your actual username.<br />
<br />
Now, as root, launch nm-connection-editor and configure the connections:<br />
# nm-connection-editor<br />
Put a check mark next to "Available to all users" and apply the settings. <br />
<br />
Now you won't be bothered by Gnome keyring! ''(citation needed)''<br />
Also, if you additionally enable "connect automatically", your connection will be available and connected before you even log in to your desktop, making your whole startup process even faster!<br />
<br />
===Problems starting nm-applet as normal user===<br />
Sometimes, the gnome applet fails to start with the following error:<br />
** (nm-applet:2941): WARNING **: <WARN> applet_dbus_manager_start_service(): Could not acquire the NetworkManagerUserSettings<br />
service.<br />
Message: 'Connection ":1.19" is not allowed to own the service "org.freedesktop.NetworkManagerUserSettings" due to security<br />
policies in the configuration file'<br />
<br />
Or if you can see the nm-applet icon in xfce4's panel's notification area while login as root but can't see it if login as a normal user, it could indicate you need to modify the policy settings to get nm-applet started as normal user. (Try to start nm-applet in terminal as normal user will give you the error above.)<br />
<br />
This depends on NetworkManager changing its behaviour since version 0.7, ignoring the "network" group altogether and instead uses ConsoleKit, which seems to be problematic at times ''(citation needed)''. This solution was provided by ''madhatter'':<br />
<br />
Add the following to your /etc/dbus-1/system.d/NetworkManager.conf<br />
<br />
<policy group="network"><br />
<allow send_destination="org.freedesktop.NetworkManager"<br />
send_interface="org.freedesktop.NetworkManager"/><br />
</policy><br />
<br />
And to /etc/dbus-1/system.d/nm-applet.conf<br />
<br />
<policy group="network"><br />
<allow own="org.freedesktop.NetworkManagerUserSettings"/><br />
<allow send_destination="org.freedesktop.NetworkManagerUserSettings"<br />
send_interface="org.freedesktop.NetworkManagerUserSettings"/><br />
<br />
<deny send_interface="org.freedesktop.NetworkManagerSettings.Secrets"/><br />
</policy><br />
<br />
Log out and once you log back in you should be able to run nm-applet and then in the panel be able to select any network, type the password for that network and then you are ready to go.<br />
<br />
For OpenVpn you need to add following line in {{filename|/etc/dbus-1/system.d/NetworkManager.conf}}<br />
<allow send_destination="org.freedesktop.NetworkManager"<br />
send_interface="org.freedesktop.NetworkManager.openvpn"/><br />
in section {{codeline|<nowiki><policy at_console="true"></nowiki>}}.<br />
<br />
===Missing default route===<br />
On at least one KDE4 system, no default route was created when establishing wireless connections with NetworkManager. Changing the route settings of the wireless connection to remove the default selection "Use only for resources on this connection" solved the issue.<br />
<br />
===3G modem not detected===<br />
If NetworkManager (from v0.7.999) does not detect your 3G modem, but you still can connect using [[wvdial]], try installing <br />
[http://www.archlinux.org/packages/extra/i686/modemmanager/ modemmanager] package using {{Codeline|pacman -S modemmanager}} and restart NetworkManager daemon with {{Codeline|/etc/rc.d/networkmanager restart}}. Replug your modem or restart. This utility provides support for hardware not in networkmanager's default database.<br />
<br />
===VPN problems in Networkmanager 0.7.999===<br />
If you get the error message "invalid secrets" when trying to connect to your VPN provider using the PPTP protocol, try installing the git versions instead: [http://aur.archlinux.org/packages.php?ID=22349 networkmanager], [http://aur.archlinux.org/packages.php?ID=26516 nm-applet] and the [http://aur.archlinux.org/packages.php?ID=29178 pptp plugin].<br />
<br />
===PolicyKit issues===<br />
{{Note|Following is probably not need for KDE 4 anymore, as there should be PolicyKit integration as of KDE 4.3. At least with knetworkmanager from [kdemod-core], the author did not run into any troubles.}}<br />
<br />
Because many Display Managers (including KDM) do not natively support policykit at login, you will run into some permission issues with D-Bus and NetworkManager.<br />
<br />
While there are several options to resolve this issue, choose ''only'' one:<br />
<br />
* Install Consolekit and add the following line to {{Filename|/etc/pam.d/kde}}:<br />
session optional pam_ck_connector.so<br />
{{Warning|This may cause the malfunction of KDE PowerDevil.}}<br />
<br />
* Add the following lines to {{Filename|/etc/dbus-1/system.d/NetworkManager.conf}}:<br />
<policy group="users"><br />
<allow send_destination="org.freedesktop.NetworkManager"/><br />
<allow send_interface="org.freedesktop.NetworkManager"/><br />
</policy><br />
:If this does not work, check if there are any policy errors by starting NetworkManager manually:<br />
# kill `pidof NetworkManager`<br />
# NetworkManager --no-daemon<br />
<br />
* Put the following script in ~/.kde4/Autostart or similar for other WMs or DEs:<br />
#!/bin/bash<br />
ck-launch-session<br />
<br />
* If none of those work, refer to this thread: http://bbs.archlinux.org/viewtopic.php?id=63576<br />
<br />
===Switching off WLAN on laptops===<br />
<br />
Sometimes networkmanager won't work when you disable your Wifi-adapter with a switch on your laptop and try to enable it again afterwards. This is often a problem with rfkill. Install rfkill from the repo:<br />
<br />
# pacman -S rfkill<br />
<br />
and use <br />
<br />
$ watch -n1 rfkill list all<br />
<br />
to check if the driver notifies rfkill about the wireless adapter's status.<br />
If one identifier stays blocked after you switch on the adapter you could try to manually unblock it with (where X is the number of the identifier provided by the above output):<br />
<br />
# rfkill event unblock X<br />
<br />
===Static IP Settings Revert To DHCP===<br />
<br />
Due to an unresolved bug, when changing default connections to static IP, nm-applet may not properly store the configuration change, and will revert to automatic DHCP. A workaround for this issue follows.<br />
<br />
Edit the default connection (eg "Auto eth0") in nm-applet. Change the connection name (eg "my eth0"), uncheck the "Available to all users" checkbox, change your static IP settings as desired, and click Apply. This will save a new connection with the given name.<br />
<br />
Next, you will want to make the default connection not connect automatically. To do so, run<br />
<br />
$ sudo nm-connection-editor # you must use sudo, not su<br />
<br />
In the connection editor, edit the default connection (eg "Auto eth0") and uncheck "Connect automatically". Click Apply and close the connection editor.<br />
<br />
==Tips and tricks==<br />
<br />
===Checking if networking is up inside a cron job or script===<br />
Some cron jobs require networking to be up to succeed. You may wish to avoid running these jobs when the network is down. To accomplish this, add an '''if''' test for networking that queries NetworkManager's '''nm-tool''' and checks the state of networking. The test shown here succeeds if any interface is up, and fails if they are all down. This is convenient for laptops that might be hardwired, might be on wireless, or might be off the network. <br />
if [ `nm-tool|grep State|cut -f2 -d' '` == "connected" ]; then<br />
#Whatever you want to do if the network is online<br />
else<br />
#Whatever you want to do if the network is offline - note, this and the else above are optional<br />
fi<br />
<br />
This useful for a cron.hourly script that runs '''fpupdate''' for the F-Prot virus scanner signature update, as an example. Another way it might be useful, with a little modification, is to differentiate between networks using various parts of the output from '''nm-tool'''; for example, since the active wireless network is denoted with an asterisk, you could grep for the network name and then grep for a literal asterisk.<br />
<br />
===Automatically unlock keyring after login===<br />
==== Gnome ====<br />
# Right click on the NM icon in your panel and select Edit Connections and open the Wireless tab<br />
# Select the connection you want to work with and click the Edit button<br />
# Check the boxes “Connect Automatically” and “Available to all users”<br />
Log out and log back in to complete.<br />
<br />
{{Note|The following method is dated and known not to work on at least one machine!}}<br />
''*In {{Filename|/etc/pam.d/gdm}} (or your corresponding daemon in /etc/pam.d), add these lines at the end of the "auth" and "session" blocks if they do not exist already: <br />
auth optional pam_gnome_keyring.so<br />
session optional pam_gnome_keyring.so auto_start<br />
<br />
*In {{Filename|/etc/pam.d/passwd}}, use this line for the 'password' block:<br />
password optional pam_gnome_keyring.so<br />
<br />
:Next time you log in, you should be asked if you want the password to be unlocked automatically on login.''<br />
<br />
==== KDE ====<br />
{{Note|See http://live.gnome.org/GnomeKeyring/Pam for reference, and if you are using kde / kdm, you can use pam-keyring-tool from the AUR.}}<br />
<br />
*Put a script like the following in ~/.kde4/Autostart:<br />
$!/bin/sh<br />
echo PASSWORD | /usr/bin/pam-keyring-tool --unlock --keyring=default -s<br />
:Similar should work with openbox, lxde, etc.<br />
<br />
===Automatically connect on boot ===<br />
Since version 0.7 the NetworkManager is able to connect on boot, before a user has logged in and unlocked the keyring.<br />
<br />
*First make sure that the keyfile plugin is loaded; {{Filename|/etc/NetworkManager/nm-system-settings.conf}} should look like this:<br />
[main]<br />
plugins=keyfile<br />
<br />
*If this was not in the file before, you have to restart '''nm-system-settings''':<br />
# killall -TERM nm-system-settings<br />
:or simply reboot.<br />
<br />
*Now grant your user the right to modify system-connections:<br />
<br />
With <b>polkit</b>:<br />
<br />
Place the following in /etc/polkit-1/localauthority/50-local.d/10-org-freedesktop-network-manager-settings.pkla<br />
<br />
<pre><br />
[Allow user YOURUSERNAME to create wireless connections for all users]<br />
Identity=unix-user:YOURUSERNAME<br />
Action=org.freedesktop.network-manager-settings.system.modify<br />
ResultAny=no<br />
ResultInactive=no<br />
ResultActive=yes<br />
</pre><br />
<br />
:Finally, in the connection-editor (of the gnome applet), check the '''Available to all users''' box.<br />
<br />
The connection is now saved in '''/etc/NetworkManager/system-connections/"CONNECTION NAME"'''. On reboot, NetworkManager will try to connect to it, when in range.<br />
<br />
{{Note|1=As per [https://bugs.kde.org/show_bug.cgi?id=204340 this] bug report, <tt>knetworkmanager</tt> does not yet implement this feature. You will need to use the GNOME network applet (<tt>nm-applet</tt>). Install it as described above in this page, <tt>"killall knetworkmanager"</tt>, then start <tt>nm-applet</tt>.<br />
<br>Please vote for the bug!}}<br />
<br />
===Ignore specific devices===<br />
Sometimes it is desired, that network manager ignores some devices and do not try to get an IP.<br />
<br />
*First you have to find out the Hal UDI (e.g. with lshal):<br />
...<br />
info.product = 'Networking Interface' (string)<br />
info.subsystem = 'net' (string)<br />
info.udi = '/org/freedesktop/Hal/devices/net_00_1f_11_01_06_55' (string)<br />
linux.hotplug_type = 2 (0x2) (int)<br />
linux.subsystem = 'net' (string)<br />
...<br />
<br />
*Add the udi to /etc/NetworkManager/nm-system-settings.conf:<br />
[keyfile]<br />
unmanaged-devices=/org/freedesktop/Hal/devices/net_00_1f_11_01_06_55<br />
<br />
:Multiple devices can be specified, delimited by semicolons:<br />
<br />
[keyfile]<br />
unmanaged-devices=/org/freedesktop/Hal/devices/net_00_1f_11_01_06_55;/org/freedesktop/Hal/devices/net_00_2c_6d_e2_08_af<br />
<br />
You do not need to restart NetworkManager for the changes to take effect.<br />
<br />
*Ignoring a type of device at boot time.<br />
this script was used to ignore all ethernet devices at boot time of a archiso build, it can be changed to ignore wifi devices etc.<br />
/!\being used on a non-persistant filesystem, the nm-system-settings.conf is default at run time<br />
#!/bin/sh<br />
# author: tim noise <darknoise@drkns.net><br />
COUNT=0<br />
TARGET_FILE="/etc/NetworkManager/nm-system-settings.conf"<br />
for i in `lshal | grep -A6 'Networking Interface' | awk -F "'" '/info.udi = / {print $2}'`; do<br />
if [ $COUNT = 0 ]; then<br />
COUNT=$COUNT+1;<br />
echo "unmanaged-devices=$i" >> $TARGET_FILE<br />
else<br />
echo -n ";$i" >> $TARGET_FILE<br />
fi<br />
done<br />
printf "\n" >> $TARGET_FILE</div>Dongerdhttps://wiki.archlinux.org/index.php?title=NetworkManager&diff=119268NetworkManager2010-10-15T14:43:08Z<p>Dongerd: /* KDE4 */</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n|NetworkManager}}<br />
[[de:Networkmanager]]<br />
{{Article summary start}}<br />
{{Article summary text|Covers installation and configuration of NetworkManager &ndash; a set of co-operative tools that make networking simple and straightforward.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Wireless Setup}}<br />
{{Article summary end}}<br />
<br />
NetworkManager is a program for providing detection and configuration for systems to automatically connect to network. NetworkManager's functionality can be useful for both wireless and wired networks. For wireless networks, NetworkManager prefers known wireless networks and has the ability to be able to switch to the most reliable network. NetworkManager-aware applications can switch from online and offline mode. NetworkManager also prefers wired connections over wireless ones, has support for modem connections and certain types of VPN. NetworkManager was originally developed by RedHat and now is hosted by the GNOME project.<br />
<br />
== Base install ==<br />
<br />
NetworkManager is available in the official repositories:<br />
<br />
# pacman -S networkmanager<br />
<br />
== Graphical Front-ends ==<br />
<br />
To configure and have easy access to NetworkManager most people will want to install an applet. This GUI front-end usually resides in the system tray (or notification area) and allows network selection and configuration of NetworkManager. Various applets exist for different types of desktops.<br />
<br />
=== GNOME ===<br />
<br />
GNOME's applet (formerly gnome-network-manager) is lightweight enough and works across all environments:<br />
<br />
# pacman -S network-manager-applet<br />
<br />
If you want to store authentication details (Wireless/DSL) and enable global connection settings, i.e "available to all users":<br />
<br />
# pacman -S gnome-keyring<br />
<br />
=== KDE4 ===<br />
<br />
The KNetworkManager front-end has been made available in KDE version 4.4 as a plasma widget:<br />
<br />
# pacman -S kdeplasma-applets-networkmanagement<br />
<br />
The GNOME counterpart works just as nicely, or even better (has more features and detects more hardware).<br />
<br />
{{Note|If you are changing from another network managing tool like Wicd, do not forget to set the default ''''Network Management Backend'''' in <br />
'''System Settings -> Hardware -> Information Sources'''}}<br />
<br />
=== KDE3 ===<br />
<br />
Though no longer supported, {{Package AUR|knetworkmanager}} is in the [[AUR]]. Package name:<br />
knetworkmanager<br />
<br />
=== Openbox ===<br />
<br />
The GNOME applet with the xfce4-notifyd notification daemon works well:<br />
<br />
# pacman -S network-manager-applet xfce4-notifyd hicolor-icon-theme gnome-icon-theme<br />
<br />
If you want to store authentication details (Wireless/DSL):<br />
<br />
# pacman -S gnome-keyring<br />
<br />
To prevent nm-applet dbus errors, edit ~/.xinitrc and change "exec openbox-session" to<br />
"exec ck-launch-session openbox-session".<br />
<br />
To have Openbox's autostart.sh start nm-applet properly, you may need to delete the file /etc/xdg/autostart/nm-applet.desktop (You may need to delete this file again after every update to network-manager-applet)<br />
<br />
Then in autostart.sh, start nm-applet with this line:<br />
<br />
(sleep 3 && /usr/bin/nm-applet --sm-disable) &<br />
<br />
=== Other Desktops and Window Managers ===<br />
<br />
It is recommended to use the GNOME applet. You'll also need to be sure that the GNOME hicolor theme is installed to be able to display the applet:<br />
<br />
# pacman -S hicolor-icon-theme gnome-icon-theme<br />
<br />
=== Command line ===<br />
<br />
cnetworkmanager, which is now available in the community repository, can be used to configure connections from the command line.<br />
<br />
# pacman -S cnetworkmanager<br />
<br />
== Configuration ==<br />
<br />
NetworkManager will require some additional steps to be able run properly.<br />
<br />
{{Note|Someone please verify how true this is. With just a pacman -S network-manager-applet everything works as expected. No hostname or networkmanager group set up. --- Confirmed, no hostname edit necessary for proper function here, network group was already added.}}<br />
<br />
=== Set hostname ===<br />
<br />
By default NetworkManager 0.7 will do a reverse lookup of your IP to determine your hostname to use to display to other networks. Because of how it handles it, generally this will result in a hostname of ''localhost'' or ''localhost.localdomain''. Having such a hostname and NetworkManagers attempts to manipulate it can occasionally cause crashes of the Xorg server ''(citation needed)''.<br />
<br />
To fix this, create a configuration that explicitly defines your hostname. Create the file {{Filename|/etc/NetworkManager/nm-system-settings.conf}} and add:<br />
<br />
<pre><br />
[main]<br />
plugins = keyfile<br />
<br />
[keyfile]<br />
hostname = <your hostname><br />
</pre><br />
<br />
Verify that your {{Filename|/etc/hosts}} is correct before continuing. If you previously tried to connect before doing this step, NetworkManager may have altered it. An example hostname line in {{Filename|/etc/hosts}}:<br />
<br />
<pre><br />
#<ip-address> <hostname.domain.org> <hostname> <br />
127.0.0.1 localhost.localdomain localhost dell-latitude<br />
</pre><br />
<br />
=== Add user to network and networkmanager groups ===<br />
<br />
To manipulate NetworkManager settings you will be required to be part of the network group OR the networkmanager group (you must create the networkmanager group first) ''(citation needed)''. Run the below commands after replacing ''USERNAME'' with your username.<br />
<br />
# gpasswd -a USERNAME network<br />
<br />
Alternatively:<br />
<br />
# groupadd networkmanager<br />
# gpasswd -a USERNAME networkmanager<br />
<br />
If you are not already a part of these groups, logout and back in for the changes to take effect.<br />
<br />
''(What is the purpose of this networkmanager group? Everything is possible with the network group.)''<br />
<br />
=== Disable current network setup ===<br />
<br />
You'll want to disable your current network setup to be able to properly test NetworkManager. First (if using the Arch Linux network scripts) stop the network:<br />
<br />
/etc/rc.d/network stop<br />
<br />
Bring down your NIC's (Network Interface Controllers, i.e. network cards). For example:<br />
<br />
ifconfig eth0 down<br />
ifconfig wlan0 down<br />
<br />
Edit {{Filename|/etc/rc.conf}} and where you defined DHCP or a static IP address, comment them out:<br />
<br />
<pre><br />
#eth0="dhcp" <br />
#wlan0="dhcp" <br />
INTERFACES=(!eth0 !wlan0)<br />
</pre><br />
<br />
=== Edit daemons ===<br />
<br />
You must ''remove'' the default '''network''' daemon and add the '''hal''' ''(needs citation; only dbus is needed)'', and '''networkmanager''' daemons in this order:<br />
<br />
DAEMONS=( ...'''hal networkmanager'''... )<br />
<br />
Be sure that the package {{Package Official|dbus}} is installed as NetworkManager will require it. The '''hal''' daemon also starts the '''dbus''' daemon, so you should not need to worry. Also, do ''not'' background hal as then the dependencies do not get loaded before (and in time for) '''networkmanager'''. To start other services (daemons) that require a network connection see the next section on how to set them up. Though the NetworkManager daemon has been started here, it will not (by default) connect onto a network until an applet is loaded and the applet specifies to do so. This means that networking services will need to be specified to NetworkManager on when to run.<br />
<br />
=== Network Services with NetworkManager Dispatcher===<br />
<br />
There are quite a few network services that you will not want running until NetworkManager brings up an interface. Good examples are '''openntpd''' and network filesystem mounts of various types (e.g. '''netfs'''). NetworkManager has the ability to start these services when you connect to a network (interface up), and stop them when you are no longer using them (interface down).<br />
<br />
To use this feature, scripts can be added to the {{Filename|/etc/NetworkManager/dispatcher.d}} directory. These scripts will need to have executable, user permissions. For security, it's good practice to make them owned by '''root:root''' and writable only by the owner. The scripts will be run in alphabetical order at connection time (with arguments ''interface up''), and in reverse alphabetical order at disconnect time (''interface down''). To ensure what order they come up in, it is common to use numerical characters prior to the name of the script (e.g. {{Filename|10_portmap}} or {{Filename|30_netfs}} (which ensures that the portmapper is up before NFS mounts are attempted).<br />
<br />
The following starts openntpd when an interface is brought up. Save the file as {{Filename|/etc/NetworkManager/dispatcher.d/20_openntpd}} and make it executable.<br />
<pre><br />
#!/bin/sh<br />
<br />
INTERFACE=$1 # The interface which is brought up or down<br />
STATUS=$2 # The new state of the interface<br />
<br />
case "$STATUS" in<br />
'up') # $INTERFACE is up<br />
exec /etc/rc.d/openntpd start<br />
;;<br />
'down') # $INTERFACE is down<br />
# Check for active interface and down if no one active<br />
if [ ! `nm-tool|grep State|cut -f2 -d' '` == "connected" ]; then<br />
exec /etc/rc.d/openntpd stop<br />
fi<br />
;;<br />
esac<br />
</pre><br />
<br />
{{Warning|if you connect to foreign or public networks, be aware of what services you are starting and what servers you expect to be available for them to connect to. You could make a security hole by starting the wrong services while connected to a public network.}}<br />
<br />
==== Use dispatcher to connect to a vpn after a network-connection is established ====<br />
<br />
In this example we want to connect automatically to a vpn-connection we defined previously with NetworkManager. First thing to to is to create the dispatcher-script that defines what to do after we connected to the network.<br />
<br />
1. Create the dispatcher script in {{Filename|/etc/NetworkManager/dispatcher.d/vpn-up}}<br />
<br />
case "$2" in<br />
up)<br />
sudo -u username DISPLAY=:0 /usr/bin/python /etc/NetworkManager/vpn-up.py<br />
;;<br />
esac<br />
<br />
Remember to make it executable with chmod +x and change '''username''' to the right one.<br />
<br />
2. Create the {{Filename|/etc/NetworkManager/vpn-up.py}} and change '''network-ESSID''' to the desired one. You'll find the code [http://dpaste.com/hold/203441/ here].<br />
<br />
Now NetworkManager should try to connect to your vpn which you had defined in your profile.<br />
<br />
=== Proxy settings ===<br />
<br />
Network Manager does not directly handle proxy settings.<br />
<br />
See: [[Proxy settings]]<br />
<br />
== Testing ==<br />
<br />
NetworkManager applets are designed to load upon login so no further configuration should be necessary for most users. If you have already disabled your previous network settings and disconnected from your network, you can now test if NetworkManager will work. First start the daemon:<br />
<br />
/etc/rc.d/networkmanager start<br />
<br />
Some applets will provide you with a .desktop file so that the NetworkManager applet can be loaded through the application menu. If it doesn't, you're going to either have to discover the command to use or logout and login again to start the applet. Once the applet is started, it will likely begin polling network connections with for auto-configuration with a DHCP server.<br />
<br />
To start the GNOME applet in non-xdg-compliant Window Managers like Awesome:<br />
<br />
nm-applet --sm-disable &<br />
<br />
For static IPs you will have to configure NetworkManager to understand them. The process usually involves right-clicking the applet and selecting something like 'Edit Connections'.<br />
<br />
==Troubleshooting==<br />
<br />
Some fixes to common problems.<br />
<br />
=== Network Management Disabled ===<br />
<br />
Sometimes when NM shuts down the pid (state) file does not get removed and you will get a 'Network management disabled' message. If this happens, you'l have to remove it manually:<br />
<br />
rm /var/lib/NetworkManager/NetworkManager.state<br />
<br />
If this happens upon reboot, you can add an action to your {{Filename|etc/rc.local}} to have it removed upon bootup:<br />
<br />
<pre>nmpid=/var/lib/NetworkManager/NetworkManager.state<br />
[ -f $nmpid ] && rm $nmpid</pre><br />
<br />
=== NetworkManager prevents DHCPCD from using resolv.conf.head and resolv.conf.tail ===<br />
<br />
Sometimes it's problematic to add static items to resolv.conf when it's constantly rewritten by nm and dhcpcd. You can use networkmanager-dhclient package from AUR but a better solution is to use this simple script:<br />
<br />
<pre><br />
#!/bin/bash<br />
# <br />
# /etc/NetworkManager/dispatcher.d/99-resolv.conf-head_and_tail<br />
# Include /etc/resolv.conf.head and /etc/resolv.conf.tail to /etc/resolv.conf<br />
#<br />
# scripts in the /etc/NetworkManager/dispatcher.d/ directory<br />
# are called alphabetically and are passed two parameters:<br />
# $1 is the interface name, and $2 is “up” or “down” as the<br />
# case may be.<br />
<br />
resolvconf='/etc/resolv.conf';<br />
cat "$resolvconf"{.head,,.tail} 2>/dev/null > "$resolvconf".tmp<br />
mv -f "$resolvconf".tmp "$resolvconf"<br />
</pre><br />
<br />
===DHCP problems===<br />
If you have problems with getting an IP via DHCP try to add the following to your {{Filename|/etc/dhclient.conf}}:<br />
interface "eth0" {<br />
send dhcp-client-identifier 01:aa:bb:cc:dd:ee:ff;<br />
}<br />
Where {{Codeline|aa:bb:cc:dd:ee:ff}} is the MAC-adress of this NIC.<br />
<br />
===How to bypass Gnome keyring for normal users connecting with wireless===<br />
It's super simple! First, create a group called '''networkmanager''' with the following command (or any other method you prefer):<br />
# groupadd networkmanager<br />
<br />
Then add your user to that group using the following command (or any other preferred method):<br />
# gpasswd -a username networkmanager<br />
Replace username in the above command with your actual username.<br />
<br />
Now, as root, launch nm-connection-editor and configure the connections:<br />
# nm-connection-editor<br />
Put a check mark next to "Available to all users" and apply the settings. <br />
<br />
Now you won't be bothered by Gnome keyring! ''(citation needed)''<br />
Also, if you additionally enable "connect automatically", your connection will be available and connected before you even log in to your desktop, making your whole startup process even faster!<br />
<br />
===Problems starting nm-applet as normal user===<br />
Sometimes, the gnome applet fails to start with the following error:<br />
** (nm-applet:2941): WARNING **: <WARN> applet_dbus_manager_start_service(): Could not acquire the NetworkManagerUserSettings<br />
service.<br />
Message: 'Connection ":1.19" is not allowed to own the service "org.freedesktop.NetworkManagerUserSettings" due to security<br />
policies in the configuration file'<br />
<br />
Or if you can see the nm-applet icon in xfce4's panel's notification area while login as root but can't see it if login as a normal user, it could indicate you need to modify the policy settings to get nm-applet started as normal user. (Try to start nm-applet in terminal as normal user will give you the error above.)<br />
<br />
This depends on NetworkManager changing its behaviour since version 0.7, ignoring the "network" group altogether and instead uses ConsoleKit, which seems to be problematic at times ''(citation needed)''. This solution was provided by ''madhatter'':<br />
<br />
Add the following to your /etc/dbus-1/system.d/NetworkManager.conf<br />
<br />
<policy group="network"><br />
<allow send_destination="org.freedesktop.NetworkManager"<br />
send_interface="org.freedesktop.NetworkManager"/><br />
</policy><br />
<br />
And to /etc/dbus-1/system.d/nm-applet.conf<br />
<br />
<policy group="network"><br />
<allow own="org.freedesktop.NetworkManagerUserSettings"/><br />
<allow send_destination="org.freedesktop.NetworkManagerUserSettings"<br />
send_interface="org.freedesktop.NetworkManagerUserSettings"/><br />
<br />
<deny send_interface="org.freedesktop.NetworkManagerSettings.Secrets"/><br />
</policy><br />
<br />
Log out and once you log back in you should be able to run nm-applet and then in the panel be able to select any network, type the password for that network and then you are ready to go.<br />
<br />
For OpenVpn you need to add following line in {{filename|/etc/dbus-1/system.d/NetworkManager.conf}}<br />
<allow send_destination="org.freedesktop.NetworkManager"<br />
send_interface="org.freedesktop.NetworkManager.openvpn"/><br />
in section {{codeline|<nowiki><policy at_console="true"></nowiki>}}.<br />
<br />
===Missing default route===<br />
On at least one KDE4 system, no default route was created when establishing wireless connections with NetworkManager. Changing the route settings of the wireless connection to remove the default selection "Use only for resources on this connection" solved the issue.<br />
<br />
===3G modem not detected===<br />
If NetworkManager (from v0.7.999) does not detect your 3G modem, but you still can connect using [[wvdial]], try installing <br />
[http://www.archlinux.org/packages/extra/i686/modemmanager/ modemmanager] package using {{Codeline|pacman -S modemmanager}} and restart NetworkManager daemon with {{Codeline|/etc/rc.d/networkmanager restart}}. Replug your modem or restart. This utility provides support for hardware not in networkmanager's default database.<br />
<br />
===VPN problems in Networkmanager 0.7.999===<br />
If you get the error message "invalid secrets" when trying to connect to your VPN provider using the PPTP protocol, try installing the git versions instead: [http://aur.archlinux.org/packages.php?ID=22349 networkmanager], [http://aur.archlinux.org/packages.php?ID=26516 nm-applet] and the [http://aur.archlinux.org/packages.php?ID=29178 pptp plugin].<br />
<br />
===PolicyKit issues===<br />
{{Note|Following is probably not need for KDE 4 anymore, as there should be PolicyKit integration as of KDE 4.3. At least with knetworkmanager from [kdemod-core], the author did not run into any troubles.}}<br />
<br />
Because many Display Managers (including KDM) do not natively support policykit at login, you will run into some permission issues with D-Bus and NetworkManager.<br />
<br />
While there are several options to resolve this issue, choose ''only'' one:<br />
<br />
* Install Consolekit and add the following line to {{Filename|/etc/pam.d/kde}}:<br />
session optional pam_ck_connector.so<br />
{{Warning|This may cause the malfunction of KDE PowerDevil.}}<br />
<br />
* Add the following lines to {{Filename|/etc/dbus-1/system.d/NetworkManager.conf}}:<br />
<policy group="users"><br />
<allow send_destination="org.freedesktop.NetworkManager"/><br />
<allow send_interface="org.freedesktop.NetworkManager"/><br />
</policy><br />
:If this does not work, check if there are any policy errors by starting NetworkManager manually:<br />
# kill `pidof NetworkManager`<br />
# NetworkManager --no-daemon<br />
<br />
* Put the following script in ~/.kde4/Autostart or similar for other WMs or DEs:<br />
#!/bin/bash<br />
ck-launch-session<br />
<br />
* If none of those work, refer to this thread: http://bbs.archlinux.org/viewtopic.php?id=63576<br />
<br />
===Switching off WLAN on laptops===<br />
<br />
Sometimes networkmanager won't work when you disable your Wifi-adapter with a switch on your laptop and try to enable it again afterwards. This is often a problem with rfkill. Install rfkill from the repo:<br />
<br />
# pacman -S rfkill<br />
<br />
and use <br />
<br />
$ watch -n1 rfkill list all<br />
<br />
to check if the driver notifies rfkill about the wireless adapter's status.<br />
If one identifier stays blocked after you switch on the adapter you could try to manually unblock it with (where X is the number of the identifier provided by the above output):<br />
<br />
# rfkill event unblock X<br />
<br />
===Static IP Settings Revert To DHCP===<br />
<br />
Due to an unresolved bug, when changing default connections to static IP, nm-applet may not properly store the configuration change, and will revert to automatic DHCP. A workaround for this issue follows.<br />
<br />
Edit the default connection (eg "Auto eth0") in nm-applet. Change the connection name (eg "my eth0"), uncheck the "Available to all users" checkbox, change your static IP settings as desired, and click Apply. This will save a new connection with the given name.<br />
<br />
Next, you will want to make the default connection not connect automatically. To do so, run<br />
<br />
$ sudo nm-connection-editor # you must use sudo, not su<br />
<br />
In the connection editor, edit the default connection (eg "Auto eth0") and uncheck "Connect automatically". Click Apply and close the connection editor.<br />
<br />
==Tips and tricks==<br />
<br />
===Checking if networking is up inside a cron job or script===<br />
Some cron jobs require networking to be up to succeed. You may wish to avoid running these jobs when the network is down. To accomplish this, add an '''if''' test for networking that queries NetworkManager's '''nm-tool''' and checks the state of networking. The test shown here succeeds if any interface is up, and fails if they are all down. This is convenient for laptops that might be hardwired, might be on wireless, or might be off the network. <br />
if [ `nm-tool|grep State|cut -f2 -d' '` == "connected" ]; then<br />
#Whatever you want to do if the network is online<br />
else<br />
#Whatever you want to do if the network is offline - note, this and the else above are optional<br />
fi<br />
<br />
This useful for a cron.hourly script that runs '''fpupdate''' for the F-Prot virus scanner signature update, as an example. Another way it might be useful, with a little modification, is to differentiate between networks using various parts of the output from '''nm-tool'''; for example, since the active wireless network is denoted with an asterisk, you could grep for the network name and then grep for a literal asterisk.<br />
<br />
===Automatically unlock keyring after login===<br />
==== Gnome ====<br />
# Right click on the NM icon in your panel and select Edit Connections and open the Wireless tab<br />
# Select the connection you want to work with and click the Edit button<br />
# Check the boxes “Connect Automatically” and “Available to all users”<br />
Log out and log back in to complete.<br />
<br />
{{Note|The following method is dated and known not to work on at least one machine!}}<br />
''*In {{Filename|/etc/pam.d/gdm}} (or your corresponding daemon in /etc/pam.d), add these lines at the end of the "auth" and "session" blocks if they do not exist already: <br />
auth optional pam_gnome_keyring.so<br />
session optional pam_gnome_keyring.so auto_start<br />
<br />
*In {{Filename|/etc/pam.d/passwd}}, use this line for the 'password' block:<br />
password optional pam_gnome_keyring.so<br />
<br />
:Next time you log in, you should be asked if you want the password to be unlocked automatically on login.''<br />
<br />
==== KDE ====<br />
{{Note|See http://live.gnome.org/GnomeKeyring/Pam for reference, and if you are using kde / kdm, you can use pam-keyring-tool from the AUR.}}<br />
<br />
*Put a script like the following in ~/.kde4/Autostart:<br />
$!/bin/sh<br />
echo PASSWORD | /usr/bin/pam-keyring-tool --unlock --keyring=default -s<br />
:Similar should work with openbox, lxde, etc.<br />
<br />
===Automatically connect on boot ===<br />
Since version 0.7 the NetworkManager is able to connect on boot, before a user has logged in and unlocked the keyring.<br />
<br />
*First make sure that the keyfile plugin is loaded; {{Filename|/etc/NetworkManager/nm-system-settings.conf}} should look like this:<br />
[main]<br />
plugins=keyfile<br />
<br />
*If this was not in the file before, you have to restart '''nm-system-settings''':<br />
# killall -TERM nm-system-settings<br />
:or simply reboot.<br />
<br />
*Now grant your user the right to modify system-connections:<br />
<br />
With <b>polkit</b>:<br />
<br />
Place the following in /etc/polkit-1/localauthority/50-local.d/10-org-freedesktop-network-manager-settings.pkla<br />
<br />
<pre><br />
[Allow user YOURUSERNAME to create wireless connections for all users]<br />
Identity=unix-user:YOURUSERNAME<br />
Action=org.freedesktop.network-manager-settings.system.modify<br />
ResultAny=no<br />
ResultInactive=no<br />
ResultActive=yes<br />
</pre><br />
<br />
:Finally, in the connection-editor (of the gnome applet), check the '''Available to all users''' box.<br />
<br />
The connection is now saved in '''/etc/NetworkManager/system-connections/"CONNECTION NAME"'''. On reboot, NetworkManager will try to connect to it, when in range.<br />
<br />
{{Note|1=As per [https://bugs.kde.org/show_bug.cgi?id=204340 this] bug report, <tt>knetworkmanager</tt> does not yet implement this feature. You will need to use the GNOME network applet (<tt>nm-applet</tt>). Install it as described above in this page, <tt>"killall knetworkmanager"</tt>, then start <tt>nm-applet</tt>.<br />
<br>Please vote for the bug!}}<br />
<br />
===Ignore specific devices===<br />
Sometimes it is desired, that network manager ignores some devices and do not try to get an IP.<br />
<br />
*First you have to find out the Hal UDI (e.g. with lshal):<br />
...<br />
info.product = 'Networking Interface' (string)<br />
info.subsystem = 'net' (string)<br />
info.udi = '/org/freedesktop/Hal/devices/net_00_1f_11_01_06_55' (string)<br />
linux.hotplug_type = 2 (0x2) (int)<br />
linux.subsystem = 'net' (string)<br />
...<br />
<br />
*Add the udi to /etc/NetworkManager/nm-system-settings.conf:<br />
[keyfile]<br />
unmanaged-devices=/org/freedesktop/Hal/devices/net_00_1f_11_01_06_55<br />
<br />
:Multiple devices can be specified, delimited by semicolons:<br />
<br />
[keyfile]<br />
unmanaged-devices=/org/freedesktop/Hal/devices/net_00_1f_11_01_06_55;/org/freedesktop/Hal/devices/net_00_2c_6d_e2_08_af<br />
<br />
You do not need to restart NetworkManager for the changes to take effect.<br />
<br />
*Ignoring a type of device at boot time.<br />
this script was used to ignore all ethernet devices at boot time of a archiso build, it can be changed to ignore wifi devices etc.<br />
/!\being used on a non-persistant filesystem, the nm-system-settings.conf is default at run time<br />
#!/bin/sh<br />
# author: tim noise <darknoise@drkns.net><br />
COUNT=0<br />
TARGET_FILE="/etc/NetworkManager/nm-system-settings.conf"<br />
for i in `lshal | grep -A6 'Networking Interface' | awk -F "'" '/info.udi = / {print $2}'`; do<br />
if [ $COUNT = 0 ]; then<br />
COUNT=$COUNT+1;<br />
echo "unmanaged-devices=$i" >> $TARGET_FILE<br />
else<br />
echo -n ";$i" >> $TARGET_FILE<br />
fi<br />
done<br />
printf "\n" >> $TARGET_FILE</div>Dongerdhttps://wiki.archlinux.org/index.php?title=NetworkManager&diff=119267NetworkManager2010-10-15T14:40:30Z<p>Dongerd: /* KDE4 */</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n|NetworkManager}}<br />
[[de:Networkmanager]]<br />
{{Article summary start}}<br />
{{Article summary text|Covers installation and configuration of NetworkManager &ndash; a set of co-operative tools that make networking simple and straightforward.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Wireless Setup}}<br />
{{Article summary end}}<br />
<br />
NetworkManager is a program for providing detection and configuration for systems to automatically connect to network. NetworkManager's functionality can be useful for both wireless and wired networks. For wireless networks, NetworkManager prefers known wireless networks and has the ability to be able to switch to the most reliable network. NetworkManager-aware applications can switch from online and offline mode. NetworkManager also prefers wired connections over wireless ones, has support for modem connections and certain types of VPN. NetworkManager was originally developed by RedHat and now is hosted by the GNOME project.<br />
<br />
== Base install ==<br />
<br />
NetworkManager is available in the official repositories:<br />
<br />
# pacman -S networkmanager<br />
<br />
== Graphical Front-ends ==<br />
<br />
To configure and have easy access to NetworkManager most people will want to install an applet. This GUI front-end usually resides in the system tray (or notification area) and allows network selection and configuration of NetworkManager. Various applets exist for different types of desktops.<br />
<br />
=== GNOME ===<br />
<br />
GNOME's applet (formerly gnome-network-manager) is lightweight enough and works across all environments:<br />
<br />
# pacman -S network-manager-applet<br />
<br />
If you want to store authentication details (Wireless/DSL) and enable global connection settings, i.e "available to all users":<br />
<br />
# pacman -S gnome-keyring<br />
<br />
=== KDE4 ===<br />
<br />
The KNetworkManager front-end has been made available in KDE version 4.4 as a plasma widget:<br />
<br />
# pacman -S kdeplasma-applets-networkmanagement<br />
<br />
The GNOME counterpart works just as nicely, or even better (has more features and detects more hardware).<br />
<br />
Note: If you are changing from another network managing tool like Wicd, do not forget to set the default 'Network Management Backend' in<br />
System Settings -> Hardware -> Information Sources<br />
<br />
=== KDE3 ===<br />
<br />
Though no longer supported, {{Package AUR|knetworkmanager}} is in the [[AUR]]. Package name:<br />
knetworkmanager<br />
<br />
=== Openbox ===<br />
<br />
The GNOME applet with the xfce4-notifyd notification daemon works well:<br />
<br />
# pacman -S network-manager-applet xfce4-notifyd hicolor-icon-theme gnome-icon-theme<br />
<br />
If you want to store authentication details (Wireless/DSL):<br />
<br />
# pacman -S gnome-keyring<br />
<br />
To prevent nm-applet dbus errors, edit ~/.xinitrc and change "exec openbox-session" to<br />
"exec ck-launch-session openbox-session".<br />
<br />
To have Openbox's autostart.sh start nm-applet properly, you may need to delete the file /etc/xdg/autostart/nm-applet.desktop (You may need to delete this file again after every update to network-manager-applet)<br />
<br />
Then in autostart.sh, start nm-applet with this line:<br />
<br />
(sleep 3 && /usr/bin/nm-applet --sm-disable) &<br />
<br />
=== Other Desktops and Window Managers ===<br />
<br />
It is recommended to use the GNOME applet. You'll also need to be sure that the GNOME hicolor theme is installed to be able to display the applet:<br />
<br />
# pacman -S hicolor-icon-theme gnome-icon-theme<br />
<br />
=== Command line ===<br />
<br />
cnetworkmanager, which is now available in the community repository, can be used to configure connections from the command line.<br />
<br />
# pacman -S cnetworkmanager<br />
<br />
== Configuration ==<br />
<br />
NetworkManager will require some additional steps to be able run properly.<br />
<br />
{{Note|Someone please verify how true this is. With just a pacman -S network-manager-applet everything works as expected. No hostname or networkmanager group set up. --- Confirmed, no hostname edit necessary for proper function here, network group was already added.}}<br />
<br />
=== Set hostname ===<br />
<br />
By default NetworkManager 0.7 will do a reverse lookup of your IP to determine your hostname to use to display to other networks. Because of how it handles it, generally this will result in a hostname of ''localhost'' or ''localhost.localdomain''. Having such a hostname and NetworkManagers attempts to manipulate it can occasionally cause crashes of the Xorg server ''(citation needed)''.<br />
<br />
To fix this, create a configuration that explicitly defines your hostname. Create the file {{Filename|/etc/NetworkManager/nm-system-settings.conf}} and add:<br />
<br />
<pre><br />
[main]<br />
plugins = keyfile<br />
<br />
[keyfile]<br />
hostname = <your hostname><br />
</pre><br />
<br />
Verify that your {{Filename|/etc/hosts}} is correct before continuing. If you previously tried to connect before doing this step, NetworkManager may have altered it. An example hostname line in {{Filename|/etc/hosts}}:<br />
<br />
<pre><br />
#<ip-address> <hostname.domain.org> <hostname> <br />
127.0.0.1 localhost.localdomain localhost dell-latitude<br />
</pre><br />
<br />
=== Add user to network and networkmanager groups ===<br />
<br />
To manipulate NetworkManager settings you will be required to be part of the network group OR the networkmanager group (you must create the networkmanager group first) ''(citation needed)''. Run the below commands after replacing ''USERNAME'' with your username.<br />
<br />
# gpasswd -a USERNAME network<br />
<br />
Alternatively:<br />
<br />
# groupadd networkmanager<br />
# gpasswd -a USERNAME networkmanager<br />
<br />
If you are not already a part of these groups, logout and back in for the changes to take effect.<br />
<br />
''(What is the purpose of this networkmanager group? Everything is possible with the network group.)''<br />
<br />
=== Disable current network setup ===<br />
<br />
You'll want to disable your current network setup to be able to properly test NetworkManager. First (if using the Arch Linux network scripts) stop the network:<br />
<br />
/etc/rc.d/network stop<br />
<br />
Bring down your NIC's (Network Interface Controllers, i.e. network cards). For example:<br />
<br />
ifconfig eth0 down<br />
ifconfig wlan0 down<br />
<br />
Edit {{Filename|/etc/rc.conf}} and where you defined DHCP or a static IP address, comment them out:<br />
<br />
<pre><br />
#eth0="dhcp" <br />
#wlan0="dhcp" <br />
INTERFACES=(!eth0 !wlan0)<br />
</pre><br />
<br />
=== Edit daemons ===<br />
<br />
You must ''remove'' the default '''network''' daemon and add the '''hal''' ''(needs citation; only dbus is needed)'', and '''networkmanager''' daemons in this order:<br />
<br />
DAEMONS=( ...'''hal networkmanager'''... )<br />
<br />
Be sure that the package {{Package Official|dbus}} is installed as NetworkManager will require it. The '''hal''' daemon also starts the '''dbus''' daemon, so you should not need to worry. Also, do ''not'' background hal as then the dependencies do not get loaded before (and in time for) '''networkmanager'''. To start other services (daemons) that require a network connection see the next section on how to set them up. Though the NetworkManager daemon has been started here, it will not (by default) connect onto a network until an applet is loaded and the applet specifies to do so. This means that networking services will need to be specified to NetworkManager on when to run.<br />
<br />
=== Network Services with NetworkManager Dispatcher===<br />
<br />
There are quite a few network services that you will not want running until NetworkManager brings up an interface. Good examples are '''openntpd''' and network filesystem mounts of various types (e.g. '''netfs'''). NetworkManager has the ability to start these services when you connect to a network (interface up), and stop them when you are no longer using them (interface down).<br />
<br />
To use this feature, scripts can be added to the {{Filename|/etc/NetworkManager/dispatcher.d}} directory. These scripts will need to have executable, user permissions. For security, it's good practice to make them owned by '''root:root''' and writable only by the owner. The scripts will be run in alphabetical order at connection time (with arguments ''interface up''), and in reverse alphabetical order at disconnect time (''interface down''). To ensure what order they come up in, it is common to use numerical characters prior to the name of the script (e.g. {{Filename|10_portmap}} or {{Filename|30_netfs}} (which ensures that the portmapper is up before NFS mounts are attempted).<br />
<br />
The following starts openntpd when an interface is brought up. Save the file as {{Filename|/etc/NetworkManager/dispatcher.d/20_openntpd}} and make it executable.<br />
<pre><br />
#!/bin/sh<br />
<br />
INTERFACE=$1 # The interface which is brought up or down<br />
STATUS=$2 # The new state of the interface<br />
<br />
case "$STATUS" in<br />
'up') # $INTERFACE is up<br />
exec /etc/rc.d/openntpd start<br />
;;<br />
'down') # $INTERFACE is down<br />
# Check for active interface and down if no one active<br />
if [ ! `nm-tool|grep State|cut -f2 -d' '` == "connected" ]; then<br />
exec /etc/rc.d/openntpd stop<br />
fi<br />
;;<br />
esac<br />
</pre><br />
<br />
{{Warning|if you connect to foreign or public networks, be aware of what services you are starting and what servers you expect to be available for them to connect to. You could make a security hole by starting the wrong services while connected to a public network.}}<br />
<br />
==== Use dispatcher to connect to a vpn after a network-connection is established ====<br />
<br />
In this example we want to connect automatically to a vpn-connection we defined previously with NetworkManager. First thing to to is to create the dispatcher-script that defines what to do after we connected to the network.<br />
<br />
1. Create the dispatcher script in {{Filename|/etc/NetworkManager/dispatcher.d/vpn-up}}<br />
<br />
case "$2" in<br />
up)<br />
sudo -u username DISPLAY=:0 /usr/bin/python /etc/NetworkManager/vpn-up.py<br />
;;<br />
esac<br />
<br />
Remember to make it executable with chmod +x and change '''username''' to the right one.<br />
<br />
2. Create the {{Filename|/etc/NetworkManager/vpn-up.py}} and change '''network-ESSID''' to the desired one. You'll find the code [http://dpaste.com/hold/203441/ here].<br />
<br />
Now NetworkManager should try to connect to your vpn which you had defined in your profile.<br />
<br />
=== Proxy settings ===<br />
<br />
Network Manager does not directly handle proxy settings.<br />
<br />
See: [[Proxy settings]]<br />
<br />
== Testing ==<br />
<br />
NetworkManager applets are designed to load upon login so no further configuration should be necessary for most users. If you have already disabled your previous network settings and disconnected from your network, you can now test if NetworkManager will work. First start the daemon:<br />
<br />
/etc/rc.d/networkmanager start<br />
<br />
Some applets will provide you with a .desktop file so that the NetworkManager applet can be loaded through the application menu. If it doesn't, you're going to either have to discover the command to use or logout and login again to start the applet. Once the applet is started, it will likely begin polling network connections with for auto-configuration with a DHCP server.<br />
<br />
To start the GNOME applet in non-xdg-compliant Window Managers like Awesome:<br />
<br />
nm-applet --sm-disable &<br />
<br />
For static IPs you will have to configure NetworkManager to understand them. The process usually involves right-clicking the applet and selecting something like 'Edit Connections'.<br />
<br />
==Troubleshooting==<br />
<br />
Some fixes to common problems.<br />
<br />
=== Network Management Disabled ===<br />
<br />
Sometimes when NM shuts down the pid (state) file does not get removed and you will get a 'Network management disabled' message. If this happens, you'l have to remove it manually:<br />
<br />
rm /var/lib/NetworkManager/NetworkManager.state<br />
<br />
If this happens upon reboot, you can add an action to your {{Filename|etc/rc.local}} to have it removed upon bootup:<br />
<br />
<pre>nmpid=/var/lib/NetworkManager/NetworkManager.state<br />
[ -f $nmpid ] && rm $nmpid</pre><br />
<br />
=== NetworkManager prevents DHCPCD from using resolv.conf.head and resolv.conf.tail ===<br />
<br />
Sometimes it's problematic to add static items to resolv.conf when it's constantly rewritten by nm and dhcpcd. You can use networkmanager-dhclient package from AUR but a better solution is to use this simple script:<br />
<br />
<pre><br />
#!/bin/bash<br />
# <br />
# /etc/NetworkManager/dispatcher.d/99-resolv.conf-head_and_tail<br />
# Include /etc/resolv.conf.head and /etc/resolv.conf.tail to /etc/resolv.conf<br />
#<br />
# scripts in the /etc/NetworkManager/dispatcher.d/ directory<br />
# are called alphabetically and are passed two parameters:<br />
# $1 is the interface name, and $2 is “up” or “down” as the<br />
# case may be.<br />
<br />
resolvconf='/etc/resolv.conf';<br />
cat "$resolvconf"{.head,,.tail} 2>/dev/null > "$resolvconf".tmp<br />
mv -f "$resolvconf".tmp "$resolvconf"<br />
</pre><br />
<br />
===DHCP problems===<br />
If you have problems with getting an IP via DHCP try to add the following to your {{Filename|/etc/dhclient.conf}}:<br />
interface "eth0" {<br />
send dhcp-client-identifier 01:aa:bb:cc:dd:ee:ff;<br />
}<br />
Where {{Codeline|aa:bb:cc:dd:ee:ff}} is the MAC-adress of this NIC.<br />
<br />
===How to bypass Gnome keyring for normal users connecting with wireless===<br />
It's super simple! First, create a group called '''networkmanager''' with the following command (or any other method you prefer):<br />
# groupadd networkmanager<br />
<br />
Then add your user to that group using the following command (or any other preferred method):<br />
# gpasswd -a username networkmanager<br />
Replace username in the above command with your actual username.<br />
<br />
Now, as root, launch nm-connection-editor and configure the connections:<br />
# nm-connection-editor<br />
Put a check mark next to "Available to all users" and apply the settings. <br />
<br />
Now you won't be bothered by Gnome keyring! ''(citation needed)''<br />
Also, if you additionally enable "connect automatically", your connection will be available and connected before you even log in to your desktop, making your whole startup process even faster!<br />
<br />
===Problems starting nm-applet as normal user===<br />
Sometimes, the gnome applet fails to start with the following error:<br />
** (nm-applet:2941): WARNING **: <WARN> applet_dbus_manager_start_service(): Could not acquire the NetworkManagerUserSettings<br />
service.<br />
Message: 'Connection ":1.19" is not allowed to own the service "org.freedesktop.NetworkManagerUserSettings" due to security<br />
policies in the configuration file'<br />
<br />
Or if you can see the nm-applet icon in xfce4's panel's notification area while login as root but can't see it if login as a normal user, it could indicate you need to modify the policy settings to get nm-applet started as normal user. (Try to start nm-applet in terminal as normal user will give you the error above.)<br />
<br />
This depends on NetworkManager changing its behaviour since version 0.7, ignoring the "network" group altogether and instead uses ConsoleKit, which seems to be problematic at times ''(citation needed)''. This solution was provided by ''madhatter'':<br />
<br />
Add the following to your /etc/dbus-1/system.d/NetworkManager.conf<br />
<br />
<policy group="network"><br />
<allow send_destination="org.freedesktop.NetworkManager"<br />
send_interface="org.freedesktop.NetworkManager"/><br />
</policy><br />
<br />
And to /etc/dbus-1/system.d/nm-applet.conf<br />
<br />
<policy group="network"><br />
<allow own="org.freedesktop.NetworkManagerUserSettings"/><br />
<allow send_destination="org.freedesktop.NetworkManagerUserSettings"<br />
send_interface="org.freedesktop.NetworkManagerUserSettings"/><br />
<br />
<deny send_interface="org.freedesktop.NetworkManagerSettings.Secrets"/><br />
</policy><br />
<br />
Log out and once you log back in you should be able to run nm-applet and then in the panel be able to select any network, type the password for that network and then you are ready to go.<br />
<br />
For OpenVpn you need to add following line in {{filename|/etc/dbus-1/system.d/NetworkManager.conf}}<br />
<allow send_destination="org.freedesktop.NetworkManager"<br />
send_interface="org.freedesktop.NetworkManager.openvpn"/><br />
in section {{codeline|<nowiki><policy at_console="true"></nowiki>}}.<br />
<br />
===Missing default route===<br />
On at least one KDE4 system, no default route was created when establishing wireless connections with NetworkManager. Changing the route settings of the wireless connection to remove the default selection "Use only for resources on this connection" solved the issue.<br />
<br />
===3G modem not detected===<br />
If NetworkManager (from v0.7.999) does not detect your 3G modem, but you still can connect using [[wvdial]], try installing <br />
[http://www.archlinux.org/packages/extra/i686/modemmanager/ modemmanager] package using {{Codeline|pacman -S modemmanager}} and restart NetworkManager daemon with {{Codeline|/etc/rc.d/networkmanager restart}}. Replug your modem or restart. This utility provides support for hardware not in networkmanager's default database.<br />
<br />
===VPN problems in Networkmanager 0.7.999===<br />
If you get the error message "invalid secrets" when trying to connect to your VPN provider using the PPTP protocol, try installing the git versions instead: [http://aur.archlinux.org/packages.php?ID=22349 networkmanager], [http://aur.archlinux.org/packages.php?ID=26516 nm-applet] and the [http://aur.archlinux.org/packages.php?ID=29178 pptp plugin].<br />
<br />
===PolicyKit issues===<br />
{{Note|Following is probably not need for KDE 4 anymore, as there should be PolicyKit integration as of KDE 4.3. At least with knetworkmanager from [kdemod-core], the author did not run into any troubles.}}<br />
<br />
Because many Display Managers (including KDM) do not natively support policykit at login, you will run into some permission issues with D-Bus and NetworkManager.<br />
<br />
While there are several options to resolve this issue, choose ''only'' one:<br />
<br />
* Install Consolekit and add the following line to {{Filename|/etc/pam.d/kde}}:<br />
session optional pam_ck_connector.so<br />
{{Warning|This may cause the malfunction of KDE PowerDevil.}}<br />
<br />
* Add the following lines to {{Filename|/etc/dbus-1/system.d/NetworkManager.conf}}:<br />
<policy group="users"><br />
<allow send_destination="org.freedesktop.NetworkManager"/><br />
<allow send_interface="org.freedesktop.NetworkManager"/><br />
</policy><br />
:If this does not work, check if there are any policy errors by starting NetworkManager manually:<br />
# kill `pidof NetworkManager`<br />
# NetworkManager --no-daemon<br />
<br />
* Put the following script in ~/.kde4/Autostart or similar for other WMs or DEs:<br />
#!/bin/bash<br />
ck-launch-session<br />
<br />
* If none of those work, refer to this thread: http://bbs.archlinux.org/viewtopic.php?id=63576<br />
<br />
===Switching off WLAN on laptops===<br />
<br />
Sometimes networkmanager won't work when you disable your Wifi-adapter with a switch on your laptop and try to enable it again afterwards. This is often a problem with rfkill. Install rfkill from the repo:<br />
<br />
# pacman -S rfkill<br />
<br />
and use <br />
<br />
$ watch -n1 rfkill list all<br />
<br />
to check if the driver notifies rfkill about the wireless adapter's status.<br />
If one identifier stays blocked after you switch on the adapter you could try to manually unblock it with (where X is the number of the identifier provided by the above output):<br />
<br />
# rfkill event unblock X<br />
<br />
===Static IP Settings Revert To DHCP===<br />
<br />
Due to an unresolved bug, when changing default connections to static IP, nm-applet may not properly store the configuration change, and will revert to automatic DHCP. A workaround for this issue follows.<br />
<br />
Edit the default connection (eg "Auto eth0") in nm-applet. Change the connection name (eg "my eth0"), uncheck the "Available to all users" checkbox, change your static IP settings as desired, and click Apply. This will save a new connection with the given name.<br />
<br />
Next, you will want to make the default connection not connect automatically. To do so, run<br />
<br />
$ sudo nm-connection-editor # you must use sudo, not su<br />
<br />
In the connection editor, edit the default connection (eg "Auto eth0") and uncheck "Connect automatically". Click Apply and close the connection editor.<br />
<br />
==Tips and tricks==<br />
<br />
===Checking if networking is up inside a cron job or script===<br />
Some cron jobs require networking to be up to succeed. You may wish to avoid running these jobs when the network is down. To accomplish this, add an '''if''' test for networking that queries NetworkManager's '''nm-tool''' and checks the state of networking. The test shown here succeeds if any interface is up, and fails if they are all down. This is convenient for laptops that might be hardwired, might be on wireless, or might be off the network. <br />
if [ `nm-tool|grep State|cut -f2 -d' '` == "connected" ]; then<br />
#Whatever you want to do if the network is online<br />
else<br />
#Whatever you want to do if the network is offline - note, this and the else above are optional<br />
fi<br />
<br />
This useful for a cron.hourly script that runs '''fpupdate''' for the F-Prot virus scanner signature update, as an example. Another way it might be useful, with a little modification, is to differentiate between networks using various parts of the output from '''nm-tool'''; for example, since the active wireless network is denoted with an asterisk, you could grep for the network name and then grep for a literal asterisk.<br />
<br />
===Automatically unlock keyring after login===<br />
==== Gnome ====<br />
# Right click on the NM icon in your panel and select Edit Connections and open the Wireless tab<br />
# Select the connection you want to work with and click the Edit button<br />
# Check the boxes “Connect Automatically” and “Available to all users”<br />
Log out and log back in to complete.<br />
<br />
{{Note|The following method is dated and known not to work on at least one machine!}}<br />
''*In {{Filename|/etc/pam.d/gdm}} (or your corresponding daemon in /etc/pam.d), add these lines at the end of the "auth" and "session" blocks if they do not exist already: <br />
auth optional pam_gnome_keyring.so<br />
session optional pam_gnome_keyring.so auto_start<br />
<br />
*In {{Filename|/etc/pam.d/passwd}}, use this line for the 'password' block:<br />
password optional pam_gnome_keyring.so<br />
<br />
:Next time you log in, you should be asked if you want the password to be unlocked automatically on login.''<br />
<br />
==== KDE ====<br />
{{Note|See http://live.gnome.org/GnomeKeyring/Pam for reference, and if you are using kde / kdm, you can use pam-keyring-tool from the AUR.}}<br />
<br />
*Put a script like the following in ~/.kde4/Autostart:<br />
$!/bin/sh<br />
echo PASSWORD | /usr/bin/pam-keyring-tool --unlock --keyring=default -s<br />
:Similar should work with openbox, lxde, etc.<br />
<br />
===Automatically connect on boot ===<br />
Since version 0.7 the NetworkManager is able to connect on boot, before a user has logged in and unlocked the keyring.<br />
<br />
*First make sure that the keyfile plugin is loaded; {{Filename|/etc/NetworkManager/nm-system-settings.conf}} should look like this:<br />
[main]<br />
plugins=keyfile<br />
<br />
*If this was not in the file before, you have to restart '''nm-system-settings''':<br />
# killall -TERM nm-system-settings<br />
:or simply reboot.<br />
<br />
*Now grant your user the right to modify system-connections:<br />
<br />
With <b>polkit</b>:<br />
<br />
Place the following in /etc/polkit-1/localauthority/50-local.d/10-org-freedesktop-network-manager-settings.pkla<br />
<br />
<pre><br />
[Allow user YOURUSERNAME to create wireless connections for all users]<br />
Identity=unix-user:YOURUSERNAME<br />
Action=org.freedesktop.network-manager-settings.system.modify<br />
ResultAny=no<br />
ResultInactive=no<br />
ResultActive=yes<br />
</pre><br />
<br />
:Finally, in the connection-editor (of the gnome applet), check the '''Available to all users''' box.<br />
<br />
The connection is now saved in '''/etc/NetworkManager/system-connections/"CONNECTION NAME"'''. On reboot, NetworkManager will try to connect to it, when in range.<br />
<br />
{{Note|1=As per [https://bugs.kde.org/show_bug.cgi?id=204340 this] bug report, <tt>knetworkmanager</tt> does not yet implement this feature. You will need to use the GNOME network applet (<tt>nm-applet</tt>). Install it as described above in this page, <tt>"killall knetworkmanager"</tt>, then start <tt>nm-applet</tt>.<br />
<br>Please vote for the bug!}}<br />
<br />
===Ignore specific devices===<br />
Sometimes it is desired, that network manager ignores some devices and do not try to get an IP.<br />
<br />
*First you have to find out the Hal UDI (e.g. with lshal):<br />
...<br />
info.product = 'Networking Interface' (string)<br />
info.subsystem = 'net' (string)<br />
info.udi = '/org/freedesktop/Hal/devices/net_00_1f_11_01_06_55' (string)<br />
linux.hotplug_type = 2 (0x2) (int)<br />
linux.subsystem = 'net' (string)<br />
...<br />
<br />
*Add the udi to /etc/NetworkManager/nm-system-settings.conf:<br />
[keyfile]<br />
unmanaged-devices=/org/freedesktop/Hal/devices/net_00_1f_11_01_06_55<br />
<br />
:Multiple devices can be specified, delimited by semicolons:<br />
<br />
[keyfile]<br />
unmanaged-devices=/org/freedesktop/Hal/devices/net_00_1f_11_01_06_55;/org/freedesktop/Hal/devices/net_00_2c_6d_e2_08_af<br />
<br />
You do not need to restart NetworkManager for the changes to take effect.<br />
<br />
*Ignoring a type of device at boot time.<br />
this script was used to ignore all ethernet devices at boot time of a archiso build, it can be changed to ignore wifi devices etc.<br />
/!\being used on a non-persistant filesystem, the nm-system-settings.conf is default at run time<br />
#!/bin/sh<br />
# author: tim noise <darknoise@drkns.net><br />
COUNT=0<br />
TARGET_FILE="/etc/NetworkManager/nm-system-settings.conf"<br />
for i in `lshal | grep -A6 'Networking Interface' | awk -F "'" '/info.udi = / {print $2}'`; do<br />
if [ $COUNT = 0 ]; then<br />
COUNT=$COUNT+1;<br />
echo "unmanaged-devices=$i" >> $TARGET_FILE<br />
else<br />
echo -n ";$i" >> $TARGET_FILE<br />
fi<br />
done<br />
printf "\n" >> $TARGET_FILE</div>Dongerd