Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: How do I check if a reboot is required after upgrading using apt-get?

  1. #1
    Join Date
    May 2019
    Beans
    3

    How do I check if a reboot is required after upgrading using apt-get?

    I would like to know if it's possible to check whether a reboot is required or not after upgrading packages using apt-get. Certain packages warn you about upgrading the system, like intel-microcode, which warns the following when upgrading:
    Code:
    intel-microcode: microcode will be updated at next boot
    But there are packages that don't warn you. The kernel is one of them.

    I've tried searching a way to know this on the Internet, but most websites check the presence of the /var/run/reboot-required file. The file is created by the update manager but apt-get doesn't create it (at least it doesn't on my system).

    How do I check if a reboot is required after using apt-get?
    If it's relevant, I'm using Ubuntu MATE 18.04.2 LTS.

    Thanks in advance.

  2. #2
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    4,075

    Re: How do I check if a reboot is required after upgrading using apt-get?

    Why not use Software Updater? When Software Updater utility finishes updating, if a restart is necessary to complete the update, it will pop up a message box informing you that the computer needs to restart to complete the updates. There are two options presented: Restart Now and Restart Later.

  3. #3
    Join Date
    Mar 2010
    Beans
    8,554
    Distro
    Ubuntu Mate

    Re: How do I check if a reboot is required after upgrading using apt-get?

    As far as I can tell there is no way to use apt or apt-get to provide the information you want.

    Either use the method Dennis N suggests or perhaps this would work:

    Code:
    cat /var/run/reboot-required.pkgs
    Output would be, just as an example, something like this (assuming there is something that requires a restart since the file is only created if the need exists):

    Code:
    linux-image-4.4.0-92-generic
    Then, run:

    Code:
    sudo reboot

  4. #4
    Join Date
    Jul 2010
    Location
    ozarks, Arkansas, USA
    Beans
    13,198
    Distro
    Xubuntu 18.04 Bionic Beaver

    Re: How do I check if a reboot is required after upgrading using apt-get?

    janlz; Hello -

    I am aware of a couple of means to see what the system thinks in respect to a required reboot.

    When a reboot is required these files will exist:
    • /var/run/reboot-required
    • /var/run/reboot-required.pkgs
    • /usr/lib/update-notifier/apt-check --human-readable


    hope this helps
    THE current(cy) in Documentation:
    https://help.ubuntu.com/community/PopularPages

    Happy ubuntu'n !

  5. #5
    Join Date
    Sep 2006
    Beans
    1,452
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: How do I check if a reboot is required after upgrading using apt-get?

    Hello,

    if I choose to logout then it informs me that some system updates won't be applied unless reboot takes place. Then I can choose cancel and reboot.

    Regards!

  6. #6
    Join Date
    Apr 2008
    Location
    Norwich CT
    Beans
    2,491
    Distro
    Ubuntu Mate

    Re: How do I check if a reboot is required after upgrading using apt-get?

    Anything related to the kernel, like nVidia drivers, or a new kernel, do require a reboot. Otherwise, there's no need to do it, in my experience. There are a few programs that have to be in the startup-sequence, and, of course, it being Linux, there's no need to reboot unless you want to.

    Few programs inform you that a reboot is needed. The examples above are when I personally reboot, and know a reboot is needed.

    By the way, use apt instead of apt-get. Apt is, IMHO, superior to apt-get.
    Last edited by oldrocker99; 2 Days Ago at 03:49 PM.

    I drink my Ubuntu black, no sugar.
    Ubuntu user 28819

  7. #7
    Join Date
    May 2019
    Beans
    3

    Re: How do I check if a reboot is required after upgrading using apt-get?

    Quote Originally Posted by Dennis N View Post
    Why not use Software Updater? When Software Updater utility finishes updating, if a restart is necessary to complete the update, it will pop up a message box informing you that the computer needs to restart to complete the updates. There are two options presented: Restart Now and Restart Later.
    Because the software updater doesn't show updates that are not security updates as soon as they're available. I've sometimes checked if there are any updates available using the software updater but it said there weren't. But if I checked using apt-get, they were shown.

    Quote Originally Posted by Rubi1200 View Post
    As far as I can tell there is no way to use apt or apt-get to provide the information you want.

    Either use the method Dennis N suggests or perhaps this would work:

    Code:
    cat /var/run/reboot-required.pkgs
    Output would be, just as an example, something like this (assuming there is something that requires a restart since the file is only created if the need exists):

    Code:
    linux-image-4.4.0-92-generic
    Then, run:

    Code:
    sudo reboot
    Quote Originally Posted by Bashing-om View Post
    janlz; Hello -

    I am aware of a couple of means to see what the system thinks in respect to a required reboot.

    When a reboot is required these files will exist:
    • /var/run/reboot-required
    • /var/run/reboot-required.pkgs
    • /usr/lib/update-notifier/apt-check --human-readable

    hope this helps
    These files are only created when the update manager tells me an update is available, because I configured it to show them immediately. If I update using apt-get and run the software manager afterwards, it warns me a reboot is required even if I didn't update anything using it. But it doesn't always work.

    Quote Originally Posted by Claus7 View Post
    Hello,

    if I choose to logout then it informs me that some system updates won't be applied unless reboot takes place. Then I can choose cancel and reboot.

    Regards!
    I tried this on a virtual machine and I'm not told that if I log out. Are you using Ubuntu MATE?

    Quote Originally Posted by oldrocker99 View Post
    Anything related to the kernel, like nVidia drivers, or a new kernel, do require a reboot. Otherwise, there's no need to do it, in my experience. There are a few programs that have to be in the startup-sequence, and, of course, it being Linux, there's no need to reboot unless you want to.

    Few programs inform you that a reboot is needed. The examples above are when I personally reboot, and know a reboot is needed.
    Well, that's what I'm currently doing as well, if a package like systemd is upgraded, I reboot the computer. If it's a program like Firefox, then I just close any Firefox process I'm running. But it would be nice if I were warned when a reboot is required.

  8. #8
    Join Date
    Sep 2006
    Beans
    1,452
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: How do I check if a reboot is required after upgrading using apt-get?

    Hello,

    Quote Originally Posted by janlz View Post
    I tried this on a virtual machine and I'm not told that if I log out. Are you using Ubuntu MATE?
    I'm using flashback. I do not know if the difference in the gtk engine responds differently for these desktop sessions. Not aware how other sessions respond as well.

    Regards!

  9. #9
    Join Date
    May 2019
    Beans
    3

    Re: How do I check if a reboot is required after upgrading using apt-get?

    Quote Originally Posted by Claus7 View Post
    I'm using flashback. I do not know if the difference in the gtk engine responds differently for these desktop sessions. Not aware how other sessions respond as well.
    It looks like this is a GNOME feature that is not present in other flavors. I tested this on my laptop, which has Lubuntu 18.04 LTS installed, and nothing is shown when logging out either.

  10. #10
    Join Date
    Sep 2006
    Beans
    1,452
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: How do I check if a reboot is required after upgrading using apt-get?

    Hello,

    in the old days, if reboot was about to take place, then I remember that the system explicitly informed about such a task and prompted you to close all programs for the changes to take effect...

    xorg and kernel updates for sure require restart, as -more or less- already mentioned from oldrocker99. Not aware of how you will be able to verify it for sure though.

    Good luck,
    Regards!

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •