Thursday, October 27, 2016

14.04 - Why does Software & Updates affects do-release-upgrade command in terminal?




I have a curious for me question referring to Update Manager and terminal command do-release-upgrade as a user I've noticed lots of people ask questions when they run:



do-release-upgrade -d


and it returns:



Checking for a new Ubuntu release
Get:1 Upgrade tool signature[198B]

Get:2 Upgrade tool[1,147kB]
Fetched 1,148 kB in 0s(0B/s)
authenticate 'utopic.tar.gz' against 'utopic.tar.gz.gpg'
extracting 'utopic.tar.gz'


but when you run:



do-release-upgrade -c



it returns:



Checking for a new Ubuntu release
No new release found


And if I go to Software & Updates --> Updates --> Notify me of a new Ubuntu version and set it to For any new version



do-release-upgrade -d



will return:



Checking for a new Ubuntu release
Get:1 Upgrade tool signature[198B]
Get:2 Upgrade tool[1,147kB]
Fetched 1,148 kB in 0s(0B/s)
authenticate 'utopic.tar.gz' against 'utopic.tar.gz.gpg'
extracting 'utopic.tar.gz'



and so will:



do-release-upgrade -c


will return:



Checking for a new Ubuntu release

New release '14.10' available.
Run 'do-release-upgrade' to upgrade to it.


And if I set it to Never both commands do-release-upgrade -d and do-release-upgrade -c will return:



Checking for a new Ubuntu release
No new release found



But in Software & Updates I set all other updates to Never notify me as I do dist-upgrade via terminal only and it works indeed it upgrades all available updates and security patches.





Why is then it doesn't work with do-release-upgrade? Shouldn't it do what I tell it to do despite what is set in Software & Updates? Or is it just designed this way?



Edit



A small edition to the question to clarify it a bit more, I don't want to receive graphical notifications about new available updates or releases or whatsoever, so in Software & Updates I set updates & notifications to Never because I'd like to do this via terminal and everything works except do-release-upgrade




The do-release-upgrade command, the Update Manager, the Software Sources program and the Software Centre all share a few common libraries and configuration files.



The particular aspect you are looking at (the next version of Ubuntu you wanted to be prompted for), is set in the file /etc/update-manager/release-upgrades.



You can edit it, and set the value of the Prompt option. Quoting the comments:



Default prompting behavior, valid options:

never - Never check for a new release.
normal - Check to see if a new release is available. If more than one new

release is found, the release upgrader will attempt to upgrade to
the release that immediately succeeds the currently-running
release.
lts - Check to see if a new LTS release is available. The upgrader
will attempt to upgrade to the first LTS release available after
the currently-running one. Note that this option should not be
used if the currently-running release is not itself an LTS
release, since in that case the upgrader won't be able to
determine if a newer release is available.



Both the GUI and the command line derive these settings (since eventually, they all end up using the Python class UpdateManager.Core.MetaRelease.MetaReleaseCore, in which:



 # some constants
CONF = "/etc/update-manager/release-upgrades"
CONF_METARELEASE = "/etc/update-manager/meta-release"


And




if parser.has_option("DEFAULT", "Prompt"):
type = parser.get("DEFAULT", "Prompt").lower()
if (type == "never" or type == "no"):
# nothing to do for this object
# FIXME: what about no longer supported?
self.downloaded.set()
return


So, this is how it has been coded, without any option to override the configuration file.




Therefore, if you want to disable the GUI notification, but be able to use do-release-upgrade, you will have to edit the configuration file. This can be done easily enough (replacing lts with normal, if you prefer):



sed -i.bak 's/^Prompt=.*$/Prompt=lts/' /etc/update-manager/release-upgrades
do-release-upgrade -c
sed -i.bak 's/^Prompt=.*$/Prompt=never/' /etc/update-manager/release-upgrades


Note that there seems to be a directory for extensible configuration (/etc/update-manager/release-upgrades.d), but it seems to be unused as of now.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...