linuxmint / mintupgrade

42 stars 16 forks source link

Ctrl+C over terminal causes mintupgrade to exit without warning #68

Closed Pullitzer closed 9 months ago

Pullitzer commented 1 year ago

mintupgrade 2022.08.13 Current OS: Linux Mint 20.3 ? Upgrade OS: LightDM Distro: Linux Mint 21 Vanessa base: Ubuntu 22.04 jammy

Thanks to the team for all the work in automating the Mint upgrade process.

A few people have posted this issue around the web. It's easy to dismiss it as a newbie / PEBKAC issue but there's more to it than that. This is small and easy to fix but extremely user unfriendly. If the goal here is to create a friendly, automated Mint upgrade tool then this would be a good fix to make.

I had MintUpgrade running and was nearly finished (it was writing boot files). It hadn't stated if/where it was keeping the log so I decided to take a copy of the terminal output before the window closed. I selected all the text in the terminal window and hit Ctrl+C. (Yes, I know, stock terminal is Ctrl+Shift+C but when working back and forth with a web browser its an easy _andminor mistake to make.)

Result: Setting up cryptsetup (2:2.4.3-1ubuntu1.1) ... Traceback (most recent call last): File "/usr/bin/mintupgrade", line 36, in b = sub.stdout.read(32) KeyboardInterrupt

What I suspect is happening here is that mintupgrade is rapidly and repeatedly grabbing focus because of all the updating. I get that and it's not a problem. What needs to be improved is that Ctrl+C needs to be trapped and at the very least prompt in the GUI before killing mintupgrade cold.

I tried to start mintupgrade again:

E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 65650 (apt-get) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it? Error - Return code: 100

At this point, I could go in the back and remove the lock file but it looked like mintupgrade was going to start over with a half-messed version of my OS in an unknown state. It would also be great if mintupgrade looked when it started up to see if it had already run and whether it had any active processes running. I'm not asking for that though - trapping and prompting on Ctrl+C would suffice.

^CTraceback (most recent call last): File "/usr/bin/mintupgrade", line 36, in b = sub.stdout.read(32) KeyboardInterrupt

Please trap Ctrl+C keyboard input and prompt before exiting to reduce the number of botched mintupgrade attempts. It just looks better for the community.

Thanks again for all your hard work. I hope you choose to implement this simple change. The issue has existed since at least Nov 2019.

In the meantime I'm going to TimeShift to today's before snapshot and try the upgrade again.. MintVanessa-UpgradeTerminalOutput-CtrlC.txt

umikali222 commented 12 months ago

That's a function of the terminal, if you run any command, ctrl+c will stop it. If you want to copy any output of a command, highlight what you want to copy with your mouse, press the right mouse button, and click copy. If you don't have any other questions, close the issue.

carlosmintfan commented 8 months ago

This can be fixed and this issue should not be closed. Do you know how?

carlosmintfan commented 8 months ago

Yes, this is a function of the terminal. But do you know you can write an application that shuts down your system or does something else when killing it? LOL Maybe it is not so easy to detect how to do this but I'll show it soon.

carlosmintfan commented 8 months ago

Ohhkay maybe it won't work completely, but at least you could execute something for a few seconds hmm

carlosmintfan commented 8 months ago

Okay, so this is what you can do: If you have installed warpinator 1.8.3, you can edit the /usr/libexec/warpinator/warpinator.py file as follows (as root): Code screenshot Go to the appropiate lines and replace with the content in the screenshot. Then make sure warpinator isn't running. Then, in a terminal, run: warpinator Wait 10 seconds for the server to start. Press Ctrl+C After some seconds, you get an endless loop saying: "I'll never let you stop me." :) killall warpinator will achieve the same resultt :)

carlosmintfan commented 8 months ago

~Oh, the line numbers aren't visible in my screenshot. I'll update it.~ Done.