Difference between revisions of "Acer Aspire 8920G"

From ArchWiki
Jump to: navigation, search
(Now setup the modules and daemons: formatting)
(Now configure the files for powersaving: Formatting)
Line 421: Line 421:
 
=====Now configure the files for powersaving=====
 
=====Now configure the files for powersaving=====
 
We shall first edit the cpufreq files making the changes in bold
 
We shall first edit the cpufreq files making the changes in bold
{{Command|name=Type this into a console|output=
+
Type this into a console
sudo nano /etc/conf.d/cpufreq
+
sudo nano /etc/conf.d/cpufreq
}}
+
 
 
in nano add these lines to the bottom of the script...
 
in nano add these lines to the bottom of the script...
{{Command|name=Type this into nano|output=
+
#configuration for cpufreq control
#configuration for cpufreq control
+
 
+
# valid governors:
# valid governors:
+
#  ondemand, performance, powersave,
#  ondemand, performance, powersave,
+
#  conservative, userspace
#  conservative, userspace
+
'''governor="ondemand"'''
'''governor="ondemand"'''
+
 
+
# valid suffixes: Hz, kHz (default), MHz, GHz, THz
# valid suffixes: Hz, kHz (default), MHz, GHz, THz
+
'''min_freq="800MHz"'''
'''min_freq="800MHz"'''
+
'''max_freq="2.4GHz"'''
'''max_freq="2.4GHz"'''
+
}}
+
  
  
 
Now the "harder" one to do is sort out the power events in acpid as they don't work out of the box.  The problem is that the power event for plugging in your power adapter is not defined in the script so you need to add the event to the file.
 
Now the "harder" one to do is sort out the power events in acpid as they don't work out of the box.  The problem is that the power event for plugging in your power adapter is not defined in the script so you need to add the event to the file.
{{Command|name=To see what I am talking about bring up a terminal and type in this command|output=
+
To see what I am talking about bring up a terminal and type in this command
sudo tail -f /var/log/messages.log
+
sudo tail -f /var/log/messages.log
}}
+
 
 
Now with this terminal open unplug the power adapter or plug it in and you will see this pop up in the log open on the terminal (use ctrl-c to exit log)
 
Now with this terminal open unplug the power adapter or plug it in and you will see this pop up in the log open on the terminal (use ctrl-c to exit log)
{{Command|name=Here is what should pop up|output=
+
Here is what should pop up
Oct 22 12:34:27 8920g kernel: Restarting tasks ... done.
+
Oct 22 12:34:27 8920g kernel: Restarting tasks ... done.
Oct 22 12:34:27 8920g logger: ACPI action undefined: '''ADP0'''
+
Oct 22 12:34:27 8920g logger: ACPI action undefined: '''ADP0'''
Oct 22 12:34:27 8920g acpid: client connected from 3654[0:0]
+
Oct 22 12:34:27 8920g acpid: client connected from 3654[0:0]
Oct 22 12:34:27 8920g acpid: 1 client rule loaded
+
Oct 22 12:34:27 8920g acpid: 1 client rule loaded
}}
+
 
  
 
The bold entry is the one we are concerned with, this is what changes when we plug in and remove the power adapter.
 
The bold entry is the one we are concerned with, this is what changes when we plug in and remove the power adapter.
  
 
Now for the interesting part, changing the acpid events to "catch" this change of power adapter.
 
Now for the interesting part, changing the acpid events to "catch" this change of power adapter.
{{Command|name=To make these changes bring up a terminal and type in this command|output=
+
To make these changes bring up a terminal and type in this command
su
+
su
cd /etc/acpi/events
+
cd /etc/acpi/events
chmod +x anything
+
chmod +x anything
cd ..
+
cd ..
gedit handler.sh
+
gedit handler.sh
}}
+
  
{{Command|name=Now we need to change the bold entries in this file|output=
 
#!/bin/sh
 
# Default acpi script that takes an entry for all actions
 
  
# NOTE: This is a 2.6-centric script.  If you use 2.4.x, you'll have to
+
Now we need to change the bold entries in this file
#      modify it to not use /sys
+
#!/bin/sh
 
+
# Default acpi script that takes an entry for all actions
minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
+
maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
+
# NOTE: This is a 2.6-centric script.  If you use 2.4.x, you'll have to
setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
+
#      modify it to not use /sys
 
+
set $*
+
minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
 
+
maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
case "$1" in
+
setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
 +
 +
set $*
 +
 +
case "$1" in
 
     button/power)
 
     button/power)
 
         #echo "PowerButton pressed!">/dev/tty5
 
         #echo "PowerButton pressed!">/dev/tty5
Line 538: Line 536:
 
         logger "ACPI group/action undefined: $1 / $2"
 
         logger "ACPI group/action undefined: $1 / $2"
 
         ;;
 
         ;;
esac
+
esac
}}
+
 
  
 
Save and exit this file and after a reboot the system will load by default the "ondemand" profile which changes the CPU speed quite nicely I find.  If you then plug in the mains for something intensive like a game with graphics or some compiling then the both processor cores will ramp up to full speed and so will the graphics card as we did that earlier.  Then when you need to use the laptop on the battery you will find that the clock will drop down to 800MHz from 2,400MHz and the graphics will slow down and conserve power.
 
Save and exit this file and after a reboot the system will load by default the "ondemand" profile which changes the CPU speed quite nicely I find.  If you then plug in the mains for something intensive like a game with graphics or some compiling then the both processor cores will ramp up to full speed and so will the graphics card as we did that earlier.  Then when you need to use the laptop on the battery you will find that the clock will drop down to 800MHz from 2,400MHz and the graphics will slow down and conserve power.

Revision as of 19:30, 22 October 2009

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Acer Aspire 8920G#)
Template:Thanks

Introduction

This is my 1st ever wiki and I hope that by writing this it can benefit another user out there to setup archlinux on their laptop like me. I should also like to explain that I am a novice in the World of Linux and so I shall try and pass on as much knowledge as I possibly can. These are the settings that apply to my machine and my network setup so you must remember that what works for me will not necessarily work ok for you. This machine is running 2.6.31-ARCH and all the hardware is ok other than having to load the wireless driver iwl4965 and nvidia everything else just worked from the core install.


Hardware

Standard Hardware

Hardware Description

Template:Hardware Template:Hardware Template:Hardware Template:Hardware Template:Hardware Template:Hardware Template:Hardware Template:Hardware Template:Hardware Template:Hardware Template:Hardware Template:Hardware

Additional Hardware

Hardware Description

Template:Hardware Template:Hardware


System Files and Command Outputs

System Files

fstab

This contains the commands to connect to my Buffalo NAS drive, which I have added incase it helps someone else with one. I connect to the drive which is on a static IP address and has no security set for the shares, so in your case connecting up to your own network shares would of course differ from mine. Template:File

resolve.conf

I needed to change this as my network is setup to use static IP addresses and this points to my router to resolve dns. Template:File

rc.conf

This contains the settings I used that apply to my machine and my network, so your rc.conf will be different to mine. Template:File

xorg.conf

Template:File

Command Outputs

lsusb

Template:Command

lspci

Template:Command


Troubleshooting

These are some of the things I needed to download and the configuration files that needed modifying in order to configure the machine to behave as a laptop should... be wireless and consume less power! I assume by this point that you have already got to the stage of a working desktop and just need to dot the i's and cross the t's to polish things off.

Wireless

Wireless needs the module "iwlwifi-4965-ucode" installing, and if you use wireless security WPA2 etc then you would also be better to load "wicd" to configure and connect to your wireless. First you need to install "iwlwifi-4965-ucode"

sudo pacman -S iwlwifi-4965-ucode


Then you need to edit /etc/rc.conf to load the module at startup. Make these changes to the Modules section

MODULES=(... !pcspkr loop iwl4965 lp)


Stage two involves getting connected to our wireless network via wicd, so let's install that now. Type this into a console

sudo pacman -S wicd


Then you need to edit /etc/rc.conf to load the wicd daemon at startup. If you put a bang(!) in front of a network interface then you are allowing wicd to control the interface. The Interfaces and Routes are optional but you will need to load the Daemon. Then after a reboot in the system notification area you should now be able to use the wicd client to hook up to your network. Make these changes to the Networking, Routes & Daemons section

INTERFACES=(!eth0)
ROUTES=(!gateway)
DAEMONS=(@syslog-ng !network @crond @alsa hal fam !netfs wicd @cpufreq @cups @openntpd @bluetooth gdm)

Nvidia Graphics

I assume by now that you have a working desktop and just need to "tweak" the system for 3-D apps and power management so this is what I changed in my system.

In the /etc/X11/xorg.conf file I made the following changes to allow compiz eye candy and power management. The PowerMizer options are set to lowest performance on battery, with the option of increasing speed if needed and the system will run at full speed when the mains are plugged in.

Make these changes to the Device section

Section "Device"
   Identifier     "Device0"
   Driver         "nvidia"
   VendorName     "NVIDIA Corporation"
   Option         "AddARGBGLXVisuals" "True"
   Option         "NoLogo" "True"
   Option         "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x3322; PowerMizerDefault=0x3; PowerMizerDefaultAC=0x1"
EndSection

Tips & Tricks

Here are some of the hacks that I have made to my system in addition to the above.

fstab mounting and offline drives

I found that despite mounting my network drives is fstab and having the wicd daemon loading that the network shares would not connect at startup. I think that fstab mounts drives at an early stage and the wicd daemon has not even loaded yet so they fail and the boot process carries on. So I found a solution where I run a script just after I logon to check to see if the drive is online and to connect if it is. I found that if I tried to mount -a and the NAS box was offline that the mount command would retry to connect a few times and this would cause the system to hang until it is finished. So as you will see from the script it first "pings" the NAS box to see if it is online and only then does it issue the mount -a command, if it is offline then it just exits.

Since I use gdm to logon to Gnome I discovered that it could run scripts at certain defined events via PostLogin, PreSession & PostSession. So I added this script that I found on the internet whilst googling and changed it a little to suit my needs.

Type this into a console, using su at the start to become root (nano method)

su
<insert root password>
cd /etc/gdm/PostLogin
cp Default.Sample Default
nano Default

in nano add these lines to the bottom of the script...

# This ping's the NAS box to see if it is online, and if it is then mount
# the shares.
# If not then just exit, or the mount command will hang the system for
# about 20~30 seconds which just plain sucks!
if [ "$(ping -c 1 192.168.1.2 | grep '0 received')" ]
       then
                : ; exit 1
       else
                mount -a
fi


Now exit nano by using "ctrl-x" and press "y" to save your changes. Then logout of the terminal as you are still running as root! When you next login to Gnome it will run the script and mount the drives if the NAS box is online. Type this into a console

exit
exit


...or if running Gnome like me then use gedit as it is much easier on the eye. Type this into a console, using su at the start to become root (gedit method)

su
<insert root password>
cd /etc/gdm/PostLogin
cp Default.Sample Default
gedit Default

in gedit add these lines to the bottom of the script...

# This ping's the NAS box to see if it is online, and if it is then mount
# the shares.
# If not then just exit, or the mount command will hang the system for
# about 20~30 seconds which just plain sucks!
if [ "$(ping -c 1 192.168.1.2 | grep '0 received')" ]
       then
                : ; exit 1
       else
                mount -a
fi

Now exit gedit and save your changes. Then logout of the terminal as you are still running as root! When you next login to Gnome it will run the script and mount the drives if the NAS box is online. Type this into a console

exit
exit

Ok, I've mounted my network shares now my laptop hangs on shutdown!

Sadly there is a bit of a bug with Linux which stretches back to it's unix roots: The concept of connecting to network drives was not around it seems and when the shutdown scripts execute it does things in reverse... so basically one of the consequences is that networking goes down before the drives have been un-mounted. This causes the system to hang as it would like to shutdown the shares properly to check to see if files are open etc but it cannot connect.

So to fix this we need to un-mount the drives at some stage before the shutdown script gets rolling. I could have added a script to /etc/gdm/PostSession/Default like above, but it seems silly to un-mount the drives if I just logged out of Gnome and let someone else login to use my laptop. So I found a suitable location that works well is /etc/rc.local.shutdown and added these commands... Type this into a console

sudo nano /etc/rc.local.shutdown

in nano add these lines to the bottom of the script...

# This un-maps my network drives and allows machine to shutdown faster
umount //media/share
umount //media/apps
umount //media/data

Exit out of nano saving changes and voila! The system now shutdown clean and fast.

Saving Power

This is an ongoing concern for me... I am working on trying to have the display dimmer when on battery and full brightness when on mains adapter. If I get this fixed then it shall appear here. Meanwhile I have so far been able to save some power with the PowerMizer settings for nvidia in xorg.conf file above, but is there more? Well yes!

Cpufreq is our first port of call

We need to install acpi and cpufreq, then configure the system for AC and battery.

Install the components

First you need to install "acpid"

sudo pacman -S acpid


Then you need to install "cpufrequtils"

sudo pacman -S cpufrequtils
Now setup the modules and daemons

We need to load the Modules and Daemons into /etc/rc.conf

sudo nano /etc/rc.conf

In nano makes these changes to rc.conf Changes the bold entries in the Modules & Daemons section

MODULES=(acpi-cpufreq cpufreq_ondemand !net-pf-10 !ipv6 !parport !snd_pcsp !pcspkr loop iwl4965 lp)
DAEMONS=(@syslog-ng !network @crond @alsa hal fam !netfs wicd @cpufreq @cups @openntpd @bluetooth gdm)
Now configure the files for powersaving

We shall first edit the cpufreq files making the changes in bold Type this into a console

sudo nano /etc/conf.d/cpufreq

in nano add these lines to the bottom of the script...

#configuration for cpufreq control

# valid governors:
#  ondemand, performance, powersave,
#  conservative, userspace
governor="ondemand"

# valid suffixes: Hz, kHz (default), MHz, GHz, THz
min_freq="800MHz"
max_freq="2.4GHz"


Now the "harder" one to do is sort out the power events in acpid as they don't work out of the box. The problem is that the power event for plugging in your power adapter is not defined in the script so you need to add the event to the file. To see what I am talking about bring up a terminal and type in this command

sudo tail -f /var/log/messages.log

Now with this terminal open unplug the power adapter or plug it in and you will see this pop up in the log open on the terminal (use ctrl-c to exit log) Here is what should pop up

Oct 22 12:34:27 8920g kernel: Restarting tasks ... done.
Oct 22 12:34:27 8920g logger: ACPI action undefined: ADP0
Oct 22 12:34:27 8920g acpid: client connected from 3654[0:0]
Oct 22 12:34:27 8920g acpid: 1 client rule loaded


The bold entry is the one we are concerned with, this is what changes when we plug in and remove the power adapter.

Now for the interesting part, changing the acpid events to "catch" this change of power adapter. To make these changes bring up a terminal and type in this command

su
cd /etc/acpi/events
chmod +x anything
cd ..
gedit handler.sh


Now we need to change the bold entries in this file

#!/bin/sh
# Default acpi script that takes an entry for all actions

# NOTE: This is a 2.6-centric script.  If you use 2.4.x, you'll have to
#       modify it to not use /sys

minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"

set $*

case "$1" in
   button/power)
       #echo "PowerButton pressed!">/dev/tty5
       case "$2" in
           PWRF)   logger "PowerButton pressed: $2" ;;
           *)      logger "ACPI action undefined: $2" ;;
       esac
       ;;
   button/sleep)
       case "$2" in
           SLPB)   echo -n mem >/sys/power/state ;;
           *)      logger "ACPI action undefined: $2" ;;
       esac
       ;;
   ac_adapter)
       case "$2" in
           # ADP0 is the name of my AC Adapter
           ADP0)
               case "$4" in
                   # 0 Means that the AC Adapter is NOT present, therefore we are using the battery!
                   00000000)
                       # So we now change the CPU scaler to ondemand which is nice and responsive
                       # But don't forget we have 2 CPU Cores to contend with!
                       echo "ondemand" >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
                       echo "ondemand" >/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
                       # 
                       #echo -n $minspeed >$setspeed
                       #/etc/laptop-mode/laptop-mode start
                   ;;
                   # 1 Means that the AC Adapter is plugged in, so we need to ramp up the Cores!
                   00000001)
                       # So now we change both Cores to performance, which by default is full-whack!
                       echo "performance" >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
                       echo "performance" >/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
                       #echo -n $maxspeed >$setspeed
                       #/etc/laptop-mode/laptop-mode stop
                   ;;
               esac
               ;;
           *)  logger "ACPI action undefined: $2" ;;
       esac
       ;;
   battery)
       case "$2" in
           BAT0)
               case "$4" in
                   00000000)   #echo "offline" >/dev/tty5
                   ;;
                   00000001)   #echo "online"  >/dev/tty5
                   ;;
               esac
               ;;
           CPU0)	
               ;;
           *)  logger "ACPI action undefined: $2" ;;
       esac
       ;;
   button/lid)
       #echo "LID switched!">/dev/tty5
       ;;
   *)
       logger "ACPI group/action undefined: $1 / $2"
       ;;
esac


Save and exit this file and after a reboot the system will load by default the "ondemand" profile which changes the CPU speed quite nicely I find. If you then plug in the mains for something intensive like a game with graphics or some compiling then the both processor cores will ramp up to full speed and so will the graphics card as we did that earlier. Then when you need to use the laptop on the battery you will find that the clock will drop down to 800MHz from 2,400MHz and the graphics will slow down and conserve power.

Bluetooth

As we have a hardware switch for bluetooth then we can turn this on only when we need it and this will save battery power and make the system a bit more secure. Hopefully I won't need to tell you how to install bluetooth, and on my machine I made no changes to the default configuration files.

Verify that it works

If you have installed bluetooth stack and started the daemon as per the wiki instructions available here Bluetooth Send a file to a mobile phone using Gnome-Bluetooth utility in the system tray. If that worked out fine then move onto the next step, if not then troubleshoot bluetooth until you do get it working.

Saving power by turning off bluetooth by default when the system is logged into the Desktop

Basically I figured the best way to do this was to use gdm's PostLogin script that I used earlier and add a line to turn off the power to the device.

Template:Command Template:Command