Many pedals have a rubber pad underneath
that's only attached by one screw, at the front of the pedal.
You can rotate this pad, and it ends up underneath your heel, which prevents the pedal from wandering off.
Example from Roland: If your pedal doesn't have this, you can add it yourself
: take a strip of material (rubber, sturdy cloth) twice as long as the pedal, and attach it to the bottom of the pedal so it sticks out in front
and you can rest your heel on it when using the pedal.
You can get commercial solutions (search for Keyboard Pedal Pad)
that do the same.
lifehacks.stackexchange.com/users/5307/Hobbes
Glue the "hook" side of some industrial hook-and-loop (Velcro or generic) to the bottom of the pedal.
It'll be locked in place on carpet of any sort, but even on vinyl as in your photo, wood, or tile, it'll be much less prone to sliding away.
You can carry a strip of the peel-and-stick loop side, to temporarily apply to the floor in case of a floor that still gives trouble.
lifehacks.stackexchange.com/users/9830/Zeiss Ikon
I use a small section of non-slip drawer liner under my sewing machine peddle.
It works great to keep the peddle in place.
As a bonus, it's not typically adhesive on either side, so it can easily be moved.
It isn't typically extremely expensive and it might already be something you have laying around.
Here is a link to a picture of it.
I hope this is helpful, let me know if you have any questions or need clarification.
lifehacks.stackexchange.com/users/96/L.B.
You could fashion a "leash" for it by taping, tying or gluing twine or kite
string to it.
At the other end of the "leash", tie a loop that's a little bigger than the leg of the chair / bench you sit on.
Then before you play the keyboard each time, put the loop end around the leg of your bench / chair.
That will keep your pedal from straying too far away.
It may move left or right a little bit, but from my personal experience as a pianist / keyboardist, that movement should be minimal.
lifehacks.stackexchange.com/users/4198/BrettFromLA
BluTack(TM)
maybe your answer, if you are on a vinyl or wooden floor.
Other brands of Tacky putty are available.
Try 'procure' some from the back of posters in schools / offices.
Just place some under your pedal and stick it to the floor.
I wouldn't advise this on carpeted floors mind.
Elastic / Rubber bands could be used, either glue to the base of the pedal (if you have access to hot glue, or just wrap them around the pedal 'base structure' (not over the pedal itself mind) This will then add grip to the base of the pedal.
lifehacks.stackexchange.com/users/20626/TiO
In this setup, the pedal is attached to one end of a gaming mouse pad (basically an extra large mouse pad) using sticky back velcro.
The pedal won't move away from your foot because your foot also is also on the same gaming pad surface.
The gaming pad has a rubbery bottom, but that also won't move because the bench anchors the other end of the gaming pad and your weight keeps the whole thing in place.
It really works!
Some Amazon links (affiliate): FORITO Gaming Mouse
Pad VELCRO Brand - Extreme Outdoor - 4
" x 2" Strips
lifehacks.stackexchange.com/users/24449/Angela T
My keyboard is standing on a carpet which solves everything, just like it does for drums.
Another thing I used that did the job was moisturizing a dishcloth and putting it under the pedal.
Make sure that it is not all soaked, but just a little bit moist and it will stay in his place.
That way you don`t have to glue and can always place it on a different place if you want.
lifehacks.stackexchange.com/users/19440/SebastienPattyn
I recently procured a musical keyboard, with a pedal that attaches to the keyboard via a wire. It looks like this:   The problem is, it runs away every time I try to play the keyboard. I step on it, and it moves farther away. I raise my foot, put it down again, and it scoots farther away.  How do I make sure that this doesn't happen, without putting something behind it that will mess up the cord?
How do I keep my keyboard pedal from running away?
lifehacks.stackexchange.com
<music>
lifehacks.stackexchange.com/questions/15924
lifehacks.stackexchange.com/users/4088/Mithical
A very simple way to stop the keyboard pedal moving is to simply put the keyboard and the pedal on a carpet. However, if that isn't possible, you could place the pedal on a non-slip liner or a piece of material, such as a mouse pad, upon which the heel of your foot can rest too. In fact, some pedals have a rubber pad underneath which you can rotate so your heel sits on the pedal to prevent it from wandering. The options are to use a rubber pad for the pedal (check to see if there is one already attached), glue a bit of velcro or some non-slip drawer liner to it or put a large mouse pad or a damp dish cloth under it to keep it in place.
Check if there is a rubber pad for the pedal and if not buy one or make one. Glue a piece of velcro to the bottom of the pedal. Attach a bit of non-slip drawer liner under the pedal. Put the pedal on a large mouse pad. Moisten a dish cloth and place it under the pedal.