Fixing No space left on device error in Ubuntu Linux
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.
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.
Argh – my paste did not paste the correct command. Let me try again:
sudo du -hc –max-depth=1
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 -
I’m happy that I could help you. Ya, it’s double dash, but somehow my copy and paste also took a dash away.
Thank you! Saved my day.
You are welcome Nilsson.
Thanks for the “sudo apt-get clean” command dude
You are welcome Emkay.
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!
Thanks for the details.
As far as root passwd, I remeber it asked me for a root password. I’ll double check.
I checked. sudo passwd root does ask you to enter password for the root account. It’s not insecure.
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.
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.
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.
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.
Arun thanks! Worked like a charm!
You are welcome Maya.