Ubuntu running only graphics mode and I cant change to text mode

I working on VM machine Ubuntu in text mode. But today my machine have run in graphics mode. Although that it was version with only text mode. Maybe any packet installed some graphics modules. And now I can do nothing. Because Ubuntu in graphics mode have not any application like terminal. I can only enter to recover mode ( but it doesnt make sense because there is the same effect ) and grub edit/console. I tried to connect via ssh and I can only login for ubuntu user not root. So only way to enter to root directory is using any distro live linux and then no problem to get root data and all files on the disk. Maybe problem is related to vm disk corruption ? What can I do to run my machine in text mode ?


Solution 1:

Ok the problem I solved. If you have sudoers users then you can connect via ssh to machine. If you dont have one then to run rescue iso or live distro. I have used Linux Mint. ( Machine must have to boot from rescue disk and attached disk with our problematic system ) Next it need to mount it and do chroot like this:

$ su sudo
$ fdisk -l                           ### disk list ( sda1, sda2 ..)
$ mount /dev/sda1 /mnt/ubuntu        ### if not mounted
$ mount --rbind /dev /mnt/dev
$ mount --rbind /proc /mnt/proc
$ mount --rbind /sys /mnt/sys
$ chroot /mnt

and next steps are shared:

$ vim /etc/default/grub

#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX="text"
GRUB_TERMINAL="console"

and update settings:

$ update-grub
$ systemctl set-default multi-user.target

Next to restart system changing boot order on the right one ... and FINISH :)