Fooling around with pkgadd (Solaris packages)

I basically had a Solaris SVR4 package that I needed to install. I didn’t care if the package worked or not after it installed. This is what happened when it first failed.

pkgadd: ERROR: checkinstall script did not complete successfully

The installer said that I was missing a package, so I went into the pkgname/install/checkinstall script and just commented those lines out. After doing that, this happened.

root@alton-solaris:/tmp# pkgadd -d .
The following packages are available:
1 pkgname pkgname
(i386) version
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:
Processing package instance from
pkgname(i386) version
company
Executing checkinstall script.
OS Release = 11.4
Processing package information.
Processing system information.
pkgadd: ERROR: packaging file is corrupt
file cksum <26912> expected <26914> actual
Installation of failed (internal error).
No changes were made to the system.

Obviously, there’s some sort of check for integrity of the file. To get around that, I went in and edited the pkgname/pkgmap file to make the changes from 26912 to 26914.

After doing this, the package magically installed. Fun!

Changing root password on Solaris 11.3 x86

I’m posting this only because the process has changed a bit since I did it back in the days. Because I’m not using Solaris on SPARC, there’s no STOP-A, boot -s, etc.

Just like back in the days with Solaris 8, you would need to boot with a cdrom or PXE or jumpstart, whatever method you have. Afterwards, you take the shell option. Obviously, you’re not installing the OS.

Solaris 11 uses ZFS, not UFS so you can’t directly mount a partition. You need import a pool instead.

mkdir /b
zpool import -f -R /a rpool
zfs set mountpoint=legacy rpool/ROOT/solaris
mount -F zfs rpool/ROOT/solaris /b
vi /b/etc/shadow

Edit the shadow file

Find your username and remove the password hash

Change your user id
username:whateverthehashis:12345::::::23456
to
username::12345::::::23456

Then we will need to allow empty passwords at login

$ vi /b/etc/default/login
Change the line:
PASSREQ=YES
to
PASSREQ=NO

umount /b
zfs set mountpoint=/ rpool/ROOT/solaris
zpool export rpool
init 6

When the system boots, you should be able to log in as root and just press return for the password. If you’re logging in through SSH, you won’t need to enter a password.

Hope this saved you some time!

Install .NET 2.0 in Windows 10

What!? Why would you want to do that!? A friend of mine recently brought a computer to me for him to install some old software on. This happened to be some custom software that was written and required .NET 2.0. I tried installing the software and it wouldn’t install because it .NET 2.0 was required and if you go to Microsoft’s website, it looks like the only version you could get is .NET 4.8 and it already came with the OS that his laptop came with! What gives!?

I managed to find this command only that allowed me to continue the install:

DISM /Online /NoRestart /Enable-Feature:NetFx3

Turns out there are tons of YouTube videos and other posts about how to install it. I just didn’t think to look. You could actually just go to the control panel and install it from there as well.

image

Anyway, hope this post can save you some time!

FATAL: invalid value for parameter “TimeZone”: “America/Los_Angeles” with DBeaver

I got that message when trying to use DBeaver to connect to a PostgreSQL DB.

FATAL: invalid value for parameter "TimeZone": "America/Los_Angeles"

I found the fix here. The first thing to check is the timezone you have set on the Postgres db itself. You can do this by running “SELECT * FROM pg_timezone_names;”.

Here’s an example:

avenger_agent_prod=# SELECT * FROM pg_timezone_names;
name | abbrev | utc_offset | is_dst
------+--------+------------+--------
UTC | UTC | 00:00:00 | f
(1 row)

The fix is to make a small change the dbeaver.ini file in DBeaver root directory. If you installed this on a Mac, the file is in /Applications/DBeaver.app/Contents/Eclipse/

Just add:

-Duser.timezone=UTC
-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.551.v20171108-1834
-showsplash
# START: change jre version, not using the one in %JAVA_HOME%
-vm 
D:\ArPortable\Java\jdk1.8.0_171\jre\bin\server\jvm.dll
# END
# JVM settings
-vmargs
-XX:+IgnoreUnrecognizedVMOptions
--add-modules=ALL-SYSTEM
-Xms64m
-Xmx1024m
# time zone
-Duser.timezone=UTC
# language
-Duser.language=en

When you restart DBeaver, it should connect.

Don’t buy/give gift cards! Store bought Visa gift cards are unsafe!

Unless someone really wants a gift card like the ones in the photo, I would not recommend it! They’re unsafe and prone to hacking. I’ve been burnt twice now for over $600 with no recourse. I bought these because I wanted to pay off some bills with American Express. Because those providers didn’t take AMEX, I bought Visas to do it with. I left the cards sealed and unopened in my drawer figuring that I would just use them later.

The first time I ran into an issue was when I logged into the website and saw that my $500 gift card had only $2 on it! Turned out that somehow, it was used at Gamestop for $497.xx. I had no idea how that could’ve happened! The card was in my drawer and I had just opened it! I emailed the company to file a dispute and I got this response:

  
CONTENT SOLUTIONS COMPANY
Communication Update    Subject: charge dispute  Hello,   Our team is currently working on your Case CS2767575 and has the below update. Thank you for your patience with this matter.   Comments:
Hello,

As stated in your Account Agreement, account discrepancies are to be communicated to us no later than 60 calendar days after the transaction history was first made available to you. Unfortunately, we did not receive your inquiry within this time limit. We have no recourse to recoup these funds for you.

Therefore, we are unable to credit your account, thus closing this dispute. Although we are not able to assist you further, we urge you to pursue this matter directly with the merchant.

We appreciate your business and value you as a customer. If you have any questions about this matter, please contact our Customer Service Department at the number or website address listed on the back of your card. This inbox is used strictly to receive documentation, or information requested related to the disputes processes. We are unable to provide account or disputes updates and apologize for any inconvenience this may cause.

Thank you,
Customer Dispute Services
   Case Status Tracker (Resolved)    What Next? Our customer service team will reach out to you shortly regarding your issue.     Any Questions?   Click here to reply.                                                                      
 

Sure, I let the card sit in my drawer for a long time, but the card hadn’t expired. How did it get used!?

My best guess as to how the card got used: Their website sucks. Now, it has a little stupid check to see if you’re human – shows you a picture of a toy that you need to rotate and when you finally get it, you could check your cards – register the card to use online, check balance, etc. I think maybe the theft happened prior to this security measure was put in place. Maybe it wasn’t. Anyway, I think someone had a script that generated numbers against their website for CVV matches and return the gift card values.

I was unlucky. Hope you’re not next. If you must buy gift cards, definitely have a plan on using them. If someone gave you one, try to use it asap. Some ideas on how to use them – obviously, it’s best to get cash for them if possible. It’s possible, but not easy. I’ve traveled to different places where Walmart cashiers are oblivious and would sell money orders for them. Most Walmarts will not. I’ve also loaded a bluebird card with one as well. Unfortunately, none around me will do it. I think it’s just how lucky you are. The way I use the cards is by doing my regular spend and all of my bills. T-Mobile takes them, I’ve used them for my water bills and energy bills as well. It’s great that I could use them to the penny.

Hope this helps!

By the way, if you’ve been screwed like me and think this is worthy of a class action lawsuit, please let me know and I would love to join.

How to test open ports w/o telnet or nc

Found this out of necessity when a security team didn’t allow the installation of either telnet or nc. I initially thought ssh would work, but it doesn’t really work.

The command is simple. Just do this:

/dev/tcp/<host>/<port>

Replace the <host> and <port>. Here’s how it would look if successful:

SV-LT-1361:~ altonyu$ > /dev/tcp/192.168.0.11/2049
SV-LT-1361:~ altonyu$ echo $?
0

Here’s how it would look if unsuccessful:

SV-LT-1361:~ altonyu$ > /dev/tcp/192.168.0.11/2047
-bash: connect: Connection refused
-bash: /dev/tcp/192.168.0.11/2047: Connection refused
SV-LT-1361:~ altonyu$ echo $?
1

Obviously if the command hangs, it probably means it won’t work either.

Hope this helps someone!

Use update-ca-trust! Or update-ca-certificates.

Don’t just append the /etc/ssl/certs/ca-certificates.crt or the /etc/ssl/certs/ca-bundle.crt.

Not long ago, I thought that it didn’t matter. I figured since the update-ca-trust command just updated the bundle, I might as well skip a step and go directly. I was wrong. Don’t do it. I guess that’s why people actually have processes and directions to follow.

The files are not meant to be edited manually. They are generated by the update-ca-trust or update-ca-certificates commands, which scan the /etc/pki/ca-trust/source/anchors or /usr/local/share/ca-certificates directories for custom CAs, and then concatenate them with the system CAs into a single file. If you edit these files directly, your changes will be overwritten the next time these commands are run. This could mean that your changes would not survive a patching if the ca-certificates package is updated.

The reason why you want to put the certificate issuers in /etc/pki/ca-trust/source/anchors/ or /etc/ssl/certs/ and use the update-ca-trust enable/extract commands is so that it can survive an update. If someone decides to patch the machine and there are other certificates being updated, the one that you appended to the bundle will get deleted.

Follow the process! For me, that’s basically:

1. Copy your custom CA file (in PEM format) to the /etc/pki/ca-trust/source/anchors directory on Red Hat-based systems, or the /usr/local/share/ca-certificates directory on Debian-based systems. Make sure the file has a .crt extension.
2. Run the update-ca-trust or update-ca-certificates command as root. This will regenerate the /etc/ssl/certs/ca-certificates.crt or the /etc/ssl/certs/ca-bundle.crt file with your custom CA included.
3. Restart any services or applications that use SSL/TLS connections, such as web servers, browsers, curl, etc. They should now trust your custom CA.

Make your own pizza at home! It’s fun, easy, and delicious!

I thought about it a little bit, but not a lot. A friend of mine that used to work at a pizza place told me that your home oven is just not hot enough. That’s not exactly true. I started to do it only because a different friend of mine did it first. He made it and his pizza to me, tasted like pizza that you would get in an elementary school cafeteria. Well, I thought maybe I could do better. Since we are in a lock-down anyway, I thought I would give it a shot. I’m very glad that I did. It’s very easy and well worth it.

I watched a bunch of YouTube videos and since I have a cast iron pan and no pizza stone, I started with that. My pizza dough has about 50% hydration by volume, but much more by weight.

The dough recipe is as follows:
1 cup bread flour
1/2 cup water
1/4 teaspoon yeast
1 teaspoon sugar
1/4 teaspoon salt

I just take a spoon or fork or spatula or chopstick or whatever I have close by and mix it. Mix it until it comes together and you see no more water and you can either knead it or just leave it. Then you let it sit for 2 hours at room temperature or overnight in the refrigerator. If you’re in a hurry, you can proof it in the oven by turning the oven on to the lowest temperature possible (mine is 150F) and then opening the door. Leave the door open for a couple of minutes so that the temperature comes down to under 100F. Then, quickly setting it next to a cup of boiling hot water and shutting the door. (Don’t let the water touch the dough.) When the dough doubles in size, it’s ready to be stretched out and go into the pan. I’ll salt and put some Italian seasoning on the pan just prior to putting the dough into the pan because I want to get some flavor on the bottom of the pizza. If you’re lazy like me, you can just drop the ball into the pan and stretch/flatten it out there. If the dough pulls back too much, just leave it and let it sit for about 5 minutes and try again.

I don’t have any portion sizing for the sauce/toppings. All I can say is don’t put too much. From one of the YouTube videos I watched, the guy says, if it feels like it’s just short, it’s probably perfect.

I’ve used this recipe for my sauce:
8 tomatoes
5-6 basil leaves
garlic salt/pepper
a couple of garlic cloves
a little bit of Parmesan cheese

Then you can basically just cook the sauce out until it’s reduced to very little water. I might’ve put too much Parmesan – the sauce came out orange, but tasted fine. I cooked it along with the mushrooms also so that the mushrooms wouldn’t release too much water into the pizza.

In the picture, I’m using store bought Classico pizza sauce. Just take a ladle of store bought pizza sauce or the sauce you made and spoon it around the dough on the pan. When you feel like you’re just short, it’s probably enough. Don’t put too much or the dough will stay wet. If you would prefer the dough to be dry, you can put a layer of cheese down on top of the dough first. You might get a wetter pizza though. Then just lay the toppings on. I don’t buy shredded cheese, ever. I’m not a fan of the anti-caking agents that they come with and it also goes bad very quickly. I prefer to buy blocks of my own cheese and grate or slice or cut it myself. In the picture, I’ve sliced my cheese thinly and layered on top and the bottom. I mix mozzarella and parmesan. You can see raw mushrooms in the picture, but I won’t put raw mushrooms on a picture anymore. I’ll just par-cooked if not cooked because mushrooms release too much water. I would recommend cooking any vegetables prior to putting them onto the pizza just to release the water.

When you’re done topping the pizza, fire up the stove onto medium high heat and let it cook for about 5 minutes or so. Then put it into the broiler at low heat for about 5 minutes or until golden brown. I then go and check the bottom of the pizza with the spatula and adjust the heat until I see the desired color. For me, it’s golden brown.

This is what the pizza looked like before baking.
This is what the pizza looked like after baking.

Enjoy your pizza! I’d love any feedback! Questions or comments welcome.

On the opposite sex …

Some interesting paraphrased quotes on the opposite sex from Chinese films.

“Men will treat you well because you have value. As that value diminishes, you’ll see they’ll stop.” -paraphrased from The Enchanting Phantom

“Women all know how to trick people (men). The prettier they are, the better they are at it.” -paraphrased from Heavenly Sword, Dragon Saber.

张馨予 Zhang Xinyu (Viann) as 康敏 Kang Min in The Demi-Gods and Semi-Devils 天龙八部. I normally root for the bad guys in the movies, but in this drama, this woman is pure evil, but so gorgeous. I get so excited to see her on screen, but I’m afraid to see what she does to people!
True! At least there’s no way I can!

How to clear the filesystem buffer cache in Linux

You would probably want to do this if you’re suspecting that there’s an issue where you’re falling short on memory, diagnosing performance issues, etc. It’s much faster than a reboot and if it solves your problem, you’ll know what to do in the future. It’s not likely that you’ll need to do this. Just good to know how.

If you’re interested in more information regarding your memory, you can go look at: https://www.linuxatemyram.com/

Taken from: https://stackoverflow.com/questions/29870068/what-are-pagecache-dentries-inodes

With some oversimplification, let me try to explain in what appears to be the context of your question because there are multiple answers.

It appears you are working with memory caching of directory structures. An inode in your context is a data structure that represents a file. A dentries is a data structure that represents a directory. These structures could be used to build a memory cache that represents the file structure on a disk. To get a directly listing, the OS could go to the dentries–if the directory is there–list its contents (a series of inodes). If not there, go to the disk and read it into memory so that it can be used again.

The page cache could contain any memory mappings to blocks on disk. That could conceivably be buffered I/O, memory mapped files, paged areas of executables–anything that the OS could hold in memory from a file.

The commands flush these buffers.

Every Linux System has three options to clear cache without interrupting any processes or services.

  1. Clear PageCache only.
    • # sync; echo 1 > /proc/sys/vm/drop_caches
  2. Clear dentries and inodes.
    • # sync; echo 2 > /proc/sys/vm/drop_caches
  3. Clear PageCache, dentries and inodes.
    • # sync; echo 3 > /proc/sys/vm/drop_caches

Explanation of above commands. sync will flush the file system buffer. Commands separated by “;” run sequentially. The shell wait for each command to terminate before executing the next command in the sequence. As mentioned in kernel documentation, writing to drop_cache will clean cache without killing any application/service, command echo is doing the job of writing to file. If you have to clear the disk cache, the first command is safest in enterprise and production as “…echo 1 > ….” will clear the PageCache only. It is not recommended to use third option above “…echo 3 >” in production until you know what you are doing, as it will clear PageCache, dentries and inodes. Is it a good idea to free Buffer and Cache in Linux that might be used by Linux Kernel? When you are applying various settings and want to check, if it is actually implemented specially on I/O-extensive benchmark, then you may need to clear buffer cache. You can drop cache as explained above without rebooting the System i.e., no downtime required. Linux is designed in such a way that it looks into disk cache before looking onto the disk. If it finds the resource in the cache, then the request doesn’t reach the disk. If we clean the cache, the disk cache will be less useful as the OS will look for the resource on the disk. Moreover it will also slow the system for a few seconds while the cache is cleaned and every resource required by OS is loaded again in the disk-cache. Now we will be creating a shell script to auto clear RAM cache daily at 2am via a cron scheduler task. Create a shell script clearcache.sh and add the following lines. #!/bin/bash # Note, we are using “echo 3”, but it is not recommended in production instead use “echo 1” echo “echo 3 > /proc/sys/vm/drop_caches” Set execute permission on the clearcache.sh file. # chmod 755 clearcache.sh Now you may call the script whenever you required to clear ram cache. Now set a cron to clear RAM cache everyday at 2am. Open crontab for editing. # crontab -e Append the below line, save and exit to run it at 2am daily. 0 2 * * * /path/to/clearcache.sh For more details on how to cron a job you may like to check our article on 11 Cron Scheduling Jobs. Is it good idea to auto clear RAM cache on production server? No! it is not. Think of a situation when you have scheduled the script to clear ram cache everyday at 2am. Everyday at 2am the script is executed and it flushes your RAM cache. One day for whatsoever reason, may be more than expected users are online on your website and seeking resource from your server. At the same time scheduled script run and clears everything in cache. Now all the user are fetching data from disk. It will result in server crash and corrupt the database. So clear ram-cache only when required,and known your foot steps, else you are a Cargo Cult System Administrator. How to Clear Swap Space in Linux? If you want to clear Swap space, you may like to run the below command. # swapoff -a && swapon -a Also you may add above command to a cron script above, after understanding all the associated risk. Now we will be combining both above commands into one single command to make a proper script to clear RAM Cache and Swap Space. # echo 3 > /proc/sys/vm/drop_caches && swapoff -a && swapon -a && printf ‘\n%s\n’ ‘Ram-cache and Swap Cleared’ OR $ su -c “echo 3 >’/proc/sys/vm/drop_caches’ && swapoff -a && swapon -a && printf ‘\n%s\n’ ‘Ram-cache and Swap Cleared'” root After testing both above command, we will run command “free -h” before and after running the script and will check cache. Clear RAM Cache and Swap Space That’s all for now, if you liked the article, don’t forget to provide us with your valuable feedback in the comments to let us know, what you think is it a good idea to clear ram cache and buffer in production and Enterprise? Sharing is Caring…