WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: alsa sound not loading properly  (Read 26868 times)

Offline LinuxUser01

  • Full Member
  • ***
  • Posts: 111
alsa sound not loading properly
« on: September 21, 2013, 06:47:15 PM »
I'm currently running the new version of TinyCore v5.0. I have installed alsa.tcz and alsaconf.tcz as OnBoot. I have placed the script "/usr/local/etc/init.d/alsasound start" in /opt/bootlocal.sh as #/usr/local/etc/init.d/alsasound start. I've ran sudo alsaconf and had it configure and ran the speaker test successfully. I have tried typing in command "alsactl store" to only get:
alsactl: state_lock:121: file /var/lib/alsa/asound.state lock error: File exists
alsactl: state_lock:121: file /var/lib/alsa/asound.state unlock error: File exists
The thing is that its suppose to save it in /usr/local/etc/asound.state. which it never did, but i have still put the unlock file from /var/lib/alsa/asound.state in my backups. I have also added etc/modprobe.conf to the backup since it has already backed up the whole opt folder which has the alsa folder and the other two files in its subdirectory. Sometimes i don't need to go through the terminal and type sudo alsaconf to get the sound working after coming back from a reboot or turning on the computer. I just run flit and it shows the sound enabled already, which doesn't make any sense to me. Not sure if i should delete the /var/lib/alsa/asound.state subdirectory/files and just copy it to  /usr/local/etc/asound.state then delete the /var/lib/alsa/asound.state unlock file from backup and add the new directory and unlocked file as shown in the comments section of alsa.tcz from the Apps Browser as stated. I'm sure i have already done too much for this sound to work as i've read over the comments section that either the script would do the job unless you want alsaconf installed and ran. Anybody with an idea would be great, thanks in advance.

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: alsa sound not loading properly
« Reply #1 on: September 21, 2013, 07:13:35 PM »
Damn, I'm so sorry. You've asked me about ALSA via PM - But had to indeed do more than whats stated in the Appbrowser info.

I think alsa got kinda messed up.
I made a symlik from
/var/lib/alsa/asound.state (thats where setting being saved afer 'sudo alsactl store')
to
/usr/local/etc/asound.state

Also I have in
~/.X.d/audio (file name doesn't matter and is not exetutable)
Code: [Select]
/usr/bin/sudo /usr/local/etc/init.d/alsasound start &
/usr/bin/sudo /usr/local/sbin/alsactl restore &

Or that could be listed in bootlocal.sh instead.
« Last Edit: September 21, 2013, 07:16:39 PM by Misalf »
Download a copy and keep it handy: Core book ;)

Offline LinuxUser01

  • Full Member
  • ***
  • Posts: 111
Re: alsa sound not loading properly
« Reply #2 on: September 21, 2013, 08:04:44 PM »
I'm running emeIFM2 as a superuser and still will not allow me to symlink asound.state from /var/lib/alsa/asound.state to /usr/local/etc/asound.state. When you mention ~/.X.d/audio are you referring to /home/tc/.X.d/audio, because i'm not able to locate that folder "audio" in that subdirectory. I'll see if i can add those two commands to the bootlocal.sh.
Okay, this is how my bootlocal.sh looks like from the top:
#!/bin/sh
#/usr/local/etc/init.d/alsasound start
#/usr/bin/sudo /usr/local/etc/init.d/alsasound start &
#/usr/bin/sudo /usr/local/sbin/alsactl restore &

Hopefully this is the correct way of input. Not sure if i am suppose to delete #/usr/local/etc/init.d/alsasound start at this point.

Offline LinuxUser01

  • Full Member
  • ***
  • Posts: 111
Re: alsa sound not loading properly
« Reply #3 on: September 21, 2013, 08:32:14 PM »
I have tried different features in emeIFM2 to get this symlink to work to no success. I just opened a terminal and from tc@box:$, i typed cd /root and got tc@box$/root$ and tried, ln -s /var/lib/alsa/asound.state /usr/local/etc/asound.state only to get a permission denied once again.

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: alsa sound not loading properly
« Reply #4 on: September 21, 2013, 08:34:12 PM »
~/.X.d/ is the 'autostart' folder.
Any file in there will be sourced (its contents will be executed but not the file itself).
I made some files in there one being named audio (so thats not a folder).

If elefm2 doesnt allow you to create symlinks, you might try doing that in terminal.
Code: [Select]
sudo ln -s /var/lib/alsa/asound.state /usr/local/etc/asound.state
bootlocal.sh is run as root so you don't need sudo there.
The  #  in front of a line is a comment symbol so the line will not be interpreted (exept for the first line).
Code: [Select]
#!/bin/sh
/usr/local/etc/init.d/alsasound start
/usr/local/sbin/alsactl restore &
The  &  at the end of a line makes sure the next line will be processed even if the current line starts a program that hangs or takes some time to finish.
« Last Edit: September 21, 2013, 08:38:34 PM by Misalf »
Download a copy and keep it handy: Core book ;)

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: alsa sound not loading properly
« Reply #5 on: September 21, 2013, 08:35:53 PM »
And include both files,
/var/lib/alsa/asound.state
and
/usr/local/etc/asound.state
to your backup.
Download a copy and keep it handy: Core book ;)

Offline LinuxUser01

  • Full Member
  • ***
  • Posts: 111
Re: alsa sound not loading properly
« Reply #6 on: September 21, 2013, 09:21:39 PM »
So all i needed was sudo before ln -s /var/lib/alsa/asound.state /usr/local/etc/asound.state in the terminal and sure enough it worked. I then placed both var/lib/alsa/asound.state and usr/local/etc/asound.state in backup as you suggested. I also revised the bootlocal.sh:
#!/bin/sh
/usr/local/etc/init.d/alsasound start
/usr/local/sbin/alsactl restore &

These procedures that i have done still hasn't changed the way i have to get the sound working from a boot/reboot. I'm wondering why alsa is so hard to get properly installed compared to the easy OSS.tcz.
« Last Edit: September 21, 2013, 09:27:29 PM by LinuxUser01 »

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: alsa sound not loading properly
« Reply #7 on: September 21, 2013, 09:47:09 PM »
What are you doing then to get sound working?

--

Have you executed
sudo alsactl store
after you have added asound.state to your backup?

Nothing comes to my mind right now what else I did to make it work.
Download a copy and keep it handy: Core book ;)

Offline LinuxUser01

  • Full Member
  • ***
  • Posts: 111
Re: alsa sound not loading properly
« Reply #8 on: September 21, 2013, 10:24:30 PM »
Yes, i did execute sudo alsactl store in the terminal before saving and shutting down. I just came back from a full shut down and the sound is still not working. So what i usually do is open a terminal and type: sudo alsaconf and when its finished it works everytime. Not sure what else to do either. Maybe change the command line from /usr/local/sbin/alsactl restore & to /usr/local/sbin/alsactl store & in the bootlocal.sh if that would make any difference at all at this point since i also tried sudo alsactl restore in the terminal which didn't do anything but give me an error alittle bit after i executed sudo alsactl store.

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: alsa sound not loading properly
« Reply #9 on: September 21, 2013, 10:33:37 PM »
Putting
/usr/local/sbin/alsactl store
in bootlocal.sh wouldn't make any sense.
'store' saves the current values to  asound.state
'restore' reads them.
--
I don't really think that matters but I have only alsa.tcz in my onboot.lst. No alsaconfig.tcz.
--
I also don't really think it makes any difference but might be worth a try to create a startup file like I did and put it in /home/tc/.X.d/
Code: [Select]
/usr/bin/sudo /usr/local/etc/init.d/alsasound start &
/usr/bin/sudo /usr/local/sbin/alsactl restore &
This needs sudo so might not work if you have set a password for your user account.
Download a copy and keep it handy: Core book ;)

Offline LinuxUser01

  • Full Member
  • ***
  • Posts: 111
Re: alsa sound not loading properly
« Reply #10 on: September 21, 2013, 11:09:16 PM »
Deleting alsaconf.tcz from the OnBoot maintenance didn't make any difference. Just created a filename called audio in /home/tc/.X.d and got into it with the Editor from the wbar and pasted those two commands you have in your post. Going to reboot and see what happens.

Offline LinuxUser01

  • Full Member
  • ***
  • Posts: 111
Re: alsa sound not loading properly
« Reply #11 on: September 21, 2013, 11:13:42 PM »
No, i still can't get sound coming back from that reboot. Just going to Add alsaconf.tcz back into the OnBoot and just run it everytime it doesn't enable. Thanks for your help.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14812
Re: alsa sound not loading properly
« Reply #12 on: September 21, 2013, 11:16:01 PM »
~/.X.d is for commands related to running X, it would be better to put commands related to alsa in /opt/bootlocal.sh

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: alsa sound not loading properly
« Reply #13 on: September 21, 2013, 11:28:16 PM »
Ah, OK. I will add the ALSA stuff to my bootlocal as well then.
--
Quote
[...] and just run it everytime it doesn't enable. [...]
It sounds like it does work 'sometimes', does it?
If so, then try adding sleep 1 & in front of the  alsasound start  command.
Download a copy and keep it handy: Core book ;)

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: alsa sound not loading properly
« Reply #14 on: September 21, 2013, 11:33:25 PM »
Oh, and one more thing.
After checking my .filetool.lst several times, this time I remembered why I have added etc/modprobe.conf.
It saves the soundcard to be used.
Try running sudo alsaconf once more, add etc/modprobe.conf to your backup.
Download a copy and keep it handy: Core book ;)