Bootstrap is a widely applicable computational statistical method. The focus of this paper lies in developing a bootstrap method for linear mixed models under homoscedasticity violation (heteroscedasticity) in variance of errors. We assume that the form of heteroscedasticity is unknown. To generate bootstrap response data as close as possible to the actual response data, we transform the marginal residuals to ensure that the variance of the modified marginal residuals in bootstrap samples is an unbiased estimator for the variance of the response variable in the linear mixed models. The consistency is proved, implying that the parameter estimators by the proposed method are asymptotically unbiased. The simulations are conducted with varying error terms and sample sizes to show improvement of the proposed method in parameter estimation. The simulation results are compared to demonstrate that the proposed method outperforms the other considered approaches including the wild method in the heteroscedastic linear mixed models under small samples and performs competitively with the parametric method and both methods outperform the other considered methods in homoscedastic linear mixed models. The proposed bootstrap method is applied to squid data for illustration of its effectiveness.