[CentOS] Display system logs in chroot ?

Sun Apr 12 08:06:09 UTC 2020
kikinovak <kikinovak at protonmail.com>

Hi,
This morning my day began quite badly, since my main production server wasn't responsive anymore. For public hosting I'm using a "Dedibox Pro" server at the french provider Online that's recently been acquired by Scaleway. I'm currently managing half a dozen public servers at that provider, all running CentOS 7.
For debugging purposes, Online's web console enables you to boot the machine into a live rescue system, in that case Ubuntu 18.04.
Once I managed to connect via SSH to the live system, here's what I did.
Mount the root partition :
# mount /dev/sda2 /mnt
Mount the /boot partition :
# mount /dev/sda1 /mnt/boot
Then :
# mount --rbind /proc /mnt/proc
# mount --rbind /dev /mnt/dev
# mount --rbind /sys /mnt/sys
And then I chroot into the system :
# chroot /mnt /bin/bash
I had networking in the chroot environment. I tried to disable a handful of services like fail2ban and firewalld to begin with, but systemctl won't run in a chroot. So what I did was simply remove everything related to fail2ban and firewalld.
Next thing was to look at the system logs to know what went wrong on startup, but I don't know how to do that from within a chroot.
Any suggestions?
Cheers,
Niki
PS : sorry for bad formatting. Since the unresponsive server is also running all my mails, I had to setup a Protonmail account to post on this list.

Sent with [ProtonMail](https://protonmail.com) Secure Email.