Save last volume level with DietPi


I have installed the latest DietPi distro in my RPi 3 + IQaudIO Pi-DAC Pro boundle.
As default behavior, the volume level is not saved and always returns at 100% after a reboot.

Using the command alsactl store, I was able to save to alsamixer another default level, but I would like to automatically store the last volume level used for playback (as done by IQaudIO RoonReady certified image).
Is it possible also with DietPi?

1 Like


Is the alsamixer name for main volume ‘PCM’?
If so, our boot script is causing the volume to reset to 100% during boot. It’s designed to reset onboard RPi volume levels.

Try removing the following code from:


Remove these lines

                #RPi set volume to -0.1db | We have to do it here because sound$
                if (( $G_HW_MODEL < 10 )); then

                        which amixer &> /dev/null && amixer set PCM -- -010 &


Set volume to desired level, then reboot system and recheck.

1 Like

Hi Dan,

the alsamixer main volume name is “Digital”, as you can see in the attached picture.
40% is the default value that I have saved with alsactl store



Ok, alsactl store is whats required.

Strange, there is a systemD service which should do this automatically. Save during shutdown and restore during boot:

systemctl status alsa-restore.service -l

It saves the config on shutdown to /var/lib/alsa/asound.state

Try removing your generated alsactl store, set volume, reboot, then check the above items.

Maybe it’s because I turn-off the DAC by simply unplug the USB.
Probably the IQaudIO certified image saves somewhere the volume level each time I change it, and not only at shoutdown.

Anyway, I will check.

If I perform a clean shutdown, the volume level is properly saved.
When I simply turn-off the device, it is not.
That means DietPi distro saves the volume only at shutdown and not immediately when changed.

This is the status of alsa-restore service: