Score:1

Why does Ubuntu keep replacing my Sources.list file during installation?

za flag

I am attempting to make a custom ISO based off Kubuntu 22.04 (Jammy Jellyfish) and I use cubic to compile it into a ISO. Every time I install it, it replaces my sources.list with the default Ubuntu one by default for no reason whatsoever. Is there a way I can permanently replace the sources.list file?

Marco avatar
br flag
Please update the question and explain how you make the distro. Which software do you use? From my knowlege, there are two places, where the sources list comes from. 1. base.tgz, 2. apt package.
user233532 avatar
za flag
I updated the comment for more clarification, sorry about that.
Marco avatar
br flag
Please update the question and add on which Ubuntu version you are working and for which Ubuntu version you want to create the distro. Actually cubic does not create distros, it creates ISO images (Custom Ubuntu ISO Creator).
user233532 avatar
za flag
I updated the comment for more clarification, sorry about that.
Marco avatar
br flag
As I have not used cubic yet, it would me take hours to install it and dig into the system to see at which point the problem is. I fear at the end, it works in my test environment, because you just added a config which has the effect you describe and all my time was wasted. Maybe somebody with more knowledge of cubic will show by and can solve this immediately.
muru avatar
us flag
The `sources.list` is not copied from the installer system. It's generated based on things like the location and mirrors selected during installation. https://askubuntu.com/a/1059993/158442
user233532 avatar
za flag
is there a way i can edit how its generated?
Score:0
us flag

This answer was adapted from How to retain a custom sources.list after the customized OS has been installed?. This solution will work for Ubuntu Desktop 22.04, 22.10, and the 23.04 Legacy Installer ISO.

  1. On your host machine, create a sources.list file with the contents you desire, and save it.

  2. In Cubic's Terminal page, create a directory to store your sources.list file.

    mkdir /opt/apt
    cd /opt/apt
    
  3. Drag and drop your sources.list file from step 1 onto the Terminal page to copy it into the current directory (/opt/apt).

  4. Make sure the permissions are correct.

    chmod a=r,u=rw sources.list
    ls -la sources.list
    # -rw-r--r-- 1 user user 0 Jul  8 19:15 sources.list
    
  5. Copy the new sources.list file to /etc/apt so you can continue customizing your OS.

    cp /opt/apt/sources.list /etc/apt
    
  6. Continue customizing your OS.

    apt update
    

    Make additional changes, as desired.

  7. Use preseeding to update the /etc/apt/sources.list file after it is overwritten by Ubiquity.

    On Cubic's Options page, on the Preseed tab, add the following at the end of the ubuntu.seed file:

    ubiquity ubiquity/success_command string \
        in-target bash -c 'cp /opt/apt/sources.list /etc/apt/';
    

    This will copy the correct sources.list file from /opt/apt/ to /etc/apt/ after successful installation of your customized OS.

  8. Generate your customized ISO and test.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.