LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-11-2015, 07:12 AM   #1
dederon
Member
 
Registered: Oct 2013
Posts: 108

Rep: Reputation: 56
why does /sbin/upgradepkg install a package twice?


hi@all,

what upgradepkg basically does is:

1. (pre)install the new pkg
2. remove the old pkg
3. reinstall the new pkg

somehow i forgot why upgragepkg is doing step 3, the script is telling me it has something to do with files changing location.

any help is appreciated, an example would be nice where leaving out step 3 will cause trouble.

Last edited by dederon; 09-15-2015 at 03:57 AM. Reason: marked as solved
 
Old 09-11-2015, 07:38 AM   #2
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Why do you care what it does? I assume that there were cases in the past where doing just the first two steps resulted in a broken installation.

EDIT: Looking through /sbin/upgradepkg itself, you can read about the --no-paranoia option and the comments related to it.

It seems that if a package used to directly manage a file and then someone changes the package to move the file into place, the install-new/delete-old method will result in the moved file disappearing. So, it's install-new/remove-old/install-new to ensure such files (normally configuration files) are correctly installed.

Last edited by Richard Cranium; 09-11-2015 at 07:44 AM. Reason: Actually looked at the source.
 
Old 09-11-2015, 08:35 AM   #3
dederon
Member
 
Registered: Oct 2013
Posts: 108

Original Poster
Rep: Reputation: 56
Quote:
Originally Posted by Richard Cranium View Post
It seems that if a package used to directly manage a file and then someone changes the package to move the file into place, the install-new/delete-old method will result in the moved file disappearing. So, it's install-new/remove-old/install-new to ensure such files (normally configuration files) are correctly installed.
thx a lot for your help. i read the source but i didn't understand, but now i think i do.

example: an installed pkg has a file etc/c.conf in its file list. the new version uses the config() routine in doinst.sh to create this file. when removing the old pkg, etc/c.conf will be removed, because it's not part of the filelist of the new package.

is that correct?
 
1 members found this post helpful.
Old 09-11-2015, 09:50 AM   #4
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Yep. I think that's about right.
 
Old 09-23-2015, 05:04 PM   #5
drmozes
Slackware Contributor
 
Registered: Apr 2008
Distribution: Slackware
Posts: 1,543

Rep: Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313
Quote:
Originally Posted by GazL View Post
Yep. I think that's about right.
Whilst looking at some pkgtools changes for 14.2 and reviewing the speedup patches that ARM has, I came across this note I'd saved years ago when I asked Pat the same question:

ftp://ftp.arm.slackware.com/slackwar...tools/INFO.txt

There's your answer.
 
5 members found this post helpful.
Old 09-24-2015, 05:44 AM   #6
dederon
Member
 
Registered: Oct 2013
Posts: 108

Original Poster
Rep: Reputation: 56
thanks for sharing, so i can be sure my assumption are right. btw, it's another great example of how bad and harmful symlinks are (plan 9 has no symlinks for good reasons). you better avoid them like the plaque.

rob pike's comment on symlinks:
Quote:
It started to go wrong when the BSD signal stuff went in (I complained at the time), then symlinks, sockets, X11 windowing, and so on, none of which were added with proper appreciation of the Unix model and its simplifications.
p.s.: are there important pkgtool changes in 14.2?
 
Old 09-24-2015, 08:42 AM   #7
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
I like symlinks and use them extensively.

I think much of these problems can be laid at the feet of the utilities themselves. cpio seems to handle symlinks far more sensibly than tar does. It's a shame it's not been updated to support the POSIX.1-2001 archive format and has fallen out of use due to the limitations of 'ustar'. There is 'pax' from the heirloom toolset of course, but as that tends not to be commonly installed, its probably not wise to become dependent upon it.

Having said that, directories turning into symlinks and vice versa from one release to another is a complex situation, and it's probably not fair to lay the responsibility of dealing with it on an underlying archive tool. The package management tools themselves should deal with that sort of stuff. Installing the package twice seems like a quick and dirty workaround for the situation, but I guess it works.
 
Old 09-24-2015, 09:51 AM   #8
dederon
Member
 
Registered: Oct 2013
Posts: 108

Original Poster
Rep: Reputation: 56
Quote:
Originally Posted by drmozes View Post
There's your answer.
now i remember another question i forgot to ask in the first place: why bother preinstalling a pkg? just to make sure the package will install without problems? i doubt that, because installpkg will happily install (at least it tries) a package onto my readonly /usr partition without complaining.
 
1 members found this post helpful.
Old 09-24-2015, 12:02 PM   #9
e5150
Member
 
Registered: Oct 2005
Location: Sweden
Distribution: Slackware and Alpine
Posts: 132

Rep: Reputation: 100Reputation: 100
Quote:
Originally Posted by dederon View Post
now i remember another question i forgot to ask in the first place: why bother preinstalling a pkg? just to make sure the package will install without problems? i doubt that, because installpkg will happily install (at least it tries) a package onto my readonly /usr partition without complaining.
Without the first install, if you were to upgradepkg tar, coreutils, sed, grep, or such packages, the remove will remove those tools, and (what is the second) install would fail due to missing programs. With the first install those tools won't be removed, since they are found in more than the package that is removed.

Last edited by e5150; 09-24-2015 at 12:03 PM.
 
Old 09-25-2015, 01:52 AM   #10
drmozes
Slackware Contributor
 
Registered: Apr 2008
Distribution: Slackware
Posts: 1,543

Rep: Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313
Quote:
Originally Posted by dederon View Post
now i remember another question i forgot to ask in the first place: why bother preinstalling a pkg? just to make sure the package will install without problems? i doubt that, because installpkg will happily install (at least it tries) a package onto my readonly /usr partition without complaining.
Patrick says:-
Quote:
The directory - symlink rationale for the install/uninstall/reinstall cycle is a rare thing. At this point, the .new files are the real reason.

The problem happens when a package used to install /etc/some/conffile.conf directly, and then a newer package changes to using /etc/some/conffile.conf.new.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash upgradepkg does not install correctly TonyErwood Slackware 6 09-30-2014 04:46 AM
upgrade with upgradepkg --install-new why? boneyard Slackware 8 09-11-2010 05:02 PM
Root ShelI Change - changed /etc/passwd /sbin/sh to /sbin/bash and gave No Shell mn35 Solaris / OpenSolaris 13 04-13-2010 04:24 AM
Chkroot scan - /sbin/init & /sbin/ifconfig INFECTED bicoba Linux - Security 4 06-07-2006 09:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration