I need to put two holes in the ceiling in order to put a LED bar
I would like to align the holes as much as I can so the bar is as much as possible parallel to the vertical walls.
How can I do it?
(I call it
laser bubble). That's the way I did it. That is the device designed for this job.
The principle is this. Once the lower beam is reflected on the emitter, the device is correctly bubbled to the floor. If not, you must use adjustable feet. This particular unit I borrowed has a top bubble too not visible in the picture. It then emits multiple laser beams to the entire room, ceiling included.
As soon as you have a correct horizontal reference on the floor, you can easily match it with the ceiling.
The owner told me that there are models which fit all pockets (budgets), he bought this unit for 80€ on the most popular ecommerce platform, but I found a similar model for 150€ at Leroy Merlin's. There are also more expensive and cheaper devices if you need to either keep it in the DIY magic box or use it for a very single job.
Your problem can be solved in several ways depending on your goal. Pick one example. You want to fix an applique to the ceiling in order to look "aligned" to the room. You have one reference point which is the electrical pipe at which centre you'll fix the bracket. Okay, this is just one of my cases.
In this case, I deployed this unit in order to draw a cross to the celing and used it to put in the correct floor's spot to match the electrical pipe. Then I needed a way to make sure the lines it drawed were aligned.
You could use the floor spaces between tiles but here is what I did. I couldn't match the tiles so I measured the distance between the beam and the edge of the floor's tile in several spots, and precisely rotated the device (which has a screw dedicated to slow rotation) until I found the same measurement twice. Then I climbed the ladder to mark the spots I wanted to drill
On the contrary, when I had another disaligned light I chose to keep one ceiling hole and draw the correct horizontal line to drill the second hole again in another place, using the same ruler technique.
I had to use the device to make brand new holes for light #2 (furthest, bottom-est, best illuminated by beam) because the initial holes I made were a mess. But after this job I found I didn't have to drill once again the light #1 which happened to be aligned already
It depends on how close the bar will be to a wall vs the center of the room.
If it's close to a wall, make it parallel to that wall, no matter how unsquare the room is. It will be very obvious if your bar is not parallel to a wall that's 3 feet (1 meter) or less away, but not so obvious that it's not parallel to the wall that's 15' (5 meters) or more away. Unless, of course the walls are obviously out of parallel at a quick glance, in which case it won't matter where you hang the light bar.
If you're hanging it in the middle of the ceiling and your walls are reasonably parallel (maybe the gap between walls is no more than about 1" (25mm) bigger at one end than the other (this is a rough guideline number, not a hard-and-fast rule) then you can simply measure from one wall to make it parallel enough.
If your walls are significantly out of parallel (roughly in the more than 1" (25mm) off category), then I'd measure the width of the room at one end of the light bar and divide that by 2 to find the center of that location, then measure the width at the other end and divide by 2 to find the center location for the other end. That way the light will split the difference.
In any case, if you're not sure how it will look (and especially if your walls are in that 3rd category of out-of-parallel), use a piece of painter's tape on the ceiling, lined up on your drilling marks and the same length as the light bar to see what it's going to look like. This way you'll know whether it's going to look "weird" (a very subjective thing answerable only by you) or if it will look "OK" (also subjective).
If it looks to "weird" for any reason, either adjust the tape now (while the tape is easy to remove without damage and before you've made permanent holes in the ceiling) to find a less "weird" location or abandon the light bar and come up with a different lighting solution that will work for your room.
Bear in mind that while most carpenters (there are, sadly, some who just don't care) will strive to make every corner exactly 90° and every wall laser straight, very few come out exactly that way. And, even if they were built that way, time has a way of making those change.
You say "LED bar" but do not give details as to what that is exactly. If it is light fixture then my answer is:
Many light fixtures can use an Adjustable bracket.
If you do a web search for Adjustable Combination Light Fixture Bracket Bar Cross Bar You will find many sources to purchase them or you can find them in the lighting section of your home improvement store.
It has two bars, one attaches firmly two the electrical box in the ceiling and the other is connected to the first on at the central pivot point. You connect the light fixture the second one,This allow you adjust the fixture, rotate it, back and forth. There are pre-drilled and threaded holes for machine screws to mount the fixture to the bar.
I do not know what your fixture is but it is likely that this is an option that can be made to work.