Washington (CNN) An emotional John Boehner spent one of his final days in office saying goodbye to friends and colleagues -- and even bitter adversaries across the Capitol.

But behind the scenes, Boehner's allies and fellow Republican leaders were moving aggressively to secure enough votes to pass one of the biggest budget deals the Ohio Republican has cut since becoming speaker nearly five years ago.

Ahead of a crucial Wednesday, when Rep. Paul Ryan is expected to be nominated to succeed Boehner as speaker, Republicans were running into a fresh set of problems as they tried to ram through the last-ditch budget deal, with lawmakers from rural states objecting to cuts to the crop insurance program and others balking at the proposal's price tag.

Boehner, R-Ohio, holds a copy of the Constitution on Capitol Hill in Washington on May 7, 1992, as Sen. Don Nickles, D-Oklahoma, looks on. Both men proclaimed it was a historic day when the Michigan House ratified the 27th Amendment to the Constitution, which would require that any Congressional pay raises not go into effect until after the next election.

Boehner, R-Ohio, holds a copy of the Constitution on Capitol Hill in Washington on May 7, 1992, as Sen. Don Nickles, D-Oklahoma, looks on. Both men proclaimed it was a historic day when the Michigan House ratified the 27th Amendment to the Constitution, which would require that any Congressional pay raises not go into effect until after the next election.

Boehner at a Capitol Hill news conference on February 6, 1995. He has had a seat in the U.S. House of Representatives since 1990. Before that he was a member of the Ohio State House of Representatives for six years.

Boehner at a Capitol Hill news conference on February 6, 1995. He has had a seat in the U.S. House of Representatives since 1990. Before that he was a member of the Ohio State House of Representatives for six years.

Boehner dumps out coal, which he called a Christmas gift to President Clinton, during a news conference about the federal budget on December 21, 1995. Many government services and agencies were closed at the end of 1995 and beginning of 1996 as a Republican-led Congress battled Clinton over spending levels.

Boehner dumps out coal, which he called a Christmas gift to President Clinton, during a news conference about the federal budget on December 21, 1995. Many government services and agencies were closed at the end of 1995 and beginning of 1996 as a Republican-led Congress battled Clinton over spending levels.

Boehner and House Majority Leader Dick Armey, R-Texas, listen to House Speaker Newt Gingrich at a 1997 news conference with entrepreneurs promoting the GOP tax relief plan.

Boehner and House Majority Leader Dick Armey, R-Texas, listen to House Speaker Newt Gingrich at a 1997 news conference with entrepreneurs promoting the GOP tax relief plan.

President George W. Bush signs into law the federal education bill No Child Left Behind at a high school in Hamilton, Ohio, in 2002. The law offered the promise of improved schools for the nation's poor and minority children and better-prepared students in a competitive world. Boehner, second from right, backed the bill.

President George W. Bush signs into law the federal education bill No Child Left Behind at a high school in Hamilton, Ohio, in 2002. The law offered the promise of improved schools for the nation's poor and minority children and better-prepared students in a competitive world. Boehner, second from right, backed the bill.

Boehner answers questions during an interview with Bloomberg in Washington on June 29, 2005.

Boehner answers questions during an interview with Bloomberg in Washington on June 29, 2005.

Boehner, center, and fellow Republican House members sing Boehner's birthday song during a news conference on Capitol Hill on November 17, 2006. Boehner served as the House Minority Leader from 2007 to 2011.

Boehner, center, and fellow Republican House members sing Boehner's birthday song during a news conference on Capitol Hill on November 17, 2006. Boehner served as the House Minority Leader from 2007 to 2011.

Boehner, center, looks on as President Barack Obama speaks with then-House Majority Leader Steny Hoyer in the East Room of the White House on February 23, 2009. Boehner and Obama have butted heads over the years.

Boehner, center, looks on as President Barack Obama speaks with then-House Majority Leader Steny Hoyer in the East Room of the White House on February 23, 2009. Boehner and Obama have butted heads over the years.

Boehner, an avid golfer, talks with Tiger Woods while golfing at the Congressional Country Club in Bethesda, Maryland, in 2009.

Boehner, an avid golfer, talks with Tiger Woods while golfing at the Congressional Country Club in Bethesda, Maryland, in 2009.

Boehner voices his concerns about the health care reform bill championed by Obama during a news conference in Washington on October 29, 2009.

Boehner voices his concerns about the health care reform bill championed by Obama during a news conference in Washington on October 29, 2009.

Boehner hugs his wife, Debbie, after addressing the crowd at the NRCC Election Night watch party on November 2, 2010, when Republicans took back control of the House of Representatives. Boehner met his wife in college, and they have been married since 1973.

Boehner hugs his wife, Debbie, after addressing the crowd at the NRCC Election Night watch party on November 2, 2010, when Republicans took back control of the House of Representatives. Boehner met his wife in college, and they have been married since 1973.

On January 5, 2011, Boehner wipes away tears as he waits to receive the gavel from outgoing House Speaker Nancy Pelosi, D-California, during the first session of the 112th Congress.

On January 5, 2011, Boehner wipes away tears as he waits to receive the gavel from outgoing House Speaker Nancy Pelosi, D-California, during the first session of the 112th Congress.

Boehner presents golfing legend Arnold Palmer with the Congressional Gold Medal at a special ceremony in the Rotunda of the Capitol in September 2012.

Boehner presents golfing legend Arnold Palmer with the Congressional Gold Medal at a special ceremony in the Rotunda of the Capitol in September 2012.

Boehner is sworn in as the speaker of the House after his re-election in January 2013.

Boehner is sworn in as the speaker of the House after his re-election in January 2013.

Boehner speaks to the media after a meeting with President Obama at the White House in October 2013, the second day of the federal government's recent shutdown. The White House squared off with Republican rivals in Congress over how to fund federal agencies, many of which were forced to close, leaving a fragile economy at risk.

Boehner speaks to the media after a meeting with President Obama at the White House in October 2013, the second day of the federal government's recent shutdown. The White House squared off with Republican rivals in Congress over how to fund federal agencies, many of which were forced to close, leaving a fragile economy at risk.

Reporters question Boehner as he arrives at the U.S. Capitol as the government stalemate continued in October 2013. President Obama signed a bill on October 17 that ended the 16-day shutdown and raised the debt ceiling.

Reporters question Boehner as he arrives at the U.S. Capitol as the government stalemate continued in October 2013. President Obama signed a bill on October 17 that ended the 16-day shutdown and raised the debt ceiling.

Boehner blasts conservative groups during a press conference in December 2013 after passing a compromise budget deal aimed at removing the threat of another government shutdown. Fed up with criticism from conservative advocates, Boehner said they were "misleading their followers." He followed up with: "Frankly, I just think that they've lost all credibility."

Boehner blasts conservative groups during a press conference in December 2013 after passing a compromise budget deal aimed at removing the threat of another government shutdown. Fed up with criticism from conservative advocates, Boehner said they were "misleading their followers." He followed up with: "Frankly, I just think that they've lost all credibility."

The image of the Speaker of the House John Boehner (R-OH) is displayed in a monitor of a camera as he talks with reporters in his office in the Capitol in November 2014 in Washington.

The image of the Speaker of the House John Boehner (R-OH) is displayed in a monitor of a camera as he talks with reporters in his office in the Capitol in November 2014 in Washington.

U.S. Vice President Joe Biden and Speaker of the House John Boehner await the arrival of President Barack Obama for the State of The Union address on January 20 in the House Chamber of the Capitol.

U.S. Vice President Joe Biden and Speaker of the House John Boehner await the arrival of President Barack Obama for the State of The Union address on January 20 in the House Chamber of the Capitol.

U.S. President Barack Obama walks with Speaker of the House John Boehner as they depart the annual Friend's of Ireland luncheon on Capitol Hill in Washington on March 17.

U.S. President Barack Obama walks with Speaker of the House John Boehner as they depart the annual Friend's of Ireland luncheon on Capitol Hill in Washington on March 17.

Afghanistan President Ashraf Ghani (right) expresses his country's gratitude for America's fiscal commitment and military sacrifices during an address to a joint meeting of the United States Congress with Vice President Joe Biden (left) and Speaker of the House John Boehner (R-OH) in the House Chamber of the U.S. Capitol March 25 in Washington.

Afghanistan President Ashraf Ghani (right) expresses his country's gratitude for America's fiscal commitment and military sacrifices during an address to a joint meeting of the United States Congress with Vice President Joe Biden (left) and Speaker of the House John Boehner (R-OH) in the House Chamber of the U.S. Capitol March 25 in Washington.

Pope Francis walks with Speaker Boehner and Vice President Joe Biden after delivering a speech to Congress in Washington on September 24.

Pope Francis walks with Speaker Boehner and Vice President Joe Biden after delivering a speech to Congress in Washington on September 24.

John Boehner has been the speaker of the U.S. House of Representatives since 2011, making him second in line for the presidency, behind the vice president. On September 25, Boehner told colleagues he's stepping down as speaker and will leave Congress at the end of October. Look back at his career in politics so far.

John Boehner has been the speaker of the U.S. House of Representatives since 2011, making him second in line for the presidency, behind the vice president. On September 25, Boehner told colleagues he's stepping down as speaker and will leave Congress at the end of October. Look back at his career in politics so far.

In a move that helps supporters of the deal, Ryan himself backed the proposal Wednesday morning, the day after he said the process behind creating the deal "stinks."

"What has been produced will go a long way toward relieving the uncertainty hanging over us, and that's why I intend to support it," Ryan said in a statement. "It's time for us to turn the page on the last few years and get to work on a bold agenda that we can take to the American people."

As Boehner tried to lock down votes on the House floor, a number of lawmakers refused to endorse the plan, angry that they were being jammed by their party leaders and worried about the effect the plan may have on their districts. Even close Boehner allies, like Rep. Pete Sessions of Texas, chairman of the powerful Rules Committee, suggested to CNN he was seriously weighing opposing the deal.

"Agriculture, agriculture, agriculture are my problems," Sessions said.

The concerns spanned the gamut -- including the backroom nature of the talks that produced a deal lawmakers will be forced to vote on with little time to review. Many Republicans also believe they should have won more concessions from the White House for raising the debt ceiling until 2017.

While GOP leaders still expressed confidence the bill would pass as early as Wednesday, it appeared that the final vote tally could be close and only a minority of Republicans would back a plan strongly supported by Democrats.

Photos: Paul Ryan, rising GOP star Photos: Paul Ryan, rising GOP star Rep. Paul Ryan, R.-Wisconsin, was elected the 54th speaker of the U.S. House of Representatives on Thursday, October 29, after receiving the votes of 236 members. The vote was largely a formality after House Republicans nominated him for the position on Wednesday, October 28. Hide Caption 1 of 25 Photos: Paul Ryan, rising GOP star Ryan announced Monday, January 12, that he would not run for president in 2016, preferring instead to focus on policy work as chairman of the House Ways and Means Committee. Ryan, the GOP's 2012 vice presidential nominee, has long been seen as a top contender for the presidency. Hide Caption 2 of 25 Photos: Paul Ryan, rising GOP star Ryan, center, speaks with Rep. Devin Nunes, R-California, before a House Ways and Means Committee meeting on March 12, 2014. Hide Caption 3 of 25 Photos: Paul Ryan, rising GOP star Ryan and his wife, Janna, arrive at a state dinner at the White House in honor of French President Francois Hollande on February 11, 2014 . Hide Caption 4 of 25 Photos: Paul Ryan, rising GOP star Willie Robertson of the reality TV series "Duck Dynasty" poses for a picture with Ryan and his wife, Janna, before President Obama delivers his State of the Union address on January 28, 2014. Hide Caption 5 of 25 Photos: Paul Ryan, rising GOP star Ryan speaks at the Conservative Political Action Conference in National Harbor, Maryland, on March 15, 2013. Hide Caption 6 of 25 Photos: Paul Ryan, rising GOP star Ryan greets supporters during a presidential campaign rally with Mitt Romney at The Square at Union Centre in West Chester, Ohio, on November 2, 2012. Hide Caption 7 of 25 Photos: Paul Ryan, rising GOP star Rep. Paul Ryan of Wisconsin speaks during a campagin stop at the Iowa State Fair in Des Moines on August 13, 2012. It was the newly minted GOP vice presidential candidate's first solo stop since becoming Romney's running mate. Hide Caption 8 of 25 Photos: Paul Ryan, rising GOP star Ryan speaks after Romney announced him as his running mate in Norfolk, Virginia, on August 11, 2012. Hide Caption 9 of 25 Photos: Paul Ryan, rising GOP star Romney introduced Ryan as his running mate in front of the USS Wisconsin. The seven-term congressman provides a strong contrast to the Obama administration on fiscal policy. Hide Caption 10 of 25 Photos: Paul Ryan, rising GOP star Romney jokes with Ryan in April 2012 during a pancake brunch at Bluemound Gardens in Milwaukee. Hide Caption 11 of 25 Photos: Paul Ryan, rising GOP star Ryan looks on as Romney greets people June 18, 2012, during a campaign event in Janesville, Wisconsin. Hide Caption 12 of 25 Photos: Paul Ryan, rising GOP star Ryan speaks while campaigning for Romney at a textile factory in Janesville, Wisconsin, on June 18, 2012. Hide Caption 13 of 25 Photos: Paul Ryan, rising GOP star Ryan, left, and Romney greet each other on stage April 3, 2012, during the primary night gathering at The Grain Exchange in Milwaukee. Hide Caption 14 of 25 Photos: Paul Ryan, rising GOP star Ryan introduces Romney at a town hall meeting in Milwaukee, Wisconsin, on April 2, 2012. Hide Caption 15 of 25 Photos: Paul Ryan, rising GOP star Ryan is introduced before speaking about the federal budget at Georgetown University on April 26, 2012. Hide Caption 16 of 25 Photos: Paul Ryan, rising GOP star Ryan holds a news conference in December 2011 in Washington to introduce a package of 10 legislative reforms designed to revamp the budget process. Hide Caption 17 of 25 Photos: Paul Ryan, rising GOP star Ryan listens as Ben Bernanke, chairman of the U.S. Federal Reserve, speaks at the Committee for a Responsible Federal Budget annual conference in Washington on June 14, 2011. Hide Caption 18 of 25 Photos: Paul Ryan, rising GOP star Ryan looks over papers as he waits for other House Republicans to arrive for a news conference in the Capitol Visitors Center in 2010. Hide Caption 19 of 25 Photos: Paul Ryan, rising GOP star Ryan speaks to the media in 2009 about President Barack Obama's 2010 budget proposal. Hide Caption 20 of 25 Photos: Paul Ryan, rising GOP star Ryan, left, and Sen. Judd Gregg of New Hampshire speak to reporters about the 2010 federal budget. Hide Caption 21 of 25 Photos: Paul Ryan, rising GOP star Then-Budget Committee Chairman John M. Spratt Jr., left, and ranking member Ryan listen to Federal Reserve Chairman Ben Bernanke testify during the House Budget hearing on the economy on January 17, 2008. Hide Caption 22 of 25 Photos: Paul Ryan, rising GOP star Ryan follows President George W. Bush off of Air Force One at General Mitchell International Airport - Air Reserve Station in Milwaukee on July 11, 2006. Hide Caption 23 of 25 Photos: Paul Ryan, rising GOP star Ryan speaks at a Cato Institute briefing on Medicare reform in the Rayburn House Office Building in Washington on July 22, 2003. Hide Caption 24 of 25 Photos: Paul Ryan, rising GOP star Speaker of the House Denis Hastert, left, administers the oath of office to Ryan at the beginning of his first term as representative of Wisconsin on January 6, 1999. Hide Caption 25 of 25

"I think we'll be in a good place," House Majority Leader Kevin McCarthy, R-California, said Tuesday night.

As House Republicans worked their members, Senate Republicans and Democrats realized they had a problem on their hands, too. Sen. Rand Paul, R-Kentucky, planned to mount a filibuster in an attempt to delay final passage -- and some rural state senators from both parties were threatening to vote against the plan. That means Senate Republicans could need roughly 20 of their members to vote to break a filibuster, a hurdle that Majority Leader Mitch McConnell will have to overcome next week.

Privately, Boehner abruptly dropped in for a brief strategy session in the office of Senate Minority Leader Harry Reid, a long-time adversary but whom he needs now to push the deal over the finish line. Boehner -- who has a reputation for getting emotional -- left, appearing to have tears in his eyes.

The two men -- in addition to McConnell and House Minority Leader Nancy Pelosi -- realized that they had their work cut out for them.

Tuesday afternoon the Congressional Budget Office informed leaders that the methods they used to pay for the deal left them roughly $5 billion short. Leadership aides from both parties downplayed the budget hole, saying the CBO didn't give them full credit for the savings they came up with and there would likely be some technical changes to the bill, but no major revisions.

Reid said the CBO issue won't sideline the deal.

"The number isn't quite right, but that doesn't matter," Reid said. "The point is this: the CBO numbers have fluctuated for more than a week. One day up. One day down. We are satisfied with the agreement we have."

Photos: The hand-off: How Speakers Ryan to O'Neill came to power Photos: The hand-off: How Speakers Ryan to O'Neill came to power The current Speaker of the U.S. House of Representatives is Paul Ryan, a Republican from Wisconsin. He gained his power from his predecessor, former Speaker John Boehner, after the Ohio Republican shocked the political world by deciding to vacate his position. Click through for other recent speakers: Hide Caption 1 of 8 Photos: The hand-off: How Speakers Ryan to O'Neill came to power Former Speaker John Boehner, a Republican from Ohio, gained his power from his predecessor, former Speaker Nancy Pelosi, when the GOP gained the majority of seats in the House in the 2010 midterm elections. Boehner announced his intention to leave the position in September 2015, and Paul Ryan succeeded him in October. Hide Caption 2 of 8 Photos: The hand-off: How Speakers Ryan to O'Neill came to power U.S. Rep. Nancy Pelosi was the first and only female speaker of the House. Her speakership lasted from January 4, 2007, to January 3, 2011. Pelosi, a Democrat, lost her seat to the Republican majority in the 2010 midterms. John Boehner took the gavel. Hide Caption 3 of 8 Photos: The hand-off: How Speakers Ryan to O'Neill came to power Dennis Hastert remains the longest serving Republican speaker in history, from January 6, 1999, to January 3, 2007. However, the GOP lost its majority in the House of Representatives, leaving Democrat Nancy Pelosi to become speaker. On Thursday, May 28, Hastert was accused in an indictment of lying to the FBI and evading currency reporting requirements as he sought to pay off a subject to "cover up past misconduct." On Thursday, October 28, Hastert pleaded guilty in the case. Hide Caption 4 of 8 Photos: The hand-off: How Speakers Ryan to O'Neill came to power Newt Gingrich broke the four-decade line of Democratic speakers by becoming speaker from 1995 to 1999 and was named Man of the Year by Time magazine for the accomplishment. He then fell from grace after a disappointing 1998 midterm election for the GOP, prompting him to step down from both the speakership and Congress. Gingrich's resignations came as a complete surprise to many, as the speaker had been fighting to keep his top job until the announcement. Hide Caption 5 of 8 Photos: The hand-off: How Speakers Ryan to O'Neill came to power Tom Foley, a Democrat who represented Washington state in the House for 30 years, took over the office of the speaker after the resignation of Jim Wright. Foley served as speaker from 1989 to January 1995 but was defeated in the 1994 election by George Nethercutt. Hide Caption 6 of 8 Photos: The hand-off: How Speakers Ryan to O'Neill came to power Jim Wright of Texas served two years as speaker, after Massachusetts Democrat Tip O'Neill retired. But he stepped down in 1989 after facing a House Ethics Committee investigation on improprieties with the sale of his book and fees from speaking engagements. He was the first speaker to resign in the face of a scandal. He died on May 6, 2015, at 92. Hide Caption 7 of 8 Photos: The hand-off: How Speakers Ryan to O'Neill came to power A Massachusetts Democrat who served as speaker from 1977 until retirement in 1987, Tip O'Neill was well-known for his deal-making as well as his collegiality with former President Ronald Reagan. Former Speaker Nancy Pelosi thought to commemorate the 34-year congressional career of O'Neill with an office building on the edge of Capitol Hill that bears his name. O'Neill was the longest continuously serving House speaker of any party in U.S. history. Hide Caption 8 of 8

Another problem facing leaders: Rural lawmakers sharply objected to language included in the deal that would cut into crop insurance subsidies for farmers.

House Agriculture Committee Chairman Mike Conaway, R-Texas, began circulating a letter Tuesday urging fellow Republicans to oppose the bill until the provision is removed.

"As chairman of the Ag Committee, I got to protect the integrity of the farm bill," Conaway said. "The overall impact is to flush insurance companies out of business, which I think is the President's intent."

Under the deal, rate of return for crop insurance will be lowered to 8.9% -- down from 14.5% -- in order to cut costs and help pay for the increased spending. Republicans and Democrats agreed to raise domestic and defense spending by $80 billion over the next two years, with an additional $32 billion in emergency war funding. It would extend the national debt limit until March 2017 and make cuts to the Social Security disability program.

Conaway, along with the Senate Agriculture Chairman Pat Roberts, R-Kansas, and top committee Democrats, issued statements blasting the change to the crop insurance program, and arguing they would oppose any changes to the 2014 farm bill they negotiated.

"While congressional leaders may sell this package as providing budget stability, it is anything but stable for farmers and ranchers," Roberts said in a statement. "Once again, our leaders are attempting to govern by backroom deals where the devil is in the details. I will continue to oppose any attempts to cut crop insurance funding or to change crop insurance program policies."

Florida Rep. Dennis Ross, a member of the House GOP whip team, told reporters he planned to vote against the bill mainly because of the "ag issue," but he also cited concerns about not getting more in return for suspending the debt ceiling.

On Tuesday afternoon, sources said that party leaders were engaged in a furious round of back-channel talks with the CBO to ensure that the price tag of the proposal didn't scare away support. By Tuesday afternoon, leaders were trying to ensure that the deal wouldn't cost more than anticipated, a potential problem for fiscal conservatives.

Many Republicans, however, were still reserving judgment -- particularly since the bill was proposed shortly before midnight and could be voted on right before Boehner officially hands the speaker's gavel over to Ryan.

Rep. Tom Rooney, R-Florida, said his district consists of seniors and farmers -- two groups who are "not going to be ecstatic about some of the things that are in there."

He added: "I'm a little frustrated that we're doing a (whip) check right now because I have no idea."

On both sides of the Capitol, lawmakers were frustrated about the process of being forced to capitulate on a key concession -- raising the debt ceiling -- without more time for debate.

Wisconsin Republican Sen. Ron Johnson called the process "disgusting" and threatened to vote against it.

Rep. John Shimkus, R-Illinois, said he was "leaning no" on the deal, pointing to the way leaders crafted the way to pay for it.

"There's a crop insurance in there I didn't know about," he said.

After a Tuesday morning meeting where GOP lawmakers played a video montage feting Boehner, the Ohio Republican expressed confidence that the deal would be passed Wednesday. But Boehner, too acknowledged the process could have been a little less sloppy.

"This is not the way to run a railroad," he told reporters, contending he had no other choice.