[2/3] alsa: Fixes Bug#13087 - adds module removal for stopping alsa.

Message ID 20230421211503.2647702-2-adolf.belka@ipfire.org
State Superseded
Headers
Series [1/3] alsa: Fix bug#13087 remove services entry |

Commit Message

Adolf Belka April 21, 2023, 9:15 p.m. UTC
  - Stopping alsa or uninstalling it left the sound modules installed until a reboot was
   carried out. Uninstallation or stopping the kernel modules should also unload them.
   This patch adds in the modprobe -r commands to unload all the snd modules installed
   with the start command. The stop command is then added into the uninstall script to
   remove the modules.

Fixes: Bug#13087
Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 src/initscripts/packages/alsa | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Adolf Belka May 3, 2023, 11:47 a.m. UTC | #1
Hi Arne,

On 02/05/2023 10:55, Arne Fitzenreiter wrote:
> I think this will not work.
> You have to run "alsctl store" to save the mixer settings before you unload the modules.
Thanks for flagging this up. I hadn't thought of that. I will fix it.
> 
> There are also some *.conf files commented in the rootfiles. Also complains that they are missing since some
> versions. (still work on my hardware anyways.)
> Please include it to the package.
I will find them and uncomment them in the rootfile.

What is the best way to submit these updates. Just a v2 update for the patch 2/3 plus another patch for the rootfile update or should I do a v2 patch submission for the complete set of three patches from the original set together with an additional patch for the rootfile changes?

Regards,

Adolf.
> 
> Arne
> 
> 
> Am 2023-04-21 23:15, schrieb Adolf Belka:
>> - Stopping alsa or uninstalling it left the sound modules installed
>> until a reboot was
>>    carried out. Uninstallation or stopping the kernel modules should
>> also unload them.
>>    This patch adds in the modprobe -r commands to unload all the snd
>> modules installed
>>    with the start command. The stop command is then added into the
>> uninstall script to
>>    remove the modules.
>>
>> Fixes: Bug#13087
>> Tested-by: Adolf Belka <adolf.belka@ipfire.org>
>> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
>> ---
>>  src/initscripts/packages/alsa | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/src/initscripts/packages/alsa b/src/initscripts/packages/alsa
>> index 348e33846..3bfb69f62 100644
>> --- a/src/initscripts/packages/alsa
>> +++ b/src/initscripts/packages/alsa
>> @@ -33,6 +33,10 @@ case "$1" in
>>          ;;
>>      stop)
>>          boot_mesg "Stopping ALSA...    Saving volumes..."
>> +        modprobe -r snd_pcm_oss >/dev/null 2>&1 || failed=1
>> +        modprobe -r snd_timer >/dev/null 2>&1 || failed=1
>> +        (exit ${failed})
>> +        evaluate_retval
>>          loadproc /usr/sbin/alsactl store
>>          ;;
  
Michael Tremer May 3, 2023, 12:08 p.m. UTC | #2
What is the benefit of unloading the kernel modules?

Wouldn’t they automatically be reloaded once something triggers udev?

-Michael

> On 3 May 2023, at 12:47, Adolf Belka <adolf.belka@ipfire.org> wrote:
> 
> Hi Arne,
> 
> On 02/05/2023 10:55, Arne Fitzenreiter wrote:
>> I think this will not work.
>> You have to run "alsctl store" to save the mixer settings before you unload the modules.
> Thanks for flagging this up. I hadn't thought of that. I will fix it.
>> There are also some *.conf files commented in the rootfiles. Also complains that they are missing since some
>> versions. (still work on my hardware anyways.)
>> Please include it to the package.
> I will find them and uncomment them in the rootfile.
> 
> What is the best way to submit these updates. Just a v2 update for the patch 2/3 plus another patch for the rootfile update or should I do a v2 patch submission for the complete set of three patches from the original set together with an additional patch for the rootfile changes?
> 
> Regards,
> 
> Adolf.
>> Arne
>> Am 2023-04-21 23:15, schrieb Adolf Belka:
>>> - Stopping alsa or uninstalling it left the sound modules installed
>>> until a reboot was
>>>    carried out. Uninstallation or stopping the kernel modules should
>>> also unload them.
>>>    This patch adds in the modprobe -r commands to unload all the snd
>>> modules installed
>>>    with the start command. The stop command is then added into the
>>> uninstall script to
>>>    remove the modules.
>>> 
>>> Fixes: Bug#13087
>>> Tested-by: Adolf Belka <adolf.belka@ipfire.org>
>>> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
>>> ---
>>>  src/initscripts/packages/alsa | 4 ++++
>>>  1 file changed, 4 insertions(+)
>>> 
>>> diff --git a/src/initscripts/packages/alsa b/src/initscripts/packages/alsa
>>> index 348e33846..3bfb69f62 100644
>>> --- a/src/initscripts/packages/alsa
>>> +++ b/src/initscripts/packages/alsa
>>> @@ -33,6 +33,10 @@ case "$1" in
>>>          ;;
>>>      stop)
>>>          boot_mesg "Stopping ALSA...    Saving volumes..."
>>> +        modprobe -r snd_pcm_oss >/dev/null 2>&1 || failed=1
>>> +        modprobe -r snd_timer >/dev/null 2>&1 || failed=1
>>> +        (exit ${failed})
>>> +        evaluate_retval
>>>          loadproc /usr/sbin/alsactl store
>>>          ;;
  
Adolf Belka May 3, 2023, 12:26 p.m. UTC | #3
Hi Michael,

On 03/05/2023 14:08, Michael Tremer wrote:
> What is the benefit of unloading the kernel modules?
> 
> Wouldn’t they automatically be reloaded once something triggers udev?
I tested installing the alsa addon on my production machine, which doesn't have any sound capability at all and I don't plan to install it. However, after installing the alsa addon I had the modules loaded and after uninstalling the alsa addon those alsa related kernel modules stayed there and would persist till a reboot was done for a core update for example.
It just seemed to me that unneeded kernel modules shouldn't stay loaded up just because an addon was installed for a test and then removed.

It seemed that things that installed modules should remove them when they are uninstalled.

Maybe the unloading should be moved to the uninstall.sh file rather than in the initscript. That might make more sense because then the addon has been completely (hopefully) removed.

Regards,
Adolf

> 
> -Michael
> 
>> On 3 May 2023, at 12:47, Adolf Belka <adolf.belka@ipfire.org> wrote:
>>
>> Hi Arne,
>>
>> On 02/05/2023 10:55, Arne Fitzenreiter wrote:
>>> I think this will not work.
>>> You have to run "alsctl store" to save the mixer settings before you unload the modules.
>> Thanks for flagging this up. I hadn't thought of that. I will fix it.
>>> There are also some *.conf files commented in the rootfiles. Also complains that they are missing since some
>>> versions. (still work on my hardware anyways.)
>>> Please include it to the package.
>> I will find them and uncomment them in the rootfile.
>>
>> What is the best way to submit these updates. Just a v2 update for the patch 2/3 plus another patch for the rootfile update or should I do a v2 patch submission for the complete set of three patches from the original set together with an additional patch for the rootfile changes?
>>
>> Regards,
>>
>> Adolf.
>>> Arne
>>> Am 2023-04-21 23:15, schrieb Adolf Belka:
>>>> - Stopping alsa or uninstalling it left the sound modules installed
>>>> until a reboot was
>>>>     carried out. Uninstallation or stopping the kernel modules should
>>>> also unload them.
>>>>     This patch adds in the modprobe -r commands to unload all the snd
>>>> modules installed
>>>>     with the start command. The stop command is then added into the
>>>> uninstall script to
>>>>     remove the modules.
>>>>
>>>> Fixes: Bug#13087
>>>> Tested-by: Adolf Belka <adolf.belka@ipfire.org>
>>>> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
>>>> ---
>>>>   src/initscripts/packages/alsa | 4 ++++
>>>>   1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/src/initscripts/packages/alsa b/src/initscripts/packages/alsa
>>>> index 348e33846..3bfb69f62 100644
>>>> --- a/src/initscripts/packages/alsa
>>>> +++ b/src/initscripts/packages/alsa
>>>> @@ -33,6 +33,10 @@ case "$1" in
>>>>           ;;
>>>>       stop)
>>>>           boot_mesg "Stopping ALSA...    Saving volumes..."
>>>> +        modprobe -r snd_pcm_oss >/dev/null 2>&1 || failed=1
>>>> +        modprobe -r snd_timer >/dev/null 2>&1 || failed=1
>>>> +        (exit ${failed})
>>>> +        evaluate_retval
>>>>           loadproc /usr/sbin/alsactl store
>>>>           ;;
>
  

Patch

diff --git a/src/initscripts/packages/alsa b/src/initscripts/packages/alsa
index 348e33846..3bfb69f62 100644
--- a/src/initscripts/packages/alsa
+++ b/src/initscripts/packages/alsa
@@ -33,6 +33,10 @@  case "$1" in
 		;;
 	stop)
 		boot_mesg "Stopping ALSA...    Saving volumes..."
+		modprobe -r snd_pcm_oss >/dev/null 2>&1 || failed=1
+		modprobe -r snd_timer >/dev/null 2>&1 || failed=1
+		(exit ${failed})
+		evaluate_retval
 		loadproc /usr/sbin/alsactl store
 		;;