You are here: sethdepot>FunWithGadgets>DebianLinux (2013-10-05, RoLaUser)

Debian Linux

Debian is free and its developers are cosmopolitans - Linux Magazin

Whenever I manage to get something running, which I struggled long time with (means, it's not yet documented across the internet, or I am to stupid to find it :-) I will share my findings here. Hope it comes to the benefit of somebody. Somewhen

My current setup:

  • Main Work Computer: Debian Testing
  • Main Notebook: Debian Squeeze Stable
  • Acer Aspire One: Debian Squeeze Stable

Contents

Disclaimer
The modifications presented here can break your system! Know what you're doing before following my ideas here - and always have a backup at hand!

Hotfix: Uswusp/Hibernate - Workaround for very slow and delayed suspend

2013-05-31

Keywords: s2disk, s2ram, hibernate, uswsusp

Symptoms
Suspend to Disk or Suspend to RAM (both hibernate and uswsusp/s2disk/s2ram) exhibit a big delay between initiation and reaching the sleep state.
This seems to be related to NVIDIA SATA controller
lspci output: 00:0e.0 IDE interface: NVIDIA Corporation MCP51 Serial ATA Controller (rev a1)

dmesg shows following error messages after resume

   May 31 07:57:32 keroro kernel: [ 5466.192861] serial 00:07: System wakeup disabled by ACPI
   May 31 07:57:32 keroro kernel: [ 5527.008062] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
   May 31 07:57:32 keroro kernel: [ 5527.008066] ata1.00: failed command: FLUSH CACHE EXT
   May 31 07:57:32 keroro kernel: [ 5527.008078] ata1.00: cmd ea/00:00:00:00:00/00:00:00:00:00/a0 tag 0
   May 31 07:57:32 keroro kernel: [ 5527.008078]          res 40/00:00:00:4f:c2/00:00:00:00:00/00 Emask 0x4 (timeout)
   May 31 07:57:32 keroro kernel: [ 5527.008081] ata1.00: status: { DRDY }
   May 31 07:57:32 keroro kernel: [ 5527.008092] ata1: hard resetting link
   May 31 07:57:32 keroro kernel: [ 5527.008095] ata1: nv: skipping hardreset on occupied port
   May 31 07:57:32 keroro kernel: [ 5527.476042] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
   May 31 07:57:32 keroro kernel: [ 5527.587709] ata1.00: configured for UDMA/133
   May 31 07:57:32 keroro kernel: [ 5527.587716] ata1.00: retrying FLUSH 0xea Emask 0x4
   May 31 07:57:32 keroro kernel: [ 5527.612092] ata1.00: device reported invalid CHS sector 0
   May 31 07:57:32 keroro kernel: [ 5527.612117] ata1: EH complete
   May 31 07:57:32 keroro kernel: [ 5527.612264] sd 0:0:0:0: [sda] Stopping disk
   May 31 07:57:32 keroro kernel: [ 5527.628071] PM: suspend of devices complete after 61438.770 msecs

As you can see there is a long waiting time for ata1, and suspend takes 61 seconds

Workaround: Disable async suspend

Disable async suspend manually (or verify the setting):

  echo disabled > "/sys/devices/pci0000:00/0000:00:0e.0/ata1/host0/target0:0:0/power/async"
  echo disabled > /sys/devices/pci0000\:00/0000\:00\:0e.0/ata2/host1/target1\:0\:0/power/async 

Can be automated with the following udev rule, put to the file /etc/udev/rules.d/86-async-scsi-disable.rules

# Workaround for broken/slow suspend by disabling async ata/scsi targets
# https://sethdepot.org/site/DebianLinux
ACTION=="add", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_target", ATTR{power/async}="disabled"

Sources

Configure: Aptitude - Filter out foreign architectures and show package origin

2013-05-12

After finally updating Skype with Wheezy I switched to multiarch support and added i386 for Skype (my native architecture is amd64).

Everything fine, besides now most of the packages in Aptitude show up twice: Once for my native arch and another time for i386. Thats kinda annoying, thats why after some googling I now managed to ban all these foreign packages into a submenu. On this turn I also removed the extra section which always bugged me because it is most of the time only "main" which I need to open in addition.

Being on it I also added the display of the package origin in the package list, because I mix debian with Ubuntu packages and want to see which one I am looking at.

It now looks like this:
aptitude_pimped.png

To get the same add the following lines to your aptitude configuration file (or create a new one):
/etc/apt/apt.conf.d/00aptitude

Aptitude::UI {
  // Filter out foreign architectures - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=687888
  // Also remove superfluous grouping on the way: topdir section
  // Default is: filter(missing),status,section(subdirs,passthrough),section(topdir)
  Default-Grouping "filter(missing),status,pattern(?architecture(foreign) => Foreign architecture, ?true ||),section(subdirs,passthrough)";

  // Also show archive origin and size change in package display
  // http://bleah.co.uk/blog/posts/group_by_origin_in_aptitude/
  // Default: %c%a%M %p %Z %v %V
  Package-Display-Format "%c%a%M%S %p %t %v %V %Z";

}

References - Thanks!

Configure: Use "o" and "C-o" within emacs magit-mode

2013-05-11

When you use emacs with dired mode or svn-mode you can open a file in then other window by pressing the "o" key or "C-o" (and stay in the orginating window). The popular Git-interface Magit puts the submodule mode on this key.

In case you like the known behavour back then put the following code into your ~/.emacs file

;; Enable Magit (when not done somewhere else)
(require 'magit)

;; Magit special key functions
(add-hook 'magit-mode-hook
    (lambda ()
        ;; Re-Bind "o" to open file in other window (overwrites magit-key-mode-popup-submodule)
        (define-key magit-mode-map (kbd "o") #'(lambda() (interactive)
              (let ((current-prefix-arg '(4))) ; C-u
              (call-interactively 'magit-visit-item) )
   ))
        ;; Re-Bind "C-o" to open file in other window (and switch back)
        (define-key magit-mode-map (kbd "C-o") #'(lambda() (interactive)
              (let ((current-prefix-arg '(4))) ; C-u
              (call-interactively 'magit-visit-item))
              (call-interactively 'other-window)
   ))
    )
)

Configure: Mailto links in Chromium/Chrome do not open in Icedove

2013-04-13

I had the problem that when clicking on mailto: links no mail window opened. During some quick debugging I learned that chromium uses xdg-email internally, which also did not worked. No error, no compose window.
I then found out that the preferred email application was not set up correctly

For the XFCE4 desktop do the following:

  1. Open "Preferred Applications" in the settings dialog
  2. Edit the preferred Mail program and enter:
    /usr/bin/icedove -compose "to=%s"
    (the -compose was missing for me)
  3. Done, you can try with
    xdg-email "test@example.org"

Debug: pam_unix(sudo:auth): conversation failed

2012-01-06

After the last batch Debian update I found myself locked out of sudo.
Rebooting into maintenance mode I found the following lines in the logfile /var/log/auth

sudo: pam_unix(sudo:auth): conversation failed
sudo: pam_unix(sudo:auth): auth could not identify passwod for user

The error was unclear, but the solution simple: A typo (a missing comment sign) in one of the files below /etc/pam.d/ which were included from /etc/pam.d/sudo

Configure: Screen Brightness Control with Keyboard Function Keys

2011-04-04

Recently I upgraded my main notebook to an NEC Lavie lm370 model. Unfortunately (among other issues) the brightness function keys in the integrated keyboard did not work automatically. To enable them, follow these instructions

  1. First make keys known by adding them to the file /etc/rc.local :
    # Get Brightness control keys working; map to XF86 Brightness keys
    # up
    setkeycodes 65 225
    # down
    setkeycodes 67 224
  2. Install acpi-support and dependencies when not yet done
  3. Add the event handler to /etc/acpi/events/brightness :
    # Control Brightness on NEC Lavie
    # See ../brightness.sh

    event=video/brightness*
    action=/etc/acpi/brightness.sh %e
  4. Put the brightness control script brightness.sh to /etc/acpi/
  5. Done, just reboot your system

Hotfix: cryptsetup: Enable resume from encrypted swap when the root filesystem is not encypted

2010-11-10

It is possible to setup encrypted swap and resume from it with the help of decrypt_derived. Unfortunately due to a bug in cryptsetup this will fail when the base filesystem is not the root filesystem.
In this case the source filesystem is omitted from the initramfs upon creation.

For my setup I only have /home (sda8_crypt) and swap (sda6_crypt) encrypted, not the root filesystem.
The initramfs hooks only include the swap_crypt in the initramfs, thus I get an error, "decrypt_derived: failed to find ..." at boot time.

Content of /etc/crypttab :

sda8_crypt UUID=[...] none luks
sda6_crypt /dev/sda6 sda8_crypt luks,keyscript=/lib/cryptsetup/scripts/decrypt_derived

To work around this issue I added an really ugly hack into /usr/share/initramfs-tools/hooks/cryptroot :

Before the lines

# Load the config opts and modules for each device
for dev in $rootdev $resumedevs; do

I added
rootdev="sda8_crypt"

And before the lines

# With large initramfs, we always add a basic subset of modules
if [ "$MODULES" != "dep" ]; then

I added

# 2010-08-09
# Because not fixed: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=475838
# Ugly hack, to have also the dependent device included
echo "cryptroot: Ugly hack, to have also the dependent device included"
cat $DESTDIR/conf/conf.d/cryptroot

And then run
update-initramfs -u -v

Reported also as Debian Bug #592430 (up to now no reaction)

Hotfix: Enter passphrase for resume with uswsusp from a USB Keyboard

2010-08-06

When your initramfs policy (/etc/initramfs-tools/conf.d/driver-policy) is set to dep then only the required modules are included in your initramfs. When you now setup encrypted hibernate/resume with uswsusp and want to use an USB Keyboard to enter the passphrase, unfortunately these drivers are not included automatically.
The result: You are prompted for the passphrase on bootup, but cannot enter it with your USB keyboard.

As a workaround I added the following lines into /etc/initramfs-tools/modules

hid
usbhid
usbcore
uhci_hcd
ehci_hcd

(Not sure wether all of these modules are needed, at least it's working this way)

See also Bug Report 512291

Configure: Reinstall Grub after System Recovery on New Hard Drive

2010-07-07

Maybe you know one of the days when everything goes wrong. Like your hard drive dies. Fortunately you will have a complete backup at hand (You will, won't you? Otherwise I recommend you to setup one with rsnapshot).
Recreating the file system on a new hard drive (with the help of a recovery DVD or USB Stick) and copying the files is a piece of cake. Just how to get the Grub bootloader installed again on the system?
For me it was not straight forward, so here are the steps I needed to take. Maybe it goes better with just another snapshot of Debian Testing. Find out by yourself.

Note: After new installation the UUIDs of your partitions are changed. I think you can take care about this during the formatting of the devices. In case you forget this, make sure to adapt the UUIDs in the following files: /etc/fstab , /etc/crypttab , /etc/uswsusp.conf

  1. Debian Installer: Boot into Rescue System, use your previous root partition as root
  2. Don't forget to manually mount your /boot drive in case it's on another partition
  3. grub-install /dev/sda # Use your boot drive of course
  4. In case your don't got your old grub menu back do a manual boot with the following grub commands
    set root=(hd0,1) # Use your /boot file system here
    linux   /vmlinuz root=/dev/sdXY ro single
    initrd /initrd
    boot
  5. After first boot back into your old system, Recover the grub setup via
    mount /boot # in case that's required
    export PATH=$PATH:/usr/sbin
    update-grub

Configure: Japanese-English Keyboard Layout

2009-10-11

Do you know this problem? The US english keyboard layout is perfect for programming and the daily work, but for your daily communication you also need the German special characters - most likely the Umlauts öäüÖÄÜ and ß, and also €, § and °. So a German keyboard layout would be nice - but it will hinder you in your programming and shell operation work. Always switchung layouts is no option, because it will get you confused and hinder you from your work.

For myself I found a suitable solution long time ago: A japanese keyboard has a programmer-friendly layout of all the special characters. And it has enough additional keys to allow putting all the German special characters on it. A simple task for your xmodmap, right? Right ... but for one key: カタカナ_ひらがな ! This key has special use in Japanese, so (out of whatever reason) it will ignore any combination with Shift.

So what can you do? After a long weekend I finally found the solution, which I will give you here.

  1. Define a new symbol table
    • Put the following file into the directory /usr/share/X11/xkb/symbols : jp_de
      With this, the special meaning of the カタカナ_ひらがな key is gone
  2. Use the layout in your xorg config by putting/changing this in the file /etc/X11/xorg.conf
    Option          "XkbLayout"     "jp_de"
  3. Last thing to do, is to setup the special keys with the following modmap by xmodmap Xmodmap_jp_de : jp_de_Xmodmap
    Maybe you need to change the keycode numbers, which you can find with the program xev

Of course it should be possible to get rid of xmodmap at all, and move everything to the symbols file. I just did not managed it so I gave up, because this solution is working perfectly for me. Somebody can give me a hint here? It will be appreciated.

So how's the result looking like? This way: jp_de_keyboard.png



Install: Fonic Surf-Stick GSM Modem

2009-07-01

This Fonic Surf-Stick is a UMTS/GSM Modem with a fairly good flatrate offer. The device itself is an HUAWEI E220 / E270 (according to lspci ) and a HUAWEI E160 (according to usbmon) :-)
So, let's get it running with our Acer Aspire One and Debian, won't we? This tutorial of course will also work for all other Debian Lenny computers with this kind of USB Sticks.

  1. First, let's install the ppp daemon, which does the actual data transmission: aptitude install ppp
    1. Make connections without authentification the default
      • The Fonic provider requires connection without authentification. Normally, the "noauth" option is only allowed for root. But I dislike running programs as root, so I made up a quick-n-dirty workaround
      • ALERT! Attention! When you use ppp for other means in your system, make sure this workaround does not break your other connections!
      • You know a more elegant solution? Please tell me!
      • Change in the file /etc/ppp/options: auth --> noauth
      • Another solution - for the who cares about security? fraction among you - is to simply run umtsmon as root (sudo umtsmon)
    2. Add the users you want to allow initiating a GSM (technically a ppp) connection to the group "dip":
      adduser username dip
  2. Install umtsmon from Sidux
    1. Get archive key package from here (or take any newer one):
      http://debian.tu-bs.de/project/sidux/debian/pool/main/s/sidux-keyring/sidux-archive-keyring_2007.03.08_all.deb
      dpkg -i sidux-archive-keyring_2007.03.08_all.deb
    2. Add to /etc/apt/sources.list
      # umtsmon
      deb http://debian.tu-bs.de/project/sidux/debian/ sid fix.main
    3. Install: aptitude install umtsmon
  3. Setup umtsmon
    1. Create a new profile, let's just call it "Fonic"
    2. Edit, put as APN "pinternet.interkom.de"
    3. Don't check the "noauth" box when you used the previously described modification of the ppp options file
      (Check the box when you're running umtsmon as root)
  4. Get connected by clicking on the "Connect" Icon, and you're in!

As a goodie, with umtsmon you can now send SMS with your computer. That's nice, isn't it?

Another solution is getting Network Manager >= 0.7, but that's another story for a stable Lenny. When you're using testing (called sid) then it should work out of the box. Ah, don't forget to store the PIN in the connection itself, otherwise Network Manger could refuse to connect.
Also you most likely need to install the packet "modemmanager" to get the USB stick recognised for Network Manager.



Contact me

Topic revision: r15 - 2013-10-05 - 19:45:42 - RoLaUser

Others

Updates


Has Bitcoins?
I take em

 

This site is powered by Foswiki © by the contributing authors.
The content of this side is placed - when not noted otherwise - under a creative commons licensed under a Creative Commons license (Deutsch)