LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   antiX / MX Linux (https://www.linuxquestions.org/questions/antix-mx-linux-127/)
-   -   My friend has screwed up apt and I need advice on troubleshooting it (https://www.linuxquestions.org/questions/antix-mx-linux-127/my-friend-has-screwed-up-apt-and-i-need-advice-on-troubleshooting-it-4175672474/)

hazel 04-03-2020 04:52 AM

My friend has screwed up apt and I need advice on troubleshooting it
 
Trying to fix somebody else's problem long-distance when you are both in isolation is not easy. It becomes even more difficult when the person at the coalface doesn't fully understand what is going on. She has been using AntiX for two years now and does her own weekly updates using synaptic, but now she has a snafu.

She wasn't able to explain to me exactly how she got into this mess, but it must have been an interrupted update. The first thing we tried was a command line update using apt upgrade. It failed and instructed her to run dpkg --configure -a by hand, so she tried to do that, but it stalled. So I thought we'd try to get a list of what was pending and update packages individually until we find out which package is broken. I hoped to be able to use synaptic for that but it won't run.

So I asked her to run dpkg --yet-to-unpack, hoping that would give us our list. It ran successfully but gave us nothing! I don't know much about the internals of apt, despite having been a Debian user for years, but I gather that unpacking goes to completion before any configuration is done. The break has obviously happened during this configuration stage.

How do we find out what these packages are? Or alternatively, is there an emergency command that will clear the blockage.

fatmac 04-03-2020 05:34 AM

Maybe

Code:

apt-get -install --fix-broken
https://unix.stackexchange.com/quest...all-fix-broken

hazel 04-04-2020 07:58 AM

OK, she has now tried that. Unfortunately apt-get simply refuses to run. It just refers her back to a manual run of dpkg --configure -a. Which then freezes as before.

I'm sure we could crack this if we could use a more specific option than "-a". There must be one particular package in the pipeline that is breaking dpkg. If we could only find out what it is, it could be uninstalled and the rest of the update carried out properly.

I'm not sure but I think this is the update that had all the wifi firmware in it.

Where do downloaded packages go? And, more important, where do they get unpacked? Is there any kind of directory listing that would tell us what's in the pipeline?

shruggy 04-04-2020 08:20 AM

Quote:

Originally Posted by hazel (Post 6107728)
There must be one particular package in the pipeline that is breaking dpkg.

Maybe just start aptitude and see what packages are marked as broken? Or even
Code:

dpkg -l | grep '^.[^ic]'

fatmac 04-04-2020 08:41 AM

Not sure if this will help, (the dpkg man page).

https://linux.die.net/man/1/dpkg

hazel 04-04-2020 08:51 AM

Quote:

Originally Posted by shruggy (Post 6107737)
Maybe just start aptitude and see what packages are marked as broken?

I've never used aptitude myself. I think I'd have to play about with it a bit before I tried to do a long-distance aptitude session with another naive user.
Quote:

Or even
Code:

dpkg -l | grep '^.[^ic]'

Could you please elaborate on that? What would the absence of a terminal "i" or "c" denote? Or am I misunderstanding your regular expression?

pan64 04-04-2020 08:56 AM

Quote:

Originally Posted by hazel (Post 6107747)
I've never used aptitude myself. I think I'd have to play about with it a bit before I tried to do a long-distance aptitude session with another naive user.


Could you please elaborate on that? What would the absence of a terminal "i" or "c" denote? Or am I misunderstanding your regular expression?

when you execute dpkg -l it will display an explanation at the beginning. Unfortunately it is lost because of the grep. So try: dpkg -l | less

you may also try: apt clean, sometimes helps.

hazel 04-04-2020 09:09 AM

Quote:

Originally Posted by fatmac (Post 6107743)
Not sure if this will help, (the dpkg man page).

https://linux.die.net/man/1/dpkg

Thanks. Having read that man page again, I feel even more frustrated because I now know where the information I want might be hiding.
Quote:

Originally Posted by man dpkg
/var/lib/dpkg/status
Statuses of available packages. This file contains information about whether a package is marked for removing or not, whether it is installed or not, etc.

Unfortunately it doesn't state whether only pending updates are listed there or everything on the system (which would make it pretty well useless for information).

I think I'll have to spend the next day or so exploring the options on my own AntiX system before going back to my friend.

shruggy 04-04-2020 09:14 AM

Quote:

Originally Posted by hazel (Post 6107747)
Could you please elaborate on that? What would the absence of a terminal "i" or "c" denote?

Any package status other than Installed or Config-files. See dpkg-query(1)

hazel 04-04-2020 09:47 AM

Using aptitude is (probably) out. I've got AntiX running in front of me now and aptitude is not part of the default install so my friend won't have it either. I wouldn't want her to try installing it while the whole apt system is in such a mess.

On the other hand the dpkg -l|grep pipeline suggested by shruggy seems to work very well. So that is the next thing we shall try.

I also had a look at the /var/lib/dpkg/status directory. Unfortunately it contains all installed packages so it's huge. But piping just the Status lines through more might yield something useful.

I shall arrange another long-range session and report back. Thanks for all your help so far.

shruggy 04-04-2020 10:15 AM

If there's some breakage in /var/lib/dpkg/status then dpkg -C will probably catch it.

sudo dpkg -V also may reveal some clues, but it's 1) rather time-consuming, and 2) may generate too much noise.

ondoho 04-05-2020 04:39 AM

It seems that ssh is installed on AntiX by default.
Wouldn't that be the best option, make your friend start sshd and you can ssh into the machine and fix it?

hazel 04-05-2020 05:31 AM

Quote:

Originally Posted by ondoho (Post 6107975)
It seems that ssh is installed on AntiX by default.
Wouldn't that be the best option, make your friend start sshd and you can ssh into the machine and fix it?

It's probably too late for me to learn how to do that now. How does one ssh into someone else's desktop machine? What would I use as an address? And how would we exchange public keys? I'm probably as naive on such matters as she is.

It's definitely an idea for the future though. If I had a permanent account on that machine and a way of logging in, problems like this would be much easier to solve. I do have access to the root account actually but I bet sshd is configured by default not to allow remote root logins. It certainly would be on any machine of mine!

fatmac 04-05-2020 06:06 AM

Once in, you change to root using su.

It's not something I have any real experience of though, I just had a go at it a couple of times when I was in the inquisitive stage of using Linux/BSD.

beachboy2 04-05-2020 09:03 AM

hazel,

This may help:
https://mediatemple.net/community/pr...-the-root-user


All times are GMT -5. The time now is 05:46 PM.