VirtualBox

Opened 9 years ago

Closed 8 years ago

#14733 closed defect (fixed)

Fix startup scripts for Linux From Scratch (LFS) 7.6 or later

Reported by: hykwok Owned by:
Component: guest additions Version: VirtualBox 5.0.6
Keywords: Cc:
Guest type: Linux Host type: Windows

Description

After LFS 7.6, the file "/etc/rc.d/init.d/functions" is replaced by the file "/lib/lsb/init-functions" so the startup script files have to be modified otherwise VboxService cannot be started. Modified the files are attached for your reference.

Attachments (22)

vboxadd (15.7 KB ) - added by hykwok 9 years ago.
vboxadd.diff (575 bytes ) - added by hykwok 9 years ago.
vboxadd-service (5.1 KB ) - added by hykwok 9 years ago.
vboxadd-service.diff (803 bytes ) - added by hykwok 9 years ago.
vboxadd-x11 (21.7 KB ) - added by hykwok 9 years ago.
vboxadd-x11.diff (563 bytes ) - added by hykwok 9 years ago.
no-lfs.patch (5.5 KB ) - added by Michael Thayer 9 years ago.
Remove special Linux from Scratch handling in init scripts, which are now an endangered species in any case
error_001.png (21.2 KB ) - added by hykwok 9 years ago.
Cannot shutdown the system without delay time
suggestion_001.png (8.2 KB ) - added by hykwok 9 years ago.
Delay time suggestion
vboxadd-service.sh (2.7 KB ) - added by Michael Thayer 9 years ago.
Test version of vboxadd-service.sh
system_01.png (21.3 KB ) - added by hykwok 9 years ago.
Testing result for "after patch" case
error_05.png (12.8 KB ) - added by hykwok 9 years ago.
Testing result for "new sh" case
vboxadd-service.2.sh (2.8 KB ) - added by Michael Thayer 9 years ago.
Next test version
test_001.png (19.4 KB ) - added by hykwok 9 years ago.
shutdown service test
test_002.png (21.1 KB ) - added by hykwok 9 years ago.
system shutdown test
vboxadd-service.3.sh (2.8 KB ) - added by Michael Thayer 9 years ago.
Next one.
vboxadd-service.4.sh (2.8 KB ) - added by Michael Thayer 9 years ago.
Additional clean-up, try this one instead
result_ok_0001.png (16.4 KB ) - added by hykwok 8 years ago.
Return code for original script
result_fail_0001.png (16.4 KB ) - added by hykwok 8 years ago.
Return code for the new script
vboxadd-service.5.sh (2.8 KB ) - added by Michael Thayer 8 years ago.
Next one.
vboxadd-service.5.diff (186 bytes ) - added by hykwok 8 years ago.
Modification for version #5
vboxadd-service.6.sh (2.7 KB ) - added by Michael Thayer 8 years ago.
This time the right file I hope.

Download all attachments as: .zip

Change History (38)

by hykwok, 9 years ago

Attachment: vboxadd added

by hykwok, 9 years ago

Attachment: vboxadd.diff added

by hykwok, 9 years ago

Attachment: vboxadd-service added

by hykwok, 9 years ago

Attachment: vboxadd-service.diff added

by hykwok, 9 years ago

Attachment: vboxadd-x11 added

by hykwok, 9 years ago

Attachment: vboxadd-x11.diff added

comment:2 by Michael Thayer, 9 years ago

Sorry if this solution is slightly more bare-bones than what you have (our development code has the same thing, but for all distributions), but could you give the following a try? Not yet tested myself for lack of time, if you do some testing - host and guest - you will speed things up.

by Michael Thayer, 9 years ago

Attachment: no-lfs.patch added

Remove special Linux from Scratch handling in init scripts, which are now an endangered species in any case

comment:3 by hykwok, 9 years ago

I tested your patch in my system (LFS 7.8). However, I could not shutdown the system normally. After some tests, I found a solution: add a delay in the "Killproc" of the "vboxadd-service" file.

by hykwok, 9 years ago

Attachment: error_001.png added

Cannot shutdown the system without delay time

by hykwok, 9 years ago

Attachment: suggestion_001.png added

Delay time suggestion

by Michael Thayer, 9 years ago

Attachment: vboxadd-service.sh added

Test version of vboxadd-service.sh

comment:4 by Michael Thayer, 9 years ago

Does the attached file do the trick?

comment:5 by hykwok, 9 years ago

The new file, vboxadd-service.sh, cannot kill the service. (I.e. the system cannot shutdown normally) Please note that I have checked the PID file name so I am sure I have used the correct script file to start the service: Before patch: /var/run/vboxadd-service.pid, After patch: /var/run/vboxadd-service, New sh file: /var/run/vboxadd-service.sh

by hykwok, 9 years ago

Attachment: system_01.png added

Testing result for "after patch" case

by hykwok, 9 years ago

Attachment: error_05.png added

Testing result for "new sh" case

by Michael Thayer, 9 years ago

Attachment: vboxadd-service.2.sh added

Next test version

comment:6 by Michael Thayer, 9 years ago

And another one to try!

comment:7 by hykwok, 9 years ago

I have tried your new file (version 2) and it can shutdown the serive. However, after I use it to replace the existing file, /etc/rc.d/init.d/vboxadd-service, and restart the system, the system cannot shutdown normally. I have rebooted the system again (cold boot) but the result is same.

by hykwok, 9 years ago

Attachment: test_001.png added

shutdown service test

by hykwok, 9 years ago

Attachment: test_002.png added

system shutdown test

by Michael Thayer, 9 years ago

Attachment: vboxadd-service.3.sh added

Next one.

by Michael Thayer, 9 years ago

Attachment: vboxadd-service.4.sh added

Additional clean-up, try this one instead

comment:8 by hykwok, 8 years ago

The latest script still has problem. Please check the difference between the return code.

by hykwok, 8 years ago

Attachment: result_ok_0001.png added

Return code for original script

by hykwok, 8 years ago

Attachment: result_fail_0001.png added

Return code for the new script

comment:9 by Michael Thayer, 8 years ago

That's what I get for doing blind testing I suppose (though that said, you could actually debug the script rather than just posting screen-shots). Anyway, here is another to try.

by Michael Thayer, 8 years ago

Attachment: vboxadd-service.5.sh added

Next one.

comment:10 by hykwok, 8 years ago

Not work. The new script still returns 1 after exit. After code checking, the logic in the "killproc" function has problem:
According to man page of "pkill" command, the "EXIT STATUS" is:
0 - One or more processes matched the criteria.
1 - No processes matched.
2 - Syntax error in the command line.
3 - Fatal error: out of memory etc.
So, in your script, the "pkill" command will be executed twice: the fisrt "pkill" command returns 0 and the second one returns 1 because the process is already killed.
My modification of this part is submitted: the "killproce" function returns immediately when the "pkill" command returns 0.

by hykwok, 8 years ago

Attachment: vboxadd-service.5.diff added

Modification for version #5

comment:11 by Michael Thayer, 8 years ago

Ahem, yes, I realised that, I just uploaded the wrong script as vboxadd-service.5.sh - it was the same as .4, not my fixed version. Here is what I meant to upload as version 5...

by Michael Thayer, 8 years ago

Attachment: vboxadd-service.6.sh added

This time the right file I hope.

comment:12 by Michael Thayer, 8 years ago

And thanks for investigating. I should clearly have asked you to do that earlier.

comment:13 by hykwok, 8 years ago

I have tested the new script (version 6) and it works.
And one more thing: I wish you can fix the build script for the guest addition.
That's because I have to create the symbolic link for the "/etc/rc.d/init.d/functions" before I execute the Linux guest addition installation file otherwise I cannot build the modules and other files for my LFS system.

comment:14 by Michael Thayer, 8 years ago

Please give the Additions from the test builds page<1> a try.

<1> https://www.virtualbox.org/wiki/Testbuilds

comment:15 by hykwok, 8 years ago

I have tested the additions 5.0.x revision 103994 and it works. Thanks for the support.

Last edited 8 years ago by hykwok (previous) (diff)

comment:16 by Frank Mehnert, 8 years ago

Resolution: fixed
Status: newclosed

Fix is part of VBox 5.0.10. Thanks for the feedback.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use