You are not logged in.
Pages: 1
Well, I can get a list of boot IDs from journalctl --list-boots. But what to do if I want only the current one without reading all the journals?
Last edited by lilydjwg (2015-10-05 08:32:43)
Offline
Offline
I don't see any mention about boot IDs on that wiki page. Also I've checked some related manpages on journald and systemd but didn't see a light way to get the current boot ID.
Offline
But what to do if I want only the current one without reading all the journals?
Show all messages from this boot:
# journalctl -b
Offline
@jasonwryan: that's assuming OP wants to obtain the boot ID only to pass it to -b.
Well, I can get a list of boot IDs from journalctl --list-boots. But what to do if I want only the current one without reading all the journals?
This is a little confusing: you know how to get the boot IDs, why would you need to "read all the journals"? If you mean you have a long list of boots to scroll through, use `tail -1` or, for the ID without other fields:
$ journalctl --list-boots | awk 'END {print $2}'
Offline
I mean the boot ID that systemd assgins to each boot, not the logs.
I can get the machine ID by `cat /etc/machine-id`, but I'm curious how to get the boot ID.
Offline
OK, I've got it by reading the sources of journalctl. It's in /proc/sys/kernel/random/boot_id.
Offline
@jasonwryan: that's assuming OP wants to obtain the boot ID only to pass it to -b.
This is a little confusing: you know how to get the boot IDs, why would you need to "read all the journals"? If you mean you have a long list of boots to scroll through, use `tail -1` or, for the ID without other fields:$ journalctl --list-boots | awk 'END {print $2}'
I presume journalctl will read the journals to find out what boot IDs it has. Anyway, it takes relatively a lot of time to get 128bit data that the system surely stores somewhere. I thought it's done by systemd, but it turns out the kernel generates it at /proc/sys/kernel/random/boot_id, and it's been there at least ten years ago!
I'm not going to pass it to journalctl. I see systemd has used it in private /tmp mount points and I may find a similar use in the future.
Offline
Pages: 1