MikMuellerDev/radio

Problems running in Ubuntu Server

Closed this issue · 8 comments

Hello,
I've been trying to use Radio on Ubuntu Server.
After installing sound-related drivers and applications (Alsa, etc.) I had the following message when launching radio with ./radio run:

ALSA lib confmisc.c:165:(snd_config_get_card) Cannot get card index for 0

That I could solve by adding my user to group audio (sudo adduser myusername audio). It seems to work OK and I can access it at localhost:8083

But the issue still appears during startup after installing with install.sh as non root and executing sudo systemctl enable radio --now

systemctl status radio.service gives the following answer:

× radio.service - An internet radio written in Rust
Loaded: loaded (/lib/systemd/system/radio.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2023-09-30 20:24:21 CEST; 2s ago
Docs: https://github.com/MikMuellerDev/radio
Process: 6810 ExecStart=/usr/bin/radio/radio run (code=exited, status=101)
Main PID: 6810 (code=exited, status=101)
CPU: 59ms
sep 30 20:24:21 morgank53sc systemd[1]: radio.service: Scheduled restart job, restart counter is at 5.
sep 30 20:24:21 morgank53sc systemd[1]: Stopped An internet radio written in Rust.
sep 30 20:24:21 morgank53sc systemd[1]: radio.service: Start request repeated too quickly.
sep 30 20:24:21 morgank53sc systemd[1]: radio.service: Failed with result 'exit-code'.
sep 30 20:24:21 morgank53sc systemd[1]: Failed to start An internet radio written in Rust.

Any suggestion to solve it?
Thanks!

Hello, just to let you know: I will take a look at your problem tomorrow.
In the meantime: Can you please provide the names of any other sound-related packages you have installed (alsa for instance) so that I can reproduce your issues.

I have just tried to reproduce your error on a system running the newest version of Ubuntu Server 22.04.3 LTS (Jammy Jellyfish).
However, I was not able to produce the error you provided.

However, I managed to find other potential issues which might affect your configuration.

  • First of all, are you certain that the software runs without systemd?
  • Maybe you have set an image path in your config.toml which does not exist? Remember that every image path should be a filename (like foo.png) which points to a file inside the /usr/bin/radio/images directory.

Exact commands I used to setup the software on a fresh ubuntu instance

wget 'https://github.com/MikMuellerDev/radio/releases/download/v0.2.0/radio-0.2.0-x86_64-unknown-linux-gnu.tar.gz'

tar xfv radio-0.2.0-x86_64-unknown-linux-gnu.tar.gz

cd radio-0.2.0/

sudo apt install alsa pulseaudio 

Running radio after this initial setup

mik@foobar:~/radio-0.2.0$ ./radio run
ALSA lib confmisc.c:165:(snd_config_get_card) Cannot get card index for 0
ALSA lib confmisc.c:165:(snd_config_get_card) Cannot get card index for 0
ALSA lib confmisc.c:165:(snd_config_get_card) Cannot get card index for 0
ALSA lib confmisc.c:165:(snd_config_get_card) Cannot get card index for 0
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib pulse.c:242:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib confmisc.c:165:(snd_config_get_card) Cannot get card index for 0
ALSA lib confmisc.c:165:(snd_config_get_card) Cannot get card index for 0
ALSA lib confmisc.c:165:(snd_config_get_card) Cannot get card index for 0
ALSA lib confmisc.c:165:(snd_config_get_card) Cannot get card index for 0
thread 'main' panicked at 'internal error: entered unreachable code: the audio devices include the default audio device', src/audio.rs:142:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
mik@foobar:~/radio-0.2.0$

As expected, the service fails to run as pulseaudio is not yet running.

sudo  adduser mik audio
pulseaudio --start
mik@foobar:~/radio-0.2.0$ ./radio run
# [2023-10-01T09:24:33Z INFO  radio] Created a new configuration file at `./config.toml`

mik@foobar:~/radio-0.2.0$ ./radio run
#[2023-10-01T09:24:52Z INFO  radio] Found existing config file at `./config.toml`
#[2023-10-01T09:24:52Z INFO  radio] Radio is running on `http://localhost:8083`
#[2023-10-01T09:24:52Z INFO  actix_server::builder] Starting 8 workers
#[2023-10-01T09:24:52Z INFO  actix_server::server] Actix runtime found; starting in Actix runtime

Installation after initial setup

mik@foobar:~/radio-0.2.0$ ./install.sh
radio-web -> /usr/bin/radio
images/ -> /usr/bin/radio
radio -> /usr/bin/radio
radio.service -> /lib/systemd/system
[2023-10-01T09:25:28Z INFO  radio] Created a new configuration file at `/etc/radio/config.toml`
[2023-10-01T09:25:28Z WARN  radio] Canceling startup due to missing configuration
Installation succeeded
NOTE: Execute 'sudo systemctl start radio' to start radio
mik@foobar:~/radio-0.2.0$

Could you please provide a bit more information regarding radio's error output?
For instance, you might attach the output of

journalctl -xeu radio

Hello and thank you very much for your rapid response.

First of all, let me tell you I'm not an advanced user of Linux, just a noob that googles a lot for solutions and tries to apply them without knowing exactly what's going on...

Regarding your first question (are you certain that the software runs without systems?), if I issue ./radio run in the directory where I uncompressed the downloaded radio-0.2.0-x86_64-unknown-linux-gnu.tar.gz, I get the web page of radio working and with sound (see attached image). My settings.toml only contains one station and the corresponding .png is in the /images directory. I also copied them to the installed versions directories. It only started working after adding my user to the sound group.

RadioWorking0

RadioWorking

Regarding the sound-related packages I have installed, from several pages found under the subject "install audio in Ubuntu server", I ended up installing libasound2, linux-sound-base alsa-base alsa-utils, pulseaudio, alsa, alsa-tools, in this order. However, I never gave pulseaudio --start. I tried it now and, after that, sudo systemctl enable radio --now with no luck.

I'm attaching the output of journalctl -xeu radio.
journalradio.txt

Excuse me if what follows doesn't make sense but, as the non-installed version started working after adding myself to the sound group, my suspicion in that the "user" the system considers when launching the installed version is not the same, and this user is not in the sound group (I tried adding root to the group also without success). Could this be the reason?

In case they are of help, I'm adding some screenshots and output from Cockpit:
image
image
Registros - morgan@morgank53sc.pdf

Some progress since the last message.

Reading "Installation after initial setup" in your last message, I realized that I had run ./install.sh before I had done ./radio run, so I did the installation again and the service started working.

The problem that appeared then was that it was not using the proper config.toml. Tried copying the one in the installation directory and even editing it with the same contents as the personalized ona, but still kept de default "admin/secret" user/password. Tried deleting all the files and installing again but got errors like:

morgan@morgank53sc:~/radio-0.2.0$ ./install.sh
radio-web -> /usr/bin/radio
images/ -> /usr/bin/radio
radio -> /usr/bin/radio
radio.service -> /lib/systemd/system
Error: could not read or create config file at /etc/radio/config.toml

Caused by:
Permission denied (os error 13)
Installation succeeded
NOTE: Execute 'sudo systemctl start radio' to start radio

So finally I decided to delete again everything related to radio, including the installation directory, and start from zero, including the download, but the error could not read or create config file at `/etc/radio/config.toml appeared again...

Finally, I realized that the "good" config.toml for the service was the one at /usr/bin/radio/, so I copied my personalized one there and, apparently, everything is going OK now

Hi,
I am pleased to hear that your issue is resolved.
I will definitely rework the install script as it lead you to believe that the config file was located in /etc.
Furthermore, I will update some of the documemtation as i believe that the initial setup is unnessecarily complex.

However, I would lile to thank you for your contribution as it revealed some issues concerning user experience.

Thank you very much for your interest in my issue!
After a lot of searching, I couldn't find many applications covering what yours does. Sure you can use MPD, but I wanted something with a web interface to be able to run it on a headless server, and this was the only one that seemed to meet the requirements.
If you find it appropriate, I'd like to make some suggestions, but I don't want to be a freeloader... I'd open other issues for that, in that case.

Sure, I do think it is appropriate for you to make suggestions so that I can improve the software.
Again, I'd like to apologize for some weird errors and documentation as I thought that I was the only one using the project.
Lastly, It was a pleasure working with you, feel free to open issues if you feel the need to.