Why does Darkice hate me?

Status
Not open for further replies.

horizon1015

Member
Joined
Nov 9, 2009
Messages
6
Location
Sacramento, CA
Let me start this off with I am basically illiterate with Linux, I am running a stream thru a Rasberry Pi 3+, using Rasperian as the OS and darkice as the streaming software. Recently the stream has been dropping, when I check the computer it shows Darkice having/had a Buffer Overrun. I've had it run for as long as two weeks or so without a problem, or as short as about 12 hours.

Any ideas of the cause or a solution??

Thanks
 

horizon1015

Member
Joined
Nov 9, 2009
Messages
6
Location
Sacramento, CA
@DC31 For Sure! thanks for helping:

# darkice configuration file
#
# Copy this configuration file to /etc/darkice#.cfg

[general]

duration = 0 # 0 means forever
bufferSecs = 5
reconnect = yes

[input]

# this can be used if darkice is the sole user of audio capture device:

# Import notes for the "device =" setting on this preconfigured image
#
# Most configurations with one additional USB sound card added will
# use "plughw:1,0" as the setting for the device.
#
# When adding 2 or more USB sound cards, your first USB sound card will
# start at plughw:0,0 and work it's way up n+1 (hw:1,0 hw:2,0 hw:3,0 and so on
#
# If adding just a single USB sound card for a broadcast, simply use the following:
# device = plughw:1,0
#
# You can verify card and device numbers by running the arecord -l command

device = plughw:1,0 # hw:0,0 then hw:1,0 then hw:2,0 etc
sampleRate = 22050
bitsPerSample = 16
channel = 1 # 1 for mono, 2 for stereo

[icecast2-0]

bitrateMode = cbr
format = mp3
bitrate = 16
quality = 0.1
channel = 1
lowpass = 4000
sampleRate = 22050

server = audio3.broadcastify.com # Your Master Server Name
port = 80 # 80 or 8080
password = XXXXXXXX # Your Feed Password
mountPoint = XXXXXXX # Your Feed Mount Point (Leave out the "/")
name = Name of My Feed # Your Feed Name
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,614
Location
Massachusetts
@DC31 For Sure! thanks for helping:

# darkice configuration file
#
# Copy this configuration file to /etc/darkice#.cfg

[general]

duration = 0 # 0 means forever
bufferSecs = 5
reconnect = yes

[input]

# this can be used if darkice is the sole user of audio capture device:

# Import notes for the "device =" setting on this preconfigured image
#
# Most configurations with one additional USB sound card added will
# use "plughw:1,0" as the setting for the device.
#
# When adding 2 or more USB sound cards, your first USB sound card will
# start at plughw:0,0 and work it's way up n+1 (hw:1,0 hw:2,0 hw:3,0 and so on
#
# If adding just a single USB sound card for a broadcast, simply use the following:
# device = plughw:1,0
#
# You can verify card and device numbers by running the arecord -l command

device = plughw:1,0 # hw:0,0 then hw:1,0 then hw:2,0 etc
sampleRate = 22050
bitsPerSample = 16
channel = 1 # 1 for mono, 2 for stereo

[icecast2-0]

bitrateMode = cbr
format = mp3
bitrate = 16
quality = 0.1
channel = 1
lowpass = 4000
sampleRate = 22050

server = audio3.broadcastify.com # Your Master Server Name
port = 80 # 80 or 8080
password = XXXXXXXX # Your Feed Password
mountPoint = XXXXXXX # Your Feed Mount Point (Leave out the "/")
name = Name of My Feed # Your Feed Name
I don’t see any smoking gun here. It all looks correct.

The line above that says “Copy this configuration file to /etc/darkice#.cfg” should say /etc/darkice.cfg without the #.

To start the stream simply type darkice at the command prompt.

Comparing yours to mine, the only difference that I see is the sampleRate= line under [icecast2-0] section. Mine has that line under [input] but not in the icecast section.
 

VK2GEL

Member
Joined
Oct 24, 2008
Messages
52
Hi all, I am running a RPi 3 with Buster and Darksnow 7.1.

The feed to BCFY works fine when I start Darksnow via GUI and choose my saved config. However I would like to run the Pi headless without KB or mouse and be able to start Darkice via SSH from the command line.

When I type sudo nano /etc/darkice1.cfg there is just an empty page, with or w/o the '1'. Do I have to paste a pro forma config in to that page?

Also, I would like the stream to start auto on boot. How do I set that up please?

Any advice appreciated, thanks. Grant.
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,614
Location
Massachusetts
I think that when running darksnow it saves the configuration to /home/pi/.darksnow/darkice.cfg. Try sudo nano /home/pi/.darksnow/darkice.cfg and see if that returns your configuration details.

If it does, then you should be able to copy it thus: sudo cp /home/pi/.darksnow/darkice.cfg /etc/darkice.cfg

Then simply type darkice at the command line to start it.

If this works, then we can tackle autostart.
 

VK2GEL

Member
Joined
Oct 24, 2008
Messages
52
Success thank you DC! Tried to start with just darkice, but it said try super user. It then started with sudo darkice.

Am using VNC so that it keeps running.

As an aside, the Pi red LED used to occult when running darkice. Now the red LED is on steady.

Can we tackle autostart please?
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,614
Location
Massachusetts
Success thank you DC! Tried to start with just darkice, but it said try super user. It then started with sudo darkice.

Am using VNC so that it keeps running.

As an aside, the Pi red LED used to occult when running darkice. Now the red LED is on steady.

Can we tackle autostart please?
The “try superuser” line comes up any time you start darkice without sudo. If you are not seeing other indications of failure you can ignore it. Mine all run perfectly well without using sudo.

If the red LED is occulting, you are experiencing low voltage from the power supply. Steady is good. Low voltage can make all sorts of weird things happen. The problem can be in the cable from the wall wart to the pi.

Sometime today I will get you the autostart details.
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,614
Location
Massachusetts
Success thank you DC! Tried to start with just darkice, but it said try super user. It then started with sudo darkice.

Can we tackle autostart please?

It is kind of a work-around as the standard ways of using systemd or crontab just don't work on a Buster Pi running a GUI (at least I haven't been able to figure them out). If you were running Buster Lite (no GUI) the systemd option works well. If you, or someone else here, knows how to make systemd or crontab start darkice automatically on a pi running Buster GUI, I am all ears.


At the command line in a Terminal window: sudo apt install screen

Edit the LXDE autostart file: sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

At the end, add: @sh /home/pi/dkcheck.sh

Here is what it should end up looking like:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@sh /home/pi/dkcheck.sh

Cntrl-X and save

Attached is a file called dkcheck.txt. Copy that file to your /home/pi directory and rename it to dkcheck.sh

Make that script executable: sudo chmod +x /home/pi/dkcheck.sh

Reboot your pi.

To check and see that darkice is running type screen -list at the command prompt.

The dkcheck.sh script runs a loop continuously that checks once a minute to see that darkice is running and if it doesn't find it, restarts it. It runs darkice in a detached screen so you won't see any evidence of it running on the GUI. Use screen -list at the command prompt to confirm that it is running.

I don't remember the last time that one of my darkice instances failed. They are pretty bulletproof. Loss of internet or power is by far much more common.
 

Attachments

  • dkcheck.txt
    216 bytes · Views: 19

a417

Active Member
Joined
Mar 14, 2004
Messages
4,669
I used these instructions to to start way back when.

Forewarning, this is a debian buster arm64 install, not raspbian buster raspi install, but I do not know of a reason why it wouldn't work with some modification, like the replacing RTLTCP w/ darkice etc... I occasionally log in locally to this workbench unit via XFCE, so the GUI is there...just not being used.

This is the service file i placed in /etc/systemd/system
Code:
[Unit]
Description=Run RTL_TCP, serving data on port 6969, utilizing dongle 4
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/rtl_tcp -a 192.168.1.202 -d 0 -p 6969
Restart=on-failure

[Install]
WantedBy=multi-user.target

then these two run at shell
Code:
sudo systemctl enable rtl_tcp.service
sudo systemctl start rtl_tcp.service

I have been using this to stream the IQ data from this dongle on my LAN for nearly 2 years. Power outages, acts of squirrel, generator transfers, it just works. Systemd works just fine for me in this instance.
 
Last edited:

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,614
Location
Massachusetts
I used these instructions to to start way back when.

Forewarning, this is a debian buster arm64 install, not raspbian buster raspi install, but I do not know of a reason why it wouldn't work with some modification, like the replacing RTLTCP w/ darkice etc... I occasionally log in locally to this workbench unit via XFCE, so the GUI is there...just not being used.

This is the service file i placed in /etc/systemd/system
Code:
[Unit]
Description=Run RTL_TCP, serving data on port 6969, utilizing dongle 4
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/rtl_tcp -a 192.168.1.202 -d 0 -p 6969
Restart=on-failure

[Install]
WantedBy=multi-user.target

then these two run at shell
Code:
sudo systemctl enable rtl_tcp.service
sudo systemctl start rtl_tcp.service

I have been using this to stream the IQ data from this dongle on my LAN for nearly 2 years. Power outages, acts of squirrel, generator transfers, it just works. Systemd works just fine for me in this instance.
[/QUOT

Here is my darkice.service file from /etc/systemd/system:

Description=My service
After=network.target

[Service]
Environment=PULSE_SOURCE=alsa_input.usb-Solid_State_System_Co._Ltd._USB_PnP_Audio_Device-00.analog-mono
ExecStart=/usr/bin/darkice -c /etc/darkice1.cfg
Restart=always
User=pi

[Install]
WantedBy=multi-user.target

Works every time on the pi running Buster Lite. Fails every time on a pi running Buster GUI.
 

VK2GEL

Member
Joined
Oct 24, 2008
Messages
52
Thanks for the advice. I will wait to see how reliable the mains power supply is, G.
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,614
Location
Massachusetts
DC31 fails how?

At the risk of sounding RTFM-ish, have you built out a service file like this?

I just dug a 2B out a junkbox and am going to throw buster on it to see if i can replicate your issues with darkice.

Any help you can give is appreciated. My service file is shown three posts above this one. Another thing that I should note is that all my pi’s run pulseaudio as each has TwoToneDetect on it, that may be relevant.

Here is a screen shot of the status after attempting sudo systemctl start darkice.service:
57081BF2-B711-4778-BD22-FE8E7A9E7A04.jpeg

57081BF2-B711-4778-BD22-FE8E7A9E7A04.jpeg

If I simply type darkice at the command line, it starts fine.
 

a417

Active Member
Joined
Mar 14, 2004
Messages
4,669
Ok, quick things here (i'm no expert)...

  1. You are setting that environment variable with service file, but not on command line...and command line works? Try taking it out temporarily. I've commented it out below
  2. The most damning line in that journalctl output is the ALSA lib pcm.c error line, it plainly doesn't like that input. Does that error go away if you comment out the environment variable?
  3. your journalctl output says "using config file: /etc/darkice.cfg" yet your service file calls /etc/darkice1.cfg, and if you simply type darkice at the command line, I have no idea which one it's using.
  4. Keep your descriptions updated in your service files, so you're not making running one, having errors on a second, and working on a third - this could be an entirely self inflicted issue. :unsure:
  5. is the standard shell login you are using "pi", when it works? If you're running at a elevated user level (ie; root) when you start it by hand, and then running it at pi from the service file...that could also be it.
Easiest stuff first. This is a systemd generic template from the raspi foundation with some basic changes to fit your use-case, lets try that first.
Code:
[Unit]
Description=new darkice service running darkice1.cfg
After=network.target

[Service]
## Environment=PULSE_SOURCE=alsa_input.usb-Solid_State_System_Co._Ltd._USB_PnP_Audio_Device-00.analog-mono
ExecStart=/usr/bin/darkice -c /etc/darkice1.cfg
WorkingDirectory=/home/pi/
StandardOutput=inherit
StandardError=inherit
Restart=always
User=pi

[Install]
WantedBy=multi-user.target
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,614
Location
Massachusetts
Sorry for the confusion, it’s all my fault. I took the service file from one pi and the error message from another.

All from one pi running Buster GUI:

The service file :
B7F3D748-FD91-4FB7-9799-04566A0EE625.jpeg

A successful start of darkice from the command line:

91AE568E-BB49-42EA-93B2-9F9726927226.jpeg

A failed start from systenctl:

888EDE8D-D673-4312-AFD5-F9C502A8ABD4.jpeg

I think that should clear up the confusion. I have the restart line commented out as it as it continually tries to restart it as it fails each time.

Thanks for your help.

Jim
 

VK2GEL

Member
Joined
Oct 24, 2008
Messages
52
Hi, I finally got the darkice config figured out, but now am getting buffer overuns that also stop the feed.

I think I need an OS that is more darkice friendly, is easy to set up for darkice to auto start on boot, easy to set up an auto reboot once or twice a day, and on which darkice will continue to run once I disconnect VNC and/or teamviewer.

Currently using Buster v10.

Any thoughts appreciated, Thanks.
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,614
Location
Massachusetts
Have you tried Raspbian Stretch Lite? Or are you perhaps using a pi4 which requires Buster? Try running the “Lite”, non-gui version.
 
Status
Not open for further replies.
Top