UCTRONICS / SKU_RM0004

Raspberry Pi NAS Cluster/Raspberry Pi SATA Cluster
50 stars 32 forks source link

Power button does not shutdown Raspberry PI with Ubuntu OS (resolved) #32

Closed WhirlyHat closed 9 months ago

WhirlyHat commented 9 months ago

I was having an issue with the power button not working on my Raspberry PI's with Ubuntu OS. Pressing the button would turn its LED off but not shut down the Raspberry PI. The power button's LED would not light up again unless I power cycled the PI.

Unlike the Raspberry Pi OS, which stores its config.txt file in the /boot directory, Ubuntu uses the /boot/firmware directory. Ubuntu 20.04 recommended adding user configurations to the usercfg.txt file, read by an include statement in config.txt, however this is no longer the case with Ubuntu 22.04 LTS. Ubuntu now merged /boot/firmware/config.txt and /boot/firmware/usercfg.txt into one file, so that the /boot/firmware/config.txt file is only required. askUbuntu article

At the top of the config.txt file under the [all] section, I commented out the existing dtparam and added the entry for UCtronics.

[all]
# Enable the audio output…..
# Commented out by me
#dtparam=i2c_arm=on
# Added this dtparam for UCtronics
dtparam=i2c_arm=on,i2c_arm_baudrate=400000

At the bottom of the config.txt file under the [all] section, I added the dtoverlay entry.

[all]
# Added this overlay for the UCtronics shutdown feature
dtoverlay=gpio-shutdown,gpio_pin=4,active_low=1,gpio_pull=up

After a reboot the power button now operated properly within Ubuntu. Hopefully this will help others experiencing the same issue.