2

I am sure this is a duplicate but I have looked extensively without finding an answer.

I am trying to run apt-get update on Ubuntu 18.04 LTS.

It always quits without an error message

When I type su -c "apt-get update" the output is as follows:

Hit:1 http://mirrors.linode.com/ubuntu bionic InRelease
Hit:2 http://mirrors.linode.com/ubuntu bionic-updates InRelease                                                   
Hit:3 http://mirrors.linode.com/ubuntu bionic-backports InRelease                                                 
Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease                                                 
Hit:5 http://ppa.launchpad.net/certbot/certbot/ubuntu bionic InRelease

And the I get the command prompt. I have tried logging in as root and using sudo instead of su -c.

When I tried it as root, it got farther:

Get:37 http://mirrors.linode.com/ubuntu bionic-updates/multiverse amd64 Packages [6,408 B]
Get:38 http://mirrors.linode.com/ubuntu bionic-updates/multiverse Translation-en [3,452 B]
Get:39 http://mirrors.linode.com/ubuntu bionic-backports/universe amd64 Packages [3,472 B]     
Get:40 http://mirrors.linode.com/ubuntu bionic-backports/universe i386 Packages [3,472 B]
Get:41 http://mirrors.linode.com/ubuntu bionic-backports/universe Translation-en [1,604 B]                                                                                                    
Fetched 29.3 MB in 11s (2,604 kB/s)                                                                                                                                                           
Killedg package lists... 53%

I am only using 25% of a 25 gig drive (it's a Linode).

According to the Linode dashboard, the server CPU load is generally at about 20%.

I have previously resolved this problem by temporarily upgrading the server to double the RAM and double the HD size.

I assume that the problem is not enough RAM, since the HD is far from full.

Is there any way I can update the server without having to resize it?

Can I temporarily dedicate all the ram to the update process?

Andy Swift
  • 123
  • 5
  • Welcome to AskUbuntu! Any idea how the process got Killed when Reading package lists...? – Elder Geek Feb 15 '19 at 20:03
  • colbycdev below suggested using htop and I then realized that the Linode only had 1GB of RAM instead of the 4GB it was supposed to have. I'm currently waiting for an answer from Linode tech support about how this could be. I don't know how the process got killed, no message nothing I could find in logs. – Andy Swift Feb 15 '19 at 20:49
  • This post might have some clues... https://askubuntu.com/questions/770257/server-out-of-memory-started-to-kill-all-processes – Elder Geek Feb 15 '19 at 20:51

3 Answers3

5

Is there any way I can update the server without having to resize it?

Yes, add a swap partition to help cope with the temporary increase in memory usage.

sudo -s
touch /swapfile
fallocate --length 4G /swapfile
mkswap /swapfile
swapon /swapfile
chmod 600 /swapfile

You should now see that there is an extra 4GB of swap available. This won't persist after reboot, if you want to do that you'll have to add a line to your /etc/fstab like this:

/swapfile none swap sw 0 0
  • The dd command resulted in 0+0 records in, 0+0 records out, 0 bytes copied, 0.0230896 s, 0.0 kB/s. mkswap gave the following error: swap area needs to be at least 40 KiB. It's late where I am and I'll look into it more tomorrow. Also see my comment on the original question… I have only 1/4 of the RAM I am supposed to have. – Andy Swift Feb 15 '19 at 20:52
  • I'm not entirely sure what is the problem. Are you thinking of apt update && apt upgrade?

    I only have 4GB ram, and had 1GB before and never had out of memory. My guess is you either are low on RAM in the first place, or something is screwed up in your system

    Use another terminal and htop to record your RAM usage and see if something else is eating memory. Maybe it's not the issue. I really need more details

    – unixandria Feb 15 '19 at 21:49
1

It really needs 2+ GB RAM to function at its best

0

In case someone else has a similar problem, here is how I actually fixed the problem of not enough RAM.

My Linode server was supposed to have 4GB of RAM, but when I ran

$ htop

It was clear that there was only 1GB of RAM available.

Somehow the configuration profile that I was using to boot my Linode include an artificial limit of 1GB of RAM even though the real limit was 4GB.

To see if this is the case, you can edit the active configuration profile:

  • 1st tab › [configuration name] › Edit (classic Linode manager)

  • Settings › [configuration name] › … › Edit (cloud manager)

I have no idea how the limit was set but once I removed the limit I could easily update the server.

Andy Swift
  • 123
  • 5