ipilcher / n5550

Thecus N5550 hardware support
GNU General Public License v2.0
8 stars 8 forks source link

Alternate Installation for hddtemp and smartmontool / More Efficient SMART Helper #13

Closed astrom0 closed 7 years ago

astrom0 commented 7 years ago

Via email, I received this piece of advice from @ipilcher

"Also, the latest git code now used a more efficient SMART helper as a replacement for both hddtemp and smartmontools, so you may want to give it a try."

[Use the following] commands [...] to put this into action[]:

$ sudo yum install libatasmart-devel $ git clone https://github.com/ipilcher/n5550.git $ cd n5550/freecusd $ gcc -O3 -Wall -Wextra -pthread -o freecusd *.c -lcip

(Ignore the deprecation warnings about sys_errlist and sys_nerr.)

$ cd smart $ gcc -O3 -Wall -Wextra -o freecusd-smart-helper helper.c -latasmart $ sudo cp freecusd-smart-helper /usr/libexec/ $ cd .. $ sudo cp freecusd /usr/bin/ $ sudo systemctl restart freecusd

Once this is done, you can remove hddtemp and/or smartmontools if desired.

I'm getting stuck at the command to copy the directory freecusd to /usr/bin: sudo cp freecusd /usr/bin/

See below for system response detail:

[thecus@N5550 n5550]$ ls ./freecusd alert.c disk.c freecusd.h lib.c pic.c smart tty.c conf.c err.c freecusd.init loadavg.c proc.c smart.c cputemp.c freecusd.conf freecusd.service main.c raid.c sysfan.c [thecus@N5550 n5550]$ sudo cp ./freecusd /usr/bin/ cp: omitting directory ‘./freecusd’

Assuming that this gets sorted and thinking ahead, what are the recommended commands to remove the previous hddtemp and smartmontool installation?

Many thanks for the help ..

ipilcher commented 7 years ago

On 07/14/2017 04:17 PM, astrom0 wrote:

Via email, I received this piece of advice from @ipilcher [Use the following] commands [...] to put this into action?

$ sudo yum install libatasmart-devel
$ git clone https://github.com/ipilcher/n5550.git
$ cd n5550/freecusd
$ gcc -O3 -Wall -Wextra -pthread -o freecusd *.c -lcip

(Ignore the deprecation warnings about sys_errlist and sys_nerr.)

$ cd smart
$ gcc -O3 -Wall -Wextra -o freecusd-smart-helper helper.c -latasmart
$ sudo cp freecusd-smart-helper /usr/libexec/
$ cd ..
$ sudo cp freecusd /usr/bin/
$ sudo systemctl restart freecusd

Once this is done, you can remove hddtemp and/or smartmontools if
desired.

I'm getting stuck at command to copy the directory freecusd to /usr/bin: |sudo cp freecusd /usr/bin/|

[thecus@N5550 n5550]$ ls ./freecusd
alert.c disk.c freecusd.h lib.c pic.c smart tty.c
conf.c err.c freecusd.init loadavg.c proc.c smart.c
cputemp.c freecusd.conf freecusd.service main.c raid.c sysfan.c
[thecus@N5550 n5550]$ sudo cp ./freecusd /usr/bin/
cp: omitting directory ‘./freecusd’

Assuming that this gets sorted, what are the recommended commands to remove the previous hddtemp and smartmontool installation?

Don't try to copy the entire freecusd directory. You should only be copying the freecusd executable file. That file should have been built by this command above (run from within the freecusd directory):

$ gcc -O3 -Wall -Wextra -pthread -o freecusd *.c -lcip

hddtemp and smartmontools can be removed with yum:

$ sudo yum remove smartmontools hddtemp

I just realized, however, that this will remove the n5550 package itself, which you presumably don't want. For now, leave hddtemp and smartmontools installed. Let me know if the helper program works for you, and I'll update the SPEC file to build an RPM that uses it.

--

Ian Pilcher arequipeno@gmail.com -------- "I grew up before Mark Zuckerberg invented friendship" --------

astrom0 commented 7 years ago

Here's what happens when I run the command as specified from within freecusd ... (note the multiple errors in the script) - based on the initial comment to ignore warnings, I didn't look that close initially, so my apologies for the oversight.

[thecus@N5550 freecusd]$ gcc -O3 -Wall -Wextra -pthread -o freecusd .c -lcip smart.c:161:46: error: expected ‘;’, ‘,’ or ‘)’ before ‘cmd_buf’ static void fcd_smart_disable(char restrict cmd_buf, ^ smart.c:169:28: error: expected ‘;’, ‘,’ or ‘)’ before ‘cmd_buf’ char *const restrict cmd_buf, ^ smart.c:217:28: error: expected ‘;’, ‘,’ or ‘)’ before ‘status’ int const restrict status, ^ smart.c:239:48: error: expected ‘;’, ‘,’ or ‘)’ before ‘status’ static void process_status(int const restrict status) ^ smart.c:284:47: error: expected ‘;’, ‘,’ or ‘)’ before ‘status’ static void process_temps(int const restrict status, ^ smart.c: In function ‘fcd_smart_fn’: smart.c:375:5: warning: implicit declaration of function ‘fcd_smart_exec’ [-Wimplicit-function-declaration] ret = fcd_smart_exec(i, ^ smart.c:387:5: warning: implicit declaration of function ‘fcd_smart_parse’ [-Wimplicit-function-declaration] fcd_smart_parse(i, ^ smart.c:395:3: warning: implicit declaration of function ‘process_status’ [-Wimplicit-function-declaration] process_status(status); ^ smart.c:396:3: warning: implicit declaration of function ‘process_temps’ [-Wimplicit-function-declaration] process_temps(status, temps, cmd_buf, pipe_fds); ^ smart.c:400:4: warning: implicit declaration of function ‘fcd_smart_disable’ [-Wimplicit-function-declaration] fcd_smart_disable(cmd_buf, pipe_fds); ^ smart.c: At top level: smart.c:27:14: warning: ‘fcd_smart_cmd’ defined but not used [-Wunused-variable] static char *fcd_smart_cmd[] = { ^

ipilcher commented 7 years ago

On 07/16/2017 01:32 AM, astrom0 wrote:

Here's what happens when I run the command as specified from within freecusd ... (note the multiple errors in the script) - based on the initial comment to ignore warnings, I didn't look that close initially.

[thecus@N5550 freecusd]$ gcc -O3 -Wall -Wextra -pthread -o freecusd
*.c -lcip
smart.c:161:46: error: expected ‘;’, ‘,’ or ‘)’ before ‘cmd_buf’
static void fcd_smart_disable(char *restrict cmd_buf,
^

Aargh! Looks like the version of gcc in CentOS 7 doesn't like the "restrict" keyword. Run the following command in the freecusd/ directory before compiling:

$ sed -i s/restrict/restrict/ smart.c

--

Ian Pilcher arequipeno@gmail.com -------- "I grew up before Mark Zuckerberg invented friendship" --------

astrom0 commented 7 years ago

Thanks for the advice. That helped immensely. I needed to stop the freecusd daemon in order to copy the new executable across. See below for the full package of commands, along with the relevant modification to stop freecusd:

$ sudo yum install libatasmart-devel
$ git clone https://github.com/ipilcher/n5550.git
$ cd n5550/freecusd
$ gcc -O3 -Wall -Wextra -pthread -o freecusd *.c -lcip

Ignore the deprecation warnings about sys_errlist and sys_nerr. See below for a typical response:

[thecus@N5550 freecusd]$ gcc -O3 -Wall -Wextra -pthread -o freecusd *.c -lcip /tmp/cc7ARWlx.o: In function fcd_err_child_pabort': err.c:(.text+0x5a1): warning:sys_errlist' is deprecated; use strerror' orstrerror_r' instead err.c:(.text+0x597): warning: sys_nerr' is deprecated; usestrerror' or `strerror_r' instead

$ cd smart
$ sed -i s/restrict/__restrict__/ smart.c
$ gcc -O3 -Wall -Wextra -o freecusd-smart-helper helper.c -latasmart
$ sudo cp freecusd-smart-helper /usr/libexec/
$ cd ..
$ sudo systemctl stop freecusd
$ sudo cp freecusd /usr/bin/
$ sudo systemctl restart freecusd

This appears to clear the Red illuminated System Warning LED noted in Issue #12 and now the LCD displays the CPU Core temperatures and RAID status with sensible information. I'll close that issue on the strength of the results here.

Nicely done. This looks like a keeper and @ipilcher may want to think about modifying the Quick Start and git details to suit. Also, give some thought to incorporating lm_sensors as mentioned over at Issue #12. It makes better sense (in terms of efficiency, reliability and noise level) to me to have the system fan control to keep the hottest component in the system targetting an acceptable temperature range rather than setting the fan to a fixed speed. One for @ipilcher to consider.

Cheers. Now to setup Greyhole to provide me a storage solution that looks like suiting my needs.