{"id":1374,"date":"2016-02-25T18:33:09","date_gmt":"2016-02-25T23:33:09","guid":{"rendered":"http:\/\/osric.com\/chris\/accidental-developer\/?p=1374"},"modified":"2016-02-25T18:33:09","modified_gmt":"2016-02-25T23:33:09","slug":"downgrading-a-debian-package","status":"publish","type":"post","link":"https:\/\/osric.com\/chris\/accidental-developer\/2016\/02\/downgrading-a-debian-package\/","title":{"rendered":"Downgrading a Debian package"},"content":{"rendered":"<p>After I updated a Debian Wheezy server to Debian Jessie, I was having some problems with VLC. I was using the cvlc to capture and record video streams, but the capture would fail after 2 seconds. A colleague suggested that I leave the OS version alone, but downgrade VLC to confirm that the new version of VLC was causing the problem. A sound idea, but how do you downgrade a Debian package?<\/p>\n<p>I found a variety of helpful sites and came up with the following:<\/p>\n<ol>\n<li>Add the source for the downgraded package the apt config<\/li>\n<li>Specify the target release in the apt config<\/li>\n<li>Use &#8220;pinning&#8221; to tell apt to use the older versions for the package and its dependencies<\/li>\n<li>Use <code>apt-get install<\/code> to install the dependencies and the package<\/li>\n<\/ol>\n<p>Details as follows:<\/p>\n<p><strong>Add the source for the downgraded package the apt config<\/strong><br \/>\nIn this case, I needed to add the<br \/>\nI left my <code>\/etc\/apt\/sources.list<\/code> as-is and added the following to <code>\/etc\/apt\/sources.list.d\/vlc.list<\/code>:<\/p>\n<p><code>deb http:\/\/mirror.cc.columbia.edu\/debian\/ wheezy main non-free contrib<br \/>\ndeb-src http:\/\/mirror.cc.columbia.edu\/debian\/ wheezy main non-free contrib<\/p>\n<p>deb http:\/\/security.debian.org\/ wheezy\/updates main contrib non-free<br \/>\ndeb-src http:\/\/security.debian.org\/ wheezy\/updates main contrib non-free<\/p>\n<p>deb http:\/\/mirror.cc.columbia.edu\/debian\/ wheezy-updates main contrib non-free<br \/>\ndeb-src http:\/\/mirror.cc.columbia.edu\/debian\/ wheezy-updates main contrib non-free<\/code><\/p>\n<p>I used Columbia&#8217;s mirror because it&#8217;s fast and geographically nearer than most of the other mirrors. I&#8217;m sure not all of those sources were necessary (there are no security-related packages in VLC) but it didn&#8217;t hurt anything to include them.<\/p>\n<p><strong>Specify the target release in the apt config<\/strong><br \/>\nI added the following to <code>\/etc\/apt\/apt.conf.d\/80targetrelease<\/code> to specify that I want Jessie to be the target\/default release:<\/p>\n<p><code>APT::Default-Release \"jessie\";<\/code><\/p>\n<p><strong>Use &#8220;pinning&#8221; to tell apt to use the older versions for package and its dependencies<\/strong><br \/>\nI created the file <code>\/etc\/apt\/preferences.d\/vlc<\/code> containing the following. I added to the list of packages as <code>apt-get install<\/code> failed due to missing dependencies. The pin-priority 1001 was suggested by several sites to be used only in the case of downgrading a package.<\/p>\n<p><code>Package: vlc<br \/>\nPin: release n=wheezy<br \/>\nPin-Priority: 1001<\/p>\n<p>Package: vlc-data<br \/>\nPin: release n=wheezy<br \/>\nPin-Priority: 1001<\/p>\n<p>Package: vlc-nox<br \/>\nPin: release n=wheezy<br \/>\nPin-Priority: 1001<\/p>\n<p>Package: libvlc5<br \/>\nPin: release n=wheezy<br \/>\nPin-Priority: 1001<\/p>\n<p>Package: libvlccore5<br \/>\nPin: release n=wheezy<br \/>\nPin-Priority: 1001<\/p>\n<p>Package: vlc-plugin-notify<br \/>\nPin: release n=wheezy<br \/>\nPin-Priority: 1001<\/p>\n<p>Package: vlc-plugin-pulse<br \/>\nPin: release n=wheezy<br \/>\nPin-Priority: 1001<\/p>\n<p>Package: xdg-utils<br \/>\nPin: release n=wheezy<br \/>\nPin-Priority: 1001<\/code><\/p>\n<p><strong>Use apt-get install to install the dependencies and the package<\/strong><br \/>\nI started by trying to <code>apt-get install vlc<\/code> but it complained about missing dependencies. I added the dependencies to the preferences file as describe in the section above, and then was able to install the following packages from Debian Wheezy:<\/p>\n<p><code>apt-get install libvlccore5<br \/>\napt-get install vlc-data<br \/>\napt-get install libvlc5<br \/>\napt-get install vlc-nox<\/code><\/p>\n<p>Alternatively, I believe I could have skipped the preferences file and setting the pin-priorities by specifying the target Debian version when running apt-get install:<\/p>\n<p><code>apt-get install -t wheezy libvlccore5<br \/>\napt-get install -t wheezy vlc-data<br \/>\napt-get install -t wheezy libvlc5<br \/>\napt-get install -t wheezy vlc-nox<\/code><\/p>\n<p>However, I&#8217;m not sure that the desired package version would be preserved after running <code>apt-get dist-upgrade<\/code>.<\/p>\n<p><strong>References<\/strong><br \/>\nThe following sites were helpful to me while I was figuring out how to do this, and if you are interested in pin-priority and the different values to use in different scenarios, I definitely recommend the first link:<\/p>\n<ul>\n<li><a href=\"http:\/\/blog.opperschaap.net\/2009\/12\/12\/using-the-preferences-file-on-debian-and-debian-based-distributions\/\">Using the preferences file on Debian and Debian based distributions<\/a><\/li>\n<li><a href=\"http:\/\/blog.andrewbeacock.com\/2007\/03\/how-to-install-specific-version-of.html\">How to install a specific version of a Debian package using apt-get<\/a><\/li>\n<li><a href=\"http:\/\/askubuntu.com\/questions\/428772\/how-to-install-specific-version-of-some-package\/428778\">How to install specific version of some package?<\/a><\/li>\n<li><a href=\"http:\/\/unix.stackexchange.com\/questions\/107689\/how-to-install-a-single-jessie-package-on-wheezy\">How to install a single Jessie package on Wheezy?<\/a><\/li>\n<li><a href=\"https:\/\/wiki.debian.org\/AptPreferences\">Debian Wiki: AptPreferences<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>After I updated a Debian Wheezy server to Debian Jessie, I was having some problems with VLC. I was using the cvlc to capture and record video streams, but the capture would fail after 2 seconds. A colleague suggested that I leave the OS version alone, but downgrade VLC to confirm that the new version &hellip; <a href=\"https:\/\/osric.com\/chris\/accidental-developer\/2016\/02\/downgrading-a-debian-package\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Downgrading a Debian package<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[391,390,347,392],"class_list":["post-1374","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-apt","tag-apt-get","tag-debian","tag-pinning"],"_links":{"self":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/1374","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/comments?post=1374"}],"version-history":[{"count":7,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/1374\/revisions"}],"predecessor-version":[{"id":1381,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/1374\/revisions\/1381"}],"wp:attachment":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/media?parent=1374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/categories?post=1374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/tags?post=1374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}