How can I tell a debian package to forget about a file (such that the file doesn't get deleted during a purge or remove)? [closed] - dpkg

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
A debian package I made overwrote files belonging to other packages (using --force-overwrite option). I realized this was bad, but after deleting these files from the package, building and reinstalling, it'll delete those files since it think's my package owns those files and no longer needs them.
I need dpkg to forget my package ever knew about those files, such that I can remove/purge/install and without it ever thinking about those files again.
Note that this package is only meant to be deployed on systems I control, not distributed to clients, so tinkering with already installed packages is acceptable, so long as I can get this back to a non-messed up state.
Couldn't find an answer on stackoverflow or here, appreciate any help or links to similar questions I missed.

Found that dpkg stores a list of each installed package's files here:
/var/lib/dpkg/info/mydpkg.list
Appears to be a list of every directory and file installed by the package, eg
/etc/udev
/etc/udev/rules.d
/etc/udev/rules.d/95-serial485-pi3.rules
/etc/udev/rules.d/97-serial485-pi4.rules
Fix: sudo vim /var/lib/dpkg/info/mydpkg.list and delete lines of files I want my package to forget about, therefore not trying to delete when uninstalling (or when installing a new version of the package that doesn't have those files anymore.) Unclear on if it's necessary to delete the lines referencing parent directories (eg /etc/udev and /etc/udev/rules.d above).
Bonus: I found this by using strace on the command that lists these files, finding out where it gets its info from:
strace dpkg-query -L mydpkg
Taken from here:
https://unix.stackexchange.com/questions/200171/where-does-dpkg-l-gather-its-information

We can use some commands that help us to keep the package dependency and remove the package.
Remove the package without removing the dependency.
sudo dpkg -r --force-depends <package_name>
Remove the package including the configuration file and without removing the dependency.
sudo dpkg -P --force-depends <package_name>
I highly don't recommend this thing because sometimes dependency may create an issue in the future.
I always prefer to uninstall all the dependency when I uninstall the package.
If your package is broken then you can use the following command to resolve an issue.
To fix the broken packages
sudo apt install -f
I have answered this question based on this article.

Related

Resolving Homebrew warnings without causing adverse effects

I am having issues installing mysql with Homebrew and have ran brew doctor to try and get to the bottom of it.
The advice given is always to resolve the warnings/errors presented by Homebrew, however I do not want to cause adverse side-effects on my system by doing so.
As I understand it, the node errors are likely caused by installing Node manually and not with Homebrew. I'm not sure what the git unlinked keg is about.
What is the safest way to resolve these errors?
CRMPiccos-MacBook:~ crmpicco$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected header files:
/usr/local/include/node/node_internals.h
/usr/local/include/node/smalloc.h
/usr/local/include/node/v8stdint.h
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
git
As I understand it, the node errors are likely caused by installing Node manually and not with Homebrew.
I don’t know where these files come from but if you’re afraid of removing them you could just move them somewhere then move them back if they’re needed.
I'm not sure what the git unlinked keg is about.
git is installed but not symlinked into standard locations like /usr/local/bin and friends. Programs that depend on that specific git installation thus can’t find it. You should either run brew link git or brew rm git if you don’t have any formula that depend on it.

How to restart X Windows System for new desktop `Xfce' to take effect [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I installed Fedora 20 a while ago and now decided to install and test Xfce ui.
I installed Desktop Switched gui utility for switching the ui.
Now when I select xfce in the switcher utility and click apply I get the following message.
Your desktop configuration has successfully been updated, but you must
restart the X Window System for the changes to take effect.
I then restart my system by doing a shutdown however my old ui (which I believe is gnome) still shows up. How do I restart the Xwindows system ?
So as I mentioned in the comments I was unable to reproduce your issue. Here is what I did.
a fresh install of Fedora-Live-Desktop-i686-20-1.iso. I created a user during this process.
then updated it with $ sudo yum groups install "Xfce Desktop".
Then I rebooted
When I got the gdm screen. I was able to click on the little gear icon and select Xfce, and everything worked like a top.
Update ( what fixed the issue ):
MistyD > No I changed the start up from session manager during logging on. The next time I restarted my system my old session option was preselected
So now what? Well in the the spirit of:
teach a man/woman to fish you feed him for a lifetime
Note: This the techniques below are non-vendor specific linux configuration advice.
In general when experience window manager configuration issues like this one: and you have two machines: and one works [ workie-box ] and once does not [ no-workie-box ].
I will go through the following debugging process:
Package installation differences
Package Configuration differences
User configuration differences
1: Package installation differences
this situation can arise for a myriad of reasons, however the most common one is the package updates. ( in this case the yum groupinstall ) occurred at different times or while pointed to different package repositories.
$ ssh root#no-workie-box
$ rpm -qa |sort > all_packages_no_workie_box.txt
Now collect the same information on the workie-box
$ ssh root#workie-box
$ rpm -qa |sort > all_packages_workie.txt
Finally copy those two text files to a different machine and diff them. This little technique has saved my bacon many many times.
To round out this topic: what if someone touched something within the package ... how can I know that? With rpm's verify command.
$ rpm -qV gdm
This can also be a super helpful technique.
2. Package Configuration differences
For your issue specifically this is tricky because you have to first choose a display managers. There are several: for example: cdm, tdm, gdm, kdm, lightdm, lxdm, mdm, xdm, SLiM, etc. Mix in with that the fact that different distros package them up and this can turn into the Wild-Wild-West pretty quickly. However here are some helpful rpm specifics
$ rpm -ql gdm |grep bin
/usr/bin/gdm-screenshot
/usr/bin/gdmflexiserver
/usr/sbin/gdm
$ rpm -qcf /usr/sbin/gdm
/etc/gdm/Init/Default
/etc/gdm/PostLogin/Default.sample
/etc/gdm/PostSession/Default
/etc/gdm/PreSession/Default
/etc/gdm/custom.conf
/etc/pam.d/gdm-autologin
/etc/pam.d/gdm-fingerprint
/etc/pam.d/gdm-password
/etc/pam.d/gdm-pin
/etc/pam.d/gdm-smartcard
You now know the pond you are fishing in, and alto of times that is enough to catch some fish. Combine that knowledge with the little tidbit I pointed out in section 1:
$ rpm -qV gdm
and this will put you on-top of anyone else configuration attempts. ( including yours that you forgot about )
3. User configuration differences
This little technique has saved my bacon numerous times while un-spooling some window manager that is not working properly. So here is the deal, linux stands on the shoulders of unix's multi user environment heritage. Because of tenet's of unix in general related to user configuration, linux will store all sorts of configuration information in your home directory. This can become extremely problamatic on an update. As most package upgrade systems will leave your configuration un-touched. I.E. They treat you as the expert... they assume you know what you are doing.. so the packagemanager wont touch user configurations.
# Logged in as a user
$ ls -a1 |grep ^\\.
.
..
.bash_history
.bash_logout
.bash_profile
.bashrc
.cache
.color
.config
.esd_auth
.gnupg
.ICEauthority
.local
.mozilla
.ssh
Look at all of those dot files and directories... Note: there could be plenty more.
Over the years I have used a few techniques to deal with this issue. However my new favorite one is to create a new user from scratch.
Reboot ( - cringe - )
Then log in as that new user. More often than not that will fix the issue. You know that the problem is something to do with your previous user's configuration.
Finally:
The last part of your question was related to restarting X, to re-read in your configuration.
Note: I put a reboot -- cringe -- in the previous section. You will find that salty sys admins take great pride in the fact that they dont reboot there linux machines. This is usually because they deal with servers all the time. I would go a step further and ask why you are running a gui on your server. But alas for the nerdy....
Here is how to re-start an X window session without rebooting.
Ok so the deal is that most likely the window manager, and thus the X session was started by a display-manager. Therefore when you log out of your window manager you are still running X. To force a restart... So here is what you do... Kill all of the display-manager && X processes. They will re-fire.. and re-read in your X configuration.
1: ctrl alt F2
This will take you to a terminal.
2: $ ps -efw
observe the processes, you are looking for X processes
3: $ ps -efw |grep X
these are your X server processes.
You also need to find your desktop manager processes. ( you could have several different ones )
4: $ ps -efw |grep kdm
$ ps -efw |grep gdm
Now: kill all of the X processes and the display manager processes.
5: $ kill -9 #<pid1> #<pid2> #<pid3> #<pid4>
Note: The system will be configured to restart those DISAPLY manager processes, thus restarting X and re-reading in your configuration.
Or you could just reboot -- grin --

Where can I download mysql jdbc jar from? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I installed and tried to use jasper report studio. The first brick wall you hit when you try to create a datasource for your reports is
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
The forums say I need to install a jar on the classpath. I have no idea how to do this, so the first hurdle is how to get the jar. The only place I can find is this:
http://dev.mysql.com/downloads/connector/j/
but this unfortunately gives you an msi installer, not a jar. I don't want to install stuff, just get the jar.
I have mysql DB installed, had have trawled through the install dir in program files, but can't find the jar.
Anyone know the official (not malware site) way to get hold of the mysql jar? It seems bizarre that its so hard to find.
I have windows 8 64 bit and mysql 5.6.
Go to http://dev.mysql.com/downloads/connector/j and with in the dropdown select "Platform Independent" then it will show you the options to download tar.gz file or zip file.
Download zip file and extract it, with in that you will find mysql-connector-XXX.jar file
If you are using maven then you can add the dependency from the link http://mvnrepository.com/artifact/mysql/mysql-connector-java
Select the version you want to use and add the dependency in your pom.xml file
If you have WL server installed, pick it up from under
\Oracle\Middleware\wlserver_10.3\server\lib\mysql-connector-java-commercial-5.1.17-bin.jar
Otherwise, download it from:
http://www.java2s.com/Code/JarDownload/mysql/mysql-connector-java-5.1.17-bin.jar.zip
Here's a one-liner using Maven:
mvn dependency:get -Dartifact=mysql:mysql-connector-java:5.1.38
Then, with default settings, it's available in:
$HOME/.m2/repository/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar
Just replace the version number if you need a different one.

"reading files list for package 'inkscape': Input/output error" while trying to install packages [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
It doesn't matter what I try to install using my package manager(sudo apt-get install whatever), I always get this error.
dpkg: unrecoverable fatal error, aborting:
reading files list for package 'inkscape': Input/output error
E: Sub-process /usr/bin/dpkg returned an error code (2)
I have researched and have tried to rebuild my dpkg status file, and I have also tried to revert to an older version, but it either hasn't worked or I am doing it wrong.
Also, when I try to run the command "sudo apt-get update", I get this error.
The problem started when I lost my internet connection while downloading monodevelop. Any help is greatly appreciated.
I figured out the answer, so I will post it here in case anybody else has the same problem in the future.
NOTE: After this fix, apt-get no longer installs dependencies for me automatically without using the -f flag.
Go into the /var/lib/dpkg directory
Make a backup of the "status" file
Open the status file as root and find the package that causes the error.
In this case, its "PACKAGE: inkscape".
Delete all the text until the next PACKAGE: declaration in the file.

Completely remove and reinstall mysql [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I managed to bork my installation of it while trying to uninstall it. I installed via Muon (Kubuntu), and attempted uninstallation the same way.
I tried apt-get install/remove (on both mysqlserver and mysql), then tried manually removing files, but it just doesn't work. Somewhere it's determining not to regenerate its configs and not reinstall like a fresh install would.
How do i just get rid of everything mysql-related? I'd like to start fresh.
apt-get purge PACKAGENAME should completely remove a package including its configurations. Maybe this works better.
remove leaves behind configuration files. You need to use purge instead. (purge works on both apt-get(8) and dpkg(8).)
I had to copy a default mysql.cnf (obtained via googling) into the /etc/mysql directory. It created debian versions of the config while using "apt-get install mysql-server-5.1", so i'm assuming the installation i was trying to do was just bad. Should have gone rpm i guess.
However using purge DID remove a few other files i didn't know about, so it did help. +1