Linux

Tuning the JVM – G1GC Garbage Collector Flags for Minecraft

Introduction

After many weeks of studying the JVM, Flags, and testing various combinations, I came up with a highly tuned set of Garbage Collection flags for Minecraft. I tested these on my server, and have been used for years. I then announced my research to the public, and to this day, many servers have been using my flag recommendations for years and reporting great improvement to garbage collection behavior.

These flags are the result of a ton of effort, and results of seeing it in production on various server sizes, plugin lists and server types. They have proven themselves repeatedly.

I strongly suggest using these flags to start your server. These flags help keep your server running CONSISTENT without any large garbage collection spikes. CPU may be slightly higher, but your server will be overall more reliable and stable TPS.

If these flags help your server, consider donating!

Donate to Aikar

The JVM Startup Flags to use – MC 1.15 (Java 8+, MC 1.8+) Update

Use these flags exactly, only changing Xmx and Xms. These flags work and scale accordingly to any size of memory, even 500MB but 1.15 will not do well with such low memory…)

These flags are recommended for ALL versions of Minecraft! 1.8 all the way to 1.15+, use this set.

IMPORTANT – READ – Don’t use ALL of your memory!! PTERODACTYL USERS!

When setting the Xms and Xmx values, if your host says you have 8000M memory, DO NOT USE 8000M! Minecraft (and Java) needs additional memory on top of that Xmx parameter. It is recommended to reduce your Xmx/Xms by about 1000-1500M to avoid running out of memory or “OOMKiller” hitting your server. This also leaves room for the Operating System to use memory too.
Have 8000M memory? Use 6500M for safety. But you may also ask your host if they will cover this overhead for you and give you 9500M instead. Some hosts will! Just ask.


Recommended Memory

I recommend using at least 6-10GB, No matter how few players! If you can’t afford 10GB of memory, give as much as you can, but ensure you leave the operating system some memory too. G1GC operates better with more memory.

If you are running with 12GB or less memory for MC, you should not adjust these parameters.

If you are using an Xmx value greater than 12G

If you have and use more than 12GB of memory, adjust the following:

  • -XX:G1NewSizePercent=40
  • -XX:G1MaxNewSizePercent=50
  • -XX:G1HeapRegionSize=16M
  • -XX:G1ReservePercent=15
  • -XX:InitiatingHeapOccupancyPercent=20

NOTICE: If you see increase in old generation collections after this, revert back to the base flags!

Explanation of these changes:

  • Base flag set aims for 30/40 to reduce risk of to space issues. With more memory, less of an issue. We can give more to new generation with 40/50, as well as reduce reserve percent since the default reserve will already be larger.
  • Region Size increase helps reduce humongous allocations, and speeds up remarking. We need a smaller region size at smaller heaps to ensure an adequate amount of regions available
  • We can start looking for old generation memory to reclaim with more of a delay with IHOP at 20 since we have more old generation available to space on CPU.

Java GC Logging

Are you having old gen issues with these flags? Help me help you! Add the following flags based on your java version to enable GC Logging:

Java 8-10:

-Xloggc:gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=1M

Java 11+:

-Xlog:gc*:logs/gc.log:time,uptime:filecount=5,filesize=1M

Once you start seeing old generation collections in Timings, grab the logs/gc.log file (same location as your latest.log) and send it to me on Paper Discord to analyze.

GC logging does not hurt your performance and can be left on at all times. The files will not take up much space (5MB)

Technical Explanation of the Flags:

  1. -Xms matching -Xmx – Why: You should never run your server with the case that -Xmx can run the system completely out of memory. Your server should always be expected to use the entire -Xmx!
    You should then ensure the OS has extra memory on top of that Xmx for non MC/OS level things. Therefore, you should never run MC with -Xmx settings you can’t support if java uses it all.Now, that means if -Xms is lower than -Xmx -YOU HAVE UNUSED MEMORY!Unused memory is wasted memory.G1 (and probably even CMS to a certain threshold, but I’m only stating what I’m sure about) operates better with the more memory it’s given. G1 adaptively chooses how much memory to give to each region to optimize pause time. If you have more memory than it needs to reach an optimal pause time, G1 will simply push that extra into the old generation and it will not hurt you (This may not be the case for CMS, but is the case for G1).The fundamental idea of improving GC behavior is to ensure short lived objects die young and never get promoted. With the more memory G1 has, the better assurance you will get that objects are not getting prematurely promoted to the old generation.G1 Operates differently than previous collectors and is able to handle larger heaps more efficiently.

    If it does not need the memory given to it, it will not use it. The entire engine operates differently and does not suffer from too large of heaps, and this is industry wide accepted information that under G1 to keep Xms and Xmx the same!

  2. UnlockExperimentalVMOptions – needed for some the below options
  3. G1NewSizePercent: These are the important ones. In CMS and other Generations, tweaking the New Generation results in FIXED SIZE New Gen and usually is done through explicit size setting with -Xmn.With G1, things are better! You now can specify percentages of an overall desired range for the new generation. With these settings, we tell G1 to not use its default 5% for new gen, and instead give it 40%!Minecraft has an extremely high a memory allocation rate, ranging to at least 800 Megabytes a second on a 30 player server! And this is mostly short lived objects (Block Position)

    Now, this means MC REALLY needs more focus on New Generation to be able to even support this allocation rate. If your new gen is too small, you will be running new gen collections 1-2+ times per second, which is really bad.You will have so many pauses that TPS has risk of suffering, and the server will not be able to keep up with the cost of GC’s.Then combine the fact that objects will now promote faster, resulting in your Old Gen growing faster. Given more NewGen, we are able to slow down the intervals of Young Gen collections, resulting in more time for short lived objects to die young and overall more efficient GC behavior.

  4. G1MixedGCLiveThresholdPercent: Controls when to include regions in Mixed GC’s in the Young GC collection, keeping Old Gen tidy without doing a normal Old Gen GC collection. When your memory is less than this percent, old gen won’t even be included in ‘mixed’ collections. Mixed are not as heavy as a full old collection, so having small incremental cleanups of old keeps memory usage light.
    Default is 65 to 85 depending on Java Version, we are setting to 90 to ensure we reclaim garbage in old gen as fast as possible to retain as much free regions as we can.My Old flag set had this at 35 which was a bug. I had the intent of this flag inverted, as I thought 35 was what 65 does. You should not be using 35 for this number.
  5. G1ReservePercent=20: MC Memory allocation rate in up to date versions is really insane. We run the risk of a dreaded “to-space exhaustion” not having enough memory free to move data around. This ensures more memory is waiting to be used for this operation. Default is 10, so we are giving another 10 to it.
  6. MaxTenuringThreshold=1: Minecraft has a really high allocation rate of memory. Of that memory, most is reclaimed in the eden generation. However transient data will overflow into survivor. Initially played with completely removing Survivor and had decent results, but does result in transient data making its way to Old which is not good.Max Tenuring 1 ensures that we do not promote transient data to old generation, but anything that survives 2 passes of Garbage Collection is just going to be assumed as longer-lived.
    Doing this greatly reduces pause times in Young Collections as copying data up to 15 times in Survivor space for a tenured object really takes a lot of time for actually old memory. Ideally the GC engine would track average age for objects instead and tenure out data faster, but that is not how it works.
    Considering average GC rate is 10s to the upwards of minutes per young collection, this does not result in any ‘garbage’ being promoted, and just delays longer lived memory to be collected in Mixed GC’s.
  7. SurvivorRatio=32: Because we drastically reduced MaxTenuringThreshold, we will be reducing use of survivor space drastically. This frees up more regions to be used by Eden instead.
  8. AlwaysPreTouch: AlwaysPreTouch gets the memory setup and reserved at process start ensuring it is contiguous, improving the efficiency of it more. This improves the operating systems memory access speed. Mandatory to use Transparent Huge Pages
  9. +DisableExplicitGC: Many plugins think they know how to control memory, and try to invoke garbage collection. Plugins that do this trigger a full garbage collection, triggering a massive lag spike. This flag disables plugins from trying to do this, protecting you from their bad code.
  10. MaxGCPauseMillis=200: This setting controls how much memory is used in between the Minimum and Maximum ranges specified for your New Generation. This is a “goal” for how long you want your server to pause for collections. 200 is aiming for at most loss of 4 ticks. This will result in a short TPS drop, however the server can make up for this drop instantly, meaning it will have no meaningful impact to your TPS. 200ms is lower than players can recognize.In testing, having this value constrained to an even lower number results in G1 not recollecting memory fast enough and potentially running out of old gen triggering a Full collection. Just because this number is 200 does not mean every collection will be 200. It means it can use up to 200 if it really needs it, and we need to let it do its job when there is memory to collect.
  11. +ParallelRefProcEnabled: Optimizes the GC process to use multiple threads for weak reference checking. Not sure why this isn’t default….
  12. G1RSetUpdatingPauseTimePercent=5: Default is 10% of time spent during pause updating Rsets, reduce this to 5% to make more of it concurrent to reduce pause durations.
  13. G1MixedGCCountTarget=4: Default is 8. Because we are aiming to collect slower, with less old gen usage, try to reclaim old gen memory faster to avoid running out of old.
  14. G1HeapRegionSize=8M+: Default is auto calculated. SUPER important for Minecraft, especially 1.15, as with low memory situations, the default calculation will in most times be too low. Any memory allocation half of this size (4MB) will be treated as “Humongous” and promote straight to old generation and is harder to free. If you allow java to use the default, you will be destroyed with a significant chunk of your memory getting treated as Humongous.
  15. +PerfDisableSharedMem: Causes GC to write to file system which can cause major latency if disk IO is high – See https://www.evanjones.ca/jvm-mmap-pause.html

Using Large Pages

Also for Large Pages – It’s even more important to use -Xms = -Xmx! Large Pages needs to have all of the memory specified for it or you could end up without the gains. This memory will not be used by the OS anyways, so use it.
Additionally use these flags (Metaspace is Java 8 Only, don’t use it for Java7):

Code:

-XX:+UseLargePagesInMetaspace

Transparent Huge Pages

Controversial Feature but may be usable if you can not configure your host for real HugeTLBFS. try adding -XX:+UseTransparentHugePages but it’s extremely important you also have AlwaysPreTouch set. Otherwise THP will likely hurt you. I have not measured how THP works for MC or its impact with AlwaysPreTouch, so this section is for the advanced users who want to experiement.

 

Credits:

Thanks to https://product.hubspot.com/blog/g1gc-fundamentals-lessons-from-taming-garbage-collection for helping reinforce my understanding of the flags and introduce improvements!


Changelog

  • 5/2/2020: Added +PerfDisableSharedMem, Adjusted MixedGCTarget to 4
  • 4/25/2020: Removed OmitStackTraces since it could cause performance issues with some plugins (but not everyone)
  • 4/5/2020: Massive refactor of the flag suggestions. Takes a new approach at optimizing pause times. Flags may still be changing. These changes are mandatory for MC 1.15
  • 10/4/2018: Removed AggressiveOpts and InitiatingHeapOccupancyPercent. Aggressive is removed in Java 11, and IHOP may hurt performance in Java 11. You should remove them for Java 8 too.
  • 8/18/2018: Adjusted MixedGCLiveThreshold to 35 (from 50) to ensure mixed GC’s start earlier.
    Added notes about recommended use of 10GB of memory.
    Added more flag documentation
  • 5/24/2018: Added -XX:+ParallelRefProcEnabled

 

0

Apache Macros – Simplify your config

Using Apache Macros

Many people host small time hobby websites or even websites for family members, friends and clients on a single server. This will lead to quite a lot of repetition for the same apache site definitions over and over again. Thankfully Apache Macros mod will solve many of these issues. This mod will let you create config templates, that can then be re-used over multiple sections of code, allowing you to pass in variables to fill in on use.

Lets get it installed!

sudo apt-get install libapache2-mod-macro
sudo a2enmod macro

Now, you can start using Macros in your site definitions, to replace common configurations.

» Official Documentation for Apache Macros

Examples of Apache Macros

In this you can see a pretty simple Domain macro. This will set the ServerName, and sets a www. alias. Now we look at the Site macro. In this example you will see it calling other macros for Log, GrantAccess and ForceDomain.

To use this, one could simply add inside of the <VirtualHost> this line:

Use Site mysite.com

And then accessing mysite.com would redirect to www.mysite.com, and log to /var/log/apache2/sites/mysite.com_access.log. Needless to say that likely cuts out 99% of the configuration you’re doing for a simple wordpress site you host for a relative.

And since the Apache Macros are parsed at config load, there’s no impact to your servers performance for using it!

For enterprise grade setups, you’re likely already using Puppet to get the same benefits and only running 1 product per server any-ways, but for those of us kicking it hobby level, Apache macros helps quits a bit! Enjoy 🙂

0

Filtering Spam before Forwarding Email with Postfix/SpamAssassin

One feature many cPanel/Shared Webhosts has is an option to forward your email to a different address. Very useful if you want to have multiple email addresses but check it all in one place (Gmail) like I do. But if you’re like me, you’ve likely migrated onto your own dedicated server you manage yourself, and its likely your making mistakes with email forwarding and filtering spam!

The problem is that that when you receive spam, you are also forwarding spam to your email provider, which makes them upset with you and tarnishes your servers IP address. I did this for years! I always thought that Gmail would be smart enough to see the path in the headers to realize it was forwarded – but then thinking about it – why would Gmail trust me that those servers actually sent the email and that I didn’t just spoof those Received: lines to blame someone else?

When I recently migrated my host, I put in a lot more effort into filtering the spam before it even hits Gmail, and learned quite a few things.

Filtering Spam with Postfix

First Off: Initial Connection Client Checks – These stop a majority of the spammers, and its so simple!
Add this line to your /etc/postfix/main.cf:

smtpd_client_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination reject_rbl_client zen.spamhaus.org reject_rbl_client bl.spamcop.net reject_rbl_client cbl.abuseat.org reject_unknown_client permit

This will enforce a lot of restrictions on the client, namely the Zen Spamhaus check, which knocks out so many spammer connections!

Filtering Spam with SpamAssassin

If you haven’t already installed SpamAssassin, do so now. There is a bit to this than I want to put into this post, so follow this sites guide: http://plecko.com.hr/?p=389

His instructions look spot on to me. Key thing I did not do on my setup and I just realized I needed to do: enable CRON=1! I’ve been running with stale SA Rules… But his guide covers it!

Next up is this page: http://wiki.apache.org/spamassassin/ImproveAccuracy

One thing it mentions is missing Perl Modules that SpamAssassin can try to use. For me, I had to run these commands to get them all installed.

sudo apt-get install libgeoip-dev
sudo cpan Geo::IP Mail::DKIM Encode::Detect DBI IO::Socket::IP Digest::SHA1 Net::Patricia

I don’t know what some of them are for, but SpamAssassin is obviously trying to use them, so give them to it!

Passing SPF Checks

Then there is SRS Rewriting. One problem with forwarding email is that it makes every one of your emails now fail SPF checks, because it looks like your server is sending mail for InsertBigNameDomain.com which does not authorize you to send mail on their behalf.

SPF is considered a “broken” implementation, and it is preferred that system admins use DKIM instead as a way to verify authenticity of an email, so ideally you need to rewrite the return path to be your own server name instead.

I used this guide: https://www.mind-it.info/forward-postfix-spf-srs/
Which summarizes down to

sudo apt-get install cmake sysv-rc-conf
cd /usr/local/src/
wget https://github.com/roehling/postsrsd/archive/master.zip
unzip master
cd postsrsd-master/
make
sudo make install
sudo postconf -e "sender_canonical_maps = tcp:127.0.0.1:10001"
sudo postconf -e "sender_canonical_classes = envelope_sender"
sudo postconf -e "recipient_canonical_maps = tcp:127.0.0.1:10002"
sudo postconf -e "recipient_canonical_classes = envelope_recipient"
sudo sysv-rc-conf postsrsd on
sudo service postsrsd restart
sudo service postfix reload

Now when you inspect a received emails header, you will see that the ReturnPath is now something like  <SRS0+9CLa=52=paypal.com=service@starlis.com>
And your SPF will now pass (You do have SPF records set right for your domain?)

Dropping the Spam

Now the final part… getting rid of that spam before it goes to Gmail!

In /etc/postfix/header_checks (you likely will need to create this file), add this simple line:

/^X-Spam-Level: \*{5,}.*/ DISCARD spam

then in /etc/postfix/main.cf:

header_checks = regexp:/etc/postfix/header_checks

This will drop the spam, but you may want to only drop higher level spam, so instead you could change the 5 to a 7, and then add to your /etc/spamassassin/local.cf (might already be there commented out):

rewrite_header Subject *****SPAM*****

This makes it so that any spam that doesn’t get dropped, has SPAM prepended to the header, which Gmail suggests you do if you do end up forwarding spam to Gmail.

With this approach, low score (5-6) spam will be forwarded but makes Gmail happy that you told them its spam ahead of time, and 7+ spam won’t even bother forwarding.

Taking these steps will help you maintain a good mail sending reputation (Hopefully I don’t have to repair mine too much…). Good luck 🙂

Final note for Gmail users

And one final step if you are using Gmail, ensure EVERY email address that you receive mail from that is forwarded to Gmail is added as a “Send Mail As” account. Gmail uses this list to know it is a forwarded address, and will be more lenient in spam rules. I don’t know if other ESP’s do this, but Gmail has requested you do this if you forward mail to them.

0

Ubuntu Live Streaming to Twitch.tv!

Good news for Linux users, the popular application for live streaming on Windows “Open Broadcasting Software” commonly known as OBS has been rewritten and now supports Linux. Ubuntu Live Streaming is now a thing with OBS.

First off, you will need a more up to date ffmpeg, found at the very common ppa:jon-severinsson/ffmpeg PPA.

sudo apt-add-repository ppa:jon-severinsson/ffmpeg
sudo apt-get update
sudo apt-get install ffmpeg

Then you will need the PPA provided by the OBS developer for almost daily updates:

sudo apt-add-repository ppa:btbn/obs-studio
sudo apt-get update
sudo apt-get install obs-studio

You will now have OBS installed.  Newest builds should have an Application Icon added for you, so find it under Audio/Video.

If your new to using this app – a quick run down of the terminology:

  • Scene: Configuration of multiple video/image sources to be output. You can have multiple scenes, such as 1 for left monitor, 1 for right monitor, 1 for ONLY a game, 1 for only a webcam, etc. You can switch between these while streaming to change what you are broadcasting.
  • Sources: Actual video and imagery sources. You add sources to a Scene such as your entire desktop or a single app, or your webcam, or a static image.

Play around with sources, each one should be obvious as to what it does, and build you a setup. When you add a source, you can resize and move it around the screen.

One issue I am having is that it does not work for my Webcam. Webcam works fine for other apps, so this has to be an issue with OBS, and another user also reports the problem.

To put my webcam into my stream, I opened up the Cheese application, then added a new Source that targets only that window, and crops off window parts and other non camera feed parts. I did have to invert Red/Blue.

Since its targeting a window and not the full desktop, you can safely minimize it and it works fine.

Now to stream to Twitch, you need to simply go to settings, go to the Streaming section, and put in your Stream key and select which server is closest to you.

Oh and one final detail (hopefully it hasn’t gotten you yet) The app likes to crash a lot when changing settings, so be sure to close the app after making a few changes to make it save them incase it crashes. I haven’t had any mid-stream crash issues though.

Good luck!

2

NVIDIA SLI + Triple Display on Ubuntu 14.04!

For many months I’ve had a 3rd monitor on my desk, but could not use it as I could not get it to work. Any time I enabled the monitor using Xinerama, the desktop would freeze on login.

I’ve now learned about how the whole XOrg and Nvidia Settings system works.

The trick is that many of the display settings for the nvidia driver are no longer relevant to Xorg.conf, and are now actually in a file in your home directory called .nvidia-settings-rc.

If you are having problems try wiping this file out, and also wipe out your /etc/X11/xorg.conf

Then, if you have SLI cards, issue sudo nvidia-config –sli=on

If you have a single card but MultiGPU, issue sudo nvidia-config –multigpu=on

If you have a SLI MultiGPU card (4+ GPU) then you only need sli, as Xorg.conf told me that multigpu was not necessary at that point.

I’m using the latest Ubuntu 14.04 nvidia-331-updates-uvm driver, which is running more stable than the nvidia-343-uvm from xorg-edgers ppa, so I do not recommend updating to 343.

Once you reboot, run the nvidia settings and ensure Base Mosaic is enabled, and enable all of your monitors in the order you want, and click the Save to X Config button.

But one detail I did not know that caused me so many issues in the past – that all of the OTHER nvidia settings has to be saved separately to that nvidia-settings-rc file.

This file should be saved automatically on close of the settings app, but to be sure go to the nvidia-settings Configuration panel and hit the save button, and simply select your home folder that it opens up to.

Now one important note, when you hit the Save to X button, its going to wipe out your SLI/MultiGPU option! So you need to go back and re-run sudo nvidia-config –sli=on or –multigpu=on to reset that setting.

Now you should be good to restart and have your working setup! I was able to get over 400 FPS in Minecraft (which given its simplicity of graphics, it is a Java game and not the best for performance).

I now have 2 more monitors on the way for Wednesday so I can be close to that “Geek Dream” of a 6+ monitor setup (I’ll be at 5 for now), but hoping to not have any issues with them.

Good luck 🙂

2

Apache 2.4, PHP 5.5 with php-fpm and mod_rewrite

This guide was updated on April 28, 2016 with some missed details!
– Added timeout and flush params to the External Server command, and added missing -socket
– Added missing apache modules actions and alias

So recently I’ve had trouble with the host I had been using for years (bad support, billing broke, DDOS Attacks on their other customers constantly affecting me), so I decided to move my web infrastructure to the same datacenter I run all of our game servers out of, HiVelocity. I decided to fully build this server out fresh instead of trying to clone the old one, and do things better this time around.

First I had recently done research into the performance impact of using Apache MPM-Prefork with mod_php, in that every Apache process has PHP loaded, so even static requests have PHP loaded – eating lots of resources!

I had heard about FastCGI as I had it when I used shared hosting back in the days with SuExec, but now I found something better: PHP-FPM – A special FastCGI based pool that is designed for PHP itself.

Win! so I set up Ubuntu 14.04.1 LTS, Apache 2.4 and went with the newer MPM Event module, which appears to do even better with Keep Alive requests.

So lets get Apache 2.4 with MPM-Event, PHP5 FPM and some PHP5 Modules going:

sudo apt-get install apache2-mpm-event libapache2-mod-fastcgi php5-fpm php5-cli php5-apcu php5-sqlite php5-gd php5-json php5-curl php5-mcrypt php5-mysqlnd php5-redis

By default it should be configured to use sockets, but if not, check in /etc/php5/fpm/pool.d/www.conf for:

listen = /var/run/php5-fpm.sock

And change it if its using a TCP port instead. Unix Sockets are faster as it avoids the TCP protocol.

Next up add /etc/apache2/conf-available/php5-fpm.conf and paste this in:

<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization -idle-timeout 900 -flush
<Directory /usr/lib/cgi-bin>
Require all granted
Require env REDIRECT_STATUS
</Directory>
</IfModule>

Now to enable these things! You need Actions, Alias, FastCgI and Rewrite modules for Apache.

sudo a2enconf php5-fpm
sudo a2enmod actions alias fastcgi rewrite

now here is the part that caused me so much trouble for an entire week! If you want to have mod_rewrite work, you need to edit /etc/apache2/apache2.conf and find the <Directory /var/www/> stanza

By default this has AllowOverride None, and you need to change that to AllowOverride FileInfo

Without this, rewrite rules will not work.

Following this, you should pretty much be set up with a working PHP5-FPM, with mod_rewrite on Apache MPM Event, and have Apache use a lot less resources in general.

I’m sorry if anything in this is off – I went through so many things trying to get everything working, but this is to the best of my knowledge what the final results were.

Please submit any corrections!

0

Ubuntu System Freeze on X58 Motherboard – Solved!

I wrote in another article on how I was having some system instability issues, where the CPU would stall, and everything stopped, no SSH, no TTY, no REISUB, dead!

BIOS updates did not help, changing hardware settings did not help, and I was about ready to sell this PC…

But I found the problem finally!

In the X58 Motherboard, at least this Classified 3, Intel Turbo is on and CxE function is off by default.

Turning Turbo off and CxE to C6 has solved my issue. It appears Turbo is trying to overclock the CPU, and the voltage shortage is freezing things up. Why a default setting can result in such a level of instability is beyond me… but these 2 settings has 100% been the solution to my issue. No more hard shutdowns!

I hope this helps someone else!

0

The quest for triple head on Ubuntu with SLI GPU

I recently purchased a system from my friend to upgrade my old system, as I really wanted 3 monitors…

So, I might of bought a “Gibson” (No, not the guitar, if your on my blog you should get the reference!), but sadly I had tons of trouble getting the 3rd monitor to work under Ubuntu 13.10!

Enabling Xinerama in older nvidia drivers caused the system to hard freeze immediately on login.
Installing nvidia-331 from a third party PPA gave an option for “Base Mosaic”, but same issue….

However, I have been having extremely annoying problems with the system CPU freezing every so often having to hard restart… Ruled out hardware issue, works fine in Windows, but over 2 different 13.10 installs (one was a constant upgrade from 10.04, other was fresh to resolve many other issues I had), the problem was very consistent.

So, it was obviously an ubuntu specific problem. Well, one idea was to try installing 12.04, so I did that last night. Went to install nvidia driver (as I couldn’t even properly boot into the system with these SLI 590 GPU’s) and noticed a new driver on the list… nvidia-331-uvm.

Apparently this is some newer tech from nvidia for improving performance, but either it being uvm or 12.04, Base Mosiac now works.

So, if you are having problems with multi GPU (I have 4 GPU’s with these SLI cards), try 12.04 (or 14.04 when it is out) with nvidia-331-uvm or higher!

Now… here’s hoping 12.04 also fixes my lockup issue!

3

Ubuntu – Could not calculate upgrade 13.10

Just wanted to share some information I found. Many may face this daunting error “Could not calculate upgrade”, and will find post telling them to type

 

“grep Broken /var/log/dist-upgrade/apt.log”

 

Well, I had a ton of broken packages, but I noticed all of them mentioned ~ricotz0

 

Broken brasero:amd64 Depends on libgtk-3-0 [ amd64 ] < 3.8.1+git20130422.0ce7854a-0ubuntu1~12.10~ricotz0 -> 3.8.6-0ubuntu2 > ( libs ) (>= 3.0.0)
Broken brasero:amd64 Depends on libnautilus-extension1a [ amd64 ] < 1:3.6.3-0ubuntu16 -> 1:3.8.2-0ubuntu2 > ( libs ) (>= 1:2.91)
Broken brasero:amd64 Depends on gnome-icon-theme [ amd64 ] < 3.7.3+git20121224.2af6b37d-0ubuntu1~12.10~ricotz0 -> 3.8.3-0ubuntu3 > ( gnome )
Broken libgtk-3-0:amd64 Depends on libgtk-3-common [ amd64 ] < 3.8.1+git20130422.0ce7854a-0ubuntu1~12.10~ricotz0 -> 3.8.6-0ubuntu2 > ( misc ) (= 3.8.1+git20130422.0ce7854a-0ubuntu1~12.10~ricotz0)
Broken libgtk-3-0:amd64 Depends on libwayland0 [ amd64 ] < 1.0.5-0ubuntu1 > ( libs ) (>= 1.0.2)

 

I recognized that to be a PPA I once had, the gnome testing… but I don’t have it right now! So I had no ppa to purge.

However, simply adding it then ppa-purging it removed the PPA and downgraded all of the packages.

This will help resolve the issue for most people exeriencing this problem (I happened to still have problems, but eventually something got it to work).

Hope this helps.

0

2 Way local folder synchronization with lsyncd

So I have a use case scenario at work where 2 way folder synchronization is of use for me. I tried using rsync but its not designed for 2 way.
Then some lovely people in #rsync on Freenode told me of some other tools, namely unison and lsyncd.

Unison does a good job of syncing between 2 dirs, and would solve the problem just fine, but it requires running the tool to do the sync process.

Ideally, I wanted something that would sync immediately on file change, which is exactly what lsyncd does.

However, it’s based on 1 way sync, but due to how it performs it doesn’t have deletion problems like my first attempts at rsync did.

So to provide 2 way with lsyncd, you simply run the tool twice, 1 for each direction.

I’ve wrote a quick bash script that can auto start the sync process for you, designed to be ran as a cronjob to ensure the daemons are running.

Create the file

~/bin/syncdirs

and paste the following in it

#!/usr/bin/env bash
#########################
## syncdirs
##
## syncs 2 directories with 2 directional sync using lsyncd
## apt-get install lsyncd
##
## written by aikar@aikar.co
## http://aikar.co/2011/03/07/2-local-folder-synchronization-lsyncd
##
#########################

sync="lsyncd --delay 0"
if [ $# == 2 ]; then
    if [ -d $1 ] && [ -d $2 ]; then
        d1="$(readlink -f $1)"
        d2="$(readlink -f $2)"
        
        sync1="$sync $d1 $d2"
        sync2="$sync $d2 $d1"
        
        found=0
        ps ax | grep -v grep | grep -q "$sync1" 
        if [ $? != 0 ]; then 
            $sync1
            found=1
        fi
        ps ax | grep -v grep | grep -q "$sync2"
        if [ $? != 0 ]; then 
            $sync2 
            found=1
        fi
        if [ $found == 1 ]; then
            echo "syncing $d1 and $d2"
        else
            echo "was already syncing"
        fi
    else
        echo "syncdirs: ERROR!"
        if [ ! -d $1 ]; then
            echo "$1 is not a directory"
        fi
        if [ ! -d $2 ]; then
            echo "$2 is not a directory"
        fi
    fi
else
    echo "syncdirs usage:"
    echo "syncdirs directory1 directory2"
fi

and then

chmod +x ~/bin/syncdirs

then if you have ~/bin in $PATH, type

syncdirs /path/to/sync /path/to/sync/with

and you should be told the dirs are now syncing.

to add ~/bin to PATH if not already done, edit ~/.bashrc and add

export PATH="$HOME/bin:$PATH"

Now to ensure they are always syncing, type

crontab -e

and add to bottom

* * * * * ~/bin/syncdirs /path/to/sync /path/to/sync/with >/dev/null

Now you should have the sync daemons auto start by cron on system start, and auto relaunch them if they die for any reason.
Disclaimer: I take no responsibility for what this tool does nor my starter script does to your files. (I didn’t even make lsyncd!)
make sure you have backups of your files before running these tools on them!!!

0

I am Senior Software Engineer and Entrepeneur. I am an enthusiast and love creating things. I operate my own side company in my free time called Starlis LLC, working in Minecraft.

I enjoy doing things right and learning modern technologies.