2

Was attempting to run sudo apt upgradeand hit Ctrl c when it gave me a prompt that I could not figure out how to get out of.

Tried to rerun sudo apt upgrade. Got a message about some kind of lock process being occupied. Foolishly, tried to restart it. This happens after selecting Ubuntu to start. https://i.stack.imgur.com/FzxNO.jpg Any ideas on how to fix that?

dluxcru
  • 123
  • Stopping a package upgrade can do that, easily. Rebooting while the process is still going, the reason for the locked process, also a very bad idea. So, never do that. Now, I think, the fastest solution is reinstall Ubuntu but perhaps other people may have other ideas. –  May 21 '19 at 01:38
  • 2
    I would boot a 'live' medium (eg. Ubuntu install media) and fsck your system. I would try and get it so I could login to runlevel 1 (terminal only running) and then look at what the last package that was being installed in your logs (taking note of it!). I would then sudo apt upgrade and hope it would continue (it may want dpkg-reconfigure if so do it). When completed i'd possibly install --reinstall the aborted package noted earlier. I'd evaluate this by what I saw in messages as steps run. (a re-install something-else no-format can always be done later if it gets messy) – guiverc May 21 '19 at 01:48
  • @guiverc Can you post a more detailed instruction on that as an answer? That should help a lot! – dluxcru May 21 '19 at 02:44

1 Answers1

0

I would boot a 'live' medium (eg. your Ubuntu install media) and fsck your system. fsck is a file-system-check command that will check for, then fix any errors in your file-system. (depending on what fs I'm using, I sometimes use xfs_check but I'm betting fsck will be right for you).

My first purpose would be to hopefully get so I can login to recovery or runlevel 1 (text terminal only and not use gui).

I would login (text term or runlevel 1) and look for the last package that was being installed in your logs (I'd stat /var/log/apt/history.log hoping it'd have a time/date stamp that matches your ^C then view it's contents), taking note of the last installed package (even last 2-3).

I would then sudo apt upgrade and hope it would continue. If it complains and wants me to run any dpkg-reconfigure commands, I'd do what it wants and repeat the sudo apt upgrade until all upgrades were complete (0 remain). Myself I'd probably sudo apt dist-upgrade as well.

When completed i'd possibly sudo apt install --reinstall the aborted package (one being installed when you ^C that was hopefully found & noted earlier).

Of course I'd evaluate this by what I saw in messages as steps run. At this stage it would include a reboot & use of system normally at first to test how it goes.

If I wasn't completely happy with the results, or unsure about anything; I'd consider install --reinstall those packages, or just go to a whole Ubuntu re-install.

My re-install choice would be using "Something else" selecting my partitions and ensuring I had 'no-format' which can be quicker. This option takes note of added packages, erases system directories, then installs, adds back your added software [packages] without touching your user directories or files. I want to trust my systems, so this would be my fall-back if I wasn't happy with any step.

guiverc
  • 30,396
  • this answer is rather hurried; sorry I'm busy currently. – guiverc May 21 '19 at 04:25
  • Thanks so much. I will meet up with one of my techie friends who is usually helpful with this kind of stuff later this week. This answer should let us try some stuff for a fix Even that bit about reinstall is super helpful, might even be easier to just take that reinstall option in particular. – dluxcru May 21 '19 at 05:21
  • 1
    @guiverc You may want to point out, that you can chroot into the installed system and update/fix from there if booting does not work. – Kev Inski May 21 '19 at 07:07
  • 1
    @KevInski is right, but there are loads of situations I haven't covered, these maybe helpful https://askubuntu.com/questions/915617/after-repairing-deleted-kernel-why-would-grub-still-not-boot-into-linux & https://askubuntu.com/questions/234384/how-to-repair-grub-with-live-cd-of-different-version-of-ubuntu (though I'm browsing commands more than headings/text so my reason for grabbing them may be missed). I would watch messages (looking for problems or things that don't look right and adjust accordingly. or search askubuntu, ubuntuforums, or asking on irc etc – guiverc May 21 '19 at 07:49
  • This was pretty helpful. We wound up taking some backups by connecting the disk to another pc with a SATA cable and then doing the final reinstall option you listed. Although this answer could be improved with screenshots of the steps for that option, great work for suggesting it - definitely saved my computer's bacon. – dluxcru May 26 '19 at 03:39