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

[openSUSE] Distro-specific smartd.conf location #2070

Closed
FroggyFlox opened this issue Sep 18, 2019 · 6 comments · Fixed by #2072
Closed

[openSUSE] Distro-specific smartd.conf location #2070

FroggyFlox opened this issue Sep 18, 2019 · 6 comments · Fixed by #2072

Comments

@FroggyFlox
Copy link
Member

In openSUSE (both leap 15.1 and Tumbleweed), the location of smartd.conf used by Rockstor differs from CentOS. As a result, SMART settings configuration from Rockstor webUI isn't possible in openSUSE variants for now.

The location of smartd.conf across all three distributions is as follows:

OS smartd version smartd.conf location
CentOS smartd 6.5 2016-05-07 r4318 /etc/smartmontools/smartd.conf
Leap 15.1 smartd 6.6 2017-11-05 r4594 /etc/smartd.conf
Tumbleweed smartd 7.0 2019-05-21 r4917 /etc/smartd.conf

I believe resolving this issue would require to specify a distro-specific location for smartd.conf in the update_config() function:

def update_config(config):
SMARTD_CONFIG = '/etc/smartmontools/smartd.conf'
ROCKSTOR_HEADER = ('###BEGIN: Rockstor smartd config. DO NOT EDIT BELOW '
'THIS LINE###')

@phillxnet
Copy link
Member

@FroggyFlox Thanks for creating this issue: an excellent exposition.

Looks like potentially another candidate for our existing distro (python-distro) dependency as per the mechanism used in:

"add non legacy distro aware repo configuration. Fixes #1991" #1992

I.e. conditional on distro_id for example.

@FroggyFlox
Copy link
Member Author

Agreed!
The following line from the SMART service configuration webUI template would also need to be updated accordingly:

<label class="col-sm-4 control-label" for="custom_config">configuration lines will be saved to the ROCKSTOR section in /etc/smartmontools/smartd.conf</label>

Noting here for reference.

@FroggyFlox
Copy link
Member Author

I just made a quick commit with conditional definition of smartd.conf's path based on distro.id() output. See below:
FroggyFlox@409aaa5

This commit has been tested to work in all three OSes.

Regarding updating the configure_smartd.jst template, we could simply shorten the text to smartd.conf, but ideally we could have the correct path displayed depending on the OS. My first thought was to use the distroInfo as displayed on the top right of the webUI but I'm unsure how to access this data.

var distroInfo = function(data) {
$('#distro-info').text(data.distro);
$('#distro-info').attr('title', data.version);
};

RockStorSocket.addListener(distroInfo, this, 'sysinfo:distro_info');

@phillxnet
Copy link
Member

@FroggyFlox Re:

Regarding updating the configure_smartd.jst template, we could simply shorten the text to smartd.conf

I think I favour this approach personally. Not ideal or complete but we are talking about a fairly advanced feature anyway. And we can always circle back around to improving this as it would be a fairly minor downgrade on tooltip info for a significant fix that we needn't hold up for the sake of a toolip detail.

but ideally we could have the correct path displayed depending on the OS.

Agreed but we can get this sorted at a later date.

@FroggyFlox
Copy link
Member Author

Sounds good!
I'll proceed with a PR soon in this case.

@FroggyFlox
Copy link
Member Author

Brief update:

smartd has been updated on CentOS Rockstor to 7.0 (rev 4883). Nothing broke, however, as the file location remains the same:

[root@Rockstor ~]# smartd -V
smartd 7.0 2018-12-30 r4883 [x86_64-linux-4.12.4-1.el7.elrepo.x86_64] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

smartd comes with ABSOLUTELY NO WARRANTY. This is free
software, and you are welcome to redistribute it under
the terms of the GNU General Public License; either
version 2, or (at your option) any later version.
See http://www.gnu.org for further details.

smartmontools release 7.0 dated 2018-12-30 at 14:47:55 UTC
smartmontools SVN rev 4883 dated 2018-12-30 at 14:48:54
smartmontools build host: x86_64-redhat-linux-gnu
smartmontools build with: C++98, GCC 4.8.5 20150623 (Red Hat 4.8.5-39)
smartmontools configure arguments: '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-selinux' '--with-libcap-ng=yes' '--with-libsystemd' '--with-systemdsystemunitdir=/usr/lib/systemd/system' '--sysconfdir=/etc/smartmontools/' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic' 'LDFLAGS=-Wl,-z,relro ' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'
[root@Rockstor ~]# 
[root@Rockstor ~]# systemctl status -l smartd
â—� smartd.service - Self Monitoring and Reporting Technology (SMART) Daemon
   Loaded: loaded (/usr/lib/systemd/system/smartd.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-09-30 11:12:41 PDT; 9min ago
     Docs: man:smartd(8)
           man:smartd.conf(5)
 Main PID: 1754 (smartd)
   Status: "Next check of 0 devices will start at 11:42:41"
   CGroup: /system.slice/smartd.service
           └─1754 /usr/sbin/smartd -n -q never

Sep 30 11:12:41 Rockstor smartd[1754]: Opened configuration file /etc/smartmontools/smartd.conf
Sep 30 11:12:41 Rockstor smartd[1754]: Configuration file /etc/smartmontools/smartd.conf was parsed, found DEVICESCAN, scanning devices
Sep 30 11:12:41 Rockstor smartd[1754]: Device: /dev/sda, type changed from 'scsi' to 'sat'
Sep 30 11:12:41 Rockstor smartd[1754]: Device: /dev/sda [SAT], opened
Sep 30 11:12:41 Rockstor smartd[1754]: Device: /dev/sda [SAT], VBOX HARDDISK, S/N:VBacc54308-956d438b, FW:1.0, 8.58 GB
Sep 30 11:12:41 Rockstor smartd[1754]: Device: /dev/sda [SAT], not found in smartd database.
Sep 30 11:12:41 Rockstor smartd[1754]: Device: /dev/sda [SAT], lacks SMART capability
Sep 30 11:12:41 Rockstor smartd[1754]: Device: /dev/sda [SAT], to proceed anyway, use '-T permissive' Directive.
Sep 30 11:12:41 Rockstor smartd[1754]: Monitoring 0 ATA/SATA, 0 SCSI/SAS and 0 NVMe devices
Sep 30 11:12:41 Rockstor systemd[1]: Started Self Monitoring and Reporting Technology (SMART) Daemon.
[root@Rockstor ~]# cat /usr/lib/systemd/system/smartd.service
[Unit]
Description=Self Monitoring and Reporting Technology (SMART) Daemon
Documentation=man:smartd(8) man:smartd.conf(5)

[Service]
Type=notify
EnvironmentFile=-/etc/sysconfig/smartmontools
ExecStart=/usr/sbin/smartd -n $smartd_opts
ExecReload=/bin/kill -HUP $MAINPID
StandardOutput=syslog

[Install]
WantedBy=multi-user.target

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants