update-smart-drivedb uses old download link

Bug #1209085 reported by Christian Franke
72
This bug affects 14 people
Affects Status Importance Assigned to Milestone
smartmontools (Ubuntu)
Fix Released
Medium
Unassigned
Trusty
Fix Released
Medium
Andreas Hasenack

Bug Description

[Impact]

Updating the smart driver db fails because the tool selected by the script (curl) is not called with a parameter that allows it to follow redirects. Since upstream changed the URL for that driver file, the script now fails.

The fix is to just add -L to the curl command line.

[Test Case]
$ sudo apt-get install smartmontools --no-install-recommends
$ sudo update-smart-drivedb
/var/lib/smartmontools/drivedb/drivedb.h.error: rejected by /usr/sbin/smartctl, probably no longer compatible

The file /var/lib/smartmontools/drivedb/drivedb.h.error contains the redirect notice:
<h1>302 Found</h1>
  The resource was found at <a href="https://sourceforge.net/p/smartmontools/code/HEAD/tree/branches/RELEASE_6_2_DRIVEDB/smartmontools/drivedb.h?format=raw">https://sourceforge.net/p/smartmontools/code/HEAD/tree/branches/RELEASE_6_2_DRIVEDB/smartmontools/drivedb.h?format=raw</a>;
you should be redirected automatically.

Update the packages and run the command again, this time it will succeed:
$ sudo update-smart-drivedb
/var/lib/smartmontools/drivedb/drivedb.h updated from branches/RELEASE_6_2_DRIVEDB

[Regression Potential]
If there is a redirect loop, before it wouldn't be followed, and now it will. There is a default limit of 50, though (--max-redirs' default), so eventually it will stop and fail (correctly).

[Other Info]
Later supported releases of Ubuntu and Debian have dropped this script from the package, so no fix is necessary there.

Following the spirit of the smallest change possible, I chose to not change the URL from where the file is downloaded.

[Original Description]

Package: smartmontools-6.1+svn3812-1 and older.

Due to sourceforge platform upgrades (http://sourceforge.net/blog/upgrades-april22/), the smartmontools SVN repository was moved to a new location. The update-smart-drivedb script from a smartmontools build before r3814 downloads drivedb.h from the old respository which is still present but set to R/O.

Possible fix:
- Update to smartmontools 6.2 (final, r3841), or
- Replace update-smart-drivedb with a new one generated from 6.2 tarball. Adjust the branch version number in line 'BRANCH="RELEASE_6_2_DRIVEDB"'. This should work for smartmontools 5.40 to 6.1. These drivedb.h branches are still maintained.

Related branches

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in smartmontools (Ubuntu):
status: New → Confirmed
Revision history for this message
Paul Hoell (hoellp) wrote :

What's up with this one? Can anyone take care of this annoyance?

This is what happens on 13.10:

~$ sudo update-smart-drivedb -v
Download from branches/RELEASE_6_2_DRIVEDB
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 329 100 329 0 0 1245 0 --:--:-- --:--:-- --:--:-- 1246
/var/lib/smartmontools/drivedb/drivedb.h.error: rejected by /usr/sbin/smartctl, probably no longer compatible

~$ cat /var/lib/smartmontools/drivedb/drivedb.h.error
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="http://sourceforge.net/p/smartmontools/code/">here</a>.</p>
<hr>
<address>Apache/2.2.3 (CentOS) Server at smartmontools.svn.sourceforge.net Port 50043</address>
</body></html>

~$ apt-cache show smartmontools
[snip]
Version: 6.1+svn3812-1
[snip]

~$ update-smart-drivedb -V
smartmontools 6.2 drive database update script
[snip]

Revision history for this message
IllPet (illpet) wrote :

The attached "patch" worked for me.

Or just run

# sed -i "/^SRCEXPR/{s#=.*#='http://sourceforge.net/p/smartmontools/code/HEAD/tree/\$location/smartmontools/drivedb.h?format=raw'#}" $(which update-smart-drivedb)

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "current URI for drivedb.h" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Norbert (nrbrtx) wrote :

Ubuntu Precise 12.04.5,
update-smart-drivedb does not work.
The error log is below.

sudo update-smart-drivedb -v
Download from branches/RELEASE_5_41_DRIVEDB
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 329 100 329 0 0 610 0 --:--:-- --:--:-- --:--:-- 1353
/usr/share/smartmontools/drivedb.h.error: rejected by /usr/sbin/smartctl, probably no longer compatible

tags: added: precise
Revision history for this message
44z6 (44z6) wrote :

update-smart-drivedb 6.2+svn3841-1.2, which is the current version in trusty (14.04), and 6.3+svn4002-2, which is the current version in wily (15.10), both work as long as you have the package ca-certificates installed along with either wget or lynx. If you have curl installed, update-smart-drivedb fails because curl is called without -L or --location. The reason is that update-smart-drivedb attempts to download
http://sourceforge.net/p/smartmontools/code/HEAD/tree/branches/RELEASE_6_2_DRIVEDB/smartmontools/drivedb.h?format=raw
which gets redirected to
https://sourceforge.net/p/smartmontools/code/HEAD/tree/branches/RELEASE_6_2_DRIVEDB/smartmontools/drivedb.h?format=raw
which needs to be verified.

update-smart-drivedb 5.41+svn3365-1, which is the current version in precise (12.04), does not work. It attempts to download
http://smartmontools.svn.sourceforge.net/viewvc/smartmontools/branches/RELEASE_5_41_DRIVEDB/smartmontools/drivedb.h?revision=HEAD
which is redirected to
http://sourceforge.net/p/smartmontools/code/ which is redirected to https://sourceforge.net/p/smartmontools/code/
which is redirected to
https://sourceforge.net/p/smartmontools/code/HEAD/tree/
which does not return a drivedb.h file.

Revision history for this message
Christian Franke (christian-franke) wrote :

I guess this will not be fixed in new packages, see Bug #1574894.

Revision history for this message
44z6 (44z6) wrote :

Would love to see this fixed in old packages, at least trusty (14.04). Should be trivial.

Christian, maybe you want to take this upstream. Keep up the excellent work.

Robie Basak (racb)
Changed in smartmontools (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → Medium
Revision history for this message
Eugene Dubovski (eugene-dubovski) wrote :

FYI, I fixed it in Debian Wheezy(6.3+svn3990-1~bpo70+1) and Ubuntu 14.04 (6.2+svn3841-1.2) by changing "http" to "https":

# update-smart-drivedb
/var/lib/smartmontools/drivedb/drivedb.h.error: rejected by /usr/sbin/smartctl, probably no longer compatible

# sed "s/SRCEXPR='http/SRCEXPR='https/g" -i $(which update-smart-drivedb)

# update-smart-drivedb
/var/lib/smartmontools/drivedb/drivedb.h updated from branches/RELEASE_6_2_DRIVEDB

Revision history for this message
Ravi Dhanshetty (rdhanshetty-2) wrote :

Hi all, FYI on Ubuntu 14.04, I just disabled curl in "/usr/sbin/update-smart-drivedb" and it is working fine for me. If your in hurry please try following steps as quick get around.

Steps :

(1) As mentioned by "44z6 (44z6) wrote on 2016-04-29", installed 'ca-certificates'
(2) Edited /usr/sbin/update-smart-drivedb and disabled/remove curl from "os_dltools=curl wget lynx"
        os_dltools="wget lynx"
(3) and ran "update-smart-drivedb"
        # update-smart-drivedb
        /var/lib/smartmontools/drivedb/drivedb.h updated from branches/RELEASE_6_2_DRIVEDB

thanks,
Ravi Dhanshetty

Revision history for this message
Eike (e-h-juerrens) wrote :

Hi all,
this bug is still present on ubuntu 14.04 LTS. The previously mentioned steps are working to solve this issue. My resulting /usr/sbin/update-smart-drivedb sections look like the following:
> [...]
> # Download tools
> os_dltools="wget lynx curl"
> [...]
I just moved curl to the end of the list.

Kind regards,
Eike

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

update-smart-drivedb was dropped in 6.4+svn4214-1:

smartmontools (6.4+svn4214-1) unstable; urgency=medium
...
  [ Jonathan Dowland ]
...
  * Get rid of update-smart-drivedb. Closes: #783317, #804299, #706909.
...
 -- Jonathan Dowland <email address hidden> Thu, 04 Feb 2016 23:21:58 +0000

So the last ubuntu release that is still supported and has this bug is trusty. As others have pointed out, adding -L to curl's command line fixes that case:
--- a/update-smart-drivedb.in
+++ b/update-smart-drivedb.in
@@ -155,7 +155,7 @@ download()

   case $tool in
     curl)
- vrun curl ${q:+-s} -f --max-redirs 0 \
+ vrun curl ${q:+-s} -f -L --max-redirs 0 \

Changed in smartmontools (Ubuntu):
status: Triaged → Fix Released
Changed in smartmontools (Ubuntu Trusty):
status: New → Triaged
importance: Undecided → Medium
tags: added: bitesize trusty
removed: precise
Changed in smartmontools (Ubuntu Trusty):
status: Triaged → In Progress
assignee: nobody → Andreas Hasenack (ahasenack)
description: updated
description: updated
description: updated
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Christian, or anyone else affected,

Accepted smartmontools into trusty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/smartmontools/6.2+svn3841-1.2ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-trusty to verification-done-trusty. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-trusty. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in smartmontools (Ubuntu Trusty):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-trusty
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Trusty verification

Confirming the problem:
ubuntu@trusty-smart-1209085:~$ sudo apt-get install smartmontools --no-install-recommends
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libfreetype6 os-prober
Use 'apt-get autoremove' to remove them.
Suggested packages:
  gsmartcontrol smart-notifier
Recommended packages:
  mailx mailutils
The following NEW packages will be installed:
  smartmontools
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 445 kB of archives.
After this operation, 1,650 kB of additional disk space will be used.
Get:1 http://br.archive.ubuntu.com/ubuntu/ trusty/main smartmontools amd64 6.2+svn3841-1.2 [445 kB]
Fetched 445 kB in 0s (1,562 kB/s)
Selecting previously unselected package smartmontools.
(Reading database ... 25846 files and directories currently installed.)
Preparing to unpack .../smartmontools_6.2+svn3841-1.2_amd64.deb ...
Unpacking smartmontools (6.2+svn3841-1.2) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up smartmontools (6.2+svn3841-1.2) ...
Processing triggers for ureadahead (0.100.0-16) ...

ubuntu@trusty-smart-1209085:~$ sudo update-smart-drivedb
/var/lib/smartmontools/drivedb/drivedb.h.error: rejected by /usr/sbin/smartctl, probably no longer compatible

With the update installed:
ubuntu@trusty-smart-1209085:~$ apt-cache policy smartmontools
smartmontools:
  Installed: 6.2+svn3841-1.2ubuntu0.1
  Candidate: 6.2+svn3841-1.2ubuntu0.1
  Version table:
 *** 6.2+svn3841-1.2ubuntu0.1 0
        500 http://br.archive.ubuntu.com/ubuntu/ trusty-proposed/main amd64 Packages
        100 /var/lib/dpkg/status
     6.2+svn3841-1.2 0
        500 http://br.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

Update script works:
ubuntu@trusty-smart-1209085:~$ sudo update-smart-drivedb
/var/lib/smartmontools/drivedb/drivedb.h updated from branches/RELEASE_6_2_DRIVEDB

ubuntu@trusty-smart-1209085:~$ file /var/lib/smartmontools/drivedb/drivedb.h
/var/lib/smartmontools/drivedb/drivedb.h: ASCII text
ubuntu@trusty-smart-1209085:~$ file /var/lhead /var/lib/smartmontools/drivedb/drivedb.h
/*
 * drivedb.h - smartmontools 6.1-6.3 drive database file
 *
 * Home page of code is: http://www.smartmontools.org
 *
 * Copyright (C) 2003-11 Philip Williams, Bruce Allen
 * Copyright (C) 2008-18 Christian Franke
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by

tags: added: verification-done-trusty
removed: verification-needed-trusty
Revision history for this message
Robie Basak (racb) wrote : Update Released

The verification of the Stable Release Update for smartmontools has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package smartmontools - 6.2+svn3841-1.2ubuntu0.1

---------------
smartmontools (6.2+svn3841-1.2ubuntu0.1) trusty; urgency=medium

  * d/p/curl-follow-redirects.patch: allow curl to follow redirects
    (LP: #1209085)

 -- Andreas Hasenack <email address hidden> Mon, 16 Jul 2018 16:10:08 -0300

Changed in smartmontools (Ubuntu Trusty):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.