hippy
Posts: 7166
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

[Solved] Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 1:19 am

Well that's annoying ... 'sudo apt-get upgrade' ...

Code: Select all

Installing new version of config file /etc/xdg/lxpanel/LXDE-pi/panels/panel ...

Configuration file '/etc/xdg/lxsession/LXDE-pi/autostart'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** autostart (Y/I/N/O/D/Z) [default=N] ? n^Hd
Installing new version of config file /etc/xdg/lxsession/LXDE-pi/desktop.conf .
I guess I should have been looking at the screen while typing, but I'm now not sure what it's done.
Last edited by hippy on Thu Dec 12, 2019 5:11 pm, edited 1 time in total.

klricks
Posts: 7038
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 1:52 am

If you don't use autostart then forget about it.

The only difference between the old and new version is this command has been removed:

Code: Select all

point-rpi
This command automatically places the mouse pointer on the Raspberry menu icon at each boot. Many found that to be annoying: https://www.raspberrypi.org/forums/view ... 3&t=243877
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

User avatar
rpdom
Posts: 16774
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 2:31 am

You should find the new version of the file as /etc/xdg/lxsession/LXDE-pi/autostart.dpkg or /etc/xdg/lxsession/LXDE-pi/autostart.new I can't remember which, but dpkg usually keeps a copy of the new version or old version of a config file depending on which option you choose.
Unreadable squiggle

fruitoftheloom
Posts: 22677
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 6:05 am

hippy wrote:
Wed Dec 11, 2019 1:19 am
Well that's annoying ... 'sudo apt-get upgrade' ...

Code: Select all

Installing new version of config file /etc/xdg/lxpanel/LXDE-pi/panels/panel ...

Configuration file '/etc/xdg/lxsession/LXDE-pi/autostart'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** autostart (Y/I/N/O/D/Z) [default=N] ? n^Hd
Installing new version of config file /etc/xdg/lxsession/LXDE-pi/desktop.conf .
I guess I should have been looking at the screen while typing, but I'm now not sure what it's done.

Use APT as per recommendation and you will not see that long winded text:

https://www.raspberrypi.org/documentati ... pdating.md
Rather than negativity think outside the box !

Asus ChromeBox 3 Celeron is my other computer.

hippy
Posts: 7166
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 12:49 pm

fruitoftheloom wrote:
Wed Dec 11, 2019 6:05 am
Use APT as per recommendation and you will not see that long winded text:

https://www.raspberrypi.org/documentati ... pdating.md
So what would APT have done; simply overwritten my existing file, or not overwritten it ?

I can't see how doing either is better than how apt-get does it which gives me the choice of what to do before potentially breaking what I have.

I am actually perfectly happy with the apt-get text which asks me what to do. The only issue was in its handling of my response. I selected an initial 'n' to keep what I had, but then decided it was better to look at the differences before deciding what to do. I backspaced and change to a 'd' so I could. It ignored that, didn't show the differences, didn't report on what it had done.

I am guessing it kept the old version. But I'm not sure how to find out what it would have changed it to, whether I made the right decision or not, or how I get out of that if I have made the wrong decision.

hippy
Posts: 7166
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 12:51 pm

klricks wrote:
Wed Dec 11, 2019 1:52 am
The only difference between the old and new version is this command has been removed:
point-rpi
Thanks. So little harm done in this case whichever had been chosen.

GlowInTheDark
Posts: 463
Joined: Sat Nov 09, 2019 12:14 pm

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 1:06 pm

I think there are two separate issues here:

1) The specific case - what to do about that autostart file. I think that has been well covered.

2) The more generic issue of: is there anything that can be done about the upgrade process stopping and needing user input. This has two implications:

a) It means you can't do a fully automated ("no touch") upgrade. You can't walk away and come back in half an hour or so and expect it to be done. You can't (as some people on this forum have suggested over the years) put it on a cron job.

b) The unsophisticated user won't know what to do. We can't just tell them "Do the upgrade and everything will be fine". There's no real answer to this; about the only advice that can be given is "If in doubt, take the default".

I realize that there is no simple answer to this. If there were, presumably, apt-get would know what to do and would do it. The fact that they have to prompt, means there really is a problem.

BTW, what I just wrote is not 100% true. Sometimes, the upgrade process stops to display some kind of message (often about security/SSL stuff) that either doesn't require *any* user input or if it does, it is pretty clear what the correct action to take is. I.e., it could just go ahead and do it and not bother the user with a bunch of unnecessary "stuff" as well as unnecessarily pausing the process.

But, as they say, it is what it is...
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth

User avatar
rpdom
Posts: 16774
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 1:23 pm

hippy wrote:
Wed Dec 11, 2019 12:49 pm
So what would APT have done; simply overwritten my existing file, or not overwritten it ?

I can't see how doing either is better than how apt-get does it which gives me the choice of what to do before potentially breaking what I have.
If apt does overwrite the file without asking, then I am definitely not going to use it ever again. I realise that is a Debian issue, not a Raspbian one, but overwriting config files (if that is the case) without asking is just not acceptable.
I'll stick with apt-get, which is proven and has worked for years.
Unreadable squiggle

User avatar
davidcoton
Posts: 4779
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 1:51 pm

rpdom wrote:
Wed Dec 11, 2019 1:23 pm
If apt does overwrite the file without asking, then I am definitely not going to use it ever again. I realise that is a Debian issue, not a Raspbian one, but overwriting config files (if that is the case) without asking is just not acceptable.
I'll stick with apt-get, which is proven and has worked for years.
AIUI, that is backwards.
Apt is intended to be interactive, it should always prompt (while offering a default, if appropriate).
Apt-get, OTOH, is intended to be unattended. If it asks a question, it's because there is no obvious default, or the consequences of a wrong answer are significant.
So apt should be the safer option for retaining human decision-making.
DISCLAIMER: I have not examined or tested the code, so the theoretical answer given may not be what is actually implemented.
Signature retired

GlowInTheDark
Posts: 463
Joined: Sat Nov 09, 2019 12:14 pm

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 2:11 pm

I doubt there's much difference between "apt" and "apt-get" here.

The issue seems to just be a bit of lazy coding in terms of how it accepts and parses user input on that prompt. It looks like the OP backspaced to try to change his answer and somehow whatever input routine the program was using got confused and mis-interpreted the user input. This is, obviously, a coding error and a potentially serious one in that it caused what might have been a critical file to get over-written.

As I said earlier, the real issue is that most users (including myself!) really don't know what answer to give, so maybe the program should just make its own best guess (i.e., not prompt at all).
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth

hippy
Posts: 7166
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 2:13 pm

The problem is that there is no obvious safe course unless apt/apt-get gains some option to be able to merge what there is with what the proposed default would be.

Any update process which makes the choice itself, doesn't ask the user what to do, will eventually make a choice which turns out to be the wrong one. What the correct choice should be will vary depending on its affect.

If it overwrites the existing configuration; all a user's hard work is discarded and that may render the system unusable or inaccessible.

If it doesn't overwrite then something new and essential may not be added which could equally render the system unusable or inaccessible.

The additional problem is a user often doesn't know what is essential and what isn't, can't easily or immediately make an informed choice as to what to do.

It also seems that, along with 'do this or that', there ought to be an option to cancel the upgrade to allow time for the user to go and research what the choice should be, what the affect of each choice would be.
Last edited by hippy on Wed Dec 11, 2019 2:18 pm, edited 1 time in total.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26063
Joined: Sat Jul 30, 2011 7:41 pm

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 2:14 pm

I would be VERy surprised if there is a coding error in apt that has not been spotted elsewhere - it's not like we are the only people using it.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

bjtheone
Posts: 571
Joined: Mon May 20, 2019 11:28 pm
Location: The Frozen North (AKA Canada)

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 2:23 pm

GlowInTheDark wrote:
Wed Dec 11, 2019 1:06 pm
2) The more generic issue of: is there anything that can be done about the upgrade process stopping and needing user input. This has two implications:

a) It means you can't do a fully automated ("no touch") upgrade. You can't walk away and come back in half an hour or so and expect it to be done. You can't (as some people on this forum have suggested over the years) put it on a cron job.

b) The unsophisticated user won't know what to do. We can't just tell them "Do the upgrade and everything will be fine". There's no real answer to this; about the only advice that can be given is "If in doubt, take the default".

I realize that there is no simple answer to this. If there were, presumably, apt-get would know what to do and would do it. The fact that they have to prompt, means there really is a problem.

BTW, what I just wrote is not 100% true. Sometimes, the upgrade process stops to display some kind of message (often about security/SSL stuff) that either doesn't require *any* user input or if it does, it is pretty clear what the correct action to take is. I.e., it could just go ahead and do it and not bother the user with a bunch of unnecessary "stuff" as well as unnecessarily pausing the process.

But, as they say, it is what it is...
Not sure if I agree with you. If you have a generic/default system it will work just fine. If you have made changes to system config files what do you think it should do? It could automatically overwrite your changes (will toss whatever customizations you made, and maybe break the system, certainly will change the way you expect it to behave), keep your changes and not get whatever is new (new functionality may not work or you may end up with a broken system), or try and merge the two files (a fairly sure recipe for disaster). Personally I run updates interactively and actually read the info. In most cases the best approach it going to be take the new, and then add back in your changes after you validate that they are still relevant/correct. You do keep copies of changed system config files right?

The unsophisticated user should not be mucking about in system config files, unless they are willing to accept the consequences. Just because you can, does not mean you should. This is one of my biggest pet peeves. Assuming a similar level of knowledge, most folks would never consider tinkering with a car engine or changing their electrical panel, but happily will follow a web page or youtube video blindly, without a clue of what the commands are actually doing. These same people then get upset when their system breaks horribly, and when asked tend to say "I did nothing". I have no issues with people tinkering and learning if that is their intent. The Pi is great for that... make a copy of your SD card and tinker away. If it breaks, swap the card and voila you are back to an unbroken system. But you at least need to understand the ramifications of what you are doing. If you change stuff, it may break. If you go down the rabbit hole of trying to apply a incorrect set of instructions written for a different version of the distro, or even for a different distro you may break it horribly enough that your only sane recourse is starting from scratch with a reinstall.

This is also why it is a good idea, whenever possible, to tweak configuration files at the user level rather than the system. A system update will never overwrite user level changes and it is fairly easy to resolve unexpected behaviour by testing with a generic test account.

You certainly can do unattended updates. If you want finer grained control use apt-get and the "quiet" and "yes" options. However, understand that doing so comes with certain risks as it will make decisions for you. If you are worried about stuff you could always do a simulation and check what it is going to do and then run it.

MarkTF
Posts: 315
Joined: Tue Mar 03, 2015 4:59 pm

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 2:27 pm

jamesh wrote:
Wed Dec 11, 2019 2:14 pm
I would be VERy surprised if there is a coding error in apt that has not been spotted elsewhere - it's not like we are the only people using it.
According to the original post listing, it looks like the response character string "n <backspace> d" was interpreted as if it were "n" rather than "d". Not sure if that's the fault of apt, the shell, or something else, but it isn't the expected behavior.
Last edited by MarkTF on Wed Dec 11, 2019 5:17 pm, edited 1 time in total.

hippy
Posts: 7166
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 3:07 pm

MarkTF wrote:
Wed Dec 11, 2019 2:27 pm
According to the original post listing, it looks like the response character string "n <backspace> d" was interpreted it as if it were "n" rather than "d". Not sure if that's the fault of apt, the shell, or something else, but it isn't the expected behavior.
Exactly that; I typed 'n', 'backspace', 'd', 'return', without paying attention to what was actually appearing on the screen. Had expected the backspace to cause the 'n' to be deleted/ignored, the 'd' to be actioned. it wasn't.

I am guessing it ended up seeing a three/four character string which, starting with 'n', was taken as an 'n' response.

That is also what happens when typing a username or password for the login prompt; 'p', 'o', 'backspace', 'i' appears to be taken as a four/five character username rather than the two one wanted it to take -

Code: Select all

Raspbian GNU/Linux 10
Pi3B login: po^Hi
Password: 

Login incorrect
So I would say it's something more systemic than just apt-get which isn't handling backspace as one would expect it to.

But the odd thing is that it behaves as expected when backspace is used at the command line or within nano. But interestingly ... typing 'p', 'o', 'backspace', 'i' in both cases ...

Code: Select all

[email protected]:~ $ read -e choice
pi
[email protected]:~ $ echo $choice
pi
[email protected]:~ $ [ ${#choice} -ne 2 ] && echo "not two chars" || echo "two chars"
two chars

Code: Select all

[email protected]:~ $ read choice
po^Hi
[email protected]:~ $ echo $choice
pi
[email protected]:~ $ [ ${#choice} -ne 2 ] && echo "not two chars" || echo "two chars"
not two chars
[email protected]:~ $ [ ${#choice} -ne 4 ] && echo "not four chars" || echo "four chars"
four chars
Seems it's something to do with that "-e".

User avatar
Paeryn
Posts: 2905
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 6:21 pm

Using read -e tells it to use readlne to get the input with has editing facilities, without -e it takes raw input exactly as it is given.
She who travels light — forgot something.

hippy
Posts: 7166
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 7:53 pm

Paeryn wrote:
Wed Dec 11, 2019 6:21 pm
Using read -e tells it to use readlne to get the input with has editing facilities, without -e it takes raw input exactly as it is given.
And I would guess that when apt-get asks for what to do it's similarly reading that raw line rather than doing a readline, hence treating backspace as a character rather than a delete last character.

So that would seem to be a prima facie bug with apt-get, but I would suggest it's still more systemic than that seeing as getty (?) does the same when logging in. It seems hard to imagine two, and possibly more, things would deliberately choose to use input methods which do not support backspace and presumably any other line editing commands.

For apt-get it makes it impossible to change one's mind once the first character has been typed, no matter how damaging one then realises that may be. The only way out being Ctrl-C which probably terminates the apt-get completely.

I guess the issue with apt-get is it's not checking the validity of the string it receives; but why would it when it believes it will get exactly what the user typed which will be correct ?

The issue when logging in isn't a problem, it's more an annoyance, one simply gets asked to try again. But for apt-get doing other than the user wanted, as pointed out by someone else, could be disastrous.

Something seems clearly not right but I don't know what that would be.

GlowInTheDark
Posts: 463
Joined: Sat Nov 09, 2019 12:14 pm

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 9:25 pm

seeing as getty (?) does the same when logging in
I believe that the issue when logging in is that classic Unix has @ for line kill and # for character erase.

Now, obviously, nowadays, no one uses these characters, but at the getty/login level, those are still in effect. The effect is that you can't really do any line editing at this point - if you make a mistake, you just have to do it over.
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth

User avatar
PeterO
Posts: 5736
Joined: Sun Jul 22, 2012 4:14 pm

Re: Annoying feature of 'apt-get uprgade'

Wed Dec 11, 2019 9:31 pm

My understanding is that apt-get was originally intended to be "scripted" and as such probably never expected to have to deal with users who change their mind after typing a few characters.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

hippy
Posts: 7166
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 12:54 am

GlowInTheDark wrote:
Wed Dec 11, 2019 9:25 pm
I believe that the issue when logging in is that classic Unix has @ for line kill and # for character erase.
That doesn't seem to apply to the login prompt nor 'read', both '#' and '@' are taken as literal characters, even if nothing follows them ...

Code: Select all

[email protected]:~ $ read choice
po#i
[email protected]:~ $ echo $choice
po#i
[email protected]:~ $ [ ${#choice} -ne 4 ] && echo "not four chars" || echo "four chars"
four chars

Code: Select all

[email protected]:~ $ read choice
[email protected]
[email protected]:~ $ echo $choice
[email protected]
[email protected]:~ $ [ ${#choice} -ne 4 ] && echo "not four chars" || echo "four chars"
four chars
PeterO wrote:
Wed Dec 11, 2019 9:31 pm
My understanding is that apt-get was originally intended to be "scripted" and as such probably never expected to have to deal with users who change their mind after typing a few characters.
That makes sense but rather makes apt-get not fit for purpose when it is used interactively.

User avatar
PeterO
Posts: 5736
Joined: Sun Jul 22, 2012 4:14 pm

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 9:27 am

hippy wrote:
Thu Dec 12, 2019 12:54 am
That makes sense but rather makes apt-get not fit for purpose when it is used interactively.
Which I think is why the current advice is to use "apt" instead. See man apt ....

Code: Select all

DESCRIPTION
       apt provides a high-level commandline interface for the package
       management system. It is intended as an end user interface and enables
       some options better suited for interactive usage by default compared to
       more specialized APT tools like apt-get(8) and apt-cache(8).
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

hippy
Posts: 7166
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 11:39 am

PeterO wrote:
Thu Dec 12, 2019 9:27 am
hippy wrote:
Thu Dec 12, 2019 12:54 am
That makes sense but rather makes apt-get not fit for purpose when it is used interactively.
Which I think is why the current advice is to use "apt" instead.
But if 'apt' simply overwrites user modified configuration files, or if it doesn't, doesn't offer a choice, that's potentially more problematic than the issue with 'apt-get', arguably even less fit for purpose.

User avatar
PeterO
Posts: 5736
Joined: Sun Jul 22, 2012 4:14 pm

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 1:05 pm

hippy wrote:
Thu Dec 12, 2019 11:39 am
PeterO wrote:
Thu Dec 12, 2019 9:27 am
hippy wrote:
Thu Dec 12, 2019 12:54 am
That makes sense but rather makes apt-get not fit for purpose when it is used interactively.
Which I think is why the current advice is to use "apt" instead.
But if 'apt' simply overwrites user modified configuration files, or if it doesn't, doesn't offer a choice, that's potentially more problematic than the issue with 'apt-get', arguably even less fit for purpose.
Do you have any evidence that apt has different behaviour to apt-get in this respect ?
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Aydan
Posts: 717
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 1:17 pm

hippy wrote:
Thu Dec 12, 2019 11:39 am
But if 'apt' simply overwrites user modified configuration files, or if it doesn't, doesn't offer a choice, that's potentially more problematic than the issue with 'apt-get', arguably even less fit for purpose.
I think apt overwrites config files only when they have not been changed by the user. Otherwise it pops up the same message about resolving the conflict.

Regards
Aydan

fruitoftheloom
Posts: 22677
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 1:21 pm

Aydan wrote:
Thu Dec 12, 2019 1:17 pm
hippy wrote:
Thu Dec 12, 2019 11:39 am
But if 'apt' simply overwrites user modified configuration files, or if it doesn't, doesn't offer a choice, that's potentially more problematic than the issue with 'apt-get', arguably even less fit for purpose.
I think apt overwrites config files only when they have not been changed by the user. Otherwise it pops up the same message about resolving the conflict.

Regards
Aydan

Seems like much ado about nothing !!
Rather than negativity think outside the box !

Asus ChromeBox 3 Celeron is my other computer.

Return to “General discussion”