All Collections
VPS
VPS Management
VPS Emergency Mode: How to Change Apparent Root on Your Disk
VPS Emergency Mode: How to Change Apparent Root on Your Disk

Changing the apparent root when the emergency mode is enabled in your VPS

Updated over a week ago

In an emergency mode SSH session, you can change the apparent root to your VPS mounted disk to simulate a typical login scenario. This enables you to execute commands and perform actions on your VPS, offering a way to address issues or manage resources directly within the disk environment.

Some commands or actions are not accessible within a chroot environment. While chroot is a potent tool for executing commands from your VPS disk, it may not resolve all resource-related issues.

To change the apparent root, use the command below:

chroot /path/to/mainpartition

Make sure to replace /path/to/mainpartition with your VPS disk main partition mounted directory. You can locate the directory by referring to this guide: VPS Emergency Mode: Where to Find Files.

A successful execution of the command won't display any error messages. Your terminal window will display the prompt for entering a new command:

root@server:/#

To verify the change was applied, run the following command:

unshare -U true

If you encounter an unshare: unshare failed: Operation not permitted error, it indicates the apparent root was successfully changed, and subsequent commands will utilize the resources from your mounted VPS disk.

Did this answer your question?