o S(e¢‹ã@sìddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z ddl mZddlmZddlmZmZmZmZmZmZmZmZmZddlmZddlm Z dd l!m"Z"dd l#m$Z$dd l%m&Z&dd l'm'Z'dd l(m)Z)ddl(m*Z*e)j+e*_+ddl,m-Z-m.Z.ddl/m0Z0m1Z1ddl2m3Z4ddl2m5Z5ddl3Z3ddl#m6Z6m7Z7m8Z8ddl9m:Z:dZ;dd„ZGdd„de?ƒZ@eAdkrôddlBmBZBejCejDdeBƒZEe@eEƒZFeF G¡eF H¡dSdS)éN)Ú NoOptionError)Ú ConfigParseré)Úget) Úcountry_mirrorÚurl_downloadableÚcheck_and_fix_xbitÚget_archÚiptables_activeÚ inside_chrootÚ)get_string_with_no_auth_from_source_entryÚis_child_of_process_nameÚ inhibit_sleep)ÚTemplate)Úurlsplit)ÚStep)ÚMyCache)ÚDistUpgradeConfig)ÚDistUpgradeQuirks)Údistinfo)Ú sourceslist)Ú SourcesListÚ is_mirror)Ú get_distroÚNoDistroTemplateException)Úgettext)Úngettext)ÚCacheExceptionDpkgInterruptedÚCacheExceptionLockingFailedÚNotEnoughFreeSpaceError)Ú run_apportz/var/run/reboot-requiredcCs4gd¢}z| |¡WStyt|ƒdYSw)zB key() function for sorted to ensure "correct" component ordering )ÚmainÚ restrictedÚuniverseÚ multiverser)ÚindexÚ ValueErrorÚlen)ÚaÚordering©r*úC/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeController.pyÚcomponent_ordering_keyNs   ýr,c@s eZdZdS)ÚNoBackportsFoundExceptionN)Ú__name__Ú __module__Ú __qualname__r*r*r*r+r-Ysr-c@sŒeZdZdZdadd„Zdbdd„Zd d „Zd d „Zd d„Zdd„Z dd„Z dd„Z dd„Z dcdd„Z dd„Zdd„Zdd„Zdddd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Zd/d0„Zd1d2„Zd3d4„Zd5d6„Zd7d8„Zd9d:„Zd;d<„Zd=d>„Z d?d@„Z!dAdB„Z"dCdD„Z#dEdF„Z$dGdH„Z%dIdJ„Z&dKdL„Z'dedMdN„Z(dedOdP„Z)dQdR„Z*dSdT„Z+dUdV„Z,dWdX„Z-dYdZ„Z.d[d\„Z/d]d^„Z0d_d`„Z1dS)fÚDistUpgradeControllerz3 this is the controller that does most of the work NcCsŽd}|dks |dkrt ¡}tj |d¡}||_||_t d|¡t d¡t   d|j j ¡||_ |j  tdƒ¡d|_d|_|jrI|jjdkrMd|_n|jj|_t|ƒ|_d|j dd ¡|_|j d ¡|j d d t|jƒ¡|j d d d ¡|jr‰|jjr‰|j d d d¡|j dd¡|_|j dd¡|_|j dd¡|_tƒ|_ dtj!vr¶t   d¡t"j dd¡d|_#t$||jƒ|_%t&ƒ|_'dtj!d<dtj!d<dt ¡dtj!dftj!d<t(dƒ|j )dd ¡}t"j d!t|ƒ¡t"j d"td#ƒ¡t"j d$td%ƒ¡t"j d&d'¡t"j d(d'¡t"j d)d*¡|j *d+d,¡|_+|j ,dd-¡|_-g|_.|j /d.¡r?d/d0„|j 0d.¡Dƒ|_.d1|_1d|_2dS)2Nz/usr/share/locale/Ú.Úmoúubuntu-release-upgraderzUsing '%s' viewz Reading cacheTÚFilesÚ BackupExtÚOptionsÚ withNetworkÚ devReleaseÚFalseÚTrueÚSourcesÚFromÚToÚ ValidOriginÚ"RELEASE_UPGRADE_NO_FORCE_OVERWRITEzenable dpkg --force-overwritezDPkg::Options::z--force-overwriteFÚ1ÚRELEASE_UPGRADE_IN_PROGRESSÚPYCENTRAL_FORCE_OVERWRITEz%s:%sz /importedÚPATHz./imported/invoke-rc.dÚNetworkÚ MaxRetrieszAcquire::Retriesz Dpkg::MaxArgsizDpkg::MaxArgBytesizAcquire::http::TimeoutÚ20zAcquire::ftp::TimeoutzApt::Get::List-CleanupÚfalseÚDistroÚForcedObsoletesÚ ValidMirrorsÚThirdPartyMirrorscSsg|]}|d‘qS)rr*)Ú.0Úpairr*r*r+Ú ¸sz2DistUpgradeController.__init__..ií)3ÚosÚgetcwdÚpathÚjoinÚdatadirÚoptionsrÚbindtextdomainÚ textdomainÚloggingÚdebugÚ __class__r.Ú_viewÚ updateStatusÚ_ÚcacheÚfetcherr8Ú useNetworkrÚconfigrÚsources_backup_extÚ add_sectionÚsetÚstrÚ devel_releaseÚfromDistÚtoDistÚoriginr ÚarchÚenvironÚapt_pkgÚ_partialUpgraderÚquirksrÚ inhibitor_fdrÚgetintÚgetlistÚforced_obsoletesÚgetListFromFileÚ valid_mirrorsÚvalid_3p_mirrorsÚ has_sectionÚitemsÚ_aptCronJobPermsÚ _session_bus)ÚselfÚdistUpgradeViewrUrTÚ localedirÚ maxRetriesr*r*r+Ú__init__`sp           ÿ ÿ zDistUpgradeController.__init__TFc Csât d¡|jdur|j d¡n |j ¡|j ¡d}d} z| |¡WStyo}z=|d7}|j   ¡t   d¡t d|¡||kret  d |¡|j   td ƒtd ƒ¡|r`| ¡nt d¡WYd}~nd}~wwq ) Nz openCache()Ú PreCacheOpenérTrçš™™™™™¹?z'failed to lock the cache, retrying (%i)zCache can not be locked (%s)zUnable to get exclusive lockzThis usually means that another package management application (like apt-get or aptitude) already running. Please close that application first.)rXrYr^rnÚrunÚ release_lockÚunlock_lists_dirÚ _openCacherr[Ú processEventsÚtimeÚsleepÚerrorr]ÚabortÚsysÚexit)rzÚlockÚrestore_sources_list_on_failÚMAX_LOCK_RETRIESÚ lock_retryÚer*r*r+Ú openCacheÂs8       ÿ ÿ  €íüzDistUpgradeController.openCachec Cs¸zt|j|j|j|j ¡|ƒ|_|j|_Wn5tyJt  d¡gd¢}t j   d¡dkr2|  d¡|j ¡ |¡t|j|j|j|j ¡ƒ|_Ynw|j|j_t dt|jƒ¡dS)Nz-dpkg interrupted, calling dpkg --configure -a©ú /usr/bin/dpkgz --configurez-aÚDEBIAN_FRONTENDÚnoninteractiveú--force-confoldz/openCache(), new cache size %i)rrar[rnÚgetOpCacheProgressr^Ú apt_cacherrXÚwarningrPrkrÚappendÚ getTerminalÚcallrmÚpartialUpgraderYr')rzrÚcmdr*r*r+r…ås,ü     ýú z DistUpgradeController._openCachecCs$|j dd¡}|jjj|vrdSdS)z¹ Returns True if this view support upgrades over ssh. In theory all views should support it, but for savety we do only allow text ssh upgrades (see LP: #322482) ÚViewÚ SupportSSHTF)rarqr[rZr.)rzÚ supportedr*r*r+Ú_viewSupportsSSHýsz&DistUpgradeController._viewSupportsSSHcCsútj d¡}tj |¡s{tj d¡r{tdƒr{| ¡s1t d¡|j  t dƒt dƒ¡t   d¡dSd }|j   t d ƒt d ƒ|¡}|dkrIt   d¡t d d d|dt|ƒg¡}|dkr{t dƒ}t dƒ|}tƒrtd|}|t dƒ|7}|j  ||¡dS)zß this will check for server mode and if we run over ssh. if this is the case, we will ask and spawn a additional daemon (to be sure we have a spare one around in case of trouble) z"/var/run/release-upgrader-sshd.pidz/procÚsshdzupgrade over ssh not allowedz.Upgrading over remote connection not supportedzÓYou are running the upgrade over a remote ssh connection with a frontend that does not support this. Please try a text mode upgrade with 'do-release-upgrade'. The upgrade will abort now. Please try without ssh.rFiþzContinue running under SSH?aThis session appears to be running under ssh. It is not recommended to perform a upgrade over ssh currently because in case of failure it is harder to recover. If you continue, an additional ssh daemon will be started at port '%s'. Do you want to continue?z/usr/sbin/sshdz-oz PidFile=%sz-przStarting additional sshdz¶To make recovery in case of failure easier, an additional sshd will be started on port '%s'. If anything goes wrong with the running ssh you can still connect to the additional one. z-iptables -I INPUT -p tcp --dport %s -j ACCEPTz¦If you run a firewall, you may need to temporarily open this port. As this is potentially dangerous it's not done automatically. You can open the port with e.g.: '%s'T)rPrRrSÚexistsÚisdirr r£rXr‰r[r]r‹rŒÚaskYesNoQuestionÚ subprocessrrer Ú information)rzÚpidfileÚportÚresÚsummaryÚdescrrŸr*r*r+Ú _sshMagicsP   ÿþ  ÿ úþ þüÿüzDistUpgradeController._sshMagiccCsÄddlm}ddlm}d}|jdks"|jdks"|jdks"|jdkr$d }|d|d }|j ¡|j d ¡s@|j ¡|j d ¡r5|jd urLt   d ¡dS|j  ¡}||j||j |jd}|  ¡d S)zž this is a helper that is run if we are started from a CD and we have network - we will then try to fetch a update of ourself r)ÚMetaReleaseCore)ÚDistUpgradeFetcherSelfFÚdapperÚhardyÚlucidÚpreciseT)ÚuseDevelopmentReleaseÚforceLTSrNzNo new dist found)Únew_distÚprogressrUÚview)Ú MetaReleaser°r±Úreleaser[r†Ú downloadedÚwaitr¸rXr‰ÚgetAcquireProgressrUr‚)rzr°r±r·Úmr¹r_r*r*r+Ú_tryUpdateSelfCs2      ÿ    ÿ   ý z$DistUpgradeController._tryUpdateSelfc Cs0t d¡dg}|D]‹\}}d|}tj |¡r•tƒ}t|ƒ }| |¡Wdƒn1s/wYz| dd¡}Wnt yPt d||f¡YdSwz tj  d |¡}Wnt yv} zt  d | ¡WYd} ~ dSd} ~ ww||tj  d |¡fvr•t d |||tj  d |¡f¡dSq d S)zº check that /usr/bin/python3 points to the default python version. Users tend to modify this symlink, which breaks stuff in obscure ways (Ubuntu #75557). z_pythonSymlinkCheck run)Úpython3rÂz/usr/share/%s/debian_defaultsNÚDEFAULTzdefault-versionz'no default version for %s found in '%s'Fz /usr/bin/%szos.path.realpath failed (%s)z/usr/binz8%s symlink points to: '%s', but expected is '%s' or '%s'T)rXrYrPrRr¥ÚSafeConfigParserÚopenÚreadfprrÚrealpathÚOSErrorr‰rS) rzÚbinaries_and_dirnamesÚbinaryÚdirnameÚdebian_defaultsraÚfÚexpected_defaultÚfs_default_versionr‘r*r*r+Ú_pythonSymlinkCheckbs>     ÿ ÿý€þÿ€z)DistUpgradeController._pythonSymlinkCheckc Csxtjgd¢tjdd ¡d ¡|_}t d|¡||jksD||j ksDt  d||jf¡|j   t dƒt d||j fƒ¡t  d ¡|jrž|jjržt ¡d }t d |¡t d t |d ¡¡tj |d¡rutj d|d¡tj |d¡r†tj d|d¡|d}tj |¡ržt d|¡t tj|¡| ¡| ¡s»t  d¡|j   t dƒt dƒ¡t  d ¡z| ¡WntyÛ}zt  d|¡WYd}~dSd}~ww|j  |j ¡sådS|j !¡|_"|j"rôdtj#d<ndtj#d<| $¡st  d¡dSd dl%m&}|D],}tj |¡r8t '|tj(¡s8t  d|¡|j   t dƒ|t d ƒ|¡| )¡q dS)!z= initial cache opening, coherence checking, network checking )Ú lsb_releasez-cz-sT)ÚstdoutÚuniversal_newlinesrzlsb-release: '%s'zBad upgrade: '%s' != '%s' zCan not upgradez=An upgrade from '%s' to '%s' is not supported with this tool.rz /backportszusing backports in '%s' zhave: %sz/*.udebr”zDir::Bin::dpkgz/usr/lib/apt/methodszDir::Bin::methodsz/etc/apt/apt.conf.d/01ubuntuzadding config '%s'z%pythonSymlinkCheck() failed, abortingzMYour python3 install is corrupted. Please fix the '/usr/bin/python3' symlink.zopenCache() failed: '%s'NFÚserverÚRELEASE_UPGRADE_MODEÚdesktopzcheckViewDepends() failed)Ú SYSTEM_DIRSz%s not writablezCan not write to '%s'zœIts not possible to write to the system directory '%s' on your system. The upgrade can not continue. Please make sure that the system directory is writable.)*r¨ÚPopenÚPIPEÚ communicateÚstripr¼rXrYrgrhr‰r[r]r‹rŒrUÚhavePrerequistsrPrQÚinfoÚglobrRr¥rlrardÚread_config_filer¯rÐr’Ú SystemErrorr^Úcoherence_checkÚneed_server_modeÚ serverModerkÚcheckViewDependsÚDistUpgradeMainr×ÚaccessÚW_OKrŠ)rzr¼Ú backportsdirÚconfr‘r×Ú systemdirr*r*r+Úprepares‚ þþþ ÿÿ     ÿ  €þ       üþ€zDistUpgradeController.preparecCs>t d|¡|jst d¡dSd|j|jf}t|tjƒS)zf helper that checks if a sources.list entry points to something downloadable zverifySourcesListEntry: %sz(skipping downloadable check (no network)Tz%s/dists/%s/Release)rXrYr`ÚuriÚdistr)rzÚentryrìr*r*r+Ú_sourcesListEntryDownloadableÊs   z3DistUpgradeController._sourcesListEntryDownloadablec sª |rt d¡nt d¡ˆj dd¡}ˆj ddd¡s!dtjvr(t d¡d}d}|d krëˆjrët ˆj d d ¡¡ˆj d d ¡D]¨}t d |¡|ˆj vs~ˆj |j r~t ˆj |j j ƒd ks~ˆj |j rêt ˆj |j j ƒdkrêˆj |j j d j dkrêt d|¡ztƒ}| ˆj¡| d¡d }t d¡WnKtyç}z?t d|¡t d¡d}ddg}d} ˆj d| ˆj||¡ˆj d| ˆjd||¡ˆj ddˆjd||¡WYd}~nd}~wwnqBˆj dd¡} ˆjg‡fdd„| Dƒ} ˆjg‡fdd„| Dƒ} dˆ_g} ˆjjdd…D]F}d |jvr#q|j d!¡r,q|j d"¡r5qd#|jvsW|j d$¡sW|j d%¡sW|j d&¡sW|j d'¡rYq|  |¡q| ˆj_d}iˆ_i}ˆjjdd…D]ý}|j|vrd(||j<|js‰|jr‹qs|j d)¡r¥|j ˆjkr¥t d*|¡d |_qs|j d)¡rÑt!j "d+¡}tj# $d,|t! %|j¡d-|j d.f¡sÏt d/|¡d |_qsd0ˆj}|jsø|j d1¡rø|j |krøˆj|_ d2g|_&t d3|¡qs|js|j d4ˆj¡rt d5¡d |_qs|jsDˆj'rDˆj'j(d krDd6ˆj|j vrDt d7¡d6ˆj|_ |j)t*d8ƒˆj7_)d |_qs|js‡d9|jvr‡t d:¡d;t+ƒdfD],} t, ,|¡}| |_ˆj|_ ˆ -|¡r…t .d<| ¡| |_|j|vrƒd=||j<nqZt d>t/|ƒ¡ˆ 0|j¡}| pŸˆ 1|j¡}|s¦|rÀd }|jsÐ|j2d?ksÐd@|jvsÐdAˆj|j vsÐdBˆj|j vsÐd#|jvrÒd}|j | vræt dCt/|ƒ¡||O}nu|j | vrA||jd(kr||O}t, ,|¡}ˆj|_ ˆ -|¡s dD||j<nd=||j<||jdDkr*d |_d ˆ_t dEt/|ƒ¡n1||O}| |  3|j ¡|_ t dFt/|ƒ¡n|j2d?krIqs|r[d |_d ˆ_t dGt/|ƒ¡|j2dkr~dH|jvsmdI|jvr~ˆj4dJvr~t dKˆj4¡dL|_dMˆjdNˆjdAˆjfD]1}ˆj 5|t6ƒ¡|js¼|j |kr¼|j2dkr¼|j&D]}||vr²q©ˆj| |¡q©qŒqs|j ˆjkrˈj|_ dOt*dPƒˆj}t7|j)t8ƒræ|j)| 9dQ¡7_)n|j)|7_)d |_d ˆ_t dRt/|ƒ¡|rp|j | vr| |  3|j ¡|_ |j | vrqsdMˆjdNˆjdAˆjfD]-}ˆj 5|t6ƒ¡|j |krP|j2dkrP|j&D]}||vrFq=ˆj| |¡q=q$t dS|j2|j |j&f¡d} d}ˆj |j2| |j |j&|¡qsˆjjdd…D]X}|js˜|js˜|j2d?ks˜|j d)¡s˜|j ˆjkršqz|j ˆjvrшjˆjˆj|j }|rÑt .dTt/|ƒ¡|j& :t;|t.crúrû)rhrürþr*r+rOrÿz/extras.ubuntu.comzE## This software is not part of Ubuntu, but is offered by third-partyz5## developers who want to ship their latest software.z/archive.canonical.comzE## Uncomment the following two lines to add software from Canonical'sz## 'partner' repository.zK## This software is not part of Ubuntu, but is offered by Canonical and thez2## respective vendors as a service to Ubuntu usersÚunknownzcdrom:z,disabled '%s' cdrom entry (dist == fromDist)zDir::State::listsz %s/%s%s_%s_%sÚdistsÚReleasez:disabling cdrom source '%s' because it has no Release filez %s-commercialzhttp://archive.canonical.comÚpartnerz transitioned commercial to '%s' z*http://landscape.canonical.com/packages/%sz&commenting landscape.canonical.com outz %s-proposedz2upgrade to development release, disabling proposedz5Not for humans during development stage of release %szold-releases.ubuntu.com/z-upgrade from old-releases.ubuntu.com detectedz"http://%sarchive.ubuntu.com/ubuntuz%transition from old-release.u.c to %sÚpassedzexamining: '%s'zdeb-srcz/security.ubuntu.comz %s-securityz %s-backportsz%entry '%s' is already set to new distÚfailedz)entry '%s' was disabled (no Release file)zentry '%s' updated to new distz&entry '%s' was disabled (unknown dist)zarchive.ubuntu.comzsecurity.ubuntu.com)Úamd64Úi386z-moving %s source entry to 'ports.ubuntu.com' z%http://ports.ubuntu.com/ubuntu-ports/ú%sú %s-updatesú zdisabled on upgrade to %szUTF-8z(entry '%s' was disabled (unknown mirror)zAdding entry: %s %s %sz)fixing components inconsistency from '%s')Úkeyzto new entry '%s')=rXrYrarqÚgetWithDefaultrPrkršr`r^Ú candidater'ÚoriginsÚarchiverÚ get_sourcesÚsourcesÚenable_componentrÚ exceptionÚaddrhrgÚsources_disabledÚlistrìÚlineÚ startswithr›Úfound_componentsÚinvalidÚdisabledrírlÚfind_dirrRr¥Úuri_to_filenameÚcompsrUrfÚcommentr]rÚcopyrïrÝr ÚisMirrorÚisThirdPartyMirrorÚtyper%rjÚ setdefaultrdÚ isinstanceÚbytesÚencodeÚextendÚsortedr,)rzÚ mirror_checkÚsync_componentsÚmain_was_missingÚpkgnameÚdistror‘rrrìÚpocketsÚ fromDistsÚtoDistsÚnew_listrîÚ foundToDistÚentry_uri_test_resultsÚlistdirÚcdistÚ test_entryÚ validMirrorÚthirdPartyMirrorÚvalidToÚdÚcompÚdisable_commentÚcomponent_diffr*rþr+ÚrewriteSourcesListØsþ      ÿ þ   ÿÿ ý€ó€ÿÿ ÿÿ ÿÿÿýÿûÿù     üÿ  ÿ ÿ     ÿ    û                 þ   €ô  þ  €€ ÿ ÿ €z(DistUpgradeController.rewriteSourcesListcst d¡tˆjdˆ_ˆj ˆj¡t‡fdd„ˆjDƒƒs3ˆj  t dƒt dƒˆj ¡}|s3ˆ  ¡ˆj dds¬t d ¡ˆj  t d ƒt d ƒˆj ˆjf¡}|r¨tˆjdˆ_ˆj d ds§ˆjr§t d ƒ}t d ƒˆj ˆjf}ˆj  ||¡szˆ  ¡t d¡d}ddg}ˆj d|ˆj|¡ˆj d|ˆjd|¡ˆj ddˆjd|¡nˆ  ¡ˆj ¡z t ¡}| ¡Wn:tyõt d¡tj d¡râˆj t dƒt dƒ¡t ddg¡Yd Sˆj t dƒt dƒ¡t d¡Yd Swˆjrˆj t dƒt dƒ¡tƒ  ˆj¡dS) NzupdateSourcesList()©Ú matcherPathc3s&|]}|jdko|jˆjkVqdS)röN)r#rírg)rMr‘rþr*r+Ú ó€$z:DistUpgradeController.updateSourcesList..z!No valid sources.list entry foundzŒWhile scanning your repository information no entry about %s could be found. An upgrade might not succeed. Do you want to continue anyway?T)r*zNo valid mirror foundaWWhile scanning your repository information no mirror entry for the upgrade was found. This can happen if you run an internal mirror or if the mirror information is out of date. Do you want to rewrite your 'sources.list' file anyway? If you choose 'Yes' here it will update all '%s' to '%s' entries. If you select 'No' the upgrade will cancel.FzGenerate default sources?zAfter scanning your 'sources.list' no valid entry for '%s' was found. Should default entries for '%s' be added? If you select 'No', the upgrade will cancel.z"Generated new default sources.listrõr!r"rör÷z"http://security.ubuntu.com/ubuntu/røz.z'UEFI system, but no UEFI grub installedFz /proc/mountsz-line '%s' in /proc/mounts not understood (%s)Nz /boot/efiÚrwú,zFound writable ESP %sz%EFI System Partition (ESP) not usablezxYour EFI System Partition (ESP) is not mounted at /boot/efi. Please ensure that it is properly configured and try again.zzThe EFI System Partition (ESP) mounted at /boot/efi is not writable. Please mount this partition read-write and try again.) rPrRr¥rXrYrIrÅrÛÚsplitr&r[r‰r]) rzÚ bootloadersÚmountedÚmountsrÚwhatÚwhereÚfsrUr(Úbr‘r*rþr+Ú _checkBootEfiÝsJ     €þ ðóÿ ÿ üÿz#DistUpgradeController._checkBootEficCs8tdƒ}tdƒ}tdƒ}tdƒ}tdƒ}tdƒ}tdƒ}|j dd d ¡r+t d ¡d S| ¡}z |j |¡Wd Sty›} zWt j  d ¡} d} | |d|d|d|d|d|i} | j D]/} | dkrc| d7} | j | vrz| |j | j| j | j| | j d7} qY| |j | j| j | jdd7} qY|j || ¡WYd} ~ d Sd} ~ ww)z: this checks if we have enough free space on /var and /usrzNot enough free disk spacez¼The upgrade has aborted. The upgrade needs a total of {str_total} free space on disk '{str_dir}'. Please free at least an additional {str_needed} of disk space on '{str_dir}'. {str_remedy}zIRemove temporary packages of former installations using 'sudo apt clean'.z¦You can remove old kernels using 'sudo apt autoremove' and you could also set COMPRESS=xz in /etc/initramfs-tools/initramfs.conf to reduce the size of your initramfs.zbEmpty your trash and remove temporary packages of former installations using 'sudo apt-get clean'.z!Reboot to clean up files in /tmp.rqÚ FreeSpaceÚ SkipCheckFz,free space check skipped via config overrideTúDir::Cache::archivesz/varz/bootú/z/tmpz/usrr )Ú str_totalÚstr_dirÚ str_neededÚ str_remedyN)r]rar rXršÚ _is_apt_btrfs_snapshot_supportedr^ÚcheckFreeSpacerrlrÚfree_space_required_listÚdirÚformatÚ size_totalÚ size_neededr[r‰)rzÚerr_sumÚerr_msgÚremedy_archivedirÚ remedy_bootÚ remedy_rootÚ remedy_tmpÚ remedy_usrÚwith_snapshotsr‘Ú archivedirÚerr_longÚremedyÚreqr*r*r+Ú_checkFreeSpace sP ç û   þ þ€èz%DistUpgradeController._checkFreeSpacecCsì|j tdƒ¡|j |j|j|j¡sdS|jr!|j |j¡s!dS|j  ¡}|j  ¡|  ¡|j  ¡|  ¡s:dS|  ¡s@dS|j  ¡|j ¡|_t|jƒdkro|j ¡t dd dd„|jDƒ¡¡t d|j¡|j  ¡|S) NúCalculating the changesFrz demoted: '%s'r cSóg|]}|j‘qSr*©rSrür*r*r+rOeóz9DistUpgradeController.calcDistUpgrade..zfound components: %s)r[r\r]r^Ú distUpgraderãrmÚ installTasksrmÚ get_changesr†r_r£r‡Úget_installed_demoted_packagesÚinstalled_demotionsr'ÚsortrXrYrSr)rzÚchangesr*r*r+ÚcalcDistUpgradeFs,        z%DistUpgradeController.calcDistUpgradecCs0| ¡}|sdS|j tdƒ||j|jj¡}|S)NFz!Do you want to start the upgrade?)r¯r[ÚconfirmChangesr]r¬r^Úrequired_download)rzr®r¬r*r*r+ÚaskDistUpgradels ýz$DistUpgradeController.askDistUpgradecCs t ¡}| |j¡otj d¡S)Nz2/var/snap/canonical-livepatch/common/machine-token)Ú distro_infoÚUbuntuDistroInfoÚis_ltsrgrPrRÚisfile)rzÚdir*r*r+Ú_isLivepatchEnabledysz)DistUpgradeController._isLivepatchEnabledcsZt ¡}ˆ ¡r| ˆj¡rdSt‡fdd„| d¡Dƒˆjƒ}ˆj dt dƒ|¡}|S)NTc3s"|] }|jˆjkr|jVqdSr{)ÚseriesrhÚversion)rMÚrrþr*r+rBƒs€ z5DistUpgradeController.askLivepatch..ÚobjectzdLivepatch security updates are not available for Ubuntu %s. If you upgrade, Livepatch will turn off.) r³r´r¸rµrhÚnextÚget_allr[ÚaskCancelContinueQuestionr])rzr·rºr¬r*rþr+Ú askLivepatch}s ÿÿz"DistUpgradeController.askLivepatchcCs4tj d¡rt dt|jƒ¡t dd¡dSdS)Nú/etc/cron.daily/aptzdisabling apt cron job (%s)i¤)rPrRr¥rXrYÚoctrxÚchmodrþr*r*r+Ú_disableAptCronJob‹s ýz(DistUpgradeController._disableAptCronJobcCs,tj d¡rt d¡t d|j¡dSdS)NrÁzenabling apt cron job)rPrRr¥rXrYrÃrxrþr*r*r+Ú_enableAptCronJobs  þz'DistUpgradeController._enableAptCronJobc Cs”| ¡d}|j ¡}|j ddd¡}|r:z t ¡d d¡d}Wn t  d¡d}Y|j  ¡  d||f¡|j  dd ¡}d }d}||krŸzt  |jj¡}t  |¡|_|j |j|¡Wd Stjjy~} zt d ¡d }| }WYd} ~ n%d} ~ wtyž} zt d | |f¡|d7}| }WYd} ~ qEd} ~ ww|r­|j tdƒtdƒ¡nt d¡|j tdƒtdƒd|¡| ¡| ¡dS)NrrIÚ SlideshowUrlr]ÚgetdefaultlocaleÚenz %s#locale=%srErFFz user canceledTú:IOError in cache.commit(): '%s'. Retrying (currentTry: %s)rzUpgrade canceledzwThe upgrade will cancel now and the original system state will be restored. You can resume the upgrade at a later time.ú+giving up on fetching after maximum retriesúCould not download the upgradeszThe upgrade has aborted. Please check your Internet connection or installation media and try again. All files downloaded so far have been kept.r)rÄr[r¿rar ÚlocalerÇrrXrÚ getHtmlViewrÅrprlÚPackageManagerr^Ú _depcacheÚAcquirer_Ú_fetch_archivesÚaptÚFetchCancelledExceptionrÝrtr‰r©r]rÅrŠ) rzrwÚ fprogressÚurlÚlangr}Ú user_canceledrÚpmr‘r*r*r+ÚdoDistUpgradeFetching•sX    õ  € €û ÿ  û z+DistUpgradeController.doDistUpgradeFetchingcCs`zddl}Wn tyYdSwz | ¡}| ¡}Wn t d¡YdSt d|¡|S)z' check if apt-btrfs-snapshot is usable rNzfailed to check btrfs supportFz!apt btrfs snapshots supported: %s)Úapt_btrfs_snapshotÚ ImportErrorÚAptBtrfsSnapshotÚsnapshots_supportedrXrrY)rzrÚÚ apt_btrfsr¬r*r*r+rßs  ÿ  z6DistUpgradeController._is_apt_btrfs_snapshot_supportedcCsF| ¡sdSddl}| ¡}d|j}| |¡}t d||f¡dS)z2 create btrfs snapshot (if btrfs layout is there) Nrzrelease-upgrade-%s-z#creating snapshot '%s' (success=%s))rrÚrÜrhÚcreate_btrfs_root_snapshotrXrÝ)rzrÚrÞÚprefixr¬r*r*r+Ú _maybe_create_apt_btrfs_snapshotîs  z6DistUpgradeController._maybe_create_apt_btrfs_snapshotc Cs¢i}tjdg|d<dtjd<dD]}tj |¡||d<tj |¡qz| ¡W|D]}||D] }tj ||¡q1q+S|D]}||D] }tj ||¡qEq?w)Nzdir::bin::dpkgz /bin/true)zdpkg::pre-invokezdpkg::pre-install-pkgszdpkg::post-invokezdpkg::post-install-pkgsz::)rlraÚ value_listÚclearÚ doDistUpgraderd)rzÚbackupsÚlstÚitemr*r*r+ÚdoDistUpgradeSimulationøs"  ÿ ÿ ÿÿz-DistUpgradeController.doDistUpgradeSimulationc Csàd}|j ¡}|j |j¡}|j dd¡}|js"|j d¡|  ¡d}d}||krWz|j  ||¡}t   d|¡Wnt yí}z¥t  d|¡|}tj d¡rªtdƒ }| ¡}Wdƒn1sfwYt  d |¡d d g} | D]1} t|ƒ | ¡r©t   d ¡| ¡td ƒ} | dt|ƒ7} | tdƒ7} |j tdƒ| ¡| ¡qxtdƒ} |js¼tƒs¼| td|ƒ7} |j tdƒ| ¡gd¢} tj d¡dkrÖ|  d¡|j ¡ | ¡| ¡WYd}~dSd}~wty}zt  d||f¡|d7}|}WYd}~q&d}~wt yP}z6t  !d¡|}|j"dkrF| ¡td ƒ} | dt|ƒ7} | tdƒ7} |j tdƒ| ¡| ¡WYd}~nd}~ww| ¡dSt  d¡|j tdƒtdƒd|¡| ¡dS) NrrErFÚ StartUpgradeFzcache.commit() returned %sz#SystemError from cache.commit(): %sz./var/run/ubuntu-release-upgrader-apt-exceptionzfound exception: '%s'z;E:Internal Error, Could not perform immediate configurationz E:Couldn't configure pre-depend z-detected preconfigure error, restorting stateúError during commitz '%s' úRestoring original system statezCould not install the upgradeszrThe upgrade has aborted. Your system could be in an unusable state. A recovery will run now (dpkg --configure -a).z· Please report this bug in a browser at http://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+filebug and attach the files in /var/log/dist-upgrade/ to the bug report. %sr“r•r–r—rÉrzcache.commit()é TrÊrËzdThe upgrade has aborted. Please check your Internet connection or installation media and try again. r)#r[r¿ÚgetInstallProgressr^rarprmrnr‚ráÚcommitrXrYràr‰rPrRr¥rÅÚreadrerrÅr]rŠr rkrr›rœrrtrÈrÚerrno) rzrwrÔÚ iprogressr}r¬rr‘rÍÚpre_configure_errorsÚ preconf_errorÚmsgrŸr*r*r+räs”      ÿþ  €ü € €   €ô  ü z#DistUpgradeController.doDistUpgradec Cs²tƒ d¡tj tj d¡¡}|jj D]!}tj tj  |j ¡¡|kr5zt  |j ¡Wqt y4Yqwq| ¡|j d¡|j tj¡|j tdƒ¡|j ¡}|j |j|j|j¡}t dd t |ƒ¡¡t dd t |ƒ¡¡|j !dd ¡D]}||vrt "d |¡t#ƒ}nq~|j $dd d ¡s t d ¡d S|j !dd¡D]}||jvr¿|j|j%r¿|j& '|j !|d¡¡q§t d|j&¡|j(rÑ||j)}n t#dd„|j*Dƒƒ}|t#|j&ƒO}|j +¡}t dd |¡¡|t#|ƒO}|j $dd d ¡st d¡t#ƒ}t d|¡t d¡|j ,¡}t-|ƒD]/\} } | .| t/t0|ƒƒd¡| |j1vrK|j 2¡|j 3| ||j&|j1¡sKt d| ¡qt d¡| 4¡|j 5¡} t dd dd„| Dƒ¡¡tdƒ} tdƒtdƒg} t0| ƒdkrÉ|j 6| | gd| d ¡rÉ|j 7¡}|j 8|j¡}z |j 9||¡Wn*t:t;fyÈ}zt "d!|¡|j "td"ƒtd#ƒd$|¡WYd}~nd}~ww|j d%¡|j<s×| =¡d S)&NÚ POSTUPGRADErŠÚ PostUpgradezSearching for obsolete softwarerer rdrIrózXthe BaseMetaPkg '%s' is in the obsolete list, something is wrong, ignoring the obsoletesÚRemoveObsoletesTzSkipping obsolete RemovalrbrJzforced_obsoletes: %scSr¥r*r¦)rMÚpr*r*r+rO¨r§z7DistUpgradeController.doPostUpgrade..zUnused dependencies: %sz0Skipping RemoveObsoletes as stated in the configzremove_candidates: '%s'z Start checking for obsolete pkgsgY@z:'%s' scheduled for remove but not safe to remove, skippingz!Finish checking for obsolete pkgsz1The following packages are marked for removal: %scSr¥r*r¦)rMr^r*r*r+rOÂr§zRemove obsolete packages?Ú_KeepÚ_RemoverFz,cache.commit() in doPostUpgrade() failed: %srêz[A problem occurred during the clean-up. Please see the below message for more information. rÚ PostCleanup)>rMÚ add_stagerPrRrËrlrarr_rwÚabspathÚdestfileÚunlinkrÈr’rnr‚r[ÚsetSteprÚCLEANUPr\r]r^rhrjrirgrhrXrYrSr)rqr‰rdr rVrrr(r`rir¬Ú_getUnusedDependenciesr˜Ú enumeratersÚfloatr'rkr†ÚtryMarkObsoleteForRemovalÚdonerªr°r¿rírîràrtrmÚrunPostInstallScripts)rzrŸrçÚ now_obsoleteÚ now_foreignr^Úremove_candidatesÚunused_dependenciesr¹Úir-r®r­ÚactionsrÔrñr‘r*r*r+Ú doPostUpgradensž  ÿ  ÿý  ý €         €  ÿ  ü€þ z#DistUpgradeController.doPostUpgradec CsÈ|jr |j ¡|j ¡|j dd¡D]C}tj |¡s$t  d|¡qt  d|¡zt |ƒ|j   ¡j|gddWqtyW}zt d||f¡WYd}~qd}~ww|jrb|j ¡dSdS) zý scripts that are run in any case after the distupgrade finished whether or not it was successful Cache lock is released during script runs in the event that the PostInstallScripts require apt or dpkg changes. rIÚPostInstallScriptsz!PostInstallScript: '%s' not foundzRunning PostInstallScript: '%s'T)Úhiddenz(got error from PostInstallScript %s (%s)N)r^rƒr„rarqrPrRr¥rXršrYrr[rœrÚ Exceptionr‰Úget_lock)rzÚscriptr‘r*r*r+rÜs$   €ÿÿz+DistUpgradeController.runPostInstallScriptscCsRt d¡t|dƒr|j |j¡|j tdƒ¡|j  ¡|  ¡t   d¡dS)z2 abort the upgrade, cleanup (as much as possible) z abort calledrrërN) rXrYÚhasattrrÚrestore_backuprbr[r\r]rŠr’r‹rŒrþr*r*r+rŠös   zDistUpgradeController.abortc Cs¬t |¡D]G}t d|¡|D];}|d}|d}|d}||jvr.t d|¡dS|j|}t|jddƒ}|dkrKt |||¡d krKd Sqqt d |¡dS) z+ check if a given depends can be satisfied zchecking: '%s' rréz_checkDep: '%s' not in cacheFrºNTzdepends '%s' is not satisfied) rlÚ parse_dependsrXrYr^r‰ÚgetattrÚ installedÚ check_dep) rzÚdepstrÚor_groupÚdepÚdepnameÚverÚoperrYÚinstverr*r*r+Ú _checkDeps$  €õ zDistUpgradeController._checkDepcCs†t d¡d}|j dd¡}| |j |jjjd¡¡|D]#}t d|¡|| |¡M}|s@|j  t dƒt d|ƒ¡t   d¡q|S) z check if depends are satisfied zcheckViewDepends()Tr ÚDependsz depends: '%s'z!Required depends is not installedz/The required dependency '%s' is not installed. r) rXrYrarqr(r[rZr.r"r‰r]r‹rŒ)rzr¬Údependsrr*r*r+räs$ ÿ  ÿÿ €z&DistUpgradeController.checkViewDependscCsÐ|j dd¡}d}tj dd¡}|j dd¡}||krT|jdd | ¡|D]}||jvr9t  d |¡t |ƒ‚q'|  |¡r@nt  d ¡tj  dd ¡|d 7}||ks||kr_t  d¡dStj  d|¡dS)NÚ PreRequistsÚPackagesrzAcquire::http::No-CacherHrErFF)ruzCan not find backport '%s'z>setting a cache control header to turn off caching temporarilyÚtruerz+pre-requists item is NOT trusted, giving upT)rarqrlÚfindrpryr’r^rXr‰r-Ú_allBackportsAuthenticatedrYrd)rzÚ backportslistr ÚnoCacher}r-r*r*r+Ú_verifyBackports(s.  þ  ô z&DistUpgradeController._verifyBackportscCs’tj dd¡dkrt d¡dSz|j dd¡}|rWdSWn ty'Ynw|D]}|j|}|js7dS|jj D]}|j rBnq;dSq*dS)NzAPT::Get::AllowUnauthenticatedFTzIskip authentication check because of APT::Get::AllowUnauthenticated==truerIÚAllowUnauthenticated) rlraÚfind_brXršÚ getbooleanrr^r rÚtrusted)rzr*r†r-r^Úcandr*r*r+r)Cs, ÿ ÿ  ÿþz0DistUpgradeController._allBackportsAuthenticatedc Cs–| d¡}t|ƒ\}}}}}d|vr| d¡d}d|||f}|jD]%}| d¡}t||ƒr2dS| d¡d} | | ¡rHt d|¡dSq#dS) z check if uri is a known mirror r‹ú@rz %s://%s%sTz//z)found apt-cacher/apt-torrent style uri %sF)ÚrstriprrrtrÚendswithrXrY) rzrìÚraw_uriÚschemeÚnetlocrRÚqueryÚfragmentÚmirrorÚmirror_host_partr*r*r+r!Ys     þzDistUpgradeController.isMirrorcCs4| d¡}|jD]}| d¡}t||ƒrdSqdS)z/ check if uri is an allowed third-party mirror r‹TF)r3rur)rzrìr:r*r*r+r"os    ÿz(DistUpgradeController.isThirdPartyMirrorcCsžd}tdd}|jD]B}|js|jrq |jdkrL|jdkrL| |j¡rLd|jvrLd|j|j vrL|j  d¡sL|j  d ¡sLd |j|jf}||vrL||7}q |S) z7 get sources.list snippet lines for the current mirror rqr2r@röFr!r zhttp://security.ubuntu.comzhttp://archive.ubuntu.comzdeb %s %s-updates main ) rrrrr#r!rìrrgrír)rzÚdumbÚlinesrrîÚnew_liner*r*r+Ú_getPreReqMirrorLinesxs(      ÿ  ÿ þ€z+DistUpgradeController._getPreReqMirrorLinesc Cs¶t d|¡| |¡}t|dƒ@}t|ƒ#}|D]}t|ƒ}|j|d}| |¡t d|¡qWdƒn1s¡n |j ?¡r¾t   d/¡t0 1d0¡dS)1NzChecking package managerzself.prepare() failedrDzPreparing the upgrade failedzXPreparing the system for the upgrade failed so a bug reporting process is being started.rErFz‚Preparing the system for the upgrade failed. To report a bug install apport and then execute 'apport-bug ubuntu-release-upgrader'.rGr%Fzneed backportsz$Getting upgrade prerequisites failedzºThe system was unable to get the prerequisites for the upgrade. The upgrade will abort now and restore the original system state. Additionally, a bug reporting process is being started.zØThe system was unable to get the prerequisites for the upgrade. The upgrade will abort now and restore the original system state. To report a bug install apport and then execute 'apport-bug ubuntu-release-upgrader'.r)rurvzUpdating repository informationT)rŽrIróz@No '%s' available/downloadable after sources.list rewrite+updatez'%s' was not in the cachez'%s' was not downloadablezInvalid package informationa†After updating your package information, the essential package '%s' could not be located. This may be because you have no official mirrors listed in your software sources, or because of excessive load on the mirror you are using. See /etc/apt/sources.list for the current list of configured software sources. In the case of an overloaded mirror, you may want to try the upgrade again later.r¤ÚFetchingÚ UpgradingzUpgrade infeasiblezQThe upgrade could not be completed, there were errors during the upgrade process.Úlibc6ÚpkgProblemResolverz'Unable to mark libc6 alone for install.zUpgrade incompletezUThe upgrade has partially completed but there were errors during the upgrade process.úUpgrade completeúKThe upgrade has completed but there were errors during the upgrade process.z:/var/lib/ubuntu-release-upgrader/release-upgrade-availablezSystem upgrade is complete.z/run/launcher-commandzw+zutf-8)Úencodingzaction: reboot ú /sbin/rebootr)@r[r\r]rrÚPREPARErërXr‰rPrRr¥r¨rØrŠrarvrUrÜrYrWrÀryr’r`ÚMODIFY_SOURCESrQr^rârãrnÚ+ensure_recommends_are_installed_on_desktopsrqÚanyVersionDownloadabler²Ú _inhibitIdleÚFETCHrÙrÅÚINSTALLrèrãrRràreÚKeyboardInterrupträr©r‹rŒr¯rrrÿÚREBOOTrMrr Ú _inside_WSLÚadviseExitOtherWSLrÅrBÚadviseRestartWSLÚconfirmRestart)rzr^Úlibc6_possibler‘rÍr*r*r+Ú fullUpgrade s   ÿ ÿ  ÿ    ÿ ÿ      ÿ   ôÿ €    ÿ  €ý€ ÿ  ÿ      ÿ   ÿ      ÿ    z!DistUpgradeController.fullUpgradecCs|j ¡| ¡Sr{)r[r†rtrþr*r*r+r‚øs zDistUpgradeController.runcCs|j tj¡|j tj¡|j tj¡d|_| ¡|  ¡s"dS|  ¡s(dS|j tj ¡|j  t dƒ¡| ¡s=dS|j tj¡|j  t dƒ¡| ¡s]|j t dƒt dƒ¡dS| ¡sn|j t dƒt dƒ¡dStj t¡r€|j ¡r~t d¡dS|j t dƒt dƒ¡dS) z, partial upgrade mode, useful for repairing TFr^r_rbrcrez"The partial upgrade was completed.)r[rrrfÚhideSteprgrnrmrër`r²rkr\r]rÙrlrär©rrPrRr¥ÚREBOOT_REQUIRED_FILErrr¨rØrþr*r*r+ÚdoPartialUpgradeüsB ÿ ÿ    þÿz&DistUpgradeController.doPartialUpgradec Cs t d¡zoz+ddl}| ¡| ¡|_|j dd¡}|j|dd}| dd¡t dƒ}t d ƒ}Wn:t yk}z.t   d d ¡d vrPWYd}~Wt   t  ¡¡dSt d t|ƒ¡t dƒ}t dƒ}WYd}~nd}~wwWt   t  ¡¡nt   t  ¡¡w|j ||¡dS)Nzinhibit screensaverrzorg.freedesktop.ScreenSaverz/org/freedesktop/ScreenSaver)Údbus_interfacer4zUpgrading UbuntuzLock screen disabledzOYour lock screen has been disabled and will remain disabled during the upgrade.ÚXDG_SESSION_TYPErq)rqÚttyzfailed to inhibit screensaver: zUnable to disable lock screenz£It is highly recommended that the lock screen be disabled during the upgrade to prevent later issues. Please ensure your screen lock is disabled before continuing.)rXrYÚdbusÚ_setNonRootEUIDÚ SessionBusryÚ get_objectÚ InterfaceÚInhibitr]rrPÚgetenvÚseteuidÚgetuidrer[r©)rzr{ÚproxyÚ screensaverr­Úmessager‘r*r*r+rj#s0  ÿ    ø€ú€ z"DistUpgradeController._inhibitIdlecCsLt ¡dkrdSt d¡}|st d¡}|st d¡dSt t|ƒ¡dS)NrÚSUDO_UIDÚ PKEXEC_UIDz"failed to determine user upgrading)rPrƒrrXrYr‚Úint)rzÚuidr*r*r+r|Is    z%DistUpgradeController._setNonRootEUIDcCs tj d¡S)Nz#/proc/sys/fs/binfmt_misc/WSLInterop)rPrRr¥rþr*r*r+roVs z!DistUpgradeController._inside_WSL)NN)TF)T)TN)F)2r.r/r0Ú__doc__r~r’r…r£r¯rÁrÐrërïr?rQr_r`ryr‡r£r¯r²r¸rÀrÄrÅrÙrrárèrärrrŠr"rär,r)r!r"r?rIrWrSrtr‚rwrjr|ror*r*r*r+r1]sf  b# ;I 7e 3$/:& J fn  Xo'& r1Ú__main__)ÚDistUpgradeViewText)Úlevel)IrÒrlr³r‹rPr¨rÌrXrZrÞr‡r Ú configparserrrrÄÚ telemetryrrMÚutilsrrrr r r r r rÚstringrÚ urllib.parserÚDistUpgradeViewrÚDistUpgradeCacherÚDistUpgradeConfigParserrrÚ aptsourcesrrÚDistInfoÚaptsources.sourceslistrrr.rrÚDistUpgradeGettextrr]rrrrÚDistUpgradeApportr rvr,rr-r¼r1r.rÚ basicConfigÚDEBUGÚvÚdcrÄrÅr*r*r*r+Úsx   ,             ù