How To Set or Change Timezone on CentOS 7

Checking the Current Timezone

In CentOS and other modern Linux distros, you can use the timedatectl command to display and set the current system’s time and timezone.

Changing Timezone in CentOS

Before changing the timezone, you’ll need to find out the long name for the timezone you want to use. The timezone naming convention usually uses a “Region/City” format.

To list all available time zones, you can either list the files in the /usr/share/zoneinfo directory or use the timedatectl command.

timedatectl list-timezones
...
America/Tijuana
America/Toronto
America/Tortola
America/Vancouver
America/Whitehorse
America/Winnipeg
...

Once you identify which time zone is accurate to your location, run the following command as sudo user:

sudo timedatectl set-timezone your_time_zone

For example, to change the system’s timezone to America/Toronto:

sudo timedatectl set-timezone America/Toronto

Run the timedatectl command to verify the changes:

CentOS 7 – Failed to set MokListRT: Invalid Parameter

CentOS 7, a bug related to the latest update was detected.

After updating CentOS 7, when rebooting, it gives the following error and the server shuts down.

Failed to set MokListRT: Invalid Parameter
Something as gone seriously wrong: import_mok_state() failed:
Invalid Parameter


Workaround #1 : on existing machine, before updating, be sure to exclude shim* and mokutil* (so that it can stay at version shim-x64-12-2.el7.x86_64

  • echo 'exclude=shim*,mokutil*' >> /etc/yum.conf
  • yum update

Workaround #2 : if you have already updated and also rebooted, you have to use a live media to

  • mount /boot/efi
  • cd /boot/efi/EFI/centos
  • cp grubx64.efi shimx64.efi
  • umount
  • reboot