Do you have an issue on your OpenStack where the instance is not booting up properly?, Or cloud-init data injection to the virtual machine failing on OpenStack as a result of metadata server not being reachable?.
Let’s create a test VM instance to demonstrate how you can check VM instance logs on OpenStack compute platform.
$ openstack server create --flavor linux-advanced-vps --net public --key-name jkmutai --security-group allow_all --image "Rocky-Linux-9" Rocky-Linux-9
+--------------------------------------+------------------------------------------------------+
| Field | Value |
+--------------------------------------+------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | |
| OS-EXT-SRV-ATTR:host | None |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None |
| OS-EXT-SRV-ATTR:instance_name | |
| OS-EXT-STS:power_state | NOSTATE |
| OS-EXT-STS:task_state | scheduling |
| OS-EXT-STS:vm_state | building |
| OS-SRV-USG:launched_at | None |
| OS-SRV-USG:terminated_at | None |
| accessIPv4 | |
| accessIPv6 | |
| addresses | |
| adminPass | 2DVtdhoq9PjV |
| config_drive | |
| created | 2024-06-19T15:00:33Z |
| flavor | linux-advanced-vps (12) |
| hostId | |
| id | cf1fdd2f-3118-4052-a629-797ccacbd2a4 |
| image | Rocky-Linux-9 (6774019b-df26-4841-8842-689e31aff1d7) |
| key_name | jkmutai |
| name | Rocky-Linux-9 |
| os-extended-volumes:volumes_attached | [] |
| progress | 0 |
| project_id | 3dfc8a0aec3d409696daa2c825b85a3f |
| properties | |
| security_groups | name='7abe316b-ad8b-4dc0-9b18-d4bbe6781a96' |
| status | BUILD |
| updated | 2024-06-19T15:00:33Z |
| user_id | a381926a111e43d288f927baf92e78c8 |
+--------------------------------------+------------------------------------------------------+
Check server status and get the instance name or instance ID by running:
$ openstack server list
+--------------------------------------+---------------+--------+-----------------------+---------------+--------------------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+---------------+--------+-----------------------+---------------+--------------------+
| 5e7e6c8d-4d80-4102-9eb3-81a086112751 | Rocky-Linux-9 | ACTIVE | public=198.41.183.233 | Rocky-Linux-9 | linux-advanced-vps |
+--------------------------------------+---------------+--------+-----------------------+---------------+--------------------+
To get OpenStack instance show console output, the command to use is:
openstack console log show <vm-instance>
Example below shows console logs for Rocky-Linux-9 instance.
openstack console log show Rocky-Linux-9
Sample output from command execution.
.....
[[0;32m OK [0m] Finished [0;1;39mdracut pre-udev hook[0m.
Starting [0;1;39mRule-based Manage���for Device Events and Files[0m...
[[0;32m OK [0m] Started [0;1;39mRule-based Manager for Device Events and Files[0m.
Starting [0;1;39mdracut pre-trigger hook[0m...
[[0;32m OK [0m] Finished [0;1;39mdracut pre-trigger hook[0m.
Starting [0;1;39mColdplug All udev Devices[0m...
[[0;32m OK [0m] Finished [0;1;39mColdplug All udev Devices[0m.
[[0;32m OK [0m] Reached target [0;1;39mSystem Initialization[0m.
[[0;32m OK [0m] Reached target [0;1;39mBasic System[0m.
[[0;32m OK [0m] Reached target [0;1;39mNetwork[0m.
Starting [0;1;39mdracut initqueue hook[0m...
[[0;32m OK [0m] Started [0;1;39mHardware RNG Entropy Gatherer Daemon[0m.
[ 1.689594] virtio_blk virtio2: 1/0/0 default/read/poll queues
[ 1.701024] virtio_blk virtio2: [vda] 167772160 512-byte logical blocks (85.9 GB/80.0 GiB)
[ 1.721627] vda: vda1 vda2 vda3 vda4
[[0;32m OK [0m] Found device [0;1;39m/dev/disk/by-label/rocky[0m.
[[0;32m OK [0m] Reached target [0;1;39mInitrd Root Device[0m.
[ 1.823181] scsi host0: ata_piix
[ 1.827731] scsi host1: ata_piix
[ 1.827840] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc0e0 irq 14 lpm-pol 0
[ 1.827842] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc0e8 irq 15 lpm-pol 0
[[0;32m OK [0m] Finished [0;1;39mdracut initqueue hook[0m.
[[0;32m OK [0m] Reached target [0;1;39mPreparation for Remote File Systems[0m.
[[0;32m OK [0m] Reached target [0;1;39mRemote Encrypted Volumes[0m.
[[0;32m OK [0m] Reached target [0;1;39mRemote File Systems[0m.
Starting [0;1;39mdracut pre-mount hook[0m...
[[0;32m OK [0m] Finished [0;1;39mdracut pre-mount hook[0m.
Starting [0;1;39mFile System Check on /dev/disk/by-label/rocky[0m...
[[0;32m OK [0m] Finished [0;1;39mFile System Check on /dev/disk/by-label/rocky[0m.
Mounting [0;1;39m/sysroot[0m...
[ 2.511799] SGI XFS with ACLs, security attributes, scrub, quota, no debug enabled
[ 2.540954] XFS (vda4): Mounting V5 Filesystem 5b6a1614-08e4-4d63-92fe-cee0bc83425f
[ 2.585105] XFS (vda4): Ending clean mount
[ 2.597811] xfs filesystem being mounted at /sysroot supports timestamps until 2038 (0x7fffffff)
[[0;32m OK [0m] Mounted [0;1;39m/sysroot[0m.
[[0;32m OK [0m] Reached target [0;1;39mInitrd Root File System[0m.
Starting [0;1;39mMountpoints Configured in the Real Root[0m...
[[0;32m OK [0m] Finished [0;1;39mMountpoints Configured in the Real Root[0m.
[[0;32m OK [0m] Reached target [0;1;39mInitrd File Systems[0m.
[[0;32m OK [0m] Reached target [0;1;39mInitrd Default Target[0m.
Starting [0;1;39mdracut pre-pivot and cleanup hook[0m...
[[0;32m OK [0m] Finished [0;1;39mdracut pre-pivot and cleanup hook[0m.
Starting [0;1;39mCleaning Up and Shutting Down Daemons[0m...
[[0;32m OK [0m] Stopped target [0;1;39mNetwork[0m.
[[0;32m OK [0m] Stopped target [0;1;39mRemote Encrypted Volumes[0m.
[[0;32m OK [0m] Stopped target [0;1;39mTimer Units[0m.
[[0;32m OK [0m] Closed [0;1;39mD-Bus System Message Bus Socket[0m.
[[0;32m OK [0m] Stopped [0;1;39mdracut pre-pivot and cleanup hook[0m.
[[0;32m OK [0m] Stopped target [0;1;39mInitrd Default Target[0m.
[[0;32m OK [0m] Stopped target [0;1;39mInitrd Root Device[0m.
[[0;32m OK [0m] Stopped target [0;1;39mInitrd /usr File System[0m.
[[0;32m OK [0m] Stopped target [0;1;39mRemote File Systems[0m.
[[0;32m OK [0m] Stopped target [0;1;39mPreparation for Remote File Systems[0m.
[[0;32m OK [0m] Stopped [0;1;39mdracut pre-mount hook[0m.
[[0;32m OK [0m] Stopped [0;1;39mdracut initqueue hook[0m.
Stopping [0;1;39mHardware RNG Entropy Gatherer Daemon[0m...
[[0;32m OK [0m] Stopped [0;1;39mSetup Virtual Console[0m.
[[0;32m OK [0m] Stopped [0;1;39mHardware RNG Entropy Gatherer Daemon[0m.
[[0;32m OK [0m] Stopped target [0;1;39mBasic System[0m.
[[0;32m OK [0m] Stopped target [0;1;39mPath Units[0m.
[[0;32m OK [0m] Stopped target [0;1;39mSlice Units[0m.
[[0;32m OK [0m] Stopped target [0;1;39mSocket Units[0m.
[[0;32m OK [0m] Stopped target [0;1;39mSystem Initialization[0m.
[[0;32m OK [0m] Stopped target [0;1;39mLocal Encrypted Volumes[0m.
[[0;32m OK [0m] Stopped [0;1;39mDispatch Password ���ts to Console Directory Watch[0m.
[[0;32m OK [0m] Stopped target [0;1;39mLocal File Systems[0m.
[[0;32m OK [0m] Stopped target [0;1;39mSwaps[0m.
[[0;32m OK [0m] Stopped [0;1;39mApply Kernel Variables[0m.
[[0;32m OK [0m] Stopped [0;1;39mLoad Kernel Modules[0m.
[[0;32m OK [0m] Stopped [0;1;39mCreate Volatile Files and Directories[0m.
[[0;32m OK [0m] Stopped [0;1;39mColdplug All udev Devices[0m.
[[0;32m OK [0m] Stopped [0;1;39mdracut pre-trigger hook[0m.
....
You can dump the contents of the logs to a file for later review.
$ openstack console log show <vm-instance> > instance_logs_file.txt
To get VNC console access URL which can be accessed from your web browser, use:
openstack console url show <vm-instance>
Here is the sample output. We can see the URL that you can open in your browser to access instance console.
+----------+-----------------------------------------------------------------------------------------------+
| Field | Value |
+----------+-----------------------------------------------------------------------------------------------+
| protocol | vnc |
| type | novnc |
| url | http://198.41.183.233:6080/vnc_auto.html?path=%3Ftoken%3D9ea9052e-0e7e-46b3-983e-198151d2e88d |
+----------+-----------------------------------------------------------------------------------------------+
As CloudSpinx, we can help you with different OpenStack administration tasks and issue resolution. You can chat with us and we will he happy to help.