date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,617,985,139,000 |
On our cluster we use LMOD to load specific pre-installed modules dynamically (like PyTorch or some other scientific packages). On top of that I want to run some code with the DeepSpeed framework which allows for optimisations to run distributed code across nodes. Under the hood it uses pdsh. The issue that I have is ... |
Inspired by doneal24's comment, I solved my issue by loading the modules only when we ssh into a specific node that has a hostname that starts with gpu.
if [[ $(hostname) == gpu* ]]; then
module load PyTorch/1.12.0-foss-2022a-CUDA-11.7.0;
module load pdsh/2.34-GCCcore-11.3.0;
fi
| Detect a pdsh session |
1,427,574,372,000 |
I am running Linux Mint 17.1 64-bit (based on Ubuntu 14.04). Ever since upgrading from Linux Mint 14/Ubuntu 12.10, the Python script I use to sync music to my Walkman has stopped working.
Previously, when I mounted my Walkman, it would automatically show up as the path /run/user/1000/gvfs/WALKMAN/Storage Media and wou... |
A guess: you are now actually using MTP for accessing your Walkman, and MTP sucks.
Details
The Operation not supported error could indicate that your Walkman uses an MTP implementation that doesn't support "direct" access. According to http://intr.overt.org/blog/?p=174 this kind of direct access is an Android-specific... | Unable to perform file operations on a MTP device mounted via GVFS: "Operation not supported" |
1,427,574,372,000 |
I have installed mtp-tools on my debian7.8.
mtp-files can list all my files on android phone.
How can I mount all my files on android phone on the directory /tmp/myphone?
root@debian:/home/debian# jmtpfs -l
Device 0 (VID=0b05 and PID=0c02) is UNKNOWN.
Please report this VID/PID and the device model to the libmtp de... |
Install jmtpfs (aptitude install jmtpfs) which allows to mount MTP devices.
Create the directory if it doesn't exist already (mkdir /tmp/myphone). Then, the following will mount your phone:
jmtpfs /tmp/myphone
jmtpfs will use the first available device. If you've got more than one connected at a time, you can do jmtp... | Mount my mtp in my android phone on a directory? |
1,427,574,372,000 |
So I'm trying to share files between the Samsung Galaxy S5 with Android and my Debian9/KDE machine using MTP instead of KDE Connect.
The problem is that I keep getting:
The process for the mtp protocol died unexpectedly.
When trying to copy over files.
It also often says
No Storages found. Maybe you need to unlock ... |
Install the jmtpfs package
apt install jmtpfs
Edit your /etc/fuse.conf as follows
# Allow non-root users to specify the allow_other or allow_root mount options.
user_allow_other
Create an udev rule. Use lsusb or mtp-detect to get the ID of your device
nano /etc/udev/rules.d/51-android.rules
with the following line... | How to get the Samsung Galaxy S5 to work with MTP on Debian 9? |
1,427,574,372,000 |
I recently wanted to connect some LG Android smartphone to my Debian, but the device wasn't detected. I installed the jmtpfs package, and that solved the problem. But in Debian, you have two packages with similar names: mtpfs and jmtpfs. What's the difference between the two? On the Debian wiki there's info that the m... |
That's precisely it! If a package is orphaned and another has taken its place you almost always want to go with the non-orphaned one for support, updates etc.
In this specific example, as the wiki page you linked says, the only real differences are the name and package status.
| What's the difference between mtpfs and jmtpfs packages in Debian? |
1,427,574,372,000 |
I would like to mount my Samsung Galaxy S7 to an folder using simple-mtpfs and I cannot do it as I used to (on previous Fedora and older Galaxy S4).
If I simply plug S7 to my computer, I can browse it using Nautilius, but I cannot access it in terminal as ordinary folder, what is exactly what I want to achieve.
Every ... |
This is an old question, anyway, now in 2023 I can manage a Samsung phone with Android version 9 via Firefox as well as by command line (gnome-terminal) in Ubuntu Desktop 22.04.x LTS.
When the phone is connected via USB (and mounted automatically), I find the path to it using this command,
find /run/user/*/gvfs -maxde... | Mount Samsung Galaxy S7 using simple-mtpfs |
1,427,574,372,000 |
I'm using Moto G4 play with Marshmallow; and CentOS 7. I'm able to mount the device and see the content as root, by using jmtpfs. First time I used sudo then I switched as root and then mounted, works fine on both occasions; but files are only visible for root user. personal user is not able to access the content
[shi... |
Un-comment the user_allow_other on your /etc/fuse.conf file.
Mount your android device with allow_other option on your home directory without sudo :
$ mkdir phone
$ jmtpfs -o allow_other phone/
| How to make Android MTP in CentOS7 available for all users? |
1,427,574,372,000 |
I am running Debian Linux 11 with LXDE and I am trying to connect a Galaxy Tab A tablet.
When I do, I get the Removable Medium Is Inserted dialog with the type of medium being "removable disk" and the only action available is "Open in File Manager". I click OK and I get an Error dialog box with the do-not-enter icon ... |
There is a common library used to handle the Media Transfer Protocol. Installing various related MTP tools (and thus their dependencies) will ensure that the actually needed libraries and other required components are present.
From comments it appears installing some or any of packages jmtpfs, mtp-tools, libmtp-runtim... | How do I resolve "The name was not provided by any .service files" when connecting Galaxy Tab A via USB? |
1,427,574,372,000 |
Have two Android phones Motorola and HTC both not working on Cinnamon 18.
They were both working on Cinnamon 17.2.
I have installed MTP tools. The commands mtp-detect and lsusb both return Vids and Pids with no apparent errors.
Plugging in the phones I select File Transfers but nothing happens ie no connection sound a... |
Solved
The problem was "Gvfs-Backends" package was not installed. Installed it via Synaptic Package Manager. How it became uninstalled is a mystery. I found this by comparing Gvfs packages on a working laptop to the not working laptop in the Synaptic Package Manager, for those who may encounter this problem. So ev... | MTP File Transfer not working on Linux Cinnamon 18 |
1,427,574,372,000 |
Have a current project where I'm trying to figure out a way to copy files(a video) from a MTP device over USB.
From the wiki I discover there is an open-source implementation called libmtp. Has anyone reading this used this? Any examples, tutorials?
I'd prefer to run Ubuntu with MATE.
Unix-like systems
A free and open... |
You should install the required packages:
sudo apt-get install libmtp-dev mtp-tools mtpfs
Connect your device then run mtp-detect, this command will detect and give you some information about your device.
Run mtp-connect then mtp-folders to display your folders with their ID
the mtp-files will display your files/fold... | Copying file from MTP device using libmtp (over USB) |
1,427,574,372,000 |
Apparently Motorola's phones have MTP disabled (?) and can't find a way to transfer the files to my computer. Have read a bunch of links and none of them work. Have created the file /etc/udev/51-android.rules (sources 1 and 2) and /etc/udev/69-libmtp.rules (source) as the links show and nothing works.
The 51 file as ... |
If the MTP function is not available you can transfer your file through FTP.
The easy way :
install the Wifi File Transfer application on your android
device
Start the application , it will give you the username , the password and the url e,g 192.169.1.150:3332 ( the 3332 port should be allowed through the firewall )... | mount moto g on debian |
1,427,574,372,000 |
I have ~/srv/mtp, which I do not remember how I created. It was back when I was trying to set up a MTP mountpoint using various tools for that.
Currently I can't do anything to the directory.
○ file mtp
mtp: ERROR: cannot open `mtp' (Input/output error)cannot read `mtp' (Is a directory)
○ ll | grep mtp
ls: cannot acc... |
Since it's a FUSE fs mounted on the mountpoint, you use the ordinary FUSE unmount method:
fusermount -u /home/sh/srv/mtp
If that fails, you can try:
fusermount -u -z /home/sh/srv/mtp
| How can I delete a former MTP directory, which now gives me input/output error whenever I try? |
1,427,574,372,000 |
I can't figure out, how to access an Android 7.0 phone's storage via MTP from terminal?
Phone: Honor 8
System: Linux Mint 18.3 Cinnamon 64-bit
I can access it via Nemo file manager as:
mtp://[usb:003,002]/
But I can't see it inside neither:
/var/run/user/$UID/gvfs/
, nor inside:
/run/user/$UID/gvfs/
I also tried to... |
In Debian 9, there's a FUSE-based filesystem jmtpfs, packaged with the same name. It seems to work quite well with Android 8 at least. Perhaps it is available as a package for Mint too?
As it's a real FUSE filesystem, it is actually mountable, and so usable from the command line.
The source code and the developer's in... | How to access an Android 7.0 phone via MTP from terminal? |
1,427,574,372,000 |
After upgrading to kali 2018(kernel 4.14), Something went wrong. Whenever I connect my android device to any of the USB port, it logs out and system returns to logging on screen, shutting down all the processes. After logging in, it behaves like the computer has been shut down.All the work/processes are lost.
I tried... |
I found the solution here.
It is a bug produces by a gnome-shell extension called "places status indicator".
Disabling this extension solves the problem.
To disable this extension, go to terminal and type
gnome-shell-extension-prefs
and scroll down to places status indicator and turn it off.
| Kali Linux 2018 crash when connecting an USB device |
1,427,574,372,000 |
Linux: build based on the Thinstation 6.2 project (on systemd)
Task: automatic mounting of MTP devices (namely Android phones) when connected to a thin client
Problem: error loading the distribution when the device is connected or incorrect mounting of the device.
Software used when mounting: simple-mtpfs, android-f... |
I finally managed to solve the mounting problem! I spent three weeks searching for a more adequate solution.
To begin with, I applied these changes to the rules script for Android devices 51-android.rules /etc/udev/rules.d/51-android.rules:
diff --git a/51-android.rules b/51-android.rules
index d75ddb3..65f235c 100644... | Mount MTP devices using systemd |
1,414,097,018,000 |
I am setting up a server where there are multiple developers working on multiple applications.
I have figured out how to give certain developers shared access to the necessary application directories using the setgid bit and default ACLs to give anyone in a group access.
Many of these applications run under a terminal... |
Yes, you can do it with screen which has multiuser support.
First, create a new session:
screen -d -m -S multisession
Attach to it:
screen -r multisession
Turn on multiuser support:
Press Ctrl-a and type (NOTE: Ctrl+a is needed just before each single command, i.e. twice here)
:multiuser on
:acladd USER ← use userna... | Sharing a terminal with multiple users (with screen or otherwise) |
1,414,097,018,000 |
I'm looking to completely decommission my SMBA service and replace it with a WebDav service.
All the google searches so far have pointed me to using Apache / Webdav. This is close to what I need but as far as I read it requires Apache to have access to my user's files and worse; if it creates a file the new file will... |
Having searched for a long time I just couldn't find one. There are many multi user servers but I couldn't find one which executed as the system user.
So I wrote one myself. This is only tested as far as I can test it myself. But for what its worth, the source code is here:
https://github.com/couling/WebDAV-Daemon
| Is there a multi-user webdav server available for linux? |
1,414,097,018,000 |
Lets pretend we had a *nix rather powerful system...
Now Obviously I know you can set up multiple users to login to a system.......but how exactly do you do that? Like....how would all the monitors connect and such, or would you need a smaller computer node that like....reroutes it or something?
How do System Admins ... |
Generally, one runs a server with no actual graphical display attached to it (maybe a very simple one for diagnostic work). Clients connect via a network protocol, either X tunneled over SSH or a remote-desktop protocol like VNC or RDP.
With the former, users execute GUI programs from the remote shell and they show up... | Multiple Users on a Desktop Environment [closed] |
1,414,097,018,000 |
I mean, if two users have the same name, how does the system know that they're actually different users when it enforces file permissions?
This doubt came to my mind while I was considering to rename my home /home/old-arch before reinstalling the system (I have /home on its own partition and I don't format it), so tha... |
In Unix, users are identified by their ID (uid), which must be unique (in the scope of the local system).
So even if it were possible to create 2 different users with the same name
(adduser on my system refuses to do this, see this question for further information Can separate unix accounts share a username but have ... | How does Linux identify users? |
1,414,097,018,000 |
I intend to use Ruby when programming my Raspberry Pi which is running the Debian based Occidentals. Via SSH, I executed:
curl -L https://get.rvm.io | bash -s stable --ruby
which downloaded the ruby source and compiled it. It tool about 2 hours to complete. I would like to use ruby via AdaFruit's WebIDE - http://lear... |
Don't dismiss RVM's value
You can use the repository version of Ruby but I would recommend going another way and using RVM to manage Ruby. I realize it might seem like it's slowing you down, but the version of Ruby that's deployed via the repositories though usable will often lead to problems down the road. It's gener... | Making ruby available to all users |
1,414,097,018,000 |
I am looking for a simple way to create a permanent alias for all users. So ~/.bashrc or ~/.bash_profile is not an option.
Hasn't anybody created a program for this? I think it should be a very common need. If not, I can always create a custom Bash script, but I need to know if there is a equivalent of .bash_profile f... |
Please have a look at bash manual:
/etc/profile
The systemwide initialization file, executed for interactive login shells
/etc/bash.bashrc
The systemwide initialization file, executed for interactive, non-login shells.
~/.bash_profile
The personal initialization file, executed for interactive login shells
~/.bashrc
T... | How to create permanent aliases on Unix-like systems? |
1,414,097,018,000 |
I'm a software developer and I have a new laptop with Ubuntu.
I plan to set up this laptop as a development workstation where I'll do my professional work (for my company) and also I'll develop some personal/home software.
I want to have my professional stuff (applications, software libraries, configurations, etc.) se... |
Absolutely!
From a security perspective separation is a Good Thing (tm) - as your professional and personal usage may have very different risk profiles.
At work you may deal with code for clients, personal data for thousands of individuals, configuration of network devices etc., and that usage may be regulated (depend... | Is it a good practice to have different users for different contexts? |
1,414,097,018,000 |
Our class is finally installing Mint Linux on our machines. The problem is our teacher is scared that we'll play war games against the two classes that use the computers. His solution is to install two separate operating systems; due to that fact, that we will need sudo ability, but he doesn't want us to be able to br... |
There are two obvious answers:
Give each user his own virtual machine image. Inside the virtual machine, the user has root access; outside the virtual machine, none at all. If your hardware supports it, kvm will work pretty well for this. And virtual machine images are just files, so they're easy to copy around, etc.... | Fully separate two accounts without installing separate operating systems? |
1,414,097,018,000 |
I'm administrating two ubuntu desktops and one debian server.
There are abount ~20 active users on the desktops. A few (5-10) user accounts are added each year and about the same amount become inactive.
I would like to share the user accounts and their respective homes between the two pcs. So far, my plan was to set ... |
You can use a configuration management system to do this. Personally, I use Puppet for this. I have a single /etc/passwd and /etc/shadow file and I have Puppet sync it across all my systems. There is an interesting learning curve with them, but definitely tutorials for doing exactly what you want on their website.
I w... | Easiest way to manage users for two machines |
1,414,097,018,000 |
I would like to find files accessed by specific user (even just read) within a folder tree. I thought the find command had this option, but it actually just searches for owner user. Is there any other command, or command combinations? The stat command offers access information, but doesn't display the user who made ac... |
This information is not stored by traditional filesystems. You have three main options:
See who is accessing it in real time using lsof/fuser or similar;
Set up auditing (take a look at auditd);
Use something like LoggedFS.
| Unix command to find files read by specific user |
1,414,097,018,000 |
Is there a graphical tool that shows (edits) all users and groups on the system, so that one can avoid editing /etc/passwd and /etc/group directly?
GNOME Settings (gnome-control-center) Users view lets only see desktop users and no groups at all.
|
Programs satisfying the requirements are:
Users and Groups (system-config-users), developed by Red Hat, included in RHEL/CentOS 7, has SELinux build dependency, deprecated.[1][2][3]
KUser (kuser), developed by KDE project, included in 4.x versions, unmantained.[4]
Mostly identical, after installed they will be acces... | Is there a GUI to edit/add users and groups |
1,414,097,018,000 |
Would it be difficult to increase the limit or would it just be a one-place change?
I have a system that could really elegantly make use of the Unix multiuser model for process isolation but I'd need much longer usernames than just 32 characters.
Is the name length standardized (POSIX)?
|
Don't try making the login name longer, you'll probably find loads of places it breaks.
Note that you don't have a problem with the number of possible login names (you only get UID_MAX-UID_MIN uids anyway, which is 59,000 on my system).
The problem is just with how descriptive they are, but fortunately there's anothe... | Linux/Unix username length limit |
1,414,097,018,000 |
I was going to use the "multiuser" option for mount.cifs, but /var/log/messages reports:
kernel:CIFS: unknown mount option multiuser
Kernel is 2.6.18-433
mount.cifs is 1.12RH
I can't find information which version of mount.cifs is supporting multiuser. I guess RHEL 5.11 and its kernel are too old for it? Can anyone... |
This document seems to say that multiuser was added in cifs-utils 4.7:
Originally by Igor Druzhinin in cifs-utils 4.7 and overhauled in 5.3. Kernel support in 3.3
The reference was rather oblique. Corroborating information seemed needed. Version control may indicate the same as 4.7 is where the man page was added:
... | mount.cifs not supporting 'multiuser'? |
1,414,097,018,000 |
We usually see personal web pages like http://example.com/~someone/, in this case, "someone" is a user of "example.com".
How to enable this by default, so whenever we add a new user "foo", then http://example.com/~foo/ is created automatically? Is the tilde in "~someone" optional, customizable?
Software environment:
W... |
For Yaws, you're looking for the tilde_expand configuration option.
There is nothing magical about the ~ character, but it is so common that I wouldn't recommend trying to circumvent it. If you want to forgo it completely, then give users the ability to edit content in /var/www/htdocs/<username>/ themselves.
| Creating a public document directory for a normal user |
1,414,097,018,000 |
I have a different user for each of my own work areas on my system. This is to keep bookmarks, files and other defaults separate.
Several "users" are generally logged in at once and I just switch between them when I change which project I'm working on in that moment.
I am using Ubuntu 18.04 with Gnome Desktop Environm... |
Probably, the way to achieve this is using dbus. This is a mechanism of communication amongst disparate tasks that is highly generic and so quite difficult to use. You should be looking for events, called signals, sent over the bus by things like the systemd logind daemon and the gnome screensaver.
There are at least ... | How do I keep track of when each user is actively using the GUI on Ubuntu? |
1,414,097,018,000 |
I have two users on my Mac. Both are me, but one is work mode, the other is non-work mode. I have an ongoing issue with installing via homebrew.
$ brew install x
Error: Can't create update lock in /usr/local/var/homebrew/locks!
Fix permissions by running:
sudo chown -R $(whoami) /usr/local/var/homebrew
Of course, exe... |
I don't know about homebrew in particular, but in theory you could use sudo to install software. Then files are accessed with root privileges, which may or may not be what you want.
In general though, if you want multiple unprivileged users to be able to write to the same location, it isn't the owner of that locatio... | Multiuser Homebrew privileges |
1,414,097,018,000 |
I could use some help with what I think is a basic request on the newest edition of Linux Mint (which I think would also be applicable to Ubuntu).
I have a home system with 3GB of RAM and accounts for family members (4 of them). As the initial login process takes 15-20 seconds and kids are impatient, I'd like a way to... |
Assuming you already have one user that auto-logs in, you can probably use a script that runs after logging in (use gnome-session-properties) that:
gets a list of users to auto-login from some file
checks for each of those users if they are logged in yet
if one is not, use xdotool to switch to the first user (by sim... | Auto-start multiple background user sessions in Linux Mint |
1,414,097,018,000 |
What happens if two git pull command are run simultaneously in the same directory?
|
git does file locking to prevent corrupting the repository. You may get messages like
error: cannot lock ref 'refs/remotes/origin/develop': is at 2cfbc5fed0c5d461740708db3f0e21e5a81b87f9 but expected 36c438af7c374e5d131240f9817dabb27d2e0a2c
From github.com:myrepository
! 36c438a..2cfbc5f develop -> origin/develo... | Running two git commands in parallel |
1,414,097,018,000 |
Let's an user A (userA) wants to run in his graphical session a graphical application as user B (userB). How is it done it on a modern GNU/Linux system?
|
Short answer
Install the
run-as
scripts and run:
run-as -X <user> <command>
Long answer
Write and run a script to authorize userB to access userA graphical session.
/home/userA/.local/bin/xhost_userB
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
xhost +si:localuser:userB
Optional: allow access at login.
/home/userA/.config/a... | How to run a graphical application as another user? |
1,414,097,018,000 |
What are the best practices for a Debian Squeeze + Grsecurity/PAX based system when multiple, and therefore insecure, websites must run on the same server? I mean how can I mitigate an attack, so that if UserX's website got hacked, the other hosted sites remain intact etc.? Are there any good guides on this topic?
|
I would start by reading http://wiki.apache.org/httpd/PrivilegeSeparation
| Best practices for secure, separated virtualhost LAMP environment |
1,414,097,018,000 |
ps aux output (only line of interest shown)
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
472 24070 0.0 0.7 1636608 59416 ? Ssl May09 10:53 grafana-server --...
id to username lookup yields nothing
$ id -nu 472
id: ‘472’: no such user
username to id lookup yields nothing
$ i... |
From the info in the comments I'll guess you are running Grafana in a docker container and you are running ps on the host.
The 472 user is the grafana user in one of the containers which is why you can't find it in the host's /etc/passwd file
| USER shown in `ps aux` but not found /etc/passwd |
1,414,097,018,000 |
we know that runlevl of multi user mode is
N 5
but on our redhat 7.2 we get the following
runlevel
5 3
what is the meaning of this run-level ?
how to change this machine to multi user mode ( full permissions )
and when we do
who -r
we get
run-level 3 last=5
Note - we perform reboot/init 6 , but s... |
what is the meaning of this run-level ?
It means that word has still not percolated everywhere, even after it being explicitly stated in the systemd manual for its runlevel command since 2010, that this concept is obsolete.
Forget about run levels.
Your operating system does not have run levels. As explained at l... | runlevel + what is runlevel 5 3 in redhat linux |
1,414,097,018,000 |
I want to set up a server that hosts git repositories over ssh and https with client certificates. I don't want any snazzy GUI or anything like that (i.e. not Bitbucket, GitLab, etc) I want a bare minimum configuration for hosting repositories only.
However, I do want user separation between repositories.
I already h... |
I did this a few years back for SVN. I set up one Unix account. i.e. git@
Added user keys to ~git/authorized_keys, with the extra stuff to run the server (i.e. git-shell) when the user logs in.
So far exactly what you said in paragraph 4.
The bit that you are missing is that each entry in ~git/authorized_keys passes a... | Setting up a git server with ssh access |
1,414,097,018,000 |
On my personal laptop I'm using Fedora 29 and have two user accounts for myself; let's call them "personal_admin" and "personal_user". My personal_admin account is strictly for administrative tasks (installing software and updates mostly), which my personal_user account is for day-to-day use. Is this overkill?
How s... |
From a security perspective, switching VTs directly and using GNOME’s “switch user” are equivalent. The “switch user” feature is more about making it user-friendly, than it is about security: it means you don’t need to know which VT you’re logged in on, or even whether you’re logged in yet.
If your two accounts are co... | How secure is switching TTY sessions vs GNOME "Switch User"? |
1,414,097,018,000 |
When using screen -x NAME is there a max number of connections to a single screen?
|
The maximum number of users logged in on a Linux system is limited by the number of available pseudo terminals. The maximum number of these is found in /proc/sys/kernel/pty/max (4096 on my test machine).
This would be an upper limit to how many users would be able to give the screen -x command.
On non-Linux systems, ... | Is there a limit to # of users connected to a screen |
1,411,765,231,000 |
I have a small arm server that runs Arch. I wanted to use only dhcpcd for my ethernet connection so I disabled netctl.service and netctl-ifplugd.service. Turns out that didn't work and I have no means of connecting to the machine anymore. The server has it's root on a usb key which I can mount on my desktop and so the... |
I have a small arm server that runs Arch. I wanted to use only dhcpcd for my ethernet connection so I disabled netctl.service and netctl-ifplugd.service. Turns out that didn't work and I have no means of connecting to the machine anymore.
Did you make sure to enable dhcpcd after disabling netctl?
How can I "systemc... | What does systemctl enable netctl.service do |
1,411,765,231,000 |
I have set up a bridge between eth0 and wlan0 with netctl. It works fine if I tell it to configure eth0 and wlan0 at startup and then for me to manually start the bridge after it boots. If I tell the bridge to start automatically as well though for some reason the wlan adapter does not connect to an access point. I th... |
Arch uses systemd to manage startup processes (daemons and the like as well).
You can write a script that simply executes the command that you want, or sleep for a min and then execute. Then add it to the boot process with the instructions on the
wiki
if you add a sleep:
#!/bin/sh
sleep 60 # one min
netctl start brid... | Arch Linux run script a minute after boot |
1,411,765,231,000 |
My DHCP Ethernet works fine in Windows,
but not in Arch Linux with netctl and dhcpcd.
What am I doing wrong?
Output of ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: wlp2s0: [...]
3: eno1: <BROADCAST... |
The OP (Konrad Höffner) posted this answer
in his question on Oct 21 ’14 at 7:22:
Solved
The network cable was defective.
I switched it out and it works again.
| DHCP IP lease attempt failed over Ethernet and DHCP with netctl |
1,411,765,231,000 |
I am trying to setup my wifi network in Arch Linux ARM to auto-connect at home and office. But it is not always connecting automatically as intended.
netctl list
* wlan0-Spaceship
wlan0-Cremehead
I am not quite sure how to debug this problem as it is acting very randomly. I have enabled both wlan0-Spaceship and wla... |
The functionality you are looking for is through nectl-auto. netctl is for auto connecting on boot or whenever the service through systemd is started where netctl-auto connects to the profiles enabled in its own manager and you would only have netctl-auto@[interface].service enabled.
netctl
netctl-auto
| netctl not auto-connecting consistently |
1,411,765,231,000 |
I have configured a wifi connection in /etc/netctl/tq84-wifi in a Arch Linux installation and am able to manually start it with sudo netctl start tq84-wifi.
Now I'd like to have my installation start the wifi connection automatically when I start Linux. I tried sudo netctl-auto switch-to tq84-wifi, yet this command te... |
Execute sudo netctl enable tq84-wifi. The netctl wiki page says:
Basic method
With this method, you can statically start only one profile per interface. First manually check that the profile can be started successfully with:
# netctl start profile
then it can be enabled using:
# netctl enable profile
This will cre... | How do I automatically execute `netctl start tq84-wifi` on bootup? |
1,411,765,231,000 |
After installing arch, I wanted to set up wifi. I typed wifi-menu wlp3s0 and selected my network. After that wifi-menu exited with no error. I typed ping - c3 google.com to verify my internet connection. I got ping: google.com: Temporary failure in name resolution I typed wifi-menu wlp3s0 again and in front of my wire... |
Ok, the problem was that some packages were missing.
The packages you need are: wireless_tools, wpa_supplicant, netctl, dialog, dhcpcd and dhclient
| arch linux wifi-menu: doesn't shows an error, but doesn't connect to the network |
1,411,765,231,000 |
I'm playing around with LXC on my Arch Linux workstation as a learning experience. I'm following the guide on the LXC page on the Archwiki and setting up a static ip for the container. This is what my network config is like:
/etc/netctl/lxcbridge
---------------------
Description="LXC Bridge"
Interface=br0
Connection=... |
So after a little bit more research I've determined why this is happening. I'm using the default Ubuntu and Debian templates to create the containers and their networking is set up so as to use DHCP to ask for a IP from the the router. So initially the static IP is set using the lxc.container.config and then when the ... | LXC container gets two IP addresses assigned to it |
1,411,765,231,000 |
Yesterday I travelled by train and there were multiple Wifi APs with the same SSID. I had no problem connecting to the Wifi; I'm just curios how netctl handles
such a case. Which of the available APs will it connect to, and does it seamlessly switch between the available APs if one of them gets out of range?
|
Probably in such cases bridges are used to interconnect up multiple access points on the same network or else signal repeaters, also known as expanders signal.
| netctl: multiple Wifi APs with same SSID |
1,411,765,231,000 |
I wanted to setup wifi on my arch linux machine with wifi-menu But it doesn't connect to wifi. It shows no error and it says, that im connected to the internet. But with ping 8.8.8.8 I get Network is unreachable. Am i missing packets or firmware for my wifi card? btw my wifi card driver is atk10-pci. Can someone help?... |
I missed packages: dhcpcd, wireless_tools, wpa_supplicant, netctl, dialog and dhclient
| what are the requirements for netctl wifi-menu in arch linux? |
1,411,765,231,000 |
Seeking to make a netctl profile for a tap device. Here is the info I was given about the connection.
GATEWAY=192.168.117.1
DNS=192.168.117.1
BROADCAST=255.255.255.255 **or** 192.168.117.255 (*I was given both of these different values*)
PREFIX=31
STATIC IP ADDRESS=192.168.117.2/24
TYPE=TAP
Netctl include... |
Do I need to specify the broadcast address or gateway?
From the looks of this article/thread titled: [SOLVED] Static IP wired connection doesn't work with netctl the broadcast address can be incorporated into the static IP's definition.
For example, they provided you with this:
BROADCAST=255.255.255.255 or 192.1... | How to make a netctl profile for a TAP device? |
1,411,765,231,000 |
I have a Server with multiple (four) network interfaces running Arch Linux when I encountered something strange that I cannot explain.
I have two interfaces configured to the the ip addresses 192.168.100.11/24 and 192.168.100.12/24 (using two netctl profiles).
Both interfaces are connected to a switch which also conne... |
Okay, so the problem seems to be, that any interface answers the ARP-requests because they are all in the same subnet and therefore even if the network interfaces have different ip addresses the ARP entries point to the same interface.
So all the packets for the different IPs are sent to the same MAC address (because... | Why can I connect to the IP of a network interface (on a server with multiple network interfaces) when the network cable is removed? |
1,411,765,231,000 |
I need to get a way to communicate to a Raspberry Pi which is acting as the brain of a project. The missing piece is the wireless TCP/IP link.
There are some tutorials for setting up a router with hostapd but I'm having trouble with some since the PI is running headless and failing to setup the interfaces correctly so... |
systemd-networkd allowed me to do something like:
[Match]
Name=wlan0
[Network]
Address=192.168.x.x
to set the wireless card address (with netctl disabled, don't mix both).
When hostapd starts, it keeps that address as the access point address.
In my specific case, one can do the same for the wired card (a static add... | Simple access point for remote electronics project |
1,411,765,231,000 |
I've got a standard router (192.168.1.1) that is connected to the internet. It also has the following connected to it:
an un-managed switch which all wired devices connect to.
a Tenda Mesh WiFi Router (192.168.1.9 >> 192.168.5.1) connected to it.
Devices connected to the Tenda have IPs of 192.168.5.x and I can't con... |
Either distribute static routes by DHCP to all hosts in the two segments, or, assuming the two routers are the default routing gateways in each segment, add a static route to each router. The latter will be less efficient.
Alternatively: Don't let the Tenda Router use a different segment with its own DHCP, bridge it ... | Static Routes between Multiple Subnets - ROUTER (WAN) + WiFi Mesh ROUTER |
1,411,765,231,000 |
What I would like to do:
I would like to start my wireless network after login (As apposed to starting at boot).
Using my login credentials to run the command: sudo netctl start network. Instead of needing to Login once, then login my credentials a second time to start networking, at the same time I would prefer not h... |
Configure sudo to allow you to run the command without a password:
As root:
# visudo
append the following:
<username> ALL = NOPASSWD: netctl start network, netctl stop network
where <username> is your username (without < and >) or ALL to allow everyone to do this. You can also stipulate a group by preceding it with ... | Start Networking at login |
1,411,765,231,000 |
Upon login to serial console I run a command via /etc/profile
netctl start wlan0-ROUTENZUG
However it fails, yielding this output
Job for netctl@wlan0\x2ROUTENZUG.service failed. See ´sytemctl status netctl@wlan0\x2ROUTENZUG.service´ and ´journalctl -xn for details.´
The latter contains nothing about that job, the fir... |
Nevermind, figured it out:
Problem was, I already had brought the respective interface up
ifconfig wlan0 up
which prevents the job from working.
Info was obtained by running
netctl status wlan0-ROUTENZUG
| netctl start PROFILE fails |
1,411,765,231,000 |
I tried both netctl and NetworkManager.
Copied /etc/netctl/examples/mobile_ppp and added number and APN name as there's no pin/pass/username and set interface to /dev/ttyUSB0 (also tried the other ttyUSB1, and ttyUSB2 as well).
My `/etc/netctl/mobile_ppp` file's contents are as follows:
Description='Example PPP mobil... |
I could finally solve it (I'm posting it using the USB connection :P).
Some points to note:
wvdial (as configured in /etc/wvdial.conf) could not connect anyhow (couldn't dial with ATDT and ATD commands).
netctl created profile, 'connected' (netctl start) without (outputting) errors but there were no real connection.
... | Cannot connect with Huawei E3131 3GMax USB Modem |
1,381,069,724,000 |
Why do the commands dig and nslookup sometimes print different results?
~$ dig facebook.com
; <<>> DiG 9.9.2-P1 <<>> facebook.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6625
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
... |
dig uses the OS resolver libraries. nslookup uses is own internal ones.
That is why Internet Systems Consortium (ISC) has been trying to get people to stop using nslookup for some time now. It causes confusion.
| dig vs nslookup |
1,381,069,724,000 |
I've a master bind9 DNS server and 2 slave servers running on IPv4 (Debian Jessie), using /etc/bind/named.conf:
listen-on-v6 { none; };
When I try to connect from different server(s) each connection takes at least 5 seconds (I'm using Joseph's timing info for debugging):
$ curl -w "@curl-format.txt" -o /dev/null -s h... |
Short answer:
A workaround is forcing glibc to reuse a socket for look up of the AAAA and A records, by adding a line to /etc/resolv.conf:
options single-request-reopen
The real cause of this issue might be:
malconfigured firewall or a router (e.g. a Juniper firewall configuration described here) which causes droppi... | Resolving hostname takes 5 seconds |
1,381,069,724,000 |
Both the nslookup and host commands return IPv4 addresses only. How can i retrieve the IPv6 address of a website using the terminal?
(I have googled around, unfortunately I couldn't find anything useful)
|
You need a way to specify that you want to retrieve an AAAA record instead of an A record. You'll want to use the dig command for this, which is the replacement for nslookup anyways.
dig AAAA websitehostname
or if you don't want the verbose output:
dig AAAA +short websitehostname
| Retrieve IPv6 address of website using terminal |
1,381,069,724,000 |
I have a lab set up with DNS running on a CentOS7 server (dns01.local.lab). The local.lab domain is defined in named.conf:
zone "local.lab" IN {
type master;
file "local.lab.zone";
allow-update { none; };
};
I also have a reverse zone but that doesn't matter for this question as far as I can tell.
The zon... |
Does dig +search dns01 give you what you want? If so, it it possible that +nosearch somehow got added to your ~/.digrc ?
ETA: Or, if you're like me, maybe the dig fairies failed to come and add +search to your ~/.digrc.
| dig does not resolve unqualified domain names, but nslookup does |
1,381,069,724,000 |
I'm experimenting with a Win10 IoT board that runs a web interface on minwinpc.local. This works fine in the browser, and also when I use ping.
However, when I use dig or nslookup, I cannot get resolve working.
How can ping and the browser possibly get the IP if the more basic tools fail to do the resolve?
Setup is ju... |
This is not a problem of a more basic protocol not working, but rather that there are multiple name service resolution protocols being used; ping here understands multicast DNS (mDNS) and is able to resolve the name minwinpc.local to an IP address via that protocol. dig and nslookup by contrast may only understand or ... | dig / nslookup cannot resolve, but ping can |
1,381,069,724,000 |
Setup
On some networks I'm able to use nslookup to resolve a domain name that is pointed to a private ip address:
@work> nslookup my192.ddns.net
Server: 10.1.2.3
Address: 10.1.2.3#53
Non-authoritative answer:
Name: my192.ddns.net
Address: 192.168.20.20
However, on my home network this same query fails:
@hom... |
This is a feature of dnsmasq. The dnsmasq people call it "Rebind Protection". It defaults to being on. Either turn it off, or add the domain that you desire to work to the set of whitelisted rebind_domain domains.
You can see the option rebind_protection if you wish to change it in /etc/config/dhcp. If you decide to... | Why does nslookup fail for DNS records set to a private address? |
1,381,069,724,000 |
A domain has nameservers and ns records. These should not, but can theoretically be different. There are multiple ways to see the ns records of a domain:
dig:
➜ ~ dig +short NS stackoverflow.com
cf-dns01.stackoverflow.com.
cf-dns02.stackoverflow.com.
nslookup:
➜ ~ nslookup -type=any stackoverflow.com
Server: ... |
If you want to see the nameservers listed by the registrar, those are available in the DNS system via the root servers.
For example:
dig @a.gtld-servers.net ns stackoverflow.com
; <<>> DiG 9.10.2-P4 <<>> @a.gtld-servers.net ns stackoverflow.com
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADE... | How to see the actual nameservers of a domain instead of the "nsrecords" |
1,381,069,724,000 |
I am currently running a script that uses nslookup on a bunch of hosts and then uses awk to print desired lines into a table. I am printing one line to file1 and another to file2, then using paste file1 file2 >> file3 to produce this table.
The table looks like this
Host IP
name 10.10.10.10
name 10.10.10.10
name 1... |
If your desired goal is to just make a table of hostnames and IP addresses, and you don't care particularly about using nslookup, I was able to seemingly create your desired output with a quick for .. echo loop:
for h in $( cat hosts.list ); do
a=$(dig +short $h | head -n1)
echo -e "$h\t${a:-Did_Not_Resolve}"
... | nslookup awk to a file showing "answer" |
1,381,069,724,000 |
We have a list of dns server IPs in /etc/resolv.conf. When doing nslookup for a particular scenario we would like to ingore the second entry below, so that naming resolution occurs via other 3 DNS server IPs.
$ cat /etc/resolv.conf
domain example.com
nameserver 192.168.1.1
nameserver 10.10.10.1
nameserver 192.168.1.2
... |
One solution might be to temporarily change the order of the nameservers in /etc/resolv.conf .
Another approach is to iterate through the nameservers and use them separately:
while read IP
do
echo "Testing nameserver ${IP}"
nslookup google.com "${IP}"
done < <(grep nameserver /etc/resolv.conf| awk '(FNR != 2) ... | any option to ignore a dns server ip from /etc/resolv.conf when doing nslookup? |
1,381,069,724,000 |
We have a managed server with centos, recently it starts showing strange behavior:
root@server [/tmp]# ping www.google.com
PING www.google.com (172.217.8.196) 56(84) bytes of data.
64 bytes from ord37s09-in-f4.1e100.net (172.217.8.196): icmp_seq=1 ttl=53 time=24.8 ms
So this looks quite good.
And here it becomes st... |
You did not use fully-qualified domain names. www.google.com is not a fully-qualified (human readable form) domain name. It does not end with a dot.
You also have a search path of plannersys.net. configured in your DNS client library and a wildcard DNS resource record for *.plannersys.net..
As a consequence of the... | Why does ping resolve to a different address than traceroute? and lynx? |
1,381,069,724,000 |
I'm finding that a few commands (for now dig and nslookup) that fail no matter what with the following output:
19-Jan-2016 15:01:50.219 ENGINE_by_id failed (crypto failure)
19-Jan-2016 15:01:50.219 error:2606A074:engine routines:ENGINE_by_id:no such engine:eng_list.c:389:id=gost
dig: dst_lib_init: crypto failure
Even... |
Run :
ldd $( which dig) | grep crypto, this will show you which crypto lib you're using at the moment. If this is different than expected one (usually openssl) you have few options :
Remove the lib which interferes
Modify LDD_LIBARY_PATH env variable, and point to the openssl lib location
Fix the problem by removing... | "crypto failure" error when running various commands |
1,381,069,724,000 |
I tried setting up a DNS Lookup on CentOS 7 (in a Virtual Box VM), which works for FQDN on the same virtual machine as the DNS. However when I try to resolve the short hostname, it fails.
I have seen this working on some servers and wanted to learn how to set it up myself. Appreciate any help on this.
Below are the co... |
The problem is in your resolv.conf/DHCP configuration if resolv.conf is not static.
You have got to add to the search directive of resolv.conf the domain eai.com
When you try a DNS name lookup, the resolver libraries, if unsuccessful, try in turns to resolve the name adding the domains in the search directive until th... | CentOS7 unable to resolve nslookup for short hostname |
1,381,069,724,000 |
I am having two NICs eth0 and eth1 for my Linux VM out of which one is in public and other in private network. When I am using nslookup for same by hostname its giving following error:
** server can't find "hostname": NXDOMAIN
I have checked all entries in /etc/hosts , /etc/sysconfig/network-scripts/ifcfg-eth0 , /etc/... |
check if your hostname is registered in DNS server you are using in /etc/resolve.conf. If not register it and check it should work.
| 'nslookup' is not working on multiple network interfaces cards in linux |
1,381,069,724,000 |
I have a domain and when I use
dig jeeja.biz
it just gives me my server ip address.
;; ANSWER SECTION:
jeeja.biz. 13914 IN A 209.15.212.171
But when I use the same command on another site:
dig ilportaledellautomobilista.it
the replay is:
;; AUTHORITY SECTION:
ilportaledellautomobilista.it. 3600 IN SOA d... |
It would seem that ilportaledellautomobilista.it does not have an A record, however the domain does exist and does have a nameserver (SOA shows that). Since that host only has a SOA record, thats what dig is returning.
www.ilportaledellautomobilista.it does have an A record though. So give that a try instead, and you ... | dig domain replay SOA |
1,381,069,724,000 |
I got several interesting :) e-mails from IP addresses where I can't identify country and owner (internet provider), it's by example
10.180.221.97
10.220.113.130
10.52.135.39
I tried several IP lookup services with no luck. Please could you help me? Is it possible that IP doesn't have country identification?
|
These addresses are coming from your private network or are somehow spoofed.
Addresses from 10.0.0.0 to 10.255.255.255 are reserved for private networks (not connected to the internet)
http://tldp.org/HOWTO/IP-Masquerade-HOWTO/addressing-the-lan.html
| Can't identify IP addresses |
1,381,069,724,000 |
I can not install nslookup in my CentOS 7.2:
yum install nslookup
[root@localhost network-scripts]# yum install -y nslookup
added plugin:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.sunnyvision.com
* epel: my.mirrors.thegigabit.com
* extras: mirror.sunnyvision.com
* updates: mirrors.ici... |
nslookup is contained in bind-utils package.
You should use below command to install it:
# yum install bind-utils
| I can not install nslookup in my CentOS server |
1,381,069,724,000 |
# uname -a
Linux myserver 3.10.0-1062.18.1.el7.x86_64 #1 SMP Tue Mar 17 23:49:17 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
# cat /etc/resolv.conf
# Generated by NetworkManager
options rotate
options timeout:3
options attempts:6
nameserver one.xxx.xxx.xxx... |
** server can't find some.url.ihave: NXDOMAIN
nslookup stops because it has received an answer to its query. It stops asking once it has an answer, obviously. That answer was that the domain does not exist.
If you don't want that to be the case, do not list in resolv.conf the IP address of a DNS server that think... | /etc/resolv.conf on CentOS7 doesn't seem to honor options |
1,381,069,724,000 |
nslookup returns the following output on mac:
www.yahoo.com -> 46.228.47.115, 46.228.47.114, 2a00:1288:110:2::4001
As I understand following IPs in DNS map to www.yahoo.com:
www.yahoo.com -> 46.228.47.115
www.yahoo.com -> 46.228.47.114
But what is:
2a00:1288:110:2::4001
|
That represents IPv6,
In short form it is, 2a00:1288:110:2::4001, which represents
2a00:1288:0110:0002:0000:0000:0000:4001
in long form.
| Understand the nslookup output. |
1,381,069,724,000 |
I don't understand how to use the ls option in nslookup on HP-UX. It failed both interactively:
> ls
Using /etc/hosts on: hpux
looking up FILES
Trying DNS
Name: ls.
> set ls
*** Invalid option: ls
>
And non-interactively:
nslookup -query=PTR 10.3.0.2 10.3.0.2 ls
What's the right way to use it?
|
Taken straight from HPUX documentation for nslookup
ls [option] domain List the information available for domain [...]. The default output contains host names and their Internet addresses.
The ls subcommand will work only if you are connecting to an authoritative server and you have permission to request a zone tran... | How to use ls in nslookup on HP-UX? [closed] |
1,381,069,724,000 |
Here's what my nslookup is doing:
ubuntu@ca:~$ time nslookup focal-250
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: focal-250.test
Address: 128.8.8.187
;; connection timed out; no servers could be reached
real 0m15.024s
user 0m0.005s
sys 0m0.018s
The first six lines... |
nslookup will query for both A and AAAA records, so if the A query returns immediately and the AAAA never returns, then nslookup will print an immediate response, then timeout.
Here's a table I made of how the dnsmasq server on 128.8.8.254 answered various types of queries:
dig @128.8.8.254 A focal-250 immedi... | Why would nslookup return a response, then timeout? |
1,381,069,724,000 |
I'd like a way of looking up all the domains in a text file (one domain per line) and generating another text file with the output as the IP address, a space, the domain name, a space and then the domain name with www. prepending it.
For example, if the source text file contains two lines:
1.gravatar.com
abcya.com
th... |
A python solution
#!/usr/bin/python3
import socket
#this module is core networking module in Python,
#can be used to resolve domain names.
sourcefile = 'sourcefile.txt' #file with domain names
outfile = 'results.txt' #file to write the IP addresses
with open(sourcefile, 'r') as inputf:
#This opens the sour... | Look Up IPs From Text File, Generate Another Text File With Specific Formatting |
1,381,069,724,000 |
I have an embedded system with two ethernet ports. These two ports are connected
to two different ethernet ports on a linux box. The linux box has another third port
which is connected to the WAN.
The setup looks like below
_________________
eth0 ---- USB2ETH... |
Either disabling or setting the reverse path filtering to loose mode for the private interfaces resolved the issue.
echo 2 > /proc/sys/net/ipv4/conf/ethusb0/rp_filter
echo 2 > /proc/sys/net/ipv4/conf/ethusb1/rp_filter
| nslookup and IP forwarding with multiple interfaces fails sometimes |
1,381,069,724,000 |
I try to use name resolution and get IP address of a web site. I used nslookup command and use 6'th line of its output. Because I noticed that output of nslookup contains IP address(in IPv4) in 6'th line. My command was :
website=<somewebsiteURL>
IP=$(nslookup "$website" | head -n 6 | tail -n 1 | cut -d" " -f2)
Also ... |
Use grep to parse strings that "looks like" a valid IPv4 addresses :
nslookup unix.stackexchange.com | grep -Eo '([0-9]{1,3}[.]){3}[0-9]{1,3}[^#]'
151.101.129.69
151.101.1.69
151.101.193.69
151.101.65.69
Use tool such as dig. It can output directly the info you desire without the need for external parsing tool:
dig ... | Why does nslookup script give different results? |
1,394,770,849,000 |
I'm reading an example bash shell script:
#!/bin/bash
# This script makes a backup of my home directory.
cd /home
# This creates the archive
tar cf /var/tmp/home_franky.tar franky > /dev/null 2>&1
# First remove the old bzip2 file. Redirect errors because this generates some if the archive
# does not exist. Then... |
No, this will not prevent the script from crashing. If any errors occur in the tar process (e.g.: permission denied, no such file or directory, ...) the script will still crash.
This is because of using > /dev/null 2>&1 will redirect all your command output (both stdout and stderr) to /dev/null, meaning no outputs are... | redirecting to /dev/null |
1,394,770,849,000 |
I am trying to understanding the concept of special files on Linux. However, having a special file in /dev seems plain silly when its function could be implemented by a handful of lines in C to my knowledge.
Moreover you could use it in pretty much the same manner, i.e. piping into null instead of redirecting into /de... |
In addition to the performance benefits of using a character-special device, the primary benefit is modularity. /dev/null may be used in almost any context where a file is expected, not just in shell pipelines. Consider programs that accept files as command-line parameters.
# We don't care about log output.
$ frobify ... | Why is /dev/null a file? Why isn't its function implemented as a simple program? |
1,394,770,849,000 |
I've read that, since file-paths in Bash can contain any character except the null byte (zero-valued byte, $'\0'), that it's best to use the null byte as a separator. For example, if the output of find will be sent to another program, it's recommended to use the -print0 option (for versions of find that have it).
But ... |
Bash uses C-style strings internally, which are terminated by null bytes. This means that a Bash string (such as the value of a variable, or an argument to a command) can never actually contain a null byte. For example, this mini-script:
foobar=$'foo\0bar' # foobar='foo' + null byte + 'bar'
echo "${#foobar}" # ... | How do I use null bytes in Bash? |
1,394,770,849,000 |
I am emptying out a hard drive on some Linux 4.x OS using this command:
sudo sh -c 'pv -pterb /dev/zero > /dev/sda'
And I opened another tty and started sudo htop and noticed this:
PID USER PRI NI CPU% RES SHR IO_RBYTES IO_WBYTES S TIME+ Command
4598 root 20 0 15.5 1820 1596 4096 ... |
They do count as I/O, but not of the type measured by the fields you’re looking at.
In htop, IO_RBYTES and IO_WBYTES show the read_bytes and write_bytes fields from /proc/<pid>/io, and those fields measure bytes which go through the block layer. /dev/zero doesn’t involve the block layer, so reads from it don’t show up... | Why don't reads from /dev/zero count as IO_RBYTES? |
1,394,770,849,000 |
I have a directory with over 400 GiB of data in it. I wanted to check that all the files can be read without errors, so a simple way I thought of was to tar it into /dev/null. But instead I see the following behavior:
$ time tar cf /dev/null .
real 0m4.387s
user 0m3.462s
sys 0m0.185s
$ time tar cf - . > /de... |
It is a documented optimization:
When the archive is being created to /dev/null, GNU tar tries to
minimize input and output operations. The Amanda backup system, when
used with GNU tar, has an initial sizing pass which uses this feature.
| Why does tar appear to skip file contents when output file is /dev/null? |
1,394,770,849,000 |
If I do: touch file; mv file /dev/null as root, /dev/null disappears. ls -lad /dev/null results in no such file or directory. This breaks applications which depend on /dev/null like SSH and can be resolved by doing mknod /dev/null c 1 3; chmod 666 /dev/null. Why does moving a regular file to this special file resul... |
Looking at the source code for mv, http://www.opensource.apple.com/source/file_cmds/file_cmds-220.7/mv/mv.c :
/*
* If rename fails because we're trying to cross devices, and
* it's a regular file, do the copy internally; otherwise, use
* cp and rm.
*/
if (lstat(from, &sb)) {
warn("%s", from);
return (1);
}... | mv a file to /dev/null breaks dev/null |
1,394,770,849,000 |
I want to test some physical links in a setup. The software tooling that I can use to test this require a block device to read/write from/to. The block devices I have available can't saturate the physical link so I can't fully test it.
I know I can setup a virtual block device which is backed by a file. So my idea was... | ERROR: type should be string, got "\nhttps://wiki.gentoo.org/wiki/Device-mapper#Zero\n\nSee Documentation/device-mapper/zero.txt for usage. This target has no target-specific parameters.\nThe \"zero\" target create that functions similarly to /dev/zero: All reads return binary zero, and all writes are discarded. Normally used in tests [...]\nThis creates a 1GB (1953125-sector) zero target:\nroot# dmsetup create 1gb-zero --table '0 1953125 zero'\n\n\n" | Create virtual block device which writes to /dev/null |
1,394,770,849,000 |
I am trying to redirect python generated input to ELF 64-bit executable in bash 5.0.3. I am getting:
> ./bf <<< $(python2 -c "print('c'*6+b'\x00'+'c'*6)")
bash: warning: command substitution: ignored null byte in input
Enter password: Password didn't match
input: cccccccccccc
How can I allow a null byte in the input?... |
You are able to pass null bytes across a pipe (like you say in the title), but the bash shell will not allow null bytes in expansions. It does not allow null bytes in expansions because the shell uses C strings to represent the results of expansions, and C strings are terminated by null bytes.
$ hexdump -C <<< $( pyth... | Send null byte in unix pipe |
1,394,770,849,000 |
So I'd like to pass the first 512 bytes of binaryFile.dd as the second parameter to myProgram but bash strips out all the NUL chars. Is there any way to avoid this in bash or am I on a hiding to nothing?
myProgram parameter1 "$(head -c 512 binaryFile.dd)"
|
There is no way to pass a null byte in the parameter of a command. This is not because of a limitation of bash, although bash has this limitation as well. This is a limitation of the interface to run a command: it treats a null byte as the end of the parameter. There's no escaping mechanism.
Most shells don't support ... | Using binary data as a parameter in bash - any way to allow nuls? |
1,394,770,849,000 |
I need to pass as a program argument a parameter expansion. The expansion results in a filename with spaces. Therefore, I double-quote it to have the filename as a single word: "$var".
As long as $var contains a filename, the program gets a single-word argument and it works fine. However, at times the expansion resu... |
The ${parameter:+word} parameter expansion form seems to do the job
( xyz=2; set -- ${xyz:+"$xyz"}; echo $# )
1
( xyz=; set -- ${xyz:+"$xyz"}; echo $# )
0
( unset xyz; set -- ${xyz:+"$xyz"}; echo $# )
0
So that should translate to
program ${var:+"$var"}
in your case
| How to prevent word splitting without preventing empty string removal? |
1,394,770,849,000 |
I just backed up the microSD card from my Raspberry Pi on my PC running a Linux distro using this command:
dd if=/dev/sdx of=file.bin bs=16M
The microSD card is only 3/4 full so I suppose there's a few gigs of null bytes at the end of the tremendous file. I am very sure I don't need that. How can I strip those null b... |
To create a backup copy of a disk while saving space, use gzip:
gzip </dev/sda >/path/to/sda.gz
When you want to restore the disk from backup, use:
gunzip -c /path/to/sda.gz >/dev/sda
This will likely save much more space than merely stripping trailing NUL bytes.
Removing trailing NUL bytes
If you really want to re... | Remove null bytes from the end of a large file |
1,394,770,849,000 |
Because that's what some of them are doing.
> echo echo Hallo, Baby! | iconv -f utf-8 -t utf-16le > /tmp/hallo
> chmod 755 /tmp/hallo
> dash /tmp/hallo
Hallo, Baby!
> bash /tmp/hallo
/tmp/hallo: /tmp/hallo: cannot execute binary file
> (echo '#'; echo echo Hallo, Baby! | iconv -f utf-8 -t utf-16le) > /tmp/hallo
> bash... |
As per POSIX,
input file shall be a text file, except that line lengths shall be unlimited¹
NUL characters² in the input make it non-text, so the behaviour is unspecified as far as POSIX is concerned, so sh implementations can do whatever they want (and a POSIX compliant script must not contain NULs).
There are some... | Are shells allowed to ignore NUL bytes in scripts? |
1,394,770,849,000 |
In a document created by a former coworker there is this command:
cat /dev/null > /var/spool/mail/root
It says next to it that it will clean out mailbox.
Can someone please explain how/why these commands do that. I need to know what will happen before I run the command.
We are trying to clean up space on var, as ... |
The command will output the data from device /dev/null to the given file (mailbox of the root account). Since /dev/null responds just with end-of-file when reading from it nothing will be written to the file, but with the redirection > the shell will have cleared the file already. Actually this is equivalent to writin... | Meaning of `cat /dev/null > file` |
1,394,770,849,000 |
I’m writing something that deals with file matches, and I need an inversion operation. I have a list of files (e.g. from find . -type f -print0 | sort -z >lst), and a list of matches (e.g. from grep -z foo lst >matches – note that this is only an example; matches can be any arbitrary subset (including empty or full) o... |
If your comm supports non-text input (like GNU tools generally do), you can always swap NUL and nl (here with a shell supporting process substitution (have you got any plan for that in mksh btw?)):
comm -23 <(tr '\0\n' '\n\0' < file1) <(tr '\0\n' '\n\0' < file2) |
tr '\0\n' '\n\0'
That's a common technique.
| Invert matching lines, NUL-separated |
1,394,770,849,000 |
In a terminal I can run...
find . -type f -print0
./testdir/testfile2.txt./testdir/testfile.txt
And then...
find . -type f -printf "%p\0"
./testdir/testfile2.txt./testdir/testfile.txt
They both visually appear the same, but since this is about the null character, that doesn't say much. If I run via the ruby repl:
2... |
There should be no difference. Pipe the output through cat -v which will escape non-printable characters.
Perhaps you have some special locale settings, which modifies what -print0 does. At least with my en_US.UTF-8 settings there is no difference. Perhaps add the output of locale to your question.
Possibly your test ... | With gnu find, what is the difference between -print0 and -printf "%p\0" |
1,394,770,849,000 |
Is it possible to safely ignore the aforementioned error message? Or is it possible to remove the null byte? I tried removing it with tr but I still get the same error message.
this is my script:
#!/bin/bash
monitordir="/home/user/Monitor/" ... |
As for your exact question:
Can I safely ignore: “warning: … ignored null byte … ”?
The answer is yes, since you are creating the null byte with your own code.
But the real question is: Why do you need a "null byte"?
The inotifywait command will produce an output in the form of:
$dir ACTION $filename
Which, for you... | Can I safely ignore: "warning: command substitution: ignored null byte in input"? |
1,394,770,849,000 |
How does the following code print just a single file?
find "$fdir" -type f -name "${fnam}-*.png" -print0 | awk -v RS='\0' -F'[-.]' '{print $(NF-1), $0}' | cat -vet
which gives me
04 /home/flora/edvart/docs/schimmel-04.png$
But doing find "$fdir" -type f -name "${fnam}-*.png" gives
/home/flora/edvart/docs/schimmel-04... |
Only GNU awk and mawk (release 1.3.4 or later) can use \0 as a record separator with the meaning "null character." Older releases of mawk, BSD awk, Busybox awk, Plan 9 awk etc. all treat the string \0 in RS as if RS had been the empty string, i.e., it enables "paragraph mode" (two or more contiguous newlines delimit ... | awk with null record separator printing just one file |
1,394,770,849,000 |
bash's mapfile seems to be broken when handling NUL separated input. In particular, it isn't handling minus characters (-) correctly, treating the empty string after one as an end-of-line marker.
For example:
#!/bin/bash
mkdir /tmp/junk
cd /tmp/junk
touch a.txt b.txt c.txt d-e-f.txt
declare -a files
echo "mapfile ... |
From bash manual section on Word Splitting:
Explicit null arguments ("" or '') are retained and passed to commands as empty strings. [...] the word -d'' becomes -d after word splitting and null argument removal.
It's helpful to have an args shell script in your toolbox to troubleshoot argument processing. Here's one... | bash mapfile NUL bug? |
1,394,770,849,000 |
I just came across the advice that if you want to get rid of a large file and a process has the file handle open you should copy it to /dev/null and its size will be reduce to zero.
How does this work? Or does this even work?
After a quick search I found conflicting answers ranging from "Yes, this totally works" to "... |
You misread the advice, the idea is not to copy the large file to /dev/null, which wouldn't affect it in any way, outside putting it in cache if space is available.
cp bigfile /dev/null # useless
The advice is not to remove the file then copy /dev/null to it, as it would keep the original inode unchanged and won't fr... | cp large file to /dev/null to reduce size to zero [closed] |
1,394,770,849,000 |
Given a file with newlines in fields (embedded by double quotes), I tried to use NUL as record separator and then select desired records.
For this I have replaced the ends of lines with NUL and then corrected for fields split by a newline (done using sed). However then exactly matching the first field in (GNU) awk wit... |
Your sed command is not changing newlines (\n) to NULs (\0) but to NULs + newlines (\0\n) (as cat -A shows).
When using GNU awk with RS set to \0, the first character of a subsequent record (and of its first field) will be \n, which will break your exact match.
And the 's/\(,"[^,"]*\)\x00/\1/' newline-splits correctio... | awk: Exact string match on field not working with NUL as record separator |
1,394,770,849,000 |
I'm trying to print the json output using jq, But I'm getting null
How can I print only access_key and secret_key, but not null?
$ cat sample.json | jq '.'
{
"access_key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
{
"secret_key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
$ cat sample.json | jq -e ".access_key"... |
Your input is not valid json. You can use https://jsonlint.com to check.
You could make it valid by changing it to something like:
[{
"access_key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}, {
"secret_key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}]
Or jq has a workaround for this:
cat sample.json | jq "..|... | Printing only the value and excluding null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.