1

I have a firstboot script /etc/init/firstboot.conf which starts on "filesystem". This file creates some symlinks to some libs in /usr/lib

Issue is , /etc/init/lightdm.conf also starts on "filesystem".

If I traverse backwards, mountall.conf is the file which emits "filesystem" event and when this event is generated, lightdm.conf as well as my custom firstboot.conf both try to execute their scripts but the ordering is not guarenteed and you can never tell which one runs first. Now I want to always ensure that firstboot.conf runs before lightdm.conf . How can I ensure this without editing lightdm.conf ( I know I can create a dependency by emitting an event in my firstboot.conf and modify the lightdm.conf to start on that emitted event, but I dont wanna do this. Need a better approach which deals only with my custom firstboot.conf !!)

AGM
  • 43
  • Any suggestions anyone? will simplify the question - "When 2 or more upstart files start on the same event, how to make sure one of them always start before others" Ex: JobA.conf --> start on ALPHA . JobB.conf --> start on ALPHA. How do I make sure JObB.conf always start before JobA.conf ?? – AGM May 13 '14 at 22:11
  • Did you read this http://askubuntu.com/questions/21378/how-can-i-make-sure-one-upstart-job-starts-before-other-upstart-jobs ? – TuKsn May 16 '14 at 20:19

2 Answers2

1

There is no way to enforce the ordering of two upstart jobs that both start on the same event, the filesystem event in this case, according to the upstart cookbook. However, you can modify your firstboot upstart job to run before the filesystem event is emitted instead.

For example, if your script only requires a particular filesystem to be mounted, you can make it depend on just the mounted event for that one filesystem:

start on mounted MOUNTPOINT=/usr

This should cause your firstboot script to run after the filesystem you need is ready but before the filesystem event is emitted. Modify the MOUNTPOINT variable to be the filesystem mountpoint from /etc/fstab that your script will need to do its function.

You can also make your firstboot script execute before lightdm, if that's the dependency you want to express instead, by using the starting event, and make your script use

start on starting lightdm
  • 1st solution : Seems like mountall mounts only virtual filesystems like /proc , /dev/ , /sys. Not sure when does the /usr , /etc , /lib and others get mounted. They are definitely not mounted by mountall. 2nd Solution : It works fine - But my case is a little compilcated that I have 2 file-systems - One is bare-minimal with no lightdm and other with full-desktop having lightdm.conf. Ofcourse "start on starting lightdm" works fine in latter case with lightdm installed but fails in my other rootfs without lightdm. – AGM May 17 '14 at 01:11
  • So I am interested in something similar to the 1st solution, but "start on mounted MOUNTPOINT=/usr" is not working for me. – AGM May 17 '14 at 01:11
0

Posting an answer because I do not have enough karma to comment:

start on mounted MOUNTPOINT=/usr

is not how to do it. This event will only be emitted if the user has a separate /usr filesystem, which is uncommon.

start on starting lightdm

is the perfect way to do this. The starting event blocks lightdm from continuing to start until your job has started.

CameronNemo
  • 1,675