/etc/resolv.conf missing on live CD

Bug #1045757 reported by BlueLight on 2012-09-04
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
relinux
High
kokoye2007 

Bug Description

When creating an ISO of a working 12.04 Ubuntu system ISO doesn't copy the /etc/resolv.conf link created on the original OS by resolvconf package - which breaks networking (DNS).
That makes the resulting live ISO not very "live" - browsing and all DNS dependent stuff just fails.
I've also tried remastersys - same story.
Ugly workaround: after booting live iso or after installing a system from it I have to run "sudo dpkg-reconfigure resolvconf " and answer "ok-yes"... and then it's all good.

There is a related bug repoer with Ubuntu team: https://bugs.launchpad.net/ubuntu/+source/resolvconf/+bug/1000244
and it looks like someone was running into the same issue with Debian's custom ISO and they solved it:
http://lists.debian.org/debian-live/2009/04/msg00040.html

mpc (mpcottam) wrote :

I found the same problem. I have a workaround which is slightly less ugly - it doesn't require using dpkg-reconfigure interface.

Any files placed in the /etc/skel directory are transferred to the live users home directory when the live system starts

So if you do the following in the original system:

sudo pico /etc/skel/netfixer.sh

and then add these two lines to the file:

echo 'nameserver 4.2.2.2' > /etc/resolv.conf
/etc/init.d/networking restart

then save

change permissions of the file:

sudo chmod 777 /etc/skel/netfixer.sh

When the custom.iso is built you will have netfixer.sh in the home folder of the live user when booting

In the live system from the terminal:

sudo ./netfixer.sh

will restore network functionality.

It just gets the above fix down to a single console line with no interaction required. Takes about 4 seconds to run.

Thanks.

Anonymous Meerkat (lkjoel) wrote :

@BlueLight "When creating an ISO of a working 12.04 Ubuntu system ISO doesn't copy the /etc/resolv.conf link created on the original OS by resolvconf package - which breaks networking (DNS)." <- Correct, relinux excludes this as using someone else's internet connection will not always work anther users system. What is weird is that casper should have generated this before loading the computer.

@mpc Hmm, seems a bit hacky (static nameserver?).

Will look into this issue and try to replicate it. This is actually an issue with casper, so once a fix is found, it will be uploaded there (might add some sed/awk hacks to relinux for people using older versions of it).

Sorry about my late reply on this issue, and thanks for the bug report and workarounds.

Changed in relinux:
importance: Undecided → High
status: New → Triaged
Per (perguth) wrote :

I run into this problem using a customized 14.04.2 LiveCD using Customizer[1].

[1]: https://github.com/clearkimura/Customizer

kokoye2007  (kokoye2007) wrote :

sudo gedit /usr/bin/remastersys

$WORKDIR/dummysys/etc/{resolv.conf,hosts,hostname,timezone,mtab*,fstab}

Remove only

resolv.conf

ref:
https://windowslinuxitwiki.wordpress.com/2013/07/01/a-custom-iso-of-ubuntu-linux-reimaged-with-remastersys-does-not-have-internet-or-network-access/

Changed in relinux:
status: Triaged → In Progress
assignee: nobody → kokoye2007 (kokoye2007)
Anonymous Meerkat (lkjoel) wrote :

For relinux 0.3a3, try replacing (line 638):

rm -rf X11/xorg.conf* resolv.conf hosts hostname timezone {m,fs}tab

with:

rm -rf X11/xorg.conf* hosts hostname timezone {m,fs}tab

to keep resolv.conf.

Ubuntu seems to have changed since the script was released, and /etc/resolv.conf is now a link that points to /run/resolvconf/resolv.conf. Because of this, casper will not create /etc/resolv.conf if it doesn't exist, and will only update /run/resolvconf/resolv.conf.

However, casper will only update /run/resolvconf/resolv.conf if it's empty, so try adding:

emptyfile /run/resolvconf/resolv.conf

somewhere after the first replaced line. Ubuntu might try to replace the contents of this file before relinux has a chance to compress this in filesystem.squashfs, so I would advise you to disconnect your internet before running relinux.

This is not a good fix in any way, because it modifies the filesystem of your host computer (other than in /home/relinux), which was a strict non-goal of relinux. However, I'm hoping it should work, at least temporarily :)

If it doesn't work, try replacing the emptyfile line with:

cat << EOF > /run/resolvconf/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
EOF

I'm very sorry, I had entirely forgotten about this bug report. Let me know if this works! :)

A better fix would be to copy /run to dummysys, and modify run/resolvconf/resolv.conf there, then add it to stage 1 of filesystem.squashfs (and exclude it from stage 2). This will probably be what I will do for relinux (if this works).

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related questions