date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,495,645,416,000
When using TCP & UDP sockets, there are many scenarios which cause connection interruption (slow connection, network reset, etc). Is there any possible situation which an unix domain socket automatically disconnects or interrupts because of an external reason? Should developers consider possible interruption in their ...
It's always possible that server will terminate unexpectedly, no matter what type of socket or IPC mechanism is used. It can happen for many different reasons, for example: it may crash because of software bug, for because due to segmentation fault or failed assertion it may eat too much memory and can get killed by...
Possible scenarios for Unix domain sockets interruption
1,495,645,416,000
I've discovered that OpenSSH is capable of forwarding UNIX sockets like this: ssh -R /var/run/program.sock:/var/run/program.sock My question is whether this extends to abstract unix sockets too. I've tried the following to no avail: ssh -nNT -R @laminar:@laminar ssh -nNT -R unix-abstract:laminar:unix-abstract:laminar...
No, that's not possible with the standard openssh-portable. You can look for instance at the unix_listener() function here. Maybe there are patches floating around, but I'm not going to answer with google search results ;-) Adding such a thing should be technically easy, but who's going to deal with the "political" p...
Forward abstract unix socket over SSH?
1,495,645,416,000
I've set permissions on the socket to 777 yet Nginx keeps stating that it's being denied permission to access, and yes I've restarted the server. Nginx is being started as root (not the best way but it's just the way it is and I'm not the one who set it this way) and the socket in question is owned by a user for the a...
I was facing the same issue. You have to disable SELinux. For detailed steps please follow the link: http://blog.odoobiz.com/2017/11/rhel-wsgi-nginx-error-permission-denied.html
nginx errors with failed (13: permission denied) for socket despite socket permissions being set to 777
1,495,645,416,000
I want one of machine have a remote control alarm running that can be triggered by any remote machine. More precisely Machine A is running the service in the background Any remote machine B can send a packet to machine A to trigger the alarm (a command called alarm) How would you suggest do do it? I would use nc: S...
Consider this Python3 example. Server A: #!/usr/bin/env python3 # coding=utf8 from subprocess import check_call from xmlrpc.server import SimpleXMLRPCServer from xmlrpc.server import SimpleXMLRPCRequestHandler # Restrict to a particular path class RequestHandler(SimpleXMLRPCRequestHandler): rpc_paths = ('/JRK75W...
Remote control alarm
1,495,645,416,000
I often run into a situation where I want to traceroute an IP without root or NET_RAW cap in Linux. I have attempted to send a UDP packet with a small TTL but no ttl error is emitted at all. It seems that getting the TTL exceeded error requires using an ICMP socket. Is it possible to use UDP or TCP protocol only witho...
Of course, you can use any protocol. Try tcptraceroute. Or the standard traceroute. from man page: -I, --icmp Use ICMP ECHO for probes -T, --tcp Use TCP SYN for probes -U, --udp Use UDP to particular destination port for tracerouting (instead of increasing the po...
It is possible to traceroute without touching ICMP?
1,495,645,416,000
I am more interested in sockets than regular files, but basically I want to know whether one process can "see" a socket as blocking where another process can see it as non-blocking. I am guessing yes, and that the kernel handles all of this depending on what options were used in the syscall. I guess this would be m...
You guess wrong. The only property which is per-file descriptor and which can be changed with fcntl(F_SETFD) is the FD_CLOEXEC close-on-exec flag. All the other properties are either per file object ("open file description" in POSIX lingo -- which can be changed with fcntl(F_SETFL)), or per inode. Setting the non-bloc...
Can one processes have a descriptor that is non-blocking while another process have a descriptor referencing the same file/socket that is blocking?
1,543,981,080,000
From https://unix.stackexchange.com/a/485290/674 Further down in the netstat output is UNIX sockets: Active UNIX domain sockets (servers and established) Proto RefCnt Flags Type State I-Node PID/Program name Path <snip> unix 2 [ ACC ] STREAM LISTENING 21936 1/systemd ...
screen processes don’t maintain socket connections while they’re running; they open and close socket connections as needed when they have messages to send. Thus, when you run screen -r to reconnect to an existing session, it connects to the existing process using a socket, negotiates various settings, and when it’s go...
Why doesn't `netstat` show Screen client but only Screen server process?
1,543,981,080,000
I'm running ssh running on macOS to redirect connections to local Unix domain socket to a domain socket on another machine. The command line for ssh call is roughly the following: $ ssh -nNT -L /var/run/some.socket:/var/run/some.socket -o TCPKeepAlive=yes \ -o ServerAliveCountMax=10 -o ServerAliveInterval=60 user...
channel 41: open failed: connect failed: open failed This error message means that the remote SSH server was unable to perform a TCP forward request, because it couldn't connect to the target of the tunnel. The last "open failed" part of the message is an error message from the remote SSH server. When you run SSH wit...
ssh: channel xx: open failed: connect failed: open failed
1,543,981,080,000
I'm trying to understand the permissions of a unix domain socket, when using an existing file, umask changes are required as well as the dir permissions. If I create a world readable dir as root and open a socket with netcat: root$: mkdir /tmp/mydir root$: chmod 777 /tmp/mydir root$: nc -l -U /tmp/mydir/sock Then as ...
You missed this in that same unix(7) manpage you're quoting from: On Linux, connecting to a stream socket object requires write permission on that socket; sending a datagram to a datagram socket likewise requires write permission on that socket. Of course, you also need search(execute) permission to all the lead...
unix domain socket permissions and umask integration between root and non root users
1,543,981,080,000
I have some old unix running as vm on VirtualBox server those vm had the serial ports simulated by unix socket for example: an old AT&T 2.1 SVr4 has socket on /tmp/att1 to connect i did minicom -D unix#/tmp/att1 on server. I heard somewhere ssh can connect to unix sockets. How to do? I have tried socat TCP-LISTEN:55...
No, you can't connect using ssh to UNIX domain socket simulating serial console. You would need SSHD server on the other side and your machines probably pre-dates the whole SSH protocol. You got this probably confused by the forwarding of UNIX domain socket, which is possible as port-forwarding.
ssh on unix socket
1,543,981,080,000
I have a C++ program which must communicate with other services (including httpd), and does so via a socket in /tmp With the advent of systemd and the PrivateTmp=true setting, processes like httpd can no longer see my program's socket by default. I don't want users to change the PrivateTmp setting of httpd since it's...
You can put your socket in /var/tmp which is a world writable dir with the sticky bit, like /tmp. If your program is a daemon started by systemd you could consider using RuntimeDirectory=somedir in the unit file, then that dir will be created in /run when your unit starts, and removed when it stops. You could then c...
Where to put socket so PrivateTmp can be true
1,543,981,080,000
Actually, I have software that runs in the ARM-Linux has three apps of mine.I want to run the one certain application in Linux host x86. The internal components in my ARM-Linux program communicate using Unix domain socket. My socket type is: AF_UNIX I am using old ARM processor doesn't support Valgrind. There is some...
No. You can't communicate across hosts on a network using AF_UNIX sockets, as those reference local inodes on the filesystem to bind the socket to, and the local filesystem is only available to the local host. To communicate between nodes, you'll need to use an AF_INET socket, which will bind to an IP address and por...
Using Unix domain socket for different hosts
1,543,981,080,000
I just installed MariaDB on Kubuntu 15.10. I am able to log in with the root user via the plugin that authenticates the user from the operating system. (This is new to me, so I am learning about it rather than removing the plugin authentication as most tutorials seem to recommend.) Now I want to create a non-root use...
Found the answer. The part I needed was "IDENTIFIED VIA unix_socket" as shown below: MariaDB [(none)]> CREATE USER serg IDENTIFIED VIA unix_socket; MariaDB [(none)]> GRANT ALL PRIVILEGES on mydatabase.* to 'serg'@'localhost'; MariaDB [(none)]> select user, host, password, plugin from mysql.user; +--------------+-----...
MariaDB: Create and grant a new user using unix sockets plugin (passwordless)
1,543,981,080,000
Is it a true statement that, shared memory does not work between a host OS and guest OS, but a Unix Domain Socket (specifically udp) can communicate between the two? An in depth explanation would be appreciated, thanks!
In general Unix Domain Sockets cannot communicate between host OS and guest OS. Unix Domain Sockets are, like e.g. Named Pipes, bound to the OS kernel. If you open the same Unix Domain Socket file node in the host and the guest, you get two different virtual network connections. One in the host kernel and one in the g...
Unix Domain Socket with VM
1,543,981,080,000
I am trying to forward a gpg-agent Unix socket to a remote machine. I have tried the following two versions of the remote forwarding command: A: ssh -vvv -N -R ~/.gnupg/S.gpg-agent:~/.gnupg/S.gpg-agent.extra {HOST} B: ssh -vvv -N -R ~/.gnupg/S.gpg-agent:/home/{USER}/.gnupg/S.gpg-agent.extra {HOST} They both report s...
The ~ must be expanded by some program. Usually this program is the shell. The sshd daemon doesn't feed the path to a shell and doesn't expand the path. But you don't need an expansion for the current users home directory as it is the working directory anyway. Try ssh -vvv -N -R ~/.gnupg/S.gpg-agent:${HOME}/.gnupg/S.g...
Does OpenSSH >=7.2 support local-side tilde expansion for remote Unix socket forwarding
1,543,981,080,000
I'm trying to get the Unix socket peer credentials in python. I am using this piece of code for that: peercred = conn.getsockopt(socket.SOL_SOCKET, socket.SO_PEERCRED, struct.calcsize("3i")) pid, uid, gid = struct.unpack("3i", peercred) This works correctly in Linux, but in OpenBSD the order is different. In OpenBsd ...
I'm no python programmer, but I guess you should special case your code based on sys.platform. SO_PEERCRED is not a standardized interface, and the actual structure / binary interface is different between the systems. On Linux, as defined in /usr/include/bits/socket.h: struct ucred { __u32 pid; __u32...
Different order for getsockopt SO_PEERCRED in Linux and OpenBSD
1,543,981,080,000
I'm in the process of upgrading from Ubuntu Server 16.04 to 18.04 and at the same time upgrading from PHP 5.6 to PHP 7. In /etc/memcached.conf I added: -s /tmp/memcached.sock -a 666 When I restart the service, I see: srw-rw-rw- 1 memcache memcache 0 Nov 13 03:44 /tmp/systemd-private-7fc3b73707084a93bcc6abd22001eb7e-m...
systemd has PrivateTmp=true for memcached.service One way would be to override PrivateTmp, specifically for the memcached.service, i.e. mkdir -p /etc/systemd/system/memcached.service.d echo "[Service]" > /etc/systemd/system/memcached.service.d/override.conf echo "PrivateTmp=false" >> /etc/systemd/system/memcached.serv...
How to configure systemd so that PHP can use memcached unix socket?
1,543,981,080,000
I am doing UDP socket programming in C. In order to listen to a port, I need to forward ports in my router. My question is how to avoid doing that and still being able to communicate over the internet, if not possible with sockets, what is the lowest level possible? In other words, every device can listen to an http s...
Usually, your ISP gives you a single IP address, and your home router does network address translation (NAT) to pretend to your ISP that all the devices in your home network are just a single device with the same address as the router itself. Because of this, if anyone wants to contact your home network from the outsi...
How to avoid forwarding ports?
1,543,981,080,000
I run an Ubuntu based server on raspi (6.5.0-1015-raspi #18-Ubuntu). On this system, I have knxd running, exposing a KNX bus to my server, and then Home Asssitant in a docker container. knxd and docker are configured as systemctl services. knxd is configured to create a UNIX domain socket in /tmp/eib, with the command...
knxd github repository at https://github.com/knxd/knxd mentions where the socket is created: "If you use Debian Jessie or another systemd-based distribution, /lib/systemd/system/knxd.socket is used to open the "standard" sockets on which knxd listens to clients. You no longer need your old -i or -u options." It also a...
Unix socket in /tmp turns into directory on reboot
1,543,981,080,000
I run a python code inside docker container performing the following calls import socket as s,subprocess as sp;s1=s.socket(s.AF_INET,s.SOCK_STREAM); s1.setsockopt(s.SOL_SOCKET,s.SO_REUSEADDR, 1);s1.bind(("0.0.0.0",9001));s1.listen(1);c,a=s1.accept(); I'm trying to get info using ss and see the open sockets, but can't...
You have to switch to the correct network namespace first, because socket state is per namespace (namely per network namespace). For example by using nsenter. sudo has to be moved first, because nsenter also requires privileges. In one line (and using ss's own filtering features) this becomes: sudo nsenter -t $(docker...
ss doesn't display socket info related to the process opening SOL_SOCKET
1,543,981,080,000
I'm trying to debug why data isn't being sent over a Unix Domain Socket. I have 2 applications which should be communicating over a UDS but aren't. To test I've done the following: Using socat, I listen on a socket like this: socat -x -u UNIX-RECV:/tmp/dd.sock STDOUT and using netcat to send data like this: echo "hel...
You have set up a listening datagram socket with socat+UNIX-RECV: and are attempting to talk to it via a stream socket with nc. The second scenario works because in that case you added the missing -u flag to nc, so that both it and socat were employing a datagram socket. It wasn't anything to do with there being a pr...
Sending data to Unix socket failing unless proxied with socat via UDP
1,543,981,080,000
i am testing stuff with sockets and i encountered that strange case : i coded i very simple tcp server in c, i made it block after accept(), just to see what happen when accepting multiple connection attempts at the same time : Here is an excerpt of code of the server : //listen() if( (listen(sock,5)) == -1) { perro...
The server code calls accept() only once. Thus, only the first connection attempt is effectively accepted and the remaining client connections are kept on a connection request queue which lives in the kernel space. The next client connection will be retrieved from the queue when accept() is called again. No process ow...
sudo netstat -antp not showing PID
1,543,981,080,000
Suppose I want to launch a co-process and attach its standard input and output to the main process, what we have here are 2 options: call pipe(2) and create 2 pipes, and attach them separately to the standard input and output of the co-process. call socketpair(2) and attach 1 end of the socket to the standard input ...
If portability is desired, then at least 2 pipes must be created. This corresponds to 2 open file description compared to 1 as is the case with a socket. Although not a performance/efficiency reason, you cannot use MSG_PEEK with pipes, but you can use it with anonymous sockets, like those created with socketpair(2).
Is 2 pipes more expensive than 1 socketpair?
1,543,981,080,000
I'm trying to launch a meta-service remotely through a socket. Requirements: The socket should start the meta-service when a connection is established The meta-service should start all child (Wants=) services upon start When the connection is closed, the meta-service should stop When the meta-service stops, it shoul...
I have a solution, but it's in python which is not ideal for dependency reasons. # simple.socket [Unit] Description=Socket [Socket] ListenStream=11111 Accept=no # simple.service [Unit] Description=Meta-service Wants=simple-child.service [Service] ExecStart=/usr/local/bin/listen.py # simple-child.service [Unit] Des...
Stop child services when systemd socket connection closes
1,543,981,080,000
How can I remove below file? srwxrwxrwx 1 patroh root 0 Aug 8 16:11 0= The user patroh is myself. The rm command won't work - it doesn't give any error when I execute rm 0. I am not sure how I created this file?
The s at the start of the line in ls -l's output identifies that as a unix-domain socket. The = at the end is a type indicator for sockets, one that ls -F adds. So the file itself is called just 0. Unix sockets are a particular method of interprocess communication that mostly acts like real network sockets but have na...
how to remove file 0= file which has srw permission
1,543,981,080,000
Do unix domain sockets support reuse? Lots of conflicting information about this online. I suspect a lot of it is just outdated, but I'm no expert. Do I ProxySet enablereuse=on if my handler is a socket? e.g. <Proxy "fcgi://matching-worker-string/" max=10> # Unsure about this: ProxySet enablereuse=on </Proxy> ...
One of your linked answers directly quotes the apache documentation for mod_proxy_fcgi. According to the answer it states: UDS does not currently support connection reuse But this phrase no-longer exists in the documentation. It was there when the answer was written on 26 jan 2017. The first snapshot on waybackmac...
Do unix domain sockets support reuse?
1,543,981,080,000
I have two processes P1 (sender) and P2 (receiver). P1 uses unix-domain-socket (UDS) to send data to P2. what will happen if P1 sends data at the rate of 100 messages/second and P2 is capable to receive 50 messages/second. Both are non-blocking sockets. What is happening in the above scenario? will p1 or p2 face memor...
If the receiver is not reading as fast as the sender sends, then the sockets buffers fill up after a while. When assuming a datagram socket type a blocking socket would block if the buffers are full and thus implicitly slow down the sender. With a non-blocking socket the sending of a message simply would fail and EAGA...
what will happen if receiver unable to handle data velocity through socket?
1,400,911,121,000
Is there a command I can type in a terminal that will tell me the last time a machine was rebooted?
uptime If you want it in numerical form, it's the first number in /proc/uptime (in seconds), so the time of the last reboot is date -d "$(</proc/uptime awk '{print $1}') seconds ago" The uptime includes the time spent in a low-power state (standby, suspension or hibernation).
How long has my Linux system been running?
1,400,911,121,000
My computer says: $ uptime 10:20:35 up 1:46, 3 users, load average: 0,03, 0,10, 0,13 And if I check last I see: reboot system boot 3.19.0-51-generi Tue Apr 12 08:34 - 10:20 (01:45) And then I check: $ ls -l /var/log/boot.log -rw-r--r-- 1 root root 4734 Apr 12 08:34 boot.log Then I see in /var/log/syslo...
On my system it gets the uptime from /proc/uptime: $ strace -eopen uptime open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 open("/lib/libproc-3.2.8.so", O_RDONLY|O_CLOEXEC) = 3 open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 open("/proc/version", O_RDONLY) = 3 open("/sys/devices/system/cpu/onli...
On Linux, when does "uptime" start counting from?
1,400,911,121,000
Background : I need to receive an alert when my server is down. When the server is down, maybe the Sysload collector will not be able to send any alert. To receive an alert when the server is down, I have an external source (server) to detect it. Question : Is there any way (i prefer bash script) to detect when my se...
If you have a separate server to run your check script on, something like this would do a simple Ping test to see if the server is alive: #!/bin/bash SERVERIP=192.168.2.3 [email protected] ping -c 3 $SERVERIP > /dev/null 2>&1 if [ $? -ne 0 ] then # Use your favorite mailer here: mailx -s "Server $SERVERIP is do...
Bash script to detect when my server is down or offline
1,400,911,121,000
I have a 1 core CPU installed on my PC. Sometimes, uptime shows load >1. How is this possible and what does this mean? EDIT: The values go up to 2.4
Load is not equal to CPU usage. It is basically an indicator how many processes are waiting to be executed. Some helpful links: https://superuser.com/questions/23498/what-does-load-average-mean-in-unix-linux http://blog.scoutapp.com/articles/2009/07/31/understanding-load-averages
Why/how does "uptime" show CPU load >1?
1,400,911,121,000
I'm aware of the uptime command, but it returns seconds since booted, so if I just substract that number from current timestamp, in theory I can get a different result if second changes after I've read the uptime and current timestamp. uptime -s is what I want, but it is not available on centos (how is it calculated b...
First of all, crtime is tricky on Linux. That said, running something like $ stat -c %z /proc/ 2014-10-30 14:00:03.012000000 +0100 or $ stat -c %Z /proc/ 1414674003 is probably exactly what you need. The /proc file system is defined by the LFS standard and should be there for any Linux system as well as for most ...
How to reliably get timestamp at which the system booted?
1,400,911,121,000
I want to display /proc/uptime in well format as: DD:HH:MM:SS /proc/uptime give me up time of system in seconds, is there a standard solution that convert seconds to this format?
Here's a way without perl: awk '{printf("%d:%02d:%02d:%02d\n",($1/60/60/24),($1/60/60%24),($1/60%60),($1%60))}' /proc/uptime
Convert linux sysuptime to well format date
1,400,911,121,000
I have an Ubuntu server running Redis, which suffers from a high load problem. Forensics Uptime # uptime 05:43:53 up 19 min, 1 user, load average: 2.96, 2.07, 1.52 sar # sar -q 05:24:00 AM LINUX RESTART 05:25:01 AM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked 05:35:04 AM 0 116 ...
You're seeing the unexpected loadavg because of high iowait. 98.7 in the wa section of top shows this. From your screenshots I see the kworker process is also in uninterruptible sleep (state of D within top) which occurs when a process is waiting for disk I/O to complete. vmstat gives you visibility into the run que...
High load average: Which processes are waiting in the queue?
1,400,911,121,000
It seems that my server keeps restarting. I want to know why. How can I know when the last time server was rebooted and why? root pts/0 139.193.156.125 Thu Aug 8 21:10 still logged in reboot system boot 2.6.32-358.11.1. Thu Aug 8 20:38 - 21:11 (00:33) reboot system boot 2.6.32-358.11.1. Thu Aug ...
/var/log/messages That is the main log file you should check for messages related to this. Additionally either /var/log/syslog (Ubuntu) or /var/log/secure (CentOS) To find out when your server was last rebooted just type uptime to see how long it has been up.
How to know why server keeps restarting?
1,400,911,121,000
I am learning Python. Till now I've been doing only basic Python coding. A day ago, I checked python implementation of tree command. Suddenly I thought of creating a Python clone for uptime. I don't have any clue about which language it is implemented in and what would be the complexity involved in cloning it. But I c...
Uptime is part of the 'procps' package, the upstream source is at http://procps.sourceforge.net/ (Not a fedora user, so not sure where to find their .src.rpm). To answer the question you didn't ask, however; take a look in /proc/uptime The first number is seconds since boot. You should be able to turn that into some...
Where can I find the source code for `uptime`?
1,400,911,121,000
Is there any way to read total running time of a linux system from BIOS or CPU? I've searched BIOS informations by dmidecode. But it gives release date which is not proper for my question. Then I've checked out /proc. But it holds uptime values just from last reboot. Maybe, writing these uptime values for every boot c...
This isn’t something the firmware tracks, as far as I’m aware. Even BMCs don’t measure total uptime. This won’t help with past uptime from previous boots, but you can start recording uptimes now, by installing a tool such as uptimed and setting it up so that it never discards values (set LOG_MAXIMUM_ENTRIES to 0 in up...
Total runtime of machine
1,400,911,121,000
How can I convert the uptime output to seconds since epoch to compare with dmesg output? Does uptime have the same resolution as the kernel message time? Is there a way to more directly get the kernel time than from uptime? ➜ ~ echo "hi" > /dev/kmsg ➜ ~ dmesg | tail [ 859.214564] hi ➜ ~ uptime 10:08 up 2 days, 4...
Depending on your flavor of Unix, the /proc filesystem may have an uptime file somewhere with the information you want. Linux> cat /proc/uptime 5899847.37 23165596.55 And the output of the uptime command for the same time: Linux> uptime 16:46:27 up 68 days, 6:51, 3 users, load average: 0.01, 0.02, 0.05 So 5899847....
How to print kernel time from command line?
1,400,911,121,000
Under Linux I can get a process's uptime in seconds with: echo $(($(cut -d "." -f1 /proc/uptime) - $(($(cut -d " " -f22 /proc/$PID/stat)/100)))) But how can I get it under different OS? ex.: SunOS, HP-UX, AIX?
On any POSIX-compliant system, you can use the etime column of ps. LC_ALL=POSIX ps -o etime= -p $PID The output is broken down into days, hours, minutes and seconds with the syntax [[dd-]hh:]mm:ss. You can work it back into a number of seconds with simple arithmetic: t=$(LC_ALL=POSIX ps -o etime= -p $PID) d=0 h=0 cas...
How to get a process uptime under different OS?
1,400,911,121,000
I need to find PC uptime from the day of installation until now. Is this logged somewhere? Does any file log this cumulative uptime?
As log-files are usually deleted after some time, the total up-time is difficult to get. If the hard disk is as old as the PC, the RAW value (last number) of smartctl -a /dev/sda | grep Power_On_Hours could give a rough estimate how many hours the PC was used.
Finding PC uptime from first day until now
1,400,911,121,000
I have a Linux system where it is showing to me two different times when the system was last booted. root@linux:~ # who -b; uptime system boot 2009-07-09 20:51 11:48am up 1 day 0:54, 1 user, load average: 0.01, 0.03, 0.00 I presume that who is showing the content of /var/log/wtmp and uptime I have no ...
[I caught some misconceptions here which I think will this post clear off eventually] There should not be any difference since both refer to /var/run/utmp file, which has its own format to store the records. If at all there is any difference, then your utmp file is busted. uptime shows the amount of time that has pass...
Uptime and who -b are showing different times when the system was last booted on Linux
1,400,911,121,000
Basically I an using conky to ssh into an android tv box and get the uptime and display it on the conky screen. I have this so far, found on net and hacked by me but it works, please amend if its crap uptime | awk -F'( |,|:)+' '{print int($6/7),"weeks",$8,"hours,",$9,"minutes."}' and it shows 4 weeks 1 hour 1 minute ...
Since you tag your question with Ubuntu, below is enough. $ uptime -p up 4 weeks, 1 day, 1 hour, 1 minute see man uptime for Ubuntu. -p, --pretty show uptime in pretty format Or with your own script: awk -F'( |,|:)+' '{ printf("%dweeks, %.fdays, %dhours, %dminutes\n", $5/7, ($5/7-int($5/7))/0.1...
getting uptime in Weeks, Days, Hours, Minutes
1,400,911,121,000
I need to write a script that figures out if a reboot has occurred after an RPM has been installed. It is pretty easy to get the epoch time for when the RPM was installed: rpm -q --queryformat "%{INSTALLTIME}\n" glibc | head -1, which produces output that looks like this: 1423807455. This cross checks with rpm -q --i...
As manuals (and even Wikipedia) point out: /proc/uptime Shows how long the system has been on since it was last restarted. The first number is the total number of seconds the system has been up. The second number is how much of that time the machine has spent idle, in seconds. On multi core systems (and some linux ve...
How do I get the time when the system booted up in epoch format?
1,400,911,121,000
A tool such as this might on the surface appear to serve no real useful purpose, but people that take care of systems like to brag, and uptime is just one of those things that they like to brag about right after how much RAM or CPUs their systems have. Additionally, how many times have you had a system mysteriously re...
uptimed One such tool that I came across many years ago is called uptimed. The project site is here: http://podgorny.cz/moin/Uptimed. This is a pretty straightforward install, given uptimed appears to be in most of the major distros' repositories. Installation $ sudo yum install uptimed Once installed the service nee...
Is there a tool for tracking uptimes across reboots?
1,400,911,121,000
How to know system uptime under battery ? so that i can get exact time of battery backup the uptime shows complete uptime (AC/Battery) NOTE : I am using linux Mint 17.
You can use UDEV to get the particulars about your system's battery. connected to power $ upower -i /org/freedesktop/UPower/devices/battery_BAT0 native-path: /sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0a/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 vendor: Panasonic model: ...
get system uptime on battery?
1,400,911,121,000
First and foremost I want to know how long my laptop (unix, apple, OSX 10.9 mavericks) has been 'awake' (i.e. how long its been open, or since it last 'slept'). I' also be interested in how long since the last restart, and time since the last shutdown (if those two things can be differentiated). I've tried the who a...
Use uptime command. Yes, it includes sleep time, if you don't want to include it see: How to find the uptime since last wake from standby?. There is no way to distinguish between restart and shutdown, without parsing logs.
How long system has been awake / running / since restart
1,400,911,121,000
I am having touble understanding what server resource is causing lag in my Java game server. In the last patch of my game server, I updated my EC2 lamp server from apache2.2, php5.3, mysql5.5 to apache2.4, php7.0, mysql5.6. I also updated my game itself, to include many more instances of monsters that are looped tho...
You notice the large values of st? Those are "stolen" CPU cycles -- cycles you can't use, because you have completely almost -- or fully -- depleted your CPU credit balance. The usage is 10% is averaged over some time window, probably 5 minutes. If you watch the output from top, you should see that 100% minus stolen...
CPU and Load Average Conflict on EC2 server
1,400,911,121,000
We all know we can get average CPU load as: uptime 10:09:22 up 2 days, 1:44, 1 user, load average: 20.01, 20.03, 22.05 but this shows only load average over the last 1 minute is 22.05 load average over the last 5 minute is 20.03 load average over the last 15 minute is 20.01 We want a list of load averages for t...
You would need additional software installed for that. You could use sar (see https://linux.die.net/man/1/sar ) or the monitoring-system of your choice. sar -q will report load averages (among others...) $ sar -q 1 5 Linux 4.9.0-9-amd64 (sds-ulm-edv-553-workstation) 09/10/2019 _x86_64_ (2 CPU) 02:04:43 PM ru...
CPU load average + how to get cpu load average for history of X hours
1,400,911,121,000
I am using the following 3 commands to check the latest time point when my computer is rebooted: last reboot who -b uptime The result for last reboot is: wtmp begins Sat Oct 9 04:49:27 2021 The result for who -b is: system boot 2018-01-11 20:52 The result for uptime is: 22:49:01 up 1372 days, ... It seems that t...
On Linux, all three commands use different sources of information by default. uptime uses the information given by the kernel in /proc/uptime. The latter contains two pieces of information: the system’s uptime, including time spent suspended, and the time spent in the idle process. These values are accurate. who -b us...
last reboot and who -b shows different results?
1,400,911,121,000
System uptime is stored in /proc/uptime. As you know, the Linux kernel has a jiffies variable which increments by each timer interrupt specified by the HZ parameter. I got the value ofHZ by the following command: $ zcat /proc/config.gz | grep CONFIG_HZ= CONFIG_HZ=300 In my machine, it's equal to 300. So I divided th...
Some/many (but not all) modern kernels add an offset to jiffies - it's a very large offset, basically it's 4294967295 - (300 * HZ) The 300 * HZ is a 5 minute offset so that the kernel always tests jiffy rollover So, for 300Hz that would be 4294877295 Subtracting that from the jiffies value, then dividing by HZ should ...
Why jiffies/HZ does not match uptime?
1,400,911,121,000
I need to log PC uptime. How I can do this? I use uptime for this and I will when ubuntu is shutdown write this command output in a file.
If you are using Ubuntu then add below lines in "/etc/rc0.d/S60umountroot" at the beginning. Log="/var/log/uptime.log" echo "$(date) $(/usr/bin/uptime)" >> "${Log}" or you can simply use logger logger "UPTIME: $(uptime)" then it will gives details in /var/log/syslog or /var/log/messages Note :- Please careful edit...
write pc uptime in a file in shutdown
1,400,911,121,000
I know this has been more or less asked before but I still don't have any answer. I started to investigate why on my system (it is a remote machine) who -b and uptime gave different results (~3 days for one / 5 days for the other). Some answers would say that maybe /var/run/utmp is corrupted. Some other answers would ...
the machine is remote/embed in a system.Sometimes the electricity is shut down. The internet connection is very slow Does the system have a clock and a battery in it?1 A lot of embedded systems don't. If not, this: Some other answers would say that the ntp server was launched after the reboot and so the system ...
last reboot/uptime/... strange behaviour
1,400,911,121,000
I want to convert uptime to date DD:MM:YY without the | and I want to put a string like "the computer is on since 23-feb-16"
You may get it for free from the output of last reboot: $ last reboot reboot system boot 4.14.81-i7 Sat Nov 17 23:25 still running reboot system boot 4.14.80-i7 Fri Nov 16 09:16 - 15:49 (06:33) $ printf "On since: "; last reboot | grep "still running" | cut -c 40-56 On since: Sat Nov 17 23:25 $...
Convert linux uptime to well format date
1,400,911,121,000
I was testing out the linux api while working on something but got stuck on the following output. [Abhii@localhost net]$ cat /proc/uptime 39135.53 149657.73 As per specs the first number should be the Uptime and the second number should be the time system has stayed idle. So why is the former less then latter ??? As ...
Idle time is the sum of all your CPU/core idle times, while uptime is the wall-clock time your system has been up. I'm guessing you have four CPUs/cores/threads.
System IDLE Time > System Uptime?
1,400,911,121,000
I was wondering how uptime is calculated. Is it simply the difference between now and boot time? More specifically-- If I were to boot up, run for 5 minutes, and put the machine to sleep for a year; Upon resuming, would my uptime show 5 minutes, or 1 year and 5 minutes? I find the verbiage in the man page a little va...
It depends on the system you are talking about. For Linux-based systems, you probably are using uptime from procps, which reads the data from /proc/uptime. To see this, read the source-code in its Git repository, e.g., uptime.c, which uses proc/sysinfo.c. According to CentOS documents 3.2.30. /proc/uptime This file ...
How is uptime calculated?
1,400,911,121,000
I would like to display uptime in common units (so not just in minutes if it is over an hour; also not just in seconds if it is over a minute; e.g., "1:02:30" for 1 hour, 2 minutes and 30 seconds would be my ideal time format) in my i3status bar. I have not even been able to find how to show uptime in the i3status bar...
I have found the solution. I simply did not understand its syntax well enough. I just had to edit my ~/.i3/i3status.sh file. It is now: #!/bin/sh /usr/bin/i3status -c $HOME/.i3status.conf | while : do read line RAM=`free -kh | grep Mem | awk '{print $3}'` TOTR=$(cat /proc/meminfo | grep MemT | sed 's/.*\:...
How to display uptime in i3status bar?
1,400,911,121,000
How can I see when my PC was rebooted? I need to know the last 10 times.
Edit: As @fpmurphy1 mentioned in a comment, there's no need for all the runlevel grepping below. A simple last reboot -n 10 will do. last -xF | grep -e 'lvl 2' -e 'lvl 5' | head -10 last is mainly used to check when and for how long a certain user was logged in (also see lastlog for that), but the log file it ...
How can I see when my PC was rebooted?
1,400,911,121,000
I'm trying to display my system uptime with i3status. This is what I have in my i3status.conf file: read_file uptime { format = "%title: %content" path = "/proc/uptime" } However the output is in seconds, as can be seen in this screenshot, which is obviously not ideal: Is there a way I am able to format this...
My solution 1. Create a very very short script Just create a new file and rename it uptime.sh; then just copy this: !#/bin/sh echo "$(uptime -p)" > ~/.config/i3/uptime this will append or write the output of the command uptime -p to a file which I chose to be in ~/.config/i3/uptime. The command uptime -p shows upt...
Format the output of "read_file uptime" in i3status
1,400,911,121,000
I am looking to build a script that will log in to multiple servers using a host file and run uptime, hostname -I and hostname Script so far echo"" ; echo "hostname:" $(ssh $HOST hostname) ; echo "IP:" $(ssh $HOST hostname -I) ; echo "uptime" $(ssh $HOST uptime) ; echo"" ; What would be the best way to accomplish m...
Assuming you just want all output in the terminal: #!/bin/bash hosts_file=/path/to/file username=youruser while read -r host; do hostname=$(ssh "${username}@${host}" hostname) ip_addr=$(ssh "${username}@${host}" hostname -I) uptime=$(ssh "${username}@${host}" uptime) echo { echo "Hostname...
uptime Script help [closed]
1,400,911,121,000
I need to create a script that will execute daily (cron job), calculate the uptime of the system, and if that number is greater than 72 hours, reboot the system. I am getting lost in converting the value of hours to something I can compare to 72. It returns me 6499.04: command not found #!/bin/bash if $(awk '{print $1...
I would do the whole test in AWK: awk '$1 > (72 * 3600) { print "yes" }' /proc/uptime If you want to use that as a test, use the exit code: if awk '{ exit ($1 < (72 * 3600)) }' /proc/uptime; then echo Need to reboot fi AWK evaluates ($1 < (72 * 3600)) as 0 if the comparison fails, 1 otherwise; 0 indicates succes...
How to check if uptime is greater than 72h?
1,400,911,121,000
I have many linux servers which I would like to check uptime but I have to login to every one. Is this possible to check linux server running time without ssh login to it? PS. My distributions are RHEL 7/8 and OL 8.
If your servers are in a trusted, secure network, all in one or just a few network segments, installing an old rwhod service and its clients (rwho and ruptime) might also fit the bill. In Debian, those services are still packaged and installable by just installing two packages (rwhod and rwho), so if your distribution...
System uptime without ssh login
1,400,911,121,000
I would like to set up my desktop computer (which is actually a server for the KVM guests I do my actual work in) to have a redundant root installation. If one drive dies I want to quickly get back to work without doing a full restore from backup, nor a system reinstall and reset all my settings and preferences. I t...
Depends on needs, but you have a few options. My personal choice is to use lvm mirroring on a root volume, and any other that is critical to my sanity (/home on my laptops and workstations). As for backups, you could tarball up or rsync your stuff to a remote host, or if it's a bit simpler even use git (works wonders...
Most ironclad way to make root installation redundant and maximize uptime? RAID, ZFS or something else?
1,400,911,121,000
I'm receiving an uptime in this format: 167h58m10.586582048s I want to transform it to seconds and discard the fraction part. I know awk could do that if only the received string had the same separator. That's not the case. How could I convert that to seconds?
If I try this: $ echo "167h58m10.586582048s" | awk -F '[hm.]' '{ print ($1 * 3600) + ($2 * 60) + $3 }' 604690 It works great. Thanks @steeldriver. I didn't know about that. I found this good article about Field Separators in awk.
Convert string time to seconds
1,400,911,121,000
I would love to get rid of this uname message when ssh'ing into the Debian 9 machine: Linux backup-server 4.9.0-5-amd64 #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04) x86_64 This line I would like to keep: No mail. I tried: ssh -q ... and setting: PrintLastLog no in the: /etc/ssh/sshd_config Then, I deleted the...
On Debian 9 there are files being executed upon ssh'ing into the server in the directory: /etc/update-motd.d/ All files in it will be executed upon successful ssh'ing if having an executable bit set. So in this case, first list all the files in it: ls -l /etc/update-motd.d/ and then investigating the contents with c...
How to suppress Debian uname message when ssh'ing into the machine? Plus changing it to something else, if possible
1,473,848,882,000
It looks like that you cannot create a brand new VM with virsh unless you already have a working XML file. I have just installed all the needed bits for QEMU-KVM to work, and need now to create my very first VM. How to? Hint: I don't have graphics!
There is quite a good walkthrough here. Essentially the tool you're wanting to use is virt-install, which you should already have if you have installed everything needed for QEMU-KVM. Here's the most relevant section. 6. Creating a new Guest VM using virt-install virt-install tool is used to create the VM. This tool ...
How to create a VM from scratch with virsh?
1,473,848,882,000
I'm trying to understand how all the components of the VM ecosystem fit together. What's the difference between: KVM QEMU libvirt Which is controlled by virsh and virt-install? This comment says that libvirt is an abstraction ontop of QEMU, which is an abstraction ontop of KVM. However the official QEMU docs say tha...
Qemu is the lowest level that emulates processor and peripherals. KVM is to accelerate it if the CPU has VT enabled. Libvirt provides a daemon and client to manipulate VMs for convenience. See also Difference between KVM and QEMU on Server Fault.
What's the difference between KVM, QEMU and libvirt?
1,473,848,882,000
In virsh how do I see which domains are marked as autostart? virsh list does not show which domains are marked as autostart.
From the man page:- virsh list --autostart should do it.
virsh, how to list autostart domains?
1,473,848,882,000
I'm trying to find the corresponding command to the buttons in virt-manager, I read about virsh help domain and I found start, shutdown and reset etc. But the one for Force Off is missing. Anyone know what that is?
virsh destroy, from man virsh Immediately terminate the domain domain. This doesn't give the domain OS any chance to react, and it's the equivalent of ripping the power cord out on a physical machine.
What commands in virsh corresponds to "Force Off" button in virt-manager?
1,473,848,882,000
I am running Ubuntu 18.04 (desktop) in a VM using Debian 9 and KVM as the hypervisor but running virsh shutdown BS-MS01 I get a message saying the domain is shutting down but the VM is actually still sat on the login screen. I have confirmed acpid is installed and running on the guest: ms01admin@BS-MS01:~$ sudo servic...
Seems like an event for the power button wasn't created automatically, not sure why? Created a new event handler here: sudo nano /etc/acpi/events/powerbtn With these parameters: event=button/power action=/sbin/poweroff Then restarted the service: sudo service acpid restart Now I'm able to shutdown the guest!
Unable to shutdown Ubuntu 18.04 guest using virsh-shutdown
1,473,848,882,000
here's a question for you that's been driving me round the bend. I've managed to find plenty of resource from folk that want to do the opposite from me i.e see a machine they created using virsh in virt-manager. However, I have a couple of VMs that I created through virt-manager that I now need to control using virsh...
You must have used different credentials when using virsh and virt-manager. Do everything under your user, or at least the same user every time instead. virt-manager and virsh are interfaces to the same libvirt VM database, but the user context makes a difference, so if you want to manage the same set of VMs, always u...
Using virsh to control VMs created in virt-manager [closed]
1,473,848,882,000
I am running CentOS 7 and was following a chapter in a book dealing with virtualization and creating storage pools. I successfully ran the following command, but I'm not sure what setting - - - - as the sourcepath actually does. virsh pool-define-as rhpol_virsh dir - - - - /var/lib/libvirt/rhpol_virsh Description of ...
A storage pool of type dir is a directory path. The only meaningful value is the directory path itself so all other parameters are ignored. In your example, /var/lib/libvirt/rhpol_virsh is a location in your filesystem that will be mapped to the storage pool rhpol_virsh. Another way of viewing this command, which I pr...
virsh and creating storage pools - What is sourcepath "- - - -"
1,473,848,882,000
I have a serial console working for a centos7 guest without graphics, which I access with virsh console vm. The guest has the appropriate console=ttyS0,115200n8 kernel command line parameter for it. Is it possible to configure additional consoles, so that I can say virsh console vm --devname vc1 and get a login prompt...
I frequently use multiple "consoles" on my VMs - one for an interactive console showing the boot-up and ending with a login prompt, and another to log all of that to a text file (usually /var/lib/libvirt/consoles/<domain>.log) I don't know if you can have multiple interactive "consoles" in a VM, but you can add as man...
Multiple virsh/kvm guest consoles without graphics
1,473,848,882,000
In a debian host with many users, I want to allow different users to create their own VMs, completely independent of each other. The closest relevant (non-root) way I have seen in guides is by connecting to the qemu:///system hypervisor . This is the system hypervisor which is shared among all users. What is more the ...
What you're using isn't KVM directly, but a management library called libvirt. You can specify a user which will have access to libvirt's setup (and thus creating VMs and pretty much running virsh commands) by adding the users to the libvirtd and kvm groups on the host. You can also use policykit to manage access, th...
how can I create a KVM guest 100% as a non root user?
1,473,848,882,000
Someone could answer me how make one prompt via pkexec when I've to use two command with authentication? My easy sample script: pkexec virsh net-start default; pkexec "/home/user/program"; I'm new in linux environmen, Thanks :)
Old answer.: May you take pkexec out of the script? Try create next script where you paste your code (without pkexec) and execute him via pkexec from your script. your script: #!/bin/bash pkexec ./new_script new script: #!/bin/bash your command: Edit.: New Answer After your conversation with @Thrig, I guess what you ...
One prompt pkexec - two command
1,473,848,882,000
I'm having an issue with viewing output from a virtual machine installed via virt-install. I first used this method, but it left me with the following immediately after running: Starting install... Connected to domain ApacheServer Escape character is ^] It sits here forever and no input is accepted into the terminal ...
So, it turns out that specifying your boot device with --cdrom /path/to/bootmedia.iso can be problematic when it comes to viewing output during boot up. Trying to install again, I noticed this warning pop up before the Starting install... text: WARNING CDROM media does not print to the text console by default, so ...
virsh: Connected to domain <name> Escape character is ^]
1,473,848,882,000
My virsh version 0.9.12.3 I created a Volume Group Pool via virsh. virsh pool-define-as vg1 logical --source-name vg --target /dev/vg Bad thing is, that /dev/vg does not exist, I made a typo. I tried to delete the pool by virsh pool-delete vg which resulted in error: Failed to delete pool vg1 error: internal error...
One can delete a pool without VolumeGroup like this: The files are stored in /etc/libvirt/storage as XML files. Just delete them.
How to delete a virsh pool without volumegroup?
1,473,848,882,000
Currently I have a virtual machine running, and I can see that with: # virsh list Id Name State ---------------------------------------------------- 1 vmname running Now I want to VNC into the machine, so I check the port: # virsh vncdisplay 1 127.0.0.1:2 Po...
You don't use port 2 of vnc console on vmname virtual machine, but you use 5902 port. You need to add 5900 to each output of vncdisplay command if you don't set up VNC port directly in virtual machine settings. To edit virtual machine configuration use edit command: edit vmname And edit line like this: <graphics type...
How do you change KVM VNC port at runtime, from the command line?
1,473,848,882,000
Searching for a good way to export all VMs from KVM nodes so I have some backups while doing in place OS upgrade of the KVM hosts. So far, I am using a hacky bash oneliner in order to dump all VMs as xml and list their disk paths for copying purposes: for vm in $(virsh list --all | egrep -v "ID|---" | awk '{print $2}'...
Example based on comments by myself and @fra-san: (I use a mixture of ZFS zvols, qcow2 and raw files for my VMs) # for vm in $(virsh list --all --name) ; do echo "$vm:" virsh dumpxml "$vm" | xmlstarlet sel -t -m '/domain/devices/disk' -m 'source/@*' -v '.' -n echo done debian10: /dev/zvol/exp/debian10 debian9: ...
How to export *all* VMs from KVM host
1,473,848,882,000
After an automatic update of CentOS to version 7.7 on Sep 17 2019 my QEMU/KVM virtual machines do not start when I reboot the hypervisor server. Trying to start the VM by hand gives this error: # virsh start mygreatvm error: failed to connect to the hypervisor error: no connection driver available for <null> Trying t...
The updates in CentOS 7.7 include an update to QEMU which needs a new package to be able to start QEMU/KVM virtual machines. # yum install libvirt-daemon-driver-qemu Then the virtual machines can be started right away (no reboot necessary): # systemctl restart libvirtd # virsh list Id Name ...
Why does my QEMU/KVM virtual machine not start after CentOS 7.7 update?
1,473,848,882,000
I have taken a snapshot recently to assist me build VMs quickly with the operating system I desire (through virsh), however, every time I build a VM, I would like to modify few files inside the img file before assigning the qemu img file to the VM such as, for example, the /etc/sysconfig/network-scripts/ifcfg-eth0 fil...
If you create the new image file in advance (e.g., using qemu-img create -f qcow2 -b <backing file> <new image name>) you could mount that drive as a loop device, then modify the files, unmount it and start the virtual machine. Mounting can be a little tricky at times since you have to skip past the partition table a...
Modifying files inside a snapshot (qemu img file)
1,473,848,882,000
When I create a VM using virt-install, the VM gets connected to the virbr0 network interface automatically by generating this XML configuration: <interface type="network"> <source network="default"/> <mac address="52:54:00:6a:40:f8"/> <model type="e1000e"/> </interface> Now I'm trying to replicate that. Checkin...
I finally figured it out! So this is what virt-install will do by default: sudo virt-install --network network=default,model=e1000,mac=00:11:22:33:44:55 And the equivalent with qemu-system-x86_64 would be: INTERFACE_NAME="$(sudo cat /var/lib/libvirt/dnsmasq/default.conf | grep "^interface=" | cut -d'=' -f2-)" sudo qe...
How to tell qemu to use a specific MAC adderss on a network bridge?
1,473,848,882,000
Very strange situation on Slackware-current. With libvirt-6.8.0 compiled by source. Let start bash completion virst st<TAB> virsh start OK virsh start --dom<TAB> virsh start --domain OK virsh start --domain <TAB> Display all 235 possibilities? (y or n) 235 possibilities? I have only 15 domains configured and the 23...
Solution found. I think libvirt read completion from /usr/share/bash-completion/completions/vsh But read from an "intruder" old file in /etc/bash_completion.d/virsh_bash_completion I solved copy this file into /etc/bash_completion.d/virsh_bash_completion sudo cp /usr/share/bash-completion/completions/vsh /etc/bash_c...
Libvirt and bash completion on Slackware-current: why domain is not completed?
1,473,848,882,000
The server1's correct state is shut off but when i run the command as normal user it shows the state as running for normal user and shut off with sudo [msingh@localhost VMFiles]$ virsh list --all Id Name State ---------------------------------------------------- 1 server1 ...
By default, sudo virsh will access the system libvirt instance. virsh as an unprivileged user, will try to access the libvirt instance for that user. You have a VM called server1 in the user instance, and a VM called server1 in the system instance, but these are not the same VM :). Your output shows they have differe...
Why does "virsh list --all" shows running as normal user but "shut off" with sudo?
1,473,848,882,000
in short: My virtual machine named CONAN01 is not starting up in gnome-boxes, I receive/see different errors and do not know what the real issues behind them are: Error 1: When starting gnome-boxes from the Gnome desktop environment and clicking on my virtual machine CONAN01 to start it up, I receive a pop-up message ...
The solution is to enable networking on the qemu-instance qemu:///session, because gnome-boxes creates the virtual machines on that instance, which is by default not able to have sophisticated networking access. Either enabling it by giving qemu-bridge-helper a setuid bit: sudo chmod 4755 /usr/lib/qemu/qemu-bridge-hel...
How to fix (several) VM start-up issues in gnome-boxes?
1,473,848,882,000
I have created a Ubuntu VM on a server running Ubuntu Server 16.04.5 LTS using the following command: sudo virt-install \ --name TEST \ --memory 2048 \ --vcpus 2 \ --location 'http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/' \ --os-variant ubuntu16.04 \ --disk path=/pools/pool0/images/vm/test...
For anyone curious, I did not find a solution to the issue. However, I managed to avoid the issue by hosting a samba share on the host (using the dperson/samba docker container) and then on the guest, I installed cifs-utils and then added this line to \etc\fstab: //192.168.1.7/Shared /media/shared cifs guest,uid=10...
Libvirt Ubuntu VM: files created on guest in shared folder given root-only access on host
1,383,242,434,000
On my 240 GB SSD I had at first two partitions, one containing the Logical Volume with Linux Mint and the other had contained a NTFS partition to share with Windows. Now I removed the NTFS partition and want to extend my logical volume group to use the released disk space. How do I extend the volume group, my logical ...
The question was solved, after reading this blog post. I will write the solution in short form: boot from a live cd with use gdisk (if you use GPT) otherwise you could go with good old fdisk note your partition settings, in my case gdisk -l /dev/sdb delete your partition with create a new partition with the exact sam...
How do I extend a partition with a LVM and the contained physical volume and logical volume?
1,383,242,434,000
I use ArchLinux, and I recently installed Spotify which is working fine, except for one thing: Every time any program triggers a system sound, the player volume is automatically muted in the mixer. How can I stop this? I have verified that this also is happening with vlc, so I'm guessing is something related to Gnome....
The problem lies in a PulseAudio module called module-role-cork which exists to pause music and video during phone calls. All applications are given a media-role property which can be either music video or phone. The Cork module will give any application tagged phone exclusive access to the PulseAudio server and pause...
How to stop gnome from muting my music?
1,383,242,434,000
I have a text status bar on a tiling window manager and I am using tcl to feed information to it. At the moment I need a command line that output the volume level 0% to 100%. I am using Arch Linux.
A one-liner to parse amixer's output for volume in a status bar: awk -F"[][]" '/dB/ { print $2 }' <(amixer sget Master) Edit: As of November 2020, the updated amixer for Arch Linux is 1.2.4 which has no 'dB' in the output. So, the command should replaced by: awk -F"[][]" '/Left:/ { print $2 }' <(amixer sget Master)
How to get volume level from the command line?
1,383,242,434,000
I would like to check the current volume level from the CLI on my Mac. I know I can set it like this: osascript -e 'set volume <N>' But that doesn't seem to work when trying to get the current volume level. $ osascript -e 'get volume' 4:10: execution error: The variable volume is not defined. (-2753)
You should find that get volume settings will return an object containing among other things the output volume and the alert volume. So for example you could do this to retrieve the entire object: osascript -e 'get volume settings' or rather maybe this to grab just the output volume (e.g. rather than the alert volum...
Get the current volume level in OS X Terminal CLI?
1,383,242,434,000
The LUKS / dm-crypt / cryptsetup FAQ page says: 2.15 Can I resize a dm-crypt or LUKS partition? Yes, you can, as neither dm-crypt nor LUKS stores partition size. I'm befuzzled: What is "resized" if no size information is stored? How does a "resize" get remembered across open / closes of a encrypted volume?
It's about online resize. For example if you use LVM, create a LV of 1G size, and put LUKS on that, it's like this: # lvcreate -L1G -n test VG # cryptsetup luksFormat /dev/mapper/VG-test # cryptsetup luksOpen /dev/mapper/VG-test lukstest # blockdev --getsize64 /dev/mapper/VG-test 1073741824 # blockdev --getsize64 /dev...
What does `cryptsetup resize` do if LUKS doesn't store partition size?
1,383,242,434,000
I am using OpenStack Cloud and using LVM on RHEL 7 to manage volumes. As per my use case, I should be able to detach and attach these volumes to different instances. While updating fstab, I have used defaults,nofail for now but I am not sure what exactly I should be using. I am aware of these options: rw, nofail, noat...
As said by @ilkkachu, if you take a look at the mount(8) manpage, all your doubts should go away. Quoting the manpages: -w, --rw, --read-write Mount the filesystem read/write. This is the default. A synonym is -o rw. Means: Not needed at all, since rw is the default, and it is part of the defaults option nofail Do...
When and where to use rw,nofail,noatime,discard,defaults?
1,383,242,434,000
Can anyone help ? I have 2 disks spanning my main partitions. 1 is 460Gb and the other is a 1TB. I would like to remove the 1TB - I would like to use it in another machine. The volume group isn't using a lot of space anyway, I only have docker with a few containers using that disk and my docker container volumes are o...
Since the filesystem you'll need the disk removed from is your root filesystem, and the filesystem type is ext4, you'll have to boot the system from some live Linux boot media first. Ubuntu Live would probably work just fine for this. Once booted from the external media, run sudo vgchange -ay ubuntu-vg to activate the...
How to remove a disk from an lvm partition?
1,383,242,434,000
I have two hard drives of different physical sector size. I would like to create an LVM volume group with them, however, when I do so with vgcreate, I get a warning telling me that the two disks have different physical sector size. Is there something to be concerned about?
You don't want to mix different sector sizes in a single VG. Newer versions of LVM don't even allow creating VG on PVs with mixed sector sizes by default (older versions show only the warning message you saw). The problem is not with the VG, but with the LVs and filesystems -- if you resize or move LV to the larger se...
Is there any risk to create an LVM group with two disks of different physical sector size?
1,383,242,434,000
I am setting up a redhat ec2 instance and by default the software I am using (called qradar) created the following volumes on the two 500g ebs storage devices attached to the instance: $ lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert storetmp rootrhel -wi-ao---- ...
An extra 80 GB in EC2 EBS costs something under $12 per month. On-line manipulations are likely to take more than one hour of your work, and a risk of downtime if something goes wrong - how much is that worth for you? Pay for some extra capacity, add it to your instance as a third disk xvdc, initialize it as a LVM PV ...
Volume Management: How to move space from one partition to another?
1,383,242,434,000
Using mate and linux mint, I would like to create another keyboard shortcut to increase and decrease the volume. Currently, I'm using custom keyboard bindings with mate-keybinding-properties. I bought a wireless headset which includes buttons to change the volume. Those buttons works well if I reconfigure the keybindi...
You can use pactl to change the volume. Eg, to increase: pactl set-sink-volume 0 +10% And to decrease: pactl set-sink-volume -- 0 -10% You need the -- here to make pactl interpret the -10% as a postitional argument. The first number is the sink to use, this may not be 0 on your system. To list the possibilities: pac...
Change volume with terminal
1,383,242,434,000
I currently use custom created keyboard shortcuts to change the volume of my computer. The terminal commands I use are: amixer sset Master 3%+ amixer sset Master 3%- This changes the volume of the "Built-in Audio Analog Stero" levels in the picture below. However, this does not control the volume of my bluetooth devi...
You are running Pulseaudio, which uses ALSA to drive soundcards, but which connects to Bluetooth speakers without involving ALSA. When you set ALSA volumes with amixer, Pulseaudio notices and corrects the source/sink volumes (actually using a somewhat complicated algorithm, because ALSA volumes can be chanined), but n...
Change volume on bluetooth speaker with amixer
1,383,242,434,000
In order to expand a Logical Volume, I had to split the cache off from it: root@server:/home# lvextend -L+50G /dev/vg1/home Unable to resize logical volumes of cache type. root@server:/home# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert home vg1 Cwi-a...
Answering in case someone is looking for this (or the future me): lvconvert --type cache --cachepool cache-pool vg/lv So in this case: lvconvert --type cache --cachepool homeCache vg1/home You can see all the LVs, including the caches, with: lvs -a
Reverse "lvconvert --splitcache"?
1,383,242,434,000
$ neofetch OS: Pop!_OS 21.10 x86_64 Kernel: 5.15.8-76051508-generic I have two Bluetooth devices: a speaker SoundCore Boost and headphones EDIFIER W830BT. When I'm trying to change the volume on headphones using system volume settings it does work. Headphones also have buttons on them for controlling volume and thos...
Disable absolute volume in Pulseaudio's config. Edit the file /etc/pulse/default.pa And change the line load-module module-bluetooth-discover to load-module module-bluetooth-discover avrcp_absolute_volume=false Credit for this solution goes to https://www.reddit.com/user/mmstick/ https://www.reddit.com/r/pop_os/co...
Bluetooth speaker volume control doesn't work (but muting does work)
1,383,242,434,000
This is something that has been bugging me for awhile and I haven't been able to find a fix yet. Whenever I change the system volume using the hardware volume keys on my laptop, it also changes the Spotify volume (it moves the Spotify volume slider as well as the system volume slider). Is there a way to prevent this f...
ERROR: type should be string, got "\nhttps://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting#Per-application_volumes_change_when_the_Master_volume_is_adjusted\nIt's a pulseaudio default setting to link all the volumes together. Setting\nflat-volumes = no\n\nin /etc/pulse/daemon.conf should fix that!\n"
Changing system volume also changes Spotify volume (Arch Linux)
1,383,242,434,000
I currently have 3x1TB physical volumes in a VG and a LV that spans the entire capacity of the VG. This LV is meant to store specific files. Now I have another 2TB drive that I want to use LVM with. This will end up being part of an LV (again, using max capacity) that will be used to store different kinds of files. Sh...
Most importantly, you can't have an LV spanning two different VGs. Also, there's no tool to move a logical volume to a different volume group. You can do it indirectly by creating a LV on the target VG, deactivating the source LV, copying the raw content, and activating the target LV. And there's no tool to move a phy...
When should I create a new volume group instead of a new logical volume?