AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / unix / 问题

Perguntas[systemd](unix)

Martin Hope
user19315471
Asked: 2025-04-07 03:53:43 +0800 CST

hostnamectl: fonte do Firmware Age

  • 11

Quando executo hostnamectlo comando, recebo esta saída:

$ hostnamectl 
 Static hostname: myhostname
       Icon name: computer-desktop
         Chassis: desktop 🖥
      Machine ID: 12345e09a3a2464689c345fe7b12345f
         Boot ID: 123451b9f31ff4c166f8368c1f86666ad
Operating System: openSUSE Leap 15.6              
     CPE OS Name: cpe:/o:opensuse:leap:15.6
          Kernel: Linux 6.4.0-150600.23.33-default
    Architecture: x86-64
 Hardware Vendor: ASRock
  Hardware Model: B450 Pro4 R2.0
Firmware Version: P5.60
   Firmware Date: Thu 2022-10-20
    Firmware Age: 2y 5month 2w 3d  <<<<<<<<<< this

Eu me pergunto: Firmware Agede onde vem isso? Não conheço nenhum outro comando que possa retornar esse valor. Como e de onde ele hostnamectlobtém esse valor?

systemd
  • 3 respostas
  • 199 Views
Martin Hope
BaRud
Asked: 2025-04-01 00:13:28 +0800 CST

"systemctl --user start" falha para rclone: ​​problema de conexão de barramento de usuário

  • 5

Eu criei um servicearquivo:

cat ~/.config/systemd/user/rclonegdrive.service 
[Unit]
Description=Rclone mound Google Drive
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/rclone mount gdrive: /home/rudra/Desktop/Zotero
TimeoutSec=5
Restart=on-failure
RestartSec=1
ExecStop=/usr/bin/fusermount -u /home/rudra/Desktop/Zotero
# logs to the journal directly, suppress double logging

[Install]
WantedBy=default.target

Mas não está funcionando com systemctl:

systemctl --user start rclonegdrive.service
Failed to connect to user scope bus via local transport: Connection refused

Este é meu systemd/userconteúdo

tree ~/.config/systemd/user/
/home/rudra/.config/systemd/user/
├── default.target.wants
│   └── [email protected] -> /usr/lib/systemd/user/[email protected]
└── rclonegdrive.service

Alguém pode me ajudar, por favor?

systemd
  • 1 respostas
  • 31 Views
Martin Hope
Adrián Bíro
Asked: 2025-03-29 18:54:53 +0800 CST

A diretiva de registro do systemd acrescenta ' ^M ' no arquivo de registro. O que devo especificar no arquivo de unidade para removê-lo?

  • 5

Tenho um script de backup (wrapper rsync) em execução, eu estava usando --log-fileflag com rsync antes, depois de mudar para StandardOutput/StandardError o systemd começou a acrescentar ' ^M ' entre as linhas de log. Como posso removê-lo com a instrução de arquivo unitário, por favor?

[Unit]
Description=...
Wants=...

[Service]
Type=oneshot
User=adrian
Group=adrian
ReadOnlyPaths=/
ReadWritePaths=/var/log/foo.log
StandardOutput=append:/var/log/foo.log
StandardError=append:/var/log/foo.log
ExecPaths=/usr/local/bin /usr/bin /bin
ExecStart=/usr/local/bin/foo_script.sh

[Install]
WantedBy=multi-user.target

Configurações de ambiente

echo $LANG
en_US.UTF-8

Tentei vários modos de saída, mas com o mesmo resultado.

Não é causado pelo editor ou outra ferramenta, o systemd loggin está anexando-o. A versão original com o logging especificado no script com o sinalizador rsync estava funcionando sem nenhum problema. journalctl -u <service name>está renderizando ok, mas a diretiva de saída do systemd está anexando-o ali.

systemd
  • 1 respostas
  • 61 Views
Martin Hope
PersianGulf
Asked: 2025-03-27 03:18:39 +0800 CST

Rotear consulta DNS para meu túnel

  • 5

Tenho o seguinte sistema:

root@debian:~# dpkg -l systemd-resolved
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name             Version      Architecture Description
+++-================-============-============-=================================
ii  systemd-resolved 257.4-3      amd64        systemd DNS resolver
root@debian:~# cat /etc/issue
Debian GNU/Linux trixie/sid \n \l

root@debian:~# ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 39 Mar 26 20:21 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf

root@debian:~# cat /run/systemd/resolve/stub-resolv.conf 
# This is /run/systemd/resolve/stub-resolv.conf managed by man:systemd-resolved(8).
# Do not edit.
#
# This file might be symlinked as /etc/resolv.conf. If you're looking at
# /etc/resolv.conf and seeing this text, you have followed the symlink.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs should typically not access this file directly, but only
# through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a
# different way, replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 127.0.0.53
options edns0 trust-ad
search .

Então eu instalei Zebedeeo tunneling e funcionou bem.
E quando eu configurei meu firefoxon localhost:81, o acesso aos sites foi filtrado.

root@debian:~# telnet localhost 81
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

Agora, eu quero usar DNS sobre localhost:81.
Como posso fazer isso?

ATUALIZAÇÃO: O meu resolvectlé:

root@debian:~# resolvectl status
Global
         Protocols: +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
  resolv.conf mode: stub
       DNS Servers: 8.8.8.8

Link 2 (enp0s31f6)
    Current Scopes: LLMNR/IPv4 mDNS/IPv4
         Protocols: -DefaultRoute +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
     Default Route: no

Link 3 (wlp58s0)
    Current Scopes: none
         Protocols: -DefaultRoute +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
     Default Route: no

Link 5 (docker0)
    Current Scopes: none
         Protocols: -DefaultRoute +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
     Default Route: no
systemd
  • 1 respostas
  • 19 Views
Martin Hope
Aleksey
Asked: 2025-03-26 15:27:26 +0800 CST

Como listar serviços que estão apenas na predefinição "desativado" via systemctl?

  • 7

Quero saber quais serviços não iniciam automaticamente com a inicialização do sistema porque PRESETo modo é disabledvia systemctl list-unit-files.

Ambos os comandos produzem uma mensagem de erro:

systemctl list-unit-files --no-pager --preset=disabled
systemctl list-unit-files --no-pager --preset-mode=disabled

Mensagem de erro:

Failed to parse preset mode: disabled.
systemd
  • 2 respostas
  • 71 Views
Martin Hope
metablaster
Asked: 2025-03-15 20:16:56 +0800 CST

É seguro limpar (excluir) referências a unidades systemd ausentes?

  • 5

Listar serviços ausentes

systemctl --state=not-found --all

Saída:

      UNIT                           LOAD      ACTIVE   SUB  DESCRIPTION                   
● boot.automount                 not-found inactive dead boot.automount                
● home.mount                     not-found inactive dead home.mount
● tmp.mount                      not-found inactive dead tmp.mount                     
● connman.service                not-found inactive dead connman.service
● console-screen.service         not-found inactive dead console-screen.service
● dpdk.service                   not-found inactive dead dpdk.service
● fcoe.service                   not-found inactive dead fcoe.service
● firewalld.service              not-found inactive dead firewalld.service
● haveged.service                not-found inactive dead haveged.service
● ip6tables.service              not-found inactive dead ip6tables.service
● iptables.service               not-found inactive dead iptables.service
● iscsi-shutdown.service         not-found inactive dead iscsi-shutdown.service
● iscsi.service                  not-found inactive dead iscsi.service
● iscsid.service                 not-found inactive dead iscsid.service
● kbd.service                    not-found inactive dead kbd.service
● rbdmap.service                 not-found inactive dead rbdmap.service
● systemd-hwdb-update.service    not-found inactive dead systemd-hwdb-update.service
● systemd-oomd.service           not-found inactive dead systemd-oomd.service
● systemd-update-done.service    not-found inactive dead systemd-update-done.service
● systemd-vconsole-setup.service not-found inactive dead systemd-vconsole-setup.service
● xencommons.service             not-found inactive dead xencommons.service
● xendomains.service             not-found inactive dead xendomains.service            
● virtlxcd.socket                not-found inactive dead virtlxcd.socket
● virtqemud.socket               not-found inactive dead virtqemud.socket
● virtvboxd.socket               not-found inactive dead virtvboxd.socket
● virtvzd.socket                 not-found inactive dead virtvzd.socket
● virtxend.socket                not-found inactive dead virtxend.socket

Encontre unidades que fazem referência a serviços ausentes

grep -rR "<service_name>" /usr/lib/systemd
grep -rR "<service_name>" /etc/systemd

# See tables in man page for more directories to search with grep and to learn their purpose
man systemd.unit

Amostra paratmp.mount

grep -rR "tmp.mount" /usr/lib/systemd
grep -rR "tmp.mount" /etc/systemd

Saída:

/usr/lib/systemd/system/basic.target:After=sysinit.target sockets.target paths.target slices.target tmp.mount
/usr/lib/systemd/system/basic.target:Wants=tmp.mount

Limpar referências

sudo nano /usr/lib/systemd/system/basic.target

Conteúdo:

[Unit]
Description=Basic System
Documentation=man:systemd.special(7)
Requires=sysinit.target
Wants=sockets.target timers.target paths.target slices.target
After=sysinit.target sockets.target paths.target slices.target tmp.mount

RequiresMountsFor=/var /var/tmp
Wants=tmp.mount

Aqui encontramos tmp.mountabaixo After=eWants=

Quero excluir essas entradas para que systemctl --state=not-found --allnão sejam mais listadas, e assim por diante para cada unidade ausente.

Pergunta

É seguro excluir essas entradas para cada unidade ausente no sistema?

systemd
  • 1 respostas
  • 34 Views
Martin Hope
Stewart
Asked: 2025-03-04 19:20:35 +0800 CST

O resultado oom-kill do systemd reflete um "sinal impuro" ou um "código de saída impuro"?

  • 6

Um serviço meu morreu recentemente devido a oom-kill.

$ systemctl status my-server.service
● my-server.service - "General purposes load-independent HTTP server"
     Loaded: loaded (/lib/systemd/system/my-server.service; enabled; vendor preset: enabled)
     Active: failed (Result: oom-kill) since Thu 2025-02-27 12:47:44 CST; 17h ago
    Process: 636 ExecStart=/usr/bin/my-server --listen-http :13668 --threads 10 (code=exited, status=0/SUCCESS)
   Main PID: 636 (code=exited, status=0/SUCCESS)
        CPU: 52min 57.893s

Feb 27 12:47:44 ios systemd[1]: my-server.service: A process of this unit has been killed by the OOM killer.
Feb 27 12:47:44 ios my-server[636]: Received signal to stop (15). Stopping...
Feb 27 12:47:44 ios systemd[1]: my-server.service: Failed with result 'oom-kill'.
Feb 27 12:47:44 ios systemd[1]: my-server.service: Consumed 52min 57.893s CPU time.

man systemd.execdiz $SERVICE_RESULTque está definido para oom-killquando "Um processo de serviço foi encerrado pelo assassino de falta de memória (OOM)".

Este foi um vazamento de memória em um processo filho de longa duração de /usr/bin/my-server. Quando isso acontece, eu gostaria de Restart=o serviço.

A questão:

Isso $SERVICE_RESULT=oom-killaciona um código de saída impuro ou um sinal impuro?

Gostaria de limitar Restart=o máximo possível. Assim, gostaria de escolher a primeira condição que atende aos oom-killcritérios da lista abaixo:

  • Restart=on-abortpode ser usado se for um sinal impuro.
  • Restart=on-abormalpode ser usado para o caso acima, ou se acionar a causa de tempo limite ou causa de watchdog (provavelmente não aplicável).
  • Restart=on-failurefunciona para todos os casos acima, além de um código de saída impuro.
  • Restart=alwaysteoricamente cobre tudo

De man systemd.service:

Table 2. Exit causes and the effect of the Restart= settings
┌──────────────────────┬────┬────────┬────────────┬────────────┬─────────────┬──────────┬─────────────┐
│Restart settings/Exit │ no │ always │ on-success │ on-failure │ on-abnormal │ on-abort │ on-watchdog │
│causes                │    │        │            │            │             │          │             │
├──────────────────────┼────┼────────┼────────────┼────────────┼─────────────┼──────────┼─────────────┤
│Clean exit code or    │    │ X      │ X          │            │             │          │             │
│signal                │    │        │            │            │             │          │             │
├──────────────────────┼────┼────────┼────────────┼────────────┼─────────────┼──────────┼─────────────┤
│Unclean exit code     │    │ X      │            │ X          │             │          │             │
├──────────────────────┼────┼────────┼────────────┼────────────┼─────────────┼──────────┼─────────────┤
│Unclean signal        │    │ X      │            │ X          │ X           │ X        │             │
├──────────────────────┼────┼────────┼────────────┼────────────┼─────────────┼──────────┼─────────────┤
│Timeout               │    │ X      │            │ X          │ X           │          │             │
├──────────────────────┼────┼────────┼────────────┼────────────┼─────────────┼──────────┼─────────────┤
│Watchdog              │    │ X      │            │ X          │ X           │          │ X           │
└──────────────────────┴────┴────────┴────────────┴────────────┴─────────────┴──────────┴─────────────┘
systemd
  • 1 respostas
  • 27 Views
Martin Hope
Ali Sarbanha
Asked: 2025-02-15 03:23:16 +0800 CST

O SpamAssassin não funciona com o Systemd, mas funciona na CLI

  • 5

Estou tentando configurar o SpamAssassin no meu servidor de e-mail (Rocky Linux 9.5). Apenas uma configuração básica!

Esta é a variável de opções em /etc/sysconfig/spamassassin:

SPAMDOPTIONS="-d -c -m5 -H --create-prefs --max-children 2 -u spamd -g spamd --socketpath=/var/lib/spamassassin/spamd.sock --socketowner=spamd --socketgroup=spamd --socketmode=0666 -s /var/log/spamd.log --debug"

--debugfoi adicionada a temporalidade

Quando inicio o SpamAssassin usando systemctl, ele sai com erros aleatórios e o systemd o reinicia novamente, coloquei o log truncado abaixo:

.
.
Fri Feb 14 19:59:03 2025 [2133] info: spamd: server successfully spawned child process, pid 2135
Fri Feb 14 19:59:03 2025 [2133] dbg: prefork: child 2135: entering state 0
Fri Feb 14 19:59:03 2025 [2133] dbg: prefork: new lowest idle kid: none
Fri Feb 14 19:59:03 2025 [2135] dbg: spamd: Privilege de-escalation from user 0 and groups 0
Fri Feb 14 19:59:03 2025 [2135] dbg: spamd: setgid ERRNO is 
Fri Feb 14 19:59:03 2025 [2135] dbg: util: get_user_groups: uid is 98
Fri Feb 14 19:59:03 2025 [2133] info: spamd: server successfully spawned child process, pid 2136
Fri Feb 14 19:59:03 2025 [2133] dbg: prefork: child 2136: entering state 0
Fri Feb 14 19:59:03 2025 [2133] dbg: prefork: new lowest idle kid: none
Fri Feb 14 19:59:03 2025 [2136] dbg: spamd: Privilege de-escalation from user 0 and groups 0
Fri Feb 14 19:59:03 2025 [2136] dbg: spamd: setgid ERRNO is 
Fri Feb 14 19:59:03 2025 [2136] dbg: util: get_user_groups: uid is 98
Fri Feb 14 19:59:03 2025 [2133] info: spamd: server killed by SIGTERM, shutting down
Fri Feb 14 19:59:04 2025 [2137] dbg: logger: successfully added file method
.
.

Decidi usar o seguinte comando e executá-lo tanto spamdem cliprimeiro plano quanto no daemonizado. Funcionou perfeitamente!

sudo -u spamd -- spamd -c -m5 -H --create-prefs --max-children 2 -u spamd -g spamd --socketpath=/var/lib/spamassassin/spamd.sock --socketowner=spamd --socketgroup=spamd --socketmode=0666 -s /var/log/spamd.log --debug

Também funciona corretamente sem sudo!

Alguém já teve problemas semelhantes com o SpamAssassin ou qualquer outro serviço?

systemd
  • 1 respostas
  • 16 Views
Martin Hope
Thomas P
Asked: 2025-02-12 23:54:48 +0800 CST

Systemd, PrivateTmp e JoinsNamespaceOf

  • 5

Temos três serviços com PrivateTmp=yes( tomcat, clamde soffice). clamde sofficedefinimos JoinsNamespaceOf=tomcat.service.

clamddeveria ser capaz de ler tudo que tomcatescreve nele /tmp, certo?

Existe uma chance (por exemplo, reinicialização de serviços) de que essa junção seja interrompida em tempo de execução (por exemplo, clamdperdendo a capacidade de leitura tomcat's /tmp)?

Como posso verificar em tempo de execução se essa junção existe (ainda está funcionando)?

Tentei usar lsnse lsns NSver alguma relação, mas não consegui reconhecer nada.

systemd
  • 1 respostas
  • 22 Views
Martin Hope
luziferius
Asked: 2025-02-11 22:39:12 +0800 CST

Como iniciar automaticamente um aplicativo GUI ao conectar um dispositivo USB?

  • 4

Quero iniciar automaticamente um aplicativo GUI, sempre que eu conectar um determinado dispositivo USB. Quando iniciado, o aplicativo roda em primeiro plano e não deve rodar como root.

Como posso fazer isso?

No meu caso específico, quero executar o Yubico Authenticator sempre que conectar meu token de hardware Yubikey USB FIDO2/TOTP.

systemd
  • 1 respostas
  • 34 Views

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Possível firmware ausente /lib/firmware/i915/* para o módulo i915

    • 3 respostas
  • Marko Smith

    Falha ao buscar o repositório de backports jessie

    • 4 respostas
  • Marko Smith

    Como exportar uma chave privada GPG e uma chave pública para um arquivo

    • 4 respostas
  • Marko Smith

    Como podemos executar um comando armazenado em uma variável?

    • 5 respostas
  • Marko Smith

    Como configurar o systemd-resolved e o systemd-networkd para usar o servidor DNS local para resolver domínios locais e o servidor DNS remoto para domínios remotos?

    • 3 respostas
  • Marko Smith

    apt-get update error no Kali Linux após a atualização do dist [duplicado]

    • 2 respostas
  • Marko Smith

    Como ver as últimas linhas x do log de serviço systemctl

    • 5 respostas
  • Marko Smith

    Nano - pule para o final do arquivo

    • 8 respostas
  • Marko Smith

    erro grub: você precisa carregar o kernel primeiro

    • 4 respostas
  • Marko Smith

    Como baixar o pacote não instalá-lo com o comando apt-get?

    • 7 respostas
  • Martin Hope
    user12345 Falha ao buscar o repositório de backports jessie 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl Por que a maioria dos exemplos do systemd contém WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky Como exportar uma chave privada GPG e uma chave pública para um arquivo 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll status systemctl mostra: "Estado: degradado" 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim Como podemos executar um comando armazenado em uma variável? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S Por que /dev/null é um arquivo? Por que sua função não é implementada como um programa simples? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 Como ver as últimas linhas x do log de serviço systemctl 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - pule para o final do arquivo 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla Por que verdadeiro e falso são tão grandes? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis Substitua a string em um arquivo de texto enorme (70 GB), uma linha 2017-12-30 06:58:33 +0800 CST

Hot tag

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve