Sep

19

Fixing No space left on device error in Ubuntu Linux

Posted by : Arun | On : September 19, 2006

I’m using Ubuntu as my main OS in both my desktop and laptop. I was getting the following error when I tried to login to Ubuntu couple of days back:

Your session lasted less than 10 seconds blah blah blah……

When I clicked the box to see the Xserver error, I got the following error message:
/etc/gdm/PreSession/Default: Registering your session with wtmp and utmp.
/etc/gdm/PreSession/Default: running: /usr/bin/sessreg -a -w /var/log/wtmp -u /var/run/utmp -x “/var/lib/gdm/:0.Xservers” -h ” ” -l “:0″ “username”
/etc/gdm/PreSession/Default: Beginning session setup mkdtemp: private socket dir: No space left on device.

It didn’t allow me to login. I then Googled to find a solution and also checked Ubuntu Forums, which is a great place to get help. This is what I did to fix the problem. It’s pretty simple.

I selected Failsafe Terminal under sessions in the GNOME login screen. I was then presented with the terminal screen. I issued the following command to find out the disk space used and space left in my system.

df -l

This showed that my root partition (/) was 100% full. I had no idea how it got full. I had allocated 10 GB for the root partition and there’s no way I would have filled that with installing programs. I thought may be the .deb files that Ubuntu uses to install programs filled up the space. I tried to clean up the .deb files with the following command:

sudo apt-get clean

It didn’t free up any space. The root partition was still 100% full. I wanted to find out the space used by each directory under the root partition. This is what I did in the terminal.

cd / — to go to the root folder

sudo du -hc –max-depth=1 — to find out the space used by each directory under the root folder.

I found out that /var/backup was using 6.5 GB. I tried to check what was in there under /var/backup, but I was denied permission to enter that directory. I wasn’t sure how to enter since

sudo cd /var/backup didn’t work. I had to enable the root password with the following command to enter that directory.

sudo passwd root

su

When I checked /var/backup there were 3 files created by some program to backup the files in the system. I have no idea which program created those. I installed some backup software earlier, but then I reformatted the hard drive and reinstalled Ubuntu 2 weeks back. I didn’t install the backup software again. The only program I used was Automatix to install common programs in Ubuntu. I’m not sure if Automatix created those backup files. I then deleted those 3 backup files and regained the 6.5 GB back. I then logged out of the Failsafe terminal mode and logged in back using the regular GNOME session and it worked. :-)

Comments (25)

  1. Saurabh said on 04-12-2014

    Thanks for the info Arun. Helped me largely. I was stuck with this space crunch issue.

  2. Steven Black said on 12-04-2013

    For the record, sudo cd can _never_ work. It invokes a shell as root, then exits the shell immediately. (As the command has ended.)

    Instead use: sudo su – or even sudo bash

    I prefer to use “sudo su -” as that loads the root user’s configuration files, and that helps insure my environment is correct and that I don’t accidentally get files owned by root:root in my home directory.

  3. Humayun A. Daud said on 04-09-2012

    Great Article!
    thnk you

  4. Kris said on 06-03-2011

    My problem came down to a misfire on removing some some files on separate mounted drive. This article helped to get me thinking in the right direction, thanks for the post.

  5. Dwight Francis said on 12-10-2010

    Four years later, your post is still solving problems. Somehow, my system kept some files at an old mount point and wouldn’t let go. Filled up my system partition (I keep /home separate) and wouldn’t let me reboot to X, just to terminal. Thanks so much for this.

  6. Arun said on 01-03-2010

    @Ian
    Thanks for the info Ian.

  7. Ian said on 26-02-2010

    Hey,
    I had same problem but needed and found different solution.

    No space left on / — no apparent reason.

    I’m using xubuntu but likely similar for ubuntu.
    When xubuntu upgrades it’s own kernel online to new kernel
    eg linux-image-2.6.24-26 to linux-image-2.6.24-27
    it leaves the old kernel plus all necessary support files libs, headers etc. as a fall back option in case any problems with the new kernel.

    Ever noticed in your grub boot menu a list of older kernel options?

    This adds up bigtime on disk space. I had 7 or 8 old kernels coming to more than 1 gig!
    If this is your problem too, get rid of the old ones.
    Best way – synaptic package manager and “mark for complete removal” the old kernel versions. They are all named “linux-image-2.6.24-27-generic” for example. Once you delete the image package all the libs, headers etc. will be deleted too.
    Good luck!

  8. Arun said on 06-03-2008

    You are welcome Maya.

  9. Maya said on 06-03-2008

    Arun thanks! Worked like a charm!

  10. Arun said on 17-12-2006

    I had the same problem with my other desktop where I installed the backup software and it filled up the space under /var/backup. I uninstalled the backup program.

  11. Trevor said on 17-12-2006

    Dude, you’re my hero. I’ve got a couple big projects I’m in the middle of and I can’t afford to be locked out of my Ubuntu system all day today. Thanks a million for posting your solution. BTW, in my case the problem was caused by an install of Simple Backup that apparently began its work with the default directory of /var/backup before I told it to backup to another (larger) partition.

  12. Arun said on 31-10-2006

    Welcome to the world of Linux. Print the ATI driver installation guide from (boot into Windows and print)
    http://wiki.cchtml.com/index.php/Ubuntu_Edgy_Installation_Guide
    #Method_1:_Installing_Edgy.27s_Included_Driver_.288.28.8.29
    When you boot, select recovery mode from the Grub menu. You’ll be greeting with command prompt. Do as explained in the guide. Reboot and see if it works. If not, reboot into recovery mode and try running the following command:
    sudo dpkg-reconfigure xserver-xorg
    Go by default selections. Once it’s done, follow the ATI driver installation again and reboot. It should work.

  13. digital camera said on 31-10-2006

    heyas all.
    my 40 gig drive is going to good use now. I have installed UBUNTU and have ordered KUBUNTU.
    I dont know how to install the driver for my ati radeon 9600xt.
    Actually i dont know if i am meant to be downloading and installing XFREE86 or the XORG version of the driver. I am downloading them both but i dont know how to do anything in Linux really.
    I dont know where I am meant to set up my modem or set up a net account. (no INETWIZ.EXE)
    So yeah, can someone help me out with getting my ATI driver installed?
    and does anyone know of a good long PDF file i can read and wrap my brain around.
    I’m still a Windows user, but I want to use Linux as much as possible.
    Thanks. :)

  14. Arun said on 24-10-2006

    I checked. sudo passwd root does ask you to enter password for the root account. It’s not insecure.

  15. Arun said on 24-10-2006

    Thanks for the details.
    As far as root passwd, I remeber it asked me for a root password. I’ll double check.

  16. Duncan said on 24-10-2006

    A side note:

    The reason “sudo cd /var/backup” won’t work is that cd is not a separate program, it’s a shell built-in command. It’s not easy to explain, but if you think about what sudo does, and what cd does, maybe you’ll understand why they don’t work together. Anyway, they don’t work together.

    But what I really wanted to post was that when you wrote that you did:

    sudo passwd root

    su

    I hope you were just using a shorthand, because if you really did that you opened up a MAJOR security hole, because you just set the root account to have no password. Make sure you fix that! Log in as root, and run the passwd command, and set a good strong password. Then, next time you want to be root, just do su and enter the password when you are prompted!

  17. Arun said on 23-10-2006

    You are welcome Emkay. :-)

  18. Emkay said on 23-10-2006

    Thanks for the “sudo apt-get clean” command dude :)

  19. Arun said on 07-10-2006

    You are welcome Nilsson. :-)

  20. Nilsson said on 06-10-2006

    Thank you! Saved my day.

  21. Arun said on 27-09-2006

    :-)
    I’m happy that I could help you. Ya, it’s double dash, but somehow my copy and paste also took a dash away.

  22. Tyler Morse said on 26-09-2006

    Sorry for the multiple posts – for some reason I can’t get two dashes to appear one after the other. Command should look something like this:

    sudo du -hc [dash][dash]max-depth=1

    where [dash] is really just -

  23. Tyler Morse said on 26-09-2006

    Argh – my paste did not paste the correct command. Let me try again:

    sudo du -hc –max-depth=1

  24. Tyler Morse said on 26-09-2006

    du doesn’t take a -max-depth parameter, it needs double hashes, like so:

    sudo du -hc –max-depth=1

    Thanks so much for the post – you saved me from a really bad problem on my machine.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

winrar download free

winrar download free

download winrar free

download winrar free

winzip activation code

winzip activation code

free winrar download

free winrar download

windows 7 ultimate product key

windows 7 ultimate product key

winzip registration code

winzip registration code

windows 7 key generator

windows 7 key generator

winzip free download full version

winzip free download full version

windows 7 product key

windows 7 product key

free winzip

free winzip

windows 7 activation crack

windows7 activation crack

winrar free

winrar free

winrar free download

winrar free download

winzip free download

winzip free download

winzip freeware

winzip freeware

free winrar

free winrar

windows 7 crack

windows 7 crack

windows xp product key

windows xp product key