wget https:\/\/fastly-cdn.system-rescue.org\/releases\/11.00\/systemrescue-11.00-amd64.iso<\/code><\/pre>\n\n\n\nSimilarly, download the checksum hash file to verify integrity of the image.<\/p>\n\n\n\n
wget https:\/\/www.system-rescue.org\/releases\/11.00\/systemrescue-11.00-amd64.iso.sha512<\/code><\/pre>\n\n\n\nNext, verify integrity of the image. Ensure both the ISO file and Checksum file are in the same working directory.<\/p>\n\n\n\n
sha512sum --check systemrescue-11.00-amd64.iso.sha512<\/code><\/pre>\n\n\n\nIf all good, you should get such an output;<\/p>\n\n\n\n
systemrescue-11.00-amd64.iso: OK<\/code><\/pre>\n\n\n\nYou can now import image into OpenStack. To import image into OpenStack, you can use use glance<\/strong> or openstack<\/strong> command.<\/p>\n\n\n\nActivate your OpenStack environment and load the credentials<\/p>\n\n\n\n
source $HOME\/kolla-ansible\/bin\/activate<\/code><\/pre>\n\n\n\nsource \/etc\/kolla\/admin-openrc.sh<\/code><\/pre>\n\n\n\nThen create the SystemRescue image;<\/p>\n\n\n\n
glance image-create --name systemrescue \\\n\t--file .\/systemrescue-11.00-amd64.iso \\\n\t--disk-format iso \\\n\t--container-format bare \\\n\t--progress\n<\/code><\/pre>\n\n\n\n+------------------+----------------------------------------------------------------------------------+\n| Property | Value |\n+------------------+----------------------------------------------------------------------------------+\n| checksum | fee7f202ba632552dbaf82a89c2438af |\n| container_format | bare |\n| created_at | 2024-04-20T07:25:20Z |\n| direct_url | rbd:\/\/17ef548c-f68b-11ee-9a19-4d1575fdfd98\/glance- |\n| | images\/1c0c448c-e766-4b8a-ac01-4b553c888074\/snap |\n| disk_format | iso |\n| id | 1c0c448c-e766-4b8a-ac01-4b553c888074 |\n| min_disk | 0 |\n| min_ram | 0 |\n| name | systemrescue |\n| os_hash_algo | sha512 |\n| os_hash_value | 10a3145a5101c00977091e7c946086edcc5e4acf8dfb57b1e912fdf27c23899cedc12cf14ef503a1 |\n| | 8a1018f917066149957d7460f3c080e2891af64cac05bc35 |\n| os_hidden | False |\n| owner | dee76bfb1767468ba250225944203193 |\n| protected | False |\n| size | 894435328 |\n| status | active |\n| stores | rbd |\n| tags | [] |\n| updated_at | 2024-04-20T07:25:30Z |\n| virtual_size | Not available |\n| visibility | shared |\n+------------------+----------------------------------------------------------------------------------+\n<\/code><\/pre>\n\n\n\nIf you want to use openstack<\/strong> command;<\/p>\n\n\n\nopenstack image create systemrescuecd \\\n --file .\/systemrescue-11.00-amd64.iso \\\n --disk-format iso \\\n --container-format bare \\\n --progress\n<\/code><\/pre>\n\n\n\n+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+\n| Field | Value |\n+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+\n| container_format | bare |\n| created_at | 2024-04-20T07:27:08Z |\n| disk_format | iso |\n| file | \/v2\/images\/83b6b25a-717d-4263-ad45-150cd301eb30\/file |\n| id | 83b6b25a-717d-4263-ad45-150cd301eb30 |\n| min_disk | 0 |\n| min_ram | 0 |\n| name | systemrescuecd |\n| owner | dee76bfb1767468ba250225944203193 |\n| properties | os_hidden='False', owner_specified.openstack.md5='', owner_specified.openstack.object='images\/systemrescuecd', owner_specified.openstack.sha256='' |\n| protected | False |\n| schema | \/v2\/schemas\/image |\n| status | queued |\n| tags | |\n| updated_at | 2024-04-20T07:27:08Z |\n| visibility | shared |\n+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+\n<\/code><\/pre>\n\n\n\nRescueing OpenStack Instance<\/h3>\n\n\n\n
As already mentioned, there are various situations that might prompt you to consider using SystemRescue to rescue your OpenStack instance.<\/p>\n\n\n\n
In my case, I had forgotten the instance credentials and I couldn’t easily access Grub menu from the OpenStack console. The only chance I had was with using SystemRescue.<\/p>\n\n\n\n
openstack server list<\/code><\/pre>\n\n\n\n+--------------------------------------+----------+--------+------------------+--------+--------+\n| ID | Name | Status | Networks | Image | Flavor |\n+--------------------------------------+----------+--------+------------------+--------+--------+\n| c6efdc70-ed41-4d34-9317-c3eb878df62b | jammy | ACTIVE | net=10.10.10.156 | jammy | minif |\n| 4e5b93a9-9de9-42e4-9419-5df8a3bd07cc | cephtest | ACTIVE | net=10.10.10.142 | cirros | mini |\n+--------------------------------------+----------+--------+------------------+--------+--------+\n<\/code><\/pre>\n\n\n\nOr<\/p>\n\n\n\n
<\/figure>\n\n\n\nThat is the instance that I will be working on!<\/p>\n\n\n\n
There are two ways in which you can rescue you OpenStack instance.<\/p>\n\n\n\n
\n- Rescueing Instance from command line<\/li>\n\n\n\n
- Rescueing Instance from Horizon Dashboard<\/li>\n<\/ul>\n\n\n\n
Rescueing Instance from command line<\/h4>\n\n\n\n
To rescue an instance from command line, you can use the command;<\/p>\n\n\n\n
openstack server rescue [--image <image>] [--password <password>] <server><\/code><\/pre>\n\n\n\nyou need to know the instance\/server name or ID, as well the SystemRescue image name or ID.<\/p>\n\n\n\n
openstack server list<\/code><\/pre>\n\n\n\nSee our output above.<\/p>\n\n\n\n
openstack image list<\/code><\/pre>\n\n\n\nSample output;<\/p>\n\n\n\n
+--------------------------------------+--------------+--------+\n| ID | Name | Status |\n+--------------------------------------+--------------+--------+\n| 024bd4c2-8ae6-4020-9f61-fb463c4b0b16 | cirros | active |\n| 097705d6-1d51-4c97-9c4a-12c7514ec3a7 | jammy | active |\n| 1c0c448c-e766-4b8a-ac01-4b553c888074 | systemrescue | active |\n+--------------------------------------+--------------+--------+\n<\/code><\/pre>\n\n\n\nNow that we have the server name\/ID as well the rescue image name\/id, proceed to stop and rescue the instance.<\/p>\n\n\n\n
openstack server stop c6efdc70-ed41-4d34-9317-c3eb878df62b<\/code><\/pre>\n\n\n\nConfirm that the instance that instance is shutoff;<\/p>\n\n\n\n
openstack server list<\/code><\/pre>\n\n\n\n+--------------------------------------+----------+---------+------------------+--------+--------+\n| ID | Name | Status | Networks | Image | Flavor |\n+--------------------------------------+----------+---------+------------------+--------+--------+\n| c6efdc70-ed41-4d34-9317-c3eb878df62b | jammy | SHUTOFF | net=10.10.10.156 | jammy | minif |\n| 4e5b93a9-9de9-42e4-9419-5df8a3bd07cc | cephtest | ACTIVE | net=10.10.10.142 | cirros | mini |\n+--------------------------------------+----------+---------+------------------+--------+--------+\n<\/code><\/pre>\n\n\n\nNow, rescue the instance;<\/p>\n\n\n\n
openstack server rescue --image 1c0c448c-e766-4b8a-ac01-4b553c888074 c6efdc70-ed41-4d34-9317-c3eb878df62b<\/strong><\/code><\/pre>\n\n\n\nThis will start the instance and boot into SystemRescue.<\/p>\n\n\n\n
Rescue Instance on OpenStack Horizon<\/h4>\n\n\n\n
You can as well rescue instance from OpenStack horizon;<\/p>\n\n\n\n
Assuming you have already imported a SystemRescue image into OpenStack;<\/p>\n\n\n\n
<\/figure>\n\n\n\nThen select your project and navigate to Project > Compute > Instances<\/strong>.<\/p>\n\n\n\nIdentify the instance you want to rescue under the actions drop down button on the right of the instance, click Rescue Instance<\/strong>.<\/p>\n\n\n\n
<\/figure>\n\n\n\nNext, select a rescue image (we use SystemRescue image here) and optionally set a password on the rescued instance.<\/p>\n\n\n\n
<\/figure>\n\n\n\nClick Confirm<\/strong>, to shutdown the instance and boot it from the rescue image.<\/p>\n\n\n\nThe state of the image now should show as Rescue<\/strong>.<\/p>\n\n\n\n
<\/figure>\n\n\n\nAccess and Troubleshoot Instance from Rescue State<\/h3>\n\n\n\n
You can access a rescued instance from command line or from horizon.<\/p>\n\n\n\n
Accessing Rescued Instance on Command Line<\/h4>\n\n\n\n
To access a rescued instance from the terminal, you need to identify the compute node on which the instance is hosted, as well the instance_name<\/strong>. You can get these details using openstack server show<\/strong> command or from Horizon.<\/p>\n\n\n\nopenstack server show c6efdc70-ed41-4d34-9317-c3eb878df62b<\/code><\/pre>\n\n\n\nSample details;<\/p>\n\n\n\n
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+\n| Field | Value |\n+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+\n| OS-DCF:diskConfig | AUTO |\n| OS-EXT-AZ:availability_zone | nova |\n| OS-EXT-SRV-ATTR:host | openstack |\n| OS-EXT-SRV-ATTR:hostname | jammy |\n| OS-EXT-SRV-ATTR:hypervisor_hostname | openstack |\n| OS-EXT-SRV-ATTR:instance_name | instance-0000000b |\n| OS-EXT-SRV-ATTR:kernel_id | |\n| OS-EXT-SRV-ATTR:launch_index | 0 |\n| OS-EXT-SRV-ATTR:ramdisk_id | |\n| OS-EXT-SRV-ATTR:reservation_id | r-mvg279bn |\n| OS-EXT-SRV-ATTR:root_device_name | \/dev\/vda |\n| OS-EXT-SRV-ATTR:user_data | None |\n| OS-EXT-STS:power_state | Running |\n| OS-EXT-STS:task_state | None |\n| OS-EXT-STS:vm_state | rescued |\n| OS-SRV-USG:launched_at | 2024-04-20T13:27:51.000000 |\n| OS-SRV-USG:terminated_at | None |\n| accessIPv4 | |\n| accessIPv6 | |\n| addresses | net=10.10.10.156 |\n| config_drive | |\n| created | 2024-04-16T13:39:31Z |\n| description | None |\n| flavor | description=, disk='5', ephemeral='0', , id='minif', is_disabled=, is_public='True', location=, name='minif', original_name='minif', |\n| | ram='2048', rxtx_factor=, swap='0', vcpus='1' |\n| hostId | f32cbc449e29ca574b72dd876976e8c4cf44d4c86b5b39617f322080 |\n| host_status | UP |\n| id | c6efdc70-ed41-4d34-9317-c3eb878df62b |\n| image | jammy (097705d6-1d51-4c97-9c4a-12c7514ec3a7) |\n| key_name | None |\n| locked | False |\n| locked_reason | None |\n| name | jammy |\n| progress | None |\n| project_id | dee76bfb1767468ba250225944203193 |\n| properties | |\n| security_groups | name='default' |\n| server_groups | [] |\n| status | RESCUE |\n| tags | |\n| trusted_image_certificates | None |\n| updated | 2024-04-20T13:27:51Z |\n| user_id | 885eb7e423154ed781cdd0a71cb5221f |\n| volumes_attached | |\n+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+\n<\/code><\/pre>\n\n\n\nThe details i need are:<\/p>\n\n\n\n
| OS-EXT-SRV-ATTR:hypervisor_hostname | openstack \n| OS-EXT-SRV-ATTR:instance_name | instance-0000000b \n<\/code><\/pre>\n\n\n\nSo, login to the node, in this case, openstack node;<\/p>\n\n\n\n
ssh username@compute-node<\/code><\/pre>\n\n\n\nReplace the details accordingly.<\/p>\n\n\n\n
Then use virsh<\/strong> command to login to instance console. We are using Kolla-ansible deployed OpenStack hence, our OpenStack services are running as Docker containers. We will therefore connect to Nova Libvirt service to get to login to the instance.<\/p>\n\n\n\ndocker exec -it nova_libvirt bash<\/code><\/pre>\n\n\n\nvirsh list<\/code><\/pre>\n\n\n\n Id Name State\n-----------------------------------\n 23 instance-00000008 running\n 25 instance-0000000b running\n<\/code><\/pre>\n\n\n\nThen;<\/p>\n\n\n\n
virsh console instance-0000000b<\/code><\/pre>\n\n\n\nOr simply;<\/p>\n\n\n\n
docker exec -it nova_libvirt virsh list<\/code><\/pre>\n\n\n\ndocker exec -it nova_libvirt virsh console instance-0000000b<\/code><\/pre>\n\n\n\nYou are given such prompt;<\/p>\n\n\n\n
Connected to domain 'instance-0000000b'\nEscape character is ^] (Ctrl + ])\n<\/code><\/pre>\n\n\n\nPress the Escape character combination to jump into shell. If it doesn’t work, try CTLR+C<\/strong>.<\/p>\n\n\n\nIn my case, I was not able to get to the shell prompt. Thus, we will resort to using Horizon console!<\/p>\n\n\n\n
From the console, you can do any administrative tasks to fix the issue you intended to fix.<\/p>\n\n\n\n
To exit the virsh console<\/strong>, use CTRL+Shift+]<\/strong>.<\/p>\n\n\n\nAccessing Rescued Instance from Horizon<\/h4>\n\n\n\n
Navigate to your project instances page on Horizon and click the instance that you had rescued to open it, and click console<\/strong> to access the console.<\/p>\n\n\n\n
<\/figure>\n\n\n\nTo open the console only on new browser tab, right click the link, “click here to show only console<\/strong>” and open in new tab.<\/p>\n\n\n\nTroubleshooting OpenStack Instance in Rescue Mode<\/h3>\n\n\n\n
From the console of the instance, either on the command line or on horizon, you can now do your administrative tasks or troubleshooting.<\/p>\n\n\n\n
Mounting Instance Filesystem<\/h4>\n\n\n\n
If you need to update your instance configuration for example, then you have to mount your root filesystem.<\/p>\n\n\n\n
Similarly, if you have other drive partitions for boot\/esp and you need to make changes related to processes whose configurations resides on such partitions, you have to mount it as well.<\/p>\n\n\n\n
SystemRescue has almost all Linux usual commands! Let’s check the drives<\/p>\n\n\n\n
lsblk<\/code><\/pre>\n\n\n\nFrom the screenshot, vdb is our instance drive, where vdb1 is the rootFS, vdb15 are ESP Boot partitions.<\/p>\n\n\n\n
<\/figure>\n\n\n\nSo, you can mount the drives;<\/p>\n\n\n\n
mkdir \/mnt\/vdb<\/code><\/pre>\n\n\n\nmount \/dev\/vdb1 \/mnt\/vdb\/<\/code><\/pre>\n\n\n\nmount \/dev\/vdb15 \/mnt\/vdb\/boot\/efi<\/code><\/pre>\n\n\n\nTroubleshooting Instance from SystemRescue<\/h4>\n\n\n\n
From here, you can edit some files directly, for example, if you want to set static IP address;<\/p>\n\n\n\n
vim \/mnt\/vdb\/etc\/netplan\/50-cloud-init.yaml<\/code><\/pre>\n\n\n\nMake your appropriate changes and save the configurations.<\/p>\n\n\n\n
You can also chroot<\/strong> into your instance root directory and perform your troubleshooting.<\/p>\n\n\n\n\nA chroot<\/em><\/strong> is an operation that changes the apparent root directory for the current running process and their children. A program that is run in such a modified environment cannot access files and commands outside that environmental directory tree. This modified environment is called a chroot jail.<\/p>\n\n\n\nReasoning
Changing root is commonly done for performing system maintenance on systems where booting and\/or logging in is no longer possible. Common examples are:<\/p>\n\n\n\n
Reinstalling the boot loader.
Rebuilding the initramfs image.
Upgrading or downgrading packages.
Resetting a forgotten password.
Building packages in a clean chroot.<\/p>\nArchWiki<\/a><\/cite><\/blockquote>\n\n\n\nTo chroot into your instance rootfs in SystemRescue;<\/p>\n\n\n\n
chroot \/mnt\/vdb<\/code><\/pre>\n\n\n\nFrom chroot environment, you can perform any action you need to.<\/p>\n\n\n\n
Unrescue the Instance<\/h3>\n\n\n\n
Once you are done fixing or troubleshooting your instance, you can exit the rescue system and unrescue the instance.<\/p>\n\n\n\n
If you are doing from command line, exit the console and;<\/p>\n\n\n\n
openstack server unrescue <INSTANCE_ID><\/code><\/pre>\n\n\n\nE.g<\/p>\n\n\n\n
openstack server unrescue c6efdc70-ed41-4d34-9317-c3eb878df62b<\/strong><\/code><\/pre>\n\n\n\nOr from the Horizon;<\/p>\n\n\n\n
<\/figure>\n\n\n\nAnd that is.<\/p>\n\n\n\n
Once your instance is up, verify if it is working as expected.<\/p>\n","protected":false},"excerpt":{"rendered":"
In this tutorial, you will learn how to rescue OpenStack instance using SystemRescue image. According to SystemRescure Homepage; SystemRescue (formerly known as SystemRescueCd) is a<\/p>\n","protected":false},"author":10,"featured_media":22211,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,1885,1886],"tags":[7453,7451,7452],"class_list":["post-22174","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-cloud-compute","category-openstack","tag-openstack-rescue-instance","tag-rescue-openstack-instance","tag-systemrescude-image-openstack","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/22174"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=22174"}],"version-history":[{"count":18,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/22174\/revisions"}],"predecessor-version":[{"id":22210,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/22174\/revisions\/22210"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/22211"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=22174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=22174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=22174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}