You are not logged in.

#1 2021-09-09 22:38:53

eNkkk
Member
Registered: 2021-09-09
Posts: 2

[SOLVED] bg process not running in bg and cannot be stopped with ^C

I have just installed archlinux-2021.09.01-x86_64 on VirtualBox 6.1.26.

Everything seems to work as it should but if I try running "ls -R / &" the process does not run in background and I cannot seem to stop it by pressing ^C or ^Z, when it's done listing the contents of / I'm finally able to end the process (which doesnt end by itself) with ^C.
Same thing happens if I run the command without & > press ^Z > type "bg".

What causes this and how can it be fixed?

Here's how I've installed Arch:

loadkeys it
timedatectl set-ntp true

cfdisk
/dev/sda1	0.2G	EFI System
/dev/sda2	1G	Linux Swap
/dev/sda3	28.8G	Linux filesystem

mkfs.ext4 /dev/sda3
mkfs.fat -F32 /dev/sda1
mkswap /dev/sda2
mount /dev/sda3 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
swapon /dev/sda2
reflector --latest 200 --protocol http,https --sort rate --save /etc/pacman.d/mirrorlist
pacstrap /mnt base linux linux-firmware vim nano man-db man-pages sudo
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
ln -sf /usr/share/zoneinfo/Europe/Rome /etc/localtime
hwclock --systohc

vim /etc/locale.gen
(uncomment en_US.UTF-8)

locale-gen

vim /etc/locale.conf
LANG=en_US.UTF-8

vim /etc/vconsole.conf
KEYMAP=it

vim /etc/hostname
arch

vim /etc/hosts
127.0.0.1	localhost
::1		localhost
127.0.1.1	arch.localdomain	arch

passwd
pacman -S grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
exit
umount -R /mnt
reboot
systemctl enable systemd-networkd
systemctl enable systemd-resolved
systemctl start systemd-networkd
systemctl start systemd-resolved

vim /etc/systemd/network/20-wired.network
[Match]
Name=enp0s3

[Network]
DHCP=yes

systemctl restart systemd-networkd
systemctl restart systemd-resolved
useradd enkkk -mG wheel
passwd enkkk

EDITOR=vim visudo
(uncomment %wheel ALL=(ALL) NOPASSWD: ALL)

Last edited by eNkkk (2021-09-09 23:30:32)

Offline

#2 2021-09-09 23:09:22

lmn
Member
Registered: 2021-05-09
Posts: 93
Website

Re: [SOLVED] bg process not running in bg and cannot be stopped with ^C

This is the intended behavior of ^C in this situation.
The command is no longer running in the foreground so the signals you send are not send to that process, but your current running process.
In this case that would probably be your shell. You're just not seeing it as the output is still going on.
You can use kill to send the appropriate signal to the process.
The same is the case when you suspend and background the process.

The thing that baffles me is the fact that the process seems to linger on. Can you elaborate on that?
If you want to you could also tell what you want to achieve with the listing of the complete filesystem?

Offline

#3 2021-09-09 23:30:07

eNkkk
Member
Registered: 2021-09-09
Posts: 2

Re: [SOLVED] bg process not running in bg and cannot be stopped with ^C

As it turns out, I should have thought about it a little longer before posting on the forum. The problem is that "ls" IS in fact running in the background, but the output is still shown on screen, as it should; what I wanted to do is "ls -R / > output.txt &".

Offline

Board footer

Powered by FluxBB