Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

set-timeout 0 should set the timeout to 0, not remove it #263

@bwarden

Description

@bwarden

if (timeout > 0) {
/* Set the timeout as configured by the user */
item_name = string_printf("timeout %d\ndefault %s-%s-%s-%d.conf\n",
timeout,
prefix,
kernel->meta.ktype,
kernel->meta.version,
kernel->meta.release);
} else {
item_name = string_printf("default %s-%s-%s-%d.conf\n",
prefix,
kernel->meta.ktype,
kernel->meta.version,
kernel->meta.release);
}

path = string_printf("%s%s/timeout", self->sysconfig->prefix, KERNEL_CONF_DIRECTORY);
if (timeout <= 0) {
/* Nothing to be done here. */
if (!nc_file_exists(path)) {
return true;
}
if (unlink(path) < 0) {
LOG_ERROR("Unable to remove %s: %s", path, strerror(errno));
return false;
}
return true;
}

# clr-boot-manager set-timeout 0
Timeout has been removed

results in the timeout value being completely removed from loader.conf, in which case systemd-boot will remain at the menu until the user makes a selection. Instead, we should write timeout 0 to loader.conf.

https://www.freedesktop.org/software/systemd/man/latest/loader.conf.html

Workaround is to mount /boot and manually change loader.conf

systemctl start boot.mount
cat /boot/loader/loader.conf # To check against the new file we generate
(echo 'timeout 0'; grep -v '^timeout' /boot/loader/loader.conf) > /boot/loader/loader.conf.new
cat /boot/loader/loader.conf.new # Make sure this looks right
mv /boot/loader/loader.conf.new /boot/loader/loader.conf
systemctl stop boot.mount

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions