How to Reset root password in Nocix

Booting Rescue Mode

1.Login to your client Portal

2.Click Services tab at the top

3.Click your Server ID

4.Click the Reload Operating System button

5.From the drop down, select sysrcd 4.3.1 operating system

6. Click Load Operating System button. Wait for the new credentials in your email. Takes 20 – 40 mins

Changing Password

Once credentials arrive, follow the steps below

  1. Login to the server via SSH
ssh root@<ip address of the server>

2. Run lsblk to identify the root partition. Sample outputs from different scenarios are as below:

There are 3 possible outcomes

i)SCENARIO ONE: You have RAID running. Sample output

root@rescue ~ # lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0     7:0    0     4G  1 loop
sda       8:0    0 447.1G  0 disk
├─sda1    8:1    0     4G  0 part
│ └─md0   9:0    0     4G  0 raid1
├─sda2    8:2    0   512M  0 part
│ └─md1   9:1    0 511.4M  0 raid1
└─sda3    8:3    0 442.6G  0 part
  └─md2   9:2    0 442.5G  0 raid1
sdb       8:16   0 447.1G  0 disk
├─sdb1    8:17   0     4G  0 part
│ └─md0   9:0    0     4G  0 raid1
├─sdb2    8:18   0   512M  0 part
│ └─md1   9:1    0 511.4M  0 raid1
└─sdb3    8:19   0 442.6G  0 part
  └─md2   9:2    0 442.5G  0 raid1

In this case, you will access the volume called /dev/md2

ii)SCENARIO 2: You have no RAID running. Sample output below

root@rescue ~ # lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0     7:0    0     4G  1 loop
sda       8:0    0 447.1G  0 disk
├─sda1    8:1    0     4G  0 part
├─sda2    8:2    0   512M  0 part
└─sda3    8:3    0 442.6G  0 part
sdb       8:16   0 447.1G  0 disk
└─sdb1    8:17   0   446G  0 part

In this case, you will access the volume called /dev/sda3

SCENARIO 3. You have LVM running. Sample Output below

root@sysresccd /root % lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 1.8T 0 disk
├─sda1 8:1 0 2M 0 part
├─sda2 8:2 0 250M 0 part
└─sda3 8:3 0 1.8T 0 part
├─vg-swap 253:0 0 15.8G 0 lvm
├─vg-tmp 253:1 0 1G 0 lvm
└─vg-root 253:2 0 1.8T 0 lvm
loop0 7:0 0 275.1M 0 loop /livemnt/squashfs

In this case, you will first run the command below

ls /dev/mapper/*

This will give an output such as below

root@sysresccd /root # ls /dev/mapper/*
/dev/mapper/control /dev/mapper/vg-root /dev/mapper/vg-swap /dev/mapper/vg-tmp

We are interested in accessing /dev/mapper/vg-root

3. Now, having identified the partition we want to access, mount the partion. Below we will assume we are on SCENARIO 3 above. So we’ll mount /dev/mapper/vg-root

root@sysresccd /root # mount /dev/mapper/vg-root /mnt 

4.Then, run the command below to chroot into the partiton

root@sysresccd /root % chroot /mnt

If you get the error below,

chroot: failed to run command ‘/bin/zsh’: No such file or directory

run the command below instead

root@sysresccd /root % chroot /mnt /usr/bin/bash

5. Reset the root password

root@sysresccd /]# passwd
Changing password for user root.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

6. Exit chroot environment

[root@sysresccd /]# exit

7. Unmount the partion and reboot

root@sysresccd /root # umount /mnt
root@sysresccd /root # reboot

Was this article helpful?

Related Articles

Leave A Comment?