AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题

问题[lxc](ubuntu)

Martin Hope
SteeveDroz
Asked: 2022-04-10 22:06:56 +0800 CST

为什么 pandoc 不在 LXC 容器中生成目录?

  • 0

我对 pandoc 没有生成正确的目录有疑问。

这是我的工作流程:

  1. 我创建了一个包含网页内容的 Markdown 文件。
  2. 我用 Git 对我的项目进行版本控制。
  3. 我git push到我的自托管 GitLab 服务器。
  4. 使用 CI/CD,我的服务器在 Ubuntu/bionic LXC 容器中运行 3 个脚本。
    1. 第一个提取元数据。
    2. 第二个调用 pandoc 生成一个带有页眉、页脚、目录和 CSS 的 HTML 页面。
    3. 第三个将新的 HTML 页面推送到我的生产服务器。

除了一个小细节之外,一切都完美无缺:当 pandoc 生成 HTML 时,缺少目录。奇怪的是,当我在本地机器(Fedora 34)上运行它时它可以工作。

这是我在第二个容器中运行的脚本(事先没有安装任何东西):

apt-get update
apt-get install -y python3 pandoc pandoc-citeproc
mkdir -p build
python3 .deploy/convert.py

您可以在下面找到脚本的结果。

注意:在 LXC 容器中,用户是 root,不需要sudo.

内容.deploy/convert.py:

import sys
import os
import re
from pathlib import Path

if __name__ == '__main__':
    with open('data/type', 'r') as f:
        type = f.readline()
    with open('data/number', 'r') as f:
        number = f.readline()
    with open('data/name', 'r') as f:
        name = f.readline()

    result = list(Path(".").rglob("*.md"))
    for file in result:
        parts = str(file).split('.')
        parts.pop()
        filename = '.'.join(parts)
        if filename != 'README':
            parts = str(filename).split('/')
            parts.pop()
            directory = '/'.join(parts)
            os.system('mkdir -p build/' + directory)

            # This is the important line!
            os.system('pandoc --toc --metadata title=' + type + '-' + number +
                      ' --metadata type=' + type +
                      ' --metadata number=' + number +
                      ' --metadata name="' + name +
                      '" -s --template .deploy/template.html ' +
                      str(file) +
                      ' -o build/' + filename + '.html'
            )

            with open('build/' + filename + '.html', 'r') as f:
                filedata = f.read()
            filedata = re.sub('href="(.*)\.md"', 'href="\\1.html"', filedata)
            with open('build/' + filename + '.html', 'w') as f:
                f.write(filedata)

这 3 个容器是按顺序调用的,在它们之间留下所谓的工件:它们是可以传递给下一个容器的文件。我在转换容器之前和之后检查了工件,唯一缺少的部分是目录。

我错过了什么?

这是我从脚本中得到的结果。同样,即使您看到$而不是,也要#知道我是 root!

$ apt-get update
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:5 https://packagecloud.io/github/git-lfs/ubuntu bionic InRelease
Reading package lists...
$ apt-get install -y python3 pandoc
Reading package lists...
Building dependency tree...
Reading state information...
python3 is already the newest version (3.6.7-1~18.04).
python3 set to manually installed.
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
  liblua5.1-0 libluajit-5.1-2 libluajit-5.1-common pandoc-data
Suggested packages:
  texlive-latex-recommended texlive-xetex texlive-luatex pandoc-citeproc
  texlive-latex-extra context wkhtmltopdf
The following NEW packages will be installed:
  liblua5.1-0 libluajit-5.1-2 libluajit-5.1-common pandoc pandoc-data
0 upgraded, 5 newly installed, 0 to remove and 13 not upgraded.
Need to get 7103 kB of archives.
After this operation, 53.7 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 liblua5.1-0 amd64 5.1.5-8.1build2 [100 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libluajit-5.1-common all 2.1.0~beta3+dfsg-5.1 [44.3 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libluajit-5.1-2 amd64 2.1.0~beta3+dfsg-5.1 [227 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic/universe amd64 pandoc-data all 1.19.2.4~dfsg-1build4 [40.1 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 pandoc amd64 1.19.2.4~dfsg-1build4 [6692 kB]
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
Fetched 7103 kB in 1s (5904 kB/s)
dpkg-preconfigure: unable to re-open stdin: 
Selecting previously unselected package liblua5.1-0:amd64.
(Reading database ... 29084 files and directories currently installed.)
Preparing to unpack .../liblua5.1-0_5.1.5-8.1build2_amd64.deb ...
Unpacking liblua5.1-0:amd64 (5.1.5-8.1build2) ...
Selecting previously unselected package libluajit-5.1-common.
Preparing to unpack .../libluajit-5.1-common_2.1.0~beta3+dfsg-5.1_all.deb ...
Unpacking libluajit-5.1-common (2.1.0~beta3+dfsg-5.1) ...
Selecting previously unselected package libluajit-5.1-2:amd64.
Preparing to unpack .../libluajit-5.1-2_2.1.0~beta3+dfsg-5.1_amd64.deb ...
Unpacking libluajit-5.1-2:amd64 (2.1.0~beta3+dfsg-5.1) ...
Selecting previously unselected package pandoc-data.
Preparing to unpack .../pandoc-data_1.19.2.4~dfsg-1build4_all.deb ...
Unpacking pandoc-data (1.19.2.4~dfsg-1build4) ...
Selecting previously unselected package pandoc.
Preparing to unpack .../pandoc_1.19.2.4~dfsg-1build4_amd64.deb ...
Unpacking pandoc (1.19.2.4~dfsg-1build4) ...
Setting up libluajit-5.1-common (2.1.0~beta3+dfsg-5.1) ...
Setting up pandoc-data (1.19.2.4~dfsg-1build4) ...
Setting up libluajit-5.1-2:amd64 (2.1.0~beta3+dfsg-5.1) ...
Setting up liblua5.1-0:amd64 (5.1.5-8.1build2) ...
Setting up pandoc (1.19.2.4~dfsg-1build4) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.5) ...
$ mkdir -p build
$ python3 .deploy/convert.py
Uploading artifacts for successful job 00:01
Uploading artifacts...
Runtime platform                                    arch=amd64 os=linux pid=1620 revision=bd40e3da version=14.9.1
build: found 2 matching files and directories      
untracked: found 4 files                           
Uploading artifacts as "archive" to coordinator... 201 Created  id=3380 responseStatus=201 Created token=WHTmbFcM
Cleaning up file based variables 00:00
Job succeeded
lxc
  • 1 个回答
  • 38 Views
Martin Hope
mcandril
Asked: 2020-08-18 05:26:03 +0800 CST

incron 作业不写入临时目录

  • 1

我有一个非常奇怪的问题,我可能没有正确煮熟,但我尝试了一个最小的例子:

在 20.04 的 20.04 lxd 容器中,我正在尝试运行由 incron 触发的作业。对于我的最小示例,这是我的 incron 行:

/home/scanfiler/test    IN_CLOSE_WRITE  /home/scanfiler/test.sh &>> /tmp/log-scanfiler-test

这是我的测试脚本

#!/bin/bash
logger "Starting"
touch /tmp/test/test-$(date +%s)-1
touch ~/test_out/test-$(date +%s)-1
sleep 20
touch /tmp/test/test-$(date +%s)-2
touch ~/test_out/test-$(date +%s)-2
logger "Done"

我正在写入日志,然后在主文件夹中创建一个文件,在 tmp 文件夹中创建一个文件,然后等待 20 秒(这让我有时间在运行时检查,以防 tmp 以某种方式立即被清除),然后我正在写入更多文件。

这就是发生的事情:

scanfiler ~scanfiler # rm test/testblah && touch test/testblah
scanfiler ~scanfiler # journalctl -xe|tail
Aug 17 14:59:26 scanfiler incrond[2526]: PATH (/home/scanfiler/test) FILE (testblah) EVENT (IN_CLOSE_WRITE)
Aug 17 14:59:26 scanfiler incrond[2526]: (scanfiler) CMD (/home/scanfiler/test.sh &>> /tmp/log-scanfiler-test)
Aug 17 14:59:26 scanfiler scanfiler[1250558]: Starting
scanfiler ~scanfiler # 
scanfiler ~scanfiler # ls /tmp/test 
scanfiler ~scanfiler # ls test_out 
test-1597669166-1
scanfiler ~scanfiler # journalctl -xe|tail
Aug 17 14:59:26 scanfiler incrond[2526]: PATH (/home/scanfiler/test) FILE (testblah) EVENT (IN_CLOSE_WRITE)
Aug 17 14:59:26 scanfiler incrond[2526]: (scanfiler) CMD (/home/scanfiler/test.sh &>> /tmp/log-scanfiler-test)
Aug 17 14:59:26 scanfiler scanfiler[1250558]: Starting
scanfiler ~scanfiler # journalctl -xe|tail
Aug 17 14:59:26 scanfiler incrond[2526]: PATH (/home/scanfiler/test) FILE (testblah) EVENT (IN_CLOSE_WRITE)
Aug 17 14:59:26 scanfiler incrond[2526]: (scanfiler) CMD (/home/scanfiler/test.sh &>> /tmp/log-scanfiler-test)
Aug 17 14:59:26 scanfiler scanfiler[1250558]: Starting
Aug 17 14:59:46 scanfiler scanfiler[1250627]: Done
scanfiler ~scanfiler # ls /tmp/test       
scanfiler ~scanfiler # ls test_out                                
test-1597669166-1  test-1597669186-2
scanfiler ~scanfiler # ls /tmp/log-scanfiler-test
ls: cannot access '/tmp/log-scanfiler-test': No such file or directory

如您所见,即使在运行时,也不会创建 tmp 文件,而主目录中的文件就在那里。最终,甚至应该在 tmp 中的日志文件都不存在。当由同一用户在控制台中运行时,一切正常,因此我的 tmp 权限可能不会以某种方式被破坏。

谁能告诉我这里发生了什么?我的脚本中有更多奇怪的问题(在控制台中运行时运行良好),但也许它们是相关的,所以我想先解决这个问题。

permissions tmp lxc lxd
  • 1 个回答
  • 139 Views
Martin Hope
oᴉɹǝɥɔ
Asked: 2020-06-08 22:12:10 +0800 CST

无法移除 core18 snap

  • 8

我正在清理我新安装的 Ubuntu 20.04,但我似乎无法删除core18snap。

$ snap list
Name    Version   Rev    Tracking         Publisher   Notes
core18  20200427  1754   latest/stable    canonical✓  base
lxd     4.1       15359  latest/stable/…  canonical✓  -
snapd   2.45      7777   latest/stable    canonical✓  snapd

$ snap remove core18 
error: cannot remove "core18": snap "core18" is not removable: snap is being used by snap lxd.

什么是core18,为什么我如此需要它以至于它不会让我删除它?我发现的大多数在线参考资料都说它适用于物联网或嵌入式设备。由于我的工作站就是这样一个设备,我不明白我为什么需要它。我打算使用lxc容器,但为什么需要这样做core18?

ubuntu-core snap lxc lxd
  • 1 个回答
  • 10859 Views
Martin Hope
craig
Asked: 2020-05-21 06:29:00 +0800 CST

系统不完全支持 snapd:无法使用“squashfs - mount failed”挂载 squashfs 映像

  • 9

我正在尝试使用 在我的 Ubuntu 实例上安装 PowerShell snap,但它会生成错误:

# sudo snap install powershell --classic
error: system does not fully support snapd: cannot mount squashfs image using "squashfs": mount:
       /tmp/sanity-mountpoint-072786794: mount failed: Operation not permitted.

我在 Turris Omnia 路由器上的 LXC 容器中运行 Ubuntu Eoan:

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 19.10
Release:    19.10
Codename:   eoan

# uname -m
armv7l

# snap --version
snap    2.42.1+19.10
snapd   2.42.1+19.10
series  16
ubuntu  19.10
kernel  4.14.162

我可以在/tmp.

这篇文章表明我至少需要内核 4.4.0-6.21;我有 4.14.162。

为什么会失败?

mount snap lxc 19.10
  • 1 个回答
  • 11421 Views
Martin Hope
Danial Behzadi
Asked: 2020-03-02 14:47:43 +0800 CST

用于 DNS 的 LXD 代理

  • 0

我在 LXD 实例中设置了一个绑定服务器,并尝试将所有 DNS 查询从主机转发到该实例。我试过这个:

sudo lxc config device add bind dnsdevicetcp proxy listen=tcp:0.0.0.0:53 connect=tcp:bind:53

但是 DNS 主要是 UDP 服务,当我尝试这样的事情时:

sudo lxc config device add bind dnsdeviceudp proxy listen=udp:0.0.0.0:53 connect=udp:bind:53

我会收到一个错误:

Error: Proxy device doesn't support the connection type: udp

如何正确转发查询?


主机:Ubuntu 服务器 18.04

没有虚拟化

LXC/LXD 版本:3.0.3

container port-forwarding lxc lxd
  • 1 个回答
  • 702 Views
Martin Hope
Zaman Oof
Asked: 2020-02-12 04:41:19 +0800 CST

安装社区服务器/文档服务器 onlyoffice 时出错

  • 1

当尝试仅安装基于那里的办公服务器时

sudo apt-get install onlyoffice-communityserver

得到这个错误:

The following packages have unmet dependencies: onlyoffice-communityserver :
Depends: mono-webserver-hyperfastcgi but it is not going to be installed
Depends: elasticsearch (= 6.5.0) but 7.2.0 is to be installed

当尝试安装 elasticsearch 6.5.0 时出现错误
https://discuss.elastic.co/t/install-of-apt-package-is-failing/150385/2

那么该怎么办?

mono nextcloud lxc 18.04 elasticsearch
  • 3 个回答
  • 1308 Views
Martin Hope
user47227
Asked: 2019-10-26 07:51:01 +0800 CST

升级到 19.10,LXD 将不再运行

  • 1

我最近升级到 19.10。

LXD 将不再运行,我收到此错误:

Error: Get http://unix.socket/1.0: dial unix /var/snap/lxd/common/lxd/unix.socket: connect: connection refused

我已经检查过 lxd 组在那里,我的用户是成员。

lxc lxd 19.10
  • 1 个回答
  • 375 Views
Martin Hope
N0rbert
Asked: 2019-05-13 06:34:38 +0800 CST

是否可以在 chroot 或容器中运行某些应用程序但允许 DBus 与主机系统交互?

  • 6

我需要在chroot(或容器)中运行旧版本的应用程序并允许 DBus 与主机系统交互。由于严重的依赖性问题,我无法在主机系统上安装此应用程序。

有关应用程序的完整详细信息:

  • 要容器化的应用程序是 GNOME Evolution 版本 3.2.3(来自 Ubuntu 12.04 LTS)
  • 主机系统是 Ubuntu MATE 16.04 LTS,它将运行 back-ported indicator-datetime-gtk2,通过 D-BUS 与容器化 Evolution 通信。

我希望它在技术上可以通过schroot绑定安装或 LXC/LXD 实现。

我应该如何设置这样的配置?

chroot 16.04 mate lxc lxd
  • 3 个回答
  • 1828 Views
Martin Hope
user1010573
Asked: 2019-04-17 00:03:44 +0800 CST

没有 vmlinux 的 Linux 容器 (LXC) 映像

  • 0

最近,我安装lxc并创建了一个 Ubuntu LXC 映像。

然后,我确实ls -a /看到了/图像内部的目录列表。

令我惊讶的是,在普通的 Linux 发行版中没有vmlinux或经常看到。vmlinuz

因此,我的问题是:如何在没有 vmlinux/z 的情况下启动 LXC 映像?

boot lxc syslinux
  • 2 个回答
  • 143 Views
Martin Hope
Colin 't Hart
Asked: 2019-03-01 02:04:12 +0800 CST

在 LXC 内运行的 Ubuntu 18.04 上尝试在控制台上以 root 身份登录时无法登录且没有密码提示

  • 0

我在运行 Proxmox 4.4-24 (Debian 8.11) 的几个节点中的 LXC 容器中安装了几个 Ubuntu 18.04.2。

在其中任何一个上,当我尝试在控制台上以 root 身份登录时,我输入“root”,按回车,几秒钟后我得到“登录不正确”。

以非 root 用户身份登录可以正常工作。

在运行 Proxmox 5.3-11 (Debian 9.8) 的多个节点中的 LXC 容器内的其他 Ubuntu 18.04.2 安装中,以 root 身份登录可以正常工作。

我什至如何开始调试这个问题?

password login virtual-console console lxc
  • 1 个回答
  • 3838 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve