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

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 1:27 pm

(It always does...)

Anyway, I think it is clear from all the discussion that there is no right answer. Most of the time, it is probably right to go ahead and do the overwrite, but just often enough to be annoying, that is not the right answer.

If I were going to write an apt-like utility, and my goals were:

1) To be fully automated. I.e., so that you could set-it-and-forget-it. I.e., come back in half an hour and have it be done. Or, to be able to put it as a cron-job.

and

2) Make it so that end-users don't have to answer questions they are ill-equipped to answer.

Then I would make it just go ahead and do the overwrite.

And, I'd be prepared to accept angry emails from people whose customized config files were lost...

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

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 2:00 pm

PeterO wrote:
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


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
Not personally. I was going by ...
fruitoftheloom wrote:
Wed Dec 11, 2019 6:05 am
Use APT as per recommendation and you will not see that long winded text:
If 'apt' is not asking what I want to do it must be deciding for itself what it's going to do.

Maybe that claim is not correct. I have no evidence either way. I took it at face value that what was claimed was correct.

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

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 2:37 pm

hippy wrote:
Thu Dec 12, 2019 2:00 pm
PeterO wrote:
Thu Dec 12, 2019 1:05 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.
Do you have any evidence that apt has different behaviour to apt-get in this respect ?
PeterO
Not personally. I was going by ...
fruitoftheloom wrote:
Wed Dec 11, 2019 6:05 am
Use APT as per recommendation and you will not see that long winded text:
If 'apt' is not asking what I want to do it must be deciding for itself what it's going to do.

Maybe that claim is not correct. I have no evidence either way. I took it at face value that what was claimed was correct.
Did you follow the link that fruity gave ? It's to a page about upgrading using the "-y" switch which automatically answers all questions as "yes", that's why you don't see the prompts.

PeterO (beginning to wonder why he's doing all the research that hippy should have done.....)
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

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

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 2:42 pm

You can change dpkg's behaviour regarding config files.

Take a look at:

https://www.debian.org/doc/debian-poli ... iles.html

and

https://raphaelhertzog.com/2010/09/21/ ... -by-dpkg/

Specifically the options:

Every time that dpkg must install a new conffile that you have modified (and a removed file is only a particular case of a modified file in dpkg’s eyes), it will stop the upgrade and wait your answer. This can be particularly annoying for major upgrades. That’s why you can give predefined answers to dpkg with the help of multiple --force-conf* options:

--force-confold: do not modify the current configuration file, the new version is installed with a .dpkg-dist suffix. With this option alone, even configuration files that you have not modified are left untouched. You need to combine it with --force-confdef to let dpkg overwrite configuration files that you have not modified.
--force-confnew: always install the new version of the configuration file, the current version is kept in a file with the .dpkg-old suffix.
--force-confdef: ask dpkg to decide alone when it can and prompt otherwise. This is the default behavior of dpkg and this option is mainly useful in combination with --force-confold.
--force-confmiss: ask dpkg to install the configuration file if it’s currently missing (for example because you have removed the file by mistake).

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

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 3:29 pm

PeterO wrote:
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


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
I always use apt not apt-get and was presented with the same questions during upgrade.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

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

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 4:01 pm

PeterO wrote:
Thu Dec 12, 2019 2:37 pm
Did you follow the link that fruity gave ? It's to a page about upgrading using the "-y" switch which automatically answers all questions as "yes", that's why you don't see the prompts.

PeterO (beginning to wonder why he's doing all the research that hippy should have done.....)
Don't be so insulting.

I did read that page - https://www.raspberrypi.org/documentati ... pdating.md

And I wouldn't characterise it as "a page about upgrading using the "-y" switch" as such though it does indicate using the "-y" switch in passing. It only mentions "-y" in the "Upgrading from Jessie to Stretch" section and doesn't explain why "-y" is used.

Interestingly it says, having indicated the use of -y, "Answer 'yes' to any prompts". So it seems the use of 'apt' or "-y" may not get rid of all the questions and prompts.

And when you say "he's doing all the research that hippy should have done" what exactly do you mean ?

What research should I have done ? I merely highlighted an annoyance with apt-get in my opening post.

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

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 4:24 pm

hippy wrote:
Thu Dec 12, 2019 4:01 pm
What research should I have done ? I merely highlighted an annoyance with apt-get in my opening post.
I mean I'd spent about an hour looking at manual pages, apt source code, web pages, trying to find any evidence to support your concerrn trolling about apt overwriting config files without warning, and I can't find any ! If you had done the same this thread could have been put to bed already !

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: 6532
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 4:25 pm

LOL

Code: Select all

pi@Pi3B:~ $ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  git git-man raspi-config
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 5,846 kB of archives.
After this operation, 37.9 kB of additional disk space will be used.
Do you want to continue? [Y/n] n^Hy
Abort.
Seems the same annoyance is there with 'apt' as it is with 'apt-get''.

But sure, "-y" avoids the prompt ... as "-y" does with 'apt-get'.

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

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 4:30 pm

hippy wrote:
Thu Dec 12, 2019 4:25 pm
Seems the same annoyance is there with 'apt' as it is with 'apt-get''.
I give up !
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: 6532
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 4:33 pm

PeterO wrote:
Thu Dec 12, 2019 4:24 pm
hippy wrote:
Thu Dec 12, 2019 4:01 pm
What research should I have done ? I merely highlighted an annoyance with apt-get in my opening post.
I mean I'd spent about an hour looking at manual pages, apt source code, web pages, trying to find any evidence to support your concerrn trolling about apt overwriting config files without warning, and I can't find any ! If you had done the same this thread could have been put to bed already !

PeterO
It wasn't me who brought up 'apt'. It wasn't me who suggested it would not prompt before making or not making changes. I haven't been concern trolling over anything.

User avatar
jojopi
Posts: 3113
Joined: Tue Oct 11, 2011 8:38 pm

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 4:37 pm

hippy wrote:
Wed Dec 11, 2019 3:07 pm
Raspbian GNU/Linux 10
Pi3B login: po^Hi
Password:

Login incorrect
Your backspace key should be sending ASCII DEL (^?), not BS (^H). Are you using a terminal emulator connected to the serial console? Most emulators will have a configuration option to set the backspace behaviour.

On the physical console, backspace is DEL by diktat from Linus, and I struggle to see how that could have been accidentally changed.

You can use the command "stty erase ^H" to tell the terminal driver that you want to use BS, but configuring the terminal emulator for DEL is the better option.

Programs that use GNU readline (bash) or implement their own line editing (nano) often treat BS and DEL the same by default, but those that use canonical line input rely on the kernel to handle special characters, and this requires the terminal settings to match the actual terminal.

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

Re: Annoying feature of 'apt-get uprgade'

Thu Dec 12, 2019 5:10 pm

jojopi wrote:
Thu Dec 12, 2019 4:37 pm
Your backspace key should be sending ASCII DEL (^?), not BS (^H). Are you using a terminal emulator connected to the serial console?
Backspace being anything other than 'BS', 0x08, Ctrl-H, is a new one for me and I've been doing serial comms for decades, but that's how it is if that's what Linux has settled on, bizarre as that is to me.

I'm using Telnet over TCP/IP using "Dave's Telnet" from Dave Cole. That has a number of different emulations, including "linux" which is what it was set to.

Having changed to other emulations to see if they were any better, which all send Ctrl-H for backspace, switching back to "linux" seems to have resolved the issue. So I guess that somewhere along the line it decided to not send out the character it was supposed to send out for the emulation it was using.

So thanks for helping me solve the actual problem.

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

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

Thu Dec 12, 2019 7:20 pm

Two comments:

1) Yes, the backspace/del issue has been a constant source of pain throughout the history of Unix. Basically, it boils down to:
a) Unix wants ^? (aka, Del, aka 0x7F)
b) Terminal programs want to send ^h (aka, BS, aka, 0x08)

So, the problem usually boils down to figuring out a way to make your terminal program send Del instead.

Note that lots of online help texts say that you should instead use "stty" to change your Unix setting to match your terminal setting, but that's a less-than-good solution. It just leads to more pain.

Note also that shells often mask the problem - that is, they are smart enough to take either BS or Del and do the right thing, so you often don't realize that you're misconfigured until you run some program, such as apt-get, that requests user input via the tty. This seems to be what happened here.

2) Regarding the "-y" switch to apt-get. No, that is not a solution. All it does is automates away the first "are you sure?" prompt in apt-get - the one that says "I'm about to install or upgrade all these packages. Continue?" It does not automate away the various prompts that can occur within the upgrade process (such as the one discussed in this thread).

And, as I've said repeatedly, there is no way it really can/could be automated, since there is no clear right answer to the question. Or, to put it another way, if it could be automated, it would have been.

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

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

Thu Dec 12, 2019 10:47 pm

You certainly can automate it away if you wish. Unsurprisingly there is an config option for that, as I already mentioned. Whether or not doing so is a good idea is an exercise left to the reader....

[Note: For those who don't understand all the ramifications, it likely is NOT a good idea]

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

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

Thu Dec 12, 2019 11:01 pm

bjtheone wrote:
Thu Dec 12, 2019 10:47 pm
You certainly can automate it away if you wish. Unsurprisingly there is an config option for that, as I already mentioned. Whether or not doing so is a good idea is an exercise left to the reader....
Yes, I did go back and re-read your post upthread aways. The second URL, in particular, is quite readable and helpful. (The one that starts with: https://raphaelhertzog.com/2010/09/21/)

However, just for clarity, note that when I said (something akin to) "You can't automate it...", I meant by that "You shouldn't" or "It would be unsafe to". Obviously, there is always a way to automate anything - if you're willing to jump through enough hoops.

As you have amply demonstrated via the URLs you posted.
[Note: For those who don't understand all the ramifications, it likely is NOT a good idea]
Agreed. Which is why they don't do it - unless you really jump through hoops to make it happen.

So, I think we can put this one to bed now.

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

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

Thu Dec 12, 2019 11:45 pm

While I think we are in agreement on the goodness of doing it in the general use case, if you have a generic system and I bet that many systems are running a very generic/default config of Raspbian, always accepting the new config is a fairly safe default. Likely much safer than exposing the issue to the user and expecting them to make the right decision.

Apt has different defaults than apt-get. The option "upgrade" has --with-new-pkgs enabled by default which drives different behaviour. Depending on the level of control you want and the behaviour you expect, you many need to dive into the dpkg options both set.

https://debian-handbook.info/browse/st ... -get.html

is another good read to understand it at a fairly high level.

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

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

Fri Dec 13, 2019 6:33 am

bjtheone wrote:
Thu Dec 12, 2019 11:45 pm
While I think we are in agreement on the goodness of doing it in the general use case, if you have a generic system and I bet that many systems are running a very generic/default config of Raspbian, always accepting the new config is a fairly safe default. Likely much safer than exposing the issue to the user and expecting them to make the right decision.
If you have a generic/default config you shouldn't get that message anyway.

It should only appear if the user has changed one of the standard config files, and in that case the user should have known what they have done and it is reasonable to expected them to be able to decide whether to keep their existing config or install the new default one.

I try not to change the default configs if possible. When I do need to change any options I prefer the way some packages do it (apt, apache, mariadb for example) of having a separate config directory where you can put new config files that override options in the default file without having to touch the default config at all.

Heater
Posts: 14272
Joined: Tue Jul 17, 2012 3:02 pm

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

Fri Dec 13, 2019 6:45 am

So the moral of the story is:

If you are going to customize configuration files:

1) Have backups. Obviously. So you can quickly recreate your system when it gets hosed.

2) If possible create new config files rpdom suggests.

3) Know what you are doing.

apt-get and friends have been working fine in many distros for millions of people. No problem there.
Memory in C++ is a leaky abstraction .

Return to “General discussion”