从干净的 ubuntu 安装下载单个文件

Bil*_*oon 2 ubuntu

互联网上是否有资源,我可以在那里下载我在 ubuntu 服务器安装中需要的单个文件?

在这种情况下,我需要一个干净的/etc/grub.d/00_headerUbuntu 服务器 12.04版本。有时我想获得一个文件的干净版本,用于特定的 linux 版本。

除了在其他地方再次安装 ubuntu 并从那里复制文件之外,我将如何获取我需要的文件?


我做了一个apt-get upgrade希望新版本的 grub 替换有问题的版本,并得到这个错误。据我了解,更新后的 grub 应该替换旧的(我选择使用 /etc/defualt/grub 的包维护者版本),因此解析后的错误与新的 grub 版本有关,而不是我的本地版本。那是对的吗?

Replacing config file /etc/default/grub with new version                                                                                                                             
/usr/sbin/grub-setup: warn: Sector 32 is already in use by FlexNet; avoiding it.  This software may cause boot or other problems in future.  Please ask its authors not to store data in the boot track.
/usr/sbin/grub-setup: warn: Sector 33 is already in use by FlexNet; avoiding it.  This software may cause boot or other problems in future.  Please ask its authors not to store data in the boot track.
Installation finished. No error reported.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-29-generic-pae
Found initrd image: /boot/initrd.img-3.2.0-29-generic-pae
Found linux image: /boot/vmlinuz-3.2.0-25-generic-pae
Found initrd image: /boot/initrd.img-3.2.0-25-generic-pae
Found linux image: /boot/vmlinuz-3.2.0-23-generic-pae
Found initrd image: /boot/initrd.img-3.2.0-23-generic-pae
Found memtest86+ image: /boot/memtest86+.bin
error: syntax error.
error: Incorrect command.
error: syntax error.
error: line no: 32
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.
done
Run Code Online (Sandbox Code Playgroud)

ger*_*ijk 5

虽然@cjc 为包管理提供的一般文件提供了一种低级方法,但配置文件有一种更简洁的方法。这里的关键是这个问题的--force-confmiss答案中解释的选项。

这是文件的示例/etc/dnsmasq.conf

确定它所属的二进制包

运行例如 /etc/dnsmasq.conf

# dpkg -S /etc/dnsmasq.conf
dnsmasq: /etc/dnsmasq.conf
Run Code Online (Sandbox Code Playgroud)

这意味着您必须获得该dnsmasq包裹。

下载正确的 .deb 包

例如:

$ aptitude download dnsmasq
Get:1 http://ftp.nl.debian.org/debian/ squeeze/main dnsmasq all 2.55-2 [14.2 kB]
Fetched 14.2 kB in 0s (190 kB/s)

$ ls
dnsmasq_2.55-2_all.deb
Run Code Online (Sandbox Code Playgroud)

让dpkg替换你想要的文件

首先删除您需要重置为默认值的文件。

# rm /etc/dnsmasq.conf
# dpkg -i --force-confmiss dnsmasq_2.55-2_all.deb
Run Code Online (Sandbox Code Playgroud)