Outils d'utilisateurs

Outils du Site


tips:delle6320linux

Cancey (ArchLinux on a Dell E6320)

Cancey's the name.

Key Advantages

Generic config

/etc/rc.conf
MODULES=(dell-laptop dell-wmi acpi_cpufreq)
...
DAEMONS=(syslog-ng sensors healthd smartd sensord hddtemp acpid laptop-mode cpufreq iptables ip6tables !network net-profiles net-auto-wired net-auto-wireless @openntpd sshd ddclient cupsd crond dbus mbm-gpsd gpsd @avahi-daemon bluetooth alsa mpd mpdscribble pcscd gdm

X11

i915

When X11 starts with an external (full HD) screen attached, it clones the display, which seems to mess up XRandR afterwards.

:!: As of gdm-3.4.1, this doesn't happen anymore, and this hack can be deactivated.

Cause

Investigating into diffed logs, it shows

Xorg.broken.log
 (II) intel(0): Using fuzzy aspect match for initial modes
 (II) intel(0): Output LVDS1 using initial mode 1024x768
 (II) intel(0): Output HDMI3 using initial mode 1024x768
...
 (**) intel(0): DPI set to (89, 121)
...
 (II) intel(0): Allocated new frame buffer 1024x768 stride 4096, tiled

instead of

Xorg.works.log
 (II) intel(0): Using exact sizes for initial modes
 (II) intel(0): Output LVDS1 using initial mode 1366x768
...
 (**) intel(0): DPI set to (119, 121)
...
 (II) intel(0): Allocated new frame buffer 1408x768 stride 5632, tiled

when no screen is attached, and the desired behaviour is observed.

Solution

To fix this, the built-in LCD screen (LVDS1) is pinned to its nominal resolution with an xorg.conf snippet.

/etc/X11/xorg.conf.d/01-LVDS1.conf
Section "Screen"
        Identifier      "Default Screen"
        Monitor         "Configured Monitor"
        Device          "Configured Video Device"
        DefaultDepth    24
        SubSection      "Display"
                Viewport        0 0
                Depth           24
                Modes           "1366x768"
        EndSubSection
EndSection

As X11 starts in clone mode, all the others are pinned too, but it's not a big deal.

Input

With a stock kernel, the trackpad on Dell Inspiron E6410 not recognized. The patch applies nicely and works on the ARCH kernel from ABS.

By default, only vertical two-finger scrolling is enabled. The horizontal one can be activated through some more X configuration. We also enable other niceties at the same time.

/etc/X11/xorg.conf.d/10-synaptics.conf
        ...
        Option "CornerCoasting" "1"
        Option "HorizEdgeScroll" "1"
        Option "HorizTwoFingerScroll" "1"
        Option "VertEdgeScroll" "1"
        ...

</file>

While we're at it, a dead-key international Dvorak mapping is also set as the default.

/etc/X11/xorg.conf.d/10-evdev.conf
Section "InputClass"
        Identifier "evdev keyboard catchall"
        MatchIsKeyboard "on"
        ...
        # Keyboard layouts
        Option "XkbLayout" "us"
        Option "XkbVariant" "dvorak-intl"
        Option "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

Dell still doesn't cater for us Dvorak users, and do not offer that keyboard layout on their laptops. Fortunately, some shops, such as this one, offer decently priced stickers to overlay on top of the keys, and make the laptop's in-built keyboard truly usable (apart, sadly, for the backlight which stills shows a QWERTY layout…).

Using SLiM as the Session Manager

At some point, GDM started behaving erratically and making my sessions freeze. I switched to SLiM, a simple and lightweight session manager. However, it doesn't expect exactly the same sessions as GDM, and doesn't set them exactly in the same way (no PulseaAudio, no .xsession-errors redirection).

A quick fix was to add a custom .xinitrc in my session.

#!/bin/bash
mv .xsession-errors .xsession-errors.old
pulseaudio --start &
/etc/gdm/Xsession fvwm > .xsession-errors

ACPI and sleep modes

Low battery

/etc/laptop-mode/conf.d/auto-hibernate.conf
ENABLE_AUTO_HIBERNATION=1
HIBERNATE_COMMAND=/usr/bin/systemctl hibernate

pm-utils

:!: Since ArchLinux migrated to systemd, the rest of this section is outdated. Rather, one has to look towards /etc/systemd/logind.confv None of the following is needed anymore :!:

The desired behaviour is a follows.

  • Blank screen on
    • Lid closed on AC
  • Suspend to RAM on
    • Lid closed on battery
    • Power button pressed on AC
  • Suspend to disk on
    • Power button pressed on battery
    • Low battery

Power Button

Add the relevant file to manage the power button.

/etc/acpi/events/lm_power
event=button/power
action=/etc/acpi/actions/lm_power.sh %e

And the related script.

/etc/acpi/actions/lm_power.sh
#!/bin/bash
/bin/sync
if [ x`cat /sys/class/power_supply/AC/online` == x1 ]; then
        /usr/bin/logger "[$0] Suspending due to $1 event ($2)"
        /usr/sbin/pm-suspend
else
        /usr/bin/logger "[$0] Hibernating due to $1 event ($2) on battery"
        /usr/sbin/pm-hibernate
fi

:!: Since May 19 (at least, on my machine) there is a /etc/acpi/handler.sh which “takes an entry for all actions.” It is also mentioned here. However, it races with the configuration above (both suspending AND powering the machine off). Simply renaming it out of the way seems to work.

Lid

We add another set of event and script tr manage the lid.

/etc/acpi/events
event=button/lid
action=/etc/acpi/actions/lm_lid_e6320.sh %e
/etc/acpi/actions/lm_lid_e6320.sh
#!/bin/bash
if [ x`cat /sys/class/power_supply/AC/online` == x1 ]; then
        if grep -q closed /proc/acpi/button/lid/LID/state; then
                /usr/bin/logger "[$0] Blanking and locking due to $1 event ($2) (or so should it be)"
        fi
else
        if grep -q closed /proc/acpi/button/lid/LID/state; then
                /usr/bin/logger "[$0] Suspending due to $1 event ($2) on battery"
                /bin/sync
                /usr/sbin/pm-suspend
        fi
fi

Ethernet

Sometimes, the ethernet interface (driven by e1000e) does not see any carrier (NO-CARRIER) despite being properly plugged in. This is a known bug, with a patch waiting in the pipe. This seems to be related to power management, and the device sleeping when it shouldn't.

In the meantime, forcibly waking the device works.

$ sudo -i
# echo on > /sys/bus/pci/devices/0000\:00\:19.0/power/control

Mobile Broadband

These seem to be quite similar to those on the Dell Latitude E4300. See the AT command set for that broadband module, which seems to be similar. Generic support is being developed there.

Its status (RF-Kill/flight mode) is linked to the wireless button on the right side of the laptop. This is confirmed by the AT+CFUN command on ttyACM0.

Wireless button on:

$ sudo screen /dev/ttyACM0

*EMRDY: 1
AT+CFUN?
+CFUN: 1

OK

and off:

$ sudo screen /dev/ttyACM0

*EMRDY: 1
AT+CFUN?
+CFUN: 4

OK

In that latter mode, many functions used below just return ERROR.

GPS

The pseudo reference says the GPS's output is first configured through ttyACM0. Experience here however shows that all the initialisation can be done on ttyACM2 (GPSD initialisation string, huh?). We set it on, with a period of 1 second, and enable DGPS.

$ sudo screen /dev/ttyACM2

*EMRDY: 1
AT+CFUN=1
OK
AT*E2GPSCTL=1,1,1
OK
AT*E2GPSNPD 

After the last command, NMEA strings will start outputing, which GPSD can happily munch on.

/etc/conf.d/gpsd
# Default settings for gpsd.
START_DAEMON="true"
GPSD_OPTIONS=""
DEVICES="/dev/ttyACM2"
USBAUTO="true"
$ sudo rc.d start gpsd
:: Starting gpsd                                                         [DONE]

There is also an application, MBM-GPSD, which can do all that on our behalf. It is in AUR. Using it just requires starting it before gpsd, and pointing the latter to /dev/gps0 instead of /dev/ttyACM2.

Modem

The ArchLinux Wiki has some documentation on the topic. We first adjust the default options.

/etc/ppp/options.mobile
ttyACM1
#921600
115200
lock
crtscts
modem
passive
novj
defaultroute
noipdefault
usepeerdns
noauth
hide-password
persist
holdoff 10
maxfail 0
debug

Then the peers file.

/etc/ppp/peers/mobile
file /etc/ppp/options.mobile
connect "/usr/sbin/chat -v -t15 -f /etc/ppp/chatscripts/mobile-modem.chat"

As mentionned on the ArchWiki, the chat scripts are not present, so me first mkdir /etc/ppp/chatscripts, then add (copy/paste) the relevant chat script (the SIM card has no PIN code; had it had one, MBM would have taken care of it anyway; the same goes for the mode).

/etc/ppp/chatscripts/mobile-modem.chat
ABORT 'BUSY'
ABORT 'NO CARRIER'
ABORT 'VOICE'
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT 'DELAYED'
REPORT CONNECT
TIMEOUT 6
'' 'ATQ0'
'OK-AT-OK' 'ATZ'
TIMEOUT 3
#'OK' @/etc/ppp/chatscripts/pin
'OK-AT-OK' 'ATI'
'OK' 'ATZ'
'OK' 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0'
#'OK' @/etc/ppp/chatscripts/mode
'OK-AT-OK' @/etc/ppp/chatscripts/apn
'OK' 'ATDT*99***1#'
TIMEOUT 30
CONNECT ''

Vodafone's APN is 'live.vodafone.com' prepaid APN is 'vfprepaymbb', which we put in '/etc/ppp/chatscripts/apn.au.vodafone'

/etc/ppp/chatscripts/apn.au.vodafone
AT+CGDCONT=1,"IP","vfprepaymbb"

To which a symlink is created as 'ln -s '/etc/ppp/chatscripts/apn.au.vodafone /etc/ppp/chatscripts/apn.

Finally, all this can be hooked into 'netcfg' with '/etc/network.d/mobile'.

/etc/network.d/mobile
CONNECTION='ppp'
INTERFACE='ignore'
PEER='mobile'
PPP_TIMEOUT=30

SmartCard

We follow the document about Using an OpenPGP SmartCard. The BCM5880, which support the CCID protocol, is supported through ArchLinux packages pcsclite and ccid.

As the key is already on the OpenPGP, it needs to be registered to the local GPG so it can use it. It seems to be sufficient to import the public key via GnuPG's –card-edit command.

$ gpg --card-edit
Application ID ...: [...]
ssb#  2048R/72DDD6F1  created: 2009-05-11  expires: 2010-11-04

gpg/card> fetch
gpg: requesting key 13912971 from http server olivier.mehani.name
gpg: key 98C66655: "Olivier Mehani <shtrom@ssji.net>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1

Suspend/Resume

Preparing initramfs

The initramfs needs to support resuming. This is configured in the relevant file by adding the hook before filesystems.

/etc/mkinitcpio.conf
...
HOOKS="base udev autodetect pata scsi sata resume filesystems usbinput"
...

The initramfs can then be rebuilt.

$ sudo mkinitcpio -p linux
==> Building image from preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: 3.0-ARCH
  -> Parsing hook: [base]
  -> Parsing hook: [udev]
  -> Parsing hook: [autodetect]
  -> Parsing hook: [pata]
  -> Parsing hook: [scsi]
  -> Parsing hook: [sata]
  -> Parsing hook: [resume]
  -> Parsing hook: [filesystems]
  -> Parsing hook: [usbinput]
==> Generating module dependencies
==> Creating gzip initcpio image: /boot/initramfs-linux.img
==> Image generation successful
==> Building image from preset: 'fallback'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> Starting build: 3.0-ARCH
  -> Parsing hook: [base]
  -> Parsing hook: [udev]
  -> Parsing hook: [pata]
  -> Parsing hook: [scsi]
  -> Parsing hook: [sata]
  -> Parsing hook: [resume]
  -> Parsing hook: [filesystems]
  -> Parsing hook: [usbinput]
==> Generating module dependencies
==> Creating gzip initcpio image: /boot/initramfs-linux-fallback.img
==> Image generation successful

Letting GRUB Know Where to Resume From

Grub2 generates most of its configuration file automatically, and forgets about manual additions. Fortunately, it can be tweaked in /etc/default/grub, by setting

GRUB_CMDLINE_LINUX_DEFAULT="resume=/dev/sda2"

(the DEFAULT variant is only appended to the kernel's command line on normal boots, while the non-DEFAULT one is always added).

Then, grub can be reconfigured.

 $ sudo grub-mkconfig -o /boot/grub/grub.cfg

(Open)NTPd-synced clock too fast after suspend

After suspend, with OpenNTPd running, the machine clock ends up being too fast by a few minutes. This is because suspend/hibernate disturbs NTP estimates.

Adding a script in /etc/pm/sleep.d/ seems to do the trick fix the problem. An issue has been openned with ArchLinux about that.

/etc/pm/sleep.d/90openntpd
#!/bin/sh
#
# 90openntpd: suspend/wakeup OpenNTPd
 
case "$1" in
hibernate|suspend)
;;
thaw|resume)
systemctl restart openntpd.service
;;
*) exit $NA
;;
esac
tips/delle6320linux.txt · Dernière modification: 2013/11/15 05:06 (modification externe)