Azure Ubuntu 15.04 virtual machine can't change date/time - date

I'm ruining an Ubuntu 15.04 OS on Azure Virtual Machine. I can't manually change the date of the system by using the "date" command. Here's a sample run:
~# date
Tue Jul 7 00:24:58 HKT 2015
~# date -s "2014-07-04 10:53:59"
Fri Jul 4 10:53:59 HKT 2014
~# date
Tue Jul 7 00:25:01 HKT 2015
I have uninstalled ntpdate but it doesn't make a difference. Has anyone experienced this before?
Thanks!

Generally speaking you can't change the time of a VM which is hosted by an external provider, because the cost of providing an emulated clock is too high and thus it tends to pick up the clock time of the host machine instead.

Related

How does openfaas solve the time zone problem of the container in the pod?

I am currently deploying openfaas on my local virtual machine's kubernetes cluster. I found that the time zone of the container started after publishing the function is inconsistent with the host machine. How should I solve this problem?
[root#k8s-node-1 ~]# date
# Host time
2021年 06月 09日 星期三 11:24:40 CST
[root#k8s-node-1 ~]# docker exec -it 5410c0b41f7a date
# Container time
Wed Jun 9 03:24:40 UTC 2021
As #coderanger pointed out in the comments section, the timezone difference is not related to OpenFaaS.
It depends on the image you are using, most of the images use UTC timezone.
Normally this shouldn't be a problem, but in some special cases you may want to change this timezone.
As described in this article, you can use the TZ environment variable to set the timezone of a container (there are also other ways to change the timezone).
If you have your own Dockerfile, you can use the ENV instruction to set this variable:
NOTE: The tzdata package has to be installed in the container for setting the TZ variable.
$ cat Dockerfile
FROM nginx:latest
RUN apt-get install -y tzdata
ENV TZ="Europe/Warsaw"
$ docker build -t mattjcontainerregistry/web-app-1 .
$ docker push mattjcontainerregistry/web-app-1
$ kubectl run time-test --image=mattjcontainerregistry/web-app-1
pod/time-test created
$ kubectl exec -it time-test -- bash
root#time-test:/# date
Wed Jun 9 17:22:03 CEST 2021
root#time-test:/# echo $TZ
Europe/Warsaw

sqlplus not responding after enter password

SQLPLUS is not responding after entering the user name and password.
[root#ns3369978 ~]# su oracle
bash-4.1$ sqlplus
SQL*Plus: Release 12.2.0.1.0 Production on Fri Dec 27 07:52:53 2019
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Enter user-name: xxxx
Enter password:
After entering the password, it is neither connecting nor showing any error. Even I am not able to come out of this. OS is CentOS release 6.9 (Final) on my server. How to find and resolve the issue?
I have searched and found one solution. By using the below command I am able to connect oracle.
sqlplus -prelim "system/123lkls as sysdba"

How to install tun on Ubuntu 16.04

I try to install tun on Ubuntu 16.04, it generates the tun.ko, but it still doesn't work.
1
Uname -a Linux host-name 4.10.0-42-generic #46~16.04.1-Ubuntu SMP Mon
Dec 4 15:57:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
2
apt-get install linux-source-4.10.0
3
cd /usr/src/linux-source-4.10.0 menuconfig->Device Drivers->Network
Device Support->Universal TUN/TAP device driver support
Then save it as tun.config.
4
make modules, it generate tun.ko under /drivers/net/ without err, then
copy it to lib/modules/4.10.0-42-generic/kernel/net/tun.ko.
And it still doesn't work. The command "modinfo tun" doesn't output anything.
Any advice about the install tun on Ubuntu 16.04?
You're probably on a VPS so you'll need to change this on your host settings.
Login to your VPS control panel using your username and password.
Click the ‘Manage’ button to the right of the VPS in which you want
to enable tun/tap
Under Controls -> Settings tab, click on ‘Enable TUN/TAP’
A dialog box appears asking for confirmation, hit yes
Source: https://www.copahost.com/blog/openvpn-in-ubuntu-tun-tap/
I had this problem myself and just fixed it by doing exactly this.

CentOS VPS show time same as in India though situated in US

If right now VPS situated in US shows time "Mon Sep 25 20:23:56 UTC 2017",
my local machine in India show time "Mon Sep 25 20:25:36 UTC+5:30 2017"(appx 2 minutes early on VPS).
My problem is When I save date to mongodb remote it save as "createdAt" : ISODate("2017-09-25T20:23:56.461Z") and when I see website on my local machine the time shows Tue Sep 26 01:33 UTC 2017. I seriously don't understand what is wrong??
why UTC+5:30 on my local machine? and how come the VPS server time is same as Indian Standard time?
Check the system time with date command.
All the servers should sync time with NTP server to avoid this kind of issues.
yum install ntp
chkconfig ntpd on
ntpdate pool.ntp.org // You can use ur own NTP server
service ntpd start

Problems to run examples in Meteor

I'm testing Meteor examples and this is what I see when I run meteor in todos examples:
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Can't start mongod. Check for other processes listening on port 3002 or other meteors running in the same project.
And this is what happens if I run mongod in the command line:
Thu Apr 12 19:27:39 Mongo DB : starting : pid = 2686 port = 27017 dbpath = /data/db/ master = 0 slave = 0 32-bit
** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
** see http://blog.mongodb.org/post/137788967/32-bit-limitations for more
Thu Apr 12 19:27:39 db version v1.4.4, pdfile version 4.5
Thu Apr 12 19:27:39 git version: nogitversion
Thu Apr 12 19:27:39 sys info: Linux murphy 2.6.32.14-dsa-ia32 #1 SMP Thu May 27 16:19:20 CEST 2010 i686 BOOST_LIB_VERSION=1_42
Thu Apr 12 19:27:39 waiting for connections on port 27017
Thu Apr 12 19:27:39 listen(): bind() failed errno:98 Address already in use for port: 27017
Thu Apr 12 19:27:39 MiniWebServer: bind() failed port:28017 errno:98 Address already in use
Thu Apr 12 19:27:39 addr already in use
Thu Apr 12 19:27:39 warning: web admin interface failed to initialize on port 28017
Someone helps? Thanks!
I had the same problem. Fixed with:
WARNING: This erases your local database:
meteor reset
I had the same problem. Just remove .meteor/local/db/mongod.lock in your meteor project folder. And meteor should run normally.
Hope it helped! :)
As mKriss mentioned, try
meteor reset
If you get this error:
reset: Meteor is running.
This command does not work while Meteor is running your application.
Exit the running meteor development server.
Then look for meteor in your running processes:
ps -x | grep meteor
This gave me the following output:
14877 pts/0 Sl 0:02 /usr/lib/meteor/mongodb/bin/mongod --bind_ip 127.0.0.1 --port 3005 --dbpath /home/sam/proto/.meteor/local/db
15022 pts/0 S+ 0:00 grep --color=auto meteor
So then I did:
kill -s KILL 14877
meteor reset
meteor
Now everything works!
Not sure if this is relevant to your problem, but I got this error and eventually discovered it was caused because I had my app directory in a NFS share (I am running on Ubuntu in VirtualBox) which mongodb doesn't like. Putting my app in my home directory instead fixed the problem.
There are a few ways around this, the question didn't show how to use mongod so I'm going to run through how to get a bit more detail on the error. meteor reset might work but not always & it will clear your apps data if it does work.
The core issue is meteor is very undescriptive when it comes to displaying data, so I would advise to get get a bit more detail on the error as it could literally any mongodb error out there. The steps below should reproduce the error with more verbosity to help diagnose what the root issue is
Find where Meteor installs mongodb
If you have the mongod tool (downloadable from http://mongodb.com), otherwise use the one installed with meteor. Just be careful you don't get too new a version that upgrades your old database, then meteor's older mongodb won't be able to understand it.
typically (but not always) at
/usr/local/meteor/mongodb/bin/mongod (OS X)
/usr/lib/meteor/mongodb/bin/mongod (Red Hat/Debian)
C:\Program Files\Meteor\mongodb\bin\mongod.exe (Windows via Tom Wijsman's port)
Run Meteor's database manually with mongodb
So we're going to use this to manually run mongodb on your apps mongodb database:
In your projects directory with your terminal app/command prompt
cd .meteor
cd local
/usr/local/meteor/mongodb/bin/mongod --dbpath ./
If your mongod path is something else use that instead, the above works on OS X.
Analyse the output to find the root cause of the issue
Now mongodb should run and give you a good description of what the problem is, or run smoothly:
Mon Apr 1 23:59:55 [initandlisten] MongoDB starting : pid=84640 port=27017 dbpath=./ 64-bit host=MacBook-Pro.local
Mon Apr 1 23:59:55 [initandlisten]
Mon Apr 1 23:59:55 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
Mon Apr 1 23:59:55 [initandlisten] db version v2.2.1, pdfile version 4.5
Mon Apr 1 23:59:55 [initandlisten] git version: d6764bf8dfe0685521b8bc7b98fd1fab8cfeb5ae
Mon Apr 1 23:59:55 [initandlisten] waiting for connections on port 27017
Have a look at the what the error might be and then tackle the problem displayed. It could be one of many.
Example issue
If it has:
exception in initAndListen: 10310 Unable to lock file: ./mongod.lock. Is a mongod instance already running?, terminating
Then restart your computer to kill any processes that might be using the file and if it still doesn't help use meteor reset to clear the directory at .meteor/local/db so your app uses a fresh database.
The errors are very helpful e.g low disk space (clear up the trash ;-) or cannot write to disk (permissions issue - use chmod/sudo).
Very obscure issues
If you find something very perplexing it might be a mongodb issue more than a meteor one, have a look around for the error you get here on stackoverflow and if you can't find it put a question up and swarms of helpful people are hopefully ready to help :)
I have very simple solution:
export LC_ALL="en_US.UTF-8"
and run meteor
If it is ok, you can add this line to
sudo vim /usr/local/bin/meteor
If meteor reset isn't working for you, check your disk space usage.
If you don't have any free disk space, you will get this error. MongoDB takes up about 450MBs, so creating a few projects can fill up a partition quickly.
If your meteor project is in a DropBox-folder, check for file names that contain the words conflicted copy in .meteor/local/db/ in your project folder and remove them. That should free up Mongod to run.
This is what helped me to run meteor on Google Compute Engine:
export LC_ALL=C
Watch for accents in the path of your projects.
..\Système\MyMeteorProject will not work,
..\System\MyMeteorProject will work.
Forgive the obvious, but does netstat -antep | grep 3002 show anything? (assuming you're on *nix)
I know this question is rather old, however I just ran into this issue as well and thought this might be useful to someone. What worked in my case was to run "sudo meteor"
I got this error message:
MongoDB had an unspecified uncaught exception.
This can be caused by MongoDB being unable to write to a local database.
Check that you have permissions to write to .meteor/local. MongoDB does
not support filesystems like NFS that do not allow file locking.
...and it turned out that I had an instance of the same app running on a different port, so add "making sure you don't have any other instances of the app running on an alternate port" to the list of things that can cause this error.
I could solve the issue under Meteor 1.2.1 and recover my data by deleting the lock file, copying whats left of .meteor/local/db/ to a temporary location (you might call this a backup), issue meteor reset and copy the backup data back to .meteor/local/db/. Everything worked as before.
for those using vagrant and do not want to meteor reset,
clearing out the db of your meteor's local directory resolved the conflict.
from the terminal:
rm -rf .meteor/local/db/
Thu Apr 12 19:27:39 listen(): bind() failed errno:98 Address already in use for port: 27017
Something else is already using the port 27017, so mongo startup is failing. Start mongo on a different port or kill whatever process is using 27017 first.
Meteor reset command did not work for me in DOS
I deleted all files and folder under <projectfolder>/.meteor/local/db to Recycle Bin
**DOS Log below:**
D:\Meteor\todos>meteor reset
Project reset.
D:\Meteor\todos>
I found the same conflict issue from syncing. I was using Ubuntu One and a bunch of new files were created in .meteor/local/db/ with "u1_conflicted" appended. I deleted those, and the ones in .meteor/local/db/journal and was back up and running.
I could recover the error by deleting the Local Mogo db lock.
Steps to remove the db lock :
Navigate to your app directory(where you have Meteor application files)
Remove file $ rm .meteor/local/db/mongod.lock
NOTE : $ meteor reset
WARNING: meteor reset erases everything in your local database.
Error occurs if Meteor Application is still running in background. Db lock is not released by the running application or due to improper system/application shutdown and unavailable for second instance of same application.
So take care to quit the application every time.
Same problem when I tried to create my project in a VMWare shared folder linking to a host folder...
cd /mnt/hgfs/Folder_in_C_host_drive
meteor create myapp
cd myapp
meteor
Unexpected mongo exit code 100. Restarting.
...
Solved by moving the project to a standard folder in my filesystem...VMWare Shared Folders are not capable of handling file security and any files are root:root owned...that was why it ended in those MongoDB errors
If you are using Vagrant, MongoDb won't run in the Vagrant shared directory: https://gist.github.com/gabrielhpugliese/5855677
If you using Windows for your dev work, Meteor now has a Windows installer:
http://win.meteor.com/
You can just try to stop running your meteor app using this command: kill -9 ps ax | grep node | grep meteor | awk '{print $1}'
I ran into the Unexpected mongo exit code 100. Restarting. error a while back.I ended up answering my own question here which seems to have done the trick for many facing the same issue.Most importantly is it doesn't require meteor resetwhich wipes the database.It's a simple and very quick three step fix so I'd recommend trying it before some of the more complicated suggestions.
I had the same problem. Fixed with:
Fixed with:
your project directory
redirect to .meteor directory > .local > .db
in .db folder remove all the files from here
run command "meteor"
It's working fine for me.Try this, it really helps alot.
Become a superuser:
# meteor --allow-superuser
run the command meteor reset on sudo user. It should work for you..