1

So recently I have had an issue with dpkg, and when using apt/apt-get, I would get an error about 50unattended-upgrades.ucftmp.

I've looked around the communities, and nobody had a specific answer. Yes, you might say that there are plenty of answers, but note that the file extension is .ucftmp. Literally, there are NO questions/answers with that extension. 50unattended-upgrades has many questions, but not with the extension.

The issue started a while ago when I tried to install something with apt, and it gave the whole "dpkg/lock" thing so I went to delete it because I wasn't using anything besides the command I was using. But I missed the last 5 characters in sudo rm /var/lib/dpkg/lock, and deleted the dpkg folder. I was able to find an answer that worked, and I used that and left it (if you want that question I can find it, so just let me know).

Just today, I was having issue with RAM, and I needed to install the memtest86+ package, and I was having the issue with 50unattended-upgrades, and also it would say that there was issues with the unattended packages, samba packages, and a few others.

Here is what happens when I try to install memtest86+ (it was already installed but the output still is an issue):

scoutchorton@scoutcbuntu-pc:~$ sudo apt install memtest86+
Reading package lists... Done
Building dependency tree       
Reading state information... Done
memtest86+ is already the newest version (5.01-3ubuntu2).
The following package was automatically installed and is no longer required:
  mokutil
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 249 not upgraded.
N: Ignoring file '50unattended-upgrades.ucftmp' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension

Unable to use any package stuff, and it is super annoying.

  • Please edit your question to include the actual install command and the exact error message you are experiencing – steeldriver Jun 16 '17 at 9:35
  • @steeldriver if you look at my answer below I have a solution for it. I just wanted to put this out there for anyone having the same issue. – scoutchorton Jun 16 '17 at 15:13
  • OK - but anyone having what issue, exactly? how will they know that their "50unattended-upgrades.ucftmp issue" is the same as yours, so that your solution is applicable? – steeldriver Jun 16 '17 at 15:17
  • @steeldriver Ok. I see what you mean. I'll try to put the command output in there if I still have it. – scoutchorton Jun 16 '17 at 15:18
  • Response updated. – scoutchorton Jun 16 '17 at 15:20
1

So far, there looks like a good solution is in the process. So here is my solution.

What didn't work:

Trying to download packages and install them manually.

I tried it. Either I am just a Linux noob and just completely missed something in the README on how to install it but it isn't as simple as sudo dpkg -i package.deb. I hate compiling software.

apt-get remove --purge

There is already issues with dpkg and packages and being corrupted, and purging them doesn't really help. They are corrupted and Ubuntu isn't recognizing them correctly.

What DID work

Step 1:

Get a USB disk. I don't think anyone has literal Live CD's anymore, but basically get your boot disk out. Get Ubuntu (I suggest the version you're currently on, just so you are 100% sure that the files should be the same) on the disk, and boot into your live session.

Step 2:

In the mess of different drives (at least, that was my situation), locate your Ubuntu partition, and your root (/) folder of your Live Session. When you find both, get the location of /var/lib/dpkg/ on both drives. The Ubuntu partition will have a location of something like /media/Ubuntu/(name of the drive)/var/lib/dpkg/.

Step 3:

Open terminal. There are a couple commands that your dpkg locations come in handy.

Command 1 (using Ubuntu partition location): sudo rm -rf /media/Ubuntu/(drive)/var/lib/dpkg/*

This command will delete everything in your current dpkg folder so that, well, it is clear. The reason for this will be apparent with the next command.

Command 2 (using both locations): sudo cp /var/lib/dpkg/* /media/Ubuntu/(drive)/var/lib/dpkg/

This will copy all the fresh dpkg files from the Live session to your Ubuntu version. Basically it is a clean 'install' of dpkg files.

Step 4:

Reboot. If you really need a system command to do this to fulfill your inner 'I use Ubuntu because I can do simple tasks with complicated commands' desires, you can use the command shutdown -r now. Remember to remove the boot disk when you do so.

Step 5:

Once you boot back into your regular Ubuntu partition, open a terminal. If you try to install anything, you will still get the whole 50unattended-upgrades issue. But this can be solved with a simple sudo rm /etc/apt/apt.conf.d/50unattended-upgrades.ucftmp which will remove the annoying file. You might be able to do this to begin with, but this whole process worked for me. So oh well. Then once you do all of that, you should do a sudo apt-get upgrade. This will take quite a while, so sit tight and wait until it's done.

When you do all of this, dpkg should be fixed. For me, sudo apt-get upgrade ran without complaints, so I assume it is fixed. If this worked for you, please let me know. Thanks for reading!! Enjoy!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.