Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

batocera-settings-(get/set) fails to read and write properly to /boot/config.txt #3349

Closed
wholee opened this issue Mar 10, 2021 · 15 comments · Fixed by #3781
Closed

batocera-settings-(get/set) fails to read and write properly to /boot/config.txt #3349

wholee opened this issue Mar 10, 2021 · 15 comments · Fixed by #3781
Labels

Comments

@wholee
Copy link

wholee commented Mar 10, 2021

RaspberryPi 4 2GB
Batocera v.30

batocera-settings-set:
batocera-settings-set -f /boot/config.txt dtovelay disable-bt
returns
Invalid config file: key 'initramfs boot/initrd.gz' has no value on line 69#

batocera-settings-get:
batocera-settings-get -f /boot/config.txt kernel
returns proper value:
boot/linux

batocera-settings-get -f /boot/config.txt overscan_scale
returns nothing

Basically, if the <key><value> is after entry initramfs boot/initrd.gz in /boot/config.txt it will not be read

Content of /boot/config.txt:

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# 64-bit mode
arm_64bit=1

# sets the initial CEC name of the device
cec_osd_name=batocera

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
# at 0, it causes flickering on hdmi output
disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# if you plug your tv at the same time as your rpi and that the rpi switches from the hdmi or give a low resolution because tv had no enough time to initialize it
boot_delay=3

# uncomment for composite PAL
#sdtv_mode=2

# uncomment if you have slow sound issues on composite output
#audio_pwm_mode=0

# uncomment for lirc-rpi
#dtoverlay=lirc-rpi

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# uncomment if you don't want the rainbow at startup
disable_splash=1

# Overclock
# https://www.raspberrypi.org/documentation/configuration/config-txt/memory.md
gpu_mem_1024=384

kernel=boot/linux
initramfs boot/initrd.gz

# enable UART (required for for retroflag)
# affect rpi performances
# enable_uart=1

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[rpi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-kms-v3d-pi4,noaudio

hdmi_ignore_edid=0xa5000080
overscan_scale=1

# Overlay setup for proper powercut, needed for Retroflag cases
dtoverlay=gpio-poweroff,gpiopin=4,active_low=1,input=1
@wholee wholee changed the title batocera-settings-get and batocera-settings-set fails to read and write properly to /boot/config.txt batocera-settings-(get/set) fails to read and write properly to /boot/config.txt Mar 10, 2021
@liberodark
Copy link

@glebm you have any idea ?

@crcerror
Copy link

@rtissera it's fixed - caused by some byte order in config file

@rtissera
Copy link

can we close the issue then ?

@crcerror
Copy link

crcerror commented Mar 11, 2021

IMHO fixed for B31 take a look at PR3312

@rtissera
Copy link

Right, fixed by #3312
Closing it.

@wholee
Copy link
Author

wholee commented Apr 23, 2021

@rtissera
Just did a test on 31-dev 2021/04/22 21:42 and the issue is still present:


Disk format: ext4
Temperature: 54°C
Architecture: rpi4
Model: Raspberry Pi 4 Model B Rev 1.2
Revision: b03112
System: Linux 5.10.31-v8
Available memory: 1158/1541 MB
Cpu number: 4
Cpu max frequency: 1800 MHz
OS version: 31-dev 2021/04/22 21:42

# batocera-settings-get -f /boot/config.txt overscan_scale
# batocera-settings-get -f /boot/config.txt kernel
boot/linux
# batocera-settings-set -f /boot/config.txt dtovelay disable-bt
Invalid config file: key 'initramfs boot/initrd.gz' has no value on line 116#
#

@rtissera
Copy link

@crcerror can you reopen ?

@nadenislamarre
Copy link
Collaborator

but batocera-settings is not for /boot/config.txt, it is for /boot/batocera-boot.conf and batocera.conf or i am wrong ?

@wholee
Copy link
Author

wholee commented Apr 23, 2021

https://wiki.batocera.org/usage_of_batocera-settings#handling_in_scripts

My impression was that batocera-settings-(get/set) was a replacement for batocera-settings
If batocera-settings-(get/set) should not be used for config.txt that's ok, I'll find a different way to edit the file.

@crcerror
Copy link

crcerror commented Apr 23, 2021

@rtissera It was decided to drop batocera-settings and use the 2 binaries instead. In theory both ways should still work even though batocera-settings used advanced error return codes.

If there is a fix needed then @glebm should do that.

@wholee
As long as the file contains values as kind of

Key=value

every file can be opened and used with batocera-settings-get set. You can also copy the old script back and use the CLI. I removed the script usage in wiki because it is outdated

EDIT
Please make boot partition writeable
batocera-es-swissknife --remount

@glebm
Copy link

glebm commented Apr 24, 2021

@wholee is describing an issue that is unrelated to this one. I've filed glebm/mini_settings#1. It's fairly low priority because it is rare that you want to edit /boot/config.txt in that manner. If you're enabling UART debugging you probably know how to use vi or rig a sed command also :)

@glebm
Copy link

glebm commented Apr 24, 2021

Ah, nevermind, the original issue was unrelated to the UTF-8 BOM markers, this should be reopened (or we could say editing /boot/config.txt is not supported yet)

glebm added a commit to glebm/batocera.linux that referenced this issue Apr 25, 2021
Allows `batocera-settings-set` to be used with `/boot/config.txt`.

Fixes batocera-linux#3349

batocera-linux/mini_settings@32d05a4
@glebm
Copy link

glebm commented Apr 25, 2021

Fixed in #3781

@wholee
Copy link
Author

wholee commented May 7, 2021

Hi,

RaspberryPi 4 2GB
Batocera 31-dev 2021/05/05 11:08

@glebm
It's still not working properly. It overwrites ALL dtoverlay parameters in the config.txt file.

config.txt before:

<snip>
# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[rpi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-kms-v3d-pi4,noaudio

# Custom
dtoverlay=disable-wifi
hdmi_ignore_edid=0xa5000080

# Overlay setup for proper powercut, needed for Retroflag cases
dtoverlay=gpio-poweroff,gpiopin=4,active_low=1,input=1
over_voltage=4
arm_freq=1800
gpu_freq=600

after running batocera-settings-set -f /boot/config.txt dtoverlay disable-wifi this is the result:

<snip>
# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
dtoverlay=disable-wifi
dtoverlay=disable-wifi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[rpi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=disable-wifi

# Custom
dtoverlay=disable-wifi
hdmi_ignore_edid=0xa5000080

# Overlay setup for proper powercut, needed for Retroflag cases
dtoverlay=disable-wifi
over_voltage=4
arm_freq=1800
gpu_freq=600

( also note the updated dtoverlay under # Uncomment this to enable infrared communication. which was commented out previously )

Looking at the code I can see where this behavior is coming from. And that behavior is correct because if a user has multiple same key/value pairs it needs to change them all but that does not apply to boot/config.txt

@glebm
Copy link

glebm commented May 22, 2021

@wholee Yeah, I guess for that use case you're better off with sed.

glebm added a commit to glebm/batocera.linux that referenced this issue May 22, 2021
Disables file validation by default for the `batocera-settings-get`
command. This allows (limited) usage with /boot/config.txt. Refs batocera-linux#3349

batocera-linux/mini_settings@b9822f8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants