Questions tagged [util-linux]

A suite of essential system utilities for Linux.

29 questions
16
votes
1 answer

Why is lazy MNT_DETACH or `umount -l` unsafe / dangerous?

I've read in a few places that umount -l is unsafe: In an answer by @cas: don't use umount's --lazy option if you care about when the external drive can be safely unplugged A comment by @frostschutz: umount --lazy is not safe and can not be made…
Tom Hale
  • 28,728
  • 32
  • 139
  • 229
8
votes
1 answer

How to use the ul command line utility

I wanted to answer Use _roff to underline words with "just use ul, this command is meant specifically for underlining text", however I just can't grasp how to use it. I thought $ echo "hello _kitty_ world" > /tmp/foo.txt $ ul /tmp/foo.txt would…
fschmitt
  • 8,720
  • 35
  • 46
6
votes
2 answers

Trouble getting busybox switch_root to work

I'm working on an embedded ARM Linux system that boots using initramfs. (Here's some background from a couple earlier questions, if you're interested.) So far, thanks in part to help received here, I can boot the kernel via TFTP with an embedded…
pingswept
  • 1,085
  • 2
  • 9
  • 12
6
votes
1 answer

Is there a command to switch to into an existing namespace?

I am using multiple UTS namespaces, each of them has some servers constantly running. I can get the namespace IDs via readlink /proc//ns/uts, now I would like to change into a given namespace to do modifications there. As far as I understand…
replay
  • 8,483
  • 1
  • 26
  • 31
5
votes
1 answer

Why and when does `lsblk` require `sudo`?

On my up-to-date Arch Linux, lsblk works fine without sudo: $ lsblk -o NAME,FSTYPE NAME FSTYPE sda ├─sda1 ext4 ├─sda2 ext4 ├─sda3 swap ├─sda4 └─sda5 ext4 sr0 $ lsblk --version lsblk from util-linux 2.26.2 On my Ubuntu 14.04, getting…
muru
  • 69,900
  • 13
  • 192
  • 292
4
votes
1 answer

Is it normal for tune2fs default mount options to not appear in mount output?

I have an SSD with 2 partitions formatted with ext4. On the second partition, I enabled discard as a default option at the filesystem level with this command: $ sudo tune2fs -o discard /dev/sda2 tune2fs 1.45.5 (07-Jan-2020) $ sudo tune2fs -l…
JoL
  • 4,520
  • 15
  • 35
4
votes
1 answer

Ubuntu runuser command?

I am creating a bash script that requires to run commands as a specific user. As a result I am using the command: runuser I have tested this script and it works perfectly in Ubuntu Server 14.10. However, when testing it on 14.04 and 12 I run into…
user3024130
  • 219
  • 2
  • 4
  • 8
3
votes
3 answers

How to know if `script` command (which records terminal sessions as typescript) is already runing?

This SO answer says that script adds the variable SCRIPT to the environment of the command it runs. I tried that but it doesn't seem to be working now. This is what I have tried ma08@IWeighHar:~/pro$ script foo.log Script started, output log file is…
ma08
  • 845
  • 2
  • 7
  • 19
3
votes
1 answer

Set environment inside `nsenter /bin/bash`

I'm entering a namespace with nsenter -m -u -i -n -p -t $PID /bin/bash. However, printenv inside this namespace doesn't have everything I need. I'd like to send these variables in, but I'd like to avoid prefixing my bash command like KEY=VALUE…
Dane O'Connor
  • 431
  • 4
  • 7
2
votes
2 answers

Could you suggest how to use `rename.ul` under Ubuntu 22.04 ? Many thanks?

Could you suggest how to use rename.ul under Ubuntu 22.04 ? Many thanks ! Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.10.102.1-microsoft-standard-WSL2 x86_64) * Documentation: https://help.ubuntu.com * Management: …
SOUser
  • 329
  • 2
  • 13
2
votes
1 answer

More / file reporting "not a text file" file which contains only one letter and newline

I am confused by the output of the more program under linux. When creating a file which contains only a single letter (except for special letters like ä which work fine), more does not report the file's content, but that the file is not a text file.…
mutableVoid
  • 168
  • 7
2
votes
2 answers

How to recover from replacing all characters in my filenames 1:1 with whitespaces?

$ rename 's/./ /g' * $ ls -l total 6832616 -rw-r--r-- 1 jboo jboo 0 Sep 28 01:44 -rw-r--r-- 1 jboo jboo 43361681 Sep 28 01:44 -rw-r--r-- 1 jboo jboo 47499946 Sep 28 01:44 -rw-r--r-- 1 jboo jboo 55881060 Sep 28 01:44 -rw-r--r-- 1 jboo…
A H
  • 183
  • 5
2
votes
1 answer

How is the output of `losetup --list` sorted?

When I run losetup --list (or just losetup) to get a list of the loopback devices on my system, the output doesn't seem to be in any meaningful order: 0 $ losetup --list NAME SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE …
ash
  • 671
  • 6
  • 16
2
votes
1 answer

util-linux look with german umlauts

I am currently having problems with util-linux's look in combination with German umlauts (ä, ö, ü). For testing purposes I set LC_ALL=de_DE.UTF-8. Consider german.dic: Aachen Rindfleisch in UTF-8 encoding: $ file german.dic german.dic: UTF-8…
2
votes
1 answer

Why does switch_root delete all the files in the initramfs?

WARNING: switch_root removes recursively all files and directories on the current root filesystem. -- man switch_root from util-linux, version 2.32-2.fc28.x86_64 Why?
sourcejedi
  • 48,311
  • 17
  • 143
  • 296
1
2