why is it mentioned in the pali canon that Without the direct guidance of a teacher, this practice can be dangerous, as the canon of Buddhist literature includes a story of the Buddha teaching this mediation to pupils, a lot of whom commit suicide while the Buddha is in retreat.does this mean that I being a layperson, can't perform this?moreover, how can I not develop aversion while practising this but still reap it's benefit?
why is it mentioned in the pali canon that Without the direct guidance of a teacher, this practice can be dangerous,
I am not sure if this is mentioned as dangerous in the canon. It is in the commentaries which say this is dangerous. It can be inferred as dangerous because of the above incident.
does this mean that I being a layperson, can't perform this?
You can do this. Only if done right it is not dangerous.
moreover, how can I not develop aversion while practising this but still reap it's benefit?
This is recommended if you inclined to see beauty in the physical form. That is, when you see something you evaluate it is beautiful you get strong attachment.
What is involved here is perception of beauty and the sensation.
Develope Opposite Perception and View
When you see a certain form or shape as beautiful then develop the perception and view that is is not. This way, as your practice mature, your mental reaction to something beautiful will lesen. The form can you your form (own beauty or looks), someone else or even imaginary form.
when a monk sees a form with the eye, (in him) the agreeable arises, the disagreeable arises, the agreeable-and-disagreeable [the neutral] arises.
If he wishes thus, ‘May I dwell perceiving the repulsive in the unrepulsive,’ he dwells perceiving the repulsive therein
... mind-object .. mind ...
Also use external form to reduce attachment to ones own body, again at the level of correcting the perception and view as well as the reflexive response of the mind, i.e., to reduce reflexing arising of craving for sensation due to perceptions on form, and should not lead to reflexing arising of aversion for sensation due to perceptions on form.
he compares this very body with that, thinking: "Such is the nature of this body: it will become like that—this is unavoidable."
Changes Perception and View due to Internal Content
Also think if what is within the body is external and what was external was inside, you will be chasing animals away from pecking at you flesh! Also imagine what is below the skin. What comes out of the orifices. Imagine body parts piled up. This also a change in perception and view. The last view to break is that the stream of consciousness in internal or self.
Whole vs. Parts and Effect on Perceptions and View
The body is made of parts. Sum of the parts are beautiful but not individually. The parts on their own does not have beauty, but put together only the perception and view of beauty arise. This way you reduce the mental reaction and attachment, to the sensation due to the mental reaction, that follows.
Also see: Mahā Sati’patthāna Sutta
Change in Form due To Decay Changes Perception and Views
Developing the view that the body is impermanent, subjected sickness, decay, old age and death. When you see someone beautiful then when they are sick, oozing excretions or on a pile of excretions, old and dead. Again this a way to adjust your perception and view so you mental reaction and the craving that result from the sensations due to how you mind's reactions are diminished.
Method on Insight
Also when you evaluate some form as beautiful, plain or ugly you get a pleasant, neutral and unpleasant sensation. Use this to eradicate you latent tendencies for craving.
On seeing a form with the eye,
one explores a form that gives rise to pleasure,
one explores a form that gives rise to pain [displeasure],
one explores a form that gives rise to equanimity.
On cognizing a mind-object with the mind,
one explores a mind-object that gives rise to pleasure,
one explores a mind-object that gives rise to pain [displeasure],
one explores a mind-object that gives rise to equanimity
the latent tendency to lust reinforced by being attached to pleasant feelings;
In the methods mentioned above, the 1st can be dangerous (from most dangerous to the lesser dangerous ones), if you develop aversion towards form, due to the pratice. This is what happened to the monks who committed suicide. They got repulsed by their own body. Meditation on repulsiveness is to bring balance to your mind (being equanimous know it is impermanent regardless of the mental reaction) than moving from one polarity to another (i.e., reflexively seeing beauty and develop craving to reflexively seeing repulsiveness and developing aversion). Developing Insight is the safest way to practice this form of meditation as you are not trying to adjust you reactive / reflexive response of the mind with the risk of overdoing it. A experienced teacher may help detect if you have overdone it and reduce the risk.
As a layperson, you can practise 'asubha' without a teacher however you must understand its purpose is to end lust rather than to end life. A stock phrase in the suttas is:
Asubhaṃ bhāvanaṃ bhāvehi. Asubhaṃ hi te bhāvanaṃ bhāvayato yo rāgo so pahīyissati.
Develop the meditation of the unattractive. For when you are developing the meditation of the unattractive, passion/lust will be abandoned.
MN 62; MN 118
In my experience, the primary issue/problem with asubha practice, as occured in the Vesali Sutta, is not so much aversion but, instead, the loss of positive regard towards physical forms in such a way that results in perceiving life as having no purpose.
Therefore, the Buddha teaches in the Vesali Sutta that once 'asubha' practise has served its purposes in generating disgust towards the physical body & abolishing lust, the mind should then develop Anapanasati to make the mind peaceful & to direct the mind to develop final gnosis.
The direct danger comes from developing aversion to one's own body and other bodies. In short starting to view your own body and that of others as a "sack of shit" or just a general "sour grapes attitude" towards yourself and others. People have apparently commited suicide as a result of these views.
To avoid it, the contemplation needs to be structured with an element of compassion(Karuṇā) so that bodily vulnerabilities are contemplated and one developes a healthy caring attitute towards the concept of a body. Elements of Metta may be needed to balance out aversion hostility if such was to manifest in behavior. It seems that the aversion does have a natural tendency to manifest itself and a correction from a teacher is usually needed at some point if one is to do it on his own.
If one's mind is powerful enough there can rise alot of visions and signs, which can be used to enter Jhana, but if not done correctly these will be very frightening and uncontrollable and one will go crazy in most cases. IE: Vivid visions of rotting corpses, corpses dragged around, people attacking you etc, not during meditation but during daily life. These states are described as potential complications by Ven. Maha Bua in the book "Wisdom creates Samadhi"
In general it can get tricky, and the meditation is very powerful so there is no saying how a session will affect one. The views can change quickly, changing them back can prove to be difficult.
That being said i think its a wonderful technique if one does it under competent guidance. Preferably someone who has trained it himself and has trained many other people and can react adequately to complications. I dont think this is something i would recommend to people, i think it has its place and probably is optimal way to train for some personality types if they wanted to train Samatha but in general its not the only option and runs a real, unnecessary risk. I think its worth noting that the bahavior is the last thing to change, views change much faster so by the time the problem behaviors manifest it may be hard to change it back and many teachers wouldnt even know how to do it.