Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: can I move /usr/src files?

  1. #1
    Join Date
    Jul 2007
    Beans
    162
    Distro
    Ubuntu 10.04 Lucid Lynx

    can I move /usr/src files?

    My /usr/src folder occupies almost 10% of my 10GB harddrive, containing useless(?) files from kernel 2.6.20 etc. Can I move them to an external drive, and if necessary, copy them back when needed? Can I do this with just the file explorer, or is there some apt command I should run instead? Or is there a zip/deb archive of these files somewhere else that I can save instead, and delete everything in the src folder?

    Thanks,
    Ayu

  2. #2
    Join Date
    Jan 2006
    Location
    Sunny Southend-on-Sea
    Beans
    5,424
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: can I move /usr/src files?

    Crikey, how many kernels have you got installed? My /usr/src comes in at 54.5 MB.

    If you've got loads of old kernels that you aren't using any more, you can remove them in Synaptic. This will also automatically remove them from GRUB's menu.lst. If everything's currently working OK, you only need to keep the latest kernel. It should go without mentioning that you shouldn't remove all the kernels but I'll mention it anyway, just in case.

    Deleting system files willy-nilly is a Bad Plan. Use the package manager for minimal breakage.
    None but ourselves can free our minds

  3. #3
    Join Date
    Apr 2005
    Location
    Massachusetts, USA
    Beans
    1,578
    Distro
    Xubuntu 10.10 Maverick Meerkat

    Re: can I move /usr/src files?

    First run this on the command line
    Code:
    uname -a
    which will tell you what version of the Kernel you are currently running. Now in your /usr/src directory you should only keep the "linux-headers" directory for the Kernel you are currently running.

    On my Jaunty installation, I'm at 2.6.28-15 and so in my /usr/src directory I have "linux-headers-2.6.28-15" and "linux-headers-2.6.28-15-generic".

    I can see the amount of space being taken from these two directories with
    Code:
    cd /usr/src
    du -sch
    I have
    64M linux-headers-2.6.28-15
    7.7M linux-headers-2.6.28-15-generic
    You will want to keep this directory around if some application wants to build something specific to your Kernel, everything else is probably extraneous and can be removed.

    Just to be on the safe side though, you should list what's in that directory so that we can tell you it's safe to remove it and there's likely a APT/DBKG command to remove it properly..

    Regards
    Registered Linux User #446796
    Registered Ubuntu User #13489

  4. #4
    Join Date
    Oct 2009
    Location
    Chicago
    Beans
    102

    Re: can I move /usr/src files?

    try:

    Code:
    sudo nautalis


    then navigate to the directory using the GUI (be careful, you'll be root!
    There are a lot of people out there driving cars. The majority of them are intimidated by looking under the hood. Arch Linux is targeting people who are not.
    Swagbucks: http://www.swagbucks.com/refer/dsdfhswa

  5. #5
    Join Date
    Jul 2007
    Beans
    162
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: can I move /usr/src files?

    Quote Originally Posted by CatKiller View Post
    If you've got loads of old kernels that you aren't using any more, you can remove them in Synaptic. This will also automatically remove them from GRUB's menu.lst.
    So if in Synaptic I just choose to remove linux-headers*, this will both clear the header files in /usr/src and clean up menu.lst?

    Quote Originally Posted by CatKiller View Post
    Deleting system files willy-nilly is a Bad Plan. Use the package manager for minimal breakage.
    Are these files actively being used or are the src files only needed when installing something?

    I have no clue how it works. I would have thought 1) Download zip 2) Unzip into /usr/src 3) Compile and install exe somewhere else

    But I guess I still need the newest source file lying around?

    Quote Originally Posted by Cypher View Post
    You will want to keep this directory around if some application wants to build something specific to your Kernel, everything else is probably extraneous and can be removed.

    Just to be on the safe side though, you should list what's in that directory so that we can tell you it's safe to remove it and there's likely a APT/DBKG command to remove it properly..
    Code:
    du -sh /usr/src/*
    75M	/usr/src/alsa
    56M	/usr/src/linux-headers-2.6.20-15
    56M	/usr/src/linux-headers-2.6.20-16
    56M	/usr/src/linux-headers-2.6.22-10
    56M	/usr/src/linux-headers-2.6.22-9
    58M	/usr/src/linux-headers-2.6.24-18
    43M	/usr/src/linux-headers-2.6.27-7
    43M	/usr/src/linux-headers-2.6.27-9
    64M	/usr/src/linux-headers-2.6.28-11
    7.6M	/usr/src/linux-headers-2.6.28-11-generic
    305M	/usr/src/linux-source-2.6.20
    55M	/usr/src/linux-source-2.6.28.tar.bz2
    8.0M	/usr/src/nvidia-180.44
    52K	/usr/src/rpm
    0	/usr/src/vboxdrv-3.0.6
    0	/usr/src/vboxnetadp-3.0.6
    0	/usr/src/vboxnetflt-3.0.6

    Thanks for all your help!

    Ayu

  6. #6
    Join Date
    May 2007
    Location
    México
    Beans
    980
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: can I move /usr/src files?

    This will remove all the uneeded packages, including old kernels.
    Code:
    sudo apt-get autoremove
    linux-headers are the headers files used to compile the kernel and some other applications. You don't need them if you are not going to compile anything from source.

    Just remove them with this:
    Code:
    sudo apt-get remove linux-headers
    conky gui: thread, web site

  7. #7
    Join Date
    Aug 2008
    Location
    Rio de Janeiro, Brazil
    Beans
    234
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: can I move /usr/src files?

    You can get rid of them, i think the following command will do:
    Code:
    sudo apt-get purge linux-headers-2.6.20-15 linux-headers-2.6.20-16 linux-headers-2.6.22-10 linux-headers-2.6.22-9
    linux-headers-2.6.27-7 linux-headers-2.6.27-9 linux-headers-2.6.24-18
    You should wait for someone else to approve it though, as i'm not sure.
    Ubuntu Beginners Team - For beginners in need of help.

  8. #8
    Join Date
    Feb 2008
    Location
    London
    Beans
    1,032
    Distro
    Ubuntu

    Re: can I move /usr/src files?

    My /usr/src is just 19MB. That's with kernel headers...no kernel source though as my current kernel is absolutely fine.
    Server: 2.2GHz Athlon 64; 4GB; 2TB; Debian 5 x64
    LividEmperor: 3.3GHz i5 2500K; 8GB; 660GB; Ubuntu 10.10 x64 + Windows 7 x64
    Netbook1: 1.6GHz Atom; 2GB; 160GB; Ubuntu 10.10 x86
    Dogeatdog: 3GHz Phenom II; 3GB; 1TB; Windows 7 x64

  9. #9
    Join Date
    May 2007
    Location
    México
    Beans
    980
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: can I move /usr/src files?

    Quote Originally Posted by pedro3005 View Post
    You can get rid of them, i think the following command will do:
    Code:
    sudo apt-get purge linux-headers-2.6.20-15 linux-headers-2.6.20-16 linux-headers-2.6.22-10 linux-headers-2.6.22-9
    linux-headers-2.6.27-7 linux-headers-2.6.27-9 linux-headers-2.6.24-18
    You should wait for someone else to approve it though, as i'm not sure.
    There is no need to specify every single package, since they are not used they will be removed. And it should be --purge not purge, which is not needed either, that argument is used to completely remove a program, this means uninstall and delete configuration files, but a kernel doesn't have that.
    conky gui: thread, web site

  10. #10
    Join Date
    Jan 2006
    Location
    Sunny Southend-on-Sea
    Beans
    5,424
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: can I move /usr/src files?

    Quote Originally Posted by ayu View Post
    So if in Synaptic I just choose to remove linux-headers*, this will both clear the header files in /usr/src and clean up menu.lst?
    Yes. But only remove the ones that you definitely don't need. You'll probably also want to remove the corresponding Linux images if you have those installed too.

    Are these files actively being used or are the src files only needed when installing something?
    They're pulled in by the nVidia driver. I have no idea if they're still needed after the install to make the nVidia driver work. You'd have to ask them.

    Given that the nvidia-glx package depends on nvidia-kernel-source, which in turn depends on linux-headers, removing the last set of headers will, in all likelihood, also remove your nVidia driver.

    Personally, I would use Synaptic to remove them rather than the command line as a new user.

    EDIT: Actually, never mind the headers. It's the fact that you've got the whole Linux source in there that's taking up all the room. Why did you install that? Is it something you need to keep?
    Last edited by CatKiller; October 7th, 2009 at 02:51 AM.
    None but ourselves can free our minds

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •