I'm having a similar issue. It doesn't matter whether I run a new kernel or an older one. The garbage is printed to the console (tty1) whether irexec is running or not. The hardware.conf file is no longer used, so that solution is out-of-date, although I think the ultimate solution has something to do with disabling uinput.
I found that the lircd-uinput.service is used to send keyboard events to /dev/uinput, basically to the console. This is a handy service if you want to use a remote to send a keyboard key to a custom menu or program running on the console. The problem with the service, is that it keeps repeating the key until it receives a release code. This behavior is by design, but it doesn't work for my application. I found an easy solution to the repeat problem, so now I can use the service to fake a keyboard using an ir remote.
To make the lircd-uinput.service register the release event automatically, and stop repeating the key, edit the service and add the --add-release-events option.
sudo nano /lib/systemd/system/lircd-uinput.service
####find this line####
Restart the services and make sure they're active.
sudo systemctl force-reload lircd
sudo systemctl force-reload lircd-uinput
sudo systemctl status lircd
sudo systemctl status lircd-uinput
#I had to start lircd-uinput, since force-reload didn't:
sudo systemctl start lircd-uinput
Now the service only enters one keypress for each remote button press.
I think this should be the default setting, otherwise, your application has to send a release code back to the lircd-uinput service, which may be a nice feature if you know how to do that.
To list all possible keyboard events supported by the kernel run:
For example, if you want your remote to press the down arrow key on your console, the corresponding remote key is 'KEY_DOWN'. Then your remote file (/etc/lirc/lircd.conf.d/myremote.conf) would contain that key name.
#<sniped...remote stuff here...>
# <sniped other codes>
# <sniped other codes>
Now that I figured out how to stop the repeating, this is a really useful service. I was able to set up a simple dialog menu and make a quick-loading, basic and responsive remote-controlled media player using a Pi Zero.
I looked at the suggestion to disable the lircd-uinput.service and found that this corrects the problem. This is a good solution for my situation, as I don't need the uinput service, and this stops characters being sent to the console. I upvoted the other answer as it is a better solution than my original one. Your case may be different if you use the uinput service.
I'm not sure what uinput would be used for, but it sends characters to the console after a remote button is pressed. The problem is that the service keeps repeating the character indefinitely, even after you've stopped pressing the remote button. I don't know if this behavior is intentional or the service is faulty.
#solution if uinput is not needed for your application
systemctl stop lircd-uinput.service
systemctl disable lircd-uinput.service
ORIGINAL WORKAROUND (This is the workaround used before discovering that disabling uinput service corrects the problem):
The only workaround I've found is to disable both lircd and irexec services, and start them in a custom starup script.
sudo systemctl disable lircd.service
sudo systemctl disable irexec.service
Create a custom startup service
sudo nano /etc/systemd/system/run-at-startup.service
##contents of /etc/systemd/system/run-at-startup.service
Description=Run script at startup after network becomes reachable
Enable the new startup service
#set the execute bit (not sure if this is needed, but I do it anyway)
sudo chmod+x /etc/systemd/system/run-at-startup.service
sudo systemctl enable run-at-startup.service
Create the startup_script.sh in /home/pi/
##contents of /home/pi/startup_script.sh
irexec -d /etc/lirc/irexec.lircrc
#put anything else after this you want to start
#set the execute bit
Hardware and software info, occurs with either kernel, 5.4.71+, 4.14.34+, pizero, running console only, OS is Raspbian GNU/Linux 9 (stretch)