LOL (anarchist.nexus)
 
LOL
you are viewing a single comment's thread
view the rest of the comments
[–] 15 points 1 year ago (18 children)

I do yes | sudo pacman -Syu && sudo poweroff

(Update and poweroff)

  • source
  • hideshow 18 child comments
  • [–] 7 points 1 year ago (8 children)

    "&&" will only run shutdown if the update runs correctly.

    I do ";" to definitely run the shutdown after the update process exits. (Don't want to keep the system running if nothing is happening any more.)

  • source
  • parent
  • hideshow 8 child comments
  • [–] 5 points 1 year ago (6 children)

    I do ";" to definitely run the shutdown after the update process exits.

    If you're able to successfully boot the machine afterwards is not your concern?

  • source
  • parent
  • hideshow 6 child comments
  • [–] 3 points 1 year ago (3 children)

    I don't know about arch but my system usually boots fine after an upgrade. (Gentoo here)

  • source
  • parent
  • hideshow 3 child comments
  • [–] 3 points 1 year ago (2 children)

    If the update is successful. If there are failures in critical steps, well...

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 1 year ago (1 child)

    Doesn't it roll back to a previous state then?

  • source
  • parent
  • hideshow 1 child comment
  • No. It will boot the previous kernel, but the user experience will be at least suboptimal if some packages have already been removed during the upgrade, but the upgrade stopped at some point because a downloaded package was corrupt, leaving lots of dependent packages unconfigured. In case networking doesn't work, it's also inconvenient to manually download the affected package on another machine and transfer it with a usb stick onto the computer to restart the upgrade.

  • source
  • parent
  • [–] 5 points 1 year ago* (4 children)

    Assuming you enter your password upon running sudo, isn't there the risk of sudo's privilege timing out if pacman takes too long to complete? I believe I tried something similar, intending to run a one-liner I could start then walk away from. However, I ended up returning to see the system not rebooted hours later.

    Or is yes somehow supposed to take care of this? Sorry, newish Debian user here who hasn't ventured outside the distribution much.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 5 points 1 year ago* (last edited 1 year ago) (1 child)

    Yes, in this command one liner, the system should not power off when the update took too long.

    Or is yes somehow supposed to take care of this?

    No, yes is simply answering all questions asked during the update procedure (start upgrade, replace config files, restart services) with "yes".

  • source
  • parent
  • hideshow 1 child comment
  • There's no timeout for sudo. When permitted, a process runs as root and then closes.

    Also, the system will still shutdown when update fails because pipes do not care if previous commands exit with a nonzero code, unless pipefail is set.

    Edit: i'm blind.

  • source
  • parent
  • [–] 4 points 1 year ago* (1 child)

    The command after && runs only if the previous command returns non-error exit status (0), if pacman returns error the latter command won't be executed.

    Additionally there's probably a configuration option for sudo for it to not time out, but it doesn't matter since you can just use systemctl reboot as a normal user to reboot your system (at least on Debian). If that's too long I recommend to add this to your .bashrc (if you use Bash): alias reb='systemctl reboot' or something similar.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 1 year ago

    Maybe this is just a yay thing but I think if sudo priveleges run out while downloading the files it prompts you for your password again before performing the changes. That would lead to it either trying to use the yes output or getting stuck in the password prompt, only failing in the prior.

    This entire problem could be solved by just running it as the root user.

  • source
  • parent