Tag Archives: linux

Arch Linux and netcfg: make only loopback up by default

Here’s how I do it:

$ cat /etc/network.d/loopback
CONNECTION='ethernet'
DESCRIPTION='Loopback to localhost'
INTERFACE='lo'
IP='static'
ADDR='127.0.0.1'
ROUTES=('127.0.0.0/24 via 127.0.0.1')
#GATEWAY='127.0.0.1'
#DNS=('192.168.1.1')

## For IPv6 autoconfiguration
#IP6=stateless

## For IPv6 static address configuration
#IP6='static'
#ADDR6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#ROUTES6=('abcd::1234')
#GATEWAY6='1234:0:123::abcd'

This file, of course, must be included from /etc/rc.conf, like this:

NETWORKS=(loopback)

ATmega168 documentation uses word addressing, avrdude uses byte addressing

I was programming USBaspBootloader into a metaboard with an Atmel AVR ATmega168 microcontroller. I always got this error:

usb 6-2: device descriptor read/64, error -71
...
usb 6-2: device not accepting address 21, error -71

1. USBaspBootloader’s Makefile specifies atmega168 and BOOTLOADER_ADDRESS=3800 by default. This is in hex addressing a byte, i.e. 0x3800. avrdude uses byte-addressing.

ATmega168 documentation refers to 0x1C00 as the bootloader address. This is in hex addressing a word. 0x3800 / 2 = 0x1C00.

So, when programming a bootloader using avrdude, USBaspLoader’s Makefile should have 3800 (the default), not 1C00.

2. bootloaderconfig.h has features enabled that make the bootloader too big (> 2K). I had to turm them off:

80 #define HAVE_EEPROM_PAGED_ACCESS 0
...
87 #define HAVE_EEPROM_BYTE_ACCESS 0
...
93 #define BOOTLOADER_CAN_EXIT 0

All of this was, of course, done under Linux.

How to determine raw (unmounted) disk file system type

sudo fdisk -ls

Analog Devices AD1984A (snd-hda-intel) on HP 6730s, Arch Linux

Here’s a great table for all your snd-hda-intel needs: Ubuntu Wiki audio_intel_da.

Making a GRUB boot floppy

mkfs -V -t msdos /dev/fd0
mount /dev/fd0 /media/floppy
cd /media/floppy
mkdir boot
mkdir boot/grub
cp -pa /boot/grub/* /media/floppy/boot/grub
umount /media/floppy
/sbin/grub --batch --device-map=/dev/null <<EOF
device (fd0) /dev/fd0
root (fd0)
setup (fd0)
quit
EOF

Lifted from Linux-SXS and GNU Hurd FAQ.

uzbl_tabbed.py: commands to FIFO

The list is on line 782 (ATM) of uzbl_tabbed.py. The FIFO location is determined by your settings (top of file for defaults, possibly overridden from config). It’s like this:

782     def parse_command(self, cmd):
783         '''Parse instructions from uzbl child processes.'''
784
785         # Commands ( [] = optional, {} = required )
786         # new [uri]
787         #   open new tab and head to optional uri.
788         # close [tab-num]
789         #   close current tab or close via tab id.
790         # next [n-tabs]
791         #   open next tab or n tabs down. Supports negative indexing.
...

So, to open a new tab in uzbl_tabbed from newsbeuter, you need a script like newtab.sh:

#!/bin/sh
echo "new $1" > `ls -1 /tmp/uzbltabbed_*`

Then call it from newsbeuter – put this in ~.newsbeuter/config:

browser "~/.local/share/uzbl/scripts/newtab.sh %u"

Unresolved trouble with hard drive in Debian

I had a really poorly partitioned FreeBSD slice, where I would always run out of space on /usr. Also, there are more pre-compiled desktop packages for Linux than there are for FreeBSD. I mean EclipseTrader and RSSOwl 2 mostly, but it’s also the BOINC server and BOINC project executables.

So, I decided to format the slice and try Debian again. Trying to find an unused CD or DVD was a pain.

After installing it, I immediately remembered the reason why I dumped Debian/Ubuntu in favor of FreeBSD in the first place: the nasty hard drive timeouts. But it’s not just timeouts: it’s the driver gradually reducing the mode from UDMA/133 to the lowest low of PIOs.

May 30 17:18:49 heaven kernel: ata2: SATA max UDMA/133 cmd 0x1F0 ctl 0x3F6 bmdma 0xFFA0 irq 14
May 30 17:18:49 heaven kernel: scsi1 : ata_piix
May 30 17:18:49 heaven kernel: ATA: abnormal status 0x7F on port 0x1F7
May 30 17:18:49 heaven kernel: ata3: PATA max UDMA/100 cmd 0x170 ctl 0x376 bmdma 0xFFA8 irq 15
May 30 17:18:49 heaven kernel: scsi2 : ata_piix
May 30 17:18:49 heaven kernel: ata3.00: ATA-6, max UDMA/100, 156301488 sectors: LBA48
May 30 17:18:49 heaven kernel: ata3.00: ata3: dev 0 multi count 16
May 30 17:18:49 heaven kernel: usb 5-6: new high speed USB device using ehci_hcd and address 2
May 30 17:18:49 heaven kernel: usb 5-6: configuration #1 chosen from 1 choice
May 30 17:18:49 heaven kernel: ata3.01: ATAPI, max UDMA/33
May 30 17:18:49 heaven kernel: ata3.00: configured for UDMA/33
May 30 17:18:49 heaven kernel: usb 4-2: USB disconnect, address 2
May 30 17:18:49 heaven kernel: ata3.01: configured for UDMA/33
May 30 17:18:49 heaven kernel: Vendor: ATA Model: HTS541080G9AT00 Rev: MB4O
May 30 17:18:49 heaven kernel: Type: Direct-Access ANSI SCSI revision: 05
May 30 17:18:49 heaven kernel: Vendor: TSSTcorp Model: CD/DVDW SN-S082D Rev: SS03
May 30 17:18:49 heaven kernel: Type: CD-ROM ANSI SCSI revision: 05
May 30 17:18:49 heaven kernel: ACPI: PCI Interrupt 0000:06:01.0[A] -> GSI 16 (level, low) -> IRQ 169
...
May 30 17:18:49 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:18:49 heaven kernel: sda: Write Protect is off
May 30 17:18:49 heaven kernel: SCSI device sda: drive cache: write back
May 30 17:18:49 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:18:49 heaven kernel: sda: Write Protect is off
May 30 17:18:49 heaven kernel: SCSI device sda: drive cache: write back
May 30 17:20:57 heaven kernel: ata3: port is slow to respond, please be patient
May 30 17:20:57 heaven kernel: ata3: soft resetting port
May 30 17:20:57 heaven kernel: ata3.00: configured for UDMA/33
May 30 17:20:57 heaven kernel: ata3.01: configured for UDMA/33
May 30 17:20:57 heaven kernel: ata3: EH complete
May 30 17:20:57 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:20:57 heaven kernel: sda: Write Protect is off
May 30 17:20:57 heaven kernel: SCSI device sda: drive cache: write back
May 30 17:20:57 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:20:57 heaven kernel: sda: Write Protect is off
May 30 17:20:57 heaven kernel: SCSI device sda: drive cache: write back
May 30 17:24:34 heaven kernel: ata3: port is slow to respond, please be patient
May 30 17:24:57 heaven kernel: ata3: soft resetting port
May 30 17:24:58 heaven kernel: ata3.00: configured for UDMA/33
May 30 17:24:58 heaven kernel: ata3.01: configured for UDMA/33
May 30 17:24:58 heaven kernel: ata3: EH complete
May 30 17:24:58 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:24:58 heaven kernel: sda: Write Protect is off
May 30 17:24:58 heaven kernel: SCSI device sda: drive cache: write back
May 30 17:24:58 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:24:58 heaven kernel: sda: Write Protect is off
May 30 17:24:58 heaven kernel: SCSI device sda: drive cache: write back
May 30 17:26:45 heaven kernel: ata3: port is slow to respond, please be patient
May 30 17:27:00 heaven kernel: usb 4-2: USB disconnect, address 3
May 30 17:27:08 heaven kernel: ata3: soft resetting port
May 30 17:27:08 heaven kernel: ata3.00: configured for UDMA/33
May 30 17:27:08 heaven kernel: ata3.01: configured for UDMA/33
May 30 17:27:08 heaven kernel: ata3: EH complete
May 30 17:27:08 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:27:08 heaven kernel: sda: Write Protect is off
May 30 17:27:08 heaven kernel: SCSI device sda: drive cache: write back
May 30 17:27:09 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:27:09 heaven kernel: sda: Write Protect is off
May 30 17:27:09 heaven kernel: SCSI device sda: drive cache: write back
May 30 17:28:45 heaven kernel: ata3.01: limiting speed to UDMA/25
May 30 17:28:45 heaven kernel: ata3: port is slow to respond, please be patient
May
30 17:28:45 heaven kernel: ata3: soft resetting port
May 30 17:28:45 heaven kernel: ata3.00: configured for UDMA/25
May 30 17:28:45 heaven kernel: ata3.01: configured for UDMA/25
May 30 17:28:45 heaven kernel: ata3: EH complete
May 30 17:28:45 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:28:45 heaven kernel: sda: Write Protect is off
May 30 17:28:45 heaven kernel: SCSI device sda: drive cache: write back
May 30 17:28:45 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:28:45 heaven kernel: sda: Write Protect is off
May 30 17:28:45 heaven kernel: SCSI device sda: drive cache: write back
May 30 17:30:56 heaven kernel: ata3.01: limiting speed to UDMA/16
May 30 17:31:27 heaven kernel: ata3: port is slow to respond, please be patient
May 30 17:31:27 heaven kernel: ata3: soft resetting port
May 30 17:31:27 heaven kernel: ata3.00: configured for UDMA/16
May 30 17:31:27 heaven kernel: ata3.01: configured for UDMA/16
May 30 17:31:27 heaven kernel: ata3: EH complete
May 30 17:31:27 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:31:27 heaven kernel: sda: Write Protect is off
May 30 17:31:27 heaven kernel: SCSI device sda: drive cache: write back
May 30 17:31:27 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:31:27 heaven kernel: sda: Write Protect is off
May 30 17:31:27 heaven kernel: SCSI device sda: drive cache: write back
May 30 17:32:13 heaven kernel: ata3.01: limiting speed to PIO4
May 30 17:32:44 heaven kernel: ata3: port is slow to respond, please be patient
May 30 17:32:44 heaven kernel: ata3: soft resetting port
May 30 17:32:44 heaven kernel: ata3.00: configured for PIO4
May 30 17:32:44 heaven kernel: ata3.01: configured for PIO4
May 30 17:32:44 heaven kernel: ata3: EH complete
May 30 17:32:44 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:32:44 heaven kernel: sda: Write Protect is off
May 30 17:32:44 heaven kernel: SCSI device sda: drive cache: write back
May 30 17:32:44 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:32:44 heaven kernel: sda: Write Protect is off
May 30 17:32:44 heaven kernel: SCSI device sda: drive cache: write back
May 30 17:33:16 heaven kernel: ata3.01: limiting speed to PIO3
May 30 17:33:23 heaven kernel: ata3: port is slow to respond, please be patient
May 30 17:33:46 heaven kernel: ata3: soft resetting port
May 30 17:33:46 heaven kernel: ata3.00: configured for PIO3
May 30 17:33:46 heaven kernel: ata3.01: configured for PIO3
May 30 17:33:46 heaven kernel: ata3: EH complete
May 30 17:33:47 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:33:47 heaven kernel: sda: Write Protect is off
May 30 17:33:47 heaven kernel: SCSI device sda: drive cache: write back
May 30 17:33:47 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:33:47 heaven kernel: sda: Write Protect is off
May 30 17:33:47 heaven kernel: SCSI device sda: drive cache: write back
May 30 17:40:17 heaven kernel: ata3.01: limiting speed to PIO2
May 30 17:40:24 heaven kernel: ata3: port is slow to respond, please be patient
May 30 17:40:47 heaven kernel: ata3: soft resetting port
May 30 17:40:47 heaven kernel: ata3.00: configured for PIO2
May 30 17:40:47 heaven kernel: ata3.01: configured for PIO2
May 30 17:40:47 heaven kernel: ata3: EH complete
May 30 17:40:47 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:40:47 heaven kernel: sda: Write Protect is off
May 30 17:40:47 heaven kernel: SCSI device sda: drive cache: write back
May 30 17:40:47 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 17:40:47 heaven kernel: sda: Write Protect is off
May 30 17:40:47 heaven kernel: SCSI device sda: drive cache: write back
...
May 30 18:00:18 heaven -- MARK --
May 30 18:03:04 heaven kernel: ata3: port is slow to respond, please be patient
May 30 18:03:04 heaven kernel: ata3: soft resetting port
May 30 18:03:04 heaven kernel: ata3.00: configured for PIO2
May 30 18:03:04 heaven kernel: ata3.01: configured for PIO2
May 30 18:03:04 heaven kernel: ata3: EH complete
May 30 18:03:04 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 18:03:04 heaven kernel: sda: Write Protect is off
May 30 18:03:04 heaven kernel: SCSI device sda: drive cache: write back
May 30 18:03:04 heaven kernel: SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
May 30 18:03:04 heaven kernel: sda: Write Protect is off
May 30 18:03:04 heaven kernel: SCSI device sda: drive cache: write back

IDE/ATA disk being recognized as SCSI, timeouts, lags, 2 Mb/s I/O speed… No, really, I’d rather dump this kind of usability and switch back to my FreeBSD, “where everything is different from how it should be on a normal Linux box”.

Oh, and I’m calling it “hell” this time. Quite unoriginal, of course, but does anyone care.