# mysql broken after upgrading freebsd



## tony33 (May 23, 2020)

So, I upgraded freebsd from 11.1 to 12.1 after this I updated ports and upgraded softwares like mysql, php etc. So, most software work even though there's warnings because 
configs are using outdated stuff.  However, most software still runs and works. Mysql is the only thing that's broken. It has a major error that doesn't allow it to run.

error states this : "  ld-elf.so.1: shared object "libncursesw.so.8"  not found . 
mysql80-server:  warning failed to start mysql."

this is what it spits out. I asked on other websites and was told  there's an issue.
I need to go to ports and install compat12x. So,  I try this and do a install make clean. 

I get an error message that compat12x needs freebsd 13 installed. 

Now, I tried to upgrade to freebsd13 thru freebsd-update and was told I can't and need to install from sources.

I need to know what I need to do to fix this issue and if I need to upgrade to freebsd 13 how can I do this? 
Like what commands I need to use? I tried freebsd-update -r  upgrade freebsd13.0-current.  

Thanks In  Advance.


----------



## rootbert (May 23, 2020)

stay with 12.1 if you want a rock-steady stable system. you can try with compat11 (it ran with 11.1 so you need compat11). To be on the save side, copy all the data files of mysql to a safe place in case you have no backups. Then you could uninstall mysql and all dependencies and do a fresh install of mysql8, placing the data files back to the appropriate location. You could also try to copy all that files to a jail and run it in a FreeBSD 11.1-jail until you migrate all the stuff to 12.1. I prefer to do a dump before upgrade, and then start over with a fresh install of my components, in this case mysql, and then restore the dump.


----------



## tony33 (May 23, 2020)

rootbert said:


> stay with 12.1 if you want a rock-steady stable system. you can try with compat11 (it ran with 11.1 so you need compat11). To be on the save side, copy all the data files of mysql to a safe place in case you have no backups. Then you could uninstall mysql and all dependencies and do a fresh install of mysql8, placing the data files back to the appropriate location. You could also try to copy all that files to a jail and run it in a FreeBSD 11.1-jail until you migrate all the stuff to 12.1. I prefer to do a dump before upgrade, and then start over with a fresh install of my components, in this case mysql, and then restore the dump.


I do have a backup before I upgraded to freebsd12.1   but I already have compat11  installed.  It's mysql80-server that complains. I am sure if I installed the previous verison back it would work. Like the older version of mysql would work fine. It's just that I don't want to have to keep every now and then updating software randomly over the year to just to keep being up to date .I rather update everything at once and not think about it until the next version. I always once up a month check to update software if it needs to be. but I do it all at the same time. I just don't like updating a few knowing there's more that needs to be updated and leave it for a month or two to then update those. Because when that happens that's when I normally forget and I assume i update everything back on that one day.  That's why I like to jut update everything at the same time.


----------



## rootbert (May 23, 2020)

ok, then you don't need compat11. Maybe try to uninstall mysql80-server and do a pkg autoremove, then start over with pkg install mysql80-server (assuming you are using pkg)


----------



## richardtoohey2 (May 24, 2020)

Slow down - take a deep breath.

FreeBSD 12.1 is fine, it looks like you've got some dependency issue with MySQL.

Back to basics - how did you upgrade?  Double-check you completed all steps and make sure you are up-to-date with any newer patches.

How do you install applications?  Via ports or pkg?

If you do an internet search for your error "libncursesw.so" - looks like that's something to do with ncurses.  So maybe you have to rebuild or reinstall that and/or rebuild/reinstall MySQL (as rootbert says above.)


----------



## tony33 (May 24, 2020)

richardtoohey2 said:


> Slow down - take a deep breath.
> 
> FreeBSD 12.1 is fine, it looks like you've got some dependency issue with MySQL.
> 
> ...



I ran  freebsd-update fetch and then update  until I got  no updates downloaded message.   Then I did freebsd-update -r upgrade freebsd12.1-RELEASE  and ran that. It grab the files and downloadded it.  It then installed the upgrade. It told me to restart and run freebsd-update fetch and update and install. I then ran portsnap fetch and then update.  I used ports.

The problem with this though is that some ports failed to make and install.  So,  I then did a pkg update and it downloaded new packages  and then I installed stuff thru there. i mostly used pkg to instant.. The ports normally failed wit h error 70 and 1.

yes it relates to ncurses. I reinstall that via pkg.  how would I rebuilt mysql?   I don't think I tried that. I tried doing a make install clean in the ports but got error 70  and error 1.  it just fails.
error 70 comes after a line that states mysql80-server is registering. 

but the file that the error states is missing. Someone had me check i THINK  in  /usr/.libs and it was in that folder.  They told me maybe a system link issue? could it be permission issues? because I know  I had permission issues   because before the upgrade I  make a backup of everything but it   would keep giving me permission issues where I can't   copy over files. so I think I by mistake chmod 777 call the files on the OS. and did a back up that way . Then I dump the files back on a new drive and am using the new drive.  I had a lot of permission issues cleared all the ones that complained at startup and with most software commonly used like apache etc. when starting. So, I  cleared that. 

I  am now thinking  I  should change it. I think the lib folder I chmod it to 655.  it was due to some complaining that  the permissions are too open and wouldn't run.  after chmodding that it fixed those errors and apache finally ran  and many  other programs. 

I am thinking now this might be the issue.


----------



## rootbert (May 24, 2020)

IIRC you had to reboot twice. In your case I would uninstall all packages and do a fresh install of the packages, I am quite sure the base operating system is fine. If you are happy with the default config options of packages I would stay with pkg, ports and packages should not be mixed.


----------



## richardtoohey2 (May 24, 2020)

It feels like the upgrading of ports/packages was missed or went wrong?  You said that you did this, so something must have failed.









						Chapter 25. Updating and Upgrading FreeBSD
					

Information about how to keep a FreeBSD system up-to-date with freebsd-update or Git, how to rebuild and reinstall the entire base system, etc




					www.freebsd.org
				




_Generally, installed applications will continue to work without problems after minor version upgrades.  Major versions use different Application Binary Interfaces (ABIs), which will break most third-party applications.  After a major version upgrade, all installed packages and ports need to be upgraded.  Packages can be upgraded using pkg upgrade.  To upgrade installed ports, use a utility such as  ports-mgmt/portmaster._

Not sure what you are doing with the file permissions - shouldn't be required for the upgrade to FreeBSD 12.1.

Were you on MySQL 8 when using FreeBSD 11?

As rootbert says - don't mix ports and packages, choose one and stick with it, and pkg is the recommended way these days.  And as rootbert says, it might be best to clear out & fresh install the packages (make sure you've backed up any data/config.)


----------



## tony33 (May 26, 2020)

richardtoohey2 said:


> It feels like the upgrading of ports/packages was missed or went wrong?  You said that you did this, so something must have failed.
> 
> 
> 
> ...


No, when I was on freebsd 11 i used mysq;57-server.


----------



## richardtoohey2 (May 26, 2020)

Did you try and upgrade MySQL during the upgrade process?
MySQL 5.7 is the current default (so far as I know) so I don't _think_ any of the upgrade process would try and move you to MySQL 8.x?

I wouldn't recommend changing any versions of ports/packages during a major OS version upgrade, unless you are compelled to.


----------



## SirDice (May 27, 2020)

richardtoohey2 said:


> MySQL 5.7 is the current default (so far as I know) so I don't _think_ any of the upgrade process would try and move you to MySQL 8.x?


It won't. From the system's point of view they are two different applications, not the same application with multiple versions. So it won't suddenly upgrade your MySQL from 5.6 to 8.0 for example. You can get in a situation like that if the _default_ changes though. In that case you will likely end up without the -server package as only the client gets updated (and due to the dependency chain the -server package gets removed).


----------



## tony33 (Jun 2, 2020)

So is the current version mysql 5.7?


----------



## SirDice (Jun 2, 2020)

tony33 said:


> So is the current version mysql 5.7?


Yes.

```
# Possible values: 5.5, 5.6, 5.7, 8.0, 5.5m, 10.1m, 10.2m, 10.3m, 10.4m, 5.5p, 5.6p, 5.7p, 5.6w
MYSQL_DEFAULT?=         5.7
```
See /usr/ports/Mk/bsd.default-versions.mk.


----------



## VladiBG (Jun 2, 2020)

Did you fix your MySQL?

Do not upgrade the database schema from 5.x to 8.0 without analyze your program first as there's some deprecated functions that were drop in MySQL 8.0
If you need a single program build from ports then stop using packages. All upgrades of all programs must be done via ports otherwise you will end up with missing dependencies. To fix this you will need to remove the installed package then to run pkg autoremove to clean the rest of the old installed dependences and install it again using the port.

ps.
Current version is MySQL 8.0
Default version in FreeBSD is MySQL 5.7
Default version is the version against All packages are build. If you need to work with the current version then you need to use ports.


----------



## tony33 (Jun 6, 2020)

VladiBG said:


> Did you fix your MySQL?
> 
> Do not upgrade the database schema from 5.x to 8.0 without analyze your program first as there's some deprecated functions that were drop in MySQL 8.0
> If you need a single program build from ports then stop using packages. All upgrades of all programs must be done via ports otherwise you will end up with missing dependencies. To fix this you will need to remove the installed package then to run pkg autoremove to clean the rest of the old installed dependences and install it again using the port.
> ...



No, I don't have mysql 8.0 working. Mysql 5.7 works  flawlessly but I just w ant to have the current verison install so I  don't have to do this in a couple of months.


----------



## richardtoohey2 (Jun 6, 2020)

5.7 is supported (by Oracle) for at least another 3 years.  It won't be going anywhere anytime soon.


----------



## VladiBG (Jun 6, 2020)

Installing MySQL 8.0 is easy but you need to upgrade your database and verify if your application is using some deprecated functions from 5.x. So it's better to stay on version 5.x on your production server and test your upgrade on some other developer test server where you can install MySQL 8.0 and restore a copy of your database and program to verify if everything is ok and after that to upgrade your production server to MySQL 8.0

For more information regarding the changes between 8.0 and 5.x you can read here:





						MySQL :: MySQL 8.0 Reference Manual :: 2.11.4 Changes in MySQL 8.0
					






					dev.mysql.com


----------



## tony33 (Jun 10, 2020)

I ran  this command:  perl -v    and it  gave an error  saying something like  ld-elf.so.0 shared library       libperl5.24.so missing.   I even uninstall perl5.30 and  tried  make sure no perl is installed and when that happened. I ran the perl -v command  and I get the same error.  Is there any command that I  can run to figure out if there's any perl install?   I just don't understand the error  I am getting other than that perl is trying to run perl5.24  even though I  installed perl5.30  and changed  i changed the make config to use perl5.30.  I ran apache24 and it uses perl5.30 with no issues.


----------



## richardtoohey2 (Jun 10, 2020)

It really feels like you missed out a step during the upgrade - you seem to have a mess of old and new ports/packages and libraries.

This shows the perl on one of my systems and the libraries it uses:

```
% ldd `which perl`
/usr/local/bin/perl:
    libperl.so.5.30 => /usr/local/lib/perl5/5.30/mach/CORE/libperl.so.5.30 (0x800249000)
    libthr.so.3 => /lib/libthr.so.3 (0x8005b3000)
    libm.so.5 => /lib/libm.so.5 (0x8005e0000)
    libcrypt.so.5 => /lib/libcrypt.so.5 (0x800612000)
    libutil.so.9 => /lib/libutil.so.9 (0x800633000)
    libc.so.7 => /lib/libc.so.7 (0x80064a000)
```


----------



## SirDice (Jun 10, 2020)

tony33 said:


> I even uninstall perl5.30 and tried make sure no perl is installed and when that happened. I ran the perl -v command and I get the same error.


If you removed all perl versions  you should get a "Command not found" error actually. Which means there's something lingering on your system that shouldn't be there.

What does `ls -l /usr/bin/perl* /usr/local/bin/perl*` show?


----------



## putin.is.a.thief (Jun 10, 2020)

tony33 said:


> I ran freebsd-update fetch and then update until I got no updates downloaded message. Then I did freebsd-update -r upgrade freebsd12.1-RELEASE and ran that. It grab the files and downloadded it. It then installed the upgrade. It told me to restart and run freebsd-update fetch and update and install. I then ran portsnap fetch and then update. I used ports.



Aren't you mixing *quarterly* pkgs with *latest* ports? This seems to be a common problem.
By default, freebsd12.1-RELEASE has */quarterly* in /etc/pkg/FreeBSD.conf, but *portsnap* tool
uses /latest ports tree. Mixing those are incorrect.
If so, either switch pkg.conf to /latest or use quarterly
ports. To use quarterly ports you either need to track the proper ports branch every time it's made (2020Q2 now) or to use this script to automatically switch branches: https://chriswells.io/downloads/System Administration/Shell Scripts/portsfetch

Also note that there is /usr/ports/INDEX-12 (for FreeBSD-12) file that need to be either recreated (make index) or fetched (make fetchindex). The last option gives you only *latest* by default if I'm not wrong. Be careful!


----------



## tony33 (Jun 11, 2020)

richardtoohey2 said:


> It really feels like you missed out a step during the upgrade - you seem to have a mess of old and new ports/packages and libraries.
> 
> This shows the perl on one of my systems and the libraries it uses:
> 
> ...


I have no clue to be honest.

I fixed the issue but not sure if it's the right way. 

What I found is  there's a /usr/bin/perl   and a  /usr/local/bin /perl.  

Now   in /usr/local/bin/  there's a perl, perl5.24  a perl5.26  and a perl5.30 

So, I had to do a sys link.   So,  I renamed /usr/bin/perl to /usr/bin/perlbak and then made a sys  link named perl at that location.
that links it to /usr/local/bin/perl5.30   and after that everything worked.


However, now I back to the original problem. I  did rebild the ports and upgraded things. 

I still get the error ld-elf.so.1 :    libncursesw.so.8   not found  but is needed for csh.   this  is what it spits out. 

I think I have to do something similar.  Even thought the latest libncursesw.so.8.  So, I don't know what else I can do. 

Only mysql8.0 can't run right now. My other softwares can run flawlessly.


----------



## richardtoohey2 (Jun 11, 2020)

perl isn't part of the base, so my understanding is that it should never have been in /usr/bin but only /usr/local/bin.

Maybe you manually built and installed perl (i.e. outside of ports) at some point?  And that installed to /usr/bin?

The older versions in /usr/local/bin - if you built those from ports then maybe you didn't follow the instructions in /usr/ports/UPDATING?  There are usually a few tidy-up steps each time there's a new version of perl.

I think you've got a bit of a tangled mess of libraries - a careful backup of configuration, databases, etc. and test that backup on another machine.

Then rebuild this affected machine from a clean install of 12.1.


----------



## tony33 (Jun 12, 2020)

The error


richardtoohey2 said:


> perl isn't part of the base, so my understanding is that it should never have been in /usr/bin but only /usr/local/bin.
> 
> Maybe you manually built and installed perl (i.e. outside of ports) at some point?  And that installed to /usr/bin?
> 
> ...


No, I  wouldn't build manually.  I just install from either ports or pkg.  I always try to install stuff from ports.

right now I looked at the error and it looks like csh is complaining that it cannot find libncurse.so.8 

I ran  ldd /bin/csh  and it  shows all that it depends on and it shows it finds /libncurses.so.8     now I am trying to figure out if  it's a permission issue.

Why would t his affect mysql80-server?  does it use csh?


----------



## richardtoohey2 (Jun 12, 2020)

Have you got another machine you can try on?  Or a machine that you can put a VM on?

Install FreeBSD 12.1 there and try MySQL 8 and everything else you want - get it all working, document the steps you need to take.  Try binary packages first.

Then you'll know it works and how to get it working and then you can decide what to do with the mangled machine.

I do not know how to fix the mangled machine - I think you will have issue after issue after issue with it because you have somehow got it in a tangled mess.  Obviously not on purpose, but that's where you are now.  Every time you try and install or upgrade something in the future, you might get another error.  Copying things and symlinking etc. will only be papering over the cracks.

What you are seeing is not normal (not in my experience, anyway!) for FreeBSD so my 2c is that you need to scrub and start again.  But if you try on another machine and confirm that you can get everything the way you want it and that FreeBSD 12.1 is fine then I think you'll have a bit more confidence that FreeBSD is OK and you can get what you want from it.


----------



## SirDice (Jun 12, 2020)

tony33 said:


> What I found is there's a /usr/bin/perl and a /usr/local/bin /perl.
> 
> Now in /usr/local/bin/ there's a perl, perl5.24 a perl5.26 and a perl5.30
> 
> ...


No!  Please  stop making symlinks. That's how you got into this mess in the first  place. Delete all installed perl  packages, then _remove_ all those left-over perls. Once everything is cleared install perl again. Now you've properly solved this.


----------



## tony33 (Jun 12, 2020)

I ran ldconfig -r      and it gives me a list and I can find the file that it claims is missing. The error I  am seeing looks like it's coming from csh but if I  ldd csh it shows it can find the file. 
The file resides in /lib  and /../../../compat/lib   etc.


----------



## tony33 (Jun 20, 2020)

SirDice said:


> No!  Please  stop making symlinks. That's how you got into this mess in the first  place. Delete all installed perl  packages, then _remove_ all those left-over perls. Once everything is cleared install perl again. Now you've properly solved this.


I did do it .  I worked on this issue. I want to know how can I make sure  ncurses is being compiled via --enable-widec   option?


----------

