When opening a lightning channel, is there any data immediately written to the blockchain? I mean, the channel is not considered opened until the data is on the blockchain. The data may be the funding transaction, or may be some sort of 2-to-2 multisignature script, I don't know.
The channel has a funding transaction which must be included in the blockchain before the channel is considered to be opened. Of course, you can use it before it is confirmed, but there is no guarantee of anything that happens in the channel.
If the answer is yes, then... is it possible that an opened channel becomes invalid due to a blockchain fork, i.e., the blockchain where the data reside being replaced by a longer,conflicting blockchain?
Yes, that is possible. However it is extremely unlikely. Like with other transactions, nodes won't consider the funding transaction to actually be complete until it has several confirmations (usually 6). The probability that a fork of length 6 occurs is extremely low. Note that the risk of a fork here is the same as a fork effecting your normal Bitcoin transactions.
If the answer is further yes, then, is it possible that some sort of double-spending attacks can be launched on the lightning network?
The same double spending attacks and risks that you can do to a normal Bitcoin transaction also effect the Lightning Network funding transactions because it really is just a normal Bitcoin transaction.