Averett

Hennessey, C.J.

The inmate petitioners filed petitions for writs of habeas corpus under G. L. c. 248 (1986 ed.), in the Superior Court, claiming that they had served in full their sentences, but that the Commissioner of Correction (commissioner)2 had wrongly ordered the forfeiture of their statutory *29good time credits. A Superior Court judge allowed the petitions, issued the writs, and denied the commissioner’s requests to stay the final orders pending an appeal. The commissioner then sought stays from a single justice of the Appeals Court who denied the requests and ordered that the matters be consolidated and expedited for presentation to the Appeals Court. The Appeals Court concluded that the petitioners were not entitled to relief under G. L. c. 248, and, treating their petitions as motions for release from unlawful restraint under Mass. R. Crim. P. 30 (a), 378 Mass. 900 (1979), that they were not entitled to postconviction relief. The Appeals Court vacated the judgments allowing the writs of habeas corpus. 25 Mass. App. Ct. 280, 281, 289 (1988).3

We granted the petitioners’ application for further appellate review. We disagree with the Appeals Court and conclude that the orders below should be affirmed. As will be seen, we deal here not with mere matters of procedural form, but rather we deal with substantive rights of the petitioners.4

The issue in these appeals concerns Mass. R. Crim. P. 30, 378 Mass. 900 (1979), and whether rule 30 completely displaces habeas corpus relief for those persons who have been convicted and seek postconviction relief. The Constitution of the Commonwealth guarantees: “The privilege and benefit of the writ of habeas corpus shall be enjoyed in this Commonwealth in the most free, easy, cheap, expeditious and ample manner; and shall not be suspended by the legislature, except upon the most urgent and pressing occasions, and for a limited time not exceeding twelve months.” Part II, c. 6, art. 7, of the Constitution of the Commonwealth.

*30General Laws c. 248, § 25, as appearing in St. 1979, c. 344, § 12, purporting to limit a court’s power to issue writs of habeas corpus, states: “The court shall have no power to issue a writ of habeas corpus, at its discretion for ... a person who is imprisoned or restrained of his liberty pursuant to a criminal conviction,” effective July 1, 1979. St. 1979, c. 344, § 51. We have stated that, “[t]o the extent that St. 1979, c. 344, § 12, purports to eliminate completely a court’s power ‘to issue a writ of habeas corpus ... for ... a person who is imprisoned or restrained of his liberty pursuant to a criminal conviction,’ it may run afoul of. . . [Part II, c. 6, art. 7, of the Constitution of the Commonwealth].” Hennessy v. Superintendent, Mass. Correctional Inst., Framingham, 386 Mass. 848, 852 n.3 (1982). This constitutional provision guarantees the enjoyment of writs of habeas corpus in the “most free, easy, cheap, expeditious and ample manner . . . .” Part II, c. 6, art. 7, of the Constitution of the Commonwealth.

We held recently in McCastle, petitioner, 401 Mass. 105 (1987), that “there [was] no constitutional impediment to restricting [the petitioner] to rule 30 relief.” Id. at 107. There, the petitioner claimed that his convictions and subsequent imprisonment were invalid because he was convicted of assault by means of a dangerous weapon, a crime which, he argued, was not a lesser included offense of armed assault with intent to rob, for which he had been indicted. Id. at 105. But, where a petition for a writ of habeas corpus is based on grounds distinct from the issues at the indictment, trial, conviction, or sentencing stage, we have commented favorably on the propriety of issuing writs of habeas corpus. See Kenney v. Commissioner of Correction, 399 Mass. 137, 138 (1987) (forfeiture of good time credits); Nelson v. Commissioner of Correction, 390 Mass. 379, 381, 396 (1983) (disciplinary board’s reliance on informants’ hearsay information in finding petitioners guilty of offenses committed in prison); Hennessy, supra at 849-852 (improper failure to apply good conduct and program participation credits to sentence).

Rule 30 (a) states: “Whoever is imprisoned or restrained of his liberty pursuant to a criminal conviction may at any time, *31as of right, file a written motion requesting the trial judge to release him or to correct the sentence which he is then serving upon the ground that his confinement or restraint was imposed in violation of the Constitution or laws of the United States or of the Commonwealth of Massachusetts.” Those who claim that good conduct credits or the like have been erroneously forfeited do not challenge the sentence, conviction, or confinement imposed. Rather, they argue that the term of a lawfully imposed sentence has expired. It is sensible to restrict an individual who has been convicted and imprisoned to rule 30 post-conviction relief before the trial judge when that individual objects to the imposition of confinement, but it is not free, easy, cheap, or expeditious to impose a rule 30 hearing before a judge on a person demanding an immediate release from prison on grounds of which the judge is completely unaware. See McCastle, supra at 107 (stating that the trial judge rather than a single justice of this court is the appropriate judge to hear a rule 30 motion, and that rule 30 “assigns the motion to the trial judge who heard the case, on the theory that [the judge’s] familiarity with the case can assist in its effective handling”).

Other factors, in addition to the fact that the trial judge hears a rule 30 motion whereas any judge in the Superior Court can hear a habeas corpus petition, distinguish rule 30 relief from the petition for habeas corpus. Issues not raised in an original rule 30 motion are generally waived, whereas they are not waived in a habeas corpus petition. See G. L. c. 248, § 1; Mass. R. Crim. P. 30 (c) (2). If an appeal is taken from a final order under rule 30, a person shall not be discharged from custody pending the final decision on appeal, whereas a person granted a writ of habeas corpus must be released immediately. Mass. R. Crim. P. 30 (c) (8) (A). Commonwealth v. Pina, 376 Mass. 659, 664-665 (1978). Furthermore, and perhaps most importantly, habeas corpus petitions must be heard freely, easily, cheaply, expeditiously, and amply, but rule 30 motions do not carry a similar mandate. Part II, c. 6, art. 7, of the Constitution of the Commonwealth.

*32We therefore conclude that individuals who establish that their lawfully imposed sentences have expired may petition for habeas corpus relief and are not limited to rule 30 postconviction relief. The commissioner argues that, on the facts of these cases, neither habeas corpus nor rule 30 relief Should have been granted. We do not address these arguments because the longstanding rule in the Commonwealth is that appeal does not lie from an issuance of a writ of habeas corpus. Wyeth v. Richardson, 10 Gray 240 (1857). Pina v. Superintendent, Mass. Correctional Inst., Walpole, 376 Mass. 659, 664(1978). Hennessy v. Superintendent, Mass. Correctional Inst., Framingham, 386 Mass. 848, 850 (1982). Stokes v. Superintendent, Mass. Correctional Inst., Walpole, 389 Mass. 883, 885 (1983).

We add that both'petitioners Averett and Megguier were “entitled to be released from restraint by the particular respondent . . . named in the petition.” See Hennessy, supra at 852. The petitioner Megguier owed no time to any institution, and the petitioner Averett was entitled to release from MCI, Cedar Junction, to serve three days at the Bristol County house of correction.

Orders allowing petitions affirmed.

In addition to the commissioner, Averett’s petition names the superintendent of the North Central Correctional Institution, Gardner, and Megguier names the superintendent of the Massachusetts Correctional Institution, Cedar Junction (MCI, Cedar Junction). We shall refer to them collectively as “commissioner.”

The factual background of these cases, for purposes of the appeals, is sufficiently stated in the Appeals Court’s decision. 25 Mass. App. Ct. 280, 281-282 (1988).

Along with the appeals, the commissioner submitted a motion to strike portions of the petitioners’ brief and a motion to expand the record. The petitioners filed a motion to expand the record. Both of the commissioner’s motions are granted. Because we conclude that the petitioners’ claims are meritorious, we need not rule on their motion to expand the record.