Display System Logs In Chroot ?

Home » CentOS » Display System Logs In Chroot ?
CentOS 2 Comments

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.

2 thoughts on - Display System Logs In Chroot ?

  • I’ll answer that myself, since I just got to the root of the problem. I just got contacted by the hosting company, and they made a mistake. So tl;dr I just have to wait until things get back to normal.

    In the meantime, I would be curious though : how *do* you read system logs in chroot ?

    Cheers,

    Niki

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

    ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

  • As far as I know: the same way you do when you’re not in a chroot. 
    *Reading* logs doesn’t seem to involve connecting to journald, so:

    less /var/log/messages (or another log file)
    journalctl ….