Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use mirrors to speed-up ubuntu boxes #195

Closed
gionn opened this issue Mar 20, 2014 · 19 comments
Closed

Use mirrors to speed-up ubuntu boxes #195

gionn opened this issue Mar 20, 2014 · 19 comments

Comments

@gionn
Copy link

gionn commented Mar 20, 2014

Hi,

ubuntu boxes come with the us.archive.ubuntu.com mirror configured in sources.list, however ubuntu support this nice feature: http://askubuntu.com/a/37754/17602

Can't ubuntu boxes simply use that instead of the default us mirror?

@juliandunn
Copy link
Contributor

Sure, seems like a good idea. I would take a patch for that. If there's a way to do it via preseed.cfg that would be great.

@gionn
Copy link
Author

gionn commented Mar 20, 2014

It should: https://help.ubuntu.com/lts/installation-guide/i386/preseed-contents.html#preseed-mirror

However I have no idea about the syntax, since it accept a simple:

d-i mirror/http/hostname string archive.ubuntu.com

I can try later.

@gionn
Copy link
Author

gionn commented Mar 25, 2014

I've tried, but it doesn't work, and it dosn't return me any error, so I suppose that preseed accept only plain hostname and nothing else.

Alternatives?

@mansona
Copy link

mansona commented Jul 15, 2014

Has there been any progress on this?

@juliandunn
Copy link
Contributor

@mansona I am not a Ubuntu expert, so I don't know how to improve this. If you know, please feel free to send a patch!

@mansona
Copy link

mansona commented Aug 20, 2014

@juliandunn sure i wouldn't mind taking a punt at this, we've fixed it in our boxes by replacing the sources.list file with the "correct" version before running anything in chef. What does your build system look like for these boxes? i.e. where would i need to make the change so that it would get automatically built in in future?

@juliandunn
Copy link
Contributor

@mansona We don't currently have an autobuild system for these boxes, but I'm not sure that's relevant. Reading back in the thread, it looks like what we need to do here is to make sure the built box has a /etc/apt/sources.list with the mirror settings rather than hardcoded US servers, so we just need to solve for that, either with a preseed.cfg directive, or a postinstall script that changes those settings.

@gionn
Copy link
Author

gionn commented Aug 20, 2014

It's simple as putting in /etc/apt/sources.list the contents:

deb mirror://mirrors.ubuntu.com/mirrors.txt <version> main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt <version>-updates main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt <version>-backports main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt <version>-security main restricted universe multiverse

where <version> is the codename of the release (precise for 12.04, trusty for 14.04, etc)

To clarify, this issue was created with the only objective to avoid using the hardcoded US mirrors.

@juliandunn
Copy link
Contributor

Cool, so a distro-version-independent script that could be applied to all current ubuntus (need to map the version to the string) would work.

@gionn
Copy link
Author

gionn commented Aug 20, 2014

Maybe a dead-simple:

sed -i 's/http:\/\/us.archive.ubuntu.com\/ubuntu\//mirror:\/\/mirrors.ubuntu.com\/mirrors.txt/g' /etc/apt/sources.list

will do the trick.

@adi-
Copy link

adi- commented Dec 17, 2014

sed returns permission denied

sed: couldn't open temporary file /etc/apt/sedJgeTJl: Permission denied

@adi-
Copy link

adi- commented Dec 17, 2014

ahhh, nevermind. sudo made the trick!

@adi-
Copy link

adi- commented Dec 17, 2014

btw, @gionn's response work like a charm!

@gionn
Copy link
Author

gionn commented Dec 17, 2014

Please note that that mirrors.txt lists even the ugliests ubuntu mirrors and sometimes I get random errors.

@juliandunn
Copy link
Contributor

Doesn't seem like a great feature to implement then...?

@thasmo
Copy link

thasmo commented Dec 25, 2014

As far as I know mirrors.txt returns you the closest mirror(s) which sometimes are not the fastest. At the moment using the US mirrors for Europe really slows down the process a whole lot unfortunately.

@miketheman
Copy link

Looks like #323 solves this for Debian.

@tersmitten
Copy link
Contributor

Some apt tools do not work with mirror:// (e.g. cron-apt, apt-file). This might be a problem.

@cheeseplus
Copy link
Contributor

Unfortunately Ubuntu doesn't offer a mirror redirector so our hands are kind of tied here - closing this issue as there isn't much that can be done here with the fact mirrors.txt seems inadequate and the mirror:// URI doesn't work across the board.

Feel free to open a new one if someone finds a good holistic solution, otherwise we'll just have to deal until Canonical decides to set something up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants