"Can not connect to the streaming server 401, Authentication Required (HTTP/1.0)"

I seem to be the first to post about this problem on the forum. It’s the dreaded “Can not connect to the streaming server 401, Authentication Required (HTTP/1.0)” error message in the Output Streams section of Settings. Been wracking my brain the last couple hours with what seems like should be a simple issue.

Just did a clean install by following LibreTime Tutorial: How to install LibreTime. This is on an internal test server with with no DNS, so the IP address is being used in lieu of a domain.

icecast.xml has all three custom passwords (for source, relay and analytics admin) in place. I have no experience with LiquidSoap, so I’m unsure if any manual tweaking needs to take place with that?

The Icecast2 server is up and running but I see no mount point listed.

So, first question: Is the error referring to the relay or the admin login? Or is it something else entirely?

It looks to not be able to connect to the initial icecast login. I’m guessing you’ve updated the admin-password via the icecast.xml file? Did you give the service a restart after that?

service icecast2 restart

Alright, slightly confused and dazed…

I knew of the service icecast2 start and service icecast2 stop commands (which both have worked in the past) but not service icecast2 restart. So I just tried the restart option and here’s what returned:

Job for icecast2.service failed because the control process exited with error code.
See "systemctl status icecast2.service" and "journalctl -xe" for details.

So I thought, ooh! This is a new message!

But just as a sanity check, I attempted stop then start again, and instead of working, the same error message returned. I swear it’s worked before. I swear it! Or maybe I’m confusing it with another service. I question my sanity still.

Anyways, I checked systemctl status icecast2.service and here’s what returned:

● icecast2.service - LSB: Icecast2 streaming media server
   Loaded: loaded (/etc/init.d/icecast2; generated)
   Active: failed (Result: exit-code) since Tue 2019-09-03 11:40:37 PDT; 12s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 9711 ExecStop=/etc/init.d/icecast2 stop (code=exited, status=2)
  Process: 51563 ExecReload=/etc/init.d/icecast2 reload (code=exited, status=0/SUCCESS)
  Process: 10392 ExecStart=/etc/init.d/icecast2 start (code=exited, status=1/FAILURE)

Sep 03 11:40:37 myhostname systemd[1]: Starting LSB: Icecast2 streaming media server...
Sep 03 11:40:37 myhostname icecast2[10392]:  * Starting streaming media server icecast2
Sep 03 11:40:37 myhostname systemd[1]: icecast2.service: Control process exited, code=exited status=1
Sep 03 11:40:37 myhostname systemd[1]: icecast2.service: Failed with result 'exit-code'.
Sep 03 11:40:37 myhostname systemd[1]: Failed to start LSB: Icecast2 streaming media server.

Next I tried journalctl -xe and got this on infinite repeat:

Sep 03 11:34:32 myhostname airtime-liquidsoap[757]: 2019/09/03 11:34:32 [_a:3] Connecting mount _a for source@localhost...
Sep 03 11:34:32 myhostname airtime-liquidsoap[757]: 2019/09/03 11:34:32 [_a:2] Connection failed: could not write data to host: Connection refused in write()
Sep 03 11:34:32 myhostname airtime-liquidsoap[757]: 2019/09/03 11:34:32 [lang:3] timeout --signal=KILL 45 pyponotify --error='could not write data to host: Connection refused in write()' --stream-id=1 --time=1567492688.66 &
Sep 03 11:34:32 myhostname airtime-liquidsoap[757]: 2019/09/03 11:34:32 [_a:3] Will try again in 5.00 sec.
Sep 03 11:34:32 myhostname airtime-liquidsoap[757]: 2019-09-03 11:34:32,507 [pyponotify] [INFO ]  #################################################
Sep 03 11:34:32 myhostname airtime-liquidsoap[757]: 2019-09-03 11:34:32,507 [pyponotify] [INFO ]  # Calling server to update liquidsoap status    #
Sep 03 11:34:32 myhostname airtime-liquidsoap[757]: 2019-09-03 11:34:32,508 [pyponotify] [INFO ]  #################################################
Sep 03 11:34:32 myhostname airtime-liquidsoap[757]: 2019-09-03 11:34:32,508 [pyponotify] [INFO ]  msg = could not write data to host: Connection refused in write()
Sep 03 11:34:32 myhostname airtime-liquidsoap[757]: 2019-09-03 11:34:32,556 [pyponotify] [INFO ]  Response: null
Sep 03 11:34:32 myhostname airtime-liquidsoap[757]: #########################################
Sep 03 11:34:32 myhostname airtime-liquidsoap[757]: #           *** pypo  ***               #
Sep 03 11:34:32 myhostname airtime-liquidsoap[757]: #     pypo notification gateway         #
Sep 03 11:34:32 myhostname airtime-liquidsoap[757]: #########################################

Apparently it has been retrying all night and all day every few seconds. I suspected this due to the 401 error message refreshing as I tried to copy/paste it earlier.

So, I’m still looking into this, but it does look like the service itself.

But now… I just attempted to go to the Icecast Server in my browser, and I am no longer able to reach the status page. So, between last night and now, something has changed. If I’m the one who changed it I cannot remember what I did; I was so tired last night.

So now I have this new problem on top of the other problem I was having with the 401 authentication error.

Maybe I should find a way to completely uninstall icecast2 and start from scratch?

Sorry, quick follow-up post:

I rebooted the machine, reinstalled icecast2 and the status page is back up. So now I’m back at square one with my original 401, authentication required error problem. Tried restarting the Icecast service and still nothing changed. Still gives a 401 error.

So, I re-ran systemctl status icecast2.service and it returned with:

● icecast2.service - LSB: Icecast2 streaming media server
   Loaded: loaded (/etc/init.d/icecast2; generated)
   Active: active (running) since Tue 2019-09-03 12:38:28 PDT; 15min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3824 ExecStop=/etc/init.d/icecast2 stop (code=exited, status=0/SUCCESS)
  Process: 5648 ExecReload=/etc/init.d/icecast2 reload (code=exited, status=0/SUCCESS)
  Process: 3829 ExecStart=/etc/init.d/icecast2 start (code=exited, status=0/SUCCESS)
    Tasks: 4 (limit: 9479)
   CGroup: /system.slice/icecast2.service
           └─3848 /usr/bin/icecast2 -b -c /etc/icecast2/icecast.xml

Sep 03 12:38:28 myhostname icecast2[3829]:  * Starting streaming media server icecast2
Sep 03 12:38:28 myhostname icecast2[3829]:    ...done.
Sep 03 12:38:28 myhostname icecast2[3829]: [2019-09-03  12:38:28] WARN CONFIG/_parse_root Warning, <hostname> not configured, using default value "localhost". This will cause problems, e.g. with YP directory listings.
Sep 03 12:38:28 myhostname icecast2[3829]: [2019-09-03  12:38:28] WARN CONFIG/_parse_root Warning, <location> not configured, using default value "Earth".
Sep 03 12:38:28 myhostname icecast2[3829]: [2019-09-03  12:38:28] WARN CONFIG/_parse_root Warning, <admin> contact not configured, using default value "icemaster@localhost".
Sep 03 12:38:28 myhostname systemd[1]: Started LSB: Icecast2 streaming media server.
Sep 03 12:53:57 myhostname systemd[1]: Reloading LSB: Icecast2 streaming media server.
Sep 03 12:53:57 myhostname icecast2[5648]:  * Reloading streaming media server configuration icecast2
Sep 03 12:53:57 myhostname icecast2[5648]:    ...done.
Sep 03 12:53:57 myhostname systemd[1]: Reloaded LSB: Icecast2 streaming media server.

and I retried journalctl -xe which returned:

Sep 03 12:55:38 myhostname airtime-liquidsoap[4016]: 2019/09/03 12:55:38 [_a:3] Connecting mount _a for source@localhost...
Sep 03 12:55:38 myhostname airtime-liquidsoap[4016]: 2019/09/03 12:55:38 [_a:2] Connection failed: 401, Authentication Required (HTTP/1.0)
Sep 03 12:55:38 myhostname airtime-liquidsoap[4016]: 2019/09/03 12:55:38 [lang:3] timeout --signal=KILL 45 pyponotify --error='401, Authentication Required (HTTP/1.0)' --stream-id=1 --time=1567539543.07 &
Sep 03 12:55:38 myhostname airtime-liquidsoap[4016]: 2019/09/03 12:55:38 [_a:3] Will try again in 5.00 sec.
Sep 03 12:55:38 myhostname airtime-liquidsoap[4016]: 2019-09-03 12:55:38,482 [pyponotify] [INFO ]  #################################################
Sep 03 12:55:38 myhostname airtime-liquidsoap[4016]: 2019-09-03 12:55:38,482 [pyponotify] [INFO ]  # Calling server to update liquidsoap status    #
Sep 03 12:55:38 myhostname airtime-liquidsoap[4016]: 2019-09-03 12:55:38,482 [pyponotify] [INFO ]  #################################################
Sep 03 12:55:38 myhostname airtime-liquidsoap[4016]: 2019-09-03 12:55:38,483 [pyponotify] [INFO ]  msg = 401, Authentication Required (HTTP/1.0)
Sep 03 12:55:38 myhostname airtime-liquidsoap[4016]: 2019-09-03 12:55:38,535 [pyponotify] [INFO ]  Response: null
Sep 03 12:55:38 myhostname airtime-liquidsoap[4016]: #########################################
Sep 03 12:55:38 myhostname airtime-liquidsoap[4016]: #           *** pypo  ***               #
Sep 03 12:55:38 myhostname airtime-liquidsoap[4016]: #     pypo notification gateway         #
Sep 03 12:55:38 myhostname airtime-liquidsoap[4016]: #########################################

Look at that… [_a:3] Connecting mount _a for source@localhost..., did a quick web search, and it returned a single link which points to a LibreTime GitHub thread from 2017

I’m reading through that thread now. Not sure what might be relevant or what has been solved. Did I find a new bug? What exactly is it trying to connect to that needs authentication? And why would it have trouble connecting to it right out of the box?

Another thought occurred to me:

In the video LibreTime Tutorial : How to administer the stream settings page at 7:02 minutes in, the instructor says the following:

For the purpose of this tutorial we’re going to assume that your LibreTime instance is using the built-in LibreTime Icecast.

Does LibreTime install its own instance of Icecast2, separate from the normal installation which can be gotten through apt-get? And if there is, where can it be located? Or was that just a bad choice of words on the instructor’s part?

Edit/note: I ran find / -type f -name "icecast.xml" to see if any additional instances of the config file were lingering around and could find nothing, so I’m going to assume there is only one instance of Icecast installed on my machine.

Okay… I figured out what was wrong. LibreTime is connecting to the server. This might make you all laugh. … okay, more like it will make you all laugh.

I was putting the relay password into the source password area. :scream:

The way I figured it out is by noticing the wording…

sources

From there, I deduced that there are two sources available, and I had a hunch that maybe Show Source was asking for, what in Icecast is simply called, “source.” I clicked Save, and voila, it worked.

If this was in the documentation, I was not able to locate it. :slight_smile:

addl-options

Perhaps we may want to make the wording more clear? Something like…

Source Username : __________________________

Source Password : __________________________

That could alleviate any confusion for newbies in the future. Like I said! It’s laughable, but still, it was an honest mistake!

1 Like

Glad you found the answer. Might sound simple to some, but possible better wording on the labels might be a good idea.

1 Like

Yeah, we need to improve the whole custom password setup for Icecast - there has been an open issue for a long time - https://github.com/LibreTime/libretime/issues/86 - basically the install script should ask for a icecast password and then reconfigure the default stream to use that. What currently happens with requiring a custom stream is confusing. Feel free to open an issue or PR on github to make any specific changes you think would improve it as you noted above.