My computer is freezing from time to time. It's because I make few mistakes and I ruined my system. I don't have any time to reinstall the system now. While my PC is frozen, it still works when I press Ctrl+Alt+F1. Is there any way to reboot system using it?
Pressing Ctrl+Alt+F1 brought you from X11 (the GUI) to a virtual console. You can certainly reboot from here.
The easiest way to reboot from a virtual console is to just press Ctrl+Alt+Delete. You don't even need to log in first, though it would not be a problem if you did. Unlike on the old DOS systems, pressing Ctrl+Alt+Delete in a GNU/Linux system like Ubuntu actually performs a proper shutdown and clean reboot.
This doesn't work in the GUI (unless you've set it up to, or you're running a really old distro). But it does work in any virtual console that doesn't have X11 running in it (unless you've set it up not to, which is rare).
Another way is to log in and run
sudo reboot
. You'll be asked for your password to log in on the virtual console, and you'll be asked for it again forsudo
. It's the same password both times, and you won't see any placeholder characters (like*
) appear as you're typing it. Type it in and press Enter.However, instead of rebooting, you might consider:
Restarting just the GUI. Your desktop environment and all running programs will swiftly quit (so you must usually be as careful with this as with a reboot), the GUI will be restarted, and the graphical login screen will come back up, when you run:
This works by stopping and starting the display manager. That particular command actually only works if your display manager is LightDM, which it is by default on most Ubuntu systems. The main exception is if you are running Ubuntu GNOME, which uses GDM:
Attempting to close just the offending program. Though no program should cause the whole GUI to freeze, it can occasionally happen. You can log in (see above) and run
top
see the currently running processes, sorted by CPU usage. (Press Q to quittop
itself.) A program that's causing the GUI to freeze is not necessarily using lots of CPU, but this is a place to start.You can also use the
ps
command to find the process ID or name of a program you know you want to try to quit, and thekill
orkillall
command to quit it by number or name, respectively. As suggested by its name,killall
attempts to kill all processes that have the name you give it. (The name of a process is not necessarily the same as the name shown to you in its launcher icon or title bar.)Be careful when rebooting, no matter how you do it:
See also What should I do when Ubuntu freezes?
Run following command:
Or
Both command will perform a reboot/restart on your system. If that does not work, hold the power key down for a couple of seconds, release it and press it again to start the pc.
If the system happens to running 16.04 release (you can check it with
lsb_release -r
), then no need forsudo
privilege on restart command. Simply runreboot
will do the jobs.Once in console mode, run the following:
sudo init 6
init 6
basically tells theinit
process to shutdown all of the spawned processes/daemons as written in the init files (in the inverse order they started) and lastly invoke theshutdown -r
now command to reboot the machine