Compute instance - davidkhala/oci-collection GitHub Wiki

hostnamectl info

  • Hardware Vendor: QEMU
  • Hardware Model: KVM Virtual Machine

Run commands

requires

  • Enable Plugin Compute Instance Run Command managed by Oracle Cloud Agent
  • IAM: Allow dynamic-group <instance principal dynamic group> to use instance-agent-command-execution-family in TENANCY where request.instance.id=target.instance.id
    • Debug by tail -f /var/log/oracle-cloud-agent/plugins/runcommand/runcommand.log Reference

Troubleshoot

  • log in tail -f /var/log/oracle-cloud-agent/plugins/runcommand/runcommand.log
  • sudo systemctl restart oracle-cloud-agent

limitation

  • instance use a systemd service(oracle-cloud-agent) to poll command, but the interval is 180s
  • Supported OS [Oracle Linux, CentOS, Windows Server]. Ubuntu are NOT supported
  • timeout for a script: The default is one hour. The maximum is 24 hours.
  • Default parrallel: 2, up to 5 maximum
    • To change the default, update the run command configuration file in cat /etc/oracle-cloud-agent/plugins/runcommand/config.yml
  • Command orchestration is not supported.

Instance metadata

Document

Endpoints

oci cli extention oci-metadata --json

Post disk resize

Oracle Linux

sudo dd iflag=direct if=/dev/oracleoci/oraclevda of=/dev/null count=1
echo "1" | sudo tee /sys/class/block/`readlink /dev/oracleoci/oraclevda | cut -d'/' -f 2`/device/rescan

Console Connection

After console connection established, you are required to input login password, then before console connection, you need to change password of user in advanced in normal terminal. If you haven't do so:

  • Ubuntu 20

    1. Reboot the instance from the Console while keep Console Connection terminal open
    2. When the reboot process starts, in the terminal window, press Esc once only after stop completed and a blank cursor flashing
      • F5 is the browser default Refresh shortcut
      • If click Esc repeatedly too early, it will go to Boot Manager console, then you have to try again
      • If click Esc repeatedly, you will go too far to GRUB command mode. In this case, run normal command to back to GRUB console mode
    3. E to edit the grub entry ubuntu.
    4. In edit mode, use the down arrow key to scroll down through the entries until you reach the line that starts with linuxefi or linux.
    5. Add init=/bin/bash to end of that line
    6. save the temporary change by entering the keyboard shortcut CTRL+X. Your change will not persist in next boot
    7. Remount filesystem for root in rescue mode. /bin/mount -o remount, rw /
    8. [ready to use here. Do your task]
    9. Post-task, run exec /usr/lib/systemd/systemd
    10. Reboot from command. /usr/sbin/reboot -f
  • Oracle Linux

  • SUSE

⚠️ **GitHub.com Fallback** ⚠️