I can't delete old kernel, Ubuntu 14.04

66

Solution 1

Looks like you have a bunch of files that don't belong to any package. Assuming you are currently running 3.13.0, you can just do rm /boot/*-3.0.0-12-generic

Solution 2

Open a terminal (CTRL+ALT+T) and chek the current kernel version:

uname -r

DO NOT REMOVE THIS KERNEL!

Copy and paste below command and hit run to check list of installed Kernels on your system:

dpkg --list | grep linux-image

Find out the kernels you want to remove, and run below command to accomplish it: Change x.x.x.x to the kernel version

sudo apt-get purge linux-image-x.x.x.x-generic

Solution 3

you could use the following bash script (run as sudo). it purges/removes all 'old' kernels.

#/bin/bash 
ls /boot/ | grep vmlinuz | sed 's@vmlinuz-@linux-image-@g' | grep -v `uname -r` > /tmp/kernelList 
for I in `cat /tmp/kernelList`
do 
  #sudo aptitude remove $I 
  sudo apt-get purge --assume-yes $I
  #echo $I
done
rm -f /tmp/kernelList 
sudo update-grub
Share:
66

Related videos on Youtube

Sarthak Mahapatra
Author by

Sarthak Mahapatra

Updated on September 18, 2022

Comments

  • Sarthak Mahapatra
    Sarthak Mahapatra over 1 year

    I am trying to develop an application where an android client sends and receives data from Python server via Socket programming. There are no errors nor any exception crashes but my client is unable to reach the python server as my server is not receiving any connection from any client. I have turned off my windows firewall so that my PC does not block unknown access. I tried referring to similar articles in stack exchange but they all say that they are receiving the connection from the client. Please tell me what is wrong with my code. Thank you in advance. (In my server code if I use my PC's IP address then it shows an error 10049 so I am using the localhost IP)

    /*Client side code- Android*/
        public void onResults(Bundle bundle) {
                ArrayList<String> matches = bundle
                        .getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
                if(matches.get(0) != null)
                {
                    final String text = matches.get(0);
                    Thread t = new Thread(){
    
                        @Override
                        public void run() {
                            try {
                                Socket s = new Socket("47.11.229.90",25001);
                                DataOutputStream dos = new DataOutputStream(s.getOutputStream());
                                dos.writeUTF(text);
    
                                //read input stream
                                DataInputStream dis2 = new DataInputStream(s.getInputStream());
                                InputStreamReader disR2 = new InputStreamReader(dis2);
                                BufferedReader br = new BufferedReader(disR2);//create a BufferReader object for input
    
                                //print the input to the application screen
                                String replyMsg = br.toString();
                                HashMap<String, String> myHashAlarm = new HashMap<String, String>();
                                myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_ALARM));
                                myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "SOME MESSAGE");
                                //String random = (helloMessages[new Random().nextInt(helloMessages.length)]);
                                ts.speak(replyMsg, TextToSpeech.QUEUE_FLUSH, myHashAlarm);
                                pulseView.startPulse();
                                //tvr.setText("Hey");
                                //final TextView receivedMsg = (TextView) findViewById(R.id.textView2);
                                //receivedMsg.setText(br.toString());
    
                                dis2.close();
                                s.close();
    
                            } catch (IOException e) {
                                e.printStackTrace();
                                Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
                            }
                        }
                    };
                    t.start();
                    Toast.makeText(MainActivity.this, "Sending data: " + text, Toast.LENGTH_LONG).show();
                    /*
                    if (text.equalsIgnoreCase("Hi") || text.equalsIgnoreCase("Hello") || text.equalsIgnoreCase("Hey") || text.equalsIgnoreCase("Hello Pi") || text.equalsIgnoreCase("Hi Pi") || text.equalsIgnoreCase("Hey Pi"))
                    {
                        //new RetriveByteArray().execute("https://raw.githubusercontent.com/felixpalmer/android-visualizer/master/demo/demo-3.gif");
                        //gif.startAnimation();
                        HashMap<String, String> myHashAlarm = new HashMap<String, String>();
                        myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_ALARM));
                        myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "SOME MESSAGE");
                        String random = (helloMessages[new Random().nextInt(helloMessages.length)]);
                        ts.speak(random, TextToSpeech.QUEUE_FLUSH, myHashAlarm);
                        pulseView.startPulse();
                        tvr.setText("Hey");
                    }
                    else if (text.equalsIgnoreCase("Who are you") || text.equalsIgnoreCase("Introduce Yourself") || text.equalsIgnoreCase("Tell me something about yourself") || text.equalsIgnoreCase("Describe yourself"))
                    {
                        //new RetriveByteArray().execute("https://raw.githubusercontent.com/felixpalmer/android-visualizer/master/demo/demo-3.gif");
                        //gif.startAnimation();
                        HashMap<String, String> myHashAlarm = new HashMap<String, String>();
                        myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_ALARM));
                        myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "SOME MESSAGE");
                        String random = (introMessages[new Random().nextInt(introMessages.length)]);
                        ts.speak(random, TextToSpeech.QUEUE_FLUSH, myHashAlarm);
                        pulseView.startPulse();
                        tvr.setText("Hey this is Doctor Pi");
    
                    }
                    else if (text.equalsIgnoreCase("I love you")|| text.equalsIgnoreCase("I am in love with your voice") || text.equalsIgnoreCase("Hey Akanksha"))
                    {
                        //new RetriveByteArray().execute("https://raw.githubusercontent.com/felixpalmer/android-visualizer/master/demo/demo-3.gif");
                        //gif.startAnimation();
                        HashMap<String, String> myHashAlarm = new HashMap<String, String>();
                        myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_ALARM));
                        myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "SOME MESSAGE");
                        ts.speak("I Love you too", TextToSpeech.QUEUE_FLUSH, myHashAlarm);
                        pulseView.startPulse();
                        tvr.setText("I Love you too");
                    } else {
                        //new RetriveByteArray().execute("https://raw.githubusercontent.com/felixpalmer/android-visualizer/master/demo/demo-3.gif");
                        //gif.startAnimation();
                        HashMap<String, String> myHashAlarm = new HashMap<String, String>();
                        myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_ALARM));
                        myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "SOME MESSAGE");
                        String random = (sorryMessages[new Random().nextInt(sorryMessages.length)]);
                        ts.speak(random, TextToSpeech.QUEUE_FLUSH, myHashAlarm);
                        pulseView.startPulse();
                        tvr.setText("Sorry!");
                    }*/
                }
                else{
                    Toast.makeText(MainActivity.this,"Null string received",Toast.LENGTH_LONG).show();
                }
                //for (String result : matches)
                //    text += result;
            }
    /*Server side code-Python*/
    import sqlite3
    import nltk
    from nltk.tokenize import word_tokenize
    from socket import *
    
    HOST = "127.0.0.1" #local host  IT SHOWS AN ERROR WHEN I USE MY PC's IP ADDRESS  47.11.229.90
    PORT = 25001 #open port 18000 for connection
    s = socket(AF_INET, SOCK_STREAM)
    s.bind((HOST, PORT))
    print("Hello")
    s.listen(1) #how many connections can it receive at one time
    connect_device, addr = s.accept() #accept the connection
    print("Connected by: ",addr)
    
    while True:
        print("In the loop")
        data = connect_device.recv(1024)  # how many bytes of data will the server receive
        data = data.decode('utf-8')
        print("Received: ", repr(data))
    
        conn = sqlite3.connect("ciao.db")
        c=conn.cursor()
        #string = "Hey tell me something about dengue"
        #string2 = string.lower()
        string = repr(data)
        string2 = string.lower()
        list_items = word_tokenize(string2)
        print("List items = ",list_items)
        Greetings = ['hi', "hey"]
        c.execute("SELECT Disease_Name FROM ciao")
        data = c.fetchall()
        data2 = []
        for i in data:
            for j in i:
                if j is not None:
                    data2.append(j)
    
        print("data2 = ",data2)
        msg = ""
        print("loop starts")
        for i in list_items:
            print(i)
            print("Data = ",data2)
    
            if i in data2:
                if 'symptoms' in list_items:
                    c.execute("SELECT Symptoms from ciao WHERE Disease_Name = (?)",(i,))
                    sym = c.fetchall()
                    for j in sym:
                        for k in j:
                            msg += k + " "
                if 'remedial' in list_items:
                    c.execute("SELECT Remedial_Measures from ciao WHERE Disease_Name = (?)", (i,))
                    rem = c.fetchall()
                    for j in rem:
                        for k in j:
                            msg += k + " "
                if 'medicines' in list_items:
                    c.execute("SELECT Medicines from ciao WHERE Disease_Name = (?)", (i,))
                    rem = c.fetchall()
                    for j in rem:
                        for k in j:
                            msg += k + " "
                if 'diagnostic' in list_items:
                    c.execute("SELECT Diagnostic_tests from ciao WHERE Disease_Name = (?)", (i,))
                    rem = c.fetchall()
                    for j in rem:
                        for k in j:
                            msg += k + " "
                if 'hospitals' in list_items:
                    c.execute("SELECT Related_Hospitals from ciao WHERE Disease_Name = (?)",(i,))
                    rem = c.fetchall()
                    for j in rem:
                        for k in j:
                            msg += k + " "
                if not('symptoms' in list_items) and not('remedial' in list_items) and not('medicines' in list_items) and not('diagnostic' in list_items) and not('hospitals' in list_items):
                    c.execute("SELECT * from ciao WHERE Disease_Name = (?)",(i,) )
                    rem = c.fetchall()
                    for j in rem:
                        for k in j:
                            msg += k + " "
    
            else:
                if i in Greetings:
                    if len(list_items) == 1 or len(list_items) == 0:
                        msg = "Hello I am Pi"
        if msg == "":
            msg = "Sorry"
        print(msg)
        connect_device.sendall(msg)
        conn.close()
    connect_device.close()
    
    • Admin
      Admin almost 10 years
      Maybe sudo apt-get autoclean or sudo apt-get autoremove?
    • Danatela
      Danatela almost 10 years
      First install new kernel, then remove old. And I suggest you to test new before removing old. Things may occur. If you have room only for one kernel, you did it wrong and have to resize your /boot partition.
    • edoher
      edoher almost 10 years
      @skyroma thanks, already tried that and emptying the Bin, doens't work
    • edoher
      edoher almost 10 years
      @Danatela I always could upgrade my kernel, and Ubuntu Tweak would do the trick by deleting old kernels. Now it just seem to have ran out of space and I don't know what to delete to fix this.
    • bain
      bain almost 10 years
      Post the output of dpkg -l linux-image*
    • edoher
      edoher almost 10 years
      OK, just edited the question with that output @bain
    • bain
      bain almost 10 years
      Looks like you have a bunch of files that don't belong to any package. Assuming you are currently running 3.13.0, you can just do rm /boot/*-3.0.0-12-generic
    • edoher
      edoher almost 10 years
      That did the job, @bain! You rule! How can I mark your comment as an answer?
    • raggedycoder
      raggedycoder over 6 years
      did you add <uses-permission android:name="android.permission.INTERNET" /> to your AndroidManifest.xml. If yes, please provide the stacktrace after you're trying to communicate your server.