Find the answer to your Linux question:
Results 1 to 9 of 9
Hi Guys, i have an activity planned where i need to update the Nic drivers (tg3),i am planning to install the src rpm and then do rpmbuild -bb. What is ...
  1. #1
    Just Joined!
    Join Date
    Oct 2011
    Posts
    1

    Rollback Driver on RHEL

    Hi Guys, i have an activity planned where i need to update the Nic drivers (tg3),i am planning to install the src rpm and then do rpmbuild -bb. What is the safest way to rollback if necessary?

  2. #2
    oz
    oz is online now
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,099
    Quote Originally Posted by mpdevul View Post
    Hi Guys, i have an activity planned where i need to update the Nic drivers (tg3),i am planning to install the src rpm and then do rpmbuild -bb. What is the safest way to rollback if necessary?
    Hello and welcome!

    There isn't any rollback option with Linux, but you can make sure you have a copy of any previous packages that you might need on hand before installing any new packages, then reinstall the previous packages if needed, or you can do some type of system backup that you could restore your previous system from if needed. You can do complete system image backups or only incremental backups of files/configs if you wish.

    Check this database for some backup options that might work for you, and I'd recommend testing them before counting on them to fulfill your needs:

    Backup | Linux App Finder

    Drive Imaging | Linux App Finder
    oz

    new members/users: read this first | new member faq
    no private messages requesting computer support - post them on the forums!
    please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.

  3. #3
    Linux Guru
    Join Date
    May 2011
    Posts
    1,843
    In the case of a kernel driver, you can effect a roll-back by simply backing up the file first, then restoring it to its original name when you wish to revert to your original state, e.g.:

    Code:
    # back up the original driver/file
    mv /lib/modules/$(uname -r)/kernel/drivers/net/tg3.ko /lib/modules/$(uname -r)/kernel/drivers/net/tg3.ko.bak
    
    # install your updated driver/rpm
    
    # remove your updated driver/rpm
    
    # restore the original driver/file
    mv /lib/modules/$(uname -r)/kernel/drivers/net/tg3.ko.bak /lib/modules/$(uname -r)/kernel/drivers/net/tg3.ko
    You might also wish to do a 'depmod -a' to regenerate your modules.dep file.

    If you ever find that you've clobbered a kernel driver, you can always replace that driver (along with all the others) with this set of commands:
    Code:
    # get the name of the RPM that owns your currently running kernel
    name=$(rpm -qf --queryformat='%{NAME}' `grubby --default-kernel`)
    
    # remove the RPM package from the RPM database, but leave the files themselves in tact
    # (you need to do this b/c yum will say it is already installed)
    rpm -e --justdb --nodeps $name
    
    # now install the kernel package
    yum install $(name)

  4. #4
    Linux Enthusiast Mudgen's Avatar
    Join Date
    Feb 2007
    Location
    Virginia
    Posts
    623
    That last is very cool, Atreyu! I never thought of that.

  5. #5
    Linux Guru
    Join Date
    May 2011
    Posts
    1,843
    Yeah, i was very happy when I found that option - can't wait for Yum to get on board.

  6. #6
    Linux Enthusiast Mudgen's Avatar
    Join Date
    Feb 2007
    Location
    Virginia
    Posts
    623
    Yeah, it's kind of weird that they specifically exclude installonly packages like kernels from the yum "reinstall" option.

  7. #7
    Linux Guru
    Join Date
    May 2011
    Posts
    1,843
    Confession: never noticed the reinstall yum option - thanks for pointing it out! when did those sneaky yum bastards slip that one in?

  8. #8
    Linux Enthusiast Mudgen's Avatar
    Join Date
    Feb 2007
    Location
    Virginia
    Posts
    623
    Those bastards originated from Duke University, so they have sneaky in their DNA (I'm a UNC alum). I think reinstall came along in the past couple of years.

    BTW, the "queryformat=%{NAME}" in
    Code:
    name=$(rpm -qf --queryformat='%{NAME}' `grubby --default-kernel`)
    makes the result ambiguous on systems with more than one kernel version installed, which is the case with most RH/Centos/Fedora systems. It's typically going to yield "kernel" without a version/architecture. rpm is going to report "kernel specifies multiple packages" and fail the db erase, and yum is going to install the latest available kernel, which may not be what you're running. I think you want to leave out the queryformat, which will yield a version-qualified name and the desired result.

    I actually had an application for this technique this morning, replacing source-compiled Qlogic drivers with the in-kernel ones. Thanks again for the tip.

  9. #9
    Linux Guru
    Join Date
    May 2011
    Posts
    1,843
    Quote Originally Posted by Mudgen View Post
    BTW, the "queryformat=%{NAME}" in
    Code:
    name=$(rpm -qf --queryformat='%{NAME}' `grubby --default-kernel`)
    makes the result ambiguous on systems with more than one kernel version installed, which is the case with most RH/Centos/Fedora systems. It's typically going to yield "kernel" without a version/architecture. rpm is going to report "kernel specifies multiple packages" and fail the db erase, and yum is going to install the latest available kernel, which may not be what you're running. I think you want to leave out the queryformat, which will yield a version-qualified name and the desired result.
    Yeah, forgot about that - I've run into that too. What I'd done to get around that was add the VERSION and RELEASE info:
    Code:
    name=$(rpm -qf --queryformat='%{NAME}-%{VERSION}-%{RELEASE}\n' `grubby --default-kernel`)
    Also, if grubby doesn't work/is not available, you can also do:

    Code:
    name=$(rpm -qf --queryformat='%{NAME}-%{VERSION}-%{RELEASE}\n' `ls /boot/vmlinuz-$(uname -r)`)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...