I want to rename the dev/ttyUSB1 to dev/ttyS1.
I am using oraclle vm, ubuntu LTS20.
How can I rename it to ttyS1?
Will mv command work here ?
I am new to linux
Related
I am upgrading my WSL2 instance from Debian 10 to Ubuntu 20.04 LTS, because I need some newer packages.
How do I copy files and directories from Debian to Ubuntu, preserving the permissions and owner? (uid and gid are the same in the two Linuxes.)
Copying to windows first changes the permissions and owner of files.
explorer.exe also changes permissions and owner.
Preferably, I'd also like to avoid having to create a shared disk image file that I could mount from Debian and Ubuntu in turn.
I'd like something simpler, like accessing the second WSL instance directly from the first, e.g.,
$ cp -a <Debian>/myfiles/ <Ubuntu>/myfiles
Is this possible?
See also my similar question: How to access \wsl$\othercontainer\some\file from within a WSL container? where the short answer is:
sudo mkdir /mnt/othercontainer
sudo mount -t drvfs '\\wsl$\othercontainer' /mnt/othercontainer
ls -l /mnt/othercontainer/some/file
NOTE: It looks like symbolic links aren't supported.
Use tar. It will preserve all the file metadata.
In <Debian>, create myfiles.tar.gz:
tar zcvf myfiles.tar.gz myfiles
Copy myfiles.tar.gz to your windows drive e.g. with explorer.exe or with /mnt/c, and then copy myfiles.tar.gz to <Ubuntu>. In <Ubuntu>, untar it:
tar zxvf myfiles.tar.gz myfiles
I'm trying to get unison working after upgrading to Mac OS X Catalina. Unfortunately, macports installs a more recent version of ocaml (4.08.1), which means that the unison 2.51.2 release won't compile.
Well, that's no problem, I just update to git master on unison, and recompile. Unfortunately, this fails at sync time because the version of ocaml used to compile on the mac (4.08.1) is different from the one used to compile on the other machine (4.07.1). Sigh. Okay, use opam magic to install 4.07.1 on my machine. Everything should be fine, right? No!
Here's the error:
Connected [//zzzmyhost//home/clements/unison-home -> //zzzmyotherhost//Users/clements/clements]
Looking for changes
Uncaught exception Failure("input_value: ill-formed message")
Raised at file "/private/tmp/unison/src/lwt/lwt.ml", line 126, characters 16-23
Called from file "/private/tmp/unison/src/lwt/generic/lwt_unix_impl.ml", line 102, characters 8-23
Called from file "/private/tmp/unison/src/update.ml" (inlined), line 2105, characters 2-69
Called from file "/private/tmp/unison/src/uitext.ml", line 978, characters 16-56
Called from file "/private/tmp/unison/src/uitext.ml", line 1066, characters 6-90
Called from file "/private/tmp/unison/src/uitext.ml", line 1088, characters 19-66
Called from file "/private/tmp/unison/src/uitext.ml", line 1144, characters 21-43
What's going on?
Sigh... the problem here (very non-obvious) is actually with a corrupted/wrong-format syncronization file, created when doing the failed sync in the earlier test.
The solution is just to go into ~/Library/Application Support/Unison (on a UNIX machine this path would presumably live in ~/.unison and delete the archive file that's causing the problem (probably the most recent one). In a pinch, just delete all of the archive files and start over.
I've got the same problem between Windows and Ubuntu 20.04 after upgrading from Ubuntu 18.04. I tried the binary from Ubuntu 18.04 in 20.04, which still fails, so the incompatibility is likely inside one of the dependencies.
As a workaround I created a Docker image based on Ubuntu 18.04:
FROM ubuntu:18.04
RUN apt-get update && apt-get dist-upgrade -y
RUN apt-get install unison -y
RUN useradd martin --home /home/martin
WORKDIR /home/martin
USER martin
Building it with docker build -t unison:18.04 .
And then I added a wrapper to ~/bin/unison-2.48.4-docker:
#!/bin/bash
docker run --rm -i \
-v /home/martin/dirtosync:/home/martin/dirtosync \
-v /home/martin/.unison:/home/martin/.unison \
--hostname $(hostname) \
unison:18.04 unison "$#"
Setting the --hostname is important, since the hostname is part of the archive file.
Inside the profile on my Windows machine I configured:
servercmd = ~/bin/unison-2.48.4-docker
In my setup with two windows clients and one Ubuntu 18.04 server, connected by ssh, the problem startet with a second server running on Ubuntu 20.04. Neither the old server nor the windows clients could sync with the new machine.
My solution: Copying the binary from Ubuntu 18.04 to a new directory in the Ubuntu 20.04 machine. This new file is referenced in the "authorized_keys" file of ssh on the new machine.
So far, everything works great with unison 2.48.4.
Is it possible to create user-privilleged directories from Windows to WSL directly?
I can create a folder from Windows, but it won't be the same as mkdir in WSL. For example, using Windows Explorer I create a new folder A
But, coming back to WSL, I can't cd A:
-bash: cd: A: Permission denied
Unless I do chmod 0761 * eventually. Isn't there a way to do that automatically?
I tried to find it out on google, but didn't worked well so I hope to find help here! :)
I am trying to create a pg_dump file on mac osx but there is no \bin folder as needed in cmd on windows.
My question is how to create the pg_dump file on mac osx?
Best regards!
Depends on where you installed PostgreSQL from. If its the .dmg from postgresql.org then the command will be in:
/Library/PostgreSQL/<version eg. 9.6>/bin
This is not in the PATH so you will have to either cd to the directory and run the command or add the directory to the PATH.
Another option is to search for the command with:
cd /
find ./ -name pg_dump
After I installed Mavericks my postgres configuration seems completely messed up. I installed the dev tools for Maverick from xcode and I've tried putting host:localhost in the db yml but still if I try to run rails s:
could not connect to server: No such file or directory (PGError)
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
If I try to start postgres manually with:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
I get: server starting
but pg_ctl -D /usr/local/var/postgres status returns pg_ctl: no server running ??
I tried to reinstall pg gem and reload postgresql but to no avail. brew info postgres returns:
postgresql: stable 9.3.1
http://www.postgresql.org/
Conflicts with: postgres-xc
/usr/local/Cellar/postgresql/9.3.1 (2919 files, 39M) *
Since I did brew reinstall postgress I know get this:
The data directory was initialized by PostgreSQL version 9.2,
which is not compatible with this version 9.3.1.
I have a postgres query tool that doesn't seem to have any trouble connecting so I know the data is still there.
I would really appreciate if someone can help me figure this out, thanks.
The error The data directory was initialized by PostgreSQL version 9.2,
which is not compatible with this version 9.3.1. is caused by the incompatible data directory between 9.2 and 9.3.
if you don't need the old data in your 9.2 db, it's very easy to solve this problem:
rm -rf /usr/local/var/postgres
where /usr/local/var/postgres is the default data directory path. you may need to change the path according to your setting.
After deleting the old data directory, init a new one with 9.3:
initdb /usr/local/var/postgres -E utf8
Then you are good to go!
====
if you need to migrate the old data from 9.2 to 9.3:
a) rename your old data directory:
mv /usr/local/var/postgres /usr/local/var/postgres9.2
b) init a new 9.3 db (create a new data directory):
initdb /usr/local/var/postgres -E utf8
c) migrate:
pg_upgrade \
-b /usr/local/Cellar/postgresql/9.2.4/bin/ \
-B /usr/local/Cellar/postgresql/9.3.1/bin/ \
-d /usr/local/var/postgres9.2 \
-D /usr/local/var/postgres \
-v
-b is your old binary while -B is your new binary. you can get them through brew info postgres.
-d is the renamed old data directory while -D is the new data directory you just created at step b.
then you would get the following message:
Creating script to analyze new cluster ok
Creating script to delete old cluster ok
Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade so,
once you start the new server, consider running:
analyze_new_cluster.sh
Running this script will delete the old cluster's data files:
delete_old_cluster.sh
d) rock with your postgres 9.3!
The most conservative way to upgrade PostgreSQL entails needing to:
Compile a version of PostgreSQL using 9.2.X sources (e.g. ./configure --prefix=/tmp/myPg-9.2 && make && make install)
Start the database using the 9.2 binaries (e.g. /tmp/myPg-9.2/bin/postgres -D /usr/local/var/postgres, this will keep PostgreSQL in the foreground in this terminal)
Dump the database using pg_dumpall
Shut down the 9.2 database.
Move /usr/local/var/postgres to someplace safe (e.g. /usr/local/var/postgres-9.2)
initdb a new database using the new 9.3 binaries.
Load the dump from pg_dumpall.
Make sure you hold on to a copy of your old 9.2 data directory until you've successfully recovered. Once you've determined that you've fully recovered from this situation, you can blow away your temp 9.2 installation in /tmp/myPg-9.2 and the old 9.2 data directory /usr/local/var/postgres-9.2. I'd make a backup of /usr/local/var/postgres-9.2 and would sit on it for a few months "just in case" (e.g. tar cjpf /usr/local/var/postgres-9.2-2013-10-31.tar.bz2 /usr/local/var/postgres-9.2).
Per comment, adding a few extra steps:
Compile a version of PostgreSQL:
cd /tmp
Download the latest .bz2 tarball of PostgreSQL's 9.2 source from http://www.postgresql.org/ftp/source/ (currently 9.2.5 as of 2013-10-31).
tar xjpf postgresql-9.2.5.tar.bz2
cd postgresql-9.2.5
./configure --prefix=/tmp/myPg-9.2 - Don't run this as root
make - Also don't run this as root
make install - Frequently you would do this as root, but you don't need to this time because you're installing in to /tmp where you have permissions to install. If your prefix was /usr/local you would have to run this command as root.