I am just curious to know the time taken by my system to boot.
In Arch Linux there is something like systemd-analyze
.
What is the alternative in Ubuntu?
Right after boot, run dmesg
command. It shows you what you want.
dmesg
not meant specifically for boot. In between the system ready and user logging in, there may be extra message which wont tell reliable amount of time system booted
Mar 11, 2016 at 7:59
Without installing any software, you can use uptime
, a native linux command, which serves to show how long computer has been running. The uptime
command executed right after you boot the system will give you a general idea. However, it will take you extra seconds to enter password and login. Better approach would be to set calling uptime > /opt/BOOT.txt
as part of lightdm startup script. It will be executed once the login screen shows up.
To do that , open or create /etc/lightdm/lightdm.conf
file with root permissions.
It should contain the following lines:
[SeatDefaults]
greeter-setup-script=uptime > /opt/BOOT.txt
After your next reboot there will be file /opt/BOOT.txt
which will tell you how long system has been up.
Alternatively you could read /proc/uptime
where the first entry is uptime in seconds
greeter-setup-script=[command]
didn't work for me. After few trials and errors, I found that greeter-setup-script=bash -c '[command]'
works instead. Redirect to /tmp/test.log
also works, for automated file clean up at every boot. Ubuntu and its derivative users should look for .conf
file in /etc/lightdm/lightdm.conf.d/
instead.
.conf
file does not exist and can be created as the answer has pointed. But I have no idea why this method doesn't work anymore in 16.04.
lightdm.conf
, ensure that output is not redirected to the same file. I think this solves the issue.
systemd-analyze is there on ubuntu.
You can only use that if you are using systemd as boot. dmesg -d would give you time taken for each command on boot process to execute..
You can always get systemd-analyze by using
sudo apt-get install systemd systemd-analyze
You're looking for bootchart
.
sudo apt-get install bootchart
It drops an image as well as the compressed log in your /var/log
showing processes and so on.
PROTIP: You may have to run sudo update-initramfs -u -k all
to get it to run at the earliest opportunity.
systemd
is available since 15.10 version, 14.04 still relies on upstart. So you may use that command in versions 15.10 and upsystemd
is available since 15.04