Outils pour utilisateurs

Outils du site


Panneau latéral

Tips

Divers

Projets

Ham Radio

Machines

Research

Privé

Études

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.

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

ACPI and sleep modes

CPU frequency management

$ sudo pacman -S cpupower
$ sudo sed -i 's/^#\?governor/governor=performance/' /etc/default/cpupower
$ sudo systemctl enable cpupower
$ sudo systemctl start cpupower

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.

From http://www.thinkwiki.org/wiki/Ericsson_F3507g_Mobile_Broadband_Module:

$ for n in `ls /sys/class/*/*{ACM,wdm,wwan0}*/device/interface`;do echo $(echo $n|awk -F '/' '{print $5}') : $(cat $n);done
wwan0 : Dell Wireless 5550 HSPA+ Mobile Broadband Mini-Card Network Adapter
ttyACM0 : Dell Wireless 5550 HSPA+ Mobile Broadband Mini-Card Modem
ttyACM1 : Dell Wireless 5550 HSPA+ Mobile Broadband Mini-Card Data Modem
ttyACM2 : Dell Wireless 5550 HSPA+ Mobile Broadband Mini-Card GPS Port
cdc-wdm0 : Dell Wireless 5550 HSPA+ Mobile Broadband Mini-Card Device Management
cdc-wdm1 : Dell Wireless 5550 HSPA+ Mobile Broadband Mini-Card USIM Port

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.

Modem

The modem works with mmcli from the ModemManager package.

$ sudo pacman -S modemmanager
$ sudo systemctl enable ModemManager
$ sudo systemctl start ModemManager
$ sudo mmcli -L
Found 1 modems:
    /org/freedesktop/ModemManager1/Modem/0 [Dell] DW5550
$ sudo mmcli -m 0  --simple-connect apn=internet # 0 comes from the list above

Note: ModemManager seemed to disrupt the functionning of another 3G dongle (Huawei E160) connected to the machine as a stop-gap measure, even though it didn't actually list it as another modem. That modem worked out of the box (without ModemManager) with netctl's mobile_ppp profile, once the right APN was set.

tldr; Quick and dirty connection script

wwan.sh
#!/bin/sh
APN=internet
DHCP="sudo dhcpcd"
 
MODEM=`mmcli -L | sed -n 's#.*\(/org/.*/Modem/[0-9]\+\).*#\1#p'`
echo "Using modem ${MODEM} to connect to APN ${APN}..." >&2
 
mmcli -m ${MODEM} --simple-connect apn=${APN} >/dev/null
 
BEARER=`mmcli -m ${MODEM} | sed -n 's#.*\(/org/.*/Bearer/[0-9]\+\).*#\1#p'`
echo "Bearer: ${BEARER}" >&2
IF=`mmcli -m ${MODEM} -b ${BEARER} | sed -n "s/.*interface: '\([^ \t]\+\)'.*/\1/p"`
echo "Obtaining IP address on ${IF}..." >&2
 
${DHCP} ${IF}

More fiddly version

$ mmcli -m 0
/org/freedesktop/ModemManager1/Modem/0 (device id '25cc83245aba9c8a5cee70f6c3b391fe9f1aef4a')
  -------------------------
  Hardware |   manufacturer: 'Dell'
           |          model: 'DW5550'
           |       revision: 'R2A07(R2A07)'
           |      supported: 'gsm-umts'
           |        current: 'gsm-umts'
           |   equipment id: 'XXX'
  -------------------------
  System   |         device: '/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6'
           |        drivers: 'cdc_acm, cdc_ncm, cdc_wdm'
           |         plugin: 'Ericsson MBM'
           |   primary port: 'ttyACM1'
           |          ports: 'ttyACM1 (at), cdc-wdm0 (at), cdc-wdm1 (at), wwp0s29u1u6i6 (net), ttyACM2 (at), ttyACM0 (at)'
  -------------------------
  Numbers  |           own : 'unknown'
  -------------------------
  Status   |           lock: 'none'
           | unlock retries: 'sim-pin (3), sim-pin2 (3), sim-puk (10), sim-puk2 (10)'
           |          state: 'connected'
           |    power state: 'on'
           |    access tech: 'umts'
           | signal quality: '80' (recent)
  -------------------------
  Modes    |      supported: 'allowed: any; preferred: none'
           |        current: 'allowed: any; preferred: none'
  -------------------------
  Bands    |      supported: 'unknown'
           |        current: 'unknown'
  -------------------------
  IP       |      supported: 'ipv4, ipv6'
  -------------------------
  3GPP     |           imei: 'XXXX'
           |  enabled locks: 'none'
           |    operator id: '50502'
           |  operator name: 'YES OPTUS'
           |   subscription: 'unknown'
           |   registration: 'home'
  -------------------------
  SIM      |           path: '/org/freedesktop/ModemManager1/SIM/0'

  -------------------------
  Bearers  |          paths: none
$ mmcli -m 0 -e
XXX: Missing output
$ mmcli -m 0 -w
    /org/freedesktop/ModemManager1/Modem/0: Initial state, 'enabled'
$ ^Ccancelling the operation...
$ mmcli -m 0 --create-bearer apn=internet
XXX: Missing output
$ mmcli -m 0 --list-bearers
Found 1 bearers:

    /org/freedesktop/ModemManager1/Bearer/0
  615  mmcli  -m 0 -b 0 -c
  577  mmcli -L
/org/freedesktop/ModemManager1/Modem/0 (device id '25cc83245aba9c8a5cee70f6c3b391fe9f1aef4a')
  -------------------------
  Hardware |   manufacturer: 'Dell'
           |          model: 'DW5550'
           |       revision: 'R2A07(R2A07)'
           |      supported: 'gsm-umts'
           |        current: 'gsm-umts'
           |   equipment id: 'XXX'
  -------------------------
  System   |         device: '/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6'
           |        drivers: 'cdc_acm, cdc_ncm, cdc_wdm'
           |         plugin: 'Ericsson MBM'
           |   primary port: 'ttyACM1'
           |          ports: 'ttyACM1 (at), cdc-wdm0 (at), cdc-wdm1 (at), wwp0s29u1u6i6 (net), ttyACM2 (at), ttyACM0 (at)'
  -------------------------
  Numbers  |           own : 'unknown'
  -------------------------
  Status   |           lock: 'none'
           | unlock retries: 'sim-pin (3), sim-pin2 (3), sim-puk (10), sim-puk2 (10)'
           |          state: 'connected'
           |    power state: 'on'
           |    access tech: 'umts'
           | signal quality: '80' (recent)
  -------------------------
  Modes    |      supported: 'allowed: any; preferred: none'
           |        current: 'allowed: any; preferred: none'
  -------------------------
  Bands    |      supported: 'unknown'
           |        current: 'unknown'
  -------------------------
  IP       |      supported: 'ipv4, ipv6'
  -------------------------
  3GPP     |           imei: 'XXX'
           |  enabled locks: 'none'
           |    operator id: '50502'
           |  operator name: 'YES OPTUS'
           |   subscription: 'unknown'
           |   registration: 'home'
  -------------------------
  SIM      |           path: '/org/freedesktop/ModemManager1/SIM/0'

  -------------------------
  Bearers  |          paths: '/org/freedesktop/ModemManager1/Bearer/0'
$ sudo dhclient wwp0s29u1u6i6
$ ip a s dev wwp0s29u1u6i6
45: wwp0s29u1u6i6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 02:80:37:ec:02:00 brd ff:ff:ff:ff:ff:ff
    inet 10.35.242.47/27 brd 10.35.242.63 scope global wwp0s29u1u6i6
       valid_lft forever preferred_lft forever
    inet6 fe80::80:37ff:feec:200/64 scope link
       valid_lft forever preferred_lft forever

netctl integration

XXX FIXME: needs PreUp hook, then DHCP

Handy mmcli commands

Send and read SMSs
$ mmcli -m 0 --messaging-create-sms 'number=PHONNO,text="Message"'
Successfully created new SMS:
    /org/freedesktop/ModemManager1/SMS/6 (unknown)
$ $ mmcli -m 0  --messaging-list-sms

Found 4 SMS messages:
    /org/freedesktop/ModemManager1/SMS/3 (received)
    /org/freedesktop/ModemManager1/SMS/4 (received)
    /org/freedesktop/ModemManager1/SMS/5 (received)
    /org/freedesktop/ModemManager1/SMS/6 (unknown)
$ mmcli -m 0 -s 6  --messaging-status
SMS '/org/freedesktop/ModemManager1/SMS/7'
  -----------------------------------
  Content    |              number: 'PHONNO'
             |                text: 'Message'
  -----------------------------------
  Properties |            PDU type: 'submit'
             |               state: 'unknown'
             |             storage: 'unknown'
             |     delivery report: 'not requested'
$ mmcli -m 0 -s 6 --send

= Variation on the same theme: check Coles Mobile balance =

Sending 'BAL' to 9999.

$ mmcli -m 0 --messaging-create-sms 'number=9999,text="BAL"'
Successfully created new SMS:
    /org/freedesktop/ModemManager1/SMS/14 (unknown)
$ mmcli -s /org/freedesktop/ModemManager1/SMS/14 --send
$ mmcli --messaging-status -s 15 # wait a bit, then guess what the next SMS ID will be
SMS '/org/freedesktop/ModemManager1/SMS/15'
  -----------------------------------
  Content    |              number: '9999'
             |                text: 'Coles Prepaid Your service number is XXXXXXXXXX
Your rate plan is Coles Prepaid $10 for 10 Days
Your service will expire 04/08/16
Your balance is $0.00
Your balance is made up of:
278MB Extra Data Exp 04/08/16

Recharge now at your local Coles Supermarket or Coles Express, or call 555'
  -----------------------------------
  Properties |            PDU type: 'deliver'
             |               state: 'received'
             |             storage: 'me'
             |                smsc: '+61411990165'
             |           timestamp: '160729125302+10'
Geo-location
$ mmcli -m 0 --location-status

/org/freedesktop/ModemManager1/Modem/4
  ----------------------------
  Location | capabilities: '3gpp-lac-ci'
           |      enabled: '3gpp-lac-ci'
           |      signals: 'no'
$ mmcli -m 0 --location-get

/org/freedesktop/ModemManager1/Modem/4
  -------------------------
  3GPP location   | Mobile country code: 'XXX'
                  | Mobile network code: 'X'
                  |  Location area code: 'XXXXX'
                  |             Cell ID: 'XXXXXXXX'
  -------------------------
  GPS NMEA traces | Not available
  -------------------------
  Raw GPS         | Not available
  -------------------------
  CDMA BS         | Not available

Previous attempts

This HSPA modem is supported through the cdc_mbim module, which creates an Ethernet-like network interface named wwanX. Before simply running DHCP on this interface, the underlying configuration can be set using mbimcli, with something along the lines of (FIXME: to be tested):

$ sudo mbimcli -d /dev/cdc-wdm0 --connect=[(APN),(PAP|CHAP|MSCHAPV2),(Username),(Password)]
$ sudo mbim-network /dev/cdc-wdm0 status

From https://github.com/vog/wwan-helper/blob/master/wwan-helper:

$ export APN=internet
$ export PIN=
$ export AT_CFUN_START=1 # allow GPRS; 6: force UMTS
$ export SERIAL_DEV=/dev/ttyACM1
$ chat -v -T "$APN" -U "$PIN" \
    TIMEOUT 2 \
    '*EMRDY: 1' \
    'AT+CPIN?' '+CPIN: READY-AT+CPIN="\U"-' \
    '\c' 'OK' \
    'AT+CFUN='"$AT_CFUN_START" 'OK' \
    'AT+CGDCONT=1,"IP","\T"' 'OK' \
    'AT*ENAP?' '*ENAP:1,""-AT*ENAP=1,1-' \
    '\c' 'OK' \
    < "$SERIAL_DEV" > "$SERIAL_DEV" # On
$ chat -v \
    TIMEOUT 2 \
    '*EMRDY: 1' \
    'AT*ENAP?' '*ENAP:0,""-AT*ENAP=0-' \
    '\c' 'OK' \
    'AT+CFUN=4' 'OK' \
    < "$SERIAL_DEV" > "$SERIAL_DEV" # Off

Also, http://marc.info/?l=linux-usb&m=123334979706403&w=2

Old attempts

The ArchLinux Wiki has some documentation on the topic.

One major difference seems to lie in the fact that the module first needs to be activated with the AT+CFUN=1 (GSM+WCDMA) command. This however only appears to be successfull (as confirmed with AT+CFUN?) when a SIM card is present; it remains at value 4 otherwise.

FIXME This might be fixed by adding 'OK' 'AT+CFUN=1' to the chat script after the TIMEOUT 3 line (or maybe the PIN code).

Older attempts

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

GPS

mbm-gpsd and systemd

There is an mbm-gpsd package in AUR which works out of the box to set the hardware up. It creates three /dev/gps[012], which GPSd can then use. This is not the usual, hotplug way, of using GPSd, so we need to enable the systemd unit, and tell it where to look.

$ sudo cp /usr/lib/systemd/system/gpsd.service /etc/systemd/system
$ sudo vim /etc/systemd/system/gpsd.service
/etc/systemd/system/gpsd.service
[Unit]
Description=GPS (Global Positioning System) Daemon
Requires=gpsd.socket
Requires=mbm-gpsd.service
 
[Service]
ExecStart=/usr/bin/gpsd -N /dev/gps0
 
[Install]
Also=gpsd.socket
Also=mbm-gpsd.service
$ sudo systemctl daemon-reload gpsd.service
$ sudo systemctl enable gpsd.service # Start at boot, or...
$ sudo systemctl start gpsd.service # ... topically start manually

Old, manual and pre-systemd, doc

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.

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

TODO: Auto adjust screens when plugged in

tips/delle6320linux.txt · Dernière modification: 2016-07-29 02:56 par shtrom