.bashrc not copied from /etc/skel when remastered Live CD is used

Bug #1245981 reported by PJSingh5000
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Ubuntu Customization Kit
Confirmed
Undecided
Unassigned

Bug Description

* Version of Ubuntu you are running on (output of lsb_release -irs)
        Ubuntu
        13.10
* Kernel architecture of host system (output of uname -rm)
        3.11.0-12-generic x86_64
* Version of Ubuntu you are trying to customize
        Ubuntu 13.10
* Kernel architecture of the version you are trying to customize
        x64
* Iso used
        ubuntu-13.10-desktop-amd64.iso
* UCK version
        2.4.6-0ubuntu1

STEPS:

I run UCK from the host machine, under user account "someuser". Since "someuser" is a member of the sudoer's group, I enter the root password when prompted.

In the UCK croot environment, I notice that the current user's home directory (~) is "/home/someuser".

In the chroot environment (using the ubuntu-13.10-desktop-amd64.iso as the base):
- I place files into /etc/skel
- I modify /etc/skel/.bashrc

After successfully creating the remastered iso USB, I proceed to install the customized OS.

In the Ubuntu installation wizzard (Ubiquity), I create a user called "someuser" (same as the user account I used to run UCK and remaster Ubuntu).

The install is successful.

CURRENT STATE ISSUE:

After installing from the remastered iso, I log in to Ubuntu using user "someuser".

I notice that /home/someuser does not have the files I had placed in /etc/skel during customization.

I also notice that .bashrc and .profile are missing from /home/someuser.

However /etc/skel on the newly installed system *does* indeed contain these files, including the modified .bashrc.

If I create a new user (using $ adduser testuser) the new user has the correct files under /home/testuser.

POSSIBLE CAUSE:

The Linux "adduser" command is used by Ubuntu's installer, Ubiquity.
(See ubiquity_2.15.26_amd64/usr/lib/ubiquity/user-setup/user-setup-apply).

The behavior of the adduser command is to *not* copy files from /etc/skel, if the user's home directory *already* exists.

In this case, I suspect that UCK creates the "/home/someuser" directory on the remastered iso, so this directory already exists when Ubiquity is run.

DESIRED BEHAVIOR:

When I create the user someuser during the Ubiquity wizard, the fiels in /home/someuser/ should be copied from /etc/skel/.

Therefore, after the remastering process is complete, the directory /home/someuser should NOT exist on the cusomized iso. This would prevent this "issue" with Ubiquity and the adduser command.

POSSIBLY RELATED SAME/ISSUE (?):

I also noticed that /root does not have .bashrc and .profile In the UCK chroot environment. This could be because the official Ubuntu Live CD, ubuntu-13.10-desktop-amd64.iso, has this issue. Or it could be due to something UCK does. I thought I'd mention this, since it may in some way be related the above issue.

description: updated
description: updated
Revision history for this message
PJSingh5000 (pjsingh5000) wrote :

Tested Ubuntu Customization Kit 2.4.7 on Ubuntu 14.04 x64.
This issue is no longer present.

Changed in uck:
status: New → Fix Released
Revision history for this message
Hans-Christian (hc-koch) wrote :

Hi,

are you sure? I have tested it today with Ubuntu 14.04.1 x64 and UCK from apt-get and I got the exact same behavior you mentioned in the start post.

Revision history for this message
PJSingh5000 (pjsingh5000) wrote :

Hans-Christian, you are correct. I just tested 14.04.1 x64 and UCK. The .bashrc and .profile files were NOT copied from the /etc/skel directory during installation.

I am surprised no one else has reported this issue. This is definately a bug, but without enough interest, it will not get any attention.

Changed in uck:
status: Fix Released → Confirmed
Revision history for this message
PJSingh5000 (pjsingh5000) wrote :

The issue seems to be in function clean_rootfs_after_chroot(), line 442 in /usr/lib/uck/remaster-live-cd.sh
    echo "Removing /home/username directory..."
    chroot "$REMASTER_DIR" rm -rf "$UCK_USER_HOME_DIR"

During execution we get the error:
    Removing /home/username directory...
    rm: cannot remove '/home/<current user>/.gvfs': Device or resource busy

I've tried to unmount .gvfs manually, and it just does not seem possible. If there is a way to reliably unmount gvfs, I think this issue could be resolved.

Revision history for this message
PJSingh5000 (pjsingh5000) wrote :

The /home/<current user>/.gvfs in the CHROOT environment can not be removed because the gvfs processes have a lock on this directory.

Even though unmounting the .gvfs directory doesn't always work, I found that killing the gvfs processes does seem to resolve the problem. However, the processes restart very quickly, so adding code to accomplish this immediately before attempting to delete the .gvfs directory appears to work well. Based on my limited research on the Internet, there is no state maintained by gvfs, and I did not experience any adverse effects by killing the gvfs processes.

Do the following to implement this "fix".

$ sudo gedit /usr/lib/uck/remaster-live-cd.sh

Between...
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    if [ `echo $UCK_USER_HOME_DIR | cut -d '/' -f2` == 'home' ] ; then
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

And...
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  echo "Removing /home/username directory..."
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Add the following, as shown...
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 if [ `echo $UCK_USER_HOME_DIR | cut -d '/' -f2` == 'home' ] ; then
  ########################################################################
  echo "List of gvfs processes..."
  eval "pgrep gvfs | xargs ps"
  echo "Killing gvfs processes..."
  kill -9 `pgrep gvfs`
  ########################################################################
  echo "Removing /home/username directory..."
  chroot "$REMASTER_DIR" rm -rf "$UCK_USER_HOME_DIR"
 fi
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

While you are making changes, you ~might~ want to fix an unrelated issue in /usr/lib/uck/customization-profiles/localized_cd/customize. An "if" statement in this script produces a run-time warning. (I don't think it's worth opening a new bug for, but I thought I'd share it here). Just add the missing quotes in the offending "if" statement as follows.

$ sudo gedit /usr/lib/uck/customization-profiles/localized_cd/customize

Replace:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    if [ -z $CHOICE ] ; then
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

With:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    if [ -z "$CHOICE" ] ; then
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Revision history for this message
PJSingh5000 (pjsingh5000) wrote :

Attached is a patch. To apply the patch, Download it to ~/Downloads, and do the following:

$ cp /usr/lib/uck/remaster-live-cd.sh /usr/lib/uck/remaster-live-cd.sh.original
$ patch /usr/lib/uck/remaster-live-cd.sh ~/Downloads/remaster-live-cd.sh.patch

To revert the this patch use:
sudo mv /usr/lib/uck/remaster-live-cd.sh.original /usr/lib/uck/remaster-live-cd.sh

The patch changes function clean_rootfs_after_chroot() to try a few different approaches to unmount the .gvfs directory inthe charoot environment. First it tries fusermount -u, then umount, and if all else fails, it kills all gvfs processes. Ultimately, this "catch-all approach" ensures that the /home/username directory in the chroot environment can be deleted by remaster-live-cd.sh without error.

A side effect of this code is that all .gvfs mounts get unmounted, and any file transfers running within or outside the chroot environbment will terminate. However, I have not experienced any issues re-connecting to gvfs file systems after this code is executed.

Revision history for this message
begmurad (begmurad1) wrote :

My name is yaqup and a uighur boy. Ubuntu is very beutifull and perfact opreation system. ubuntu and linux is best system and is a art. we are use ubuntu and i think how many pepole love use Ubuntu (www.qutbeg.com ), but ubuntu complex batter windows, how loong useres no way out use ubuntu for example uighur pepole. so we have easy to handle (download this way http://begmurad.wix.com/yaqupjan#!Azadelinux-ning-LTS-neshirlèrini-chüshirwiling/c218b/FD4A7F0B-EE6C-40D8-911B-56F8B12BE864 ) .its very very perfact !!! but we have problem do not something. The easy sytem is use remastersys remastered. but one problem is install the easy system have some mistake . important is user name and password and user pictre mistake. dear omgubuntu team ; can help me solve this problem?
                                                            from yaqup

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.