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?

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
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.