firstlogin script can't be executed because the permission of /root directory is 0700 in the virtual machine created by python-vm-builder

Bug #378639 reported by Yufei
46
This bug affects 7 people
Affects Status Importance Assigned to Milestone
vm-builder (Ubuntu)
Triaged
Low
Unassigned

Bug Description

Binary package hint: python-vm-builder

If you create virtual machine by python-vm-builder, it will setup the permission /root to 0700 in the virtual machine.

But the firstlogin and firstboot scripts are copied /root. firstboot script will excute, but firstlogin will fail because the permission problem.

A quick fix is run chmod 0755 in the firstboot script.

I don't know whether iit's by design or not.

Revision history for this message
Chris McNabb (raizyr) wrote :

Additionally the firstlogin script probably shouldn't run as root, it should instead run as the login user.

I made some modifications to write the file to /home/$USER/.firstboot.sh for the user specified with --user (or the default). It's created with permissions 0777 so that it can be removed by the user (since it's a one time script for the first login of the default user). I also changed the firstloginrc template to simply test for the existance of $HOME/.firstboot.sh run it if it exists, and remove the file if it exits successfully.

Revision history for this message
Jarl (jarl-dk) wrote :
Revision history for this message
Chuck Short (zulcss) wrote :

Hi,

Thanks for the patch which version of vmbuilder is this for?

Regards
chuck

Changed in vm-builder (Ubuntu):
assignee: nobody → Chuck Short (zulcss)
status: New → Incomplete
Chuck Short (zulcss)
Changed in vm-builder (Ubuntu):
importance: Undecided → Low
Revision history for this message
Chuck Short (zulcss) wrote :

We'd like to figure out what's causing this bug for you, but we haven't heard back from you in a while. Could you please provide the requested information? Thanks!

Changed in vm-builder (Ubuntu):
assignee: Chuck Short (zulcss) → nobody
assignee: nobody → Chuck Short (zulcss)
Revision history for this message
Jarl (jarl-dk) wrote :

OK, so the commenter raizyr is not going to provide informatoin about what version his patch is for.

However missing informatoin aobut a user supplied patch does not render the whole bug incomplete. If it renders the patch useless, then please just ignore it, but please take the bug serious.

Therefore I mark the bug "new". The altirenative would be that I create a new bug, because I still see this problem.

Jarl

Changed in vm-builder (Ubuntu):
status: Incomplete → New
Revision history for this message
Chris McNabb (raizyr) wrote :

Sorry that I missed the previous emails. The patch was originally for whichever version was released at the time I posted three months ago. I don't recall what that was and the automatic updates are running on my server so I cannot check there.

With only about 5 minutes checking though, I was able to find that nothing has changed with the two affected files in release 0.10-0ubuntu2 and I was able to successfully apply the patch to that version.

Revision history for this message
Doka (doka-wepoca) wrote :

You can circumvent this bug by running on the virtual machine this command:
sudo /root/firstlogin.sh

Chuck Short (zulcss)
Changed in vm-builder (Ubuntu):
assignee: Chuck Short (zulcss) → nobody
Revision history for this message
MURAOKA Yusuke (yusuke) wrote :

I've got near situation. And it's a logical bug.

When I login first time with not root permission account. It cause bellow.

1. The account can't access to /root/firstlogin_done. Because of lack of the file.
2. Thus, processing is going into the if statement.
3. Run first login script.
4. make /root/firstlogin_done by sudo.

But when I login second time in same situation. It cause bellow.

1. The account can't access to /root/firstlogin_done. Because of lack of the *permission*.
*. brabrabra

So the first login file called /etc/bash.bashrc is calling at every login actually, *not once*.
This bug is in python-vm-builder_0.12.3 and trunk repository either.

Chuck Short (zulcss)
Changed in vm-builder (Ubuntu):
status: New → Triaged
Revision history for this message
Daniël de Kok (danieldk) wrote :

This bug still seems to be present (at least testing with 12.10).

The best workaround seems to be:

1. Set permissions of /root to 0711 in the firstboot script.
2. Reset the permissions of /root to 0700 at the end of the firstboot script.

Revision history for this message
Daniël de Kok (danieldk) wrote :

Of course, under (2) I meant at the end of the firstlogin script.

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.