# Using TV card casually freezes system on shutdown [CLOSED]

## PlasmaPhil

As I only experienced this problem on my AMD64 workstation (tried also on a Pentium 3 machine with Gentoo) I guess this is a hardware/kernel related problem. The following happens:

While working with KDE, I happen to switch on KDETV to watch some Snooker/Docu/whatsoever. Sometimes, especially if the TV application was up for a longer time (perhaps an hour or more) something prevents my system from shutting down normally. The whole thing announces itself in the moment that I close KDETV. If I still hear sound, this is a clear sign that shutdown will not complete. Anyhow everything else still works perfect and will continue to work perfect, until I touch some init script. The shutdown of KDE will then take exceptionally long time, X goes down, console appears, shows init messages of stopping daemos/etc and stops waiting forever on the line "Shutting down ntpd". I can still switch to other consoles and use them, but if I try to used other init scripts, unmount my network shares or even use "ps ax", this console also will freeze.

This is annoying because of two reasons:

1. If I forget that my system has gone mad a few hours ago, I hit "Shutdown", turn off the screens, walk out, only to come back the next hour/day/week to still hear my box humming and showing "Shutting down ntpd" on the console.

2. I am unable to unmount just any filesystem, no matter if NFS or local, which inevitably results in possible filesystem corruptions, unclosed handles and hell knows what else.

This is happening from the very beginning (about the beginning of this year) I am using the TV card with this machine in conjuction with Gentoo. Old Windows XP (yeah, blame me) with WinTV application on the same machine, no problems. Same setup (Kernel version, KDE and other software) on a Pentium 3, no problem. Except the awkward video image, but thats another story. Every Kernel version since Feb 2007 is having this effect on AMD64.

Details on my setup: Linux 2.6.22-gentoo-r9 #3 SMP PREEMPT

 x86_64 AMD Athlon(tm) 64 X2

 bttv: driver version 0.9.17, Hauppauge WinTV [card=10], PCI subsystem ID is 0070:13eb, model#44354, tuner=20

 Xorg 1.3.0.0-r2, KDE 3.5.7, KDETV 0.8.9 (arts linguas_de opengl xinerama)

Details on my hardware: Asus A8N-SLI Deluxe, nVidia nForce4 Ultra

 AMD Athlon64 X2 4200+

 Hauppauge WinTV PCI

 nVidia GeForce 6600LE

/proc/interrupts

```
           CPU0       CPU1

  0:     153297   28720369   IO-APIC-edge      timer

  1:          0          2   IO-APIC-edge      i8042

  6:          0          5   IO-APIC-edge      floppy

  7:          0          0   IO-APIC-edge      parport0

  9:          0          0   IO-APIC-fasteoi   acpi

 10:          0          0   IO-APIC-edge      MPU401 UART

 15:       2587     510345   IO-APIC-edge      ide1

 17:       1257     197550   IO-APIC-fasteoi   EMU10K1, eth1

 18:       8395    2234755   IO-APIC-fasteoi   bttv0, Bt87x audio, nvidia

 20:       5850     927387   IO-APIC-fasteoi   ohci_hcd:usb2

 21:       4462     803875   IO-APIC-fasteoi   ehci_hcd:usb1

 22:       1767     238572   IO-APIC-fasteoi   sata_nv

 23:      27119    4871502   IO-APIC-fasteoi   sata_nv, eth0

NMI:          0          0

LOC:   28870257   28869201

ERR:          0

```

Anyone experiencing the same problems? Or even better, having a solution? I suppose for a detailed analysis a dmesg/kernel config/xorg.conf/etc could be useful, I just don't want to post 3478 lines of extra text in the first run.

Greetings,

PlasmaLast edited by PlasmaPhil on Wed Feb 27, 2008 11:26 pm; edited 1 time in total

----------

## Strunzdesign

Hi!

Same problem here! I think the problem started to appear 2 years ago... I've got a Hauppauge WinTV PCI FM on a dual Athlon MP 2000+ with a NVidia GF4 graphics card. The problem appears when closing KDETV. If the sound does not disappear during close, the bug was triggered. It appears approx. in 50% of all cases here. "ps aux" freezes, and the system does not shut down cleanly afterwards.

Fortunately, I found a litte workaround. Start KDETV via "strace". Lots of stuff appears, but kdetv won't crash anymore. I think its some sort of race condition inside the linux kernel, not an application problem. An application must not be able to crash a kernel! Otherwise, its still a kernel bug  :Wink: 

However, this was my experience until some minutes ago. I was able to crash Kdetv within strace for the first time, and I was able to discover the command that caused the crash after closing:

...

...

...

ioctl(3, FIONREAD, [0])                 = 0

gettimeofday({1201211925, 920918}, NULL) = 0

select(10, [3 4 5 7 9], [], [], {1, 769345}) = 1 (in [3], left {1, 762000})

gettimeofday({1201211925, 929632}, NULL) = 0

ioctl(3, FIONREAD, [64])                = 0

read(3, "\241 \257\250\7\0`\0046\1\0\0005\1\0\0\246e\317\255\0\0\0\0\0\0\0\0\0\0\0\0"..., 64) = 64

gettimeofday({1201211925, 930683}, NULL) = 0

gettimeofday({1201211925, 930773}, NULL) = 0

gettimeofday({1201211925, 930825}, NULL) = 0

gettimeofday({1201211925, 930869}, NULL) = 0

gettimeofday({1201211925, 930931}, NULL) = 0

gettimeofday({1201211925, 930977}, NULL) = 0

gettimeofday({1201211925, 931061}, NULL) = 0

gettimeofday({1201211925, 931118}, NULL) = 0

gettimeofday({1201211925, 931349}, NULL) = 0

ioctl(5, FIONREAD, [0])                 = 0

write(6, "\0", 1)                       = 1

write(3, "\n\23\2\0\7\0`\4\31\0\v\0\7\1\0\0\0\0\30\0\22\0\0\0\7\1\0\0\7\0`\4"..., 52) = 52

ioctl(5, FIONREAD, [1])                 = 0

ioctl(12, VIDIOC_STREAMOFF, 0xbfc26c60) = 0

munmap(0xb52bb000, 1028096

"munmap" causes the crash... but I have no idea what's going on. Time for a bug report I think.

Okay, just my $0.02  :Wink: 

Regards,

Florian

----------

## Strunzdesign

Already reported upstream: http://bugs.kde.org/show_bug.cgi?id=148119

----------

## linuxtuxhellsinki

I had also this problem with kdetv, Hauppauge WinTV analog PCI card and Nvidia FX5200, but it hasn't happened anymore in long time (almost an year).  My solution was usually to start another kdetv which started without video and then close it which was usually closing the other one too, or kill 'em both with "killall kdetv".

I think it was mostly happening with 2.6.18 and .19 kernels and now I've been stuck with this 2.6.20-gentoo-r7 cause with .21 and .22 kernels there was no sound with kdetv, while sound worked with all other programs   :Question: 

And when I had little time to debug that problem I realized that there's no v4l1_compat module with newer kernel and that could be the source of problem (re-emerging kdetv didn't help).

```
 mandrake KDETV-soundproblem # uname -a

Linux mandrake 2.6.20-gentoo-r7 #1 PREEMPT Sat Apr 28 12:13:34 EEST 2007 i686 Intel(R) Pentium(R) 4 CPU 1.60GHz GenuineIntel GNU/Linux

mandrake KDETV-soundproblem # lsmod |grep cx

cx8800                 34060  0

compat_ioctl32          1536  1 cx8800

cx88_alsa              12712  0

cx88xx                 66084  2 cx8800,cx88_alsa

ir_common              30340  1 cx88xx

i2c_algo_bit            7944  2 nvidiafb,cx88xx

tveeprom               14992  1 cx88xx

videodev               27264  2 cx8800,cx88xx

v4l2_common            24064  3 tuner,cx8800,videodev

v4l1_compat            14468  2 cx8800,videodev

video_buf              24836  3 cx8800,cx88_alsa,cx88xx

btcx_risc               5000  3 cx8800,cx88_alsa,cx88xx

mandrake KDETV-soundproblem # cat lsmod.2.6.23 |grep cx

cx8800                 33504  0

compat_ioctl32          1536  1 cx8800

cx88_alsa              12712  0

cx88xx                 65956  2 cx8800,cx88_alsa

ir_common              34564  1 cx88xx

i2c_algo_bit            6532  2 nvidiafb,cx88xx

tveeprom               15760  1 cx88xx

videodev               28160  2 cx8800,cx88xx

v4l2_common            17280  4 tuner,cx8800,cx88xx,videodev

video_buf              24836  3 cx8800,cx88_alsa,cx88xx

btcx_risc               5000  3 cx8800,cx88_alsa,cx88xx
```

But that's another problem and not related to this thread (while I'd be happy if someone could help), but I don't have that problem with shutting down kdetv anymore and I've had this machine on over an month and I've been watching TV and closing/opening kdetv many times every day.

----------

## PlasmaPhil

Allright, thanks for your suggestions and the bug report. I just added a few words to the bug description. Let's see if something happens, in the meantime I disabled the card in the kernel config and the next time I get my hands on the vacuum cleaner, I'll take the opportunity to remove it completely from the machine. Not with the cleaner, but you know how it looks on the inside after a few weeks ...

It would be nice if a real fix could be made for this issue, but maybe it's time for a new piece of hardware, perhaps some digital DVB stuff. I heard they give a rather nice picture  :Wink: 

----------

## PlasmaPhil

More related information:

http://lkml.org/lkml/2007/9/9/138

http://bugzilla.kernel.org/show_bug.cgi?id=5339

----------

## PlasmaPhil

I've been using media-tv/tvtime now for a while and it seems to work stable. Not a single crash in the last few weeks. Due to the lack of answers on the KDE and Kernel Bugzilla I suppose this problem is not of interest for the responsible developers.

This thread is therefore closed. If anyone reads this, please check the links above for news after the date of this posting. We can't help you.

----------

