sysutils/devcpu-data error "Please update your system in order to update CPU microcode."

Nikos Kastanas zerotronic at gmail.com
Sun Feb 18 16:41:32 UTC 2018


Hello

I have a problem that i cannot seem to able to find the answer to.

I have a Lenovo X220 laptop that runs FreeBSD-11.1-RELEASE fully updated
with freebsd-update
I installed sysutils/devcpu-data in order to update the cpu microcode, then
i checked that cpuctl is loaded in kldload and then i added
microcode_update_enable="YES" in /etc/rc.conf

When i run service microcode_update start i always get the error "Please
update your system in order to update CPU microcode."

After checking in the microcode_update rc script i see the following:
https://svnweb.freebsd.org/ports/head/sysutils/devcpu-data/files/microcode_update.in?revision=459084&view=markup

58    if [ "${microcode_cpus}" = "ALL" ]; then
59        CPUCONTROL_UPDATED=$(cpucontrol -h 2>&1 | grep -q -- -e; echo $?)
60        if [ ${CPUCONTROL_UPDATED} -ne 0 ]; then
61            echo "Please update your system in order to update CPU
microcode."
62        else


>From what i can understand the script is trying to run "cpucontrol -h 2>&1
| grep -q -- -e" and then get the exit code.
If the exit code is 0 then all is ok but if the exit code is not equal to
zero then it displays that error message.

So i tried to run "cpucontrol -h | grep -q -- -e" manually as root and it
dispayed the usage as it should, but when i checked the exit code with
"echo $?" i got 1.
After running only "cpucontrol -h" i get an exit code of 64.
Then i decided to take a look in the cpucontrol source code in the svn
repository
https://svnweb.freebsd.org/base/release/11.1.0/usr.sbin/cpucontrol/cpucontrol.c?revision=321354&view=markup
and this is what i found:

453     case 'h':
454         /* FALLTHROUGH */
455     default:
456         usage();
457         /* NOTREACHED */
458     }

which, if i understand correctly, means that when i run "cpucontrol -h"
then it falls through to the default case which is to run the usage()
function.

After checking the usage() function i found the following:

109     usage(void)
110     {
111             const char *name;
112
113             name = getprogname();
114             if (name == NULL)
115                     name = "cpuctl";
116             fprintf(stderr, "Usage: %s [-vh] [-d datadir] [-m
msr[=value] | "
117                 "-i level | -i level,level_type | -u] device\n", name);
118             exit(EX_USAGE);
119     }

If i understand correctly this function will display the usage of the
program and then always exit with an exit code of EX_USAGE, which according
to
https://www.freebsd.org/cgi/man.cgi?sysexits(3) is is equal to 64 and means
that the command was used incorrectly.

If devcpu-data expects cpucontrol usage to exit with 0 in order for it to
run the update, but cpucontrol usage always exits with 64 then the update
will never happen. I will always get the error message
"Please update your system in order to update CPU microcode."

My question is how can i fix that so i can update my cpu microcode?

Thank you for your time

Best regards,

Nikos Kastanas
-- 
email : zerotronic at gmail.com
           nik.kastanas at gmail.com


More information about the freebsd-ports mailing list