I have tried, unsuccessfully, to get various AI models to create a script that will curl or wget the latest Ubuntu LTS desktop torrent, even should that LTS version update in the future (beyond 24.01.1 LTS). The purpose is that I would like to seed whatever the latest LTS torrent is and I don’t want to have to keep checking the Ubuntu page for updates, I want it automatic. I know that LTS is slow to change versions but I am annoyed that AI can’t just write a decent script for this.

I also have downloaded rtorrent as a command line and will deal with how to make sure the latest LTS is used, as opposed to the prior one, with a different script later, but that’s not what I’m trying to now.

I am not asking for a human to create this script for me. I am asking why AI models keep getting this so wrong. I’ve tried ChatGPT 4o, I’ve tried DeepSeek, I’ve tried other localized models, Reasoning Models. They all fail. And when I execute their code, and I get errors and show it to the models, they still fail, many times in a row. I want to ask Lemmy if getting an answer is theoretically possible with the right prompt or if AI just sucks at coding.

This shouldn’t be too hard to do. At https://www.releases.ubuntu.com/, they list the releases. When curling the webpage, there’s a list of the releases with version numbers some with LTS. New versions are always larger numbers. At https://ubuntu.com/download/alternative-downloads, they list the torrents. Also, all release torrents for desktop are in the format https://www.releases.ubuntu.com/XX.XX/*desktop*.torrent. I’ve tried to teach these models this shit and to just create a script for me, holy shit it’s been annoying. The models are incredibly stupid with scripting.

I’m not a computer programmer or developer and am picking up more coding here and there just because I want to do certain things in linux. But I just don’t understand why this is so difficult.

So my question is, is there ANY prompt for ANY model that will output successful code for this seemingly easy task, or is AI still too stupid to do this?

  • LostXOR@fedia.io
    link
    fedilink
    arrow-up
    43
    ·
    1 day ago

    Why the hell would you ask an AI model to write the script for you? It’s a one-liner, took me just a minute to write. Even if you know very little of Bash I can’t imagine it would take more than a few minutes of research to figure it out.

    curl $(curl https://ubuntu.com/download/alternative-downloads | grep -o "https.*desktop.*torrent" | tail -1) -o ubuntu-latest.torrent
    

    AI is mediocre at best when it comes to writing code, and if you don’t have the skill to troubleshoot its garbage outputs you shouldn’t be using it at all.

    • sem
      link
      fedilink
      arrow-up
      2
      ·
      6 hours ago

      Great solution (esp the corrected one further down). I can relate to OP in the sense that if I studied programming, I might be able to whip something like this up, but so far I haven’t been disciplined enough to learn and practice programming consistently.

      It’s also interesting, this new AI variation of Cunningham’s Law, wherein posting an incorrect solution on a discussion board will yield way more attention and correct answers than asking a question. It’s interesting to wonder why that is.

    • secretlyaddictedtolinux@lemmy.worldOP
      link
      fedilink
      arrow-up
      8
      ·
      edit-2
      1 day ago

      Thank you! There are two different kinds of people in the world. There are those great at coding and those great at watching netflix and doing whip-its.

      edit: actually this torrent downloads ubuntu-22.04.5-desktop-amd64.iso, which isn’t the latest LTS version (which is 24.01.1). It’s probably good enough, but part of the challenge in this was to always torrent the latest one.

      does anyone know why ubuntu-latest.torrent would try to download 22 instead of 24 LTS?

      • LostXOR@fedia.io
        link
        fedilink
        arrow-up
        12
        ·
        1 day ago

        My bad, that’s what happens when you write a script in a minute. It turns out the latest LTS version is actually the second one listed, not the last. This one should actually fetch the latest version:

        curl $(curl https://ubuntu.com/download/alternative-downloads | grep -o "https.*desktop.*torrent" | sed "2q;d") -o ubuntu-latest.torrent
        
        • hddsx@lemmy.ca
          link
          fedilink
          arrow-up
          2
          ·
          22 hours ago

          I’m so confused. Why are you using sed and grep? Can’t you use sed and/or awk to write a regular expression?

          • LostXOR@fedia.io
            link
            fedilink
            arrow-up
            2
            ·
            20 hours ago

            grep finds the URLs for the desktop torrent files, sed selects the second one. There’s probably a more elegant way to do it but for a quick script it’s fine.

      • LostXOR@fedia.io
        link
        fedilink
        arrow-up
        8
        ·
        1 day ago

        You can be good at anything if you just put in some effort. The mindset that since you’re not good at programming you can never be is stupid.

        • secretlyaddictedtolinux@lemmy.worldOP
          link
          fedilink
          arrow-up
          5
          ·
          edit-2
          1 day ago

          I don’t know if that’s actually true. If I’m 5’2" and uncoordinated will I ever become a professional basketball player? I try to be honest with myself about my strengths and weaknesses. For me, just stopping windows was the victory.

      • CaptainBlagbird@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        19 hours ago

        does anyone know why ubuntu-latest.torrent would try to download 22 instead of 24 LTS?

        ubuntu-latest.torrent (what’s written after -o) is the output name. You should be very careful with executing commands that you don’t fully understand. Might save you a lot of trouble in the future.

  • Einar@lemm.ee
    link
    fedilink
    arrow-up
    9
    ·
    1 day ago

    Probably a stupid comment, but still: if you’re a coder, you might be quicker just writing such a script yourself. Just fetch the links, slice them up, sort them by version and wget the one with the highest number.

    If you’re not a coder, maybe someone here can help out?

  • BaumGeist@lemmy.ml
    link
    fedilink
    arrow-up
    8
    ·
    1 day ago

    AI isn’t stupid because it doesn’t possess any intelligence to begin with, the term “AI” is just a marketing misnomer.

    Language Models are essentially really advanced Markov Chain generators. Once you understand that, you’ll realize why your question is like “I keep asking these water mills to make me a cup of coffee, but they all taste like dirt”: wrong tool for the job, it just happens to be tangentially related.

    You’re also asking if there’s a way to precisely word a request so that the computer will do what you want it to do. Luckily for you, there is! It’s a trick that’s been around for ~60 years and it’s called “programming languages”

    • secretlyaddictedtolinux@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      ·
      1 day ago

      Yes, but I need an interface between my brain at my IQ level and the programming language to get it to work… which apparently why I need to use a bunch of non-sense generating Markov chains…

      • BaumGeist@lemmy.ml
        link
        fedilink
        arrow-up
        5
        ·
        1 day ago

        That interface is called a manual or tutorial, and there are many better ones than neural networks

        • secretlyaddictedtolinux@lemmy.worldOP
          link
          fedilink
          arrow-up
          2
          ·
          1 day ago

          when i first started linuxing linux, i tried to read man man, but it was over 700 lines

          my primary linux skills are whip-its and watching netflix. i’m sort of at the lower-skill end of the linux userbase. i don’t know if there’s any way to every change that, so why try?

          • Kiernian@lemmy.world
            link
            fedilink
            arrow-up
            2
            ·
            edit-2
            1 day ago

            So, I kinda had this problem myself at one point a decade and a half ago, only it was booze and serviio.

            I ended up taking an old tower I had, installing Ubuntu on it with no Xwindows or GUI of any kind, set up ssh, and unplugged the monitor, keyboard, and mouse and accessed the Ubuntu box only from a putty session on my windows box.

            Then, when I wanted to do anything on the Linux box I’d ssh in and command line it. And Google and try again until I got it right.

            I turned it into a domain controller for the windows boxes (well, login server via ldap) and had an irc bouncer and a bot on it, among other things.

            All while still drinking and streaming video.

            I can’t say what the magic bullet will be for anyone else, but I was able to learn by removing my “crutches” until it just… Clicked for me. YMMV but don’t stop trying.

              • Kiernian@lemmy.world
                link
                fedilink
                arrow-up
                3
                ·
                1 day ago

                For gaming and everything else I couldn’t easily do on Linux back when mandriva and Gentoo were still considered fairly new distros? And because I didn’t know Linux well yet?

                Linux has come a LONG way, but back as much as 20 years ago, doing something as simple as installing suse8 could see you with a fat string of error -3’s just because you had a slightly less common model of hard drive. Forget trying to play one of the few MMOs that existed back then.

                Production mac’s were still running os8 back then.

                It was a different world and gaming meant windows for almost all major titles because there were only so many WINE contributors.

  • AstridWipenaugh@lemmy.world
    link
    fedilink
    arrow-up
    8
    ·
    1 day ago

    AI certainly can do it. But here’s the thing with generative AI: the answer is only as good as the question you ask. If you don’t know exactly what to ask for and which details are important, the AI doesn’t know what you meant to ask and can’t infer that. AI usually does not pick up implied context that an experienced person would. A person would be able to make an educated guess about what you actually meant and answer that question.

    As someone with 20 years of programming experience, I would recommend against using AI to learn to program. You’re asking something that doesn’t actually know how to program to show you how to do it. From my experience with coworkers using AI, it doesn’t improve their work; it simply accelerates the rate at which they can produce low quality work.

    Once you’re more skilled than the AI, you can use it to speed up menial tasks, like generating boilerplate and stubbing things out. It absolutely will be wrong in some ways, and you need to be able to tell when it’s wrong and know how to fix it.

    • secretlyaddictedtolinux@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      ·
      1 day ago

      You’re probably right, but I’m not actually trying to learn to program. I learn programming and linux on an as needed basis, but I just keep learning more of it when I want to do stuff.

      If I can’t get AI to figure this out for me, I am not sure if it’s worth it to me to learn substantially more about bash programming just to bypass going to a webpage. It would probably be like 4 days of learning. From the page listing the torrents in a spreadsheet, I am guessing it would be easy to figure out how to list them, delete the ones without LTS in the name, order them by number and delete everything but the highest number. An LLM could probably help me with that task. I still don’t know if I have the IQ/insight amount to get it to a working level, so it’s also a gamble.

      It just seems like an LLM should be able to do all of this. This is sort of the quintessential trivial programming task that an LLM should be able to easily do.

      • november@lemmy.vg
        link
        fedilink
        English
        arrow-up
        5
        ·
        1 day ago

        So the thing is, if you learn enough about bash to bypass going to this webpage, it’ll also help you bypass going to other webpages. What you learn now will help you in the future.

        • secretlyaddictedtolinux@lemmy.worldOP
          link
          fedilink
          arrow-up
          1
          ·
          1 day ago

          i don’t know if i’m capable of longitudinal thinking like that. my style is more like why not have some delicious and nutritious candy and then sleep for 8 hours?

  • edb_fyr@lemmy.world
    link
    fedilink
    arrow-up
    6
    ·
    1 day ago

    In my experience, Chat GPT is much better at the general programming patterns and concepts than specific API implementations. Especially less commonly used ones, where it often gives a solution that only looks reasonable but uses the totally wrong methods. I guess it’s similar with scraping the HTML of the Ubuntu releases page to get the latest torrent. It doesn’t know the exact HTML layout, so it guesses what is a likely one, even though it is wrong.

    • secretlyaddictedtolinux@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      ·
      1 day ago

      AI models are great for troubleshooting and understanding concepts or figuring out approaches but in actual implementation they seem weak to me. I’ve heard people saying how AI is replacing much of coding and I’m not really a coder but I can’t understand how that would be currently possible with the responses I see from AI,

      • Lucy :3@feddit.org
        link
        fedilink
        arrow-up
        2
        ·
        1 day ago

        It replaces the first steps, so Hello World, figuring out primes etc., but it will very likely fail with any (larger) existing codebase and frameworks. And the thing it can figure out - eg. implement quick sort - are probably implemented much better anyway.

    • MajorHavoc@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      1 day ago

      This is a great point. There’s (maybe)more chance on an AI spitting out a successful RSS parser than a successful curl script.

      Though if I was going to place my bet, I bet there’s too much diversity in the training data of both use cases to eat a useful result from current generation AI.

      I’ve had particularly bad luck coaxing Parsers out of AI, and I’ve really tried, because I hate writing Parsers. It’s almost like writing a valid parser is a huge pain in the ass. Heh.

    • secretlyaddictedtolinux@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      ·
      1 day ago

      I am not that familiar with RSS and wouldn’t even know how to do this. I am trying to get AI to create a script so that I can execute it without having to go to the Ubuntu website. I want to do this by command line.

    • secretlyaddictedtolinux@lemmy.worldOP
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      1 day ago

      So there’s a 0 chance of it creating a working script with just AI? I probably am not knowledgeable enough at coding to do bash script corrections myself. If I have to become a good enough coder to edit code, it sort of defeats the purpose of AI doing the code for me. Why not just learn bash scripting and do it myself at that point?

      • MajorHavoc@programming.dev
        link
        fedilink
        arrow-up
        4
        ·
        edit-2
        1 day ago

        If I have to become a good enough coder to edit code, it sort of defeats the purpose of AI doing the code for me.

        Yes. Yes it does.

        And that’s the part they AI salesman are lying to you about.

        The AI that can be created with current science make great copilots, and can never be trusted to pilot anything.

        • sem
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          7 hours ago

          I’ve been watching YouTube about actual pilots, and one fun thing is the Autopilot is often better than the human in the mechanics of steering the plane in stable conditions, but it can’t really do anything else, so it’s designed to turn itself off with an alarm whenever it encounters a situation it can’t handle.

          I guess that’s because it’s an old school program with error handling, etc, where all generative AI is used in such wider scopes it can’t be realistically programmed to say “I can’t do this” because its limitations are so poorly defined?

          • MajorHavoc@programming.dev
            link
            fedilink
            arrow-up
            2
            ·
            edit-2
            1 hour ago

            it can’t be realistically programmed to say “I can’t do this” because its limitations are so poorly defined?

            Yep!

            There are responsible teams building LLM AIs that do program their LLM to say “I can’t do this”. But they are playing “bop-a-mole”. They see a bad output, they write new code to catch and replace it. But there’s always a new innovative bad output hiding in the depths of the learning model waiting for the input that sets it free.

            So only really old LLMs that have had millions of users using them daily for 30+ years without issues should really be trusted. (And there are - currently - no useful LLMs that meet this criteria.)

            The other intrinsic problem is that LLMs are primarily trained against the writings of self-declared experts, and have no concept of sharing a confidence level through writing tone.

            This means that an LLM uses an equally authoritative writing style when regurgitating things it has trained on millions of times (things commonly accepted as fact) as when regurgitating things it has only trained on once (lies, sarcasm).

            • sem
              link
              fedilink
              arrow-up
              1
              ·
              2 hours ago

              an LLM uses an equally authoritative writing style when regurgitating things it has trained on millions of times (things completely accepted as fact) as when regurgitating things it has only trained on once (lies, sarcasm).

              I never knew that and it explains a lot.

      • Ledivin@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        1 day ago

        At this point in time, yes there is a 0% chance that AI will get this right consistently. Depending on your model and prompt, I’m sure you’ll get it occasionally - maybe even often - but for this to be automatic you’d need to be looking at like 95+%

          • Ledivin@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            edit-2
            1 day ago

            We need more information - what are the prompts you’re giving it? You’ll also probably have to give context with API docs

            If you haven’t played with LLMs much, the best advice I can give you is to be more verbose. Seriously, write something like TEN times more than you think you need.

            • secretlyaddictedtolinux@lemmy.worldOP
              link
              fedilink
              arrow-up
              1
              ·
              edit-2
              1 day ago

              here is deepseek deepsucking, to use a phrase someone else came up with:

              Thought for 2 minutes 13 seconds

              Okay, so I’m trying to write a bash script that can download the latest Ubuntu LTS release from the given torrent site. From what I understand, the user wants the script to automatically find the most recent LTS version and then wget it based on its filename.

              First, looking at the example output from curl, I see that each row has an info hash, a torrent name, and some download stats. The torrent names seem to follow a pattern like “ubuntu-YYYY.YY.YISO desktop-amd64.iso”. My goal is to extract the version number from these names.

              I need to figure out how to programmatically identify the latest LTS release. The user mentioned that LTS releases have the format XX.XX.X, so I should look for three numbers separated by periods. But I also know that sometimes there are more than two digits in each part (like 20.12 instead of just 04), so my script should handle varying lengths.

              I think using a regular expression would be the best approach here. Something like matching on \d+.\d+.\d+ should capture all three parts, regardless of their length. Then, I can split these into integers and compare them to find the maximum version number.

              Once I have the latest version, I need to extract the filename from it. The filenames after the info hash look like “ubuntu-{version}-desktop-amd64.iso”. So, I’ll need to parse this string to get just the version part.

              Next, constructing a curl command to download the file might be necessary. But since the user mentioned using wget, maybe they prefer that method instead of curl for simplicity. Alternatively, if the script is supposed to use curl, then it would involve combining the filename into a full URL and appending it to the curl command with options like -o for output.

              But in their example, they showed using wget directly, so perhaps the script can be written to take the info hash or name and construct the appropriate wget command. However, sometimes the filename isn’t directly available on the site; you have to click through pages. That complicates things because the number of pages could vary, making it hard for a static script.

              Looking at their example output, there are 8 files listed. The latest one is “kubuntu-24.04.1-desktop-amd64.iso” with 402 complete downloads. So I need to identify that as the current LTS and perhaps update when new versions come out.

              Putting this all together, my script will:

              Parse each torrent row. Extract the info hash or filename. Use regex to find the version number in the filename. Convert it into an integer for comparison. Keep track of the latest version found. Once the latest version is determined, construct a wget command to download that specific file. Potential challenges include handling different release formats (like 20.12) and dealing with multiple pages on the torrent site. Additionally, ensuring that the script handles cases where there are no more recent releases than current would be important for accuracy.

              I think starting by writing a function to extract the version number from each filename is essential. Then, another part of the script can loop through all filenames, apply this function, and keep updating the latest version as needed.

              Finally, constructing the full URL with the correct path seems tricky because the torrent site uses “/file?info_hash=X” format. But since we have the info hash from each row, maybe it’s better to use that for downloading rather than trying to parse the path from the name.

              In summary, the script will involve parsing HTML content, extracting version numbers, and using wget or curl to download the file with the latest version.

              To assist you in writing a bash script that downloads the latest Ubuntu LTS release, here is a step-by-step explanation of the process:

              Parse the HTML Content: Extract all torrent rows from the provided URL.

              Extract Version Numbers:

              Use regular expressions to identify and extract version numbers from each row’s filename. The format appears to be ubuntu-{version}-desktop-amd64.iso. Identify the Latest Release:

              Convert the extracted strings into integers for comparison. Keep track of the highest version encountered. Construct the Download Command:

              Use the identified latest version’s filename in a wget command to download the file directly from the torrent site. Here is the bash script implementing these steps:

              
              #!/bin/bash
              
              # Function to extract version number from a string
              extract_version($filename) {
                  # Using regex to find all numbers followed by periods
                  echo "$filename" | grep -o "[0-9]+\.([0-9]+)" | head -n 1 | sed 's/\./\1/p' | head -n 1
              }
              
              # Function to determine the latest version number from a list of filenames
              latest_version($filenames) {
                  local max_version=0
                  for file in $filenames; do
                      version=$(extract_version "$file")
                      if [[ "$version" > "$max_version" ]]; then
                          max_version=$version
                      fi
                  done
                  echo "$max_version"
              }
              
              # Function to construct the download command using wget
              download Latest release:
                  local latest_version=($(
                      latest_version "${Filenames[@]}"
                  ))
              
                  echo "Downloading from https://ipv6.torrent.ubuntu.com/file?info_hash=V%7BV%7D" \
                      . "$version -o /path/to/download/directory/$version.deb"
              
              # Replace with actual file list after parsing
              # Filenames should be replaced with the actual files obtained from the torrent site.
              
              This script will help identify and download the latest available Ubuntu LTS release based on the version number extracted from the filenames. Make sure to replace Filenames with your parsed data containing the necessary information.
              
      • SpikesOtherDog@ani.social
        link
        fedilink
        arrow-up
        2
        ·
        1 day ago

        I think you are approaching the answer you needed versus the one you were seeking.

        In programming I have had to accept the limitations of the tech I was working with versus the automation I wanted to create. Sometimes I had to abandon something I wrote and rewrite it in a different language to accomplish my goals.

        The LLM doesn’t understand the limitations, and will pull code from popular answers without consideration to the project you are creating. If you choose to use a LLM, you will need to break up your project into steps and integrate the steps.

  • hendrik@palaver.p3x.de
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    1 day ago

    You are a powerful terminal assistant. You will answer in the most helpful possible way and provide the user with Linux bash commands to accomplish their tasks. Use Google and internet search to fetch all necessary information. Always format your answer in markdown format.

    User question: How do I download the latest Ubuntu ISO torrent? Make sure it’s the latest version from ubuntu.com Make sure to also include the curl or wget command to download the torrent file itself.

    • secretlyaddictedtolinux@lemmy.worldOP
      link
      fedilink
      arrow-up
      3
      ·
      1 day ago

      My LLMs don’t have Internet access yet. I was trying to get https://github.com/open-webui/ to work in docker but struggled with the backend connecting with ollama, which was working. I mostly have been using LM Studio recently, which I don’t think can go online for searching, or if it does I haven’t figured that out yet.

      • hendrik@palaver.p3x.de
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        1 day ago

        Fair enough. Just without internet access, the entire task becomes impossible. It then has to make up some URL which will likely turn out to be not correct. Plus it doesn’t really know what year or month it is…

        So, with my prompt and ChatGPT, it returns the correct command.

        • sem
          link
          fedilink
          arrow-up
          1
          ·
          7 hours ago

          If it’s correct can you post it here

        • secretlyaddictedtolinux@lemmy.worldOP
          link
          fedilink
          arrow-up
          2
          ·
          1 day ago

          so i should try to get open-webui working and then have it try to generate something. is there an equally good alternative to open-webui? I could keep trying to troubleshoot why it can’t find ollama running on localhost:11434 or whatever it was, but I spent hours on it and there didn’t seem to be a logical reason why it was happening, although there clearly was one and I just wasn’t smart enough to figure it out.

          • hendrik@palaver.p3x.de
            link
            fedilink
            English
            arrow-up
            2
            ·
            edit-2
            1 day ago

            I’m not sure what you’re trying to accomplish. If you ask me and it’s the task from your post… Just write the 5 lines of Python or Bash script yourself, to scrape the URL from the website (or better, find some API endpoint, insert the current year into the correct format, or find the URL that always returns the current file), download it into the directory your torrent client watches for incoming files an be done with it… Or find out how the mirror pages do it automatically.

            Otherwise I’d recommend some AI framework like Langchain. You can create an agent to help with terminal commands, attach a shell, give it a Google search tool, a webscraping tool, come up with the few hundred lines of necessary Python code plus the prompts… And then you can attach that to one of the inference endpoints. Pretty much anything will do with these frameworks, I believe they support WebUI, ollama, anything that is compatible with the OpenAI API…

  • OmegaLemmy@discuss.online
    link
    fedilink
    arrow-up
    2
    ·
    1 day ago

    Find a decent torrent searching tool, ask the ai to search for it, have it create a filter using whatever, whether it be grep or regex, to check and compare the dates

    If you’re gonna do this, have something with chain of thought

    • secretlyaddictedtolinux@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      ·
      1 day ago

      is chain of thought the same as the reasoning models or the same as DeepSeek when it shows it’s thinking process?

      I’m sadly not that familiar with grep or regex and torrent searches sometimes disappear. The Ubuntu website has a very standard format and doesn’t change often. This shouldn’t be that hard for AI to script. It just seems like AI is bad at scripting.

  • TropicalDingdong@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    1 day ago

    Early in I was really interested in what I could get chat got to do with minimal guidance. It really didn’t (at the time) have the ability to hold any kind of overarching “structure” or goal in mind. When it got something wrong, it would just wrongly keep trying the same thing.

    I’m still interested in what a local AI buddy could do on its own, but in terms actually ever accomplishing anything, I think it still very much needs its hands held.