systemd: lightdm.service: Main process exited, code=exited, status=1/FAILURE / How to log whats happening in a early stage of the booting process

  • Question
    Anonymous
    Inactive

    Hello.

    I’ve upgraded Ubuntu 18.04 to 20.04 on my ARM (32 bit armhf) Chromebook. While Ubuntu 18.04 works perfectly,Ubuntu 20.04 has some kind of problem. I think that during the upgrade something broken.At the beginning I’ve added this lines in rc.local :

    ​

    journalctl –boot –no-pager > /home/linux/log
    exit 0

    ​

    and I’ve got this log file :

    [https://pastebin.ubuntu.com/p/QZMygg8cjP/](https://pastebin.ubuntu.com/p/QZMygg8cjP/)

    ​

    unfortunately,later,the same technique stopped working. It didn’t produce that log file anymore. I tried to execute different commands and binary files putting them before and after “exit 0” on the file /etc/rc.local,but nothing has been created anymore. For example :

    ​

    echo > /home/linux/ciao1
    sudo systemctl set-default multi-user.target
    echo > /home/linux/ciao2
    journalctl –boot –no-pager > /home/linux/log0
    /bin/journalctl –boot –no-pager > /home/linux/log1
    /bin/./journalctl –boot –no-pager > /home/linux/log2
    /bin/./journalctl –boot –no-pager > /log3
    journalctl –boot –no-pager > /log4
    exit 0
    sudo systemctl set-default multi-user.target
    echo > /home/linux/ciao3

    ​

    What do you suggest me to do to ? I imagine that I should understand why it doesnt create a log file anymore and / or I should choose another technique to produce the log file from a different run level ? Anyway,I want to understand how to fix it.

Viewing 0 reply threads
  • Replies
      brokenmkvii
      Guest
      It seems like you are trying to capture boot logs by redirecting the output to a file using the journalctl command in your ‘/etc/rc.local’ file. However, the ‘etc/rc.local’ file is not the recommended way to achieve this in modern Ubuntu.

      In Ubuntu 20.04, traditional ‘rc.local’ is deprecated and may not work reliably due to changes in system initialization. A better way to capture boot logs is by using sytemd services. Here is how you can create a systemd service to capture boot logs:

      Create a systemd service unit file. For example, create a file named /etc/systemd/system/boot-log.service: **”sudo nano /etc/systemd/system/boot-log.service”**

      Add the following content to the boot-log.service file:

      [Unit]
      Description=Capture Boot Logs

      [Service]
      Type=oneshot
      ExecStart=/bin/bash -c “/usr/bin/journalctl –boot –no-pager > /home/linux/boot-log.txt”
      RemainAfterExit=yes

      [Install]
      WantedBy=multi-user.target

      This systemd service runs the journalctl command during boot and redirects the output to a file named boot-log.txt in the /home/linux directory.

      Save the file and exit the text editor.

      Enable the systemd service to run on boot: **”sudo systemctl enable boot-log.service”**

      Start the service manually to capture the current boot logs: **”sudo systemctl start boot-log.service”**

      Check if the boot-log.txt file has been created in the /home/linux directory. You can view its contents to see the captured boot logs: **”cat /home/linux/boot-log.txt”**

      This should help you capture boot logs reliably in Ubuntu 20.04. Make sure to use the systemd service approach rather than relying on /etc/rc.local, which is not recommended for this purpose in newer Ubuntu versions.

Viewing 0 reply threads
  • You must be logged in to reply to this topic.