27 votes
Accepted

Why doesn’t binary compiled on M1 Mac (arm64) run on EC2 t4g.micro instance (aarch64)?

It’s not enough to have a binary for the same hardware architecture; it also needs to target the appropriate software platform. A binary built for macOS on M1 won’t run on Debian, even on an M1 (let ...
Stephen Kitt's user avatar
20 votes

Why am I getting 400 Bad Request?

Make sure you do not have illegal characters in your virtual hosts' ServerName. I ran into this issue while migrating "sub_domain.test.com" from Apache 2.2 to 2.4. The underscore in "sub_domain" ...
Chris78's user avatar
  • 301
19 votes

Return the private IP of an EC2 instance from within the EC2 instance

$ curl http://169.254.169.254/latest/meta-data/local-ipv4 The private IPv4 address of the instance. In cases where multiple network interfaces are present, this refers to the eth0 device (the ...
Michael - sqlbot's user avatar
18 votes
Accepted

How to set environment variables permanently in Amazon Linux 2

It's better to set universal variables by creating scripts in /etc/profile.d. You want to create it with an extension of your shell name. For example, if it's bash, it will be called script.sh for ...
Nasir Riley's user avatar
  • 11.4k
17 votes
Accepted

How is an Elastic IP address different from a static IP address?

The main difference between the two is that: You will lose your Public IP when you Stop and Start the instance, while the EIP remains linked to the instance even after the Stop/Start operation (...
Echoes_86's user avatar
  • 752
15 votes
Accepted

Multiple commands during an SSH inside an SSH session

Consider that && is a logical operator. It does not mean "also run this command" it means "run this command if the other succeeded". That means if the rm command fails (which will happen if ...
Centimane's user avatar
  • 4,460
12 votes

How do I resize this AWS EC2 ubuntu 18 instance from 16GB to 100GB

I had the same issue Solved it with the command below (other answers are wrong) sudo growpart /dev/nvme0n1 1 I could then extend the FS with sudo resize2fs /dev/nvme0n1p1
moussa chikhi's user avatar
11 votes

Multiple commands during an SSH inside an SSH session

You can always define in your jumpbox Multiplexing in OpenSSH Multiplexing is the ability to send more than one signal over a single line or connection. With multiplexing, OpenSSH can re-use an ...
Rui F Ribeiro's user avatar
8 votes
Accepted

Accidentally port 22 got closed, how do I fix the SSH access?

I did it by detaching the volume from the current instance than added it to the other instance as a secondary volume. Than the volume become readable, and I changed the ssh config file to default one. ...
Ajeet Khan's user avatar
8 votes

/proc consuming space on hard disk gradually

You’re misreading the output: the lines about /proc are error messages because du can’t read some of the files find is asking it to use; they don’t indicate that files in /proc are among the top-ten ...
Stephen Kitt's user avatar
8 votes
Accepted

SSH'd into a linux AWS box, how to exit out of terminal without closing script running in AWS box?

ersonally I use screen to get in/out of the system while keeping the processes running. $ sudo apt install screen To create a new screen: $ screen -S screen_name Then do something in your screen, ...
RustyShackleford's user avatar
8 votes
Accepted

Cannot extend partition beyond 2TB on AWS Ubuntu

Your drive is formatted as MBR. For drives larger than 2TB, they need to be partitioned as GPT as MBR is limited to 2TB regardless of the OS.
Nasir Riley's user avatar
  • 11.4k
7 votes

DISPLAY environment variable not set

I solved this problem by simply hardcoding $DISPLAY as :1, export DISPLAY=:1 in my .bashrc file. I however, still don't understand why this works. Here is the output of xauth list ip-172-31-74-230....
coda's user avatar
  • 271
7 votes

delay/cancel linux shutdown

[C]an I catch and cancel somehow the shutdown signal before any other processes catch them, and cancel the shutdown on time? This isn't possible. If they want to shut it down, they can just tell the ...
Chris Down's user avatar
  • 125k
6 votes

Driver install, kernel source not found

First install dkms: sudo apt-get install dkms Then do the Cuda installation, e.g. sudo sh cuda_8.0.61_375.26_linux.run
mehryaragha's user avatar
6 votes

Turn off --skip-grant-tables in MySQL

You can make this done by using below steps. [root@backups1 mysql5.7]# bin/mysqld_safe --skip-grant-tables --user=mysql connect to your mysql without password. mysql> flush privileges; mysql> ...
Mansur Ul Hasan's user avatar
6 votes

How does a EC2 machine prevent ssh root access with a warning?

admin@machine:~$ sudo su root@machine:# cat /root/.ssh/authorized_keys no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"admin\" ...
loopbackbee's user avatar
  • 4,542
6 votes
Accepted

yum lockfile is held by another user

I'm pretty sure your running into this issue using Ansible 2.8, it want's to blow up now when running YUM Package installs. Easy work around to this is to set the lock_timeout var to 100 + as the ...
D-Rod's user avatar
  • 76
6 votes
Accepted

Yum in Amazon Linux 2 still asks for GPG key even after "rpm --import" when adding Kubernetes repo

This is a known issue (see https://github.com/kubernetes/kubernetes/issues/60134). Work around it by disabling GPG checks: set repo_gpgcheck=0 in /etc/yum.repos.d/kubernetes.repo. Credits to ...
Edward's user avatar
  • 2,464
6 votes

How to fix infinite bash loop (bashrc + bash_profile) when ssh-ing into an ec2 server?

In general, ~/.bashrc is only sourced by interactive shells, and ~/.bash_profile by login shells (Difference between login shell and non-login shell?). If you only send commands via Ssh, you get ...
Quasímodo's user avatar
  • 18.8k
6 votes

How to fix infinite bash loop (bashrc + bash_profile) when ssh-ing into an ec2 server?

[update] This interesting case deserves a better answer (which I'm borrowing from this answer on superuser). My original answer below depends on the fact that ssh user@server command is supposed to ...
xhienne's user avatar
  • 17.8k
6 votes

How to fix infinite bash loop (bashrc + bash_profile) when ssh-ing into an ec2 server?

When you run ssh, by default it runs your shell in interactive mode, and in interactive mode it processes your .bashrc. However, if you specify a command to run, it will invoke the shell in non-...
Andy Dalton's user avatar
  • 13.9k
5 votes
Accepted

Apache server at new AWS EC2 instance is not reachable

The web server seems to be listening to the actual port and running, accordingly to your netstat. You have got to open the firewall rule in the AWS console. Have a look at this: Authorizing Inbound ...
Rui F Ribeiro's user avatar
5 votes

Restore system file permissions

I don't think there is any faster way. You could come up with a script that copies the ownership info from a working installation, but writing the script would probably take more time than creating a ...
Tero Kilkanen's user avatar
5 votes
Accepted

sshfs "Connection reset by peer" with identify file

There can be many mistakes in syntax, and many more in connection. Best solution is turn on verbose mode with switch -o debug and in my case I see problem with "absolute path to identity file" no ...
Bruno's user avatar
  • 301
5 votes
Accepted

How to install OpenVPN client on RHEL 7.3?

Remove epel-6 repo yum remove epel-release Enable epel-7 repo: wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.‌​noarch.rpm rpm -ivh epel-release-latest-7.‌​noarch.rpm Or wget ...
GAD3R's user avatar
  • 66.3k
5 votes

Issues with "nohup" on Linux instance on EC2 Amazon Web Services

I had exactly the same issue. I was running my node server as you do: nohup node server.js & In this way, the process is running in the terminal session, that's the reason the process lives ...
Andrea De Luisi's user avatar
5 votes

How do I configure my Amazon Linux service to auto-restart if it fails?

Amazon Linux 2 If your version of Amazon Linux is >=2.0, it has systemd by default. In this case, you should simply be able to use the same unit file you have been using on CentOS, with the restart ...
novice's user avatar
  • 429
5 votes
Accepted

Syntax error checking if file exists

The error you're getting suggests you're actually running it via Python. Has some fool overwritten your bash binary with python ? Try running bash --version. Example [steve@centos ~]$ cat x1 #!/...
steve's user avatar
  • 21.9k

Only top scored, non community-wiki answers of a minimum length are eligible